Advertisement
ElMagoBlue

vimrc

Jan 25th, 2019
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 9.37 KB | None | 0 0
  1. "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
  2. "                                                                              "
  3. "                       __   _ _ _ __ ___  _ __ ___                            "
  4. "                       \ \ / / | '_ ` _ \| '__/ __|                           "
  5. "                        \ V /| | | | | | | | | (__                            "
  6. "                         \_/ |_|_| |_| |_|_|  \___|                           "
  7. "                                                                              "
  8. "                          Author: Łukasz Seremak                              "
  9. "                          Mail: lukasz.seremak@outlook.com                    "
  10. "                                                                              "
  11. "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
  12.  
  13. runtime! archlinux.vim
  14.  
  15.  
  16. """" START Plug Configuration
  17. if empty(glob('~/.vim/autoload/plug.vim'))
  18.   silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
  19.     \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  20.   autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
  21. endif
  22.  
  23.  
  24. set nocompatible
  25. syntax on
  26. set nowrap
  27. set encoding=utf8
  28.  
  29. " Use Unix as the standard file type
  30. set ffs=unix,dos,mac
  31.  
  32.  
  33. " set the runtime path to include Vundle and initialize
  34. call plug#begin('~/.vim/plugged')
  35.  
  36. Plug 'lukaszseremak/spacegrayy'
  37. Plug 'vim-airline/vim-airline'
  38. Plug 'vim-airline/vim-airline-themes'
  39. Plug 'davidhalter/jedi-vim'
  40. Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }
  41. Plug 'xuyuanp/nerdtree-git-plugin'
  42. Plug 'airblade/vim-gitgutter'
  43. Plug 'heavenshell/vim-pydocstring', { 'on':  'Pydocstring' }
  44. Plug 'mhinz/vim-startify'
  45. Plug 'Raimondi/delimitMate'
  46. Plug 'tmhedberg/SimpylFold'
  47. Plug 'tpope/vim-fugitive'
  48. Plug 'janko-m/vim-test', { 'for': 'python' }
  49. Plug 'ambv/black', { 'on':  'Black' }
  50. Plug 'bronson/vim-trailing-whitespace'
  51. Plug 'tpope/vim-surround'
  52. " Plug 'w0rp/ale'
  53. Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
  54. Plug 'junegunn/fzf.vim'
  55. " Plug 'majutsushi/tagbar', { 'on':  'TagbarToggle' }
  56. " Plug 'xolox/vim-easytags'
  57. Plug 'editorconfig/editorconfig-vim'
  58. Plug 'xuhdev/vim-latex-live-preview'
  59.  
  60.  
  61. call plug#end()
  62. filetype plugin indent on    " required
  63.  
  64. """" END Plug Configuration
  65.  
  66. "define a group `vimrc` and initialize
  67. augroup vimrc
  68.     autocmd!
  69. augroup END
  70.  
  71.  
  72. " Theme and Styling
  73. " so ~/.vim/bundle/colors/spacegray.vim
  74. colorscheme spacegrayy
  75. set termguicolors
  76. set t_Co=256
  77. let base16colorspace=256    " Access colors present in 256 colorspace
  78.  
  79.  
  80. " Basic configure
  81. set shiftwidth=4
  82. set softtabstop=4
  83. set smartindent
  84. set expandtab
  85. set path+=**
  86. set rnu
  87. set wildmenu
  88. set wildmode=list:longest,full  " configure wildmenu tab completion
  89. set wildignorecase
  90. set hidden
  91. set showmatch           " highlight matching parenthesis
  92. set mat=2   " How many tenths of a second to blink when matching brackets
  93. set ttyfast                                 " terminal acceleration
  94. set laststatus=2    " Always display the status line
  95. set clipboard=unnamed
  96. set nobackup                                " no backup files
  97. set nowritebackup
  98. set noswapfile
  99. set history=500
  100. set autoread    " Set to auto read when a file is changed from the outside
  101. " set lazyredraw  " Don't redraw while executing macros (good performance config)
  102. let g:elite_mode=1  " Enable Elite mode, no arrows
  103. let mapleader=','
  104.  
  105. " Spell-check set to F6:
  106. map <F6> :setlocal spell! spelllang=en_us<CR>
  107.  
  108. " Maintain undo history between sessions
  109. set undofile
  110. set undodir=~/.vim/undodir
  111.  
  112. " Add a bit extra margin to the left
  113. set foldcolumn=1
  114.  
  115. " OSX backspace fix
  116. set backspace=indent,eol,start
  117.  
  118. " new line without invoke insert mode
  119. nmap OO o<Esc>k
  120.  
  121. " disabling syntax highlighting after 128 columns
  122. set cursorline
  123. " set synmaxcol=150
  124.  
  125. " Disable mouse
  126. set mouse=
  127. set ttymouse=
  128.  
  129. " :W sudo saves the file
  130. command! W w !sudo tee % > /dev/null
  131.  
  132. " Move VISUAL LINE selection within buffer.
  133. vnoremap K :move '<-2<CR>gv=gv
  134. vnoremap J :move '>+1<CR>gv=gv
  135.  
  136. " Ignore compiled files
  137. set wildignore=*.o,*~,*.pyc
  138. set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
  139.  
  140. " Visual mode pressing * or # searches for the current selection
  141. vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>
  142. vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>
  143.  
  144. " Disable scrollbars
  145. set guioptions-=r
  146. set guioptions-=R
  147. set guioptions-=l
  148. set guioptions-=L
  149.  
  150. "Make the 151st column stand out
  151. if exists('+colorcolumn')
  152.  set colorcolumn=151
  153. else
  154.  au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>151v.\+', -1)
  155. endif
  156.  
  157.  
  158. " Python default config
  159. let python_highlight_all = 1
  160. au BufNewFile,BufRead *.py
  161.    \ set tabstop=4 |
  162.    \ set softtabstop=4 |
  163.    \ set shiftwidth=4 |
  164.    \ set expandtab |
  165.    \ set autoindent |
  166.    \ set fileformat=unix
  167.  
  168.  
  169. " vim-airline/vim-airline
  170. let g:airline_theme='powerlineish'
  171. let g:airline#extensions#tabline#enabled = 1
  172. let g:airline#extensions#virtualenv#enabled = 1
  173. let g:airline_detect_modified=1
  174. let g:airline_detect_spell=1
  175. let g:airline_powerline_fonts = 1
  176. let g:airline_symbols_ascii = 1
  177.  
  178.  
  179. " davidhalter/jedi-vim
  180. autocmd vimrc FileType python setlocal completeopt-=preview
  181. let g:jedi#use_splits_not_buffers = "right"
  182. let g:jedi#completions_command = "<c-n>"
  183. let g:SuperTabDefaultCompletionType = "context"
  184. let g:jedi#popup_on_dot = 0
  185.  
  186.  
  187.  
  188. " scrooloose/nerdtree
  189. autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
  190. nmap t :NERDTreeToggle<CR>
  191. let NERDTreeIgnore=['\.pyc$', '\~$']    "ignore files in NERDTree
  192.  
  193.  
  194. " airblade/vim-gitgutter
  195. set updatetime=1000
  196. nmap ]h <Plug>GitGutterNextHunk
  197. nmap [h <Plug>GitGutterPrevHunk
  198.  
  199.  
  200. " Raimondi/delimitMate
  201. let delimitMate_matchpairs = "(:),[:],{:},<:>"
  202.  
  203.  
  204. " tmhedberg/SimpylFold
  205. let g:SimpylFold_docstring_preview = 1
  206.  
  207.  
  208. " ambv/black
  209. let g:black_linelength = 120
  210. let g:black_skip_string_normalization = 1
  211.  
  212.  
  213. " janko-m/vim-test
  214. let test#python#runner = 'pytest'
  215.  
  216.  
  217. " " w0rp/ale
  218. " let g:ale_lint_on_enter = 1
  219. " let g:ale_set_loclist = 1
  220. " let g:ale_set_highlights = 1
  221. " let g:ale_completion_enabled = 1
  222. " let g:ale_maximum_file_size = 50000  " Don't lint large files (> 50KB), it can slow things down
  223. " let g:ale_lint_delay = 5000
  224. " let g:ale_linters = {
  225. " \    'cpp': ['clang'],
  226. " \    'python': ['pylint', 'flake8', 'pycodestyle'],
  227. " \}
  228. "
  229. " let python_max_line_length = '--max-line-length=150'
  230. " let g:ale_python_pylint_options = python_max_line_length
  231. " let g:ale_python_pycodestyle_options = python_max_line_length
  232. " let g:ale_python_flake8_options = python_max_line_length
  233. "
  234. " " change the format for echo messages
  235. " let g:ale_echo_msg_error_str = 'E'
  236. " let g:ale_echo_msg_warning_str = 'W'
  237. " let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
  238.  
  239. " navigate between errors quickly
  240. nmap <silent> <C-k> <Plug>(ale_previous_wrap)
  241. nmap <silent> <C-j> <Plug>(ale_next_wrap)
  242.  
  243.  
  244. " junegunn/fzf.vim
  245. function! FZFOpen(command_str)
  246.   if (expand('%') =~# 'NERD_tree' && winnr('$') > 1)
  247.     exe "normal! \<c-w>\<c-w>"
  248.   endif
  249.   exe 'normal! ' . a:command_str . "\<cr>"
  250. endfunction
  251.  
  252. let g:fzf_action = {
  253.   \ 'ctrl-t': 'tab split',
  254.   \ 'ctrl-x': 'split',
  255.   \ 'ctrl-v': 'vsplit' }
  256.  
  257. let g:fzf_colors =
  258. \ { 'fg':      ['fg', 'Normal'],
  259.   \ 'bg':      ['bg', 'Normal'],
  260.   \ 'hl':      ['fg', 'Comment'],
  261.   \ 'fg+':     ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
  262.   \ 'bg+':     ['bg', 'CursorLine', 'CursorColumn'],
  263.   \ 'hl+':     ['fg', 'Statement'],
  264.   \ 'info':    ['fg', 'PreProc'],
  265.   \ 'border':  ['fg', 'Ignore'],
  266.   \ 'prompt':  ['fg', 'Conditional'],
  267.   \ 'pointer': ['fg', 'Exception'],
  268.   \ 'marker':  ['fg', 'Keyword'],
  269.   \ 'spinner': ['fg', 'Label'],
  270.   \ 'header':  ['fg', 'Comment'] }
  271.  
  272.  
  273. imap <c-x><c-f> <plug>(fzf-complete-path)
  274. imap <c-x><c-l> <plug>(fzf-complete-line)
  275.  
  276. nnoremap <silent> <C-p> :call FZFOpen(':Files')<CR>
  277. nnoremap <silent> <C-g>l :call FZFOpen(':BLines')<CR>
  278. nnoremap <silent> <C-g>w :call FZFOpen(':Windows')<CR>
  279. nnoremap <silent> <C-g>t :call FZFOpen(':BTags')<CR>
  280. nnoremap <silent> <C-g>bc :call FZFOpen(':BCommits')<CR>
  281. nnoremap <silent> <C-g>c :Commands<CR>
  282.  
  283.  
  284. " " majutsushi/tagbar
  285. " autocmd FileType tagbar setlocal nocursorline nocursorcolumn
  286. " nmap <F8> :TagbarToggle<CR>
  287. " let g:tagbar_autoclose = 1
  288. " let g:tagbar_autofocus = 1
  289. " let g:tagbar_map_openallfolds = "zi"
  290. " let g:tagbar_map_closeallfolds = "zc"
  291. " let g:tagbar_map_nexttag = "n"
  292. " let g:tagbar_map_prevtag = "p"
  293. " let g:tagbar_sort = 0
  294. " let g:tagbar_autofocus = 1
  295. " let g:tagbar_case_insensitive = 1
  296. " let g:tagbar_show_linenumbers = 2
  297. "
  298. "
  299. " "  xolox/vim-easytags
  300. " let g:easytags_async = 1
  301. " let g:ycm_collect_identifiers_from_tags_files=0
  302. " let g:easytags_syntax_keyword = 'always'
  303. " let g:easytags_file = '~/.vim/tags'
  304.  
  305. " xuhdev/vim-latex-live-preview
  306. autocmd Filetype tex setl updatetime=1
  307. let g:livepreview_previewer = 'xreader'
  308.  
  309.  
  310. function! VisualSelection(direction, extra_filter) range
  311.     let l:saved_reg = @"
  312.     execute "normal! vgvy"
  313.  
  314.     let l:pattern = escape(@", "\\/.*'$^~[]")
  315.    let l:pattern = substitute(l:pattern, "\n$", "", "")
  316.  
  317.    if a:direction == 'gv'
  318.        call CmdLine("Ack '" . l:pattern . "' " )
  319.    elseif a:direction == 'replace'
  320.        call CmdLine("%s" . '/'. l:pattern . '/')
  321.    endif
  322.  
  323.    let @/ = l:pattern
  324.    let @" = l:saved_reg
  325. endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement