Advertisement
Guest User

vimrc

a guest
Dec 5th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 1.56 KB | None | 0 0
  1. map <leader>w :w
  2. map <leader>wq :wq
  3. map <leader>Wq :wq
  4. map :Wq :wq
  5. map <leader>qq :q!
  6.  
  7. " 'jk' to escape insert
  8. imap jk <Esc>
  9. nnoremap <C-space> i
  10. imap <C-space> <Esc>
  11.  
  12. " bash if statement
  13. autocmd FileType bash,script,sh inoremap ;i if<Space>;<Space>then<Enter><Enter><Esc>0ifi<Esc>2kf;i
  14. autocmd FileType bash,script,sh inoremap ;w while<Space>;<Space>do<Enter><Enter><Esc>0idone<Esc>2kf;i
  15. autocmd FileType bash,script,sh inoremap ;f for<Space>i<Space>in<Space>;<Space>do<Enter><Enter><Esc>0idone<Esc>2kf;i
  16.  
  17.  
  18. " Smart Quotes
  19. inoremap <expr> ' strpart(getline('.'), col('.')-1, 1) == "\'" ? "\<Right>" : "\'\'\<Left>"
  20. inoremap '<Enter> '''<CR>'''<Esc>O
  21. inoremap ''    '
  22. inoremap <expr> " strpart(getline('.'), col('.')-1, 1) == "\"" ? "\<Right>" : "\"\"\<Left>"
  23. inoremap "<Enter> """<CR>"""<Esc>O
  24. inoremap ""    "
  25.  
  26.  
  27. " Smart Parens
  28. inoremap <expr> ) strpart(getline('.'), col('.')-1, 1) == ")" ? "\<Right>" : ")"
  29. inoremap (     ()<Left>
  30. inoremap (<CR> (<CR>)<Esc>O
  31. inoremap ((    (
  32. inoremap ()    ()
  33.  
  34. " Smart Braces
  35. inoremap <expr> } strpart(getline('.'), col('.')-1, 1) == "}" ? "\<Right>" : "}"
  36. inoremap {     {}<Left>
  37. inoremap {<CR> {<CR>}<Esc>O
  38. inoremap {{    {
  39. inoremap {}    {}
  40.  
  41. " Smart Brackets
  42. inoremap <expr> ] strpart(getline('.'), col('.')-1, 1) == "]" ? "\<Right>" : "]"
  43. inoremap [     []<Left>
  44. inoremap [<CR> [<CR>]<Esc>O
  45. inoremap [[    [
  46. inoremap []    []
  47.  
  48. " Smart Brackets
  49. inoremap <expr> > strpart(getline('.'), col('.')-1, 1) == ">" ? "\<Right>" : ">"
  50. inoremap <     <><Left>
  51. inoremap </    </><Left>
  52. inoremap <<    <
  53. inoremap <>    <>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement