diff --git a/config/nvim/.luarc.json b/config/nvim/.luarc.json new file mode 100644 index 0000000..ceb1818 --- /dev/null +++ b/config/nvim/.luarc.json @@ -0,0 +1,12 @@ +{ + "runtime.version": "LuaJIT", + "runtime.path": [ + "lua/?.lua", + "lua/?/init.lua" + ], + "diagnostics.globals": ["vim"], + "workspace.checkThirdParty": false, + "workspace.library": [ + "$VIMRUNTIME" + ] +} diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 6f06fa1..9a7ad9a 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -1,7 +1,7 @@ ------------------------------------------------------------------- -- Settings ------------------------------------------------------------------- -vim.opt.winborder = "rounded" +-- vim.opt.winborder = "rounded" vim.opt.hlsearch = false vim.opt.tabstop = 4 vim.opt.cursorcolumn = false @@ -51,19 +51,34 @@ vim.pack.add({ { src = "https://github.com/echasnovski/mini.icons" }, { src = "https://github.com/echasnovski/mini.statusline" }, { src = "https://github.com/echasnovski/mini.pick" }, + { src = "https://github.com/echasnovski/mini.extra" }, { src = 'https://github.com/neovim/nvim-lspconfig' }, { src = 'https://github.com/lewis6991/gitsigns.nvim' }, { src = 'https://github.com/MunifTanjim/nui.nvim' }, { src = 'https://github.com/folke/noice.nvim' }, + { src = "https://github.com/L3MON4D3/LuaSnip" }, + { src = "https://github.com/rafamadriz/friendly-snippets" }, + { src = 'https://github.com/saghen/blink.cmp' }, }) ------------------------------------------------------------------- -- Plugin config ------------------------------------------------------------------- --- colorscheme -vim.cmd.colorscheme("nightly_cm") require "noice".setup() -require "mini.pick".setup() + +local win_config = function() + local height = math.floor(0.618 * vim.o.lines) + local width = math.floor(0.618 * vim.o.columns) + return { + anchor = 'NW', + height = height, + width = width, + row = math.floor(0.5 * (vim.o.lines - height)), + col = math.floor(0.5 * (vim.o.columns - width)), + } +end +require "mini.pick".setup({ window = { config = win_config } }) +require "mini.extra".setup() require "mini.statusline".setup() require "gitsigns".setup({ signs = { @@ -83,20 +98,43 @@ require "gitsigns".setup({ col = 1, }, }) +------------------------------------------------------------------- +-- Autocomplete +------------------------------------------------------------------- +require("luasnip.loaders.from_vscode").lazy_load() +require("blink.cmp").setup({ + signature = { enabled = true }, + completion = { + documentation = { auto_show = false, auto_show_delay_ms = 500 }, + menu = { + auto_show = true, + draw = { + columns = { + { "label", "label_description", gap = 1 }, + { "kind_icon", "kind" } + }, + } + }, + }, + sources = { + default = { 'lsp', 'buffer', 'path', 'snippets' }, + providers = { + -- defaults to `{ 'buffer' }` + lsp = { fallbacks = {} } + }, + }, + fuzzy = { implementation = "lua" }, +}) + ------------------------------------------------------------------- -- LSP config ------------------------------------------------------------------- vim.lsp.enable({ "lua_ls", "rust_analyzer", "bashls", "pyright", "marksman", "clangd", "yamlls" }) --- prevent the built-in vim.lsp.completion autotrigger from selecting the first item -vim.opt.completeopt = { "menuone", "popup", "noselect" } -vim.api.nvim_create_autocmd("LspAttach", { - callback = function(ev) - local client = vim.lsp.get_client_by_id(ev.data.client_id) - if client ~= nil and client:supports_method("textDocument/completion") then - vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true }) - end - end, -}) + +------------------------------------------------------------------- +-- GUI config +------------------------------------------------------------------- +vim.cmd.colorscheme("nightly_cm") vim.diagnostic.config({ severity_sort = true, float = { border = "rounded", source = "if_many" },