Compare commits

..

No commits in common. "b26149af9834734892973b5cce47ee10954eca9d" and "6e6bb3422cb67dfb90dd89d5671ba3ad6898ffaf" have entirely different histories.

2 changed files with 42 additions and 87 deletions

View File

@ -51,15 +51,12 @@ in
cmp-nvim-lsp
cmp_luasnip
comment-nvim
copilot-cmp
copilot-lua
dashboard-nvim
formatter-nvim
lsp_lines-nvim
lspkind-nvim
lualine-lsp-progress
lualine-nvim
luasnip
formatter-nvim
neogit
noice-nvim
nui-nvim # for noice-nvim
@ -70,7 +67,6 @@ in
nvim-treesitter.withAllGrammars
nvim-ts-context-commentstring
nvim-web-devicons # for dashboard-nvim
orgmode
plenary-nvim # for telescope, neogit
telescope-nvim
which-key-nvim

View File

@ -92,23 +92,9 @@ require("nvim-treesitter.configs").setup({
},
})
local lspkind = require("lspkind")
lspkind.init({
symbol_map = {
Copilot = "",
},
})
local cmp = require("cmp")
local luasnip = require("luasnip")
cmp.setup({
formatting = {
format = lspkind.cmp_format({
mode = "symbol", -- show only symbol annotations
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
}),
},
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
@ -141,11 +127,9 @@ cmp.setup({
end, { "i", "s" }),
}),
sources = {
{ name = "buffer", priority = 1 },
{ name = "copilot", priority = 8 },
{ name = "luasnip", priority = 7 },
{ name = "nvim_lsp", priority = 9 },
{ name = "orgmode", priority = 9 },
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
},
})
@ -206,53 +190,39 @@ wk.register({
["="] = { "<cmd>Format<cr>", "format (formatter)" },
}, { noremap = true, silent = true })
local lsp_lines = require("lsp_lines")
lsp_lines.setup()
-- Disable virtual_text since it's redundant due to lsp_lines.
vim.diagnostic.config({
virtual_text = false,
})
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lspconfig = require("lspconfig")
local on_attach_def = function(_, bufnr)
local options = { noremap = true, silent = true, buffer = bufnr }
local on_attach_def = function(client, bufnr)
local options = { noremap = true, silent = true } -- default options
local buffer_options = table_merge(options, { buffer = bufnr }) -- buffer specific options
wk.register({
K = { vim.lsp.buf.hover, "show info" },
["<leader>"] = {
l = {
name = "lsp",
d = { vim.diagnostic.open_float, "open diagnostic window" },
n = { vim.diagnostic.goto_next, "next error" },
p = { vim.diagnostic.goto_prev, "prev error" },
c = { vim.lsp.buf.code_action, "code action" },
r = { vim.lsp.buf.rename, "rename" },
f = {
-- set format keybinding
-- prefere lsp formatting over external formatter
if client.server_capabilities.documentFormattingProvider then
local modes = { "n", "v" }
for _, mode in ipairs(modes) do
wk.register({
["="] = {
function()
vim.lsp.buf.format({ async = true })
end,
"format (lsp)",
mode = { "n", "v" },
},
},
w = {
name = "workspace",
a = { vim.lsp.buf.add_workspace_folder, "add workspace folder" },
r = { vim.lsp.buf.remove_workspace_folder, "remove workspace folder" },
l = {
function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end,
"list workspace folders",
},
},
t = {
name = "toggle",
l = { lsp_lines.toggle, "lsp lines" },
},
}, table_merge(buffer_options, { mode = mode }))
end
end
wk.register({
K = { vim.lsp.buf.hover, "show info" },
["<leader>l"] = {
name = "lsp",
d = { vim.diagnostic.open_float, "open diagnostic window" },
n = { vim.diagnostic.goto_next, "next error" },
p = { vim.diagnostic.goto_prev, "prev error" },
c = { vim.lsp.buf.code_action, "code action" },
r = { vim.lsp.buf.rename, "rename" },
},
g = {
name = "goto",
@ -262,7 +232,7 @@ local on_attach_def = function(_, bufnr)
i = { vim.lsp.buf.implementation, "implementation" },
t = { vim.lsp.buf.type_definition, "type defininition" },
},
}, options)
}, buffer_options)
end
local lspconfig_default_options = {
@ -316,6 +286,20 @@ lspconfig_setup("lua_ls", {
},
})
local lsp_lines = require("lsp_lines")
lsp_lines.setup()
-- Disable virtual_text since it's redundant due to lsp_lines.
vim.diagnostic.config({
virtual_text = false,
})
wk.register({
t = {
name = "toggle",
l = { lsp_lines.toggle, "lsp lines" },
},
{ prefix = "<leader>" },
})
require("dashboard").setup({
theme = "hyper",
config = {
@ -388,28 +372,3 @@ require("nvim-treesitter.configs").setup({
keymaps = { ["."] = "textsubjects-smart" },
},
})
require("copilot").setup({
suggestion = { enabled = false },
panel = { enabled = false },
})
require("copilot_cmp").setup()
local orgmode = require("orgmode")
-- Load custom treesitter grammar for org filetype
orgmode.setup_ts_grammar()
-- Treesitter configuration
require("nvim-treesitter.configs").setup({
-- If TS highlights are not enabled at all, or disabled via `disable` prop,
-- highlighting will fallback to default Vim syntax highlighting
highlight = {
enable = true,
-- Required for spellcheck, some LaTex highlights and
-- code block highlights that do not have ts grammar
additional_vim_regex_highlighting = { "org" },
},
})
orgmode.setup({
org_agenda_files = { "~/Notes/org" },
org_default_notes_file = "~/Notes/org/refile.org",
})