diff --git a/lua/keymap.lua b/lua/keymap.lua index 89a3c1f..2f9216c 100644 --- a/lua/keymap.lua +++ b/lua/keymap.lua @@ -13,10 +13,10 @@ vim.keymap.set("n", "m", tb.keymaps, {}) vim.keymap.set("n", "c", tb.commands, {}) -- find Documentation vim.keymap.set("n", "d", tb.man_pages, {}) --- find symbols +-- find symbols vim.keymap.set("n", "v", tb.lsp_workspace_symbols, {}) -- open tree -vim.keymap.set({ "i", "n" }, "", vim.cmd.NvimTreeFocus, {}) +vim.keymap.set({ "n" }, "", vim.cmd.NvimTreeFocus, {}) -- move and copy lines vim.keymap.set({ "i", "n" }, "", function() vim.api.nvim_feedkeys("ddkP", "x", false) @@ -30,6 +30,12 @@ end, {}) vim.keymap.set({ "i", "n" }, "", function() vim.api.nvim_feedkeys("yyp", "x", false) end, {}) +vim.keymap.set("v", "", function () + vim.api.nvim_feedkeys("yP", "x", false) +end) +vim.keymap.set("v", "", function () + vim.api.nvim_feedkeys("yp", "x", false) +end) -- toggle function signature vim.keymap.set("i", "", function() require("lsp_signature").toggle_float_win() @@ -71,10 +77,10 @@ vim.keymap.set("n", "h", ":%S/", { vim.keymap.set({ "n", "v" }, "se", require("nvim-emmet").wrap_with_abbreviation) -- open command line with the path of current buffer already inserted vim.keymap.set("n", "e", function() - -- print((":e " .. string.gsub(vim.fn.expand("%"), '(.*/)(.*)', '%1'))); + -- print((":e " .. string.gsub(vim.fn.expand("%"), '(.*/)(.*)', '%1'))); vim.api.nvim_feedkeys((":e " .. string.gsub(vim.fn.expand("%"), "(.*/)(.*)", "%1")), "L", false) end) -vim.keymap.set("n", "c", ":let @+=@\"") +vim.keymap.set("n", "c", ':let @+=@"') -- training vim.keymap.set("n", "", ':echoe "Use h"') vim.keymap.set("n", "", ':echoe "Use l"') @@ -85,12 +91,44 @@ vim.keymap.set("i", "", ':echoe "Use h"i') vim.keymap.set("i", "", ':echoe "Use l"i') vim.keymap.set("i", "", ':echoe "Use k"i') vim.keymap.set("i", "", ':echoe "Use j"i') --- https://stackoverflow.com/questions/1841480/how-to-use-lowercase-marks-as-global-in-vim --- Use lowercase for global marks and uppercase for local marks. -local low = function(i) return string.char(97+i) end -local upp = function(i) return string.char(65+i) end - -for i=0,25 do vim.keymap.set("n", "m"..low(i), "m"..upp(i)) end -for i=0,25 do vim.keymap.set("n", "m"..upp(i), "m"..low(i)) end -for i=0,25 do vim.keymap.set("n", "'"..low(i), "'"..upp(i)) end -for i=0,25 do vim.keymap.set("n", "'"..upp(i), "'"..low(i)) end +vim.keymap.set({"n", "v", "i"}, "", "", { + noremap = true +}) +vim.cmd.aunmenu([[PopUp.How-to\ disable\ mouse]]) +vim.cmd.aunmenu([[PopUp.Paste]]) +vim.cmd.aunmenu([[PopUp.Select\ All]]) +vim.cmd.aunmenu([[PopUp.Inspect]]) +-- vim.api.nvim_create_autocmd("BufAdd", { +-- callback = function(e) +-- vim.keymap.set({"n", "i", "v"}, "", "", { +-- buffer = e.buf +-- }) +-- end, +-- }) +-- vim.api.nvim_create_autocmd("User", { +-- pattern = "BufferLineHoverOver", +-- callback = function(e) +-- print("over") +-- vim.keymap.del({"n", "i", "v"}, "", { +-- buffer = e.buf +-- }) +-- end, +-- }) +-- vim.api.nvim_create_autocmd("User", { +-- pattern = "BufferLineHoverOut", +-- callback = function(e) +-- print("out") +-- vim.keymap.set({"n", "i", "v"}, "", "", { +-- buffer = e.buf +-- }) +-- end, +-- }) +-- -- https://stackoverflow.com/questions/1841480/how-to-use-lowercase-marks-as-global-in-vim +-- -- Use lowercase for global marks and uppercase for local marks. +-- local low = function(i) return string.char(97+i) end +-- local upp = function(i) return string.char(65+i) end +-- +-- for i=0,25 do vim.keymap.set("n", "m"..low(i), "m"..upp(i)) end +-- for i=0,25 do vim.keymap.set("n", "m"..upp(i), "m"..low(i)) end +-- for i=0,25 do vim.keymap.set("n", "'"..low(i), "'"..upp(i)) end +-- for i=0,25 do vim.keymap.set("n", "'"..upp(i), "'"..low(i)) end diff --git a/lua/masonDownload.lua b/lua/masonDownload.lua index 620991d..0db18d2 100644 --- a/lua/masonDownload.lua +++ b/lua/masonDownload.lua @@ -1,5 +1,4 @@ local pkgs = { - "nixpkgs-fmt", "jdtls", "yaml-language-server", } diff --git a/lua/plugins.lua b/lua/plugins.lua index 32e8d74..4bf1840 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,18 +1,74 @@ local plugins = { - { - "christoomey/vim-titlecase" - }, + { + "norcalli/nvim-colorizer.lua", + }, + { + "folke/lazydev.nvim", + ft = "lua", -- only load on lua files + init = function() + vim.g.lazydev_enabled = true + end, + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = "luvit-meta/library", words = { "vim%.uv" } }, + }, + }, + }, + { "Bilal2453/luvit-meta", lazy = true }, -- optional `vim.uv` typings + -- { -- optional blink completion source for require statements and module annotations + -- "saghen/blink.cmp", + -- opts = { + -- sources = { + -- -- add lazydev to your completion providers + -- completion = { + -- enabled_providers = { "lsp", "path", "snippets", "buffer", "lazydev" }, + -- }, + -- providers = { + -- -- dont show LuaLS require statements when lazydev has items + -- lsp = { fallback_for = { "lazydev" } }, + -- lazydev = { name = "LazyDev", module = "lazydev.integrations.blink" }, + -- }, + -- }, + -- }, + -- }, + { + "echasnovski/mini.bufremove", + version = "*", + }, + { + "folke/noice.nvim", + event = "VeryLazy", + -- opts = { + -- -- add any options here + -- }, + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + "MunifTanjim/nui.nvim", + -- OPTIONAL: + -- `nvim-notify` is only needed, if you want to use the notification view. + -- If not available, we use `mini` as the fallback + "rcarriga/nvim-notify", + }, + }, + { + "lewis6991/hover.nvim", + }, + { + "christoomey/vim-titlecase", + }, { "kylechui/nvim-surround", version = "*", -- Use for stability; omit to use `main` branch for the latest features event = "VeryLazy", config = function() require("nvim-surround").setup({ - keymaps = { - visual = "s", - visual_line = "s" - } - }) + keymaps = { + visual = "s", + visual_line = "s", + }, + }) end, }, { @@ -104,15 +160,10 @@ local plugins = { { "neovim/nvim-lspconfig", }, - { "folke/neodev.nvim", opts = {} }, + { "p00f/clangd_extensions.nvim", }, - { - "folke/trouble.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - opts = {}, - }, { "abecodes/tabout.nvim", lazy = false, @@ -190,7 +241,23 @@ local plugins = { }, { "kevinhwang91/nvim-ufo", - dependencies = { "kevinhwang91/promise-async" }, + dependencies = { + "kevinhwang91/promise-async", + { + "luukvbaal/statuscol.nvim", + config = function() + local builtin = require("statuscol.builtin") + require("statuscol").setup({ + relculright = true, + segments = { + { text = { builtin.foldfunc }, click = "v:lua.ScFa" }, + { text = { "%s" }, click = "v:lua.ScSa" }, + { text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" }, + }, + }) + end, + }, + }, }, --{ -- 'mfussenegger/nvim-lint' diff --git a/lua/sets.lua b/lua/sets.lua index f8702e2..e1711c1 100644 --- a/lua/sets.lua +++ b/lua/sets.lua @@ -7,6 +7,7 @@ vim.opt.shiftwidth = 4 vim.opt.smartcase = true vim.opt.ignorecase = true vim.opt.scrolloff = 6 +vim.opt.sloc = "statusline" -- eregex.vim vim.g.eregex_default_enable = 1 diff --git a/lua/setup.lua b/lua/setup.lua index e86bc3b..66b6058 100644 --- a/lua/setup.lua +++ b/lua/setup.lua @@ -1,5 +1,7 @@ require("themesetup") vim.cmd([[colorscheme tokyonight]]) +require("setupnotify") +require("setupnoice") require("mason").setup() require("mason-lspconfig").setup() @@ -25,5 +27,8 @@ require("setuplualine") require("setupDiscord") require('telescope').load_extension('fzf') +require('telescope').load_extension("noice") require("setupbufferline") require("setupterminal") +require("setuphover") +require("colorizer").setup() diff --git a/lua/setupDiscord.lua b/lua/setupDiscord.lua index 36e8f4c..7361454 100644 --- a/lua/setupDiscord.lua +++ b/lua/setupDiscord.lua @@ -5,10 +5,10 @@ require("presence").setup({ neovim_image_text = "A text editor of all time", -- Text displayed when hovered over the Neovim image main_image = "neovim", -- Main image display (either "neovim" or "file") client_id = "793271441293967371", -- Use your own Discord application client id (not recommended) - log_level = "error", -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error") + log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error") debounce_timeout = 5, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(, true)`) enable_line_number = true, -- Displays the current line number instead of the current project - blacklist = { "nitro" }, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches + blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches buttons = { { label = "Git", diff --git a/lua/setupbufferline.lua b/lua/setupbufferline.lua index de57482..6458ba3 100644 --- a/lua/setupbufferline.lua +++ b/lua/setupbufferline.lua @@ -1,8 +1,83 @@ vim.opt.termguicolors = true +-- test +local function get_listed_bufs() + return vim.tbl_filter(function(bufnr) + return vim.api.nvim_buf_get_option(bufnr, "buflisted") + end, vim.api.nvim_list_bufs()) +end +-- print(vim.inspect(get_listed_bufs())) +local function close_empty_unnamed_buffers() + -- Get a list of all buffers + local buffers = vim.api.nvim_list_bufs() + local total = table.getn(get_listed_bufs()) + local soFar = 0 + -- Iterate over each buffer + for _, bufnr in ipairs(buffers) do + -- Check i f the buffer is empty and doesn't have a name + if + vim.api.nvim_buf_is_loaded(bufnr) + and vim.api.nvim_buf_get_name(bufnr) == "" + and vim.api.nvim_buf_get_option(bufnr, "buftype") == "" + then + -- Get all lines in the buffer + local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) + + -- Initialize a variable to store the total number of characters + local total_characters = 0 + + -- Iterate over each line and calculate the number of characters + for _, line in ipairs(lines) do + total_characters = total_characters + #line + if total_characters ~= 0 then + break + end + end + + -- Close the buffer i f it's empty: + if total_characters == 0 then + soFar = soFar + 1 + end + end + end + if soFar == total then + vim.cmd("quit") + end +end +local close = function() + local bd = require("mini.bufremove").delete + if vim.bo.modified then + local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()), "&Yes\n&No\n&Cancel") + if choice == 1 then -- Yes + vim.cmd.write() + bd(0) + elseif choice == 2 then -- No + bd(0, true) + end + else + bd(0) + end + close_empty_unnamed_buffers() +end +vim.o.confirm = true +vim.api.nvim_create_autocmd("BufEnter", { + group = vim.api.nvim_create_augroup("NvimTreeClose", { clear = true }), + callback = function() + local layout = vim.api.nvim_call_function("winlayout", {}) + if + layout[1] == "leaf" + and vim.api.nvim_buf_get_option(vim.api.nvim_win_get_buf(layout[2]), "filetype") == "NvimTree" + and layout[3] == nil + then + vim.cmd("quit") + end + end, +}) require("bufferline").setup({ options = { mode = "buffers", numbers = "buffer_id", + close_command = close, + right_mouse_command = close, indicator = { -- icon = "| ", style = "icon", diff --git a/lua/setupformat.lua b/lua/setupformat.lua index 1f815e3..63b18c7 100644 --- a/lua/setupformat.lua +++ b/lua/setupformat.lua @@ -15,7 +15,7 @@ require("formatter").setup({ require("formatter.filetypes.nix").nixpkgs_fmt, function() return { - exe = "nixpkgs-fmt", + exe = "nixfmt", stdin = true, args = {}, } diff --git a/lua/setuphover.lua b/lua/setuphover.lua new file mode 100644 index 0000000..ba5dccf --- /dev/null +++ b/lua/setuphover.lua @@ -0,0 +1,23 @@ +require("hover").setup({ + init = function() + require("hover.providers.diagnostic") + require("hover.providers.lsp") + end, + preview_opts = { + border = "rounded", + }, + preview_window = false, + title = true, + mouse_providers = { + "Diagnostics", + "LSP", + }, + mouse_delay = 0, +}) +local h = require("hover") +vim.keymap.set("n", "K", h.hover) +vim.keymap.set("n", "gK", h.hover_select) +vim.keymap.set("n", "", h.hover_mouse, { + noremap = true, +}) +vim.o.mousemoveevent = true diff --git a/lua/setuplsp.lua b/lua/setuplsp.lua index 0bf75e3..19dc95c 100644 --- a/lua/setuplsp.lua +++ b/lua/setuplsp.lua @@ -1,7 +1,4 @@ --- https://github.com/neovim/nvim-lspconfig/blob/master/dloc/server_configurations.md -require("neodev").setup({ - -- add any options here, or leave empty to use the default settings -}) +-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md local capabilities = require("cmp_nvim_lsp").default_capabilities() capabilities.textDocument.completion.completionItem.snippetSupport = true @@ -10,40 +7,64 @@ capabilities.textDocument.foldingRange = { lineFoldingOnly = true, } local root_file = { - '.eslintrc', - '.eslintrc.js', - '.eslintrc.cjs', - '.eslintrc.yaml', - '.eslintrc.yml', - '.eslintrc.json', - 'eslint.config.js', - 'eslint.config.mjs', - 'eslint.config.cjs', - 'eslint.config.ts', - 'eslint.config.mts', - 'eslint.config.cts', + ".eslintrc", + ".eslintrc.js", + ".eslintrc.cjs", + ".eslintrc.yaml", + ".eslintrc.yml", + ".eslintrc.json", + "eslint.config.js", + "eslint.config.mjs", + "eslint.config.cjs", + "eslint.config.ts", + "eslint.config.mts", + "eslint.config.cts", } -require"lspconfig".eslint.setup({ - capabilities = capabilities, - -- root_dir = function (fname) - -- local rootDir = vim.fs.dirname(vim.fs.find({"package.json", "pnpm-lock.yaml", "node_modules"}, {upward = true})[1]) - -- local eCode = os.execute([[bash -c "ls -alh -- ]].. rootDir ..[[ | grep --perl-regexp .eslintrc\..\{2,4\}\|eslint.config\..\{2,3\}"]]) - -- -- if eCode ~= 0 then - -- -- print("funny") - -- -- return vim.fs.normalize("~/src/estest") - -- -- end - -- local util = require"lspconfig.util" - -- root_file = util.insert_package_json(root_file, 'eslintConfig', fname) - -- local a = util.root_pattern(unpack(root_file))(fname) - -- print(a) - -- return a - -- end, - -- fix format command on attach - on_attach = function (client, bufnr) - vim.keymap.set({"n"}, "", "EslintFixAll", { - buffer = bufnr, - }) - end +require("lspconfig").rust_analyzer.setup({ + settings = { + ["rust-analyzer"] = { + imports = { + granularity = { + group = "module", + }, + prefix = "self", + }, + cargo = { + buildScripts = { + enable = true, + }, + }, + procMacro = { + enable = true, + }, + }, + }, + on_attach = function(client, bufnr) + vim.lsp.inlay_hint.enable(true, { bufnr = bufnr }) + end, + capabilities = capabilities, +}) +require("lspconfig").eslint.setup({ + capabilities = capabilities, + -- root_dir = function (fname) + -- local rootDir = vim.fs.dirname(vim.fs.find({"package.json", "pnpm-lock.yaml", "node_modules"}, {upward = true})[1]) + -- local eCode = os.execute([[bash -c "ls -alh -- ]].. rootDir ..[[ | grep --perl-regexp .eslintrc\..\{2,4\}\|eslint.config\..\{2,3\}"]]) + -- -- if eCode ~= 0 then + -- -- print("funny") + -- -- return vim.fs.normalize("~/src/estest") + -- -- end + -- local util = require"lspconfig.util" + -- root_file = util.insert_package_json(root_file, 'eslintConfig', fname) + -- local a = util.root_pattern(unpack(root_file))(fname) + -- print(a) + -- return a + -- end, + -- fix format command on attach + on_attach = function(client, bufnr) + vim.keymap.set({ "n" }, "", "EslintFixAll", { + buffer = bufnr, + }) + end, }) -- jdtls local function setupJDTLS() @@ -81,11 +102,11 @@ local function setupJDTLS() -- } -- -- vim.list_extend(bundles, vim.split(vim.fn.glob(vim.fn.stdpath 'config' .. '/resources/vscode-java-test-main/server/*.jar', true), '\n')) local function makeandgetpath() - local root = require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'}); - if root == nil then - return "" - end - local path = root .. "/data" + local root = require("jdtls.setup").find_root({ ".git", "mvnw", "gradlew" }) + if root == nil then + return "" + end + local path = root .. "/data" os.execute("mkdir -p " .. path) return path end @@ -144,7 +165,7 @@ end -- }) -- ENDjdtls require("lspconfig").emmet_language_server.setup({ - filetypes = {"css", "scss", "sass", "less", "html"}, + filetypes = { "css", "scss", "sass", "less", "html" }, capabilities = capabilities, }) require("lspconfig").cssls.setup({ @@ -202,9 +223,11 @@ require("lspconfig").kotlin_language_server.setup({ require("lspconfig").lua_ls.setup({ capabilities = capabilities, on_init = function(client) - local path = client.workspace_folders[1].name - if vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc") then - return + if client.workspace_folders then + local path = client.workspace_folders[1].name + if vim.uv.fs_stat(path .. "/.luarc.json") or vim.uv.fs_stat(path .. "/.luarc.jsonc") then + return + end end client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, { @@ -216,20 +239,22 @@ require("lspconfig").lua_ls.setup({ -- Make the server aware of Neovim runtime files workspace = { checkThirdParty = false, - -- or pull in all of 'runtimepath'. NOTE: this is a lot slower - library = vim.api.nvim_get_runtime_file("", true), + library = { + vim.env.VIMRUNTIME, + -- Depending on the usage, you might want to add additional paths here. + -- "${3rd}/luv/library" + -- "${3rd}/busted/library", + }, + -- or pull in all of 'runtimepath'. NOTE: this is a lot slower and will cause issues when working on your own configuration (see https://github.com/neovim/nvim-lspconfig/issues/3189) + -- library = vim.api.nvim_get_runtime_file("", true) }, }) end, settings = { - Lua = { - completion = { - callSnippet = "Replace", - }, - }, + Lua = {}, }, }) - +require("vencord") local luasnip = require("luasnip") local pairs = require("nvim-autopairs.completion.cmp") local cmp = require("cmp") @@ -244,11 +269,11 @@ cmp.setup({ -- [''] = cmp.mapping.scroll_docs(4), -- Down -- C-b (back) C-f (forward) for snippet placeholder navigation. [""] = cmp.mapping.complete(), - [""] = cmp.mapping.confirm({ + [""] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true, }), - [""] = cmp.mapping(function(fallback) + [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif luasnip.expand_or_jumpable() then @@ -268,6 +293,10 @@ cmp.setup({ end, { "i", "s" }), }), sources = { + { + name = "lazydev", + group_index = 0, + }, { name = "nvim_lsp" }, { name = "luasnip" }, { name = "hrsh7th/cmp-nvim-lsp-signature-help" }, diff --git a/lua/setuplualine.lua b/lua/setuplualine.lua index c5c63c3..62b9ccc 100644 --- a/lua/setuplualine.lua +++ b/lua/setuplualine.lua @@ -1,40 +1,47 @@ -require('lualine').setup { - options = { - icons_enabled = true, - theme = 'tokyonight', - component_separators = { left = '', right = ''}, - section_separators = { left = '', right = ''}, - disabled_filetypes = { - statusline = {}, - winbar = {}, - }, - ignore_focus = {}, - always_divide_middle = true, - globalstatus = false, - refresh = { - statusline = 1000, - tabline = 1000, - winbar = 1000, - } - }, - sections = { - lualine_a = {'mode'}, - lualine_b = {'branch', 'diff', 'diagnostics'}, - lualine_c = {'filename'}, - lualine_x = {'encoding', 'fileformat', 'filetype'}, - lualine_y = {'progress'}, - lualine_z = {'location'} - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = {'filename'}, - lualine_x = {'location'}, - lualine_y = {}, - lualine_z = {} - }, - tabline = {}, - winbar = {}, - inactive_winbar = {}, - extensions = {} -} +require("lualine").setup({ + options = { + icons_enabled = true, + theme = "tokyonight", + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + }, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch", "diff", "diagnostics" }, + lualine_c = { + "filename", + }, + lualine_x = { + "%S", + "encoding", + "fileformat", + "filetype", + }, + lualine_y = { "progress" }, + lualine_z = { "location" }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { "filename" }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {}, +}) diff --git a/lua/setupnoice.lua b/lua/setupnoice.lua new file mode 100644 index 0000000..944fb3c --- /dev/null +++ b/lua/setupnoice.lua @@ -0,0 +1,211 @@ +local logged = false; +local function test(a, b) + if logged then return end + vim.notify(vim.inspect(a)) + vim.notify(vim.inspect(b)) + logged = true +end +require("notify").setup({ + max_width = 65, + max_height = 7, + on_open = test +}) +vim.notify = require("notify") +require("noice").setup({ + cmdline = { + enabled = true, -- enables the Noice cmdline UI + view = "cmdline_popup", -- view for rendering the cmdline. Change to `cmdline` to get a classic cmdline at the bottom + opts = {}, -- global options for the cmdline. See section on views + ---@type table + format = { + -- conceal: (default=true) This will hide the text in the cmdline that matches the pattern. + -- view: (default is cmdline view) + -- opts: any options passed to the view + -- icon_hl_group: optional hl_group for the icon + -- title: set to anything or empty string to hide + cmdline = { pattern = "^:", icon = "", lang = "vim" }, + search_down = { kind = "search", pattern = "^/", icon = " ", lang = "regex" }, + search_up = { kind = "search", pattern = "^%?", icon = " ", lang = "regex" }, + filter = { pattern = "^:%s*!", icon = "$", lang = "bash" }, + lua = { pattern = { "^:%s*lua%s+", "^:%s*lua%s*=%s*", "^:%s*=%s*" }, icon = "", lang = "lua" }, + help = { pattern = "^:%s*he?l?p?%s+", icon = "" }, + input = { view = "cmdline_input", icon = "󰥻 " }, -- Used by input() + -- lua = false, -- to disable a format, set to `false` + }, + }, + messages = { + -- NOTE: If you enable messages, then the cmdline is enabled automatically. + -- This is a current Neovim limitation. + enabled = true, -- enables the Noice messages UI + view = "notify", -- default view for messages + view_error = "notify", -- view for errors + view_warn = "notify", -- view for warnings + view_history = "messages", -- view for :messages + view_search = "virtualtext", -- view for search count messages. Set to `false` to disable + }, + popupmenu = { + enabled = true, -- enables the Noice popupmenu UI + ---@type 'nui'|'cmp' + backend = "nui", -- backend to use to show regular cmdline completions + ---@type NoicePopupmenuItemKind|false + -- Icons for completion item kinds (see defaults at noice.config.icons.kinds) + kind_icons = {}, -- set to `false` to disable icons + }, + -- default options for require('noice').redirect + -- see the section on Command Redirection + ---@type NoiceRouteConfig + redirect = { + view = "popup", + filter = { event = "msg_show" }, + }, + -- You can add any custom commands below that will be available with `:Noice command` + ---@type table + commands = { + history = { + -- options for the message history that you get with `:Noice` + view = "split", + opts = { enter = true, format = "details" }, + filter = { + any = { + { event = "notify" }, + { error = true }, + { warning = true }, + { event = "msg_show", kind = { "" } }, + { event = "lsp", kind = "message" }, + }, + }, + }, + -- :Noice last + last = { + view = "popup", + opts = { enter = true, format = "details" }, + filter = { + any = { + { event = "notify" }, + { error = true }, + { warning = true }, + { event = "msg_show", kind = { "" } }, + { event = "lsp", kind = "message" }, + }, + }, + filter_opts = { count = 1 }, + }, + -- :Noice errors + errors = { + -- options for the message history that you get with `:Noice` + view = "popup", + opts = { enter = true, format = "details" }, + filter = { error = true }, + filter_opts = { reverse = true }, + }, + all = { + -- options for the message history that you get with `:Noice` + view = "split", + opts = { enter = true, format = "details" }, + filter = {}, + }, + }, + notify = { + -- Noice can be used as `vim.notify` so you can route any notification like other messages + -- Notification messages have their level and other properties set. + -- event is always "notify" and kind can be any log level as a string + -- The default routes will forward notifications to nvim-notify + -- Benefit of using Noice for this is the routing and consistent history view + enabled = true, + view = "notify", + }, + lsp = { + progress = { + enabled = true, + -- Lsp Progress is formatted using the builtins for lsp_progress. See config.format.builtin + -- See the section on formatting for more details on how to customize. + --- @type NoiceFormat|string + format = "lsp_progress", + --- @type NoiceFormat|string + format_done = "lsp_progress_done", + throttle = 1000 / 30, -- frequency to update lsp progress message + view = "mini", + }, + override = { + -- override the default lsp markdown formatter with Noice + ["vim.lsp.util.convert_input_to_markdown_lines"] = false, + -- override the lsp markdown formatter with Noice + ["vim.lsp.util.stylize_markdown"] = false, + -- override cmp documentation with Noice (needs the other options to work) + ["cmp.entry.get_documentation"] = false, + }, + hover = { + enabled = true, + silent = true, -- set to true to not show a message if hover is not available + view = nil, + ---@type NoiceViewOptions + opts = {}, + }, + signature = { + enabled = true, + auto_open = { + enabled = true, + trigger = true, -- Automatically show signature help when typing a trigger character from the LSP + luasnip = true, -- Will open signature help when jumping to Luasnip insert nodes + throttle = 50, -- Debounce lsp signature help request by 50ms + }, + view = nil, -- when nil, use defaults from documentation + ---@type NoiceViewOptions + opts = {}, -- merged with defaults from documentation + }, + message = { + -- Messages shown by lsp servers + enabled = true, + view = "notify", + opts = {}, + }, + -- defaults for hover and signature help + documentation = { + view = "hover", + ---@type NoiceViewOptions + opts = { + lang = "markdown", + replace = true, + render = "plain", + format = { "{message}" }, + win_options = { concealcursor = "n", conceallevel = 3 }, + }, + }, + }, + markdown = { + hover = { + ["|(%S-)|"] = vim.cmd.help, -- vim help links + ["%[.-%]%((%S-)%)"] = require("noice.util").open, -- markdown links + }, + highlights = { + ["|%S-|"] = "@text.reference", + ["@%S+"] = "@parameter", + ["^%s*(Parameters:)"] = "@text.title", + ["^%s*(Return:)"] = "@text.title", + ["^%s*(See also:)"] = "@text.title", + ["{%S-}"] = "@parameter", + }, + }, + health = { + checker = true, -- Disable if you don't want health checks to run + }, + ---@type NoicePresets + presets = { + -- you can enable a preset by setting it to true, or a table that will override the preset config + -- you can also add custom presets that you can enable/disable with enabled=true + bottom_search = false, -- use a classic bottom cmdline for search + command_palette = false, -- position the cmdline and popupmenu together + long_message_to_split = false, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help + }, + throttle = 1000 / 30, -- how frequently does Noice need to check for ui updates? This has no effect when in blocking mode. + ---@type NoiceConfigViews + views = {}, ---@see section on views + ---@type NoiceRouteConfig[] + routes = {}, --- @see section on routes + ---@type table + status = {}, --- @see section on statusline components + ---@type NoiceFormatOptions + format = {}, --- @see section on formatting +}) diff --git a/lua/setupnotify.lua b/lua/setupnotify.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/setuptabout.lua b/lua/setuptabout.lua index 869b7ab..6ebf595 100644 --- a/lua/setuptabout.lua +++ b/lua/setuptabout.lua @@ -1,11 +1,11 @@ require("tabout").setup({ tabkey = "", -- key to trigger tabout, set to an empty string to disable backwards_tabkey = "", -- key to trigger backwards tabout, set to an empty string to disable - act_as_tab = true, -- shift content if tab out is not possible + act_as_tab = false, -- shift content if tab out is not possible act_as_shift_tab = false, -- reverse shift content if tab out is not possible (if your keyboard/terminal supports ) default_tab = "", -- shift default action (only at the beginning of a line, otherwise is used) default_shift_tab = "", -- reverse shift default action, - enable_backwards = true, -- well ... + enable_backwards = false, -- well ... completion = true, -- if the tabkey is used in a completion pum tabouts = { { open = "'", close = "'" }, @@ -15,6 +15,7 @@ require("tabout").setup({ { open = "[", close = "]" }, { open = "{", close = "}" }, { open = "{", close = "}" }, + { open = "<", close = ">" } }, ignore_beginning = true, --[[ if the cursor is at the beginning of a filled element it will rather tab out than shift the content ]] exclude = {}, -- tabout will ignore these filetypes diff --git a/lua/setupufo.lua b/lua/setupufo.lua index c6a60be..7437652 100644 --- a/lua/setupufo.lua +++ b/lua/setupufo.lua @@ -2,6 +2,7 @@ vim.o.foldcolumn = "1" -- '0' is not bad vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value vim.o.foldlevelstart = 99 vim.o.foldenable = true +vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] -- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself vim.keymap.set("n", "zR", require("ufo").openAllFolds) diff --git a/lua/vencord.lua b/lua/vencord.lua new file mode 100644 index 0000000..2b992f5 --- /dev/null +++ b/lua/vencord.lua @@ -0,0 +1,17 @@ +local lspConfig = require("lspconfig") +local configs = require("lspconfig.configs") + +if not configs.vencord then + configs.vencord = { + default_config = { + cmd = { "/home/meyer/dev/ts/vencord-ls/dist/index.js" }, + filetypes = { "typescript", "typescriptreact" }, + root_dir = function(fname) + return lspConfig.util.find_git_ancestor(fname) + end, + settings = {}, + }, + } +end + +lspConfig.vencord.setup{}