nix: vim: Snippets and auto-completion
This commit is contained in:
parent
b42cc85dec
commit
9b450cc22f
|
@ -16,17 +16,6 @@
|
||||||
" Theme
|
" Theme
|
||||||
source ~/.config/vim/theme.vim
|
source ~/.config/vim/theme.vim
|
||||||
|
|
||||||
" Snippets
|
|
||||||
{{ use_plugin('vsnip') }}
|
|
||||||
|
|
||||||
" Auto-completion
|
|
||||||
{% if variant == 'nvim' %}
|
|
||||||
{{ use_plugin('nvim_compe') }}
|
|
||||||
{% else %}
|
|
||||||
{{ use_plugin('deoplete') }}
|
|
||||||
{{ use_plugin('supertab') }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
" Undo management
|
" Undo management
|
||||||
{{ use_plugin('undotree') }}
|
{{ use_plugin('undotree') }}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
{{ add_source('hrsh7th/vim-vsnip') -}}
|
|
||||||
{{ add_source('hrsh7th/vim-vsnip-integ') -}}
|
|
||||||
{{ add_source('rafamadriz/friendly-snippets') -}}
|
|
||||||
{# TODO Ansible snippets? #}
|
|
|
@ -210,6 +210,15 @@ in
|
||||||
# Treesitter
|
# Treesitter
|
||||||
nvim-ts-rainbow # Randomly color parenthesis pairs
|
nvim-ts-rainbow # Randomly color parenthesis pairs
|
||||||
# 23.11: Replace with plugins.rainbow-delimiters
|
# 23.11: Replace with plugins.rainbow-delimiters
|
||||||
|
|
||||||
|
# Snippets
|
||||||
|
vim-vsnip
|
||||||
|
vim-vsnip-integ
|
||||||
|
friendly-snippets
|
||||||
|
|
||||||
|
# Auto-completion
|
||||||
|
nvim-compe
|
||||||
|
# TODO Archived. Maybe use nvim-cmp and plugins instead?
|
||||||
];
|
];
|
||||||
extraConfigLua = lib.strings.concatMapStringsSep "\n" (f: builtins.readFile f) [
|
extraConfigLua = lib.strings.concatMapStringsSep "\n" (f: builtins.readFile f) [
|
||||||
./vim/feline.lua
|
./vim/feline.lua
|
||||||
|
@ -220,6 +229,17 @@ in
|
||||||
extraConfigVim = ''
|
extraConfigVim = ''
|
||||||
" vim-gutentags
|
" vim-gutentags
|
||||||
let g:gutentags_cache_dir = expand('~/.cache/nvim/tags')
|
let g:gutentags_cache_dir = expand('~/.cache/nvim/tags')
|
||||||
|
|
||||||
|
" nvim-compe
|
||||||
|
" Copy-pasted because I couldn't be bothered
|
||||||
|
set completeopt=menuone,noselect
|
||||||
|
|
||||||
|
inoremap <silent><expr> <C-Space> compe#complete()
|
||||||
|
inoremap <silent><expr> <CR> compe#confirm('<CR>')
|
||||||
|
inoremap <silent><expr> <C-e> compe#close('<C-e>')
|
||||||
|
inoremap <silent><expr> <C-f> compe#scroll({ 'delta': +4 })
|
||||||
|
inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })
|
||||||
|
|
||||||
'';
|
'';
|
||||||
autoCmd = [
|
autoCmd = [
|
||||||
# vim-easy-align: Align Markdown tables
|
# vim-easy-align: Align Markdown tables
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
{{ add_source('hrsh7th/nvim-compe') -}}
|
-- Default recommended config
|
||||||
{# I'm a bit lost with all this, so this is the default recommended config,
|
|
||||||
using vim-vsnip because the proposed configuration for tab-completion uses it, so… #}
|
|
||||||
lua << EOF
|
|
||||||
require'compe'.setup {
|
require'compe'.setup {
|
||||||
enabled = true;
|
enabled = true;
|
||||||
autocomplete = true;
|
autocomplete = true;
|
||||||
|
@ -32,17 +29,9 @@ require'compe'.setup {
|
||||||
vsnip = true;
|
vsnip = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
EOF
|
|
||||||
set completeopt=menuone,noselect
|
|
||||||
|
|
||||||
|
-- Vim instructions were here
|
||||||
|
|
||||||
inoremap <silent><expr> <C-Space> compe#complete()
|
|
||||||
inoremap <silent><expr> <CR> compe#confirm('<CR>')
|
|
||||||
inoremap <silent><expr> <C-e> compe#close('<C-e>')
|
|
||||||
inoremap <silent><expr> <C-f> compe#scroll({ 'delta': +4 })
|
|
||||||
inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })
|
|
||||||
|
|
||||||
lua << EOF
|
|
||||||
local t = function(str)
|
local t = function(str)
|
||||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||||
end
|
end
|
||||||
|
@ -81,4 +70,3 @@ vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||||
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||||
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||||
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||||
EOF
|
|
Loading…
Reference in a new issue