dotfiles/vim/plugins.vim

281 lines
7.7 KiB
VimL
Raw Normal View History

2021-01-31 21:45:12 +01:00
scriptencoding utf-8
2021-02-01 19:17:51 +01:00
" © Alicia Sykes <https://aliciasykes.com> 2021 Licensed under MIT
2021-01-31 21:45:12 +01:00
2021-02-01 19:17:51 +01:00
" Initiate Plugins
2021-01-31 21:45:12 +01:00
call plug#begin('~/.vim/plugged')
2021-02-01 19:17:51 +01:00
" Layout and Navigation
Plug 'vim-airline/vim-airline'
Plug 'preservim/nerdtree'
Plug 'andymass/vim-matchup'
Plug 'preservim/tagbar'
Plug 'ludovicchabant/vim-gutentags'
2021-01-31 21:45:12 +01:00
Plug '~/.fzf'
Plug 'junegunn/fzf.vim'
2021-02-01 19:17:51 +01:00
Plug 'psliwka/vim-smoothie'
Plug 'ryanoasis/vim-devicons'
2021-01-31 21:45:12 +01:00
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim', { 'do': '!pip install --user --upgrade neovim' }
endif
2021-02-01 19:17:51 +01:00
" Text Operations
Plug 'preservim/nerdcommenter'
Plug 'dense-analysis/ale'
2021-01-31 21:45:12 +01:00
Plug 'tpope/vim-surround'
2021-02-01 19:17:51 +01:00
Plug 'haya14busa/incsearch.vim'
Plug 'mg979/vim-visual-multi'
Plug 'triglav/vim-visual-increment'
Plug 'janko/vim-test'
Plug 'vim-syntastic/syntastic'
2021-01-31 21:45:12 +01:00
2021-02-01 19:17:51 +01:00
" Git
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
Plug 'rhysd/committia.vim'
Plug 'tpope/vim-git'
" Specific File Types
2021-01-31 21:45:12 +01:00
Plug 'pangloss/vim-javascript', { 'for': ['javascript'] }
Plug 'HerringtonDarkholme/yats.vim', { 'for': ['typescript'] }
2021-02-01 19:17:51 +01:00
Plug 'MaxMEllon/vim-jsx-pretty', { 'for': ['jsx', 'tsx'] }
Plug 'ap/vim-css-color', { 'for': ['css', 'scss', 'sass'] }
Plug 'mustache/vim-mustache-handlebars', {'for': ['mustache', 'handlebars', 'html']}
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
2021-01-31 21:45:12 +01:00
Plug 'vim-scripts/indentpython.vim', {'for': ['python']}
2021-02-01 19:17:51 +01:00
Plug 'tmhedberg/SimpylFold', {'for': ['python']}
Plug 'lervag/vimtex', { 'for': ['tex'] }
Plug 'ekalinin/Dockerfile.vim', { 'for': ['dockerfile', 'docker-compose', 'Dockerfile'], 'do': 'make install' }
2021-01-31 21:45:12 +01:00
Plug 'elzr/vim-json', {'for': ['json']}
2021-02-01 19:17:51 +01:00
Plug 'raimon49/requirements.txt.vim', {'for': ['requirements']}
2021-01-31 21:45:12 +01:00
Plug 'gabrielelana/vim-markdown', {'for': ['markdown']}
2021-02-01 19:17:51 +01:00
Plug 'zinit-zsh/zinit-vim-syntax'
2021-01-31 21:45:12 +01:00
Plug 'chr4/nginx.vim'
2021-02-01 19:17:51 +01:00
if has('nvim')
Plug 'numirias/semshi', {'for': ['python'], 'do': ':UpdateRemotePlugins' }
endif
2021-01-31 21:45:12 +01:00
2021-02-01 19:17:51 +01:00
" Themes
Plug 'dracula/vim', { 'as': 'dracula' }
2021-01-31 21:45:12 +01:00
call plug#end()
2021-02-01 19:17:51 +01:00
" Plugin Configuration
2021-01-31 21:45:12 +01:00
" =====================
augroup vim_test_settings
autocmd!
let g:test#strategy = 'neovim'
let g:test#neovim#term_position = 'vertical'
2021-02-01 19:17:51 +01:00
" Integrate with coverage tool
2021-01-31 21:45:12 +01:00
let g:test#python#pytest#options = '--cov-branch --cov-context=test'
" disable vim-projectionist
let g:test#no_alternate = 1
nmap <silent> <C-t>n :TestNearest<CR>
nmap <silent> <C-t>f :TestFile<CR>
nmap <silent> <C-t>s :TestSuite<CR>
nmap <silent> <C-t>l :TestLast<CR>
nmap <silent> <C-t>v :TestVisit<CR>
augroup end
augroup tagbar_plugin_settins
autocmd!
let g:tagbar_ctags_bin='ctags'
let g:tagbar_iconchars = ['►', '▼']
let g:tagbar_autoclose = 1
let g:tagbar_type_markdown = {
\ 'ctagstype' : 'markdown',
\ 'kinds' : [
\ 'h:headings',
\ 'l:links',
\ 'i:images'
\ ],
\ }
let g:tagbar_type_sh = {
\ 'ctagstype' : 'sh',
\ 'kinds' : [
\ 'f:functions',
\ 'v:variables',
\ ],
\ }
let g:tagbar_type_elm = {
\ 'ctagstype' : 'elm',
\ 'kinds' : [
\ 'm:module',
\ 'i:imports',
\ 't:types',
\ 'C:constructors',
\ 'c:constants',
\ 'f:functions',
\ 'p:ports'
\ ],
\ }
let g:tagbar_type_ansible = {
\ 'ctagstype' : 'ansible',
\ 'kinds' : [
\ 't:tasks'
\ ],
\ }
nmap <F8> :TagbarToggle<CR>
augroup END
if has_key(g:plugs, 'vim-airline')
augroup airline_plugin_settings
autocmd!
let g:airline_powerline_fonts = 1
let g:airline_left_sep='' " Slightly fancier than '>'
let g:airline_right_sep='' " Slightly fancier than '<'
let g:airline#extensions#ale#enabled = 1
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep=' '
let g:airline#extensions#tabline#left_alt_sep=' '
let g:airline#extensions#tabline#buffer_nr_format = '%s '
let g:airline#extensions#tabline#buffer_nr_show = 1
augroup END
endif
2021-02-01 19:17:51 +01:00
" Commit Msg
2021-01-31 21:45:12 +01:00
let g:committia_hooks = {}
function! g:committia_hooks.edit_open(info)
" Scroll the diff window from insert mode
" Map <C-n> and <C-p>
imap <buffer><C-n> <Plug>(committia-scroll-diff-down-half)
imap <buffer><C-p> <Plug>(committia-scroll-diff-up-half)
endfunction
2021-02-01 19:17:51 +01:00
" Python
2021-01-31 21:45:12 +01:00
let python_highlight_all = 1
let g:pyenv#auto_create_ctags = 1
let g:pyenv#auto_assign_ctags = 1
2021-02-01 19:17:51 +01:00
" Gutter
2021-01-31 21:45:12 +01:00
augroup gitgutter_options
autocmd!
let g:gitgutter_diff_args = '-w' " ignore whitespace changes
let g:gitgutter_sign_added = ''
let g:gitgutter_sign_modified = ''
let g:gitgutter_sign_modified_removed = ''
let g:gitgutter_sign_removed = ''
let g:gitgutter_sign_removed_first_line = ''
let g:gitgutter_highlight_linenrs = 1
nmap <A-,> <Plug>(GitGutterUndoHunk)
nmap <A-.> <Plug>(GitGutterStageHunk)
nmap <A-/> <Plug>(GitGutterPreviewHunk)
augroup END
augroup incremental_search_options
autocmd!
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
" automatically turn off hlsearch
set hlsearch
let g:incsearch#auto_nohlsearch = 1
" and deal in some mappings
map n <Plug>(incsearch-nohl-n)
map N <Plug>(incsearch-nohl-N)
map * <Plug>(incsearch-nohl-*)
map # <Plug>(incsearch-nohl-#)
map g* <Plug>(incsearch-nohl-g*)
map g# <Plug>(incsearch-nohl-g#)
" do not persist search end
let g:incsearch#do_not_save_error_message_history = 1
" different highlight colors
let g:incsearch#separate_highlight = 1
augroup END
augroup gutentags_options
autocmd!
let g:gutentags_ctags_tagfile = '.git/tags'
let g:gutentags_file_list_command = {
\ 'markers': {
\ '.git': 'git grep --cached -I -l -e $""',
\ },
\ }
augroup END
if has_key(g:plugs, 'fzf.vim')
augroup fzf_settings
autocmd!
" fzf mappings
nmap <Leader>t :Tags<CR>
nmap <Leader>bt :BTags<CR>
nmap <Leader>f :GFiles<CR>
nmap <Leader>F :Files<CR>
nmap <Leader>c :Commits<CR>
nmap <Leader>b :Buffers<CR>
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
" floating window
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }
augroup END
" ale settings
augroup ale_plugin_settings
autocmd!
let g:ale_fix_on_save = 1 " run on save
let g:ale_lint_on_save = 1 " 2 options allow to lint only when file is saved
let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_enter = 1 " lint when entering the buffer
let g:ale_completion_enabled = 0 " do not mix up stuff with deoplete
let g:ale_sign_error = '✖' " error sign
let g:ale_sign_warning = '⚠' " warning sign
let g:ale_fixers = ['trim_whitespace', 'remove_trailing_lines']
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
let g:ale_set_balloons = 1
nmap <A-f> <Plug>(ale_fix)<CR>
nmap <A-l> <Plug>(ale_lint)<CR>
nmap <A-d> <Plug>(ale_detail)<CR>
nmap <A-k> <Plug>(ale_previous_wrap)
nmap <A-j> <Plug>(ale_next_wrap)
nmap <F3> <Plug>(ale_hover)
nmap <F4> <Plug>(ale_go_to_definition)
2021-02-01 19:17:51 +01:00
if has('nvim')
autocmd VimEnter *
\ set updatetime=1000 |
\ let g:ale_lint_on_text_changed = 0
autocmd CursorHold * call ale#Queue(0)
autocmd CursorHoldI * call ale#Queue(0)
autocmd InsertEnter * call ale#Queue(0)
autocmd InsertLeave * call ale#Queue(0)
endif
2021-01-31 21:45:12 +01:00
augroup END
endif
2021-02-01 19:17:51 +01:00