From 7733ab5531454fed0e2fbb86ad2bb6680163b424 Mon Sep 17 00:00:00 2001 From: Ariel D'Alessandro Date: Mon, 30 Aug 2021 20:53:28 +0200 Subject: add harpoon --- lua/alpha/harpoon.lua | 7 +++++++ lua/alpha/init.lua | 1 + lua/plugins.lua | 10 +++++++++- plugin/lsp.vim | 16 +++++++++++++++- plugin/packer_compiled.lua | 4 ++++ 5 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 lua/alpha/harpoon.lua diff --git a/lua/alpha/harpoon.lua b/lua/alpha/harpoon.lua new file mode 100644 index 0000000..c4fa9df --- /dev/null +++ b/lua/alpha/harpoon.lua @@ -0,0 +1,7 @@ +vim.api.nvim_set_keymap("n", "ss", [[ lua require("harpoon.ui").toggle_quick_menu()]], {noremap = true, silent = true, expr = false}) + +vim.api.nvim_set_keymap("n", "sa", [[ lua require("harpoon.mark").add_file()]], {noremap = true, silent = true, expr = false}) +vim.api.nvim_set_keymap("n", "su", [[ lua require("harpoon.ui").nav_file(1)]], {noremap = true, silent = true, expr = false}) +vim.api.nvim_set_keymap("n", "si", [[ lua require("harpoon.ui").nav_file(2)]], {noremap = true, silent = true, expr = false}) +vim.api.nvim_set_keymap("n", "so", [[ lua require("harpoon.ui").nav_file(3)]], {noremap = true, silent = true, expr = false}) +vim.api.nvim_set_keymap("n", "sp", [[ lua require("harpoon.ui").nav_file(4)]], {noremap = true, silent = true, expr = false}) diff --git a/lua/alpha/init.lua b/lua/alpha/init.lua index d180239..3d3ce78 100644 --- a/lua/alpha/init.lua +++ b/lua/alpha/init.lua @@ -1,3 +1,4 @@ require("alpha.telescope") require("alpha.refactoring") require("alpha.snippets") +require("alpha.harpoon") diff --git a/lua/plugins.lua b/lua/plugins.lua index d2e6cd7..7b169cb 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -12,12 +12,20 @@ return require('packer').startup(function(use) } } - use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' } use { 'nvim-treesitter/playground' } use { 'nvim-treesitter/nvim-treesitter-refactor' } use { 'nvim-treesitter/nvim-treesitter-textobjects' } + use { + 'ThePrimeagen/harpoon', + requires = { + 'nvim-lua/plenary.nvim', + 'nvim-lua/popup.nvim', + 'ThePrimeagen/harpoon', + }, + } + use { "folke/twilight.nvim", config = function() diff --git a/plugin/lsp.vim b/plugin/lsp.vim index c411983..850a63b 100644 --- a/plugin/lsp.vim +++ b/plugin/lsp.vim @@ -42,6 +42,7 @@ nnoremap vh :lua vim.lsp.buf.hover() " to test nnoremap vi :lua vim.lsp.buf.implementation() +nnoremap vf :lua vim.lsp.buf.formatting() nnoremap vrn :lua vim.lsp.buf.rename() nnoremap vca :lua vim.lsp.buf.code_action() nnoremap vsd :lua vim.lsp.util.show_line_diagnostics(); vim.lsp.util.show_line_diagnostics() @@ -65,7 +66,20 @@ local function setup_servers() require'lspinstall'.setup() local servers = require'lspinstall'.installed_servers() for _, server in pairs(servers) do - require'lspconfig'[server].setup{ on_attach=on_attach} + if server == 'lua' then + require'lspconfig'.lua.setup { + on_attach=on_attach, + settings = { + Lua = { + diagnostics = { + globals = { 'vim' } + } + } + }, + } + else + require'lspconfig'[server].setup{ on_attach=on_attach } + end end end diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index cdc1197..3ca7e53 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua @@ -85,6 +85,10 @@ _G.packer_plugins = { loaded = true, path = "/home/alpha/.local/share/nvim/site/pack/packer/start/gruvbox" }, + harpoon = { + loaded = true, + path = "/home/alpha/.local/share/nvim/site/pack/packer/start/harpoon" + }, ["lualine.nvim"] = { loaded = true, path = "/home/alpha/.local/share/nvim/site/pack/packer/start/lualine.nvim" -- cgit v1.2.3