From 8a0439114dc9caa4283cc3e315576dd7b0cde4d4 Mon Sep 17 00:00:00 2001 From: Anurag Singh Date: Sat, 3 Feb 2024 06:30:00 -0800 Subject: [PATCH] NVIM tree configurations. --- init.lua | 31 ++++++++++++++++++++++++++++++- lazy-lock.json | 29 +++++++++++++++++++++++++++++ lua/custom/plugins/init.lua | 29 ++++++++++++++++++++++++++++- 3 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 lazy-lock.json diff --git a/init.lua b/init.lua index c7e64006..8231374e 100644 --- a/init.lua +++ b/init.lua @@ -272,7 +272,16 @@ require('lazy').setup({ -- -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins -- { import = 'custom.plugins' }, -}, {}) + -- empty setup using defaults + {"nvim-tree/nvim-tree.lua", + config = function() + require'nvim-tree'.setup { + -- Your nvim-tree configuration here + } + end + }, +}, +{}) -- [[ Setting options ]] -- See `:help vim.o` @@ -315,6 +324,10 @@ vim.o.completeopt = 'menuone,noselect' -- NOTE: You should make sure your terminal supports this vim.o.termguicolors = true +-- Added for nvim-tree +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + -- [[ Basic Keymaps ]] -- Keymaps for better default experience @@ -331,6 +344,22 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnos vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) +-- NVimTree configuration +-- +-- Keymaps for NvimTree +vim.keymap.set('n', 'tt', ':NvimTreeToggle', { noremap = true, silent = true }) +vim.keymap.set('n', 'tc', ':NvimTreeClose', { noremap = true, silent = true }) +vim.keymap.set('n', 'tf', ':NvimTreeFocus', { noremap = true, silent = true }) + +vim.api.nvim_create_autocmd("BufEnter", { + nested = true, + callback = function() + if #vim.api.nvim_list_wins() == 1 and vim.api.nvim_buf_get_name(0):match("NvimTree_") ~= nil then + vim.cmd("quit") + end + end +}) + -- [[ Highlight on yank ]] -- See `:help vim.highlight.on_yank()` local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 00000000..4d2d9214 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,29 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, + "LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "fidget.nvim": { "branch": "main", "commit": "1d1042d418ee8cb70d68f1e38db639844331c093" }, + "friendly-snippets": { "branch": "main", "commit": "b8fae73a479ae0a1c54f5c98fa687ae8a0addc53" }, + "gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" }, + "indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" }, + "lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" }, + "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "2b3d247fce06f53934174f5dfe0362c42d65c00c" }, + "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" }, + "neodev.nvim": { "branch": "main", "commit": "2793ba3127c2c93ee486b9072a3ef129eeb950cc" }, + "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, + "nvim-lspconfig": { "branch": "master", "commit": "9a6279953c82d01b58825a46ede032ab246a5983" }, + "nvim-tree.lua": { "branch": "master", "commit": "f39f7b6fcd3865ac2146de4cb4045286308f2935" }, + "nvim-treesitter": { "branch": "master", "commit": "4fbf150a1621d52f17b099506e1a32f107079210" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "8edd5a6d96936bdff23333d3bc177481388839e5" }, + "onedark.nvim": { "branch": "master", "commit": "1230aaf2a427b2c5b73aba6e4a9a5881d3e69429" }, + "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, + "vim-fugitive": { "branch": "master", "commit": "e7bf502a6ae492f42a91d231864e25630286319b" }, + "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, + "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, + "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } +} \ No newline at end of file diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8..f3be9e5e 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,31 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information -return {} + +-- disable netrw at the very start of your init.lua +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +-- optionally enable 24-bit colour +vim.opt.termguicolors = true + +-- empty setup using defaults +require("nvim-tree").setup() + +-- OR setup with some options +--require("nvim-tree").setup({ +-- sort = { +-- sorter = "case_sensitive", +-- }, +-- view = { +-- width = 30, +-- }, +-- renderer = { +-- group_empty = true, +-- }, +-- filters = { +-- dotfiles = true, +-- }, +--}) + +--return {}