summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito G. Graffagnino <vito@graffagnino.xyz>2022-06-03 17:17:42 +0100
committerVito G. Graffagnino <vito@graffagnino.xyz>2022-06-03 17:17:42 +0100
commitc2635e343598a8d95d816a760572a87d30541cb2 (patch)
tree1cdf149dd4ee9073b945e49fc296930f21420222
parent30b4a7f4831f0a092d33702b7f8541b129412ea6 (diff)
parent8fad47c3cf670bad0afd9439032c148d27ca62de (diff)
Merge branch '12-nvimtree' into vgg
-rw-r--r--init.lua1
-rw-r--r--lua/user/keymaps.lua4
-rw-r--r--lua/user/nvim-tree.lua100
-rw-r--r--lua/user/plugins.lua2
4 files changed, 105 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index ce84304..75b0fe9 100644
--- a/init.lua
+++ b/init.lua
@@ -10,3 +10,4 @@ require "user.autopairs"
require "user.lua"
require "user.comment"
require "user.gitsigns"
+require "user.nvim-tree"
diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua
index c7d10c4..2827499 100644
--- a/lua/user/keymaps.lua
+++ b/lua/user/keymaps.lua
@@ -25,8 +25,6 @@ keymap("n", "<C-j>", "<C-w>j", opts)
keymap("n", "<C-k>", "<C-w>k", opts)
keymap("n", "<C-l>", "<C-w>l", opts)
-keymap("n", "<leader>e", ":Lex 30<cr>", opts)
-
-- Resize with arrows
keymap("n", "<C-Up>", ":resize +2<CR>", opts)
keymap("n", "<C-Down>", ":resize -2<CR>", opts)
@@ -65,6 +63,8 @@ keymap("t", "<C-j>", "<C-\\><C-N><C-w>j", term_opts)
keymap("t", "<C-k>", "<C-\\><C-N><C-w>k", term_opts)
keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", term_opts)
+-- Nvimtree
+keymap("n", "<leader>e", ":NvimTreeToggle<cr>", opts)
-- keymap("n", "<leader>f", "<cmd>Telescope find_files<cr>", opts)
keymap("n", "<leader>f", "<cmd>lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))<cr>", opts)
keymap("n", "<c-t>", "<cmd>Telescope live_grep<cr>", opts)
diff --git a/lua/user/nvim-tree.lua b/lua/user/nvim-tree.lua
new file mode 100644
index 0000000..e80e04b
--- /dev/null
+++ b/lua/user/nvim-tree.lua
@@ -0,0 +1,100 @@
+-- following options are the default
+-- each of these are documented in `:help nvim-tree.OPTION_NAME`
+vim.g.nvim_tree_icons = {
+ default = "",
+ symlink = "",
+ git = {
+ unstaged = "",
+ staged = "S",
+ unmerged = "",
+ renamed = "➜",
+ deleted = "",
+ untracked = "U",
+ ignored = "◌",
+ },
+ folder = {
+ default = "",
+ open = "",
+ empty = "",
+ empty_open = "",
+ symlink = "",
+ },
+}
+
+local status_ok, nvim_tree = pcall(require, "nvim-tree")
+if not status_ok then
+ return
+end
+
+local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
+if not config_status_ok then
+ return
+end
+
+local tree_cb = nvim_tree_config.nvim_tree_callback
+
+nvim_tree.setup {
+ disable_netrw = true,
+ hijack_netrw = true,
+ open_on_setup = false,
+ ignore_ft_on_setup = {
+ "startify",
+ "dashboard",
+ "alpha",
+ },
+ auto_close = true,
+ open_on_tab = false,
+ hijack_cursor = false,
+ update_cwd = true,
+ update_to_buf_dir = {
+ enable = true,
+ auto_open = true,
+ },
+ diagnostics = {
+ enable = true,
+ icons = {
+ hint = "",
+ info = "",
+ warning = "",
+ error = "",
+ },
+ },
+ update_focused_file = {
+ enable = true,
+ update_cwd = true,
+ ignore_list = {},
+ },
+ git = {
+ enable = true,
+ ignore = true,
+ timeout = 500,
+ },
+ view = {
+ width = 30,
+ height = 30,
+ hide_root_folder = false,
+ side = "left",
+ auto_resize = true,
+ mappings = {
+ custom_only = false,
+ list = {
+ { key = { "l", "<CR>", "o" }, cb = tree_cb "edit" },
+ { key = "h", cb = tree_cb "close_node" },
+ { key = "v", cb = tree_cb "vsplit" },
+ },
+ },
+ number = false,
+ relativenumber = false,
+ },
+ quit_on_open = 0,
+ git_hl = 1,
+ disable_window_picker = 0,
+ root_folder_modifier = ":t",
+ show_icons = {
+ git = 1,
+ folders = 1,
+ files = 1,
+ folder_arrows = 1,
+ tree_width = 30,
+ },
+}
diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua
index ded58ec..7224112 100644
--- a/lua/user/plugins.lua
+++ b/lua/user/plugins.lua
@@ -46,6 +46,8 @@ return packer.startup(function(use)
use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins
use "windwp/nvim-autopairs" -- Autopairs, integrates with both cmp and treesitter
use "numToStr/Comment.nvim" -- Easily comment stuff
+ use 'kyazdani42/nvim-web-devicons'
+ use 'kyazdani42/nvim-tree.lua'
-- Colorschemes
use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out