diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index 0a8663e..3d36a35 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -1,3 +1,16 @@ +let g:nvim_tree_show_icons = { + \ 'git': 1, + \ 'folders': 1, + \ 'files': 1, + \ 'folder_arrows': 1, + \ } +let g:nvim_tree_icons = { + \ 'default': '', + \ 'folder': { + \ 'arrow_open': "", + \ 'arrow_closed': "", + \ } + \ } lua require('plugins') " Load vim config in current directory @@ -10,7 +23,6 @@ let delimitMate_balance_matchpairs = 1 " Theme colorscheme gruvbox -" colorscheme codedark set t_Co=256 set t_ZH= set t_ZR= @@ -35,9 +47,6 @@ endif let g:airline_symbols.dirty = " ±" let g:airline_symbols.notexists = " " -" NERDTree -autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif - " Preferences syntax on filetype plugin indent on @@ -53,52 +62,36 @@ set hidden set updatetime=300 set noshowmode -" Keybindings -map :NERDTreeToggle -map :TmuxNavigateLeft -map :TmuxNavigateDown -map :TmuxNavigateUp -map :TmuxNavigateRight -map :bn -map :bp -map 10j -map 10k -map :Bdelete -map :call ToggleQuickfixList() -map :noh +set foldmethod=expr +set foldexpr=nvim_treesitter#foldexpr() +set foldnestmax=1 +set foldlevel=20 -inoremap pumvisible() ? "\" : "\" -inoremap pumvisible() ? "\" : "\" -imap pumvisible() ? "\" : "delimitMateBS" -imap pumvisible() ? "\\" : "delimitMateCR" +" Keybindings +nnoremap NvimTreeToggle +nnoremap TmuxNavigateLeft +nnoremap TmuxNavigateDown +nnoremap TmuxNavigateUp +nnoremap TmuxNavigateRight +nnoremap bn +nnoremap bp +nnoremap Bdelete +nnoremap TroubleToggle workspace_diagnostics +nnoremap call ToggleQuickfixList() +nnoremap noh +nnoremap 10j +nnoremap 10k nnoremap ff Telescope find_files nnoremap fg Telescope live_grep nnoremap fb Telescope buffers nnoremap lc Telescope lsp_code_actions nnoremap ls Telescope lsp_document_symbols -map ln :lua vim.lsp.diagnostic.goto_next() -map lp :lua vim.lsp.diagnostic.goto_prev() -map ll :lua vim.lsp.buf. -map lh :lua vim.lsp.buf.hover() -map lf :lua vim.lsp.buf.formatting() +nnoremap ln lua vim.lsp.diagnostic.goto_next() +nnoremap lp lua vim.lsp.diagnostic.goto_prev() +nnoremap ll lua vim.lsp.buf. +nnoremap lh lua vim.lsp.buf.hover() +nnoremap lf lua vim.lsp.buf.formatting() -let g:closetag_filenames = "*.html,*.xhtml,*.phtml,*.erb,*.jsx,*.tsx" -let g:closetag_xhtml_filenames = '*.xhtml,*.jsx,*.tsx,*.erb' - -" gray -highlight! CmpItemAbbrDeprecated guibg=NONE gui=strikethrough guifg=#808080 -" blue -highlight! CmpItemAbbrMatch guibg=NONE guifg=#569CD6 -highlight! CmpItemAbbrMatchFuzzy guibg=NONE guifg=#569CD6 -" light blue -highlight! CmpItemKindVariable guibg=NONE guifg=#9CDCFE -highlight! CmpItemKindInterface guibg=NONE guifg=#9CDCFE -highlight! CmpItemKindText guibg=NONE guifg=#9CDCFE -" pink -highlight! CmpItemKindFunction guibg=NONE guifg=#C586C0 -highlight! CmpItemKindMethod guibg=NONE guifg=#C586C0 -" front -highlight! CmpItemKindKeyword guibg=NONE guifg=#D4D4D4 -highlight! CmpItemKindProperty guibg=NONE guifg=#D4D4D4 -highlight! CmpItemKindUnit guibg=NONE guifg=#D4D4D4 +highlight! CmpItemAbbrMatch ctermfg=cyan +highlight! CmpItemAbbrMatchFuzzy ctermfg=cyan diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index 4bda069..ded7d79 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -5,6 +5,7 @@ if fn.empty(fn.glob(install_path)) > 0 then end require('packer').startup(function() + use 'antoinemadec/FixCursorHold.nvim' use 'wbthomason/packer.nvim' use 'gruvbox-community/gruvbox' @@ -12,23 +13,27 @@ require('packer').startup(function() use 'bling/vim-airline' use 'Raimondi/delimitMate' - use 'alvan/vim-closetag' - use 'scrooloose/nerdtree' - -- -- use 'tomtom/tcomment_vim' + -- use 'scrooloose/nerdtree' + use { + 'kyazdani42/nvim-tree.lua', + requires = { + 'kyazdani42/nvim-web-devicons', -- optional, for file icon + }, + config = function() require'nvim-tree'.setup { + auto_close = true, + } end + } use 'tpope/vim-commentary' use 'tpope/vim-surround' use 'christoomey/vim-tmux-navigator' use 'tpope/vim-dispatch' use 'milkypostman/vim-togglelist' use 'moll/vim-bbye' - -- use { 'junegunn/fzf', run = './install --bin' } - -- use 'junegunn/fzf.vim' - -- use 'tpope/vim-fugitive' - -- use 'ConradIrwin/vim-bracketed-paste' use { 'nvim-telescope/telescope.nvim', requires = { {'nvim-lua/plenary.nvim'} } } + use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } use 'neovim/nvim-lspconfig' use 'hrsh7th/cmp-nvim-lsp' @@ -37,6 +42,26 @@ require('packer').startup(function() use 'hrsh7th/cmp-cmdline' use 'hrsh7th/nvim-cmp' use 'onsails/lspkind-nvim' + use 'ray-x/lsp_signature.nvim' + use { + "folke/trouble.nvim", + requires = "kyazdani42/nvim-web-devicons", + config = function() + require("trouble").setup { + signs = { + -- icons / text used for a diagnostic + error = "error", + warning = "warn", + hint = "hint", + information = "info" + }, + } + end + } + + use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' } + use 'windwp/nvim-ts-autotag' + use 'JoosepAlviste/nvim-ts-context-commentstring' use 'hrsh7th/cmp-vsnip' use 'hrsh7th/vim-vsnip' @@ -50,7 +75,30 @@ end) vim.api.nvim_set_keymap('n', 'k', "v:count == 0 ? 'gk' : 'k'", { noremap = true, expr = true, silent = true }) vim.api.nvim_set_keymap('n', 'j', "v:count == 0 ? 'gj' : 'j'", { noremap = true, expr = true, silent = true }) -require('telescope').setup{ defaults = { file_ignore_patterns = { "node_module" } } } +require('telescope').setup { + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- the default case_mode is "smart_case" + } + } +} +-- To get fzf loaded and working with telescope, you need to call +-- load_extension, somewhere after setup function: +require('telescope').load_extension('fzf') + +require "lsp_signature".setup({ + hint_enable = false, + handler_opts = { + border = "none" -- double, rounded, single, shadow, none + }, + padding = ' ', +}) + +require'nvim-tree'.setup() -- nvim-cmp setup local cmp = require 'cmp' @@ -145,7 +193,7 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( } ) -vim.o.updatetime = 250 +vim.o.updatetime = 100 -- Taken from: https://github.com/wookayin/dotfiles/blob/master/nvim/lua/config/lsp.lua -- Makes it so the diagnostic popup does not keep overwriting other popups @@ -178,8 +226,6 @@ augroup LSPDiagnosticsOnHover augroup END ]] -vim.cmd [[autocmd CursorHoldI * silent! lua vim.lsp.buf.signature_help()]] - -- Enable some language servers with the additional completion capabilities offered by nvim-cmp local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) @@ -217,10 +263,21 @@ cmp.setup { } } -vim.fn.sign_define("LspDiagnosticsSignError", { text="" }) -vim.fn.sign_define("LspDiagnosticsSignWarning", { text="" }) -vim.fn.sign_define("LspDiagnosticsSignInformation", { text="" }) -vim.fn.sign_define("LspDiagnosticsSignHint", { text="" }) +require'nvim-treesitter.configs'.setup { + ensure_installed = "maintained", +} +require('nvim-ts-autotag').setup() +require'nvim-treesitter.configs'.setup { + context_commentstring = { + enable = true + } +} + +local signs = { Error = "", Warn = "", Hint = "", Info = "" } +for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) +end -- Set completeopt to have a better completion experience -vim.o.completeopt = 'menuone,noselect' +-- vim.o.completeopt = 'menuone,noselect' diff --git a/nvim/.config/nvim/plugin/packer_compiled.lua b/nvim/.config/nvim/plugin/packer_compiled.lua index c72dce4..1a72e26 100644 --- a/nvim/.config/nvim/plugin/packer_compiled.lua +++ b/nvim/.config/nvim/plugin/packer_compiled.lua @@ -69,6 +69,11 @@ end time([[try_loadstring definition]], false) time([[Defining packer_plugins]], true) _G.packer_plugins = { + ["FixCursorHold.nvim"] = { + loaded = true, + path = "/home/tim/.local/share/nvim/site/pack/packer/start/FixCursorHold.nvim", + url = "https://github.com/antoinemadec/FixCursorHold.nvim" + }, ["cmp-buffer"] = { loaded = true, path = "/home/tim/.local/share/nvim/site/pack/packer/start/cmp-buffer", @@ -109,16 +114,16 @@ _G.packer_plugins = { path = "/home/tim/.local/share/nvim/site/pack/packer/start/gruvbox", url = "https://github.com/gruvbox-community/gruvbox" }, + ["lsp_signature.nvim"] = { + loaded = true, + path = "/home/tim/.local/share/nvim/site/pack/packer/start/lsp_signature.nvim", + url = "https://github.com/ray-x/lsp_signature.nvim" + }, ["lspkind-nvim"] = { loaded = true, path = "/home/tim/.local/share/nvim/site/pack/packer/start/lspkind-nvim", url = "https://github.com/onsails/lspkind-nvim" }, - nerdtree = { - loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/nerdtree", - url = "https://github.com/scrooloose/nerdtree" - }, ["nvim-cmp"] = { loaded = true, path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-cmp", @@ -129,6 +134,32 @@ _G.packer_plugins = { path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", url = "https://github.com/neovim/nvim-lspconfig" }, + ["nvim-tree.lua"] = { + config = { "\27LJ\1\2J\0\0\2\0\4\0\a4\0\0\0%\1\1\0>\0\2\0027\0\2\0003\1\3\0>\0\2\1G\0\1\0\1\0\1\15auto_close\2\nsetup\14nvim-tree\frequire\0" }, + loaded = true, + path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", + url = "https://github.com/kyazdani42/nvim-tree.lua" + }, + ["nvim-treesitter"] = { + loaded = true, + path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["nvim-ts-autotag"] = { + loaded = true, + path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-ts-autotag", + url = "https://github.com/windwp/nvim-ts-autotag" + }, + ["nvim-ts-context-commentstring"] = { + loaded = true, + path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-ts-context-commentstring", + url = "https://github.com/JoosepAlviste/nvim-ts-context-commentstring" + }, + ["nvim-web-devicons"] = { + loaded = true, + path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", + url = "https://github.com/kyazdani42/nvim-web-devicons" + }, ["packer.nvim"] = { loaded = true, path = "/home/tim/.local/share/nvim/site/pack/packer/start/packer.nvim", @@ -139,11 +170,22 @@ _G.packer_plugins = { path = "/home/tim/.local/share/nvim/site/pack/packer/start/plenary.nvim", url = "https://github.com/nvim-lua/plenary.nvim" }, + ["telescope-fzf-native.nvim"] = { + loaded = true, + path = "/home/tim/.local/share/nvim/site/pack/packer/start/telescope-fzf-native.nvim", + url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim" + }, ["telescope.nvim"] = { loaded = true, path = "/home/tim/.local/share/nvim/site/pack/packer/start/telescope.nvim", url = "https://github.com/nvim-telescope/telescope.nvim" }, + ["trouble.nvim"] = { + config = { "\27LJ\1\2\1\0\0\3\0\6\0\t4\0\0\0%\1\1\0>\0\2\0027\0\2\0003\1\4\0003\2\3\0:\2\5\1>\0\2\1G\0\1\0\nsigns\1\0\0\1\0\4\16information\tinfo\thint\thint\fwarning\twarn\nerror\nerror\nsetup\ftrouble\frequire\0" }, + loaded = true, + path = "/home/tim/.local/share/nvim/site/pack/packer/start/trouble.nvim", + url = "https://github.com/folke/trouble.nvim" + }, ["typescript-vim"] = { loaded = true, path = "/home/tim/.local/share/nvim/site/pack/packer/start/typescript-vim", @@ -159,11 +201,6 @@ _G.packer_plugins = { path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-bbye", url = "https://github.com/moll/vim-bbye" }, - ["vim-closetag"] = { - loaded = true, - path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-closetag", - url = "https://github.com/alvan/vim-closetag" - }, ["vim-code-dark"] = { loaded = true, path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-code-dark", @@ -207,6 +244,14 @@ _G.packer_plugins = { } time([[Defining packer_plugins]], false) +-- Config for: nvim-tree.lua +time([[Config for nvim-tree.lua]], true) +try_loadstring("\27LJ\1\2J\0\0\2\0\4\0\a4\0\0\0%\1\1\0>\0\2\0027\0\2\0003\1\3\0>\0\2\1G\0\1\0\1\0\1\15auto_close\2\nsetup\14nvim-tree\frequire\0", "config", "nvim-tree.lua") +time([[Config for nvim-tree.lua]], false) +-- Config for: trouble.nvim +time([[Config for trouble.nvim]], true) +try_loadstring("\27LJ\1\2\1\0\0\3\0\6\0\t4\0\0\0%\1\1\0>\0\2\0027\0\2\0003\1\4\0003\2\3\0:\2\5\1>\0\2\1G\0\1\0\nsigns\1\0\0\1\0\4\16information\tinfo\thint\thint\fwarning\twarn\nerror\nerror\nsetup\ftrouble\frequire\0", "config", "trouble.nvim") +time([[Config for trouble.nvim]], false) if should_profile then save_profiles() end end)