Compare commits
4 commits
6e6bb3422c
...
b26149af98
Author | SHA1 | Date | |
---|---|---|---|
b26149af98 | |||
eb77aa8823 | |||
819590103d | |||
2bc3938654 |
2 changed files with 87 additions and 42 deletions
|
@ -51,12 +51,15 @@ 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
|
||||||
|
@ -67,6 +70,7 @@ 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
|
||||||
|
|
|
@ -92,9 +92,23 @@ 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)
|
||||||
|
@ -127,9 +141,11 @@ cmp.setup({
|
||||||
end, { "i", "s" }),
|
end, { "i", "s" }),
|
||||||
}),
|
}),
|
||||||
sources = {
|
sources = {
|
||||||
{ name = "nvim_lsp" },
|
{ name = "buffer", priority = 1 },
|
||||||
{ name = "luasnip" },
|
{ name = "copilot", priority = 8 },
|
||||||
{ name = "buffer" },
|
{ name = "luasnip", priority = 7 },
|
||||||
|
{ name = "nvim_lsp", priority = 9 },
|
||||||
|
{ name = "orgmode", priority = 9 },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -190,39 +206,53 @@ 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(client, bufnr)
|
local on_attach_def = function(_, bufnr)
|
||||||
local options = { noremap = true, silent = true } -- default options
|
local options = { noremap = true, silent = true, buffer = bufnr }
|
||||||
local buffer_options = table_merge(options, { buffer = bufnr }) -- buffer specific options
|
|
||||||
|
|
||||||
-- 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)",
|
|
||||||
},
|
|
||||||
}, table_merge(buffer_options, { mode = mode }))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
wk.register({
|
wk.register({
|
||||||
K = { vim.lsp.buf.hover, "show info" },
|
K = { vim.lsp.buf.hover, "show info" },
|
||||||
["<leader>l"] = {
|
["<leader>"] = {
|
||||||
|
l = {
|
||||||
name = "lsp",
|
name = "lsp",
|
||||||
d = { vim.diagnostic.open_float, "open diagnostic window" },
|
d = { vim.diagnostic.open_float, "open diagnostic window" },
|
||||||
n = { vim.diagnostic.goto_next, "next error" },
|
n = { vim.diagnostic.goto_next, "next error" },
|
||||||
p = { vim.diagnostic.goto_prev, "prev error" },
|
p = { vim.diagnostic.goto_prev, "prev error" },
|
||||||
c = { vim.lsp.buf.code_action, "code action" },
|
c = { vim.lsp.buf.code_action, "code action" },
|
||||||
r = { vim.lsp.buf.rename, "rename" },
|
r = { vim.lsp.buf.rename, "rename" },
|
||||||
|
f = {
|
||||||
|
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" },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
g = {
|
g = {
|
||||||
name = "goto",
|
name = "goto",
|
||||||
|
@ -232,7 +262,7 @@ local on_attach_def = function(client, 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" },
|
||||||
},
|
},
|
||||||
}, buffer_options)
|
}, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
local lspconfig_default_options = {
|
local lspconfig_default_options = {
|
||||||
|
@ -286,20 +316,6 @@ 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 = {
|
||||||
|
@ -372,3 +388,28 @@ 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",
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in a new issue