init.vim 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. " _ _|_|_____ ___ ___
  2. " | | | | | _| _|
  3. " \_/|_|_|_|_|_| |___|
  4. " Menu:
  5. " 1...................Plugins
  6. " 2....................Basics
  7. " 3................Remappings
  8. " 4......Plugin Configuration
  9. " 3.......................GUI
  10. " 4................Statusline
  11. " 5.....................Fonts
  12. " 6....................Panels
  13. " 7................MS Windows
  14. "set laststatus=2
  15. "set showtabline=2
  16. " -----[ PLUGINS ]----- "
  17. call plug#begin('~/.vim/plugged')
  18. Plug 'itchyny/lightline.vim' " simple, goodlooking statusline
  19. Plug 'junegunn/fzf.vim' " fuzzy finder for files/buffers ..
  20. Plug 'ervandew/supertab' " tabcompletion
  21. Plug 'junegunn/goyo.vim' " Goyo, distraction free writing for LaTeX
  22. Plug 'HansMartin/inline-python' " Inline Python exec.
  23. Plug 'airblade/vim-rooter' " root-directory finder
  24. Plug 'dylanaraps/wal.vim' " Set coloscheme from pywal
  25. Plug 'rust-lang/rust.vim' " For Rust
  26. Plug 'preservim/nerdtree' " Not sure if needed
  27. Plug 'tpope/vim-fugitive' " Git for Vim
  28. call plug#end()
  29. " -----[ BASICS ]----- "
  30. " Color Settings
  31. colorscheme wal " using the wal colorscheme
  32. set mouse=a " for moving splits with the mouse
  33. " Encoding
  34. set encoding=utf-8 " set UTF-8 Encoding per Defautl (render glyphs and co)
  35. set nocompatible
  36. set conceallevel=0 " conceallevel for markdown/latex files
  37. " disable any (terminal-)bells
  38. set noeb
  39. set novb
  40. set belloff=all
  41. " Path settings
  42. set backupdir=$HOME/.config/nvim/backups
  43. set noswapfile
  44. set undodir=$HOME/.config/nvim/undo
  45. " Syntax and Lines
  46. syntax enable
  47. set number
  48. set relativenumber
  49. filetype plugin indent on
  50. " CursorLine
  51. " set cursorline
  52. " hi CursorLine term=none cterm=none
  53. " Tab/Spacing settings
  54. set expandtab " use spaces instead of tabs
  55. set shiftwidth=4 " number of columns when indenting with > or <
  56. set softtabstop=4 " number of spaces when hitting tab
  57. set autoindent " set indentation from previous line
  58. " searching...
  59. set ignorecase " case insensitive
  60. set nohlsearch " no search highlighting after the search is done
  61. set noshowmatch " disable that blinking bracket stuff
  62. set wildmenu " shows menu for tab completion
  63. set incsearch " search if you type the letters
  64. set path+=** " include all subdirs for finding files (eg. :find)
  65. set backspace=2
  66. set scrolloff=2
  67. " -----[ Remappings ]----- "
  68. " Bind 'n' to nzz (center current line)
  69. nnoremap n nzz
  70. nnoremap N Nzz
  71. " Jump 5 lines at once with Ctr+e and Ctr+y
  72. nnoremap <C-e> 5<C-e>
  73. nnoremap <C-y> 5<C-y>
  74. " mapping for fast buffer switching
  75. nnoremap <leader>a :bp!<CR>
  76. noremap <leader>s :bn!<CR>
  77. " When selecting Text, keep the Block selected
  78. vmap < <gv
  79. vmap > >gv
  80. " Remove Trailling Whitespaces on Buffer Write
  81. autocmd BufWritePre * :%s/\s\+$//e
  82. " auto execute xrdb when .Xresources is saved
  83. autocmd BufWritePost ~/.Xresources !xrdb %
  84. " automatically adjust splits
  85. autocmd VimResized * wincmd =
  86. " use Ctr+C for Copy Pasterino into sys. clipboard
  87. vnoremap <C-c> "*y :let @+=@*<CR>
  88. nnoremap <leader>c "+yy
  89. " Bind Goyo to shortcut
  90. map <F3> <ESC>:Goyo <CR>
  91. " Markdown viewer script
  92. map <F9> <ESC>:silent !md-viewer % <CR>
  93. " Auto make
  94. map <F8> <ESC>:silent !make <CR>
  95. " -----[ Plugin Configuration ]----- "
  96. " Lightline - Status Line
  97. " To use the wombat colorscheme
  98. set noshowmode " no required when having lightline in place
  99. let g:lightline = {
  100. \ 'colorscheme': 'wombat',
  101. \ }
  102. " FZF - Best Tool ever
  103. nnoremap <C-t> :Tags<CR>
  104. nnoremap <C-b> :Buffers<CR>
  105. nnoremap <C-n> :Files<CR>
  106. " Nerdtree (tmp replacement with Vifm
  107. nnoremap <C-t> :NERDTreeToggle<CR>
  108. " Map the Python Evaluation into the vim-expression command(Q)
  109. nnoremap Q :EvalPython <CR>
  110. let g:il_append=1
  111. let g:il_use_nextline=0
  112. " UltiSnips (Ancient, but could come in handy at some day)
  113. "let g:UltiSnipsExpandTrigger = '<tab>'
  114. let g:UltiSnipsExpandTrigger = '<c-s>'
  115. let g:UltiSnipsJumpForwardTrigger = '<tab>'
  116. let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
  117. let g:UltiSnipsSnippetsDir='~/.vim/UltiSnips/'
  118. " Goyo Configuration
  119. let g:goyo_width=100
  120. let g:goyo_height=100
  121. " --- LaTeX Mappings ---
  122. " stolen from Luke Smith's vimrc "
  123. " will only work in .tex files
  124. " Navigating with guides
  125. autocmd FileType tex inoremap <Space><Tab> <Esc>/<++><Enter>"_c4l
  126. autocmd FileType tex vnoremap <Space><Tab> <Esc>/<++><Enter>"_c4l
  127. autocmd FileType tex nnoremap <Space><Tab> <Esc>/<++><Enter>"_c4l
  128. " Compile document using xelatex:
  129. autocmd FileType tex inoremap <F5> <Esc>:!pdflatex<space><c-r>%<Enter>a
  130. autocmd FileType tex nnoremap <F5> :!pdflatex<space><c-r>%<Enter>
  131. " Shortcuts
  132. autocmd FileType tex inoremap ,em \emph{}<Space><++><Esc>T{i
  133. autocmd FileType tex inoremap ,bf \textbf{}<Space><++><Esc>T{i
  134. autocmd FileType tex vnoremap , <ESC>`<i\{<ESC>`>2la}<ESC>?\\{<Enter>a
  135. autocmd FileType tex inoremap ,it \textit{}<Space><++><Esc>T{i
  136. autocmd FileType tex inoremap ,ol \begin{enumerate}<Enter><Enter>\end{enumerate}<Enter><Enter><++><Esc>3kA\item<Space>
  137. autocmd FileType tex inoremap ,ul \begin{itemize}<Enter><Enter>\end{itemize}<Enter><Enter><++><Esc>3kA\item<Space>
  138. autocmd FileType tex inoremap ,li <Enter>\item<Space>
  139. autocmd FileType tex inoremap ,ref \ref{}<Space><++><Esc>T{i
  140. autocmd FileType tex inoremap ,tab \begin{tabular}<Enter><++><Enter>\end{tabular}<Enter><Enter><++><Esc>4kA{}<Esc>i
  141. autocmd FileType tex inoremap ,sc \textsc{}<Space><++><Esc>T{i
  142. autocmd FileType tex inoremap ,chap \chapter{}<Enter><Enter><++><Esc>2kf}i
  143. autocmd FileType tex inoremap ,sec \section{}<Enter><Enter><++><Esc>2kf}i
  144. autocmd FileType tex inoremap ,ssec \subsection{}<Enter><Enter><++><Esc>2kf}i
  145. autocmd FileType tex inoremap ,sssec \subsubsection{}<Enter><Enter><++><Esc>2kf}i
  146. autocmd FileType tex inoremap ,col \begin{columns}[T]<Enter>\begin{column}{.5\textwidth}<Enter><Enter>\end{column}<Enter>\begin{column}{.5\textwidth}<Enter><++><Enter>\end{column}<Enter>\end{columns}<Esc>5kA
  147. " -----[ GUI ]----- "
  148. " This hides the Toolbar, Menubar and left/right scrollbar in gvim
  149. if has("gui_running")
  150. set guioptions -=T
  151. set guioptions -=m
  152. set guioptions -=r
  153. set guioptions -=L
  154. endif
  155. " -----[ Fonts ]----- "
  156. if has("gui_running")
  157. if has("gui_gtk2")
  158. set guifont=Hack\ 9 elseif has("gui_macvim")
  159. set guifont=Menlo\ Regular:h14
  160. elseif has("gui_win32")
  161. set guifont=Hack:h9:cANSI,Consolas:h11:cANSI
  162. endif
  163. endif
  164. " -----[ Panels ]----- "
  165. " This remaps Ctrl+W +<direction> to Ctr+HJKL for changig the Panel in a
  166. " splitted mode
  167. map <C-h> <C-W>h
  168. map <C-j> <C-W>j
  169. map <C-k> <C-W>k
  170. map <C-l> <C-W>l
  171. " This is to get Tabs by using the <leader> Key (Leader Key: '\')
  172. nmap <leader>1 1gt
  173. nmap <leader>2 2gt
  174. nmap <leader>3 3gt
  175. nmap <leader>4 4gt
  176. nmap <leader>5 5gt
  177. nmap <leader>6 6gt
  178. " -----[ MS Windows ]----- "
  179. " Getting the Windows mswin behaviour
  180. if has("win32")
  181. source $VIMRUNTIME/mswin.vim
  182. behave mswin
  183. endif
  184. if exists("b:current_syntax")
  185. finish
  186. endif
  187. " Conceal
  188. hi Conceal guibg=NONE
  189. setlocal cole=1