summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-10-06 01:08:39 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-10-06 01:08:39 +0200
commit2dea91e91c1680cbd03a5e60239823f56b90513c (patch)
treecff916ff0eb400ccebf4b3fe9873c71d5d780dfb
parentdea978318e7a0244362706795ac777e7cd46c4da (diff)
checkpoint
-rw-r--r--after/ftplugin/sh.lua4
-rw-r--r--lua/config/lsp.lua95
-rw-r--r--lua/config/set.lua7
3 files changed, 55 insertions, 51 deletions
diff --git a/after/ftplugin/sh.lua b/after/ftplugin/sh.lua
index 2cb8493..5bd9b4b 100644
--- a/after/ftplugin/sh.lua
+++ b/after/ftplugin/sh.lua
@@ -1,3 +1,5 @@
local map = vim.keymap.set
-map("n", ",v", [[<cmd>s/\(\s*\)\(.\+\)/\1"$(\2)"/<cr>]])
+map("n", ",v", [[<cmd>s/\(\s*\)\(.\+\)/\1"$(\2)"/<cr>]], { desc = "Surround with variable" })
+map("n", ",p", [[<cmd>s/\(\s*\)\(.\+\)/\1printf '\2: %s\\n' "$\2"/<cr>]], { desc = "Surround var with printf" })
+map("n", ",e", [[<cmd>s/\(\s*\)\(.\+\)/\1[ "$\2" ] || exit 1'/<cr>]], { desc = "Surround var with exit if empty" })
diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua
index b913dac..0869f41 100644
--- a/lua/config/lsp.lua
+++ b/lua/config/lsp.lua
@@ -9,15 +9,15 @@ local lspconfig = require("lspconfig")
local lspkind = require("lspkind")
local builtin = require("telescope.builtin")
-map("n", " lca", lbuf.code_action, { desc = "Code actions" })
+map("n", " <cr>", lbuf.code_action, { desc = "Code actions" })
map("n", "gd", lbuf.definition, { desc = "Definition" })
-map("n", " lrn", lbuf.rename, { desc = "Rename" })
-map("n", " lim", builtin.lsp_implementations, { desc = "Implementation" })
-map("n", " lsh", lbuf.signature_help, { desc = "Signature help" })
-map("n", " lth", lbuf.typehierarchy, { desc = "Type hierarchy" })
-map("n", " llf", lbuf.references, { desc = "References" })
-map("n", " lds", lbuf.document_symbol, { desc = "List symbols" })
-map("n", " ltd", lbuf.type_definition, { desc = "Type definition" })
+map("n", " lr", lbuf.rename, { desc = "Rename" })
+map("n", " li", builtin.lsp_implementations, { desc = "Implementation" })
+map("n", " ls", lbuf.signature_help, { desc = "Signature help" })
+map("n", " lh", lbuf.typehierarchy, { desc = "Type hierarchy" })
+map("n", " lf", lbuf.references, { desc = "References" })
+map("n", " ll", lbuf.document_symbol, { desc = "List symbols" })
+map("n", " lt", lbuf.type_definition, { desc = "Type definition" })
-- map("n", " lls", vim.lsp.handlers["workspace/symbol"])
map("n", " lq", diagnostic.setqflist, { desc = "Diagnostic quickfix" })
map("n", " >>", diagnostic.goto_next, { desc = "Diagnostic next" })
@@ -31,22 +31,24 @@ end, { desc = "Diagnostic prev error" })
map("n", " vf", diagnostic.open_float, { desc = "Diagnostics open floating window" })
-- map("n", " ")
+-- vim.lsp.inlay_hint(0, false)
+
-- [[ LSP Setups ]]
lspconfig.gopls.setup({
- settings = {
- gopls = {
- hints = {
- assignVariableTypes = true,
- compositeLiteralFields = true,
- compositeLiteralTypes = true,
- constantValues = true,
- functionTypeParameters = true,
- parameterNames = true,
- rangeVariableTypes = true,
- },
- },
- },
+ -- settings = {
+ -- gopls = {
+ -- hints = {
+ -- assignVariableTypes = true,
+ -- compositeLiteralFields = true,
+ -- compositeLiteralTypes = true,
+ -- constantValues = true,
+ -- functionTypeParameters = true,
+ -- parameterNames = true,
+ -- rangeVariableTypes = true,
+ -- },
+ -- },
+ -- },
})
lspconfig.clangd.setup({})
lspconfig.emmet_ls.setup({})
@@ -60,6 +62,31 @@ lspconfig.powershell_es.setup({
"/home/aluc/.local/share/nvim/mason/packages/powershell-editor-services/PowerShellEditorServices/Start-EditorServices.ps1",
},
})
+lspconfig.lua_ls.setup({
+ -- with neovim support
+ 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 = {
+ version = "LuaJIT",
+ },
+ -- Make the server aware of Neovim runtime files
+ workspace = {
+ checkThirdParty = false,
+ library = {
+ vim.env.VIMRUNTIME,
+ },
+ },
+ })
+ end,
+ settings = {
+ Lua = {},
+ },
+})
-- [[ nvim cmp ]]
cmp.setup({
@@ -133,29 +160,3 @@ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.s
vim.diagnostic.config({
float = { border = _border },
})
--- lua
--- with neovim support
-require("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 = {
- version = "LuaJIT",
- },
- -- Make the server aware of Neovim runtime files
- workspace = {
- checkThirdParty = false,
- library = {
- vim.env.VIMRUNTIME,
- },
- },
- })
- end,
- settings = {
- Lua = {},
- },
-})
diff --git a/lua/config/set.lua b/lua/config/set.lua
index 516e2c0..05e3803 100644
--- a/lua/config/set.lua
+++ b/lua/config/set.lua
@@ -90,7 +90,7 @@ opt.formatoptions = "tocqrnj"
-- Get the current working directory, replace the $HOME portion of the path with ~,
-- and extract the last three directories
-local cwd = vim.fn.getcwd():gsub(os.getenv("HOME"), "~")
+local cwd = vim.fn.getcwd():gsub(home, "~")
local last_dirs = string.match(cwd, "[^/]+/[^/]+/[^/]+/?$")
if last_dirs then
opt.titlestring = last_dirs .. " -> %t"
@@ -105,9 +105,10 @@ vim.cmd("match Todo /\\(TODO\\|FIXME\\):/")
-- -- Custom highlight for markdown definitions
if vim.filetype.match({ buf = 0 }) == "markdown" then
- vim.cmd("match mdDefs /^[[:space:]]*-[^:]\\+:/")
vim.cmd("hi mdDefs guifg=" .. require("nord.colors").palette.frost.ice)
+ vim.cmd("match mdDefs /^[[:space:]]*-[^:]\\+:/")
end
-vim.cmd("match matchURL /" .. "\\(https\\?\\|ftp\\|magnet\\):\\/\\/[[:alnum:]%\\/_#.-~:]*" .. "/")
+-- TODO: this is some text
+vim.cmd("syntax match matchURL /" .. "\\(https\\?\\|ftp\\|magnet\\):\\/\\/[[:alnum:]%\\/_#.-~:]*" .. "/")
vim.cmd("hi matchURL guifg=" .. require("nord.colors").palette.aurora.yellow)