From a88d64dfa826d8dced22815e57652fff49039b94 Mon Sep 17 00:00:00 2001 From: Franciszek Malinka Date: Sat, 16 Apr 2022 21:09:35 +0200 Subject: Switched from NERDTree to NvimTree --- lua/user/bufferline.lua | 2 +- lua/user/config.lua | 4 +- lua/user/keymaps.lua | 7 +++- lua/user/lsp/test.py | 1 - lua/user/nvimtree.lua | 97 ++++++++++++++++++++++++++++++++++++++++++++ lua/user/plugins.lua | 11 +++-- lua/user/session-manager.lua | 2 + lua/user/telescope.lua | 5 +-- 8 files changed, 115 insertions(+), 14 deletions(-) delete mode 100644 lua/user/lsp/test.py create mode 100644 lua/user/nvimtree.lua (limited to 'lua/user') diff --git a/lua/user/bufferline.lua b/lua/user/bufferline.lua index 65f037c..7540cc9 100644 --- a/lua/user/bufferline.lua +++ b/lua/user/bufferline.lua @@ -25,7 +25,7 @@ bufferline.setup { diagnostics_update_in_insert = false, offsets = { { - filetype = "nerdtree", + filetype = "NvimTree", text = "Files", highlight = "Directory", text_align = "center" diff --git a/lua/user/config.lua b/lua/user/config.lua index fb655ec..bbd3a65 100644 --- a/lua/user/config.lua +++ b/lua/user/config.lua @@ -1,10 +1,10 @@ vim.opt.termguicolors = true vim.o.background = "dark" -- or "light" for light mode -vim.cmd([[colorscheme gruvbox]]) +vim.cmd([[colorscheme darkplus]]) vim.cmd [[autocmd BufWinLeave *.* mkview]] vim.cmd [[autocmd BufWinLeave *.* silent loadview]] -vim.cmd [[autocmd VimEnter *.* AlphaReady]] +-- vim.cmd [[autocmd VimEnter *.* AlphaReady]] vim.cmd [[highlight Normal ctermbg=none]] vim.cmd [[highlight NonText ctermbg=none]] diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index 533f2bc..084069e 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -16,8 +16,11 @@ vim.g.mapleader = " " vim.g.maplocalleader = " " -- NERDTree keybindings -keymap("n", "", ":NERDTree", opts) -keymap("n", "", ":NERDTreeToggle", opts) +-- keymap("n", "", ":NERDTree", opts) +-- keymap("n", "", ":NERDTreeToggle", opts) + +-- NvimTree keybindings +keymap("n", "", ":NvimTreeToggle", opts) -- Resizing windows (like i3) keymap("n", "", ":resize -2", opts) diff --git a/lua/user/lsp/test.py b/lua/user/lsp/test.py deleted file mode 100644 index 2399fb2..0000000 --- a/lua/user/lsp/test.py +++ /dev/null @@ -1 +0,0 @@ -import math.sqrt diff --git a/lua/user/nvimtree.lua b/lua/user/nvimtree.lua new file mode 100644 index 0000000..d6ac3ce --- /dev/null +++ b/lua/user/nvimtree.lua @@ -0,0 +1,97 @@ +local status_ok, nvim_tree = pcall(require, "nvim-tree") +if not status_ok then + print("Error loading nvim_tree") + return +end + +local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") +if not config_status_ok then + return +end + +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 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 = { + "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", "", "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 612d603..84b05ff 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -43,8 +43,9 @@ return packer.startup(function(use) use "vim-airline/vim-airline" use "vim-airline/vim-airline-themes" -- use "itchyny/lightline.vim" - use "preservim/nerdtree" - use "tiagofumo/vim-nerdtree-syntax-highlight" + -- use "preservim/nerdtree" + -- use "tiagofumo/vim-nerdtree-syntax-highlight" + use "kyazdani42/nvim-tree.lua" use "kyazdani42/nvim-web-devicons" use "ryanoasis/vim-devicons" @@ -89,8 +90,10 @@ return packer.startup(function(use) use "akinsho/bufferline.nvim" use "goolord/alpha-nvim" - use "Shatur/neovim-session-manager" - + use { + "Shatur/neovim-session-manager", + commit = "2d42185c859907ab600dd2d0ebd8d1764eec5b58" + } if PACKER_BOOTSTRAP then require("packer").sync() end diff --git a/lua/user/session-manager.lua b/lua/user/session-manager.lua index 570c722..c23b721 100644 --- a/lua/user/session-manager.lua +++ b/lua/user/session-manager.lua @@ -8,3 +8,5 @@ session_manager.setup({ sessions_dir = Path:new(vim.fn.stdpath('data'), '.sessions'), autoload_mode = require("session_manager.config").AutoloadMode.Disabled, }) + +vim.cmd('autocmd User SessionLoadPost lua require"nvim-tree".toggle(false, true)') diff --git a/lua/user/telescope.lua b/lua/user/telescope.lua index 322068b..f073ea2 100644 --- a/lua/user/telescope.lua +++ b/lua/user/telescope.lua @@ -5,14 +5,11 @@ if not status_ok then end local actions = require "telescope.actions" -local pls_work = "ui-select" - telescope.setup { defaults = { prompt_prefix = " ", - selection_caret = " ", - + selection_caret = "> ", --  mappings = { i = { -- cgit v1.2.3