summaryrefslogtreecommitdiff
path: root/pkgs/custom-neovim/config/lua/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/custom-neovim/config/lua/plugins')
-rw-r--r--pkgs/custom-neovim/config/lua/plugins/lspconfig.lua91
-rw-r--r--pkgs/custom-neovim/config/lua/plugins/lualine.lua1
-rw-r--r--pkgs/custom-neovim/config/lua/plugins/presence.lua3
-rw-r--r--pkgs/custom-neovim/config/lua/plugins/tabby.lua2
-rw-r--r--pkgs/custom-neovim/config/lua/plugins/telescope.lua1
5 files changed, 98 insertions, 0 deletions
diff --git a/pkgs/custom-neovim/config/lua/plugins/lspconfig.lua b/pkgs/custom-neovim/config/lua/plugins/lspconfig.lua
new file mode 100644
index 0000000..98b34f2
--- /dev/null
+++ b/pkgs/custom-neovim/config/lua/plugins/lspconfig.lua
@@ -0,0 +1,91 @@
+-- vim.keymap.set('n', '<space>d', vim.diagnostic.setloclist, {desc = "Add buffer diagnostics to the location list."})
+
+-- Disable semantic tokens to stop weird highlighting.
+vim.api.nvim_create_autocmd('LspAttach', {
+ callback = function(ev)
+ local client = vim.lsp.get_client_by_id(ev.data.client_id)
+ if client then
+ client.server_capabilities.semanticTokensProvider = nil
+ end
+ end
+})
+
+-- Use LspAttach autocommand to only map the following keys
+-- after the language server attaches to the current buffer
+vim.api.nvim_create_autocmd('LspAttach', {
+ group = vim.api.nvim_create_augroup('UserLspConfig', {}),
+ callback = function(ev)
+ -- Enable completion triggered by <c-x><c-o>
+ vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
+
+ -- Buffer local mappings.
+ -- See `:help vim.lsp.*` for documentation on any of the below functions
+
+ local keymap = function(mode, key, desc, action)
+ vim.keymap.set(mode, key, action, {noremap = true, silent = true, desc = desc})
+ end
+
+ keymap('n', 'gD', "Go to declaration", vim.lsp.buf.declaration)
+ keymap('n', 'gd', "Go to definition", vim.lsp.buf.definition)
+ keymap('n', 'gy', "Go to type definition", vim.lsp.buf.type_definition)
+ keymap('n', 'gi', "Go to implementation", vim.lsp.buf.implementation)
+ keymap('n', '<M-k>', "Signature Help", vim.lsp.buf.signature_help)
+ keymap('i', '<M-k>', "Signature Help", vim.lsp.buf.signature_help)
+ keymap('n', "<space>o", "Manage LSP workspace", "")
+ keymap('n', '<space>oa', "Add Workspace Folder", vim.lsp.buf.add_workspace_folder)
+ keymap('n', '<space>or', "Remove Workspace Folder", vim.lsp.buf.remove_workspace_folder)
+ keymap('n', '<space>ol', "List Workspace Folders", function()
+ print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
+ end)
+ keymap('n', '<space>r', "Rename Symbol", vim.lsp.buf.rename)
+ keymap("n", "<leader>s", "Open symbol picker", [[:Pick lsp scope="document_symbol"<cr>]])
+ keymap("n", "<leader>S", "Open workspace symbol picker", [[:Pick lsp scope="workspace_symbol"<cr>]])
+
+ -- LSP Pickers
+ keymap({'n', 'v'}, "<leader>a", "Perform code action", require("actions-preview").code_actions)
+ keymap("n", "<leader>D", "Open workspace diagnostic picker", ":Pick diagnostic<cr>")
+ keymap("n", "<leader>d", "Open diagnostic picker", [[:Pick diagnostic scope="current"<cr>]])
+
+ keymap('n', 'gr', "Buffer References", vim.lsp.buf.references)
+ keymap('n', '<localleader>f', "Format Buffer", function()
+ vim.lsp.buf.format { async = true }
+ end)
+ end,
+})
+
+local lspconfig = require('lspconfig')
+
+-- Configure individual lsps
+lspconfig.nil_ls.setup {}
+lspconfig.lua_ls.setup {
+ on_init = function(client)
+ local path = client.workspace_folders[1].name
+ if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then
+ return
+ end
+
+ client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
+ runtime = {
+ -- Tell the language server which version of Lua you're using
+ -- (most likely LuaJIT in the case of Neovim)
+ version = 'LuaJIT'
+ },
+ -- Make the server aware of Neovim runtime files
+ workspace = {
+ checkThirdParty = false,
+ library = {
+ vim.env.VIMRUNTIME,
+ -- Depending on the usage, you might want to add additional paths here.
+ "${3rd}/luv/library"
+ -- "${3rd}/busted/library",
+ }
+ -- or pull in all of 'runtimepath'. NOTE: this is a lot slower
+ -- library = vim.api.nvim_get_runtime_file("", true)
+ }
+ })
+ end,
+ settings = {
+ Lua = {}
+ }
+}
+lspconfig.marksman.setup {}
diff --git a/pkgs/custom-neovim/config/lua/plugins/lualine.lua b/pkgs/custom-neovim/config/lua/plugins/lualine.lua
new file mode 100644
index 0000000..9814cae
--- /dev/null
+++ b/pkgs/custom-neovim/config/lua/plugins/lualine.lua
@@ -0,0 +1 @@
+require("lualine").setup()
diff --git a/pkgs/custom-neovim/config/lua/plugins/presence.lua b/pkgs/custom-neovim/config/lua/plugins/presence.lua
new file mode 100644
index 0000000..7ffb57f
--- /dev/null
+++ b/pkgs/custom-neovim/config/lua/plugins/presence.lua
@@ -0,0 +1,3 @@
+require('presence').setup({
+ neovim_image_text = "Neovim Text Editor",
+})
diff --git a/pkgs/custom-neovim/config/lua/plugins/tabby.lua b/pkgs/custom-neovim/config/lua/plugins/tabby.lua
new file mode 100644
index 0000000..2ad03ed
--- /dev/null
+++ b/pkgs/custom-neovim/config/lua/plugins/tabby.lua
@@ -0,0 +1,2 @@
+vim.o.showtabline = 1
+require('tabby').setup()
diff --git a/pkgs/custom-neovim/config/lua/plugins/telescope.lua b/pkgs/custom-neovim/config/lua/plugins/telescope.lua
new file mode 100644
index 0000000..be3366b
--- /dev/null
+++ b/pkgs/custom-neovim/config/lua/plugins/telescope.lua
@@ -0,0 +1 @@
+require("telescope").setup()