Use RGB colors for nvim

So we can use some nice plugins.
This commit is contained in:
Geoffrey Frogeye 2021-07-04 12:41:34 +02:00
parent c2d3ccb779
commit 9bfe9d25e4
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
17 changed files with 118 additions and 38 deletions

View file

@ -24,6 +24,15 @@
src: loader.j2 src: loader.j2
dest: "{{ ansible_user_dir }}/.config/vim/loader.vim" dest: "{{ ansible_user_dir }}/.config/vim/loader.vim"
mode: "u=rw,g=r,o=r" mode: "u=rw,g=r,o=r"
tags: g
- name: Install theme
template:
src: theme.j2
dest: "{{ ansible_user_dir }}/.config/vim/theme.vim"
mode: "u=rw,g=r,o=r"
tags:
- color
- name: Configure vim plugin list - name: Configure vim plugin list
template: template:

View file

@ -20,3 +20,7 @@ source ~/.config/{{ variant }}/plugininstall.vim
" PLUGINS CONFIGURATION " PLUGINS CONFIGURATION
{% include 'pluginconfig.j2' %} {% include 'pluginconfig.j2' %}
" THEME CONFIGURATION
source ~/.config/vim/theme.vim

View file

@ -1,5 +1,6 @@
if has('nvim') if has('nvim')
source ~/.config/nvim/init.vim let $MYVIMRC="~/.config/nvim/init.vim"
else else
source ~/.config/vim/init.vim let $MYVIMRC="~/.config/vim/init.vim"
endif endif
source $MYVIMRC

View file

@ -7,10 +7,21 @@
" END PLUGIN CONFIG {{ name }} " END PLUGIN CONFIG {{ name }}
{%- endmacro -%} {%- endmacro -%}
" Config reload
{% if variant == 'nvim' %}
{{ use_plugin('reload') }}
{% endif %}
" Visuals " Visuals
{{ use_plugin('base16') }} {{ use_plugin('base16') }}
{{ use_plugin('airline') }} {{ use_plugin('airline') }}
{{ use_plugin('devicons') }} {{ use_plugin('devicons') }}
{% if variant == 'nvim' %}
{{ use_plugin('lightbulb') }}
{{ use_plugin('ts-rainbow') }}
{{ use_plugin('specs') }}
{% endif %}
" Goto utilities " Goto utilities
{% if variant == 'nvim' %} {% if variant == 'nvim' %}
@ -62,20 +73,23 @@
" Git helpers " Git helpers
{{ use_plugin('fugitive') }} {{ use_plugin('fugitive') }}
{% if variant == 'nvim' %}
{{ use_plugin('gitsigns') }}
{% else %}
{{ use_plugin('gitgutter') }} {{ use_plugin('gitgutter') }}
{% endif %}
" Language-specific stuff " Language-specific stuff
{{ use_plugin('tcomment') }} {{ use_plugin('tcomment') }}
{{ use_plugin('languagetool') }} {{ use_plugin('languagetool') }}
{{ use_plugin('pandoc') }} {{ use_plugin('pandoc') }}
{% if variant == 'nvim' %}
{{ use_plugin('dap') }}
{% else %}
{% if 'c' in dev_stuffs or 'c++' in dev_stuffs %} {% if 'c' in dev_stuffs or 'c++' in dev_stuffs %}
{{ use_plugin('vebugger') }} {{ use_plugin('vebugger') }}
{% endif %} {% endif %}
{#
{% if 'python' in dev_stuffs and variant == 'nvim' %}
{{ use_plugin('semshi') }}
{% endif %} {% endif %}
#}
{% if 'ansible' in dev_stuffs %} {% if 'ansible' in dev_stuffs %}
{{ use_plugin('ansible') }} {{ use_plugin('ansible') }}
{% endif %} {% endif %}

View file

@ -8,7 +8,6 @@ let g:airline#extensions#tabline#enabled = 1
let g:airline_section_a = airline#section#create(['mode']) let g:airline_section_a = airline#section#create(['mode'])
let g:airline_section_b = airline#section#create(['branch', 'hunks']) let g:airline_section_b = airline#section#create(['branch', 'hunks'])
" let g:airline_section_z = airline#section#create(['%B', '@', '%l', ':', '%c']) " 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#error_symbol = '✖ '
let airline#extensions#languageclient#warning_symbol = '⚠ ' let airline#extensions#languageclient#warning_symbol = '⚠ '

View file

@ -1,17 +1,7 @@
{#
" nvim plugin doesn't support terminal colors
{% if variant == 'nvim' %} {% if variant == 'nvim' %}
{# Beware, doesn't work without RGB colors #}
{{ add_source('RRethy/nvim-base16') -}} {{ add_source('RRethy/nvim-base16') -}}
{% else %} {% else %}
#}
{{ add_source('chriskempson/base16-vim') -}} {{ add_source('chriskempson/base16-vim') -}}
{#
{% endif %} {% endif %}
#}
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

@ -0,0 +1,2 @@
{# Debug Adapter Protocol client #}
{{ add_source('mfussenegger/nvim-dap') -}}

View file

@ -0,0 +1,7 @@
{# Show changed git lines in the gutter #}
{{ add_source('lewis6991/gitsigns.nvim') -}}
{# Dependency #}
{{ add_source('nvim-lua/plenary.nvim') -}}
lua << EOF
require('gitsigns').setup()
EOF

View file

@ -0,0 +1,3 @@
{# Shows a lightbulb whenever a codeAction is available under the cursor #}
{{ add_source('kosayoda/nvim-lightbulb') -}}
autocmd CursorHold,CursorHoldI * lua require'nvim-lightbulb'.update_lightbulb()

View file

@ -7,19 +7,6 @@ local nvim_lsp = require('lspconfig')
-- after the language server attaches to the current buffer -- after the language server attaches to the current buffer
local on_attach = function(client, bufnr) local on_attach = function(client, bufnr)
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
-- disable virtual text
virtual_text = false,
-- show signs
signs = true,
-- delay update diagnostics
update_in_insert = false,
}
)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
@ -34,7 +21,7 @@ local on_attach = function(client, bufnr)
-- buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts) -- buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts) buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<C-K>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) buf_set_keymap('n', '<C-S-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
@ -42,9 +29,9 @@ local on_attach = function(client, bufnr)
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
-- buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) -- buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
-- buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) -- buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', '<space>d', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts) buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts) buf_set_keymap('n', '[e', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts) buf_set_keymap('n', ']e', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
-- buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts) -- buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts) buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
buf_set_keymap("v", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR><Esc>", opts) buf_set_keymap("v", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR><Esc>", opts)

View file

@ -0,0 +1,2 @@
{{ add_source('famiu/nvim-reload') -}}
{{ add_source('nvim-lua/plenary.nvim') -}}

View file

@ -0,0 +1,6 @@
{# Dim inactive windows #}
{# Not working very well, at least with undotree #}
{{add_source('sunjon/shade.nvim')-}}
lua << EOF
require'shade'.setup()
EOF

View file

@ -0,0 +1,20 @@
{{ add_source('edluffy/specs.nvim') -}}
lua << EOF
require('specs').setup{
show_jumps = true,
min_jump = 5,
popup = {
delay_ms = 0, -- delay before popup displays
inc_ms = 10, -- time increments used for fade/resize effects
blend = 10, -- starting blend, between 0-100 (fully transparent), see :h winblend
width = 10,
winhl = "PMenu",
fader = require('specs').pulse_fader,
resizer = require('specs').shrink_resizer
},
ignore_filetypes = {},
ignore_buftypes = {
nofile = true,
},
}
EOF

View file

@ -19,8 +19,8 @@ noremap gr <cmd>Telescope lsp_references<cr>
noremap ga <cmd>Telescope lsp_code_actions<cr> noremap ga <cmd>Telescope lsp_code_actions<cr>
vnoremap ga <cmd>Telescope lsp_range_code_actions<cr> vnoremap ga <cmd>Telescope lsp_range_code_actions<cr>
noremap gq <cmd>Telescope lsp_document_diagnostics<cr> noremap gq <cmd>Telescope lsp_document_diagnostics<cr>
noremap gQ <cmd>Telescope lsp_workspace_diagnostics<cr> noremap gE <cmd>Telescope lsp_workspace_diagnostics<cr>
noremap gd <cmd>Telescope lsp_definitions<cr> noremap ge <cmd>Telescope lsp_definitions<cr>
lua << EOF lua << EOF
require('telescope').setup{ require('telescope').setup{

View file

@ -3,4 +3,28 @@
{# To check if it's really working {# To check if it's really working
{{ add_source('nvim-treesitter/playground') -}} {{ add_source('nvim-treesitter/playground') -}}
#} #}
{# TODO Find a way to run `:TSInstall all` non-interactively #} lua <<EOF
require'nvim-treesitter.configs'.setup {
ensure_installed = "maintained",
ignore_install = {},
highlight = {
enable = true,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn",
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
{# Not very working yet, I'm afraid
indent = {
enable = true,
},
#}
}
EOF
{# TODO Investigate https://github.com/nvim-treesitter/nvim-treesitter-textobjects #}

View file

@ -0,0 +1,11 @@
{# Randomly color parentheses pairs #}
{{add_source('p00f/nvim-ts-rainbow')-}}
lua << EOF
require'nvim-treesitter.configs'.setup {
rainbow = {
enable = true,
extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
max_file_lines = 1000, -- Do not enable for files with more than 1000 lines, int
}
}
EOF

View file

@ -0,0 +1 @@
colorscheme base16-{{ base16_scheme }}