From 593acd3a3f57224b6b195ebc519bc40983ac1382 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Sun, 17 Apr 2022 13:37:29 -0600 Subject: add vim config this is compatible both with nvim and vim --- .config/nvim/init.vim | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 .config/nvim/init.vim (limited to '.config/nvim/init.vim') diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100644 index 0000000..e220b2a --- /dev/null +++ b/.config/nvim/init.vim @@ -0,0 +1,89 @@ +if has('nvim') + " Neovim specific commands +else + " Standard vim specific commands +endif + +" Mutual commands after this +let mapleader=',' +set showcmd +syntax enable + +set background=dark +colorscheme dracula +highlight BadWhitespace ctermbg=red + +set title +set encoding=utf-8 +set number relativenumber +set cursorline +set clipboard+=unnamedplus + +filetype plugin indent on +set tabstop=4 +set shiftwidth=4 +set foldmethod=indent +set foldlevel=99 + +" es_mx not always supported +" set spelllang=es_mx,en_us +set spelllang=en_us +set showbreak=↪\ +set listchars=eol:↲,nbsp:␣,tab:»\ ,trail:•,precedes:⟨,extends:⟩ + + +" functions +" Toggle spellchecking +function! ToggleSpellCheck() + set spell! + if &spell + echo "Spellcheck ON" + else + echo "Spellcheck OFF" + endif +endfunction + +" Toggle listchars +function! ToggleListChars() + set list! + if &list + echo "Listchars ON" + else + echo "Listchars OFF" + endif +endfunction + +" keybindings +" reload vim +nmap :source ~/.config/nvim/init.vim + +" toggle relative line number +nmap :set number invrelativenumber + +" buffers +nnoremap gb :ls:buffer +nmap a :badd +nmap l :ls + +" split navigation +nmap h +nmap j +nmap k +nmap l +nnoremap :vertical resize -5 +nnoremap :resize +5 +nnoremap :resize -5 +nnoremap :vertical resize +5 + +" tab manipulation +nmap t :tabe +nmap y :tabclose + +" enable folding with the spacebar +nnoremap za + +" spell checking +nmap s :call ToggleSpellCheck() + +" listchars +nmap c :call ToggleListChars() -- cgit v1.2.3-54-g00ecf