neovim

Personal neovim configuration files
git clone git://gtms.dev/neovim
Log | Files | Refs

commit be41918e799f3dcc32637f82b254dae08d596ebc
parent 9aefe5d4e4a49404d3a0de35af1ddce2cbbbb74a
Author: Tomas Nemec <owl@gtms.dev>
Date:   Tue, 24 Oct 2023 08:55:02 +0200

update

Diffstat:
Mafter/plugin/dap.lua | 7+++++++
Aftplugin/gdscript.lua | 1+
Mftplugin/go.lua | 5++++-
Mlua/tms/lsp/servers.lua | 15+++++++++++++--
Aplugin/snippet.lua | 10++++++++++
5 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/after/plugin/dap.lua b/after/plugin/dap.lua @@ -228,3 +228,10 @@ local has_dapgo, dapgo = pcall(require, 'dap-go') if has_dapgo then dapgo.setup() end + +-- dap godot +dap.adapters.godot = { type = 'server', host = '127.0.0.1', port = 6006 } + +dap.configurations.gdscript = { + { type = 'godot', request = 'launch', name = 'Launch scene', project = '${workspaceFolder}', launch_scene = true }, +} diff --git a/ftplugin/gdscript.lua b/ftplugin/gdscript.lua @@ -0,0 +1 @@ +vim.lsp.start(require'tms.lsp'.make_opts('gdscript')) diff --git a/ftplugin/go.lua b/ftplugin/go.lua @@ -1,7 +1,10 @@ vim.bo.makeprg = [[go run %]] + +vim.lsp.start(require'tms.lsp'.make_opts('gopls')) + -- vim.cmd [[command! -buffer -nargs=? Godoc lua require('tms.ft.go.doc').godoc(vim.fn.expand('<args>'), vim.fn.expand('<cword>'))]] vim.api.nvim_create_autocmd('BufWritePre', - { callback = require('tms.ft.go').org_imports, buffer = 0, desc = 'GO Organize Imports' }) + { callback = require('tms.ft.go').org_imports, buffer = 0, desc = 'Go Organize Imports' }) vim.keymap.set('n', '<leader>ao', require('tms.ft.go').org_imports, { buffer = true, desc = 'Go Organize Imports' }) vim.keymap.set('n', '<leader>ar', vim.cmd.make, { buffer = true }) vim.keymap.set('n', '<leader>at', function() diff --git a/lua/tms/lsp/servers.lua b/lua/tms/lsp/servers.lua @@ -1,6 +1,13 @@ -- Custom configuration for servers local M = {} +function M.gdscript(opts) + opts.cmd = vim.lsp.rpc.connect('127.0.0.1', 6005) + opts.filetypes = { 'gd', 'gdscript', 'gdscript3' } + opts.root_dir = vim.fs.dirname(vim.fs.find({ 'project.godot', '.git' }, { upward = true })[1]) + return opts +end + function M.jsonls(opts) if pcall(require, 'schemastore') then opts.settings = { @@ -53,12 +60,16 @@ function M.lua_ls(opts) end function M.emmet_ls(opts) - opts.root_dir = require('lspconfig').util.root_pattern('.git', vim.fn.getcwd()) + opts.root_dir = function(path) + vim.fs.dirname(vim.fs.find({ '.git', vim.fn.getcwd() }, { path = path, upward = true })[1]) + end return opts end function M.gopls(opts) - opts.root_dir = require('lspconfig').util.root_pattern('go.work', 'go.mod', '.git', vim.fn.getcwd()) + opts.cmd = { 'gopls' } + opts.filetypes = { 'go', 'gomod', 'gowork', 'gotmpl' } + opts.root_dir = vim.fs.dirname(vim.fs.find({ 'go.work', 'go.mod', '.git', vim.fn.getcwd() }, { upward = true })[1]) return opts end diff --git a/plugin/snippet.lua b/plugin/snippet.lua @@ -0,0 +1,10 @@ +vim.keymap.set({ 'i', 's' }, '<c-l>', function() + if vim.snippet.jumpable(1) then + vim.snippet.jump(1) + end +end, { desc = 'Snippet Jump Forward' }) +vim.keymap.set({ 'i', 's' }, '<c-h>', function() + if vim.snippet.jumpable(-1) then + vim.snippet.jump(-1) + end +end, { desc = 'Snippet Jump Forward' })