From 414e46dd1579a0dcfab72662804f6c21642f6771 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Mon, 16 Sep 2024 23:48:33 -0700 Subject: [PATCH] feat: minor overhaul * switch to oil.nvim from yazi * use lualine with custom config * optimize settings --- config/default.nix | 14 +++++++++++--- config/keymaps.nix | 22 +++++++++++----------- config/plugins/cmp.nix | 4 ++++ config/plugins/formatters.nix | 10 ++++++++++ config/plugins/navigation.nix | 19 ++++++++++++++++--- config/plugins/qol.nix | 32 ++++++++++++++++++++++++++++++++ flake.nix | 1 + 7 files changed, 85 insertions(+), 17 deletions(-) diff --git a/config/default.nix b/config/default.nix index 57fa937..fce264e 100644 --- a/config/default.nix +++ b/config/default.nix @@ -1,4 +1,3 @@ -{ pkgs, ... }: { imports = [ ./plugins @@ -13,7 +12,16 @@ luaLoader.enable = true; performance = { - combinePlugins.enable = true; - byteCompileLua.enable = true; + combinePlugins = { + enable = true; + standalonePlugins = [ + "nvim-treesitter" + ]; + }; + byteCompileLua = { + enable = true; + plugins = true; + nvimRuntime = true; + }; }; } diff --git a/config/keymaps.nix b/config/keymaps.nix index 502c3e9..bf63bff 100644 --- a/config/keymaps.nix +++ b/config/keymaps.nix @@ -323,10 +323,19 @@ options.desc = "Look through yank history with telescope."; } { - action = '':lua require("yazi").yazi()''; + action = '':Oil''; key = "e"; options = { - desc = "Open Yazi current nvim working directory"; + desc = "Open oil file explorer in current nvim working directory"; + noremap = true; + silent = true; + }; + } + { + action = '':Oil''; + key = "e"; + options = { + desc = "Open oil file explorer in current nvim working directory"; noremap = true; silent = true; }; @@ -377,15 +386,6 @@ }; } # { - # action = ":Yazi"; - # key = "mf"; - # options = { - # desc = "Open Yazi at current file"; - # noremap = true; - # silent = true; - # }; - # } - # { # action = "lua require'conform'.format({ bufnr = args.bf })"; # key = "cf"; # options = { diff --git a/config/plugins/cmp.nix b/config/plugins/cmp.nix index 2da6741..4ce94df 100644 --- a/config/plugins/cmp.nix +++ b/config/plugins/cmp.nix @@ -1,5 +1,9 @@ { plugins = { + lspkind = { + enable = true; + cmp.enable = true; + }; cmp-async-path.enable = true; cmp = { enable = true; diff --git a/config/plugins/formatters.nix b/config/plugins/formatters.nix index 7815bc1..9cfde77 100644 --- a/config/plugins/formatters.nix +++ b/config/plugins/formatters.nix @@ -28,6 +28,16 @@ plugins.conform-nvim = { enable = true; + # because combinePlugins.enable = true, the collision of `doc` is + # unavoidable. this renames them. + package = pkgs.vimPlugins.conform-nvim.overrideAttrs (oldAttrs: { + postInstall = + (oldAttrs.postInstall or "") + + '' + mv $out/doc/recipes.md $out/doc/conform-nvim_recipes.md + ''; + }); + # package = pkgs.vimPlugins.conform-nvim; settings = { format_on_save = { timeoutMs = 500; diff --git a/config/plugins/navigation.nix b/config/plugins/navigation.nix index cbf994d..4d4cfe2 100644 --- a/config/plugins/navigation.nix +++ b/config/plugins/navigation.nix @@ -1,4 +1,5 @@ # Getting around REALLY FAST +{ pkgs, ... }: { plugins = { telescope = { @@ -37,9 +38,21 @@ }; yazi = { enable = true; - settings = { - open_for_directories = true; - }; + # settings = { + # open_for_directories = true; + # }; + }; + oil = { + enable = true; + # because combinePlugins.enable = true, the collision of `doc` is + # unavoidable. this renames them. + package = pkgs.vimPlugins.oil-nvim.overrideAttrs (oldAttrs: { + postInstall = + (oldAttrs.postInstall or "") + + '' + mv $out/doc/recipes.md $out/doc/oil_recipes.md + ''; + }); }; harpoon = { enable = true; diff --git a/config/plugins/qol.nix b/config/plugins/qol.nix index e896bf0..157e514 100644 --- a/config/plugins/qol.nix +++ b/config/plugins/qol.nix @@ -22,6 +22,38 @@ enableTelescope = true; }; trouble.enable = true; + barbecue.enable = true; + lualine = { + enable = true; + sections = { + lualine_a = [ "branch" ]; + lualine_b = [ "diff" ]; + lualine_c = [ + # { + # __unkeyed-1 = { + # __raw = '' + # function() + # local bufnr = vim.api.nvim_get_current_buf() + # + # local clients = vim.lsp.buf_get_clients(bufnr) + # if next(clients) == nil then + # return "" + # end + # + # local c = {} + # for _, client in pairs(clients) do + # table.insert(c, client.name) + # end + # return '\u{f085} ' .. table.concat(c, '|') + # end + # ''; + # icon = ""; + # }; + # } + ]; + }; + globalstatus = true; + }; crates-nvim.enable = true; # git stuff lazygit.enable = true; diff --git a/flake.nix b/flake.nix index d2a7e5d..08b81c1 100644 --- a/flake.nix +++ b/flake.nix @@ -54,6 +54,7 @@ nvim = nixvim'.makeNixvimWithModule nixvimModule; in { + formatter = pkgs.nixfmt-rfc-style; checks = { default = nixvimLib.check.mkTestDerivationFromNixvimModule nixvimModule;