You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.7 KiB
64 lines
1.7 KiB
|
|
" Bash like keys for the command line
|
|
cnoremap <C-A> <Home>
|
|
cnoremap <C-E> <End>
|
|
cnoremap <C-K> <C-U>
|
|
|
|
cnoremap <C-P> <Up>
|
|
cnoremap <C-N> <Down>
|
|
|
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
" => Parenthesis/bracket
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
vnoremap $1 <esc>`>a)<esc>`<i(<esc>
|
|
vnoremap $2 <esc>`>a]<esc>`<i[<esc>
|
|
vnoremap $3 <esc>`>a}<esc>`<i{<esc>
|
|
vnoremap $$ <esc>`>a"<esc>`<i"<esc>
|
|
vnoremap $q <esc>`>a'<esc>`<i'<esc>
|
|
vnoremap $e <esc>`>a`<esc>`<i`<esc>
|
|
|
|
" Map auto complete of (, ", ', [
|
|
inoremap $1 ()<esc>i
|
|
inoremap $2 []<esc>i
|
|
inoremap $3 {}<esc>i
|
|
inoremap $4 {<esc>o}<esc>O
|
|
inoremap $q ''<esc>i
|
|
inoremap $e ""<esc>i
|
|
|
|
map <leader>n :cn<cr>
|
|
map <leader>p :cp<cr>
|
|
|
|
" ==> NERDTree
|
|
map <C-n> :NERDTreeToggle<CR>
|
|
map <F8> :TagbarToggle<CR>
|
|
|
|
" ==> vim-ruby
|
|
if !exists( "*RubyEndToken" )
|
|
|
|
function RubyEndToken()
|
|
let current_line = getline( '.' )
|
|
let braces_at_end = '{\s*\(|\(,\|\s\|\w\)*|\s*\)\?$'
|
|
let stuff_without_do = '^\s*\(class\|if\|unless\|begin\|case\|for\|module\|while\|until\|def\)'
|
|
let with_do = 'do\s*\(|\(,\|\s\|\w\)*|\s*\)\?$'
|
|
|
|
if match(current_line, braces_at_end) >= 0
|
|
return "\<CR>}\<C-O>O"
|
|
elseif match(current_line, stuff_without_do) >= 0
|
|
return "\<CR>end\<C-O>O"
|
|
elseif match(current_line, with_do) >= 0
|
|
return "\<CR>end\<C-O>O"
|
|
else
|
|
return "\<CR>"
|
|
endif
|
|
endfunction
|
|
|
|
endif
|
|
|
|
autocmd FileType ruby map <buffer> <CR> <C-R>=RubyEndToken()<CR>
|
|
|
|
autocmd FileType go map <C-n> :cnext<CR>
|
|
autocmd FileType go map <C-m> :cprevious<CR>
|
|
autocmd FileType go nmap <leader>a :cclose<CR>
|
|
autocmd FileType go nmap <leader>b <Plug>(go-build)
|
|
autocmd FileType go nmap <leader>r <Plug>(go-run)
|
|
|
|
|