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.

165 lines
4.8 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' " 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 'godlygeek/tabular' " Tabularizing things
  23. Plug 'plasticboy/vim-markdown' , {'for': 'md'} " Helps for markdown
  24. call plug#end()
  25. " Rainbow
  26. au FileType java,c,cpp,py,h call rainbow#load()
  27. " You complete me
  28. let g:ycm_global_ycm_extra_conf = '/home/tiynger/.config/nvim/ycm_extra_conf.py'
  29. let g:ycm_semantic_triggers = {
  30. \ 'tex' : ['{']
  31. \}
  32. if !exists('g:ycm_semantic_triggers')
  33. let g:ycm_semantic_triggers = {}
  34. endif
  35. let g:ycm_semantic_triggers.tex = g:vimtex#re#youcompleteme
  36. " Tagbar
  37. map <F3> :TagbarToggle<CR>
  38. " Nerdtree
  39. map <F2> :NERDTreeToggle<CR>
  40. autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
  41. let g:NERDTreeWinPos = "left"
  42. " Neotex
  43. let g:neotex_enabled = 2
  44. " CoVim
  45. let CoVim_default_name = "TiynGER"
  46. let CoVim_default_port = "7000"
  47. " Hexokinase
  48. let g:Hexokinase_refreshEvents = ['InsertLeave']
  49. let g:Hexokinase_optInPatterns = [
  50. \ 'full_hex',
  51. \ 'triple_hex',
  52. \ 'rgb',
  53. \ 'rgba',
  54. \ 'hsl',
  55. \ 'hsla',
  56. \ 'color_names'
  57. \]
  58. let g:Hexokinase_highlighters = ['backgroundfull']
  59. autocmd VimEnter * HexokinaseTurnOn
  60. " Vim-Mardown
  61. let g:vim_markdown_folding_disabled=1
  62. let g:vim_markdown_no_default_key_mappings=1
  63. " End Plugin section
  64. let mapleader =","
  65. set go=a
  66. " Enable mouse for all modes
  67. set mouse=a
  68. set clipboard+=unnamedplus
  69. " Enable command completion
  70. set wildmode=longest,list,full
  71. " Setting Tab-length
  72. set expandtab
  73. set softtabstop=4
  74. set shiftwidth=4
  75. " Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
  76. set splitbelow splitright
  77. " Disable case sensitive matching
  78. set ignorecase
  79. " Enable nocompatible mode
  80. set nocompatible
  81. " Enable Plugins
  82. filetype plugin on
  83. " Enable syntax highlighting
  84. syntax on
  85. " Enable true colors
  86. set termguicolors
  87. " Set utf-8 encoding
  88. set encoding=utf-8
  89. " Show relative numbers on left side
  90. set number relativenumber
  91. " Speedup vim with long lines
  92. set ttyfast
  93. set lazyredraw
  94. " enable persistent undo
  95. if has('persistent_undo')
  96. set undofile
  97. set undodir=$XDG_CACHE_HOME/vim/undo
  98. endif
  99. " Colorscheme
  100. colorscheme codedark
  101. highlight CursorLine ctermbg=Yellow cterm=bold guibg=#1b1b1b
  102. highlight CursorColumn ctermbg=Yellow cterm=bold guibg=#1b1b1b
  103. " Center screen on Insertion
  104. autocmd InsertEnter * norm zz
  105. " Delete trailing whitespaces on save
  106. autocmd BufWritePre * %s/\s\+$//e
  107. " Disables automatic commenting on newline:
  108. autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
  109. " Clean LaTex build files
  110. autocmd VimLeave *.tex !texclear %
  111. " Read files correctly
  112. autocmd BufRead,BufNewFile *.tex set filetype=tex
  113. autocmd BufRead,BufNewFile *.h set filetype=c
  114. " Mapping Dictionaries
  115. map <F5> :setlocal spell! spelllang=de_de<CR>
  116. map <F6> :set spelllang=en_us<CR>
  117. " Compiler for languages
  118. map <leader>c :w! \| !compiler <c-r>%<CR>
  119. " Open corresponding file (pdf/html/...)
  120. map <leader>p :!opout <c-r>%<CR><CR>
  121. " Shortcut for split navigation
  122. map <C-h> <C-w>h
  123. map <C-j> <C-w>j
  124. map <C-k> <C-w>k
  125. map <C-l> <C-w>l
  126. " Copy selected text to system clipboard (requires gvim/nvim/vim-x11 installed):
  127. map <C-p> "+P
  128. vnoremap <C-c> "+y
  129. " Save file as sudo on files that require root permission
  130. cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
  131. " Alias for replacing
  132. nnoremap S :%s//gI<Left><Left><Left>
  133. " Start Formatting section
  134. autocmd FileType java,python,c,tex,latex noremap <F8> gggqG
  135. au FileType python setlocal formatprg=autopep8\ -
  136. au FileType java setlocal formatprg=astyle\ --indent=spaces=2\ --style=google
  137. autocmd FileType java setlocal shiftwidth=2 softtabstop=2
  138. au FileType c setlocal formatprg=astyle\ --mode=c
  139. au FileType tex,latex setlocal formatprg=latexindent\ -
  140. " End Formatting section