.vimrc 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. " COLOR STUFF
  2. " Does not work: set guifont=Hack:h12:cANSI:qDRAFT
  3. set guifont=Consolas:h11
  4. colorscheme evening
  5. syntax on
  6. " Plugins
  7. execute pathogen#infect()
  8. filetype plugin indent on
  9. " Show number
  10. set number
  11. " Map leader
  12. let mapleader = ","
  13. " No backup stuff
  14. set noswapfile
  15. set nobackup
  16. " Netrw
  17. let g:netrw_banner = 0
  18. let g:netrw_liststyle = 3
  19. let g:netrw_winsize = 30
  20. " Toggle Vexplore with Ctrl-E
  21. function! ToggleVExplorer()
  22. if exists("t:expl_buf_num")
  23. let expl_win_num = bufwinnr(t:expl_buf_num)
  24. if expl_win_num != -1
  25. let cur_win_nr = winnr()
  26. exec expl_win_num . 'wincmd w'
  27. close
  28. exec cur_win_nr . 'wincmd w'
  29. unlet t:expl_buf_num
  30. else
  31. unlet t:expl_buf_num
  32. endif
  33. else
  34. exec '1wincmd w'
  35. Vexplore
  36. let t:expl_buf_num = bufnr("%")
  37. endif
  38. endfunction
  39. map <silent> <C-E> :call ToggleVExplorer()<CR>
  40. " Make sure that when you get a error saying "Could not create folder .....
  41. " Just create it"
  42. autocmd BufWinLeave *.* mkview
  43. autocmd BufWinEnter *.* loadview
  44. highlight folded guibg=darkgrey
  45. highlight folded guifg=yellow
  46. " Disable the current stuff that is highlighted
  47. map <silent> <C-h> :noh<cr>
  48. " Searching but better
  49. " Ignore case when searching
  50. set ignorecase
  51. " When searching try to be smart about cases
  52. set smartcase
  53. " Highlight search results
  54. set nohlsearch
  55. " Makes search act like search in modern browsers
  56. set incsearch
  57. " Source this file again.
  58. noremap <silent> <leader>rc :source $HOME/.vimrc<CR>
  59. "set cursorline
  60. set cursorline
  61. set cursorcolumn
  62. highlight CursorLine ctermbg=Yellow cterm=bold guibg=#3b3b3b
  63. highlight CursorColumn ctermbg=Yellow cterm=bold guibg=#3b3b3b
  64. " Spell checker
  65. map <leader>s :setlocal spell! spelllang=en_us<CR>
  66. " Fix what the spell checker finds
  67. noremap <silent> <leader>fix mc1z=`c
  68. " Do space space to jump to <++>
  69. noremap <Space><Space> /<++><Enter>"_c4l
  70. " Make the letter after a period be capital :)
  71. augroup CapitalAfterPeriods
  72. au!
  73. autocmd InsertCharPre * if search('\v(%^|[.!?]\_s)\_s*%#', 'bcnw') != 0 | let v:char = toupper(v:char) | endif
  74. augroup END
  75. " Replace stuff shortcut
  76. nnoremap S :%s#g<Left><Left>
  77. " File Tab stuffs
  78. nnoremap <C-Left> :tabprevious<CR>
  79. nnoremap <C-Right> :tabnext<CR>
  80. nnoremap <silent> <A-Left> :tabm -1<CR>
  81. nnoremap <silent> <A-Right> :tabm +1<CR>
  82. " Copy paste
  83. " NOTE: These are clipboard settings for windoze. Linux should be different.
  84. set nopaste
  85. set clipboard=unnamed
  86. " Show text in middle
  87. set sidescrolloff=999
  88. set scrolloff=999
  89. " NO BEEP
  90. set noerrorbells visualbell t_vb=
  91. autocmd GUIEnter * set visualbell t_vb=
  92. " No more stinky esc key that's way to far away. Instead I can use alt + space.
  93. nnoremap <M-Space> <esc> " Remap in Normal mode
  94. inoremap <M-Space> <Esc> " Remap in Insert and Replace mode
  95. vnoremap <M-Space> <esc> " Remap in Visual and Select mode
  96. xnoremap <M-Space> <esc> " Remap in Visual mode
  97. snoremap <M-Space> <esc> " Remap in Select mode
  98. cnoremap <M-Space> <C-C> " Remap in Command-line mode
  99. onoremap <M-Space> <esc> " Remap in Operator pending mode
  100. " Surperior jkl; rather then hjkl ALSO be able to go through wrapped text
  101. " Never do this. This is a bad idea. If you use vim on the daily. All other
  102. " programs have decided not to this so your screwed.
  103. " noremap j h
  104. " noremap k gj
  105. " noremap l gk
  106. " noremap ; l
  107. " These autoclose stuff
  108. " Also a bad idea. Don't do this because there in your way. On anny other
  109. " program these things exist you just type {} left arrow and wow your there.
  110. " It isn't that hard and you don't need them.
  111. "inoremap ( ()<Esc>i
  112. "inoremap { {}<Esc>i
  113. "inoremap {<CR> {<CR>}<Esc>O
  114. "inoremap [ []<Esc>i
  115. "inoremap < <><Esc>i
  116. " Never auto complete these when writing or doing anything. inoremap ' ''<Esc>i
  117. " inoremap " ""<Esc>i
  118. " Wildmenu
  119. set wildmenu
  120. set wildmode=longest,list,full
  121. " Auto remove spaces on save
  122. autocmd BufWritePre * %s/\s\+$//e
  123. " Tab stuffs
  124. " Use spaces instead of tabs
  125. set expandtab
  126. " Be smart when using tabs ;)
  127. set smarttab
  128. " 1 tab == 4 spaces
  129. set shiftwidth=4
  130. set tabstop=4
  131. " Autoindents
  132. "set autoindent
  133. set smartindent
  134. set backspace=indent,eol,start
  135. " Status line
  136. " Give some space before the line starts
  137. set laststatus=2
  138. " Actually start the status line parameters
  139. set statusline=
  140. " Show the file name
  141. set statusline+=\ FILE:
  142. set statusline+=\ %F
  143. " Show both the current line number and the total lines in file
  144. set statusline+=\ LINES:
  145. set statusline+=\ %l
  146. set statusline+=\ %L
  147. " Go to the right side of the status line
  148. set statusline+=%=
  149. " Show the progress percentage of where you are in the document
  150. set statusline+=%p
  151. " Search duckduckgo
  152. vmap gw "gy:silent! exec '!Start C:\Users\Stanl\AppData\Local\BraveSoftware\Brave-Browser\Application\brave.exe "duckduckgo.com/?q='@g'&ie=utf-8"'<CR><CR>dd
  153. " LATEX AUTO
  154. " Makes more latex stuff work with autocmd.
  155. let g:tex_flavor ='tex'
  156. " Insert a section
  157. autocmd FileType tex inoremap ;sec \section{}<Enter><++><Enter><Esc>2kf}i
  158. " Insert a begin
  159. autocmd FileType tex inoremap ;beg \begin{DELRN}<Enter><++><Enter>\end{DELRN}<Esc>--www<Esc>:%s#DELRN##<Left>
  160. " Command to delete all of what's in a {}
  161. nnoremap <silent> @ ci{
  162. " Insert a Frame
  163. autocmd FileType tex inoremap ;fr \section{DELRN}<Enter>\begin{frame}<Enter>\frametitle{DELRN}<Enter><++><Enter>\end{frame}<Esc>