From 80222dd4896c1b111dae9a7df0e4e638c5f24cc5 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Mon, 26 Aug 2024 20:14:12 +0200 Subject: [PATCH] Add nvim-tree setup --- tasks/neovim.yml | 4 ++++ templates/nvim/init.lua.j2 | 1 + templates/nvim/lua/keybindings.lua.j2 | 2 +- templates/nvim/lua/nvim-tree.lua.j2 | 18 ++++++++++++++++++ templates/nvim/lua/options.lua.j2 | 4 ++++ vars/main.yml | 3 +-- 6 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 templates/nvim/lua/nvim-tree.lua.j2 diff --git a/tasks/neovim.yml b/tasks/neovim.yml index 633db0a..af1957c 100644 --- a/tasks/neovim.yml +++ b/tasks/neovim.yml @@ -148,6 +148,10 @@ src: 'templates/nvim/lua/indent-blankline.lua.j2', dest: '{{ xdg_config_dir }}/nvim/lua/indent-blankline.lua', } + - { + src: 'templates/nvim/lua/nvim-tree.lua.j2', + dest: '{{ xdg_config_dir }}/nvim/lua/_nvim-tree.lua', + } - block: - name: create neovim install directory diff --git a/templates/nvim/init.lua.j2 b/templates/nvim/init.lua.j2 index 58d3b70..d38546b 100644 --- a/templates/nvim/init.lua.j2 +++ b/templates/nvim/init.lua.j2 @@ -10,3 +10,4 @@ require('lua-line') require('git-signs') require('_telescope') require('indent-blankline') +require('_nvim-tree') diff --git a/templates/nvim/lua/keybindings.lua.j2 b/templates/nvim/lua/keybindings.lua.j2 index a9cad32..653e2dd 100644 --- a/templates/nvim/lua/keybindings.lua.j2 +++ b/templates/nvim/lua/keybindings.lua.j2 @@ -1,6 +1,6 @@ local opts = {noremap=true, silent=true} -vim.api.nvim_set_keymap('n', '', ':NERDTreeToggle', opts) +vim.api.nvim_set_keymap('n', '', ':NvimTreeToggle', opts) vim.api.nvim_set_keymap('n', 'ff', 'lua require("telescope.builtin").find_files()', opts) vim.api.nvim_set_keymap('n', 'fg', 'lua require("telescope.builtin").live_grep()', opts) vim.api.nvim_set_keymap('n', 'fb', 'lua require("telescope.builtin").buffers()', opts) diff --git a/templates/nvim/lua/nvim-tree.lua.j2 b/templates/nvim/lua/nvim-tree.lua.j2 new file mode 100644 index 0000000..294e5b1 --- /dev/null +++ b/templates/nvim/lua/nvim-tree.lua.j2 @@ -0,0 +1,18 @@ +local nvim_tree = require('nvim-tree'); + +nvim_tree.setup { + renderer = { + icons = { + show = { + file = false, + folder = false, + modified = false, + hidden = false, + diagnostics = false, + bookmarks = false, + git = false, + folder_arrow = false + } + } + } +} diff --git a/templates/nvim/lua/options.lua.j2 b/templates/nvim/lua/options.lua.j2 index 367a04a..0c2f806 100644 --- a/templates/nvim/lua/options.lua.j2 +++ b/templates/nvim/lua/options.lua.j2 @@ -55,5 +55,9 @@ vim.o.background = 'light' vim.o.laststatus = 2 vim.o.statusline = ' %F %m%r%w %= %{hostname()} %{strlen(&ft)?&ft:"none"} %{(&bomb?",BOM":"")} %{&ff} %l/%L %c %P' +-- use a dedicated file explorer +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + -- python interpreter vim.g.python3_host_prog = './env/bin/python' diff --git a/vars/main.yml b/vars/main.yml index 7063c8d..c4e3dbf 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -8,7 +8,7 @@ dotfiles_repo: 'git@git.fudiggity.nl:sonny/dotfiles.git' public_dotfiles_repo: 'git@git.fudiggity.nl:sonny/dotfiles.git' neovim_plugins: - - { url: 'https://github.com/preservim/nerdtree', name: 'nerdtree' } + - { url: 'https://github.com/nvim-tree/nvim-tree.lua', name: 'nvim-tree' } - { url: 'https://github.com/neovim/nvim-lspconfig', name: 'nvim-lspconfig' } - { url: 'https://github.com/hrsh7th/nvim-cmp/', name: 'nvim-cmp' } - { url: 'https://github.com/hrsh7th/cmp-nvim-lsp/', name: 'cmp-nvim-lsp' } @@ -29,7 +29,6 @@ neovim_plugins: name: 'gitsigns.nvim', version: 'v0.9.0', } - - { url: 'https://github.com/sainnhe/edge', name: 'edge' } - { url: 'https://github.com/nvim-lualine/lualine.nvim', name: 'lualine' } - { url: 'https://github.com/catppuccin/nvim',