let mapleader = " " noremap e :Ex noremap h :noh noremap :bnext noremap :bprevious noremap t :tabnext noremap c :Bclose:tabclosegT noremap zz noremap zz noremap q :e ~/buffer.md noremap j noremap k noremap h noremap l " Spelling suggestions (requires fzf) function! s:SpellReplace(word, choice) abort execute 'normal! ciw' . a:choice stopinsert endfunction function! s:SpellSuggest() abort let l:word = expand('') if empty(l:word) return endif call fzf#run(fzf#wrap({ \ 'source': spellsuggest(l:word, 25), \ 'sink': function('s:SpellReplace', [l:word]), \ 'options': ['--prompt', 'Spelling: ' . l:word . '> '] \ })) endfunction nnoremap s :call SpellSuggest() command! Bclose call BufcloseCloseIt() function! BufcloseCloseIt() let l:currentBufNum = bufnr("%") let l:alternateBufNum = bufnr("#") if buflisted(l:alternateBufNum) buffer # else bnext endif if bufnr("%") == l:currentBufNum new endif if buflisted(l:currentBufNum) execute("bdelete! ".l:currentBufNum) endif endfunction