Forráskód Böngészése

Add vim asterisk improvements, change leader to space

Vim setting capitalisation is also more standardised, and the paste and wrap
toggles are assigned to <F2> and <F3> to make way for other shortcuts.
Weiyi Lou 10 éve
szülő
commit
3968b47abd

+ 10 - 0
vim/settings/asterisk.vim

@@ -0,0 +1,10 @@
+" vim-asterisk
+" Improved * and # behaviour
+"  - cursor does not immediately jump
+"  - relative cursor position across */# searches remain
+"  - works with visual selection
+map *  <Plug>(asterisk-z*)
+map #  <Plug>(asterisk-z#)
+map g* <Plug>(asterisk-gz*)
+map g# <Plug>(asterisk-gz#)
+let g:asterisk#keeppos = 1

+ 5 - 2
vim/settings/ctrlp.vim

@@ -1,5 +1,4 @@
-" Function definition jumping with CtrlP's Funky plugin
-nnoremap <silent> <C-F> :CtrlPFunky<CR>
+let g:ctrlp_map = '<Leader>p'
 
 "let g:ctrlp_working_path_mode = 'rw' let's try out ra
 let g:ctrlp_user_command = {
@@ -9,4 +8,8 @@ let g:ctrlp_user_command = {
     \ },
     \ 'fallback': 'find %s -type f'
 \ }
+
 let g:ctrlp_extensions = ['funky']
+
+" Function definition jumping with CtrlP's Funky plugin
+nnoremap <silent> <Leader>f :CtrlPFunky<CR>

+ 11 - 11
vim/settings/folding.vim

@@ -36,19 +36,19 @@ if has('folding')
 
   " Keyboard Shortcuts {{{
   " Space as a Folding toggle in normal mode.
-  nnoremap <silent> <space>     @=(foldlevel('.')?'za':"\<space>")<CR>
+  nnoremap <silent> <Leader><Space>     @=(foldlevel('.')?'za':"\<Space>")<CR>
 
   " Code folding options (spf13-vim)
-  nmap <leader>f0 :set foldlevel=0<CR>
-  nmap <leader>f1 :set foldlevel=1<CR>
-  nmap <leader>f2 :set foldlevel=2<CR>
-  nmap <leader>f3 :set foldlevel=3<CR>
-  nmap <leader>f4 :set foldlevel=4<CR>
-  nmap <leader>f5 :set foldlevel=5<CR>
-  nmap <leader>f6 :set foldlevel=6<CR>
-  nmap <leader>f7 :set foldlevel=7<CR>
-  nmap <leader>f8 :set foldlevel=8<CR>
-  nmap <leader>f9 :set foldlevel=9<CR>
+  nmap <Leader>f0 :set foldlevel=0<CR>
+  nmap <Leader>f1 :set foldlevel=1<CR>
+  nmap <Leader>f2 :set foldlevel=2<CR>
+  nmap <Leader>f3 :set foldlevel=3<CR>
+  nmap <Leader>f4 :set foldlevel=4<CR>
+  nmap <Leader>f5 :set foldlevel=5<CR>
+  nmap <Leader>f6 :set foldlevel=6<CR>
+  nmap <Leader>f7 :set foldlevel=7<CR>
+  nmap <Leader>f8 :set foldlevel=8<CR>
+  nmap <Leader>f9 :set foldlevel=9<CR>
   " }}}
 
   " Fold Highlighting {{{

+ 1 - 1
vim/settings/gundo.vim

@@ -1,2 +1,2 @@
 " Gundo
-"nnoremap <silent> <leader>u :GundoToggle<CR>
+"nnoremap <silent> <Leader>u :GundoToggle<CR>

+ 1 - 1
vim/settings/keymaps.vim

@@ -1,5 +1,5 @@
 " Toggle keyboard layout
-"nnoremap <silent> <leader><space> :call CycleKeymap()<CR>
+"nnoremap <silent> <Leader><Space> :call CycleKeymap()<CR>
 
 "function! CycleKeymap()
   "if has('keymap')

+ 1 - 1
vim/settings/mouse.vim

@@ -13,7 +13,7 @@
 set mouse=a
 
 " Toggle mouse support.
-nnoremap <silent> <leader>m :call ToggleMouse()<CR>
+nnoremap <silent> <Leader>m :call ToggleMouse()<CR>
 
 function! ToggleMouse()
   if &mouse == 'a'

+ 2 - 2
vim/settings/nerdcommenter.vim

@@ -1,3 +1,3 @@
 " Toggle Commenting out lines with NERDCommenter
-nnoremap <silent> <leader>, :call NERDComment("n", "toggle")<CR>
-vnoremap <silent> <leader>, <ESC>:call NERDComment("x", "toggle")<CR>
+nnoremap <silent> <Leader>, :call NERDComment("n", "toggle")<CR>
+vnoremap <silent> <Leader>, <Esc>:call NERDComment("x", "toggle")<CR>

+ 1 - 1
vim/settings/nerdtree.vim

@@ -1,5 +1,5 @@
 " Toggle NERDTree file browser
-nnoremap <silent> <leader>d :NERDTreeMirrorToggle<CR>
+nnoremap <silent> <Leader>d :NERDTreeMirrorToggle<CR>
 let g:NERDTreeIgnore=['\.pyc', '\~$', '\.swo$', '\.swp$', '\.git', '\.hg', '\.svn', '\.bzr']
 let g:NERDTreeChDirMode=0
 let g:NERDTreeQuitOnOpen=1

+ 5 - 5
vim/settings/quickfix.vim

@@ -7,7 +7,7 @@
 "    - '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
+"    - <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
@@ -27,8 +27,8 @@ if has("autocmd")
   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
+  " 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 |
@@ -51,14 +51,14 @@ if has("autocmd")
         \ call MapQfPrevNext()
   " }}}
 
-  " <TAB> and <BSLASH> map adding helper. {{{
+  " <Tab> and <Bslash> map adding helper. {{{
   function! MapQfPrevNext()
     exec "nmap <silent> <tab> :cprev<CR>"
     exec "nmap <silent> <bslash> :cnext<CR>"
   endfunction
   " }}}
 
-  " <TAB> and <BSLASH> map removal helper. {{{
+  " <Tab> and <Bslash> map removal helper. {{{
   function! UnmapQfPrefNext()
     exec "nunmap <tab>"
     exec "nunmap <bslash>"

+ 4 - 4
vim/settings/screenmovement.vim

@@ -11,10 +11,10 @@
 set virtualedit=block
 
 " Smart way to move between windows, with vertical maximisation (spf13-vim).
-map <C-J> <C-W>j<C-W>_
-map <C-K> <C-W>k<C-W>_
-map <C-L> <C-W>l<C-W>_
-map <C-H> <C-W>h<C-W>_
+map <C-j> <C-w>j<C-w>_
+map <C-k> <C-w>k<C-w>_
+map <C-l> <C-w>l<C-w>_
+map <C-h> <C-w>h<C-w>_
 
 " Smart way to move between windows, without vertical maximisation.
 "noremap <C-j> <C-w>j

+ 2 - 2
vim/settings/sparkup.vim

@@ -1,2 +1,2 @@
-"g:sparkupExecuteMapping (Default: '<c-e>') - Mapping used to execute sparkup.
-let g:sparkupNextMapping = '<leader>n'
+"g:sparkupExecuteMapping (Default: '<C-e>') - Mapping used to execute sparkup.
+let g:sparkupNextMapping = '<Leader>n'

+ 4 - 4
vim/settings/tabular.vim

@@ -1,7 +1,7 @@
-nmap <leader>a= :Tabularize /=<CR>
-vmap <leader>a= :Tabularize /=<CR>
-nmap <leader>a: :Tabularize /:\zs<CR>
-vmap <leader>a: :Tabularize /:\zs<CR>
+nmap <Leader>a= :Tabularize /=<CR>
+vmap <Leader>a= :Tabularize /=<CR>
+nmap <Leader>a: :Tabularize /:\zs<CR>
+vmap <Leader>a: :Tabularize /:\zs<CR>
 
 inoremap <silent> <Bar>   <Bar><Esc>:call <SID>align()<CR>a
 

+ 1 - 1
vim/settings/tagbar.vim

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

+ 7 - 6
vim/settings/toggles.vim

@@ -1,11 +1,12 @@
-" Toggle text wrap - no used as it conflicts with
-"nnoremap <silent> <leader>w :set wrap! wrap?<CR>
-
 " Toggle paste mode - no autoindenting of pasted material
-nnoremap <silent> <leader>p :set paste! paste?<CR>
+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>
+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>
+nnoremap <silent> <Leader>s :set scrollbind! scrollbind?<CR>

+ 7 - 7
vim/settings/version_control.vim

@@ -11,12 +11,12 @@ if has("autocmd")
 endif
 
 " Search for conflict markers
-nnoremap <leader>fc /\v^[<\|=>]{7}( .*\|$)<CR>
+nnoremap <Leader>fc /\v^[<\|=>]{7}( .*\|$)<CR>
 
 " Git commands with Fugitive
-nnoremap <silent> <leader>gc :Gcommit -v<CR>
-nnoremap <silent> <leader>gl :Glog<CR><CR>
-nnoremap <silent> <leader>gap :Git add -p<CR>
-nnoremap <silent> <leader>gs :Gstatus<CR>
-nnoremap <silent> <leader>gd :Gdiff<CR>
-nnoremap <silent> <leader>gb :Gblame<CR>
+nnoremap <silent> <Leader>gc :Gcommit -v<CR>
+nnoremap <silent> <Leader>gl :Glog<CR><CR>
+nnoremap <silent> <Leader>gap :Git add -p<CR>
+nnoremap <silent> <Leader>gs :Gstatus<CR>
+nnoremap <silent> <Leader>gd :Gdiff<CR>
+nnoremap <silent> <Leader>gb :Gblame<CR>

+ 3 - 3
vim/settings/white_space.vim

@@ -19,8 +19,8 @@ if has("autocmd")
 endif
 
 " Add extra lines up and down
-nnoremap <leader>j o<Esc>k
-nnoremap <leader>k O<Esc>j
+nnoremap <Leader>j o<Esc>k
+nnoremap <Leader>k O<Esc>j
 
 " Convert tabs to spaces
-nnoremap <silent> <leader><TAB> :%s/<TAB>/  /g<CR>
+nnoremap <silent> <Leader><Tab> :%s/<Tab>/  /g<CR>

+ 1 - 1
vim/settings/yaml.vim

@@ -1,2 +1,2 @@
 " yaml highlighting
-au BufNewFile,BufRead *.yaml,*.yml so ~/.vim/bundle/yaml.vim/colors/yaml.vim
+au BufNewFile,BufRead *.yaml,*.yml so ~/.vim/plugged/yaml.vim/colors/yaml.vim

+ 6 - 3
vim/vimrc

@@ -65,11 +65,14 @@ endif
 "" Key Remaps
 """"""""""""""""""""""""""""""""""""""""""""""""""""""
 
-let mapleader = ','
+let mapleader = ' '
+
+" Save changes to a file
+nmap <silent> <Leader>w :up<CR>
 
 " More convenient escape
-inoremap kj <ESC>
-inoremap jk <ESC>
+inoremap kj <Esc>
+inoremap jk <Esc>
 
 " Yank from the cursor to the end of the line, to be consistent with C and D.
 nnoremap Y y$