general.vim 3.7 KB

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