From 34384463478574bfa2d5db036081b6bc5446c5af Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Mon, 28 Nov 2022 22:11:57 -0700 Subject: [PATCH] add nvim-tree to flake --- flake.nix | 1 + modules/neovim/plugins/misc.nix | 3 ++ modules/neovim/plugins/tree.nix | 75 +++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 modules/neovim/plugins/tree.nix diff --git a/flake.nix b/flake.nix index ecb60a1..5ab79a9 100644 --- a/flake.nix +++ b/flake.nix @@ -179,6 +179,7 @@ ./modules/neovim/plugins/lsp.nix ./modules/neovim/plugins/completion.nix ./modules/neovim/plugins/toggleterm.nix + ./modules/neovim/plugins/tree.nix ./modules/colorscheme/gruvbox/neovim-gruvbox.nix ]; }; diff --git a/modules/neovim/plugins/misc.nix b/modules/neovim/plugins/misc.nix index a8f632b..9ad3c89 100644 --- a/modules/neovim/plugins/misc.nix +++ b/modules/neovim/plugins/misc.nix @@ -6,9 +6,12 @@ pkgs.vimPlugins.vim-repeat # Better repeat using . pkgs.vimPlugins.comment-nvim # Smart comment commands pkgs.vimPlugins.impatient-nvim # Faster load times + pkgs.vimPlugins.glow-nvim # Markdown preview popup + pkgs.vimPlugins.nvim-colorizer-lua # Hex color previews ]; setup.Comment = { }; + setup.colorizer = { }; vim.o.termguicolors = true; # Set to truecolor vim.o.hidden = true; # Don't unload buffers when leaving them diff --git a/modules/neovim/plugins/tree.nix b/modules/neovim/plugins/tree.nix new file mode 100644 index 0000000..0dc42ba --- /dev/null +++ b/modules/neovim/plugins/tree.nix @@ -0,0 +1,75 @@ +{ pkgs, dsl, ... }: { + + plugins = [ pkgs.vimPlugins.nvim-tree-lua pkgs.vimPlugins.nvim-web-devicons ]; + + # Disable netrw eagerly + # https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129 + vim.g.loaded = 1; + vim.g.loaded_netrwPlugin = 1; + + setup.nvim-tree = { + disable_netrw = true; + hijack_netrw = true; + update_focused_file = { + enable = true; + update_cwd = true; + ignore_list = { }; + }; + diagnostics = { + enable = true; + icons = { + hint = ""; + info = ""; + warning = ""; + error = ""; + }; + }; + renderer = { + icons = { + glyphs = { + git = { + unstaged = "~"; + staged = "+"; + unmerged = ""; + renamed = "➜"; + deleted = ""; + untracked = "?"; + ignored = "◌"; + }; + }; + }; + }; + view = { + width = 30; + hide_root_folder = false; + side = "left"; + mappings = { + custom_only = false; + list = [ + { + key = [ "l" "" "o" ]; + cb = dsl.rawLua + "require('nvim-tree.config').nvim_tree_callback('edit')"; + } + { + key = "h"; + cb = dsl.rawLua + "require('nvim-tree.config').nvim_tree_callback('close_node')"; + } + { + key = "v"; + cb = dsl.rawLua + "require('nvim-tree.config').nvim_tree_callback('vsplit')"; + } + ]; + }; + number = false; + relativenumber = false; + }; + }; + + lua = '' + vim.keymap.set("n", "e", ":NvimTreeFindFileToggle", { silent = true }) + ''; + +}