From 3b9218b2b946380292a592cb0fdc667bf8e54ecd Mon Sep 17 00:00:00 2001 From: iFargle Date: Thu, 15 Feb 2024 12:07:08 +0900 Subject: [PATCH] test --- .../cli/{nixvim-small.nix => nixvim-base.nix} | 7 + home-manager/common/software/cli/nixvim.nix | 183 +----------------- home-manager/small.nix | 2 +- 3 files changed, 9 insertions(+), 183 deletions(-) rename home-manager/common/software/cli/{nixvim-small.nix => nixvim-base.nix} (92%) diff --git a/home-manager/common/software/cli/nixvim-small.nix b/home-manager/common/software/cli/nixvim-base.nix similarity index 92% rename from home-manager/common/software/cli/nixvim-small.nix rename to home-manager/common/software/cli/nixvim-base.nix index 0f5f409e..c7137ed3 100644 --- a/home-manager/common/software/cli/nixvim-small.nix +++ b/home-manager/common/software/cli/nixvim-base.nix @@ -54,6 +54,13 @@ # Fugitive (nmap "gc" ":Git commit -a" // desc "[C]ommit" ) (nmap "gp" ":Git push" // desc "[P]ush") + # Window Management + (nmap "wh" "" // desc "Move to left window") + # (nmap "wl" "" // desc "Move to right window") + # (nmap "wj" "" // desc "Move to lower window") + # (nmap "wk" "" // desc "Move to upper window") + # (nmap "wc" "" // desc "[C]lose active window") + # (nmap "wn" "" // desc "Open [n]ew window") ]; options = { diff --git a/home-manager/common/software/cli/nixvim.nix b/home-manager/common/software/cli/nixvim.nix index f6a3317b..f6d6be0a 100644 --- a/home-manager/common/software/cli/nixvim.nix +++ b/home-manager/common/software/cli/nixvim.nix @@ -1,143 +1,8 @@ { inputs, pkgs, config, lib, theme, ... }: { - imports = [ - inputs.nixvim.homeManagerModules.nixvim - ] ++ lib.optional (builtins.isString theme) ../../../../stylix/${theme}/home-manager/nixvim.nix; + imports = [ ./nixvim-base.nix ]; programs.nixvim = { - enable = true; - viAlias = true; - vimAlias = true; - - globals.mapleader = " "; - globals.maplocalleader = " "; - - keymaps = let - map = mode: key: action: { mode = mode; key = key; action = action; }; - nmap = key: action: map [ "n" ] key action; - nvmap = key: action: map [ "n" "v" ] key action; - imap = key: action: map [ "i" ] key action; - desc = d: { options.desc = d; }; - silent = { options.silent = true; }; - expr = { options.expr = true; }; - in [ - # Unmap keys that aren't useful, or that we want to use for different things - (nvmap "" "" // silent) - (nvmap "" "" // silent) - (nvmap "s" "" // silent) - # Redo - (nmap "R" "") - # Copy and paste - (nvmap "y" "\"+y" // desc "Cop[y] to clipboard") - (nvmap "p" "\"+p" // desc "[P]aste from clipboard") - # Jump to start/end of line - (nvmap "H" "0") - (nvmap "L" "$") - # Navigate up and down word wrapped text as if it were not word wrapped - (nmap "k" "v:count == 0 ? 'gk' : 'k'" // silent // expr) - (nmap "j" "v:count == 0 ? 'gj' : 'j'" // silent // expr) - # Center cursor when jumping foward or back - (nmap "" "zz") - (nmap "" "zz") - - # Insert Mode - - # Normal Mode - # NVimTree - (nmap "n" "" // desc "[N]vimTree" // silent) - (nmap "nf" ":NvimTreeFocus" // desc "[F]ocus NvimTree") - (nmap "nt" ":NvimTreeToggle" // desc "[T]oggle NvimTree") - (nmap "ns" ":NvimTreeFindFile" // desc "[S]earch NvimTree") - (nmap "nc" ":NvimTreeClose" // desc "[C]lose NvimTree") - # ToggleTerm - (nmap "t" "" // desc "[T]oggleTerm" // silent) - (nmap "tt" ":ToggleTerm" // desc "[T]oggle Terminal") - # Fugitive - (nmap "gc" ":Git commit -a" // desc "[C]ommit" ) - (nmap "gp" ":Git push" // desc "[P]ush") - ]; - - options = { - number = true; - shiftwidth = 2; - # Indent wrapped text. - breakindent = true; - colorcolumn = "100"; - showmode = false; - }; plugins = { - # Parser generator tool - treesitter.enable = true; - # Snippet engine for neovim - luasnip.enable = true; - # Nix language syntax highlighting / file type associations - nix.enable = true; - # Run nix develop / shell without exiting vim - nix-develop.enable = true; - # tab bar like Firefox or Chrome - bufferline.enable = true; - # Popup to show shortcuts - which-key.enable = true; - # Automatic indent - intellitab.enable = true; - # Highlight all entries of the currently selected word - illuminate.enable = true; - # sidebar file browser - nvim-tree.enable = true; - # Gutter information for git modifications - gitsigns.enable = true; - # Terminal in vim - toggleterm.enable = true; - # Rainbow matching {} [] () 's - rainbow-delimiters.enable = true; - # Colorize hex colors inline - nvim-colorizer.enable = true; - # git plugin for vim - fugitive.enable = true; - - # Airline / Powerline alternative - lualine = { - enable = true; - componentSeparators = { - left = "|"; - right = "|"; - }; - }; - - telescope = { - enable = true; - extensions.fzf-native.enable = true; - keymaps = { - "" = { - action = "find_files"; - desc = "Search files by name"; - }; - "s" = { - action = "live_grep"; - desc = "Search by live grep"; - }; - "b" = { - action = "buffers"; - desc = "Search open [B]uffers by file name"; - }; - "h" = { - action = "help_tags"; - desc = "Search [H]elp"; - }; - "w" = { - action = "grep_string"; - desc = "Search for [W]ord under cursor"; - }; - "gs" = { - action = "git_status"; - desc = "Search [G]it [S]tatus"; - }; - "r" = { - action = "oldfiles"; - desc = "Search [R]ecently opened files by name"; - }; - }; - }; - lsp = { enable = true; servers = { @@ -205,52 +70,6 @@ }; }; }; - - nvim-cmp = { - enable = true; - autoEnableSources = true; - mapping = { - "" = "cmp.mapping.complete()"; - "" = "cmp.mapping.scroll_docs(-4)"; - "" = "cmp.mapping.close()"; - "" = "cmp.mapping.scroll_docs(4)"; - "" = "cmp.mapping.confirm({ select = true })"; - "" = { - action = "cmp.mapping.select_prev_item()"; - modes = [ - "i" - "s" - ]; - }; - "" = { - action = "cmp.mapping.select_next_item()"; - modes = [ - "i" - "s" - ]; - }; - }; - sources = [ - { name = "nvim_lua"; } - { name = "nvim_lsp"; } - { name = "path"; } - { name = "buffer"; } - ]; - }; }; - - colorschemes = { - tokyonight.enable = true; - gruvbox.enable = true; - catppuccin.enable = true; - dracula.enable = true; - oxocarbon.enable = true; - - }; - extraPlugins = with pkgs.vimPlugins; [ - everforest - onehalf - rose-pine - ]; }; } diff --git a/home-manager/small.nix b/home-manager/small.nix index 8b02fbea..c919b1fa 100644 --- a/home-manager/small.nix +++ b/home-manager/small.nix @@ -3,7 +3,7 @@ # Common configs ./common/software/cli/bash.nix ./common/software/cli/git.nix - ./common/software/cli/nixvim-small.nix + ./common/software/cli/nixvim-base.nix ./common/software/cli/ssh.nix ./common/software/cli/btop.nix