Dotfiles for different machines on different branches.
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.

185 lines
5.5 KiB

7 months ago
7 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
7 months ago
11 months ago
11 months ago
11 months ago
11 months ago
7 months ago
  1. " Begin Plugin section
  2. if ! filereadable(expand('~/.config/nvim/autoload/plug.vim'))
  3. echo "Downloading junegunn/vim-plug to manage plugins..."
  4. silent !mkdir -p ~/.config/nvim/autoload/
  5. silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ~/.config/nvim/autoload/plug.vim
  6. autocmd VimEnter * PlugInstall
  7. endif
  8. call plug#begin('~/.local/share/nvim/plugged')
  9. Plug 'lervag/vimtex' , {'for' : 'tex'} " Tex library for autocompletion
  10. Plug 'donRaphaco/neotex' , {'for': 'tex'} " Asynchronous pdf rendering
  11. Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'} " Filetree
  12. Plug 'majutsushi/tagbar' " Show tags
  13. Plug 'airblade/vim-gitgutter' " Git Upgrades
  14. Plug 'qpkorr/vim-renamer' " Bulk renamer
  15. Plug 'sirver/ultisnips' " Snippets
  16. Plug 'uiiaoo/java-syntax.vim' , {'for': 'java'} " Better syntax highlight for java than default
  17. Plug 'frazrepo/vim-rainbow' " Colorized matching brackets
  18. Plug 'junegunn/fzf.vim' " Quickly jump files using fzf
  19. Plug 'ryanoasis/vim-devicons' " Enable Icons for vim
  20. Plug 'rrethy/vim-hexokinase' , {'do': 'make hexokinase'} " Color Preview
  21. Plug 'tomasiser/vim-code-dark' " adding colorscheme
  22. "Plug 'blueshirts/darcula'
  23. Plug 'godlygeek/tabular' " Tabularizing things
  24. Plug 'plasticboy/vim-markdown' , {'for': 'md'} " Helps for markdown
  25. Plug 'tpope/vim-surround' " Help for quotes/parantheses
  26. Plug 'alvan/vim-closetag' " Auto close HTML tags
  27. call plug#end()
  28. " Colorscheme
  29. colorscheme codedark
  30. " Rainbow
  31. au FileType java,c,cpp,py,h call rainbow#load()
  32. " You complete me
  33. let g:ycm_global_ycm_extra_conf = '/home/tiynger/.config/nvim/ycm_extra_conf.py'
  34. let g:ycm_autoclose_preview_window_after_completion = 1
  35. let g:ycm_autoclose_preview_window_after_insertion = 1
  36. let g:ycm_semantic_triggers = {
  37. \ 'tex' : ['{']
  38. \}
  39. if !exists('g:ycm_semantic_triggers')
  40. let g:ycm_semantic_triggers = {}
  41. endif
  42. let g:ycm_semantic_triggers.tex = g:vimtex#re#youcompleteme
  43. let g:ycm_filepath_blacklist = {'*': 1}
  44. " Tagbar
  45. map <F3> :TagbarToggle<CR>
  46. " Nerdtree
  47. map <F2> :NERDTreeToggle<CR>
  48. autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
  49. let g:NERDTreeWinPos = "left"
  50. " Neotex
  51. let g:neotex_enabled = 2
  52. " CoVim
  53. let CoVim_default_name = "TiynGER"
  54. let CoVim_default_port = "7000"
  55. " Hexokinase
  56. let g:Hexokinase_refreshEvents = ['InsertLeave']
  57. let g:Hexokinase_optInPatterns = [
  58. \ 'full_hex',
  59. \ 'triple_hex',
  60. \ 'rgb',
  61. \ 'rgba',
  62. \ 'hsl',
  63. \ 'hsla',
  64. \ 'color_names'
  65. \]
  66. let g:Hexokinase_highlighters = ['backgroundfull']
  67. autocmd VimEnter * HexokinaseTurnOn
  68. " Vim-Mardown
  69. let g:vim_markdown_folding_disabled=1
  70. let g:vim_markdown_no_default_key_mappings=1
  71. " Vim-Closetag
  72. let g:closetag_filenames = '*.html,*.xhtml,*.phtml'
  73. let g:closetag_xhtml_filenames = '*.xhtml,*.jsx'
  74. let g:closetag_filetypes = 'html,xhtml,phtml'
  75. let g:closetag_xhtml_filetypes = 'xhtml,jsx'
  76. let g:closetag_emptyTags_caseSensitive = 1
  77. let g:closetag_regions = {
  78. \ 'typescript.tsx': 'jsxRegion,tsxRegion',
  79. \ 'javascript.jsx': 'jsxRegion',
  80. \ }
  81. let g:closetag_shortcut = '>'
  82. let g:closetag_close_shortcut = '<leader>>'
  83. " End Plugin section
  84. let mapleader =","
  85. set go=a
  86. " Enable mouse for all modes
  87. set mouse=a
  88. set clipboard+=unnamedplus
  89. " Enable command completion
  90. set wildmode=longest,list,full
  91. " Setting Tab-length
  92. set expandtab
  93. set softtabstop=4
  94. set shiftwidth=4
  95. " Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
  96. set splitbelow splitright
  97. " Disable case sensitive matching
  98. set ignorecase
  99. " Enable nocompatible mode
  100. set nocompatible
  101. " Enable Plugins
  102. filetype plugin on
  103. " Enable syntax highlighting
  104. syntax on
  105. " Enable true colors
  106. set termguicolors
  107. " Set utf-8 encoding
  108. set encoding=utf-8
  109. " Show relative numbers on left side
  110. set number relativenumber
  111. " Speedup vim with long lines
  112. set ttyfast
  113. set lazyredraw
  114. " enable persistent undo
  115. if has('persistent_undo')
  116. set undofile
  117. set undodir=$XDG_CACHE_HOME/vim/undo
  118. endif
  119. " Delete trailing whitespaces on save
  120. fun! TrimWhitespace()
  121. let l:save = winsaveview()
  122. keeppatterns %s/\s\+$//e
  123. call winrestview(l:save)
  124. endfun
  125. autocmd BufWritePre * :call TrimWhitespace()
  126. " Disables automatic commenting on newline:
  127. autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
  128. " Clean LaTex build files
  129. autocmd VimLeave *.tex !texclear %
  130. " Read files correctly
  131. autocmd BufRead,BufNewFile *.tex set filetype=tex
  132. autocmd BufRead,BufNewFile *.h set filetype=c
  133. " Mapping Dictionaries
  134. map <F5> :setlocal spell! spelllang=de_de<CR>
  135. map <F6> :set spelllang=en_us<CR>
  136. " Compiler for languages
  137. map <leader>c :w! \| !compiler <c-r>%<CR>
  138. " Open corresponding file (pdf/html/...)
  139. map <leader>p :!opout <c-r>%<CR><CR>
  140. " Shortcut for split navigation
  141. map <C-h> <C-w>h
  142. map <C-j> <C-w>j
  143. map <C-k> <C-w>k
  144. map <C-l> <C-w>l
  145. " Copy selected text to system clipboard (requires gvim/nvim/vim-x11 installed):
  146. map <C-p> "+P
  147. vnoremap <C-c> "+y
  148. " Save file as sudo on files that require root permission
  149. cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
  150. " Alias for replacing
  151. nnoremap S :%s//gI<Left><Left><Left>
  152. " Start Formatting section
  153. autocmd FileType java,python,c,tex,latex noremap <F8> gggqG
  154. au FileType python setlocal formatprg=autopep8\ -
  155. au FileType java setlocal formatprg=astyle\ --indent=spaces=2\ --style=google
  156. autocmd FileType java setlocal shiftwidth=2 softtabstop=2
  157. au FileType c setlocal formatprg=astyle\ --mode=c
  158. au FileType tex,latex setlocal formatprg=latexindent\ -
  159. " End Formatting section