Compare commits
No commits in common. "5d658930f431b08bf5d690f5503bd1617e70a8c3" and "f230ae7a1161e77342032bbe296900561d8e6bd6" have entirely different histories.
5d658930f4
...
f230ae7a11
@ -1,4 +1,4 @@
|
|||||||
-- setting error signs
|
-- settings erro signs
|
||||||
local function sign_define(args)
|
local function sign_define(args)
|
||||||
vim.fn.sign_define(args.name, {
|
vim.fn.sign_define(args.name, {
|
||||||
texthl = args.name,
|
texthl = args.name,
|
||||||
@ -28,7 +28,7 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
|||||||
desc = "LSP Actions",
|
desc = "LSP Actions",
|
||||||
callback = function(event)
|
callback = function(event)
|
||||||
-- Enable omnifunc
|
-- Enable omnifunc
|
||||||
-- vim.bo[event.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
vim.bo[event.buf].omnifunc = "v:lua.MiniCompletion.completefunc_lsp"
|
||||||
|
|
||||||
-- Buffer local mappings
|
-- Buffer local mappings
|
||||||
local opts = { buffer = event.buf }
|
local opts = { buffer = event.buf }
|
||||||
@ -56,65 +56,31 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities()
|
|
||||||
|
|
||||||
local default_setup = function(server)
|
|
||||||
require("lspconfig")[server].setup({
|
|
||||||
capabilities = lsp_capabilities,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- setup mason and automatically install some language server's
|
-- setup mason and automatically install some language server's
|
||||||
require("mason").setup({})
|
require("mason").setup({})
|
||||||
require("mason-lspconfig").setup({
|
require("mason-lspconfig").setup({
|
||||||
ensure_installed = { "lua_ls", "jsonls", "bashls", "pyright", "marksman", "gopls", "clangd" },
|
ensure_installed = { "lua_ls", "jsonls", "bashls", "pyright", "marksman", "gopls", "clangd" },
|
||||||
handlers = { default_setup },
|
})
|
||||||
|
|
||||||
|
-- automatically setup already installed lsp's
|
||||||
|
require("mason-lspconfig").setup_handlers({
|
||||||
|
function(server_name)
|
||||||
|
require("lspconfig")[server_name].setup({})
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- setup haskell language server manually cause it doesn't work with mason for xmonad
|
-- setup haskell language server manually cause it doesn't work with mason for xmonad
|
||||||
require("lspconfig").hls.setup({ capabilities = lsp_capabilities })
|
require("lspconfig").hls.setup({})
|
||||||
|
|
||||||
-- simple completion setup with snippet support
|
-- autocompletion using mini.completion
|
||||||
local cmp = require("cmp")
|
require("mini.completion").setup({
|
||||||
|
lsp_completion = {
|
||||||
cmp.setup({
|
source_func = "omnifunc",
|
||||||
sources = {
|
auto_setup = false,
|
||||||
{ name = "nvim_lsp" },
|
|
||||||
{ name = "snippy" },
|
|
||||||
{ name = "path" },
|
|
||||||
},
|
},
|
||||||
mapping = cmp.mapping.preset.insert({
|
fallback_action = "<C-x><C-n>",
|
||||||
["<C-l>"] = cmp.mapping.confirm({ select = false }),
|
|
||||||
["<C-j>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible then
|
|
||||||
cmp.select_next_item()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
["<C-k>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
}),
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
require("snippy").expand_snippet(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
formatting = {
|
|
||||||
format = require("lspkind").cmp_format({
|
|
||||||
mode = "symbol_text", -- show only symbol annotations
|
|
||||||
maxwidth = 50, -- prevent the popup from showing more than provided characters
|
|
||||||
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
enabled = function()
|
|
||||||
-- disable completion in comments
|
|
||||||
local context = require("cmp.config.context")
|
|
||||||
return not context.in_treesitter_capture("comment") and not context.in_syntax_group("Comment")
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- bind ctrl j and k to move beetwen completion items
|
||||||
|
vim.keymap.set("i", "<C-j>", [[pumvisible() ? "\<C-n>" : "\<C-j>"]], { expr = true })
|
||||||
|
vim.keymap.set("i", "<C-k>", [[pumvisible() ? "\<C-p>" : "\<C-k>"]], { expr = true })
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
-- mini.nvim statusline module
|
-- mini.nvim statusline module
|
||||||
require("mini.statusline").setup({
|
require("mini.statusline").setup({
|
||||||
set_vim_settings = false,
|
set_vim_options = false,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- mini.nvim commeting module
|
-- mini.nvim commeting module
|
||||||
|
@ -14,8 +14,6 @@ vim.opt.rtp:prepend(lazypath)
|
|||||||
|
|
||||||
-- plugins installation and configuration
|
-- plugins installation and configuration
|
||||||
require("lazy").setup({
|
require("lazy").setup({
|
||||||
-- lsp setup
|
|
||||||
{
|
|
||||||
-- LSP Support
|
-- LSP Support
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
-- lsp download manager
|
-- lsp download manager
|
||||||
@ -28,21 +26,7 @@ require("lazy").setup({
|
|||||||
"mfussenegger/nvim-lint",
|
"mfussenegger/nvim-lint",
|
||||||
-- mason autoinstaller for formatter's and linter's
|
-- mason autoinstaller for formatter's and linter's
|
||||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||||
-- minimal snippet's support
|
|
||||||
"dcampos/nvim-snippy",
|
|
||||||
-- basic snippet's
|
|
||||||
"honza/vim-snippets",
|
|
||||||
-- cmp for autocompletion
|
|
||||||
"hrsh7th/nvim-cmp",
|
|
||||||
-- cmp nvim-lsp plugin
|
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
|
||||||
-- cmp snippy support
|
|
||||||
"dcampos/cmp-snippy",
|
|
||||||
-- path comletion
|
|
||||||
"hrsh7th/cmp-path",
|
|
||||||
-- kind icons
|
|
||||||
"onsails/lspkind.nvim",
|
|
||||||
},
|
|
||||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||||
"lewis6991/gitsigns.nvim",
|
"lewis6991/gitsigns.nvim",
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user