separate mac and linux vim keymaping
This commit is contained in:
parent
5e4ff731de
commit
245ca3a2b4
@ -1,4 +1,15 @@
|
|||||||
|
let vimsettings = '~/.vim/settings'
|
||||||
|
let uname = system("uname -s")
|
||||||
|
|
||||||
|
for fpath in split(globpath(vimsettings, '*.vim'), '\n')
|
||||||
|
|
||||||
|
if (fpath == expand(vimsettings) . "/yadr-keymap-mac.vim") && uname[:4] ==? "linux"
|
||||||
|
continue " skip mac mappings for linux
|
||||||
|
endif
|
||||||
|
|
||||||
|
if (fpath == expand(vimsettings) . "/yadr-keymap-linux.vim") && uname[:4] !=? "linux"
|
||||||
|
continue " skip linux mappings for mac
|
||||||
|
endif
|
||||||
|
|
||||||
for fpath in split(globpath('~/.vim/settings', '*.vim'), '\n')
|
|
||||||
exe 'source' fpath
|
exe 'source' fpath
|
||||||
endfor
|
endfor
|
||||||
|
81
vim/settings/yadr-keymap-linux.vim
Normal file
81
vim/settings/yadr-keymap-linux.vim
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
" ========================================
|
||||||
|
" Linux specific General vim sanity improvements
|
||||||
|
" ========================================
|
||||||
|
"
|
||||||
|
" ========================================
|
||||||
|
" RSI Prevention - keyboard remaps
|
||||||
|
" ========================================
|
||||||
|
" Certain things we do every day as programmers stress
|
||||||
|
" out our hands. For example, typing underscores and
|
||||||
|
" dashes are very common, and in position that require
|
||||||
|
" a lot of hand movement. Vim to the rescue
|
||||||
|
"
|
||||||
|
" Now using the middle finger of either hand you can type
|
||||||
|
" underscores with Ctrl-k or Ctrl-d, and add Shift
|
||||||
|
" to type dashes
|
||||||
|
imap <silent> <C-k> _
|
||||||
|
imap <silent> <C-d> _
|
||||||
|
imap <silent> <C-K> -
|
||||||
|
imap <silent> <C-D> -
|
||||||
|
|
||||||
|
" Change inside various enclosures with Ctrl-" and Ctrl-'
|
||||||
|
" The f makes it find the enclosure so you don't have
|
||||||
|
" to be standing inside it
|
||||||
|
nnoremap <C-'> f'ci'
|
||||||
|
nnoremap <C-"> f"ci"
|
||||||
|
nnoremap <C-(> f(ci(
|
||||||
|
nnoremap <C-)> f)ci)
|
||||||
|
nnoremap <C-[> f[ci[
|
||||||
|
nnoremap <C-]> f]ci]
|
||||||
|
|
||||||
|
" ==== NERD tree
|
||||||
|
" Ctrl-Shift-N for nerd tree
|
||||||
|
nmap <C-N> :NERDTreeToggle<CR>
|
||||||
|
|
||||||
|
" move up/down quickly by using Ctrl-j, Ctrl-k
|
||||||
|
" which will move us around by functions
|
||||||
|
nnoremap <silent> <C-j> }
|
||||||
|
nnoremap <silent> <C-k> {
|
||||||
|
autocmd FileType ruby map <buffer> <C-j> ]m
|
||||||
|
autocmd FileType ruby map <buffer> <C-k> [m
|
||||||
|
autocmd FileType rspec map <buffer> <C-j> }
|
||||||
|
autocmd FileType rspec map <buffer> <C-k> {
|
||||||
|
autocmd FileType javascript map <buffer> <C-k> }
|
||||||
|
autocmd FileType javascript map <buffer> <C-j> {
|
||||||
|
|
||||||
|
" Command-/ to toggle comments
|
||||||
|
map <C-/> :TComment<CR>
|
||||||
|
imap <C-/> <Esc>:TComment<CR>i
|
||||||
|
|
||||||
|
" Use Alt- numbers to pick the tab you want
|
||||||
|
map <silent> <A-1> :tabn 1<cr>
|
||||||
|
map <silent> <A-2> :tabn 2<cr>
|
||||||
|
map <silent> <A-3> :tabn 3<cr>
|
||||||
|
map <silent> <A-4> :tabn 4<cr>
|
||||||
|
map <silent> <A-5> :tabn 5<cr>
|
||||||
|
map <silent> <A-6> :tabn 6<cr>
|
||||||
|
map <silent> <A-7> :tabn 7<cr>
|
||||||
|
map <silent> <A-8> :tabn 8<cr>
|
||||||
|
map <silent> <A-9> :tabn 9<cr>
|
||||||
|
|
||||||
|
" Create window splits easier. The default
|
||||||
|
" way is Ctrl-w,v and Ctrl-w,s. I remap
|
||||||
|
" this to vv and ss
|
||||||
|
nnoremap <silent> vv <C-w>v
|
||||||
|
nnoremap <silent> ss <C-w>s
|
||||||
|
|
||||||
|
" Resize windows with arrow keys
|
||||||
|
nnoremap <C-Up> <C-w>+
|
||||||
|
nnoremap <C-Down> <C-w>-
|
||||||
|
nnoremap <C-Left> <C-w><
|
||||||
|
nnoremap <C-Right> <C-w>>
|
||||||
|
|
||||||
|
" ============================
|
||||||
|
" Tabularize - alignment
|
||||||
|
" ============================
|
||||||
|
" Hit Ctrl-Shift-A then type a character you want to align by
|
||||||
|
nmap <C-A> :Tabularize /
|
||||||
|
vmap <C-A> :Tabularize /
|
||||||
|
|
||||||
|
" Source current file Ctrl-% (good for vim development)
|
||||||
|
map <C-%> :so %<CR>
|
81
vim/settings/yadr-keymap-mac.vim
Normal file
81
vim/settings/yadr-keymap-mac.vim
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
" ========================================
|
||||||
|
" Mac specific General vim sanity improvements
|
||||||
|
" ========================================
|
||||||
|
"
|
||||||
|
" ========================================
|
||||||
|
" RSI Prevention - keyboard remaps
|
||||||
|
" ========================================
|
||||||
|
" Certain things we do every day as programmers stress
|
||||||
|
" out our hands. For example, typing underscores and
|
||||||
|
" dashes are very common, and in position that require
|
||||||
|
" a lot of hand movement. Vim to the rescue
|
||||||
|
"
|
||||||
|
" Now using the middle finger of either hand you can type
|
||||||
|
" underscores with apple-k or apple-d, and add Shift
|
||||||
|
" to type dashes
|
||||||
|
imap <silent> <D-k> _
|
||||||
|
imap <silent> <D-d> _
|
||||||
|
imap <silent> <D-K> -
|
||||||
|
imap <silent> <D-D> -
|
||||||
|
|
||||||
|
" Change inside various enclosures with Cmd-" and Cmd-'
|
||||||
|
" The f makes it find the enclosure so you don't have
|
||||||
|
" to be standing inside it
|
||||||
|
nnoremap <D-'> f'ci'
|
||||||
|
nnoremap <D-"> f"ci"
|
||||||
|
nnoremap <D-(> f(ci(
|
||||||
|
nnoremap <D-)> f)ci)
|
||||||
|
nnoremap <D-[> f[ci[
|
||||||
|
nnoremap <D-]> f]ci]
|
||||||
|
|
||||||
|
" ==== NERD tree
|
||||||
|
" Cmd-Shift-N for nerd tree
|
||||||
|
nmap <D-N> :NERDTreeToggle<CR>
|
||||||
|
|
||||||
|
" move up/down quickly by using Cmd-j, Cmd-k
|
||||||
|
" which will move us around by functions
|
||||||
|
nnoremap <silent> <D-j> }
|
||||||
|
nnoremap <silent> <D-k> {
|
||||||
|
autocmd FileType ruby map <buffer> <D-j> ]m
|
||||||
|
autocmd FileType ruby map <buffer> <D-k> [m
|
||||||
|
autocmd FileType rspec map <buffer> <D-j> }
|
||||||
|
autocmd FileType rspec map <buffer> <D-k> {
|
||||||
|
autocmd FileType javascript map <buffer> <D-k> }
|
||||||
|
autocmd FileType javascript map <buffer> <D-j> {
|
||||||
|
|
||||||
|
" Command-/ to toggle comments
|
||||||
|
map <D-/> :TComment<CR>
|
||||||
|
imap <D-/> <Esc>:TComment<CR>i
|
||||||
|
|
||||||
|
" Use numbers to pick the tab you want (like iTerm)
|
||||||
|
map <silent> <D-1> :tabn 1<cr>
|
||||||
|
map <silent> <D-2> :tabn 2<cr>
|
||||||
|
map <silent> <D-3> :tabn 3<cr>
|
||||||
|
map <silent> <D-4> :tabn 4<cr>
|
||||||
|
map <silent> <D-5> :tabn 5<cr>
|
||||||
|
map <silent> <D-6> :tabn 6<cr>
|
||||||
|
map <silent> <D-7> :tabn 7<cr>
|
||||||
|
map <silent> <D-8> :tabn 8<cr>
|
||||||
|
map <silent> <D-9> :tabn 9<cr>
|
||||||
|
|
||||||
|
" Create window splits easier. The default
|
||||||
|
" way is Ctrl-w,v and Ctrl-w,s. I remap
|
||||||
|
" this to vv and ss
|
||||||
|
nnoremap <silent> vv <C-w>v
|
||||||
|
nnoremap <silent> ss <C-w>s
|
||||||
|
|
||||||
|
" Resize windows with arrow keys
|
||||||
|
nnoremap <D-Up> <C-w>+
|
||||||
|
nnoremap <D-Down> <C-w>-
|
||||||
|
nnoremap <D-Left> <C-w><
|
||||||
|
nnoremap <D-Right> <C-w>>
|
||||||
|
|
||||||
|
" ============================
|
||||||
|
" Tabularize - alignment
|
||||||
|
" ============================
|
||||||
|
" Hit Cmd-Shift-A then type a character you want to align by
|
||||||
|
nmap <D-A> :Tabularize /
|
||||||
|
vmap <D-A> :Tabularize /
|
||||||
|
|
||||||
|
" Source current file Cmd-% (good for vim development)
|
||||||
|
map <D-%> :so %<CR>
|
@ -25,22 +25,6 @@ endfunction
|
|||||||
nnoremap 0 ^
|
nnoremap 0 ^
|
||||||
nnoremap ^ 0
|
nnoremap ^ 0
|
||||||
|
|
||||||
" ========================================
|
|
||||||
" RSI Prevention - keyboard remaps
|
|
||||||
" ========================================
|
|
||||||
" Certain things we do every day as programmers stress
|
|
||||||
" out our hands. For example, typing underscores and
|
|
||||||
" dashes are very common, and in position that require
|
|
||||||
" a lot of hand movement. Vim to the rescue
|
|
||||||
"
|
|
||||||
" Now using the middle finger of either hand you can type
|
|
||||||
" underscores with apple-k or apple-d, and add Shift
|
|
||||||
" to type dashes
|
|
||||||
imap <silent> <D-k> _
|
|
||||||
imap <silent> <D-d> _
|
|
||||||
imap <silent> <D-K> -
|
|
||||||
imap <silent> <D-D> -
|
|
||||||
|
|
||||||
" ,# Surround a word with #{ruby interpolation}
|
" ,# Surround a word with #{ruby interpolation}
|
||||||
map ,# ysiw#
|
map ,# ysiw#
|
||||||
vmap ,# c#{<C-R>"}<ESC>
|
vmap ,# c#{<C-R>"}<ESC>
|
||||||
@ -77,16 +61,6 @@ map ,` ysiw`
|
|||||||
" gary bernhardt's hashrocket
|
" gary bernhardt's hashrocket
|
||||||
imap <c-l> <space>=><space>
|
imap <c-l> <space>=><space>
|
||||||
|
|
||||||
" Change inside various enclosures with Cmd-" and Cmd-'
|
|
||||||
" The f makes it find the enclosure so you don't have
|
|
||||||
" to be standing inside it
|
|
||||||
nnoremap <D-'> f'ci'
|
|
||||||
nnoremap <D-"> f"ci"
|
|
||||||
nnoremap <D-(> f(ci(
|
|
||||||
nnoremap <D-)> f)ci)
|
|
||||||
nnoremap <D-[> f[ci[
|
|
||||||
nnoremap <D-]> f]ci]
|
|
||||||
|
|
||||||
"Go to last edit location with ,.
|
"Go to last edit location with ,.
|
||||||
nnoremap ,. '.
|
nnoremap ,. '.
|
||||||
|
|
||||||
@ -100,8 +74,6 @@ nnoremap ,. '.
|
|||||||
imap <C-a> <esc>wa
|
imap <C-a> <esc>wa
|
||||||
|
|
||||||
" ==== NERD tree
|
" ==== NERD tree
|
||||||
" Cmd-Shift-N for nerd tree
|
|
||||||
nmap <D-N> :NERDTreeToggle<CR>
|
|
||||||
" Open the project tree and expose current file in the nerdtree with Ctrl-\
|
" Open the project tree and expose current file in the nerdtree with Ctrl-\
|
||||||
nnoremap <silent> <C-\> :NERDTreeFind<CR>:vertical res 30<CR>
|
nnoremap <silent> <C-\> :NERDTreeFind<CR>:vertical res 30<CR>
|
||||||
|
|
||||||
@ -110,23 +82,6 @@ nnoremap <silent> <C-\> :NERDTreeFind<CR>:vertical res 30<CR>
|
|||||||
nmap <silent> ,qc :cclose<CR>
|
nmap <silent> ,qc :cclose<CR>
|
||||||
nmap <silent> ,qo :copen<CR>
|
nmap <silent> ,qo :copen<CR>
|
||||||
|
|
||||||
" move up/down quickly by using Cmd-j, Cmd-k
|
|
||||||
" which will move us around by functions
|
|
||||||
nnoremap <silent> <D-j> }
|
|
||||||
nnoremap <silent> <D-k> {
|
|
||||||
autocmd FileType ruby map <buffer> <D-j> ]m
|
|
||||||
autocmd FileType ruby map <buffer> <D-k> [m
|
|
||||||
autocmd FileType rspec map <buffer> <D-j> }
|
|
||||||
autocmd FileType rspec map <buffer> <D-k> {
|
|
||||||
autocmd FileType javascript map <buffer> <D-k> }
|
|
||||||
autocmd FileType javascript map <buffer> <D-j> {
|
|
||||||
|
|
||||||
|
|
||||||
" Command-/ to toggle comments
|
|
||||||
map <D-/> :TComment<CR>
|
|
||||||
imap <D-/> <Esc>:TComment<CR>i
|
|
||||||
|
|
||||||
|
|
||||||
"Move back and forth through previous and next buffers
|
"Move back and forth through previous and next buffers
|
||||||
"with ,z and ,x
|
"with ,z and ,x
|
||||||
nnoremap <silent> ,z :bp<CR>
|
nnoremap <silent> ,z :bp<CR>
|
||||||
@ -149,29 +104,12 @@ nnoremap <C-w>gf :tabe<cfile><CR>
|
|||||||
" Zoom in
|
" Zoom in
|
||||||
map <silent> ,gz <C-w>o
|
map <silent> ,gz <C-w>o
|
||||||
|
|
||||||
" Use numbers to pick the tab you want (like iTerm)
|
|
||||||
map <silent> <D-1> :tabn 1<cr>
|
|
||||||
map <silent> <D-2> :tabn 2<cr>
|
|
||||||
map <silent> <D-3> :tabn 3<cr>
|
|
||||||
map <silent> <D-4> :tabn 4<cr>
|
|
||||||
map <silent> <D-5> :tabn 5<cr>
|
|
||||||
map <silent> <D-6> :tabn 6<cr>
|
|
||||||
map <silent> <D-7> :tabn 7<cr>
|
|
||||||
map <silent> <D-8> :tabn 8<cr>
|
|
||||||
map <silent> <D-9> :tabn 9<cr>
|
|
||||||
|
|
||||||
" Create window splits easier. The default
|
" Create window splits easier. The default
|
||||||
" way is Ctrl-w,v and Ctrl-w,s. I remap
|
" way is Ctrl-w,v and Ctrl-w,s. I remap
|
||||||
" this to vv and ss
|
" this to vv and ss
|
||||||
nnoremap <silent> vv <C-w>v
|
nnoremap <silent> vv <C-w>v
|
||||||
nnoremap <silent> ss <C-w>s
|
nnoremap <silent> ss <C-w>s
|
||||||
|
|
||||||
" Resize windows with arrow keys
|
|
||||||
nnoremap <D-Up> <C-w>+
|
|
||||||
nnoremap <D-Down> <C-w>-
|
|
||||||
nnoremap <D-Left> <C-w><
|
|
||||||
nnoremap <D-Right> <C-w>>
|
|
||||||
|
|
||||||
" create <%= foo %> erb tags using Ctrl-k in edit mode
|
" create <%= foo %> erb tags using Ctrl-k in edit mode
|
||||||
imap <silent> <C-K> <%= %><Esc>3hi
|
imap <silent> <C-K> <%= %><Esc>3hi
|
||||||
|
|
||||||
@ -207,13 +145,6 @@ noremap ,hl :set hlsearch! hlsearch?<CR>
|
|||||||
nnoremap ' `
|
nnoremap ' `
|
||||||
nnoremap ` '
|
nnoremap ` '
|
||||||
|
|
||||||
" ============================
|
|
||||||
" Tabularize - alignment
|
|
||||||
" ============================
|
|
||||||
" Hit Cmd-Shift-A then type a character you want to align by
|
|
||||||
nmap <D-A> :Tabularize /
|
|
||||||
vmap <D-A> :Tabularize /
|
|
||||||
|
|
||||||
" ============================
|
" ============================
|
||||||
" SplitJoin plugin
|
" SplitJoin plugin
|
||||||
" ============================
|
" ============================
|
||||||
@ -223,8 +154,5 @@ nmap sk :SplitjoinJoin<cr>
|
|||||||
" Get the current highlight group. Useful for then remapping the color
|
" Get the current highlight group. Useful for then remapping the color
|
||||||
map ,hi :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" . " FG:" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"fg#")<CR>
|
map ,hi :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" . " FG:" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"fg#")<CR>
|
||||||
|
|
||||||
" Source current file Cmd-% (good for vim development)
|
|
||||||
map <D-%> :so %<CR>
|
|
||||||
|
|
||||||
" ,hp = html preview
|
" ,hp = html preview
|
||||||
map <silent> ,hp :!open -a Safari %<CR><CR>
|
map <silent> ,hp :!open -a Safari %<CR><CR>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user