From 299167feb753e542166c4fac5cb0588ebdd7c908 Mon Sep 17 00:00:00 2001 From: Jim Richter Date: Wed, 22 Sep 2021 11:44:12 +0200 Subject: [PATCH] switch nerdtree to nvim-tree.lua --- configs/.p10k.zsh | 20 ++++++++--------- configs/init.lua | 44 +++++++++++++++++++++++-------------- configs/lua/keymappings.lua | 9 +++++--- configs/lua/lsp-utils.lua | 3 ++- 4 files changed, 45 insertions(+), 31 deletions(-) diff --git a/configs/.p10k.zsh b/configs/.p10k.zsh index 80d1a38..b79e91d 100644 --- a/configs/.p10k.zsh +++ b/configs/.p10k.zsh @@ -1,7 +1,7 @@ -# Generated by Powerlevel10k configuration wizard on 2021-08-23 at 14:33 CEST. +# Generated by Powerlevel10k configuration wizard on 2021-09-16 at 15:20 CEST. # Based on romkatv/powerlevel10k/config/p10k-pure.zsh. -# Wizard options: nerdfont-complete + powerline, large icons, pure, snazzy, rpromt, -# 1 line, compact, instant_prompt=verbose. +# Wizard options: nerdfont-complete + powerline, small icons, pure, rpromt, 1 line, +# compact, transient_prompt, instant_prompt=verbose. # Type `p10k configure` to generate another config. # # Config file for Powerlevel10k with the style of Pure (https://github.com/sindresorhus/pure). @@ -39,12 +39,12 @@ # Prompt colors. local grey='242' - local red='#FF5C57' - local yellow='#F3F99D' - local blue='#57C7FF' - local magenta='#FF6AC1' - local cyan='#9AEDFE' - local white='#F1F1F0' + local red='1' + local yellow='3' + local blue='4' + local magenta='5' + local cyan='6' + local white='7' # Left prompt segments. typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( @@ -161,7 +161,7 @@ # - always: Trim down prompt when accepting a command line. # - same-dir: Trim down prompt when accepting a command line unless this is the first command # typed after changing current working directory. - typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off + typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always # Instant prompt mode. # diff --git a/configs/init.lua b/configs/init.lua index be0b1b0..a9afb49 100644 --- a/configs/init.lua +++ b/configs/init.lua @@ -13,11 +13,13 @@ paq:setup({verbose = true}) { "nvim-lua/plenary.nvim", -- Theming Plugins "kaicataldo/material.vim", - "ryanoasis/vim-devicons", "xiyaowong/nvim-transparent", -- Layout Plugins - "preservim/nerdtree", - "jistr/vim-nerdtree-tabs", + --"preservim/nerdtree", + --"unkiwii/vim-nerdtree-sync", + "kyazdani42/nvim-web-devicons", + "kyazdani42/nvim-tree.lua", + "karb94/neoscroll.nvim", -- Code Navigation "junegunn/fzf", "nvim-lua/popup.nvim", @@ -27,6 +29,7 @@ paq:setup({verbose = true}) { -- Obsidian / Roam features "lervag/wiki.vim", -- Syntax / Autocomplete + "preservim/nerdcommenter", "neovim/nvim-lspconfig", "kabouzeid/nvim-lspinstall", "nvim-lua/lsp-status.nvim", @@ -57,12 +60,15 @@ if u.has_plugin("cmp") then -- Apply Theme o.syntax = "enable" o.termguicolors = true - g.NERDTreeShowHidden = true - g.NERDTreeAutoDeleteBuffer = true - g.NERDTreeMinimalUI = true - g.NERDTreeDirArrows = true + --g.NERDTreeShowHidden = true + --g.NERDTreeAutoDeleteBuffer = true + --g.NERDTreeMinimalUI = true + --g.NERDTreeDirArrows = true -- g.NERDTreeCustomOpenArgs = {file = {where = "t"}} + + g.nvim_tree_auto_open = 1 g.hidden = true + g.filetype = true g.material_terminal_italics = 1 g.material_theme_style = "darker" g.wiki_root = "~/Notes" @@ -106,17 +112,18 @@ if u.has_plugin("cmp") then -- Toggleterm / Lazygit setup require "lazy-git" - -- Autocommands - u.create_augroup( - { - {"VimEnter", "*", "if (@% == '') | NERDTree | endif"}, - {"BufEnter", "*", 'if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif'}, - {"BufWinEnter", "*", "NERDTreeMirrorOpen"} - --{"BufEnter", "*", "if &modifiable | NERDTreeFind | wincmd p | endif"} - }, - "Nerdtree" - ) + require("nvim-tree.view").View.winopts.signcolumn = "no" + -- Autocommands + --[[ u.create_augroup(]] + --[[{]] + --[[{"StdinReadPre", "*", "let s:std_in=1"},]] + --[[{"VimEnter", "*", "if argc() == 0 && !exists('s:std_in') | NERDTree | endif"},]] + --[[{"BufEnter", "*", 'if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif'},]] + --[[{"BufWinEnter", "*", "if getcmdwintype() == '' | silent NERDTreeMirror | endif"}]] + --[[},]] + --[["Nerdtree"]] + --[[)]] -- Setup rest.vim require("rest-nvim").setup( { @@ -134,6 +141,9 @@ if u.has_plugin("cmp") then } ) + -- Smooth Scrolling + require("neoscroll").setup() + -- Autocompletion Setup o.completeopt = "menuone,noselect" require "autocomplete" diff --git a/configs/lua/keymappings.lua b/configs/lua/keymappings.lua index fce4e57..1f11d6a 100644 --- a/configs/lua/keymappings.lua +++ b/configs/lua/keymappings.lua @@ -9,14 +9,17 @@ map("n", " ", "", remap) g.mapleader = " " map("n", "", ":Telescope find_files", options) -map("n", "", ":Telescope grep_string", options); -map("n", "", ":Telescope live_grep", options); +map("n", "", ":Telescope grep_string", options) +map("n", "", ":Telescope live_grep", options) -- Navigate Buffers map("n", "", "h", options) map("n", "", "j", options) map("n", "", "k", options) map("n", "", "l", options) +-- Find file in NvimTree +map("n", "", ":NvimTreeFindFile", options) + -- I aint no weak boy map("n", "", ":echo 'No Left for you'", options) map("n", "", ":echo 'No Right for you'", options) @@ -30,7 +33,7 @@ map("n", "r", "lua require('rest-nvim').run()", options) map("n", "q", ":q", options) -- Open Nerdtree -map("n", "", ":NERDTreeToggle", options) +map("n", "", ":NvimTreeToggle", options) -- Make ctrl+s work map("n", "", ":w", options) diff --git a/configs/lua/lsp-utils.lua b/configs/lua/lsp-utils.lua index cb1ca93..c6d04f6 100644 --- a/configs/lua/lsp-utils.lua +++ b/configs/lua/lsp-utils.lua @@ -1,5 +1,6 @@ local nvim_lsp = require "lspconfig" local lsp_status = require("lsp-status") +local utils = require("utils") -- function to attach completion when setting up lsp local function on_attach(client) @@ -21,7 +22,7 @@ local function on_attach(client) buf_set_keymap("n", "K", "lua vim.lsp.buf.hover()", opts) buf_set_keymap("n", "e", "lua vim.lsp.diagnostic.show_line_diagnostics()", opts) buf_set_keymap("n", "rn", "lua vim.lsp.buf.rename()", opts) - buf_set_keymap("n", "", "lua vim.lsp.buf.code_action()", opts) + buf_set_keymap("n", "", "lua vim.lsp.buf.code_action()", opts) buf_set_keymap("n", "[d", "lua vim.lsp.diagnostic.goto_prev()", opts) buf_set_keymap("n", "]d", "lua vim.lsp.diagnostic.goto_next()", opts)