Configure (n)vim with Ansible. Fully

This commit is contained in:
Geoffrey Frogeye 2021-07-03 14:13:25 +02:00
parent dd0e5a2189
commit 72e54fd8f7
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
43 changed files with 355 additions and 378 deletions

View file

@ -0,0 +1,2 @@
{# Regex for words, with case in mind #}
{{ add_source('tpope/tpope-vim-abolish') -}}

View file

@ -0,0 +1,14 @@
{{ add_source('vim-airline/vim-airline') -}}
{{ add_source('vim-airline/vim-airline-themes') -}}
set noshowmode
set laststatus=2
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline_section_a = airline#section#create(['mode'])
let g:airline_section_b = airline#section#create(['branch', 'hunks'])
" let g:airline_section_z = airline#section#create(['%B', '@', '%l', ':', '%c'])
let g:airline_theme = 'base16_monokai'
let airline#extensions#languageclient#error_symbol = '✖ '
let airline#extensions#languageclient#warning_symbol = '⚠ '

View file

@ -1,3 +1,5 @@
" Asynchronous Lint Engine
" LSP client for vim and nvim
{{ add_source('dense-analysis/ale') }}
nmap <F3> :ALEFix<CR>
@ -6,4 +8,3 @@ let g:ale_sign_error = '×'
let g:ale_sign_warning = '!'
let g:ale_completion_enabled = 1
let g:ale_fixers = ['autopep8', 'shfmt', 'uncrustify', 'remove_trailing_lines', 'trim_whitespace', 'phpcbf']
let g:ale_php_phpcs_standard = '/srv/http/machines/ruleset.xml'

View file

@ -0,0 +1,2 @@
{# Various for Ansible #}
{{ add_source('pearofducks/ansible-vim', { 'do': './UltiSnips/generate.sh'}) -}}

View file

@ -0,0 +1,14 @@
{{ add_source('prabirshrestha/asyncomplete.vim') -}}
let g:asyncomplete_auto_popup = 1
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<cr>"
imap <c-space> <Plug>(asyncomplete_force_refresh)
{{ add_source('prabirshrestha/asyncomplete-file.vim') -}}
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#file#get_source_options({
\ 'name': 'file',
\ 'whitelist': ['*'],
\ 'priority': 10,
\ 'completor': function('asyncomplete#sources#file#completor')
\ }))

View file

@ -0,0 +1,8 @@
{{ add_source('chriskempson/base16-vim') -}}
colorscheme base16-default-dark
" let base16colorspace=256
" set termguicolors
" Some terminals requires a combination of the previous
" (the last one being setting the colorscheme to the exact theme in use),
" but it's a mess so I let you to figure out which one needs which

View file

@ -1 +1,26 @@
{{ add_source('Shougo/deoplete.nvim', {'do': ':UpdateRemotePlugins'}) }}
{# Auto-completion for vim and nvim #}
{% if variant == 'nvim' -%}
{{ add_source('Shougo/deoplete.nvim', {'do': ':UpdateRemotePlugins'}) -}}
{% else -%}
{{ add_source('Shougo/deoplete.nvim') -}}
{{ add_source('roxma/nvim-yarp') -}}
{{ add_source('roxma/vim-hug-neovim-rpc') -}}
{% endif -%}
{% raw %}
let g:deoplete#enable_at_startup = 1
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ deoplete#manual_complete()
function! s:check_back_space() abort "{{{
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction"}}}
{% endraw %}
" suggested by ssemshi to make it not too slow
" let g:deoplete#auto_complete_delay = 100
call deoplete#custom#option({
\ 'auto_complete_delay': 100,
\ 'smart_case': v:true,
\ })

View file

@ -0,0 +1,4 @@
{# Aligning lines around a certain character #}
{{ add_source('junegunn/vim-easy-align') -}}
" Align GitHub-flavored Markdown tables
au FileType markdown vmap <Bar> :EasyAlign*<Bar><Enter>

View file

@ -0,0 +1,4 @@
{# Git basics #}
{{ add_source('tpope/vim-fugitive') -}}
{# Open files in GitLab #}
{{ add_source('shumphrey/fugitive-gitlab.vim') -}}

View file

@ -0,0 +1,36 @@
{# Fuzzy matching for all kind of stuff #}
{{ add_source('junegunn/fzf', {'do': './install --bin'}) }}
{{ add_source('junegunn/fzf.vim') -}}
let g:fzf_layout = { 'down': '~40%' }
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'border': ['fg', 'Ignore'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
let g:fzf_command_prefix = 'Fzf'
nmap gF :FzfFiles<CR>
nmap gf :FzfGFiles<CR>
nmap gb :FzfBuffers<CR>
nmap gL :FzfLines<CR>
nmap gl :FzfBLines<CR>
nmap gT :FzfTags<CR>
nmap gt :FzfBTags<CR>
nmap gm :FzfMarks<CR>
nmap gw :FzfWindows<CR>
nmap gh :FzfHistory<CR>
nmap gH :FzfHistory:<CR>
nmap gS :FzfHistory/<CR>
nmap gs :FzfSnippets<CR>
" TODO `gd` → go to tag matching selected word, or show a list with that
" of tags pre-filtered with that word

View file

@ -0,0 +1,2 @@
{# Show changed git lines in the gutter #}
{{ add_source('airblade/vim-gitgutter') -}}

View file

@ -0,0 +1,3 @@
{# Generate tags #}
{{ add_source('ludovicchabant/vim-gutentags') -}}
let g:gutentags_cache_dir = expand('~/.cache/{{ variant }}/tags')

View file

@ -0,0 +1,20 @@
{{ add_source('autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh'}) -}}
let g:LanguageClient_serverCommands = {
\ 'python': ['pyls'],
\ 'sh': ['bash-language-server', 'start'],
\ }
let g:LanguageClient_loggingFile = expand('~/.cache/{{ variant }}/LanguageClient.log')
function LC_maps()
if has_key(g:LanguageClient_serverCommands, &filetype)
nnoremap <buffer> <silent> K :call LanguageClient#textDocument_hover()<cr>
nnoremap <buffer> <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <buffer> <silent> gD :call LanguageClient#textDocument_references()<CR>
nnoremap <buffer> <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
nnoremap <buffer> <silent> <F3> :call LanguageClient#textDocument_formatting()<CR>
set completefunc=LanguageClient#complete
set omnifunc=LanguageClient#complete
endif
endfunction
autocmd FileType * call LC_maps()

View file

@ -0,0 +1,3 @@
{# Check grammar for human languages #}
{{ add_source('dpelle/vim-LanguageTool') -}}
let g:languagetool_jar = "/usr/share/java/languagetool/languagetool-commandline.jar"

View file

@ -0,0 +1,6 @@
{# Pandoc specific stuff because there's no LSP for it #}
{{ add_source('vim-pandoc/vim-pandoc') -}}
{{ add_source('vim-pandoc/vim-pandoc-syntax') -}}
let g:pandoc#modules#disabled = ["folding"]
let g:pandoc#spell#enabled = 0
let g:pandoc#syntax#conceal#use = 0

View file

@ -0,0 +1,2 @@
{# Auto-highlight one character per word for quick f/F movement #}
{{ add_source('unblevable/quick-scope') -}}

View file

@ -0,0 +1,2 @@
{# Semantic highlighting for Python for neovim #}
{{ add_source('numirias/semshi', {'do': ':UpdateRemotePlugins'}) -}}

View file

@ -0,0 +1,2 @@
{# When in f/F/t/T mode, highlight in red the characters that can be jumped to #}
{{ add_source('deris/vim-shot-f') -}}

View file

@ -0,0 +1,2 @@
{# Smoooooth scrolling #}
{{ add_source('terryma/vim-smooth-scroll') -}}

View file

@ -0,0 +1,4 @@
{# Use TAB for autocompletion #}
{{ add_source('ervandew/supertab') -}}
let g:SuperTabDefaultCompletionType = "<c-n>" " Go down when completing
let g:SuperTabContextDefaultCompletionType = "<c-n>"

View file

@ -0,0 +1,2 @@
{# Change surroundings pairs (e.g. brackets, quotes… #}
{{ add_source('tpope/vim-surround') -}}

View file

@ -0,0 +1,2 @@
{# Better interaction with surrounding pairs #}
{{ add_source('wellle/targets.vim') -}}

View file

@ -0,0 +1,2 @@
{# Language-aware (un)commenting #}
{{ add_source('tomtom/tcomment_vim') -}}

View file

@ -0,0 +1,2 @@
{{ add_source('mbbill/undotree') -}}
nmap <F7> :UndotreeToggle<CR>

View file

@ -0,0 +1,2 @@
{# Debug from the editor #}
{{ add_source('idanarye/vim-vebugger') -}}

View file

@ -0,0 +1,23 @@
{# LSP client for Vim8 and neovim #}
{{ add_source('prabirshrestha/vim-lsp') -}}
{{ add_source('mattn/vim-lsp-settings') -}}
" (providers are automatically detected thanks to vim-lsp-settings.
" You can even install some locally using :LspInstallServer)
nnoremap gd :LspDefinition<CR>
nnoremap gD :LspDeclaration<CR>
nnoremap <F3> :LspDocumentFormat<CR>
vnoremap <F3> :LspDocumentRangeFormat<CR>
nnoremap gE :LspNextDiagnostic<CR>
nnoremap ge :LspNextError<CR>
nnoremap <F2> :LspRename<CR>
let g:lsp_signs_enabled = 1
let g:lsp_diagnostics_echo_cursor = 1
let g:lsp_signs_error = {'text': '✗'}
let g:lsp_signs_warning = {'text': '‼'}
let g:lsp_signs_information = {'text': ''}
let g:lsp_signs_hint = {'text': '?'}
let g:lsp_highlight_references_enabled = 1

View file

@ -0,0 +1,12 @@
{# Tag bar #}
{{ add_source('liuchengxu/vista.vim') -}}
nmap <F8> :Vista!!<CR>
let g:vista_icon_indent = ["▸ ", ""]
let g:vista#renderer#enable_icon = 0
" The default icons can't be suitable for all the filetypes, you can extend it as you wish.
let g:vista#renderer#icons = {
\ "function": "f",
\ "variable": "x",
\ }