diff --git a/modules/home/nixvim/autocmds.nix b/modules/home/nixvim/autocmds.nix new file mode 100644 index 0000000..518ec35 --- /dev/null +++ b/modules/home/nixvim/autocmds.nix @@ -0,0 +1,9 @@ +{...}: { + programs.nixvim.autoCmd = [ + # yank highlight + { + event = "TextYankPost"; + callback.__raw = "function() vim.highlight.on_yank() end"; + } + ]; +} diff --git a/modules/home/nixvim/default.nix b/modules/home/nixvim/default.nix index 6585c9a..6058473 100644 --- a/modules/home/nixvim/default.nix +++ b/modules/home/nixvim/default.nix @@ -6,6 +6,7 @@ imports = [ inputs.nixvim.homeModules.nixvim ./options.nix + ./autocmds.nix ./keymaps.nix ./language.nix ./colorscheme.nix diff --git a/modules/home/nixvim/keymaps.nix b/modules/home/nixvim/keymaps.nix index b27ed57..f005223 100644 --- a/modules/home/nixvim/keymaps.nix +++ b/modules/home/nixvim/keymaps.nix @@ -19,6 +19,23 @@ }; in { programs.nixvim.keymaps = [ + # Search + (mk "" "nohlsearch" "検索ハイライトを解除") + + # Screen line movement + { + mode = "n"; + key = "j"; + action.__raw = "v:count == 0 and 'gj' or 'j'"; + options = { silent = true; expr = true; desc = "下へ移動(画面行優先)"; }; + } + { + mode = "n"; + key = "k"; + action.__raw = "v:count == 0 and 'gk' or 'k'"; + options = { silent = true; expr = true; desc = "上へ移動(画面行優先)"; }; + } + # LSP (mkRaw "K" "vim.lsp.buf.hover" "LSPエラーのホバー表示") (mk "gd" "Glance definitions" "定義へ移動") diff --git a/modules/home/nixvim/options.nix b/modules/home/nixvim/options.nix index ad68608..889b2f9 100644 --- a/modules/home/nixvim/options.nix +++ b/modules/home/nixvim/options.nix @@ -11,6 +11,12 @@ mouse = "a"; clipboard = "unnamedplus"; updatetime = 200; + timeoutlen = 300; + undofile = true; + + # display + wrap = false; + scrolloff = 8; # search ignorecase = true;