general.vim 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. " Be IMproved
  2. if &compatible
  3. set nocompatible
  4. endif
  5. " set leader key
  6. let g:mapleader = "\<Space>"
  7. " set local leader key
  8. let g:maplocalleader = ','
  9. syntax enable " Enables syntax highlighing
  10. "set hidden " Required for specific actions that require multiple buffers
  11. set nowrap " display long lines as just one line
  12. set encoding=utf-8 " The encoding displayed
  13. set pumheight=10 " Makes popup menu smaller
  14. set fileencoding=utf-8 " The encoding written to file
  15. set ruler " show the cursor position all the time
  16. set cmdheight=2 " always keep this at 2"
  17. set iskeyword+=- " treat dash separated words as a word text object"
  18. set mouse=a " Enable your mouse
  19. set splitbelow " Horizontal splits will automatically be below
  20. set splitright " Vertical splits will automatically be to the right
  21. set t_Co=256 " Support 256 colors
  22. "set autochdir " Your working directory will always be the same as your working directory
  23. set conceallevel=0 " So that I can see `` in markdown files
  24. set tabstop=2 " Insert 2 spaces for a tab
  25. set shiftwidth=2 " Change the number of space characters inserted for indentation
  26. set smarttab " Makes tabbing smarter will realize you have 2 vs 4
  27. set expandtab " Converts tabs to spaces
  28. set smartindent " Makes indenting smart
  29. set autoindent " Good auto indent
  30. set laststatus=0 " Always display the status line
  31. set number " Line numbers
  32. set cursorline " Enable highlighting of the current line
  33. set background=dark " tell vim what the background color looks like
  34. let g:elite_mode=1 " Disable arrows"
  35. filetype plugin indent on " Gives vim abilty to recognize filetypes
  36. " Disable arrow movement, resize splits instead.
  37. if get(g:, 'elite_mode')
  38. nnoremap <Up> :resize -2<CR>
  39. nnoremap <Down> :resize +2<CR>
  40. nnoremap <Left> :vertical resize -2<CR>
  41. nnoremap <Right> :vertical resize +2<CR>
  42. endif
  43. " Alternate way to save
  44. nnoremap <C-s> :w<CR>
  45. " Alternate way to quit
  46. nnoremap <C-Q> :wq!<CR>
  47. " Use control-c instead of escape
  48. nnoremap <C-c> <Esc>
  49. " <TAB>: completion.
  50. inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
  51. " Open terminal with F1
  52. nnoremap <silent> <F1> :10split term://bash<CR>
  53. nnoremap <silent> <F2> :bdelete! term://*<return>
  54. inoremap K <c-d>
  55. nnoremap J <c-u>
  56. nnoremap <C-h> <C-w>h
  57. nnoremap <C-j> <C-w>j
  58. nnoremap <C-k> <C-w>k
  59. nnoremap <C-l> <C-w>l
  60. " Remap terminal switch
  61. tnoremap <C-[> <C-\><C-n>
  62. tnoremap <C-c><Esc> <Esc>
  63. tnoremap <C-h> <C-\><C-n><C-w>h
  64. tnoremap <C-j> <C-\><C-n><C-w>j
  65. tnoremap <C-k> <C-\><C-n><C-w>k
  66. tnoremap <C-l> <C-\><C-n><C-w>l
  67. nnoremap <M-h> <C-w>h
  68. nnoremap <M-j> <C-w>j
  69. nnoremap <M-k> <C-w>k
  70. nnoremap <M-l> <C-w>l
  71. " I think this does something on mac but I might be full of shit
  72. nnoremap <D-h> <C-w>h
  73. nnoremap <D-j> <C-w>j
  74. nnoremap <D-k> <C-w>k
  75. nnoremap <D-l> <C-w>l
  76. " I hate escape more than anything else
  77. inoremap jk <Esc>
  78. inoremap kj <Esc>
  79. " This is how much I hate it
  80. "inoremap <esc> <nop>
  81. " Easy CAPS
  82. inoremap <c-u> <ESC>viwUi
  83. nnoremap <c-u> viwU<Esc>
  84. " TAB in general mode will move to text buffer
  85. nnoremap <C-TAB> :VimwikiNextLink<CR>
  86. " SHIFT-TAB will go back
  87. nnoremap <C-S-TAB> :VimwikiPrevLink<CR>
  88. "nmap <Leader>wn <Plug>VimwikiNextLink
  89. "nmap <Leader>wp <Plug>VimwikiPrevLink
  90. " TAB in general mode will move to text buffer
  91. nnoremap <TAB> :bnext<CR>
  92. " SHIFT-TAB will go back
  93. nnoremap <S-TAB> :bprevious<CR>
  94. " Copy paste between vim and everything else
  95. set clipboard=unnamedplus
  96. " hold when tabbing
  97. vnoremap < <gv
  98. vnoremap > >gv
  99. cmap w!! w !sudo tee %