Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

226 lines
6.7 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. "" __ _______ _____ _____
  2. "" \ \ / / ____| ____|_ _|
  3. "" \ V /| _| | _| | |
  4. "" | | | |___| |___ | |
  5. "" |_| |_____|_____| |_|
  6. "" Yeet's vim configuration
  7. " XDG Base Directory Specification
  8. set runtimepath^=$XDG_CONFIG_HOME/vim
  9. set runtimepath+=$XDG_DATA_HOME/vim
  10. set runtimepath+=$XDG_CONFIG_HOME/vim/after
  11. set packpath^=$XDG_DATA_HOME/vim,$XDG_CONFIG_HOME/vim
  12. set packpath+=$XDG_CONFIG_HOME/vim/after,$XDG_DATA_HOME/vim/after
  13. let g:netrw_home = $XDG_DATA_HOME."/vim"
  14. call mkdir($XDG_DATA_HOME."/vim/spell", 'p')
  15. set viewdir=$XDG_DATA_HOME/vim/view | call mkdir(&viewdir, 'p')
  16. set backupdir=$XDG_CACHE_HOME/vim/backup | call mkdir(&backupdir, 'p')
  17. set directory=$XDG_CACHE_HOME/vim/swap | call mkdir(&directory, 'p')
  18. set undodir=$XDG_CACHE_HOME/vim/undo | call mkdir(&undodir, 'p')
  19. let s:MRU_File = $XDG_CACHE_HOME."/vim/mru"
  20. if !has('nvim') | set viminfofile=$XDG_CACHE_HOME/vim/viminfo | endif
  21. " Set leader
  22. let mapleader = ","
  23. " Leader Mappings
  24. nnoremap <Leader>c :w! \| !compiler "<c-r>%"<CR>
  25. map <Leader>w :update<CR>
  26. map <Leader>q :qall<CR>
  27. map <Leader>gs :Gstatus<CR>
  28. " map Q to gq for line formatting cuz Q is useless
  29. nnoremap Q gq
  30. " Recently edited files
  31. map <Leader>h :History<CR>
  32. " CtrlP use FZF (faster!)
  33. nnoremap <C-p> :Files<CR>
  34. nnoremap <Leader>b :Buffers<CR>
  35. noremap <Leader>u :w<Home>silent <End> !urlview<CR>
  36. " System clipboard copy
  37. nnoremap <Leader>y "+y
  38. nnoremap <Leader>p "+p
  39. vnoremap <Leader>y "+y
  40. vnoremap <Leader>p "+p
  41. nnoremap <Leader>Y "+Y
  42. nnoremap <Leader>P "+P
  43. vnoremap <Leader>d "+d
  44. nnoremap <Leader>D "+D
  45. if has('nvim')
  46. source ~/.config/nvim/plugin/plugins.vim
  47. endif
  48. syntax on
  49. filetype plugin on
  50. set autoread " Auto reload changed files
  51. set wildmenu " Tab autocomplete in command mode
  52. set backspace=indent,eol,start " http://vi.stackexchange.com/a/2163
  53. set laststatus=2 " Show status line on startup
  54. set splitright " Open new splits to the right
  55. set splitbelow " Open new splits to the bottom
  56. set lazyredraw " Reduce the redraw frequency
  57. set ttyfast " Send more characters in fast terminals
  58. set nowrap " Don't wrap long lines
  59. set listchars=extends:→ " Show arrow if line continues rightwards
  60. set listchars+=precedes:← " Show arrow if line continues leftwards
  61. set nobackup nowritebackup noswapfile " Turn off backup files
  62. set noerrorbells novisualbell " Turn off visual and audible bells
  63. set expandtab shiftwidth=2 tabstop=2 " Two spaces for tabs everywhere
  64. set history=500
  65. set hidden " Save buffers automatically
  66. set ignorecase smartcase " Search queries intelligently set case
  67. set incsearch " Show search results as you type
  68. set timeoutlen=1000 ttimeoutlen=0 " Remove timeout when hitting escape
  69. set showcmd " Show size of visual selection
  70. set cmdheight=2
  71. set t_Co=256
  72. noh
  73. " set clipboard=unnamedplus
  74. set shortmess+=c
  75. set updatetime=300
  76. if has("patch-8.1.1564")
  77. " Recently vim can merge signcolumn and number column into one
  78. set signcolumn=number
  79. else
  80. set signcolumn=yes
  81. endif
  82. " Persistent undo
  83. set undodir=~/.local/share/vim/undo/
  84. set undofile
  85. set undolevels=1000
  86. set undoreload=10000
  87. " Ignored files/directories from autocomplete (and CtrlP)
  88. set wildignore+=*/tmp/*
  89. set wildignore+=*.so
  90. set wildignore+=*.zip
  91. set wildignore+=*/vendor/bundle/*
  92. set wildignore+=*/node_modules/
  93. " Enable autocompletion:
  94. set wildmode=longest,list,full
  95. " Disables automatic commenting on newline:
  96. autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
  97. vnoremap . :normal .<CR>
  98. map <leader>f :Goyo \| set linebreak<CR>
  99. map <leader>o :setlocal spell! spelllang=en_us<CR>
  100. set splitbelow splitright
  101. map <leader>s :!clear && shellcheck -x %<CR>
  102. cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
  103. "-------------------------------------------------------------------------------
  104. " Interface
  105. "-------------------------------------------------------------------------------
  106. set number " Enable line numbers
  107. set scrolloff=5 " Leave 5 lines of buffer when scrolling
  108. set sidescrolloff=10 " Leave 10 characters of horizontal buffer when scrolling
  109. "-------------------------------------------------------------------------------
  110. " Colors & Formatting
  111. "-------------------------------------------------------------------------------
  112. let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
  113. let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
  114. if (has("termguicolors"))
  115. set termguicolors
  116. endif
  117. let g:material_theme_style='ocean-community'
  118. set background=dark
  119. try
  120. colorscheme material
  121. catch /^Vim\%((\a\+)\)\=:E185/
  122. colorscheme default
  123. endtry
  124. " Showcase comments in italics
  125. highlight Comment cterm=italic gui=italic
  126. " Easy tab navigation
  127. nnoremap <C-Left> :tabprevious<CR>
  128. nnoremap <C-Right> :tabnext<CR>
  129. " Find/replace
  130. vnoremap <C-r> "hy:%s/<C-r>h//g<left><left><left>
  131. " DON'T USE ARROWS NORMIE
  132. nnoremap <C-c> :echoe "Use Esc"<CR>
  133. nnoremap <Left> :echoe "Use h"<CR>
  134. nnoremap <Right> :echoe "Use l"<CR>
  135. nnoremap <Up> :echoe "Use k"<CR>
  136. nnoremap <Down> :echoe "Use j"<CR>
  137. " Split resize
  138. nnoremap <silent> <Leader>+ :exe "resize " . (winheight(0) * 3/2)<CR>
  139. nnoremap <silent> <Leader>- :exe "resize " . (winheight(0) * 2/3)<CR>
  140. " Make vim obey transparency
  141. hi! Normal ctermbg=NONE guibg=NONE
  142. hi! NonText ctermbg=NONE guibg=NONE
  143. "-------------------------------------------------------------------------------
  144. " Neovim-specific configurations
  145. if has('nvim')
  146. let $NVIM_TUI_ENABLE_TRUE_COLOR=1
  147. set termguicolors
  148. " Fix vim-tmux-navigator <C-h> https://git.io/viGRU
  149. nmap <BS> <C-W>h
  150. " Fix vim-tmux-navigator <C-h> https://git.io/vS5QH
  151. nmap <BS> :<C-u>TmuxNavigateLeft<CR>
  152. " The following require plugins to be loaded so they should only be set in neovim
  153. let g:vimtex_view_general_viewer = 'zathura'
  154. " Syntastic max file size for python
  155. let g:syntastic_python_pylint_post_args="--max-line-length=120"
  156. " Widths fot several plugins
  157. let g:goyo_width = 120 " Goyo
  158. let g:Tlist_WinWidth = 40 " Tlist
  159. endif
  160. " Don't clear clipboard on exit
  161. autocmd VimLeave * call system("xsel -ib", getreg('+'))
  162. " Useful for GDB debugging
  163. packadd termdebug
  164. " File Specific Settings
  165. if has("autocmd")
  166. " Use skeleton files
  167. augroup templates
  168. autocmd BufNewFile *.* silent! execute '0r ~/.config/vim/templates/skeleton.'.expand("<afile>:e")
  169. autocmd BufNewFile * %substitute#\[:VIM_EVAL:\]\(.\{-\}\)\[:END_EVAL:\]#\=eval(submatch(1))#ge
  170. augroup END
  171. autocmd BufWinLeave *.tex !texclear %:p " Run texclear on exit
  172. autocmd BufRead calcurse-note.* :set filetype=markdown " Use markdown for calcurse notes
  173. endif