general.vim 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. " Be IMproved
  2. if &compatible
  3. set nocompatible
  4. endif
  5. " Gives vim abilty to recognize filetypes
  6. filetype plugin indent on
  7. " Enables syntax highlighing
  8. syntax enable
  9. " display long lines as just one line
  10. set nowrap
  11. " The encoding displayed
  12. set encoding=utf-8
  13. " The encoding written to file
  14. set fileencoding=utf-8
  15. " Enable your mouse
  16. set mouse=a
  17. " Horizontal splits will automatically be below
  18. set splitbelow
  19. " Vertical splits will automatically be to the right
  20. set splitright
  21. " Support 256 colors
  22. set t_Co=256
  23. " Your working directory will always be the same as your working directory
  24. set autochdir
  25. " Insert 4 spaces for a tab
  26. set tabstop=4
  27. " Change the number of space characters inserted for indentation
  28. set shiftwidth=4
  29. " Makes tabbing smarter will realize you have 2 vs 4
  30. set smarttab
  31. " Converts tabs to spaces
  32. set expandtab
  33. " Makes indenting smart
  34. set smartindent
  35. " Good auto indent
  36. set autoindent
  37. " Always display the status line
  38. set laststatus=2
  39. " Line numbers
  40. set number
  41. " Enable highlighting of the current line
  42. set cursorline
  43. let g:elite_mode=1
  44. " Disable arrow movement, resize splits instead.
  45. if get(g:, 'elite_mode')
  46. nnoremap <Up> :resize -2<CR>
  47. nnoremap <Down> :resize +2<CR>
  48. nnoremap <Left> :vertical resize -2<CR>
  49. nnoremap <Right> :vertical resize +2<CR>
  50. endif
  51. " Alternate way to save
  52. nnoremap <C-s> :w<CR>
  53. " Alternate way to quit
  54. nnoremap <C-Q> :wq!<CR>
  55. " Use control-c instead of escape
  56. nnoremap <C-c> <Esc>
  57. " <TAB>: completion.
  58. inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
  59. " F2 split vertical
  60. nnoremap <F2> :vsplit<CR>
  61. " F3 split horizontal
  62. nnoremap <F3> :split<CR>
  63. " Toggle Line numbers
  64. nnoremap <F4> :set nonumber!<CR>
  65. " Toggle NERDTree
  66. nnoremap <F5> :NERDTreeToggle<CR>
  67. " Get rid of highlights after search
  68. nnoremap <silent> <F7> :nohlsearch<CR><F7>
  69. " Open terminal with F1
  70. nnoremap <F1> :10split term://bash<CR>
  71. " insert mode for terminal
  72. autocmd BufWinEnter,WinEnter term://* startinsert
  73. autocmd BufLeave term://* stopinsert
  74. " Remap window switch
  75. nnoremap <C-h> <C-w>h
  76. nnoremap <C-j> <C-w>j
  77. nnoremap <C-k> <C-w>k
  78. nnoremap <C-l> <C-w>l
  79. " Remap terminal switch
  80. tnoremap <C-[> <C-\><C-n>
  81. tnoremap <C-c><Esc> <Esc>
  82. tnoremap <C-h> <C-\><C-n><C-w>h
  83. tnoremap <C-j> <C-\><C-n><C-w>j
  84. tnoremap <C-k> <C-\><C-n><C-w>k
  85. tnoremap <C-l> <C-\><C-n><C-w>l
  86. " TAB in general mode will mov to text buffer
  87. nnoremap <TAB> :bnext<CR>
  88. " SHIFT-TAB will go back
  89. nnoremap <S-TAB> :bprevious<CR>
  90. " Map leader switch to whatever you want
  91. let mapleader = ","