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

@ -1,5 +1,11 @@
- name: Upgrade Neovim plugins - name: Upgrade Neovim plugins
command: "nvim +PlugUpgrade +PlugUpdate +PlugInstall +qall" command: "nvim +PlugUpgrade +PlugUpdate +PlugInstall +qall!"
failed_when: no listen: nvim plugins changed
listen: neovim plugins changed environment:
VIMINIT: "source {{ ansible_user_dir }}/.config/nvim/plugininstall.vim"
- name: Upgrade Vim plugins
command: "vim +PlugUpgrade +PlugUpdate +PlugInstall +qall!"
listen: vim plugins changed
environment:
VIMINIT: "source {{ ansible_user_dir }}/.config/vim/plugininstall.vim"

View file

@ -1,14 +1,46 @@
- name: Create nvim configuration directory - name: Set vim variants to use
set_fact:
vim_variants:
- vim
- nvim
# TODO vim-minimal for bsh
# TODO Select those in a clever way
- name: Create vim configuration directory
file: file:
state: directory state: directory
path: "{{ ansible_user_dir }}/.config/{{ item }}" path: "{{ ansible_user_dir }}/.config/{{ item }}"
mode: "u=rwx,g=rx,o=rx" mode: "u=rwx,g=rx,o=rx"
with_items: loop: "{{ vim_variants }}"
- nvim
- name: Configure nvim - name: Install vim-plug
template: get_url:
src: nvim.j2 url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
dest: "{{ ansible_user_dir }}/.config/nvim/init.vim" dest: "{{ ansible_user_dir }}/.config/vim/plug.vim"
mode: "u=rw,g=r,o=r" mode: "u=rw,g=r,o=r"
tags: g
- name: Install loader
template:
src: loader.j2
dest: "{{ ansible_user_dir }}/.config/vim/loader.vim"
mode: "u=rw,g=r,o=r"
- name: Configure vim plugin list
template:
src: plugininstall.j2
dest: "{{ ansible_user_dir }}/.config/{{ variant }}/plugininstall.vim"
mode: "u=rw,g=r,o=r"
notify:
- "{{ variant }} plugins changed"
loop: "{{ vim_variants }}"
loop_control:
loop_var: variant
- name: Configure vim
template:
src: init.vim.j2
dest: "{{ ansible_user_dir }}/.config/{{ variant }}/init.vim"
mode: "u=rw,g=r,o=r"
loop: "{{ vim_variants }}"
loop_control:
loop_var: variant

View file

@ -1,5 +1,3 @@
""" VIM SETTINGS """
" From https://www.hillelwayne.com/post/intermediate-vim/ " From https://www.hillelwayne.com/post/intermediate-vim/
set encoding=utf-8 set encoding=utf-8
@ -49,6 +47,15 @@ if has('nvim')
augroup END augroup END
endif endif
" Keep undo history across sessions by storing it in a file
if has('persistent_undo')
let myUndoDir = expand(vimDir . '/undodir')
" Create dirs
call system('mkdir ' . myUndoDir)
let &undodir = myUndoDir
set undofile
endif
syntax enable syntax enable
" From http://stackoverflow.com/a/5004785/2766106 " From http://stackoverflow.com/a/5004785/2766106

View file

@ -0,0 +1,22 @@
set nocompatible
filetype on
" SET PATHS
set runtimepath+=~/.config/{{ variant }}
let vimDir = '$HOME/.cache/{{ variant }}'
call system('mkdir ' . vimDir)
let &runtimepath.=','.vimDir
set viminfo+=n~/.cache/{{ variant }}/viminfo
" PLUGIN INSTALLATION
source ~/.config/{{ variant }}/plugininstall.vim
" EDITOR CONFIGURATION
{% include 'editor.j2' %}
" PLUGINS CONFIGURATION
{% include 'pluginconfig.j2' %}

View file

@ -0,0 +1,5 @@
if has('nvim')
source ~/.config/nvim/init.vim
else
source ~/.config/vim/init.vim
endif

View file

@ -1,8 +0,0 @@
set nocompatible
filetype on
set runtimepath+=~/.config/vim,~/.cache/vim
set viminfo+=n~/.cache/vim/viminfo
{% include 'plugins.j2' %}

View file

@ -0,0 +1,2 @@
{% set plugins = namespace(sources=[]) %}
{% include 'pluginlist.j2' %}

View file

@ -0,0 +1,13 @@
source ~/.config/vim/plug.vim
{% set plugins = namespace(sources=[]) %}
{% import 'pluginlist.j2' as pluginlist with context %}
call plug#begin('~/.cache/{{ variant }}/plugged')
{% for link, extra in plugins.sources %}
{% if extra %}
Plug '{{ link }}', { {% for k, v in extra.items() %}'{{ k }}': '{{ v }}', {% endfor %} }
{% else %}
Plug '{{ link }}'
{% endif %}
{% endfor %}
call plug#end()

View file

@ -2,8 +2,57 @@
{% set plugins.sources = plugins.sources + [(link, extra)] %} {% set plugins.sources = plugins.sources + [(link, extra)] %}
{%- endmacro -%} {%- endmacro -%}
{% macro use_plugin(name) -%} {% macro use_plugin(name) -%}
{% include 'plugins/' + name + '.j2' %} " START PLUGIN CONFIG {{ name }}
{% include 'plugins/' + name + '.j2' +%}
" END PLUGIN CONFIG {{ name }}
{%- endmacro -%} {%- endmacro -%}
{{ use_plugin('ale') }} " Theming
{{ use_plugin('base16') }}
{{ use_plugin('airline') }}
" Goto utilities
{{ use_plugin('fzf') }}
" Search/replace
{{ use_plugin('abolish') }}
" Sourounding pairs
{{ use_plugin('surround') }}
{{ use_plugin('targets') }}
" f/F mode
{{ use_plugin('shot_f') }}
{{ use_plugin('quick_scope') }}
" Tags
{{ use_plugin('gutentags') }}
{{ use_plugin('vista') }}
" Language Server Client
{{ use_plugin('vim_lsp') }}
" Auto-completion
{{ use_plugin('deoplete') }} {{ use_plugin('deoplete') }}
{{ use_plugin('supertab') }}
" Undo management
{{ use_plugin('undotree') }}
" Git helpers
{{ use_plugin('fugitive') }}
{{ use_plugin('gitgutter') }}
" Language-specific stuff
{{ use_plugin('tcomment') }}
{{ use_plugin('languagetool') }}
{{ use_plugin('pandoc') }}
{% if 'c' in dev_stuffs or 'c++' in dev_stuffs %}
{{ use_plugin('vebugger') }}
{% endif %}
{% if 'python' in dev_stuffs and variant == 'nvim' %}
{{ use_plugin('semshi') }}
{% endif %}
{% if 'ansible' in dev_stuffs %}
{{ use_plugin('ansible') }}
{% endif %}

View file

@ -1,21 +0,0 @@
" Auto-install vim-plug
if empty(glob('~/.cache/vim/autoload/plug.vim'))
silent !curl -fLo ~/.cache/vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
{% set plugins = namespace(sources=[]) %}
{% import 'pluginlist.j2' as pluginlist with context %}
call plug#begin('~/.cache/vim/plugged')
{% for link, extra in plugins.sources %}
{% if extra %}
Plug '{{ link }}', { {% for k, v in extra.items() %}'{{ k }}': '{{ v }}', {% endfor %} }
{% else %}
Plug '{{ link }}'
{% endif %}
{% endfor %}
call plug#end()
{% include 'pluginlist.j2' %}

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') }} {{ add_source('dense-analysis/ale') }}
nmap <F3> :ALEFix<CR> nmap <F3> :ALEFix<CR>
@ -6,4 +8,3 @@ let g:ale_sign_error = '×'
let g:ale_sign_warning = '!' let g:ale_sign_warning = '!'
let g:ale_completion_enabled = 1 let g:ale_completion_enabled = 1
let g:ale_fixers = ['autopep8', 'shfmt', 'uncrustify', 'remove_trailing_lines', 'trim_whitespace', 'phpcbf'] 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",
\ }

View file

@ -44,8 +44,7 @@ export SCREENRC="$HOME/.config/screenrc"
export SQLITE_HISTFILE="$HOME/.cache/sqlite_history" export SQLITE_HISTFILE="$HOME/.cache/sqlite_history"
direnv TERMINFO "$HOME/.config/terminfo" direnv TERMINFO "$HOME/.config/terminfo"
export RXVT_SOCKET="$HOME/.cache/urxvtd-$HOST" export RXVT_SOCKET="$HOME/.cache/urxvtd-$HOST"
export MYVIMRC="$HOME/.config/vim/vimrc" export VIMINIT="source $HOME/.config/vim/loader.vim"
export VIMINIT="source $MYVIMRC"
direnv WINEPREFIX "$HOME/.cache/wineprefix/default" direnv WINEPREFIX "$HOME/.cache/wineprefix/default"
direnv YARN_CACHE_FOLDER "$HOME/.cache/yarn" direnv YARN_CACHE_FOLDER "$HOME/.cache/yarn"
export YARN_DISABLE_SELF_UPDATE_CHECK=true # This also disable the creation of a ~/.yarnrc file export YARN_DISABLE_SELF_UPDATE_CHECK=true # This also disable the creation of a ~/.yarnrc file

View file

@ -1 +0,0 @@
colorscheme.vim

View file

@ -1,23 +0,0 @@
" Put plugins and dictionaries in this dir (also on Windows)
let vimDir = '$HOME/.cache/vim'
let &runtimepath.=','.vimDir
" let base16colorspace=256
" set termguicolors
" source $HOME/.config/vim/colorscheme.vim
" 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
colorscheme base16-default-dark
" Keep undo history across sessions by storing it in a file
if has('persistent_undo')
let myUndoDir = expand(vimDir . '/undodir')
" Create dirs
call system('mkdir ' . vimDir)
call system('mkdir ' . myUndoDir)
let &undodir = myUndoDir
set undofile
endif

View file

@ -1,187 +0,0 @@
""" ALE """
" nmap <F3> :ALEFix<CR>
"
" 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'
" For PHP, install https://pear.php.net/package/PHP_CodeSniffer
""" UNDOTREE """
nmap <F7> :UndotreeToggle<CR>
""" VIM-AIRLINE """
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 = '⚠ '
""" FZF """
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
""" SUPERTAB """
let g:SuperTabDefaultCompletionType = "<c-n>" " Go down when completing
let g:SuperTabContextDefaultCompletionType = "<c-n>"
""" LanguageTool """
let g:languagetool_jar = "/usr/share/java/languagetool/languagetool-commandline.jar"
""" vim-pandoc """
let g:pandoc#modules#disabled = ["folding"]
let g:pandoc#spell#enabled = 0
let g:pandoc#syntax#conceal#use = 0
""" LanguageClient-neovim """
" let g:LanguageClient_serverCommands = {
" \ 'python': ['pyls'],
" \ 'sh': ['bash-language-server', 'start'],
" \ }
" let g:LanguageClient_loggingFile = expand('~/.cache/vim/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()
""" vim-lsp """
" (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
""" deoplete """
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"}}}
" 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,
\ })
""" asyncomplete """
" 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)
""" asyncomplete-file
" 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')
" \ }))
""" 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",
\ }
" EasyAlign
" Align GitHub-flavored Markdown tables
au FileType markdown vmap <Bar> :EasyAlign*<Bar><Enter>
" SmoothScroll
noremap <silent> <C-K> :call smooth_scroll#up(20, 5, 1)<CR>
noremap <silent> <C-J> :call smooth_scroll#down(20, 5, 1)<CR>
" gutentags
let g:gutentags_cache_dir = expand('~/.cache/vim/tags')

View file

@ -1,105 +0,0 @@
""" PLUGINS MANAGEMENT """
" NOTE 18-06-24 Got rid of Vundle in favor of vim-plug (why: more recent, supports
" Neovim, simpler). Commented out plugins that seemed useless, feel free to
" uncomment them again if you need to
" Auto-install vim-plug
if empty(glob('~/.cache/vim/autoload/plug.vim'))
silent !curl -fLo ~/.cache/vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Plugin definition
call plug#begin('~/.cache/vim/plugged')
" Plug 'L9'
" Plug 'rstacruz/sparkup', {'rtp': 'vim/'}
Plug 'chriskempson/base16-vim'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-fugitive'
Plug 'shumphrey/fugitive-gitlab.vim'
" Plug 'tpope/vim-repeat'
" Regex for words, with case in mind
Plug 'tpope/tpope-vim-abolish'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'airblade/vim-gitgutter'
Plug 'mbbill/undotree'
Plug 'ludovicchabant/vim-gutentags'
" Plug 'majutsushi/tagbar'
Plug 'wellle/targets.vim'
" Plug 'Chiel92/vim-autoformat'
Plug 'tomtom/tcomment_vim'
" Plug 'Shougo/denite.nvim'
" Plug 'tomlion/vim-solidity'
" Plug 'godlygeek/tabular'
" Plug 'jrozner/vim-antlr'
" When in f/F/t/T mode, highlight in red the characters that can be jumped to
Plug 'deris/vim-shot-f'
" Auto-highlight one character per word for quick f/F movement
Plug 'unblevable/quick-scope'
" Auto-completion
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
" Plug 'prabirshrestha/asyncomplete.vim'
" Plug 'prabirshrestha/asyncomplete-file.vim'
" Plug 'python-mode/python-mode', { 'branch': 'develop' }
Plug 'junegunn/fzf', {'do': './install --bin'}
Plug 'junegunn/fzf.vim'
Plug 'ervandew/supertab'
Plug 'dpelle/vim-LanguageTool'
Plug 'terryma/vim-smooth-scroll'
Plug 'vim-pandoc/vim-pandoc'
Plug 'vim-pandoc/vim-pandoc-syntax'
Plug 'idanarye/vim-vebugger'
" " Language Server Procotol client
" Plug 'autozimu/LanguageClient-neovim', {
" \ 'branch': 'next',
" \ 'do': 'bash install.sh',
" \ }
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
" Automatically closes brackets, quotes and parentheses
" Plug 'jiangmiao/auto-pairs'
" Disabled : While it works correctly when typing code,
" when modifying existing one it's another thing
" Plug 'ActivityWatch/aw-watcher-vim'
" Activity watch
" (might not want this on every install)
" Tag bar
Plug 'liuchengxu/vista.vim'
" Semantic highlighting for Python
Plug 'numirias/semshi', {'do': ':UpdateRemotePlugins'}
" Aligning lines around a certain character
Plug 'junegunn/vim-easy-align'
" Various for Ansible
Plug 'pearofducks/ansible-vim', { 'do': './UltiSnips/generate.sh' }
call plug#end()

View file

@ -1,14 +0,0 @@
" VIM Configuration - Geoffrey FROGEYE
"
set nocompatible
filetype on
set runtimepath+=~/.config/vim,~/.cache/vim
set viminfo+=n~/.cache/vim/viminfo
source ~/.config/vim/pluginlist.vim
source ~/.config/vim/paths.vim
source ~/.config/vim/vimconfig.vim
source ~/.config/vim/pluginconfig.vim