commit 6e15fcf1166e81d8c2004a62e3355a16dafd0520
parent 9bfcbb01d543b6a418227a4b0f2da330ad2f9fd0
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Wed, 10 Apr 2019 09:39:15 +0200
Fix conditional binding of FZF commands
Diffstat:
1 file changed, 12 insertions(+), 30 deletions(-)
diff --git a/.vim/plugin/keybinds.vim b/.vim/plugin/keybinds.vim
@@ -93,21 +93,6 @@ end
"nnoremap <leader><CR> :terminal bash<CR>
nnoremap <leader><CR> :terminal<CR>
-if exists(':TmuxNavigateLeft')
- let g:tmux_navigator_no_mappings = 1
- nnoremap <silent> <C-h> :TmuxNavigateLeft<CR>
- nnoremap <silent> <C-j> :TmuxNavigateDown<CR>
- nnoremap <silent> <C-k> :TmuxNavigateUp<CR>
- nnoremap <silent> <C-l> :TmuxNavigateRight<CR>
-end
-
-" equal split size
-nnoremap <leader>= <C-w>=
-
-" bindings to git cmd
-"nmap <leader>g :Start git commit -a -v -S<CR>
-"nmap <leader>G :Start git commit -a -v -S && git push<CR>
-
" bindings to fugitive
nnoremap <leader>ga :Gwrite<CR>
nnoremap <leader>gm :Gmove
@@ -122,10 +107,6 @@ nnoremap <leader>gP :Gpull<CR>
inoremap jk <Esc>
inoremap lkj <Esc>:write<CR>
-" Improve navigation on wrapped lines
-"nnoremap j gj
-"nnoremap k gk
-
" Disable arrow keys
noremap <Left> <Nop>
noremap <Right> <Nop>
@@ -152,18 +133,19 @@ elseif executable("ag")
nnoremap <Leader>a :Ag<CR>
end
+nnoremap , :ls<CR>:buffer<Space>
" using fzf.vim
-if exists(':Buffers')
- nnoremap , :Buffers<CR>
-else
- nnoremap , :ls<CR>:buffer<Space>
-end
-nnoremap <leader>o :History<CR>
-nnoremap <leader>f :Files<CR>
-nnoremap <leader>F :GFiles<CR>
-nnoremap <leader>l :Lines<CR>
-nnoremap <leader>L :BLines<CR>
-nnoremap <leader>t :Tags<CR>
+augroup FzfBinds
+ autocmd VimEnter * if exists(":Buffers") |
+ \ exe "nnoremap , :Buffers<CR>" |
+ \ exe "nnoremap <leader>o :History<CR>" |
+ \ exe "nnoremap <leader>f :Files<CR>" |
+ \ exe "nnoremap <leader>F :GFiles<CR>" |
+ \ exe "nnoremap <leader>l :Lines<CR>" |
+ \ exe "nnoremap <leader>L :BLines<CR>" |
+ \ exe "nnoremap <leader>t :Tags<CR>" |
+ \ endif
+augroup end
" Copy and paste to system clipboard with <Space>v and <Space>y
xnoremap <Leader>y "+y