[neovim] fixed autocomplete

This commit is contained in:
Simon Cornet 2024-04-02 20:52:48 +02:00
parent 524ecc7cdd
commit 053224b97a
4 changed files with 99 additions and 0 deletions

View File

@ -9,6 +9,7 @@
./hyprland
./mako
./mpv
./neovim
./ssh
./theme
./tmux

View File

@ -0,0 +1 @@
{ ... }: { imports = [ ./neovim.nix ]; }

View File

@ -0,0 +1,91 @@
{ config, pkgs, ... }:
{
# neovim
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
# neovim config
extraConfig = ''
" Use tab for trigger completion with characters ahead and navigate.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
" clipboard
set clipboard+=unnamedplus
" cursor
set guicursor=a:hor20-Cursor
set guicursor=v:block-Cursor
" terminal title
set title
" auto-complete
set completeopt=menu,menuone,longest
" show number
set number
'';
# lua config
extraLuaConfig = ''
-- set mapleader
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- set vim options
vim.opt.backspace = '2'
vim.opt.laststatus = 2
vim.opt.cursorline = true
-- set scrolloff
vim.opt.scrolloff = 10
-- indentation
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.expandtab = true
vim.opt.smartindent = true
'';
# auto-complete
coc = {
enable = true;
settings = {
"suggest.noselect" = true;
"suggest.enablePreview" = true;
"suggest.enablePreselect" = true;
"suggest.disableKind" = true;
"diagnostic.errorSign" = "";
"diagnostic.infoSign" = "";
"diagnostic.hintSign" = "";
};
};
# plugins
plugins = with pkgs.vimPlugins; [
vim-nix
];
};
}

View File

@ -16,6 +16,12 @@
# override colors
set-option -sa terminal-overrides ",xterm*:Tc"
# set screen
set-option -g default-terminal "screen-256color"
# escape time
set-option -sg escape-time 10
# start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1