diff options
| author | David Morgan <djm_uk@protonmail.com> | 2025-10-17 17:21:55 +0100 |
|---|---|---|
| committer | David Morgan <djm_uk@protonmail.com> | 2025-10-17 17:21:55 +0100 |
| commit | 0988ca5109a06b4c898f81f04ee176df86ebc22d (patch) | |
| tree | a1c7cbe076273161339c8c61cef7c8cbac0c58b6 | |
| parent | 26e8414d102b7f7c5af836a81f244951a50fea64 (diff) | |
| download | dotfiles-0988ca5109a06b4c898f81f04ee176df86ebc22d.tar.gz | |
vim -> nvim
| -rw-r--r-- | nix-conf/home/includes/common.nix | 49 | ||||
| -rw-r--r-- | nix-conf/home/includes/dev-common.nix | 1 | ||||
| -rw-r--r-- | nix-conf/home/includes/nvim.nix | 99 |
3 files changed, 100 insertions, 49 deletions
diff --git a/nix-conf/home/includes/common.nix b/nix-conf/home/includes/common.nix index ab15660..ae88ddc 100644 --- a/nix-conf/home/includes/common.nix +++ b/nix-conf/home/includes/common.nix @@ -11,6 +11,7 @@ let in { imports = [ + ./nvim.nix ./zsh.nix inputs.sops-nix.homeManagerModules.sops ]; @@ -161,54 +162,6 @@ in programs.gpg.enable = true; programs.nix-index.enable = true; - programs.vim = { - enable = true; - extraConfig = '' - colorscheme molokai - " highlight doesn't work properly without this - syntax enable - highlight Normal ctermfg=white ctermbg=black - set hlsearch - set showmatch - set pastetoggle=<F2> - nmap <silent> <F3> :silent nohlsearch<CR> - imap <silent> <F3> <C-o>:silent nohlsearch<CR> - nmap <silent> <F4> :silent setlocal spell spelllang=en_gb<CR> - imap <silent> <F4> <C-o>:silent setlocal spell spelllang=en_gb<CR> - nmap <silent> <F5> :silent setlocal nospell<CR> - imap <silent> <F5> <C-o>:silent setlocal nospell<CR> - nmap <silent> <F6> :silent set diffopt+=iwhite<CR> - imap <silent> <F6> <C-o>:silent set diffopt+=iwhite<CR> - nmap <silent> <F7> :silent set diffopt-=iwhite<CR> - imap <silent> <F7> <C-o>:silent set diffopt-=iwhite<CR> - ''; - plugins = [ - pkgs.vimPlugins.sensible - pkgs.vimPlugins.auto-pairs - pkgs.vimPlugins.ctrlp - pkgs.vimPlugins.editorconfig-vim - pkgs.vimPlugins.inkpot - pkgs.vimPlugins.molokai - pkgs.vimPlugins.surround - pkgs.vimPlugins.vim-lastplace - pkgs.vimPlugins.vim-nix - pkgs.vimPlugins.vim-pasta - pkgs.vimPlugins.vim-repeat - pkgs.vimPlugins.vim-sexp-mappings-for-regular-people - pkgs.vimPlugins.vim-sleuth - ]; - settings = { - background = "dark"; - copyindent = true; - expandtab = true; - ignorecase = true; - number = true; - shiftwidth = 4; - smartcase = true; - tabstop = 4; - }; - }; - programs.ssh = { enable = true; includes = [ diff --git a/nix-conf/home/includes/dev-common.nix b/nix-conf/home/includes/dev-common.nix index c5c12f4..30e8a4b 100644 --- a/nix-conf/home/includes/dev-common.nix +++ b/nix-conf/home/includes/dev-common.nix @@ -18,7 +18,6 @@ in imagemagick janet multimarkdown - neovim nixd ripgrep-all diff --git a/nix-conf/home/includes/nvim.nix b/nix-conf/home/includes/nvim.nix new file mode 100644 index 0000000..06b262c --- /dev/null +++ b/nix-conf/home/includes/nvim.nix @@ -0,0 +1,99 @@ +{ pkgs, ... }: + +{ + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + + plugins = with pkgs.vimPlugins; [ + molokai + nvim-autopairs + nvim-lastplace + nvim-surround + plenary-nvim + telescope-nvim + vim-pasta + vim-repeat + vim-sleuth + (nvim-treesitter.withPlugins ( + ps: with ps; [ + tree-sitter-bash + tree-sitter-lua + tree-sitter-vim + tree-sitter-vimdoc + tree-sitter-json + tree-sitter-yaml + tree-sitter-nix + tree-sitter-markdown + tree-sitter-regex + tree-sitter-clojure + tree-sitter-java + tree-sitter-typescript + tree-sitter-javascript + tree-sitter-elisp + tree-sitter-make + tree-sitter-dockerfile + tree-sitter-markdown-inline + ] + )) + ]; + + extraLuaConfig = '' + vim.opt.termguicolors = true + vim.cmd('colorscheme molokai') + vim.cmd('highlight Normal ctermfg=white ctermbg=black') + + vim.opt.background = "dark" + vim.opt.copyindent = true + vim.opt.expandtab = true + vim.opt.ignorecase = true + vim.opt.number = true + vim.opt.shiftwidth = 4 + vim.opt.smartcase = true + vim.opt.tabstop = 4 + vim.opt.hlsearch = true + vim.opt.showmatch = true + vim.opt.clipboard = 'unnamedplus' + if vim.fn.has('clipboard') == 1 then + vim.opt.clipboard = 'unnamedplus' + end + + vim.api.nvim_create_autocmd('BufEnter', { + callback = function() vim.opt.formatoptions:remove({'c','r','o'}) end + }) + + -- Keymaps (Lua) + local map = vim.keymap.set + local silent = { silent = true } + + map({'n','i'}, '<F3>', function() vim.cmd('silent nohlsearch') end, silent) + + map({'n','i'}, '<F4>', function() + vim.cmd('silent setlocal spell spelllang=en_gb') + end, silent) + + map({'n','i'}, '<F5>', function() + vim.cmd('silent setlocal nospell') + end, silent) + + map({'n','i'}, '<F6>', function() + vim.cmd('silent set diffopt+=iwhite') + end, silent) + + map({'n','i'}, '<F7>', function() + vim.cmd('silent set diffopt-=iwhite') + end, silent) + + require('nvim-lastplace').setup({}) + require('nvim-treesitter.configs').setup({ + highlight = { enable = true }, + indent = { enable = true }, + }) + require('telescope').setup({}) + require('nvim-autopairs').setup({}) + require('nvim-surround').setup({}) + ''; + }; + +} |