general.vim 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 nowrap " display long lines as just one line
  12. set encoding=utf-8 " The encoding displayed
  13. set fileencoding=utf-8 " The encoding written to file
  14. set ruler " show the cursor position all the time
  15. set iskeyword+=- " treat dash separated words as a word text object"
  16. set mouse=a " Enable your mouse
  17. set splitbelow " Horizontal splits will automatically be below
  18. set splitright " Vertical splits will automatically be to the right
  19. set t_Co=256 " Support 256 colors
  20. set autochdir " Your working directory will always be the same as your working directory
  21. set tabstop=4 " Insert 4 spaces for a tab
  22. set shiftwidth=4 " Change the number of space characters inserted for indentation
  23. set smarttab " Makes tabbing smarter will realize you have 2 vs 4
  24. set expandtab " Converts tabs to spaces
  25. set smartindent " Makes indenting smart
  26. set autoindent " Good auto indent
  27. set laststatus=2 " Always display the status line
  28. set number " Line numbers
  29. set cursorline " Enable highlighting of the current line
  30. set background=dark " tell vim what the background color looks like
  31. let g:python_highlight_all = 0 " Get rid of annoying red highlights"
  32. let g:elite_mode=1 " Disable arrows"
  33. " Disable arrow movement, resize splits instead.
  34. if get(g:, 'elite_mode')
  35. nnoremap <Up> :resize -2<CR>
  36. nnoremap <Down> :resize +2<CR>
  37. nnoremap <Left> :vertical resize -2<CR>
  38. nnoremap <Right> :vertical resize +2<CR>
  39. endif
  40. " Gives vim abilty to recognize filetypes
  41. filetype plugin indent on
  42. " Alternate way to save
  43. nnoremap <C-s> :w<CR>
  44. " Alternate way to quit
  45. nnoremap <C-Q> :wq!<CR>
  46. " Use control-c instead of escape
  47. nnoremap <C-c> <Esc>
  48. " <TAB>: completion.
  49. inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
  50. " Open terminal with F1
  51. nnoremap <silent> <F1> :10split term://bash<CR>
  52. " insert mode for terminal
  53. autocmd BufWinEnter,WinEnter term://* startinsert
  54. autocmd BufLeave term://* stopinsert
  55. " Toggle tagbar
  56. nnoremap <silent> <F2> :TagbarToggle<CR>
  57. " Toggle Line numbers
  58. nnoremap <silent> <F4> :set nonumber!<CR>
  59. " Toggle NERDTree
  60. nnoremap <silent> <F5> :NERDTreeToggle<CR>
  61. " Startify
  62. nnoremap <silent> <F6> :Startify<CR>
  63. " Get rid of highlights after search
  64. nnoremap <silent> <F7> :nohlsearch<CR><F7>
  65. " Toggle open buffers
  66. nnoremap <silent> <F8> :BuffergatorToggle<CR>
  67. " For fuzzy finder
  68. ""nnoremap <silent> <F9> :Files<CR>
  69. " F10 split vertical
  70. nnoremap <silent> <F9> :vsplit<CR>
  71. " F11 split horizontal
  72. nnoremap <silent> <F10> :split<CR>
  73. " Make current buffer only buffer
  74. nnoremap <silent> <F12> :only<CR>
  75. " Remap window switch
  76. " Switch to rename for LSP to do add leader
  77. ""nnoremap <F4> :SearchTasks *<CR>
  78. nnoremap <silent> <leader>n :NERDTreeToggle<return>
  79. nnoremap <silent> <leader>m :TagbarToggle<return>
  80. nnoremap <silent> <leader>l :set nonumber!<return>
  81. nnoremap <silent> <leader>s :Startify<return>
  82. nnoremap <silent> <leader>w :w<return>
  83. nnoremap <silent> <leader>b :<return>
  84. nnoremap <silent> <leader>p :pclose<return>
  85. " Split edit your vimrc. Type space, v, r in sequence to trigger
  86. fun! OpenConfigFile(file)
  87. if (&filetype ==? 'startify')
  88. execute 'e ' . a:file
  89. else
  90. execute 'tabe ' . a:file
  91. endif
  92. endfun
  93. nnoremap <silent> <leader>in :call OpenConfigFile('~/.config/nvim/init.vim')<cr>
  94. nnoremap <C-h> <C-w>h
  95. nnoremap <C-j> <C-w>j
  96. nnoremap <C-k> <C-w>k
  97. nnoremap <C-l> <C-w>l
  98. " Remap terminal switch
  99. tnoremap <C-[> <C-\><C-n>
  100. tnoremap <C-c><Esc> <Esc>
  101. tnoremap <C-h> <C-\><C-n><C-w>h
  102. tnoremap <C-j> <C-\><C-n><C-w>j
  103. tnoremap <C-k> <C-\><C-n><C-w>k
  104. tnoremap <C-l> <C-\><C-n><C-w>l
  105. " TAB in general mode will move to text buffer
  106. nnoremap <TAB> :bnext<CR>
  107. " SHIFT-TAB will go back
  108. nnoremap <S-TAB> :bprevious<CR>