general.vim 3.3 KB

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