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.

173 lines
5.5 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
  1. set runtimepath^=$XDG_CONFIG_HOME/vim
  2. set runtimepath+=$XDG_DATA_HOME/vim
  3. set runtimepath+=$XDG_CONFIG_HOME/vim/after
  4. set packpath^=$XDG_DATA_HOME/vim,$XDG_CONFIG_HOME/vim
  5. set packpath+=$XDG_CONFIG_HOME/vim/after,$XDG_DATA_HOME/vim/after
  6. let g:netrw_home = $XDG_DATA_HOME."/vim"
  7. call mkdir($XDG_DATA_HOME."/vim/spell", 'p')
  8. set viewdir=$XDG_DATA_HOME/vim/view | call mkdir(&viewdir, 'p')
  9. set backupdir=$XDG_CACHE_HOME/vim/backup | call mkdir(&backupdir, 'p')
  10. set directory=$XDG_CACHE_HOME/vim/swap | call mkdir(&directory, 'p')
  11. set undodir=$XDG_CACHE_HOME/vim/undo | call mkdir(&undodir, 'p')
  12. let s:MRU_File = $XDG_CACHE_HOME."/vim/mru"
  13. if !has('nvim') | set viminfofile=$XDG_CACHE_HOME/vim/viminfo | endif
  14. source ~/.local/share/vim/plugin/plugins.vim
  15. " Set leader
  16. let mapleader = ","
  17. noh
  18. " Leader Mappings
  19. map <Leader>w :update<CR>
  20. map <Leader>q :qall<CR>
  21. map <Leader>gs :Gstatus<CR>
  22. " Recently edited files
  23. map <Leader>h :History<CR>
  24. " CtrlP use FZF (faster!)
  25. nnoremap <C-p> :Files<Cr>
  26. noremap <leader>u :w<Home>silent <End> !urlview<CR>
  27. syntax on
  28. filetype plugin on
  29. autocmd Filetype scss if getfsize(@%) > 300 | setlocal syntax=OFF | endif
  30. augroup twig_ft
  31. au!
  32. autocmd BufNewFile,BufRead *.html.inky set syntax=eruby
  33. augroup END
  34. set autoread " Auto reload changed files
  35. set wildmenu " Tab autocomplete in command mode
  36. set backspace=indent,eol,start " http://vi.stackexchange.com/a/2163
  37. set laststatus=2 " Show status line on startup
  38. set splitright " Open new splits to the right
  39. set splitbelow " Open new splits to the bottom
  40. set lazyredraw " Reduce the redraw frequency
  41. set ttyfast " Send more characters in fast terminals
  42. set nowrap " Don't wrap long lines
  43. set listchars=extends:→ " Show arrow if line continues rightwards
  44. set listchars+=precedes:← " Show arrow if line continues leftwards
  45. set nobackup nowritebackup noswapfile " Turn off backup files
  46. set noerrorbells novisualbell " Turn off visual and audible bells
  47. set expandtab shiftwidth=2 tabstop=2 " Two spaces for tabs everywhere
  48. set history=500
  49. " set hlsearch " Highlight search results
  50. set ignorecase smartcase " Search queries intelligently set case
  51. set incsearch " Show search results as you type
  52. set timeoutlen=1000 ttimeoutlen=0 " Remove timeout when hitting escape
  53. set showcmd " Show size of visual selection
  54. set t_Co=256
  55. set clipboard=unnamedplus
  56. " Persistent undo
  57. set undodir=~/.local/share/vim/undo/
  58. set undofile
  59. set undolevels=1000
  60. set undoreload=10000
  61. " Ignored files/directories from autocomplete (and CtrlP)
  62. set wildignore+=*/tmp/*
  63. set wildignore+=*.so
  64. set wildignore+=*.zip
  65. set wildignore+=*/vendor/bundle/*
  66. set wildignore+=*/node_modules/
  67. "-------------------------------------------------------------------------------
  68. " Interface
  69. "-------------------------------------------------------------------------------
  70. set number " Enable line numbers
  71. set scrolloff=5 " Leave 5 lines of buffer when scrolling
  72. set sidescrolloff=10 " Leave 10 characters of horizontal buffer when scrolling
  73. "-------------------------------------------------------------------------------
  74. " Colors & Formatting
  75. "-------------------------------------------------------------------------------
  76. let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
  77. let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
  78. if (has("termguicolors"))
  79. set termguicolors
  80. endif
  81. let g:material_style='oceanic'
  82. set background=dark
  83. colorscheme vim-material
  84. let g:airline_theme='material'
  85. " Showcase comments in italics
  86. highlight Comment cterm=italic gui=italic
  87. " Open most recently used files on start
  88. " autocmd VimEnter * Mru .
  89. " Easy tab navigation
  90. nnoremap <C-Left> :tabprevious<CR>
  91. nnoremap <C-Right> :tabnext<CR>
  92. " Golang specific settings
  93. let g:go_highlight_build_constraints = 1
  94. let g:go_highlight_extra_types = 1
  95. let g:go_highlight_fields = 1
  96. let g:go_highlight_functions = 1
  97. let g:go_highlight_methods = 1
  98. let g:go_highlight_operators = 1
  99. let g:go_highlight_structs = 1
  100. let g:go_highlight_types = 1
  101. let g:go_auto_type_info = 1
  102. let g:go_fmt_command = "goimports"
  103. " Find/replace
  104. vnoremap <C-r> "hy:%s/<C-r>h//g<left><left><left>
  105. nnoremap <leader>e :noh<CR>
  106. " let g:auto_save = 1 " enable AutoSave on Vim startup
  107. " let g:auto_save_in_insert_mode = 0 " do not save in insert mode
  108. " Get off my lawn - helpful when learning Vim :)
  109. nnoremap <C-c> :echoe "Use Esc"<CR>
  110. nnoremap <Left> :echoe "Use h"<CR>
  111. nnoremap <Right> :echoe "Use l"<CR>
  112. nnoremap <Up> :echoe "Use k"<CR>
  113. nnoremap <Down> :echoe "Use j"<CR>
  114. nnoremap <silent> <Leader>+ :exe "resize " . (winheight(0) * 3/2)<CR>
  115. nnoremap <silent> <Leader>- :exe "resize " . (winheight(0) * 2/3)<CR>
  116. let g:Tlist_WinWidth = 40
  117. " Syntastic max file size for python
  118. let g:syntastic_python_pylint_post_args="--max-line-length=120"
  119. "-------------------------------------------------------------------------------
  120. " Neovim-specific configurations
  121. "-------------------------------------------------------------------------------
  122. if has('nvim')
  123. let $NVIM_TUI_ENABLE_TRUE_COLOR=1
  124. set termguicolors
  125. " Fix vim-tmux-navigator <C-h> https://git.io/viGRU
  126. nmap <BS> <C-W>h
  127. " Fix vim-tmux-navigator <C-h> https://git.io/vS5QH
  128. nmap <BS> :<C-u>TmuxNavigateLeft<CR>
  129. endif
  130. command! -complete=file -nargs=1 Rpdf :r !pdftotext -nopgbrk <q-args> - |fmt -csw78
  131. autocmd VimLeave * call system("xsel -ib", getreg('+'))
  132. packadd termdebug