Переглянути джерело

Re-add vim-unimpaired, Remove redundant settings

Unimpaired makes certain settings redundant.

Filebrowser - no need for `<leader>d` since we can use `-` to get the
current file in netrw, and have learnt to use the buffer list more.
Also, learn the very awesome `[f` & `]f` pair.

Quickfix - `<Tab>` and `<Backslash>` are now replaced with `[q` & `]q`.

Wrap and list toggles are `cow` and `col`. Scrollbind isn't really used.

SCM conflict marker search - use `[n` & `]n`.

Newline adding replaced with `[<Space>` & `]<Space>`. Also, learn to
exchange lines with `[e` & `]e` too.

Used to use 'o' in various places (quickfix, netrw) to open files,
but should learn to just use 'enter', and leave 'o' for opening in
splits.

Some unused settings files (like indentguides.vim) have been removed.
Weiyi Lou 10 роки тому
батько
коміт
ba2f8ae108

+ 1 - 0
vim/plugins.vim

@@ -23,6 +23,7 @@ Plug 'terryma/vim-multiple-cursors'
 Plug 'tpope/vim-endwise'
 Plug 'tpope/vim-fugitive'
 Plug 'tpope/vim-repeat'
+Plug 'tpope/vim-unimpaired'
 Plug 'vim-pandoc/vim-pandoc'
 Plug 'vim-scripts/visualrepeat'
 " }}}

+ 0 - 4
vim/settings/filebrowser.vim

@@ -1,9 +1,5 @@
 " Netrw - Vim's built-in file browser.
 
-" Open and close file browser with `<Leader>d`
-nmap <silent> <Leader>d :Explore<CR>
-autocmd FileType netrw map <silent> <buffer> <Leader>d :Rexplore<CR>
-
 " Open files and toggle folders with 'o' like in QuickFix.
 autocmd FileType netrw map <silent> <buffer> o <CR>
 

+ 1 - 2
vim/settings/folding.vim

@@ -8,8 +8,7 @@
 "    - Statbox to right displays line count and fold level.
 "    - SpaceBar toggles folds, if any.
 "        (much more convenient than the 'z' commands)
-"    - SPF13-VIM provides quick foldlevel setting map: <Leader>f[0-9]
-"        (useful with statbox lvl)
+"    - Quick foldlevel setting map: zf[0-9]
 "
 "   Note that custom foldtext will only work for vim 7.3+. For earlier
 "   versions of vim, only the colouring and spacebar mapping will take effect.

+ 0 - 6
vim/settings/indentguides.vim

@@ -1,6 +0,0 @@
-""""""""" Indent Guides
-let g:indent_guides_enable_on_vim_startup = 1
-let g:indent_guides_auto_colors = 0
-" reverse indent guides highlighting
-"highlight IndentGuidesOdd ctermbg=grey
-highlight IndentGuidesEven ctermbg=235

+ 0 - 19
vim/settings/keymaps.vim

@@ -1,19 +0,0 @@
-" Toggle keyboard layout
-"nnoremap <silent> <Leader><Space> :call CycleKeymap()<CR>
-
-"function! CycleKeymap()
-  "if has('keymap')
-    "if (&keymap == '')
-      "set keymap=colemak
-      "echo 'Colemak keymap selected'
-    "elseif (&keymap == 'colemak')
-      "set keymap=dvorak
-      "echo 'Dvorak keymap selected'
-    "else
-      "set keymap=
-      "echo 'Qwerty keymap selected'
-    "endif
-  "else
-    "echo 'Keymaps not supported'
-  "endif
-"endfunction

+ 0 - 58
vim/settings/quickfix.vim

@@ -1,49 +1,5 @@
-" Quickfix - Modeline and Notes {{{
-" vim: set sw=2 ts=2 sts=2 et tw=78 foldmarker={{{,}}} foldlevel=0 foldmethod=marker spell:
-"
-"   cinaeco/dotfiles Quickfix Maps and Behaviors
-"
-"   Some personal conventions:
-"    - 'q' to close quickfix and location list windows.
-"    - 'o' to open quickfix and location list entries.
-"      (not all plugins have these maps)
-"    - <Tab> and <Bslash> for previous and next entries, so long as quickfix
-"    is open.
-"      (maps are cleared when quickfix is closed)
-"    - quickfix should open after any grep invocation e.g. :Glog
-"      (particularly for fugitive - tpope refuses this as default behaviour)
-"
-"   TODO:
-"    Perhaps this could be some less arbitrary rule?
-"
-" }}}
-
 if has("autocmd")
 
-  " Quickfix Buffer remaps, 'q' and 'o'. {{{
-  "  - `q` to close qf buffer.
-  "  - `o` to open location entry under cursor.
-  autocmd FileType qf nnoremap <silent> <buffer> q :ccl<CR>:lcl<CR>
-  autocmd FileType qf nnoremap <silent> <buffer> o <CR>
-  " }}}
-
-  " Global maps on qf window open, '<Tab>' and '<Bslash>'. {{{
-  "  - `<Tab>` and `<Bslash>` for going to previous and next entry
-  "  - unmaps when qf buffer is closed.
-  autocmd BufWinEnter quickfix
-        \ setlocal nocursorline |
-        \ let g:qfix_win = bufnr("$") |
-        \ call MapQfPrevNext()
-  " }}}
-
-  " Global map removal on qf window close. {{{
-  autocmd BufWinLeave *
-        \ if exists("g:qfix_win") && expand("<abuf>") == g:qfix_win |
-        \   unlet! g:qfix_win |
-        \   call UnmapQfPrefNext() |
-        \ endif
-  " }}}
-
   " Open quickfix window after any grep invocation (Glog and Ggrep). {{{
   autocmd QuickFixCmdPost *grep* cwindow |
         \ setlocal nocursorline |
@@ -51,18 +7,4 @@ if has("autocmd")
         \ call MapQfPrevNext()
   " }}}
 
-  " <Tab> and <Bslash> map adding helper. {{{
-  function! MapQfPrevNext()
-    execute "nmap <silent> <tab> :cprev<CR>"
-    execute "nmap <silent> <bslash> :cnext<CR>"
-  endfunction
-  " }}}
-
-  " <Tab> and <Bslash> map removal helper. {{{
-  function! UnmapQfPrefNext()
-    execute "nunmap <tab>"
-    execute "nunmap <bslash>"
-  endfunction
-  " }}}
-
 endif

+ 0 - 4
vim/settings/tagbar.vim

@@ -1,4 +0,0 @@
-nnoremap <silent> <Leader>t :TagbarToggle<CR>
-
-" Close sidebar after we go to selection
-let g:tagbar_autoclose = 1

+ 6 - 10
vim/settings/toggles.vim

@@ -2,17 +2,13 @@
 nnoremap <silent> <F2> :set paste! paste?<CR>
 set pastetoggle=<F2>
 
-" Toggle text wrap
-nnoremap <silent> <F3> :set wrap! wrap?<CR>
-
-" Toggle visible whitespace characters
-nnoremap <silent> <Leader>l :set list! list?<CR>
-
-" Toggle scrollbind for moving multiple splits in sync together
-nnoremap <silent> <Leader>s :set scrollbind! scrollbind?<CR>
-
 " Toggle line numbers
-nnoremap <silent> <Leader>n :set number! relativenumber! relativenumber?<CR>
+nnoremap <silent> <Leader>n :set number! relativenumber! number?<CR>
 
 " Toggle Undotree
 nnoremap <silent> <Leader>u :UndotreeToggle<CR>
+
+" Toggle Tagabar
+nnoremap <silent> <Leader>t :TagbarToggle<CR>
+" Close tagbar after we go to selection
+let g:tagbar_autoclose = 1

+ 0 - 3
vim/settings/version_control.vim

@@ -10,9 +10,6 @@ if has("autocmd")
   autocmd BufReadPost fugitive://* set bufhidden=delete
 endif
 
-" Search for conflict markers
-nnoremap <Leader>c /\v^[<\|=>]{7}( .*\|$)<CR>
-
 " Git commands with Fugitive
 nnoremap <silent> <Leader>gc :Gcommit -v<CR>
 nnoremap <silent> <Leader>gl :Glog<CR><CR>

+ 0 - 4
vim/settings/white_space.vim

@@ -16,9 +16,5 @@ function! StripTrailingWhitespace()
   call cursor(l, c)
 endfunction
 
-" Add extra lines up and down
-nnoremap <Leader>j o<Esc>k
-nnoremap <Leader>k O<Esc>j
-
 " Convert tabs to spaces
 nnoremap <silent> <Leader><Tab> :%s/<Tab>/  /g<CR>