update to nvim 0.10, add lspsaga etc
This commit is contained in:
parent
e3a99eb8f2
commit
7123c851a2
8 changed files with 100 additions and 136 deletions
67
init.lua
67
init.lua
|
@ -1,3 +1,4 @@
|
||||||
|
-- Begin NvChad setup
|
||||||
vim.g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
|
vim.g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
|
@ -38,6 +39,8 @@ vim.schedule(function()
|
||||||
local mappings = require "mappings"
|
local mappings = require "mappings"
|
||||||
mappings.General()
|
mappings.General()
|
||||||
end)
|
end)
|
||||||
|
-- end NvChad setup
|
||||||
|
|
||||||
local autocmd = vim.api.nvim_create_autocmd
|
local autocmd = vim.api.nvim_create_autocmd
|
||||||
|
|
||||||
-- Auto resize panes when resizing nvim window
|
-- Auto resize panes when resizing nvim window
|
||||||
|
@ -45,64 +48,28 @@ autocmd("VimResized", {
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
command = "tabdo wincmd =",
|
command = "tabdo wincmd =",
|
||||||
})
|
})
|
||||||
-- if windows or WSL
|
|
||||||
if vim.loop.os_uname() == "win32" then
|
|
||||||
vim.g.clipboard = {
|
|
||||||
name = "WslClipboard",
|
|
||||||
copy = {
|
|
||||||
["+"] = "clip.exe",
|
|
||||||
["*"] = "clip.exe",
|
|
||||||
},
|
|
||||||
paste = {
|
|
||||||
["+"] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
|
|
||||||
["*"] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
|
|
||||||
},
|
|
||||||
cache_enabled = 0,
|
|
||||||
}
|
|
||||||
-- if nvim supports osc52
|
|
||||||
elseif pcall(require, "vim.ui.clipboard.osc52") then
|
|
||||||
vim.g.clipboard = {
|
|
||||||
name = "OSC 52",
|
|
||||||
copy = {
|
|
||||||
["+"] = require("vim.ui.clipboard.osc52").copy,
|
|
||||||
["*"] = require("vim.ui.clipboard.osc52").copy,
|
|
||||||
},
|
|
||||||
paste = {
|
|
||||||
["+"] = require("vim.ui.clipboard.osc52").paste,
|
|
||||||
["*"] = require("vim.ui.clipboard.osc52").paste,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
-- use osc52 plugin
|
|
||||||
elseif pcall(require, "osc52") then
|
|
||||||
local function copy(lines, _)
|
|
||||||
require("osc52").copy(table.concat(lines, "\n"))
|
|
||||||
end
|
|
||||||
|
|
||||||
local function paste()
|
|
||||||
return { vim.fn.split(vim.fn.getreg "", "\n"), vim.fn.getregtype "" }
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.g.clipboard = {
|
|
||||||
name = "osc52",
|
|
||||||
copy = { ["+"] = copy, ["*"] = copy },
|
|
||||||
paste = { ["+"] = paste, ["*"] = paste },
|
|
||||||
}
|
|
||||||
end
|
|
||||||
vim.opt.relativenumber = true
|
|
||||||
vim.opt.cursorline = true
|
|
||||||
|
|
||||||
|
-- Set default shell to pwsh on windows
|
||||||
if vim.loop.os_uname() == "win32" then
|
if vim.loop.os_uname() == "win32" then
|
||||||
vim.opt.shell = vim.fn.executable "pwsh" == 1 and "pwsh" or "powershell"
|
vim.opt.shell = vim.fn.executable "pwsh" == 1 and "pwsh" or "powershell"
|
||||||
vim.opt.shellcmdflag =
|
vim.opt.shellcmdflag =
|
||||||
"-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;"
|
"-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;"
|
||||||
vim.opt.shellredir = "-RedirectStandardOutput %s -NoNewWindow -Wait"
|
vim.opt.shellredir = "-RedirectStandardOutput %s -NoNewWindow -Wait"
|
||||||
vim.opt.shellpipe = "2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode"
|
vim.opt.shellpipe = "2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode"
|
||||||
vim.opt.shellquote = ""
|
vim.opt.shellquote = ""
|
||||||
vim.opt.shellxquote = ""
|
vim.opt.shellxquote = ""
|
||||||
else
|
else
|
||||||
vim.opt.shell = vim.fn.executable "zsh" == 1 and "zsh" or "bash"
|
-- vim.opt.shell = env.SHELL
|
||||||
end
|
end
|
||||||
|
|
||||||
|
vim.opt.relativenumber = true
|
||||||
|
vim.opt.cursorline = true
|
||||||
vim.g.copilot_assume_mapped = true
|
vim.g.copilot_assume_mapped = true
|
||||||
vim.opt.foldmethod = "expr"
|
-- ufo config
|
||||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
vim.o.foldcolumn = "0" -- '0' is not bad
|
||||||
vim.opt.foldenable = false
|
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
|
||||||
|
vim.o.foldlevelstart = 99
|
||||||
|
-- vim.o.foldenable = true
|
||||||
|
vim.opt.wildmode = { "list", "longest" }
|
||||||
|
vim.opt.wildmenu = true
|
||||||
|
vim.opt.autoread = true
|
||||||
|
|
|
@ -5,21 +5,15 @@ local M = {}
|
||||||
local highlights = require "highlights"
|
local highlights = require "highlights"
|
||||||
M.ui = {
|
M.ui = {
|
||||||
theme = "lunar_witch",
|
theme = "lunar_witch",
|
||||||
-- theme_toggle = { "onedark", "one_light" },
|
|
||||||
|
|
||||||
hl_override = highlights.override,
|
hl_override = highlights.override,
|
||||||
hl_add = highlights.add,
|
hl_add = highlights.add,
|
||||||
|
|
||||||
statusline = {
|
statusline = {
|
||||||
overriden_modules = function (modules)
|
overriden_modules = function(modules)
|
||||||
modules[10] = vim.o.columns > 140 and "%#StText# [%l,%c]" or ""
|
modules[10] = vim.o.columns > 140 and "%#StText# [%l,%c]" or ""
|
||||||
end
|
end,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- M.plugins = "plugins"
|
|
||||||
|
|
||||||
-- check core.mappings for table structure
|
|
||||||
-- M.mappings = require "mappings"
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
return {
|
return {
|
||||||
defaults = { lazy = true },
|
defaults = { lazy = true },
|
||||||
install = { colorscheme = { "nvchad" } },
|
|
||||||
|
|
||||||
ui = {
|
ui = {
|
||||||
icons = {
|
icons = {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
local lspconfig = require "lspconfig"
|
local lspconfig = require "lspconfig"
|
||||||
local on_attach = require("nvchad.configs.lspconfig").on_attach
|
local on_attach = require("nvchad.configs.lspconfig").on_attach
|
||||||
|
local on_attach = require("nvchad.configs.lspconfig").on_init
|
||||||
local capabilities = require("nvchad.configs.lspconfig").capabilities
|
local capabilities = require("nvchad.configs.lspconfig").capabilities
|
||||||
|
|
||||||
-- if you just want default config for the servers then put them in a table
|
-- if you just want default config for the servers then put them in a table
|
||||||
|
@ -20,38 +21,9 @@ local servers = {
|
||||||
for _, lsp in ipairs(servers) do
|
for _, lsp in ipairs(servers) do
|
||||||
lspconfig[lsp].setup {
|
lspconfig[lsp].setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
|
on_init = on_init,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
lspconfig.lua_ls.setup {
|
|
||||||
on_init = function(client)
|
|
||||||
local path = client.workspace_folders[1].name
|
|
||||||
if not vim.loop.fs_stat(path .. "/.luarc.json") and not vim.loop.fs_stat(path .. "/.luarc.jsonc") then
|
|
||||||
client.config.settings = 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,
|
|
||||||
-- "${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)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
require("copilot").setup()
|
require("copilot").setup()
|
||||||
|
|
|
@ -56,9 +56,6 @@ M.nvimtree = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
M.copilot = {
|
M.copilot = {
|
||||||
config = function(_, opts)
|
|
||||||
require("core.utils").load_mappings "copilot"
|
|
||||||
end,
|
|
||||||
suggestion = {
|
suggestion = {
|
||||||
auto_trigger = true,
|
auto_trigger = true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,7 +6,9 @@ local M = {}
|
||||||
---@type Base46HLGroupsList
|
---@type Base46HLGroupsList
|
||||||
M.override = {
|
M.override = {
|
||||||
Comment = {
|
Comment = {
|
||||||
|
fg = "grey_fg",
|
||||||
italic = true,
|
italic = true,
|
||||||
|
bold = true,
|
||||||
},
|
},
|
||||||
St_NormalMode = {
|
St_NormalMode = {
|
||||||
fg = "white",
|
fg = "white",
|
||||||
|
@ -29,6 +31,20 @@ M.add = {
|
||||||
NvimTreeSpecialFile = {
|
NvimTreeSpecialFile = {
|
||||||
fg = "yellow",
|
fg = "yellow",
|
||||||
},
|
},
|
||||||
|
["@comment"] = {
|
||||||
|
fg = "grey_fg",
|
||||||
|
italic = true,
|
||||||
|
bold = true,
|
||||||
|
},
|
||||||
|
Type = {
|
||||||
|
fg = "yellow",
|
||||||
|
},
|
||||||
|
["@type"] = {
|
||||||
|
fg = "yellow",
|
||||||
|
},
|
||||||
|
Structure = {
|
||||||
|
fg = "yellow",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -4,11 +4,32 @@ local M = {}
|
||||||
M.General = function()
|
M.General = function()
|
||||||
map("n", ";", ":", { desc = "general enter command mode", nowait = true })
|
map("n", ";", ":", { desc = "general enter command mode", nowait = true })
|
||||||
map("v", ">", ">gv", { desc = "general indent" })
|
map("v", ">", ">gv", { desc = "general indent" })
|
||||||
map("n", "<C-Left>", "<C-w>h", { desc = "general Window left" })
|
map("n", "<C-Left>", "<C-w>h", { desc = "switch Window left" })
|
||||||
map("n", "<C-Right>", "<C-w>l", { desc = "general Window right" })
|
map("n", "<C-Right>", "<C-w>l", { desc = "switch Window right" })
|
||||||
map("n", "<C-Down>", "<C-w>j", { desc = "general Window down" })
|
map("n", "<C-Down>", "<C-w>j", { desc = "switch Window down" })
|
||||||
map("n", "<C-Up>", "<C-w>k", { desc = "general Window up" })
|
map("n", "<C-Up>", "<C-w>k", { desc = "switch Window up" })
|
||||||
|
map("n", "K", "<cmd>Lspsaga hover_doc<CR>", { desc = "LSPSaga Hover" })
|
||||||
|
map("n", "]d", function()
|
||||||
|
vim.diagnostic.goto_next()
|
||||||
|
end, { desc = "LSP Next Diagnostic" })
|
||||||
|
map("n", "[d", function()
|
||||||
|
vim.diagnostic.goto_prev()
|
||||||
|
end, { desc = "LSP Prev Diagnostic" })
|
||||||
|
map("n", "<Leader>lf", "<cmd>Lspsaga show_cursor_diagnostics<CR>", { desc = "LSPSaga floating diagnostic" })
|
||||||
|
map("n", "<Leader>gr", "<cmd>Lspsaga finder ref<CR>", { desc = "LSPSaga search references" })
|
||||||
|
map("n", "<Leader>gi", "<cmd>Lspsaga finder imp<CR>", { desc = "LSPSaga search implementation" })
|
||||||
|
map("n", "<Leader>gd", "<cmd>Lspsaga finder def<CR>", { desc = "LSPSaga search definition" })
|
||||||
|
map("n", "<Leader>rr", "<cmd>Lspsaga rename<CR>", { desc = "LSPSaga rename" })
|
||||||
|
map("n", "<Leader>ci", "<cmd>Lspsaga incoming_calls<CR>", { desc = "LSPSaga incoming calls" })
|
||||||
|
map("n", "<Leader>co", "<cmd>Lspsaga outgoing_calls<CR>", { desc = "LSPSaga outgoing calls" })
|
||||||
|
map("n", "<C-b>", "<cmd>Lspsaga outline<CR>", { desc = "LSPSaga outline" })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.Ufo = function()
|
||||||
|
map("n", "zR", require("ufo").openAllFolds, { desc = "UFO Open All Folds" })
|
||||||
|
map("n", "zM", require("ufo").closeAllFolds, { desc = "UFO Close All Folds" })
|
||||||
|
end
|
||||||
|
|
||||||
M.Dap = function()
|
M.Dap = function()
|
||||||
map("n", "<leader>db", "<cmd> DapToggleBreakpoint <CR>", { desc = "dap Toggle Breakpoint" })
|
map("n", "<leader>db", "<cmd> DapToggleBreakpoint <CR>", { desc = "dap Toggle Breakpoint" })
|
||||||
map("n", "<leader>dus", function()
|
map("n", "<leader>dus", function()
|
||||||
|
|
|
@ -26,7 +26,7 @@ return {
|
||||||
-- "deno",
|
-- "deno",
|
||||||
"prettier",
|
"prettier",
|
||||||
|
|
||||||
-- c/cpp slike he has tuff
|
-- c/cpp stuff
|
||||||
"clangd",
|
"clangd",
|
||||||
"clang-format",
|
"clang-format",
|
||||||
|
|
||||||
|
@ -41,6 +41,23 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
-- {
|
||||||
|
-- "cbochs/grapple.nvim",
|
||||||
|
-- dependencies = {
|
||||||
|
-- { "nvim-tree/nvim-web-devicons", lazy = true },
|
||||||
|
-- },
|
||||||
|
-- lazy = false,
|
||||||
|
-- },
|
||||||
|
{
|
||||||
|
"nvimdev/lspsaga.nvim",
|
||||||
|
config = function()
|
||||||
|
require("lspsaga").setup {}
|
||||||
|
end,
|
||||||
|
dependencies = {
|
||||||
|
"nvim-treesitter/nvim-treesitter", -- optional
|
||||||
|
"nvim-tree/nvim-web-devicons", -- optional
|
||||||
|
},
|
||||||
|
},
|
||||||
{ "ThePrimeagen/refactoring.nvim" },
|
{ "ThePrimeagen/refactoring.nvim" },
|
||||||
{
|
{
|
||||||
"nvimtools/none-ls.nvim",
|
"nvimtools/none-ls.nvim",
|
||||||
|
@ -56,6 +73,9 @@ return {
|
||||||
require "nvchad.configs.lspconfig"
|
require "nvchad.configs.lspconfig"
|
||||||
require "configs.lspconfig"
|
require "configs.lspconfig"
|
||||||
end, -- Override to setup mason-lspconfig
|
end, -- Override to setup mason-lspconfig
|
||||||
|
dependencies = {
|
||||||
|
"nvimdev/lspsaga.nvim",
|
||||||
|
},
|
||||||
lazy = false,
|
lazy = false,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -86,7 +106,7 @@ return {
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Delimiters
|
-- Delimiters
|
||||||
{ "Raimondi/delimitMate", lazy = false },
|
{ "Raimondi/delimitMate", lazy = false },
|
||||||
-- lazygit
|
-- lazygit
|
||||||
{
|
{
|
||||||
"kdheepak/lazygit.nvim",
|
"kdheepak/lazygit.nvim",
|
||||||
|
@ -96,7 +116,7 @@ return {
|
||||||
lazy = false,
|
lazy = false,
|
||||||
},
|
},
|
||||||
-- fzf
|
-- fzf
|
||||||
{ "junegunn/fzf.vim", lazy = false },
|
{ "junegunn/fzf.vim", lazy = false },
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
dependencies = { "nvim-lua/plenary.nvim", "junegunn/fzf.vim" },
|
dependencies = { "nvim-lua/plenary.nvim", "junegunn/fzf.vim" },
|
||||||
|
@ -129,7 +149,6 @@ return {
|
||||||
opts = overrides.nvimtree,
|
opts = overrides.nvimtree,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Install a plugin
|
|
||||||
{
|
{
|
||||||
"max397574/better-escape.nvim",
|
"max397574/better-escape.nvim",
|
||||||
event = "InsertEnter",
|
event = "InsertEnter",
|
||||||
|
@ -138,30 +157,7 @@ return {
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- TODO: remove this on nvim 0.10
|
{ "zbirenbaum/copilot.lua", event = "InsertEnter", lazy = false },
|
||||||
{
|
|
||||||
"ojroques/nvim-osc52",
|
|
||||||
config = function()
|
|
||||||
local function copy(lines, _)
|
|
||||||
require("osc52").copy(table.concat(lines, "\n"))
|
|
||||||
end
|
|
||||||
|
|
||||||
local function paste()
|
|
||||||
return { vim.fn.split(vim.fn.getreg "", "\n"), vim.fn.getregtype "" }
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.g.clipboard = {
|
|
||||||
name = "osc52",
|
|
||||||
copy = { ["+"] = copy, ["*"] = copy },
|
|
||||||
paste = { ["+"] = paste, ["*"] = paste },
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Now the '+' register will copy to system clipboard using OSC52
|
|
||||||
-- vim.keymap.set('n', '<leader>c', '"+y')
|
|
||||||
-- vim.keymap.set('n', '<leader>cc', '"+yy')
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{ "zbirenbaum/copilot.lua", event = "InsertEnter", opts = overrides.copilot, lazy = false },
|
|
||||||
-- Nyoom around files
|
-- Nyoom around files
|
||||||
{
|
{
|
||||||
"smoka7/hop.nvim",
|
"smoka7/hop.nvim",
|
||||||
|
@ -172,6 +168,19 @@ return {
|
||||||
print(mappings.Hop())
|
print(mappings.Hop())
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"kevinhwang91/nvim-ufo",
|
||||||
|
dependencies = { "kevinhwang91/promise-async" },
|
||||||
|
config = function()
|
||||||
|
require("ufo").setup {
|
||||||
|
provider_selector = function(bufnr, filetype, buftype)
|
||||||
|
return { "treesitter", "indent" }
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
mappings.Ufo()
|
||||||
|
end,
|
||||||
|
lazy = false,
|
||||||
|
},
|
||||||
|
|
||||||
------------
|
------------
|
||||||
-- Python --
|
-- Python --
|
||||||
|
@ -211,17 +220,6 @@ return {
|
||||||
vim.g.rustfmt_autosave = 1
|
vim.g.rustfmt_autosave = 1
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"simrat39/rust-tools.nvim",
|
|
||||||
ft = "rust",
|
|
||||||
dependencies = "neovim/nvim-lspconfig",
|
|
||||||
opts = function()
|
|
||||||
return require "configs.rust-tools"
|
|
||||||
end,
|
|
||||||
config = function(_, opts)
|
|
||||||
require("rust-tools").setup(opts)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"saecki/crates.nvim",
|
"saecki/crates.nvim",
|
||||||
ft = { "rust", "toml" },
|
ft = { "rust", "toml" },
|
Loading…
Add table
Reference in a new issue