From e51abef64e461babea7fe1b2a76415c7434ee69d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Tue, 18 Jan 2022 21:55:40 +0100 Subject: [PATCH] add some vim config --- config/home-manager/base.nix | 1 + config/programs/vim.nix | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 config/programs/vim.nix diff --git a/config/home-manager/base.nix b/config/home-manager/base.nix index dc22c118..c06abec6 100644 --- a/config/home-manager/base.nix +++ b/config/home-manager/base.nix @@ -1,6 +1,7 @@ { pkgs, ... }: { imports = [ ../programs/zsh.nix + ../programs/vim.nix ]; programs = { zsh = { diff --git a/config/programs/vim.nix b/config/programs/vim.nix new file mode 100644 index 00000000..af570aea --- /dev/null +++ b/config/programs/vim.nix @@ -0,0 +1,33 @@ +{ pkgs, ... }: { + programs.neovim = { + enable = true; + coc = { + enable = true; + }; + extraConfig = '' + set nocompatible + set number relativenumber + + " NerdTree config + " Automatically open NERDTree and move to the previous window + autocmd VimEnter * NERDTree | wincmd p + " Close vim when NERDTree is the only window left + autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif + " Ban replacing NERDTree + autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 | + \ let buf=bufnr() | buffer# | execute "normal! \w" | execute 'buffer'.buf | endif + + " NerdTree git plugin + " Use nerdfonts + let g:NERDTreeGitStatusUseNerdFonts = 1 + + " CtrlP config + let g:ctrlp_map = '' + let g:ctrlp_cmd = 'CtrlP' + ''; + plugins = with pkgs.vimPlugins; [ + nerdtree nerdtree-git-plugin vim-devicons + ctrlp-vim + ]; + }; +}