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.

154 lines
4.4 KiB

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