mirror of
https://github.com/TheM1Stery/dotfiles.git
synced 2025-04-20 09:01:11 +00:00
Compare commits
5 Commits
63965068e6
...
cf1e4aae1c
Author | SHA1 | Date | |
---|---|---|---|
cf1e4aae1c | |||
3f162cefdc | |||
f725f8cb87 | |||
813897a1cc | |||
78a1c3bcfb |
@ -2,12 +2,8 @@
|
|||||||
"Ionide-vim": { "branch": "master", "commit": "c7e8973426431839e9d888a4aa8d6a41251ba16f" },
|
"Ionide-vim": { "branch": "master", "commit": "c7e8973426431839e9d888a4aa8d6a41251ba16f" },
|
||||||
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
|
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
|
||||||
"barbecue": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" },
|
"barbecue": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" },
|
||||||
|
"blink.cmp": { "branch": "main", "commit": "18b352d12b35bca148427b607098df14b75a218f" },
|
||||||
"cloak.nvim": { "branch": "main", "commit": "648aca6d33ec011dc3166e7af3b38820d01a71e4" },
|
"cloak.nvim": { "branch": "main", "commit": "648aca6d33ec011dc3166e7af3b38820d01a71e4" },
|
||||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
|
|
||||||
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
|
||||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
|
||||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
|
||||||
"codesnap.nvim": { "branch": "main", "commit": "6400480aa6cc366cbd931146c429aaa64680dab9" },
|
"codesnap.nvim": { "branch": "main", "commit": "6400480aa6cc366cbd931146c429aaa64680dab9" },
|
||||||
"conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" },
|
"conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" },
|
||||||
"copilot.vim": { "branch": "release", "commit": "782461159655b259cff10ecff05efa761e3d4764" },
|
"copilot.vim": { "branch": "release", "commit": "782461159655b259cff10ecff05efa761e3d4764" },
|
||||||
@ -35,7 +31,6 @@
|
|||||||
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
|
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
|
||||||
"nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
|
"nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
|
||||||
"nvim-autopairs": { "branch": "master", "commit": "68f0e5c3dab23261a945272032ee6700af86227a" },
|
"nvim-autopairs": { "branch": "master", "commit": "68f0e5c3dab23261a945272032ee6700af86227a" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" },
|
|
||||||
"nvim-dap": { "branch": "master", "commit": "52302f02fea3a490e55475de52fa4deb8af2eb11" },
|
"nvim-dap": { "branch": "master", "commit": "52302f02fea3a490e55475de52fa4deb8af2eb11" },
|
||||||
"nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" },
|
"nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" },
|
||||||
"nvim-lightbulb": { "branch": "master", "commit": "f7f61c47af5bf701b1f4af127bc565ab6491acbf" },
|
"nvim-lightbulb": { "branch": "master", "commit": "f7f61c47af5bf701b1f4af127bc565ab6491acbf" },
|
||||||
@ -56,6 +51,7 @@
|
|||||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||||
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
|
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
|
||||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "011d98eaa3a73b5a51d82ce5bc6b1397dde95562" },
|
"rainbow-delimiters.nvim": { "branch": "master", "commit": "011d98eaa3a73b5a51d82ce5bc6b1397dde95562" },
|
||||||
|
"roslyn.nvim": { "branch": "main", "commit": "633a61c30801a854cf52f4492ec8702a8c4ec0e9" },
|
||||||
"rustaceanvim": { "branch": "master", "commit": "f03035fa03ccb36cd26d0792c946fbacba1d1a39" },
|
"rustaceanvim": { "branch": "master", "commit": "f03035fa03ccb36cd26d0792c946fbacba1d1a39" },
|
||||||
"snacks.nvim": { "branch": "main", "commit": "4e13b24e999e844ad4e6cd9dd1bc7021262ee4d6" },
|
"snacks.nvim": { "branch": "main", "commit": "4e13b24e999e844ad4e6cd9dd1bc7021262ee4d6" },
|
||||||
"tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "3d3cd95e4a4135c250faf83dd5ed61b8e5502b86" },
|
"tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "3d3cd95e4a4135c250faf83dd5ed61b8e5502b86" },
|
||||||
|
50
nvim/lua/themystery/plugins/completion.lua
Normal file
50
nvim/lua/themystery/plugins/completion.lua
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
return {
|
||||||
|
'saghen/blink.cmp',
|
||||||
|
dependencies = { 'rafamadriz/friendly-snippets' },
|
||||||
|
|
||||||
|
version = '*',
|
||||||
|
|
||||||
|
---@module 'blink.cmp'
|
||||||
|
---@type blink.cmp.Config
|
||||||
|
opts = {
|
||||||
|
-- 'default' for mappings similar to built-in completion
|
||||||
|
-- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate)
|
||||||
|
-- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept
|
||||||
|
-- See the full "keymap" documentation for information on defining your own keymap.
|
||||||
|
keymap = { preset = 'super-tab' },
|
||||||
|
completion = {
|
||||||
|
menu = { border = 'single' },
|
||||||
|
documentation = { window = { border = 'single' } },
|
||||||
|
},
|
||||||
|
signature = { window = { border = 'single' } },
|
||||||
|
appearance = {
|
||||||
|
-- Sets the fallback highlight groups to nvim-cmp's highlight groups
|
||||||
|
-- Useful for when your theme doesn't support blink.cmp
|
||||||
|
-- Will be removed in a future release
|
||||||
|
use_nvim_cmp_as_default = true,
|
||||||
|
-- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||||
|
-- Adjusts spacing to ensure icons are aligned
|
||||||
|
nerd_font_variant = 'mono',
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Default list of enabled providers defined so that you can extend it
|
||||||
|
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||||
|
sources = {
|
||||||
|
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||||
|
per_filetype = {
|
||||||
|
sql = { 'snippets', 'dadbod', 'buffer' },
|
||||||
|
},
|
||||||
|
-- add vim-dadbod-completion to your completion providers
|
||||||
|
providers = {
|
||||||
|
dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" },
|
||||||
|
lazydev = {
|
||||||
|
name = "LazyDev",
|
||||||
|
module = "lazydev.integrations.blink",
|
||||||
|
-- make lazydev completions top priority (see `:h blink.cmp`)
|
||||||
|
score_offset = 100,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts_extend = { "sources.default" }
|
||||||
|
}
|
@ -33,18 +33,22 @@ return {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- dap.configurations.rust = {
|
dap.adapters.coreclr = {
|
||||||
-- {
|
type = "executable",
|
||||||
-- name = "Rust Debug",
|
command = vim.fn.stdpath("data") .. "/mason/bin/netcoredbg",
|
||||||
-- type = "codelldb",
|
args = { '--interpreter=vscode' }
|
||||||
-- request = "launch",
|
}
|
||||||
-- program = function()
|
|
||||||
-- return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/target/debug", "file")
|
|
||||||
-- end,
|
dap.configurations.cs = {
|
||||||
-- cwd = "${workspaceFolder}",
|
{
|
||||||
-- stopOnEntry = true,
|
name = "launch - netcoredbg",
|
||||||
-- showDisassembly = "never"
|
type = "coreclr",
|
||||||
-- }
|
request = "launch",
|
||||||
-- }
|
program = function()
|
||||||
|
return vim.fn.input('Path to dll', vim.fn.getcwd() .. '/bin/Debug/', 'file')
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -45,11 +45,6 @@ return {
|
|||||||
},
|
},
|
||||||
"SmiteshP/nvim-navic",
|
"SmiteshP/nvim-navic",
|
||||||
"Decodetalkers/csharpls-extended-lsp.nvim",
|
"Decodetalkers/csharpls-extended-lsp.nvim",
|
||||||
-- {
|
|
||||||
-- "lukas-reineke/headlines.nvim",
|
|
||||||
-- dependencies = "nvim-treesitter/nvim-treesitter",
|
|
||||||
-- config = true, -- or `opts = {}`
|
|
||||||
-- },
|
|
||||||
{
|
{
|
||||||
'MeanderingProgrammer/markdown.nvim',
|
'MeanderingProgrammer/markdown.nvim',
|
||||||
main = "render-markdown",
|
main = "render-markdown",
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
return {
|
|
||||||
{
|
|
||||||
"folke/lazydev.nvim",
|
|
||||||
ft = "lua", -- only load on lua files
|
|
||||||
opts = {
|
|
||||||
library = {
|
|
||||||
-- See the configuration section for more details
|
|
||||||
-- Load luvit types when the `vim.uv` word is found
|
|
||||||
{ path = "luvit-meta/library", words = { "vim%.uv" } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ "Bilal2453/luvit-meta", lazy = true }, -- optional `vim.uv` typings
|
|
||||||
}
|
|
@ -26,6 +26,18 @@ return {
|
|||||||
vim.keymap.set("n", "<leader>cf", crates.show_features_popup, opts)
|
vim.keymap.set("n", "<leader>cf", crates.show_features_popup, opts)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"folke/lazydev.nvim",
|
||||||
|
ft = "lua", -- only load on lua files
|
||||||
|
opts = {
|
||||||
|
library = {
|
||||||
|
-- See the configuration section for more details
|
||||||
|
-- Load luvit types when the `vim.uv` word is found
|
||||||
|
{ path = "luvit-meta/library", words = { "vim%.uv" } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ "Bilal2453/luvit-meta", lazy = true }, -- optional `vim.uv` typings
|
||||||
{
|
{
|
||||||
"ray-x/go.nvim",
|
"ray-x/go.nvim",
|
||||||
dependencies = { -- optional packages
|
dependencies = { -- optional packages
|
||||||
@ -35,25 +47,20 @@ return {
|
|||||||
build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries
|
build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'VonHeikemen/lsp-zero.nvim',
|
"seblyng/roslyn.nvim",
|
||||||
branch = 'v3.x',
|
ft = "cs",
|
||||||
dependencies = {
|
opts = {
|
||||||
-- LSP Support
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
|
dependencies = {
|
||||||
|
-- Mason
|
||||||
'williamboman/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'williamboman/mason-lspconfig.nvim',
|
||||||
|
|
||||||
-- Autocompletion
|
-- Autocompletion
|
||||||
'hrsh7th/nvim-cmp',
|
'saghen/blink.cmp',
|
||||||
'hrsh7th/cmp-buffer',
|
|
||||||
'hrsh7th/cmp-path',
|
|
||||||
'saadparwaiz1/cmp_luasnip',
|
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
|
||||||
'hrsh7th/cmp-nvim-lua',
|
|
||||||
|
|
||||||
-- Snippets
|
|
||||||
'L3MON4D3/LuaSnip',
|
|
||||||
'rafamadriz/friendly-snippets',
|
|
||||||
|
|
||||||
-- extras
|
-- extras
|
||||||
"SmiteshP/nvim-navic",
|
"SmiteshP/nvim-navic",
|
||||||
@ -63,6 +70,7 @@ return {
|
|||||||
-- specific language servers
|
-- specific language servers
|
||||||
'mrcjkb/rustaceanvim',
|
'mrcjkb/rustaceanvim',
|
||||||
'ray-x/go.nvim',
|
'ray-x/go.nvim',
|
||||||
|
'seblyng/roslyn.nvim'
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- unknown filetypes(needed for some lsp servers)
|
-- unknown filetypes(needed for some lsp servers)
|
||||||
@ -75,24 +83,78 @@ return {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
local lsp = require("lsp-zero")
|
|
||||||
|
|
||||||
lsp.configure('yamlls', {
|
vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
|
||||||
|
|
||||||
|
local lspconfig_defaults = require('lspconfig').util.default_config
|
||||||
|
lspconfig_defaults.capabilities = vim.tbl_deep_extend(
|
||||||
|
'force',
|
||||||
|
lspconfig_defaults.capabilities,
|
||||||
|
require('blink.cmp').get_lsp_capabilities()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local navic = require("nvim-navic")
|
||||||
|
|
||||||
|
local navbuddy = require("nvim-navbuddy")
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
callback = function(event)
|
||||||
|
local opts = { buffer = event.buf, remap = false }
|
||||||
|
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||||
|
vim.lsp.inlay_hint.enable(true)
|
||||||
|
if client and client.server_capabilities.documentSymbolProvider then
|
||||||
|
navic.attach(client, event.buf)
|
||||||
|
navbuddy.attach(client, event.buf)
|
||||||
|
end
|
||||||
|
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||||
|
vim.keymap.set("n", "gD", function() vim.lsp.buf.declaration() end, opts)
|
||||||
|
vim.keymap.set("n", "<leader>dc", function() vim.lsp.buf.hover() end, opts)
|
||||||
|
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
|
||||||
|
vim.keymap.set("n", "<leader>ed", function() vim.diagnostic.open_float() end, opts)
|
||||||
|
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
|
||||||
|
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
|
||||||
|
-- for the code action key map to work you need to change key binding('.' symbol) of your terminal, otherwise it won't work
|
||||||
|
vim.keymap.set("n", "<C-.>", function() vim.lsp.buf.code_action() end, opts)
|
||||||
|
vim.keymap.set("n", "<leader>gr", function() vim.lsp.buf.references() end, opts)
|
||||||
|
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
|
||||||
|
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
|
||||||
|
-- sometimes lsp fails, we can restart it with this keymap
|
||||||
|
vim.keymap.set('n', "<leader>lr", vim.cmd.LspRestart, opts)
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>nv", function() navbuddy.open() end, opts)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
require("go").setup({
|
||||||
|
lsp_cfg = false
|
||||||
|
})
|
||||||
|
|
||||||
|
local noop = function() end
|
||||||
|
|
||||||
|
local gopls_opts = require("go.lsp").config()
|
||||||
|
local handlers = {
|
||||||
|
function(server_name)
|
||||||
|
require("lspconfig")[server_name].setup {}
|
||||||
|
end,
|
||||||
|
rust_analyzer = noop,
|
||||||
|
fsautocomplete = noop,
|
||||||
|
gopls = function()
|
||||||
|
require('lspconfig').gopls.setup(gopls_opts)
|
||||||
|
end,
|
||||||
|
yamlls = function()
|
||||||
|
require('lspconfig').yamlls.setup {
|
||||||
filetypes = { 'yaml', 'yaml.openapi' }
|
filetypes = { 'yaml', 'yaml.openapi' }
|
||||||
})
|
|
||||||
|
|
||||||
lsp.configure('csharp_ls', {
|
|
||||||
handlers = {
|
|
||||||
["textDocument/definition"] = require("csharpls_extended").handler,
|
|
||||||
["textDocument/typeDefinition"] = require("csharpls_extended").handler
|
|
||||||
}
|
}
|
||||||
})
|
end,
|
||||||
|
clangd = function()
|
||||||
lsp.configure('clangd', {
|
require("lspconfig").clangd.setup {
|
||||||
cmd = { 'clangd', '--offset-encoding=utf-16' },
|
cmd = { 'clangd', '--offset-encoding=utf-16' },
|
||||||
})
|
}
|
||||||
-- this code makes it so that the css language server doesn't complain about tailwindcss classes
|
end,
|
||||||
lsp.configure("cssls", {
|
cssls = function()
|
||||||
|
require("lspconfig").cssls.setup {
|
||||||
settings = {
|
settings = {
|
||||||
css = {
|
css = {
|
||||||
lint = { unknownAtRules = "ignore" }
|
lint = { unknownAtRules = "ignore" }
|
||||||
@ -104,11 +166,10 @@ return {
|
|||||||
lint = { unknownAtRules = "ignore" }
|
lint = { unknownAtRules = "ignore" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
end,
|
||||||
lsp.configure("tailwindcss", {
|
tailwindcss = function()
|
||||||
settings = {
|
require("lspconfig").tailwindcss.setup {
|
||||||
},
|
|
||||||
filetypes = {
|
filetypes = {
|
||||||
"astro",
|
"astro",
|
||||||
"handlebars",
|
"handlebars",
|
||||||
@ -122,154 +183,35 @@ return {
|
|||||||
"templ"
|
"templ"
|
||||||
},
|
},
|
||||||
init_options = { userLanguages = { rust = "html", templ = "html" } },
|
init_options = { userLanguages = { rust = "html", templ = "html" } },
|
||||||
})
|
|
||||||
--
|
|
||||||
-- lsp.configure("rust_analyzer", {
|
|
||||||
-- settings = {
|
|
||||||
-- ["rust-analyzer"] = {
|
|
||||||
-- checkOnSave = true,
|
|
||||||
-- check = {
|
|
||||||
-- command = "clippy"
|
|
||||||
-- }
|
|
||||||
-- }
|
|
||||||
-- }
|
|
||||||
-- })
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local cmp = require('cmp')
|
|
||||||
local cmp_action = lsp.cmp_action()
|
|
||||||
|
|
||||||
require('luasnip.loaders.from_vscode').lazy_load()
|
|
||||||
|
|
||||||
local tailwindcss_colors = require('tailwindcss-colorizer-cmp')
|
|
||||||
|
|
||||||
local cmp_formatter = function(entry, vim_item)
|
|
||||||
-- vim_item as processed by tailwindcss-colorizer-cmp
|
|
||||||
vim_item = tailwindcss_colors.formatter(entry, vim_item)
|
|
||||||
|
|
||||||
-- change menu (name of source)
|
|
||||||
vim_item.menu = ({
|
|
||||||
nvim_lsp = "[LSP]",
|
|
||||||
buffer = "[Buffer]",
|
|
||||||
path = "[Path]",
|
|
||||||
emoji = "[Emoji]",
|
|
||||||
luasnip = "[LuaSnip]",
|
|
||||||
vsnip = "[VSCode Snippet]",
|
|
||||||
calc = "[Calc]",
|
|
||||||
spell = "[Spell]",
|
|
||||||
})[entry.source.name]
|
|
||||||
return vim_item
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
formatting = {
|
|
||||||
fields = { "abbr", "menu", "kind" },
|
|
||||||
format = cmp_formatter,
|
|
||||||
},
|
|
||||||
preselect = 'item',
|
|
||||||
completion = {
|
|
||||||
completeopt = 'menu,menuone,noinsert'
|
|
||||||
},
|
|
||||||
window = {
|
|
||||||
completion = cmp.config.window.bordered(),
|
|
||||||
documentation = cmp.config.window.bordered(),
|
|
||||||
},
|
|
||||||
sources = {
|
|
||||||
{ name = 'path' },
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
{ name = 'nvim_lua' },
|
|
||||||
{ name = 'buffer', keyword_length = 3 },
|
|
||||||
{ name = 'luasnip', keyword_length = 2 },
|
|
||||||
{ name = 'lazydev', group_index = 0 }
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
-- confirm completion item
|
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Insert }),
|
|
||||||
['<Tab>'] = cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Replace }),
|
|
||||||
|
|
||||||
-- toggle completion menu
|
|
||||||
['<C-e>'] = cmp_action.toggle_completion(),
|
|
||||||
|
|
||||||
-- tab complete
|
|
||||||
-- ['<Tab>'] = cmp_action.tab_complete(),
|
|
||||||
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
|
||||||
|
|
||||||
-- navigate between snippet placeholder
|
|
||||||
['<C-d>'] = cmp_action.luasnip_jump_forward(),
|
|
||||||
['<C-b>'] = cmp_action.luasnip_jump_backward(),
|
|
||||||
|
|
||||||
-- scroll documentation window
|
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(5),
|
|
||||||
['<C-u>'] = cmp.mapping.scroll_docs(-5),
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
local navic = require("nvim-navic")
|
|
||||||
|
|
||||||
local navbuddy = require("nvim-navbuddy")
|
|
||||||
|
|
||||||
lsp.on_attach(function(client, bufnr)
|
|
||||||
local opts = { buffer = bufnr, remap = false }
|
|
||||||
lsp.default_keymaps({ buffer = bufnr })
|
|
||||||
vim.lsp.inlay_hint.enable(true)
|
|
||||||
if client.server_capabilities.documentSymbolProvider then
|
|
||||||
navic.attach(client, bufnr)
|
|
||||||
navbuddy.attach(client, bufnr)
|
|
||||||
end
|
|
||||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>dc", function() vim.lsp.buf.hover() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>ed", function() vim.diagnostic.open_float() end, opts)
|
|
||||||
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
|
|
||||||
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
|
|
||||||
-- for the code action key map to work you need to change key binding('.' symbol) of your terminal, otherwise it won't work
|
|
||||||
vim.keymap.set("n", "<C-.>", function() vim.lsp.buf.code_action() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>drr", function() vim.lsp.buf.references() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
|
|
||||||
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
|
|
||||||
-- sometimes lsp fails, we can restart it with this keymap
|
|
||||||
vim.keymap.set('n', "<leader>lr", vim.cmd.LspRestart, opts)
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>nv", function() navbuddy.open() end, opts)
|
|
||||||
end)
|
|
||||||
|
|
||||||
require("mason").setup({});
|
|
||||||
require("go").setup({
|
|
||||||
lsp_cfg = false
|
|
||||||
})
|
|
||||||
|
|
||||||
local gopls_opts = require("go.lsp").config()
|
|
||||||
require("mason-lspconfig").setup({
|
|
||||||
ensure_installed = { 'ts_ls', 'svelte', 'lua_ls', 'csharp_ls', 'rust_analyzer', 'gopls' },
|
|
||||||
handlers = {
|
|
||||||
lsp.default_setup,
|
|
||||||
lua_ls = function()
|
|
||||||
local lua_opts = lsp.nvim_lua_ls()
|
|
||||||
require('lspconfig').lua_ls.setup(lua_opts)
|
|
||||||
end,
|
|
||||||
rust_analyzer = lsp.noop,
|
|
||||||
fsautocomplete = lsp.noop,
|
|
||||||
gopls = function()
|
|
||||||
require('lspconfig').gopls.setup(gopls_opts)
|
|
||||||
end,
|
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
require("mason").setup({
|
||||||
|
registries = {
|
||||||
|
'github:mason-org/mason-registry',
|
||||||
|
'github:Crashdummyy/mason-registry'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
require("mason-lspconfig").setup({
|
||||||
|
ensure_installed = { 'ts_ls', 'svelte', 'lua_ls', 'rust_analyzer', 'gopls' },
|
||||||
|
handlers = handlers,
|
||||||
|
automatic_installation = false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
lsp.set_sign_icons({
|
|
||||||
error = '✘',
|
|
||||||
warn = '▲',
|
|
||||||
hint = '⚑',
|
|
||||||
info = ''
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
virtual_text = false,
|
virtual_text = false,
|
||||||
severity_sort = true,
|
severity_sort = true,
|
||||||
|
signs = {
|
||||||
|
text = {
|
||||||
|
[vim.diagnostic.severity.ERROR] = '✘',
|
||||||
|
[vim.diagnostic.severity.WARN] = '▲',
|
||||||
|
[vim.diagnostic.severity.HINT] = '⚑',
|
||||||
|
[vim.diagnostic.severity.INFO] = ''
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
float = {
|
float = {
|
||||||
style = 'minimal',
|
style = 'minimal',
|
||||||
border = 'rounded',
|
border = 'rounded',
|
||||||
|
@ -5,40 +5,6 @@ return {
|
|||||||
ft = sql_ft,
|
ft = sql_ft,
|
||||||
dependencies = { 'tpope/vim-dadbod', lazy = true },
|
dependencies = { 'tpope/vim-dadbod', lazy = true },
|
||||||
lazy = true,
|
lazy = true,
|
||||||
init = function()
|
|
||||||
-- vim.api.nvim_create_autocmd("FileType", {
|
|
||||||
-- pattern = {
|
|
||||||
-- "sql",
|
|
||||||
-- },
|
|
||||||
-- command = [[setlocal omnifunc=vim_dadbod_completion#omni]],
|
|
||||||
-- })
|
|
||||||
|
|
||||||
-- taken from here https://github.com/kristijanhusak/vim-dadbod-completion/issues/53#issuecomment-1902659351
|
|
||||||
local autocomplete_group = vim.api.nvim_create_augroup("vimrc_autocompletion", { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
|
||||||
pattern = sql_ft,
|
|
||||||
callback = function()
|
|
||||||
local cmp = require("cmp")
|
|
||||||
local global_sources = cmp.get_config().sources
|
|
||||||
local buffer_sources = {}
|
|
||||||
|
|
||||||
-- add globally defined sources (see separate nvim-cmp config)
|
|
||||||
-- this makes e.g. luasnip snippets available since luasnip is configured globally
|
|
||||||
if global_sources then
|
|
||||||
for _, source in ipairs(global_sources) do
|
|
||||||
table.insert(buffer_sources, { name = source.name })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- add vim-dadbod-completion source
|
|
||||||
table.insert(buffer_sources, { name = "vim-dadbod-completion" })
|
|
||||||
|
|
||||||
-- update sources for the current buffer
|
|
||||||
cmp.setup.buffer({ sources = buffer_sources })
|
|
||||||
end,
|
|
||||||
group = autocomplete_group,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'kristijanhusak/vim-dadbod-ui',
|
'kristijanhusak/vim-dadbod-ui',
|
||||||
|
@ -17,17 +17,24 @@ return {
|
|||||||
vim.keymap.set('n', 'zr', require('ufo').openFoldsExceptKinds)
|
vim.keymap.set('n', 'zr', require('ufo').openFoldsExceptKinds)
|
||||||
vim.keymap.set('n', 'zm', require('ufo').closeFoldsWith) -- closeAllFolds == closeFoldsWith(0)
|
vim.keymap.set('n', 'zm', require('ufo').closeFoldsWith) -- closeAllFolds == closeFoldsWith(0)
|
||||||
|
|
||||||
local lsp = require('lsp-zero')
|
local lsp_capabilities = vim.tbl_deep_extend(
|
||||||
|
'force',
|
||||||
lsp.set_server_config({
|
require('blink.cmp').get_lsp_capabilities(),
|
||||||
capabilities = {
|
{
|
||||||
textDocument = {
|
textDocument = {
|
||||||
foldingRange = {
|
foldingRange = {
|
||||||
dynamicRegistration = false,
|
dynamicRegistration = false,
|
||||||
lineFoldingOnly = true
|
lineFoldingOnly = true
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
}
|
|
||||||
})
|
local lspconfig_defaults = require('lspconfig').util.default_config
|
||||||
|
lspconfig_defaults.capabilities = vim.tbl_deep_extend(
|
||||||
|
'force',
|
||||||
|
lspconfig_defaults.capabilities,
|
||||||
|
lsp_capabilities
|
||||||
|
)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ fi
|
|||||||
|
|
||||||
# Created by newuser for 5.9
|
# Created by newuser for 5.9
|
||||||
|
|
||||||
|
|
||||||
# zsh settigns
|
# zsh settigns
|
||||||
|
|
||||||
# my alliases are in ~/.profile so this just sources it
|
# my alliases are in ~/.profile so this just sources it
|
||||||
@ -26,8 +25,6 @@ source <(copilot completion zsh)
|
|||||||
export HISTSIZE=10000
|
export HISTSIZE=10000
|
||||||
export SAVEHIST=10000
|
export SAVEHIST=10000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_dotnet_zsh_complete()
|
_dotnet_zsh_complete()
|
||||||
{
|
{
|
||||||
local completions=("$(dotnet complete "$words")")
|
local completions=("$(dotnet complete "$words")")
|
||||||
@ -43,7 +40,6 @@ _dotnet_zsh_complete()
|
|||||||
_values = "${(ps:\n:)completions}"
|
_values = "${(ps:\n:)completions}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# useful plugins
|
# useful plugins
|
||||||
source ~/.zsh/zsh-autocomplete/zsh-autocomplete.plugin.zsh
|
source ~/.zsh/zsh-autocomplete/zsh-autocomplete.plugin.zsh
|
||||||
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
|
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||||
@ -86,6 +82,3 @@ export BUN_INSTALL="$HOME/.bun"
|
|||||||
export PATH="$BUN_INSTALL/bin:$PATH"
|
export PATH="$BUN_INSTALL/bin:$PATH"
|
||||||
export FP='fzf --preview="bat --style=numbers --color=always --line-range :500 {}"'
|
export FP='fzf --preview="bat --style=numbers --color=always --line-range :500 {}"'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user