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.mapleader = " "
|
||||
|
||||
|
@ -38,6 +39,8 @@ vim.schedule(function()
|
|||
local mappings = require "mappings"
|
||||
mappings.General()
|
||||
end)
|
||||
-- end NvChad setup
|
||||
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
-- Auto resize panes when resizing nvim window
|
||||
|
@ -45,64 +48,28 @@ autocmd("VimResized", {
|
|||
pattern = "*",
|
||||
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
|
||||
vim.opt.shell = vim.fn.executable "pwsh" == 1 and "pwsh" or "powershell"
|
||||
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.shellpipe = "2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode"
|
||||
vim.opt.shellquote = ""
|
||||
vim.opt.shellxquote = ""
|
||||
else
|
||||
vim.opt.shell = vim.fn.executable "zsh" == 1 and "zsh" or "bash"
|
||||
-- vim.opt.shell = env.SHELL
|
||||
end
|
||||
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.cursorline = true
|
||||
vim.g.copilot_assume_mapped = true
|
||||
vim.opt.foldmethod = "expr"
|
||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
vim.opt.foldenable = false
|
||||
-- ufo config
|
||||
vim.o.foldcolumn = "0" -- '0' is not bad
|
||||
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"
|
||||
M.ui = {
|
||||
theme = "lunar_witch",
|
||||
-- theme_toggle = { "onedark", "one_light" },
|
||||
|
||||
hl_override = highlights.override,
|
||||
hl_add = highlights.add,
|
||||
|
||||
statusline = {
|
||||
overriden_modules = function (modules)
|
||||
overriden_modules = function(modules)
|
||||
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
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
return {
|
||||
defaults = { lazy = true },
|
||||
install = { colorscheme = { "nvchad" } },
|
||||
|
||||
ui = {
|
||||
icons = {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
local lspconfig = require "lspconfig"
|
||||
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
|
||||
|
||||
-- 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
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
on_init = on_init,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
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()
|
||||
|
|
|
@ -56,9 +56,6 @@ M.nvimtree = {
|
|||
},
|
||||
}
|
||||
M.copilot = {
|
||||
config = function(_, opts)
|
||||
require("core.utils").load_mappings "copilot"
|
||||
end,
|
||||
suggestion = {
|
||||
auto_trigger = true,
|
||||
},
|
||||
|
|
|
@ -6,7 +6,9 @@ local M = {}
|
|||
---@type Base46HLGroupsList
|
||||
M.override = {
|
||||
Comment = {
|
||||
fg = "grey_fg",
|
||||
italic = true,
|
||||
bold = true,
|
||||
},
|
||||
St_NormalMode = {
|
||||
fg = "white",
|
||||
|
@ -29,6 +31,20 @@ M.add = {
|
|||
NvimTreeSpecialFile = {
|
||||
fg = "yellow",
|
||||
},
|
||||
["@comment"] = {
|
||||
fg = "grey_fg",
|
||||
italic = true,
|
||||
bold = true,
|
||||
},
|
||||
Type = {
|
||||
fg = "yellow",
|
||||
},
|
||||
["@type"] = {
|
||||
fg = "yellow",
|
||||
},
|
||||
Structure = {
|
||||
fg = "yellow",
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
|
|
|
@ -4,11 +4,32 @@ local M = {}
|
|||
M.General = function()
|
||||
map("n", ";", ":", { desc = "general enter command mode", nowait = true })
|
||||
map("v", ">", ">gv", { desc = "general indent" })
|
||||
map("n", "<C-Left>", "<C-w>h", { desc = "general Window left" })
|
||||
map("n", "<C-Right>", "<C-w>l", { desc = "general Window right" })
|
||||
map("n", "<C-Down>", "<C-w>j", { desc = "general Window down" })
|
||||
map("n", "<C-Up>", "<C-w>k", { desc = "general Window up" })
|
||||
map("n", "<C-Left>", "<C-w>h", { desc = "switch Window left" })
|
||||
map("n", "<C-Right>", "<C-w>l", { desc = "switch Window right" })
|
||||
map("n", "<C-Down>", "<C-w>j", { desc = "switch Window down" })
|
||||
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
|
||||
|
||||
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()
|
||||
map("n", "<leader>db", "<cmd> DapToggleBreakpoint <CR>", { desc = "dap Toggle Breakpoint" })
|
||||
map("n", "<leader>dus", function()
|
||||
|
|
|
@ -26,7 +26,7 @@ return {
|
|||
-- "deno",
|
||||
"prettier",
|
||||
|
||||
-- c/cpp slike he has tuff
|
||||
-- c/cpp stuff
|
||||
"clangd",
|
||||
"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" },
|
||||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
|
@ -56,6 +73,9 @@ return {
|
|||
require "nvchad.configs.lspconfig"
|
||||
require "configs.lspconfig"
|
||||
end, -- Override to setup mason-lspconfig
|
||||
dependencies = {
|
||||
"nvimdev/lspsaga.nvim",
|
||||
},
|
||||
lazy = false,
|
||||
},
|
||||
|
||||
|
@ -86,7 +106,7 @@ return {
|
|||
},
|
||||
|
||||
-- Delimiters
|
||||
{ "Raimondi/delimitMate", lazy = false },
|
||||
{ "Raimondi/delimitMate", lazy = false },
|
||||
-- lazygit
|
||||
{
|
||||
"kdheepak/lazygit.nvim",
|
||||
|
@ -96,7 +116,7 @@ return {
|
|||
lazy = false,
|
||||
},
|
||||
-- fzf
|
||||
{ "junegunn/fzf.vim", lazy = false },
|
||||
{ "junegunn/fzf.vim", lazy = false },
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim", "junegunn/fzf.vim" },
|
||||
|
@ -129,7 +149,6 @@ return {
|
|||
opts = overrides.nvimtree,
|
||||
},
|
||||
|
||||
-- Install a plugin
|
||||
{
|
||||
"max397574/better-escape.nvim",
|
||||
event = "InsertEnter",
|
||||
|
@ -138,30 +157,7 @@ return {
|
|||
end,
|
||||
},
|
||||
|
||||
-- TODO: remove this on nvim 0.10
|
||||
{
|
||||
"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 },
|
||||
{ "zbirenbaum/copilot.lua", event = "InsertEnter", lazy = false },
|
||||
-- Nyoom around files
|
||||
{
|
||||
"smoka7/hop.nvim",
|
||||
|
@ -172,6 +168,19 @@ return {
|
|||
print(mappings.Hop())
|
||||
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 --
|
||||
|
@ -211,17 +220,6 @@ return {
|
|||
vim.g.rustfmt_autosave = 1
|
||||
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",
|
||||
ft = { "rust", "toml" },
|
Loading…
Add table
Reference in a new issue