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-nvim-lsp
cmp_luasnip cmp_luasnip
comment-nvim comment-nvim
copilot-cmp
copilot-lua
dashboard-nvim dashboard-nvim
formatter-nvim
lsp_lines-nvim lsp_lines-nvim
lspkind-nvim
lualine-lsp-progress lualine-lsp-progress
lualine-nvim lualine-nvim
luasnip luasnip
formatter-nvim
neogit neogit
noice-nvim noice-nvim
nui-nvim # for noice-nvim nui-nvim # for noice-nvim
@ -70,7 +67,6 @@ in
nvim-treesitter.withAllGrammars nvim-treesitter.withAllGrammars
nvim-ts-context-commentstring nvim-ts-context-commentstring
nvim-web-devicons # for dashboard-nvim nvim-web-devicons # for dashboard-nvim
orgmode
plenary-nvim # for telescope, neogit plenary-nvim # for telescope, neogit
telescope-nvim telescope-nvim
which-key-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 cmp = require("cmp")
local luasnip = require("luasnip") local luasnip = require("luasnip")
cmp.setup({ 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 = { snippet = {
-- REQUIRED - you must specify a snippet engine -- REQUIRED - you must specify a snippet engine
expand = function(args) expand = function(args)
@ -141,11 +127,9 @@ cmp.setup({
end, { "i", "s" }), end, { "i", "s" }),
}), }),
sources = { sources = {
{ name = "buffer", priority = 1 }, { name = "nvim_lsp" },
{ name = "copilot", priority = 8 }, { name = "luasnip" },
{ name = "luasnip", priority = 7 }, { name = "buffer" },
{ name = "nvim_lsp", priority = 9 },
{ name = "orgmode", priority = 9 },
}, },
}) })
@ -206,53 +190,39 @@ wk.register({
["="] = { "<cmd>Format<cr>", "format (formatter)" }, ["="] = { "<cmd>Format<cr>", "format (formatter)" },
}, { noremap = true, silent = true }) }, { 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.. -- 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 capabilities = require("cmp_nvim_lsp").default_capabilities()
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
local on_attach_def = function(_, bufnr) local on_attach_def = function(client, bufnr)
local options = { noremap = true, silent = true, buffer = bufnr } local options = { noremap = true, silent = true } -- default options
local buffer_options = table_merge(options, { buffer = bufnr }) -- buffer specific options
wk.register({ -- set format keybinding
K = { vim.lsp.buf.hover, "show info" }, -- prefere lsp formatting over external formatter
["<leader>"] = { if client.server_capabilities.documentFormattingProvider then
l = { local modes = { "n", "v" }
name = "lsp", for _, mode in ipairs(modes) do
d = { vim.diagnostic.open_float, "open diagnostic window" }, wk.register({
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 = {
function() function()
vim.lsp.buf.format({ async = true }) vim.lsp.buf.format({ async = true })
end, end,
"format (lsp)", "format (lsp)",
mode = { "n", "v" },
}, },
}, }, table_merge(buffer_options, { mode = mode }))
w = { end
name = "workspace", end
a = { vim.lsp.buf.add_workspace_folder, "add workspace folder" },
r = { vim.lsp.buf.remove_workspace_folder, "remove workspace folder" }, wk.register({
l = { K = { vim.lsp.buf.hover, "show info" },
function() ["<leader>l"] = {
print(vim.inspect(vim.lsp.buf.list_workspace_folders())) name = "lsp",
end, d = { vim.diagnostic.open_float, "open diagnostic window" },
"list workspace folders", n = { vim.diagnostic.goto_next, "next error" },
}, p = { vim.diagnostic.goto_prev, "prev error" },
}, c = { vim.lsp.buf.code_action, "code action" },
t = { r = { vim.lsp.buf.rename, "rename" },
name = "toggle",
l = { lsp_lines.toggle, "lsp lines" },
},
}, },
g = { g = {
name = "goto", name = "goto",
@ -262,7 +232,7 @@ local on_attach_def = function(_, bufnr)
i = { vim.lsp.buf.implementation, "implementation" }, i = { vim.lsp.buf.implementation, "implementation" },
t = { vim.lsp.buf.type_definition, "type defininition" }, t = { vim.lsp.buf.type_definition, "type defininition" },
}, },
}, options) }, buffer_options)
end end
local lspconfig_default_options = { 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({ require("dashboard").setup({
theme = "hyper", theme = "hyper",
config = { config = {
@ -388,28 +372,3 @@ require("nvim-treesitter.configs").setup({
keymaps = { ["."] = "textsubjects-smart" }, 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",
})