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.

163 lines
4.7 KiB

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