From 053224b97a69b21e1f153998fac6bb8d99579ba8 Mon Sep 17 00:00:00 2001 From: Simon Cornet Date: Tue, 2 Apr 2024 20:52:48 +0200 Subject: [PATCH] [neovim] fixed autocomplete --- nix/home/default.nix | 1 + nix/home/neovim/default.nix | 1 + nix/home/neovim/neovim.nix | 91 +++++++++++++++++++++++++++++++++++++ nix/home/tmux/tmux.nix | 6 +++ 4 files changed, 99 insertions(+) create mode 100644 nix/home/neovim/default.nix create mode 100644 nix/home/neovim/neovim.nix diff --git a/nix/home/default.nix b/nix/home/default.nix index fbd983b..07db594 100644 --- a/nix/home/default.nix +++ b/nix/home/default.nix @@ -9,6 +9,7 @@ ./hyprland ./mako ./mpv + ./neovim ./ssh ./theme ./tmux diff --git a/nix/home/neovim/default.nix b/nix/home/neovim/default.nix new file mode 100644 index 0000000..a7ea133 --- /dev/null +++ b/nix/home/neovim/default.nix @@ -0,0 +1 @@ +{ ... }: { imports = [ ./neovim.nix ]; } diff --git a/nix/home/neovim/neovim.nix b/nix/home/neovim/neovim.nix new file mode 100644 index 0000000..74bdf78 --- /dev/null +++ b/nix/home/neovim/neovim.nix @@ -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 + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() + inoremap pumvisible() ? "\" : "\" + function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' + endfunction + + " Use to trigger completion. + if has('nvim') + inoremap coc#refresh() + else + inoremap 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 + ]; + }; +} diff --git a/nix/home/tmux/tmux.nix b/nix/home/tmux/tmux.nix index dcdf100..3b63d09 100644 --- a/nix/home/tmux/tmux.nix +++ b/nix/home/tmux/tmux.nix @@ -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