From b59dc0aab647d23d0756e29a12b40e70f63d5b28 Mon Sep 17 00:00:00 2001 From: Lander Van den Bulcke Date: Wed, 28 Aug 2024 16:44:05 +0200 Subject: [PATCH] feat: add initial neovim config Signed-off-by: Lander Van den Bulcke --- home/lander/global/default.nix | 1 + home/lander/global/vim.nix | 87 ++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 home/lander/global/vim.nix diff --git a/home/lander/global/default.nix b/home/lander/global/default.nix index 6c4f5cc..e6c0b7e 100644 --- a/home/lander/global/default.nix +++ b/home/lander/global/default.nix @@ -9,6 +9,7 @@ inputs.catppuccin.homeManagerModules.catppuccin ./git + ./vim.nix ./zsh.nix ]; diff --git a/home/lander/global/vim.nix b/home/lander/global/vim.nix new file mode 100644 index 0000000..fc2891a --- /dev/null +++ b/home/lander/global/vim.nix @@ -0,0 +1,87 @@ +{ pkgs, ... }: +{ + programs.neovim = { + enable = true; + package = pkgs.neovim-unwrapped; + catppuccin.enable = true; + viAlias = true; + vimAlias = true; + vimdiffAlias = true; + + extraLuaConfig = '' + vim.opt.autochdir = true + vim.opt.backup = false + + vim.opt.autoindent = true + vim.opt.cindent = true + vim.opt.smartindent = true + + vim.opt.expandtab = true + vim.opt.shiftwidth = 2 + vim.opt.smarttab = true + vim.opt.softtabstop = 2 + vim.opt.tabstop = 2 + + vim.opt.backspace = "indent,eol,start" + vim.g.mapleader = ';' + vim.g.maplocalleader = ';' + + vim.opt.hlsearch = true + vim.opt.ignorecase = true + vim.opt.showmatch = true + + vim.opt.number = true + vim.opt.background = dark + vim.opt.termguicolors = true + + function map(mode, lhs, rhs, opts) + local options = {noremap = true, silent = true} + if opts then + options = vim.tbl_extend("force", options, opts) + end + vim.keymap.set(mode, lhs, rhs, options) + end + + map('n', 't', ':ToggleTerm' ) + map('i', '', '' ) + map('t', '', '' ) + map('n', 'p', ':NvimTreeToggle' ) + map('n', '', ':NvimTreeToggle' ) + map('n', 'ff', ':Telescope find_files') + map('n', 'fg', ':Telescope live_grep' ) + map('n', 'fb', ':Telescope buffers' ) + map('n', 'fh', ':Telescope help_tags' ) + map('n', 'fo', ':Telescope vim_options' ) + + vim.cmd.colorscheme "catppuccin" + ''; + + plugins = with pkgs.vimPlugins; [ + nvim-web-devicons + telescope-nvim + vim-nix + vim-visual-multi + { + plugin = nvim-comment; + type = "lua"; + config = '' + require('nvim_comment').setup() + ''; + } + { + plugin = nvim-tree-lua; + type = "lua"; + config = '' + require('nvim-tree').setup({ update_cwd = true }) + ''; + } + { + plugin = lightline-vim; + type = "viml"; + config = '' + let g:lightline = {'colorscheme': 'catppuccin'} + ''; + } + ]; + }; +}