Last active
March 21, 2021 03:34
-
-
Save creativenull/0429aee83caba01a2176c8527ca4d8fb to your computer and use it in GitHub Desktop.
Simple init.vim config file for converting into init.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ============================================================================= | |
" = Utils/Functions = | |
" ============================================================================= | |
function! CursorMode() abort | |
if mode() == 'n' | |
return 'NORMAL' | |
elseif mode() == 'i' | |
return 'INSERT' | |
elseif mode() == 'c' | |
return 'COMMAND' | |
elseif mode() == 'v' || mode() == 'V' || mode() == '' | |
return 'VISUAL' | |
elseif mode() == 'R' || mode() == 'Rv' || mode() == 'Rx' | |
return 'REPLACE' | |
endif | |
endfunction | |
" ============================================================================= | |
" = Auto Commands = | |
" ============================================================================= | |
augroup set_invisible_chars | |
au! | |
au FileType help set nolist | |
au FileType fzf set nolist | |
augroup end | |
" ============================================================================= | |
" = Plugins = | |
" ============================================================================= | |
call plug#begin(stdpath('data') . '/plugged') | |
Plug 'tpope/vim-surround' | |
Plug 'srcery-colors/srcery-vim' | |
call plug#end() | |
" ============================================================================= | |
" = Theming and Looks = | |
" ============================================================================= | |
set number | |
set relativenumber | |
set termguicolors | |
colorscheme srcery | |
" ============================================================================= | |
" = Options = | |
" ============================================================================= | |
" Completion options | |
set completeopt=menuone,noinsert,noselect | |
set updatetime=100 | |
" Search options | |
set ignorecase | |
set smartcase | |
set expandtab | |
set wrapscan | |
" Indent options | |
set tabstop=4 | |
set shiftwidth=0 | |
set softtabstop=4 | |
set expandtab | |
set smartindent | |
" Line options | |
set showmatch | |
set showbreak=+++ | |
set textwidth=120 | |
set scrolloff=5 | |
set linebreak | |
set colorcolumn=120 | |
set signcolumn='yes' | |
" Move swapfiles and backupfiles into ~/.cache | |
set swapfile | |
set directory=expand('$HOME/.cache/nvim') | |
set backup | |
set backupdir=expand('$HOME/.cache/nvim') | |
" Undo even after closing vim | |
set undofile | |
set undodir=expand('$HOME/.cache/nvim') | |
set undolevels=10000 | |
set history=10000 | |
" Enable a little bit performance | |
set lazyredraw | |
" Buffers/Tabs/Windows | |
set hidden | |
" Backspace Behaviour | |
set backspace=indent,eol,start | |
" Status line | |
set noshowmode | |
set statusline=\ %{CursorMode()} %{expand("%:t")} %m%y %=%l/%L\ | |
" Better command display | |
set cmdheight=2 | |
set list | |
set listchars=tab:▸\ ,trail:·,space:· | |
" ============================================================================= | |
" = Keybindings = | |
" ============================================================================= | |
" Leader key | |
let mapleader=' ' | |
" Map Esc, to perform quick switching between Normal and Insert mode | |
inoremap jk <ESC> | |
" Open built-in file explorer | |
nnoremap <F3> :Ex<CR> | |
" Edit vimrc | |
nnoremap <leader>ve :edit $MYVIMRC<CR> | |
" Source the vimrc to reflect changes | |
nnoremap <leader>vs :source $MYVIMRC<CR> | |
" ============================================================================= | |
" = Commands = | |
" ============================================================================= | |
command! Config edit $MYVIMRC | |
command! ConfigReload source $MYVIMRC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment