This commit is contained in:
sadan 2024-11-17 22:19:14 -05:00
parent ddf45b4e55
commit 1e120b1eb6
No known key found for this signature in database
16 changed files with 604 additions and 130 deletions

View file

@ -13,10 +13,10 @@ vim.keymap.set("n", "<C-f>m", tb.keymaps, {})
vim.keymap.set("n", "<C-f>c", tb.commands, {}) vim.keymap.set("n", "<C-f>c", tb.commands, {})
-- find Documentation -- find Documentation
vim.keymap.set("n", "<C-f>d", tb.man_pages, {}) vim.keymap.set("n", "<C-f>d", tb.man_pages, {})
-- find symbols -- find symbols
vim.keymap.set("n", "<C-f>v", tb.lsp_workspace_symbols, {}) vim.keymap.set("n", "<C-f>v", tb.lsp_workspace_symbols, {})
-- open tree -- open tree
vim.keymap.set({ "i", "n" }, "<C-t>", vim.cmd.NvimTreeFocus, {}) vim.keymap.set({ "n" }, "<C-t>", vim.cmd.NvimTreeFocus, {})
-- move and copy lines -- move and copy lines
vim.keymap.set({ "i", "n" }, "<A-Up>", function() vim.keymap.set({ "i", "n" }, "<A-Up>", function()
vim.api.nvim_feedkeys("ddkP", "x", false) vim.api.nvim_feedkeys("ddkP", "x", false)
@ -30,6 +30,12 @@ end, {})
vim.keymap.set({ "i", "n" }, "<A-S-Down>", function() vim.keymap.set({ "i", "n" }, "<A-S-Down>", function()
vim.api.nvim_feedkeys("yyp", "x", false) vim.api.nvim_feedkeys("yyp", "x", false)
end, {}) end, {})
vim.keymap.set("v", "<A-S-Up>", function ()
vim.api.nvim_feedkeys("yP", "x", false)
end)
vim.keymap.set("v", "<A-S-Down>", function ()
vim.api.nvim_feedkeys("yp", "x", false)
end)
-- toggle function signature -- toggle function signature
vim.keymap.set("i", "<C-S-Space>", function() vim.keymap.set("i", "<C-S-Space>", function()
require("lsp_signature").toggle_float_win() require("lsp_signature").toggle_float_win()
@ -71,10 +77,10 @@ vim.keymap.set("n", "<leader>h", ":%S/", {
vim.keymap.set({ "n", "v" }, "<leader>se", require("nvim-emmet").wrap_with_abbreviation) vim.keymap.set({ "n", "v" }, "<leader>se", require("nvim-emmet").wrap_with_abbreviation)
-- open command line with the path of current buffer already inserted -- open command line with the path of current buffer already inserted
vim.keymap.set("n", "<leader>e", function() vim.keymap.set("n", "<leader>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) vim.api.nvim_feedkeys((":e " .. string.gsub(vim.fn.expand("%"), "(.*/)(.*)", "%1")), "L", false)
end) end)
vim.keymap.set("n", "<leader>c", ":let @+=@\"<CR>") vim.keymap.set("n", "<leader>c", ':let @+=@"<CR>')
-- training -- training
vim.keymap.set("n", "<Left>", ':echoe "Use h"<CR>') vim.keymap.set("n", "<Left>", ':echoe "Use h"<CR>')
vim.keymap.set("n", "<Right>", ':echoe "Use l"<CR>') vim.keymap.set("n", "<Right>", ':echoe "Use l"<CR>')
@ -85,12 +91,44 @@ vim.keymap.set("i", "<Left>", '<ESC>:echoe "Use h"<CR>i')
vim.keymap.set("i", "<Right>", '<ESC>:echoe "Use l"<CR>i') vim.keymap.set("i", "<Right>", '<ESC>:echoe "Use l"<CR>i')
vim.keymap.set("i", "<Up>", '<ESC>:echoe "Use k"<CR>i') vim.keymap.set("i", "<Up>", '<ESC>:echoe "Use k"<CR>i')
vim.keymap.set("i", "<Down>", '<ESC>:echoe "Use j"<CR>i') vim.keymap.set("i", "<Down>", '<ESC>:echoe "Use j"<CR>i')
-- https://stackoverflow.com/questions/1841480/how-to-use-lowercase-marks-as-global-in-vim vim.keymap.set({"n", "v", "i"}, "<MiddleMouse>", "<RightMouse>", {
-- Use lowercase for global marks and uppercase for local marks. noremap = true
local low = function(i) return string.char(97+i) end })
local upp = function(i) return string.char(65+i) end vim.cmd.aunmenu([[PopUp.How-to\ disable\ mouse]])
vim.cmd.aunmenu([[PopUp.Paste]])
for i=0,25 do vim.keymap.set("n", "m"..low(i), "m"..upp(i)) end vim.cmd.aunmenu([[PopUp.Select\ All]])
for i=0,25 do vim.keymap.set("n", "m"..upp(i), "m"..low(i)) end vim.cmd.aunmenu([[PopUp.Inspect]])
for i=0,25 do vim.keymap.set("n", "'"..low(i), "'"..upp(i)) end -- vim.api.nvim_create_autocmd("BufAdd", {
for i=0,25 do vim.keymap.set("n", "'"..upp(i), "'"..low(i)) end -- callback = function(e)
-- vim.keymap.set({"n", "i", "v"}, "<MiddleMouse>", "<NOP>", {
-- buffer = e.buf
-- })
-- end,
-- })
-- vim.api.nvim_create_autocmd("User", {
-- pattern = "BufferLineHoverOver",
-- callback = function(e)
-- print("over")
-- vim.keymap.del({"n", "i", "v"}, "<MiddleMouse>", {
-- buffer = e.buf
-- })
-- end,
-- })
-- vim.api.nvim_create_autocmd("User", {
-- pattern = "BufferLineHoverOut",
-- callback = function(e)
-- print("out")
-- vim.keymap.set({"n", "i", "v"}, "<MiddleMouse>", "<NOP>", {
-- 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

View file

@ -1,5 +1,4 @@
local pkgs = { local pkgs = {
"nixpkgs-fmt",
"jdtls", "jdtls",
"yaml-language-server", "yaml-language-server",
} }

View file

@ -1,18 +1,74 @@
local plugins = { 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", "kylechui/nvim-surround",
version = "*", -- Use for stability; omit to use `main` branch for the latest features version = "*", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy", event = "VeryLazy",
config = function() config = function()
require("nvim-surround").setup({ require("nvim-surround").setup({
keymaps = { keymaps = {
visual = "<leader>s", visual = "<leader>s",
visual_line = "<leader>s" visual_line = "<leader>s",
} },
}) })
end, end,
}, },
{ {
@ -104,15 +160,10 @@ local plugins = {
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
}, },
{ "folke/neodev.nvim", opts = {} },
{ {
"p00f/clangd_extensions.nvim", "p00f/clangd_extensions.nvim",
}, },
{
"folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
opts = {},
},
{ {
"abecodes/tabout.nvim", "abecodes/tabout.nvim",
lazy = false, lazy = false,
@ -190,7 +241,23 @@ local plugins = {
}, },
{ {
"kevinhwang91/nvim-ufo", "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' -- 'mfussenegger/nvim-lint'

View file

@ -7,6 +7,7 @@ vim.opt.shiftwidth = 4
vim.opt.smartcase = true vim.opt.smartcase = true
vim.opt.ignorecase = true vim.opt.ignorecase = true
vim.opt.scrolloff = 6 vim.opt.scrolloff = 6
vim.opt.sloc = "statusline"
-- eregex.vim -- eregex.vim
vim.g.eregex_default_enable = 1 vim.g.eregex_default_enable = 1

View file

@ -1,5 +1,7 @@
require("themesetup") require("themesetup")
vim.cmd([[colorscheme tokyonight]]) vim.cmd([[colorscheme tokyonight]])
require("setupnotify")
require("setupnoice")
require("mason").setup() require("mason").setup()
require("mason-lspconfig").setup() require("mason-lspconfig").setup()
@ -25,5 +27,8 @@ require("setuplualine")
require("setupDiscord") require("setupDiscord")
require('telescope').load_extension('fzf') require('telescope').load_extension('fzf')
require('telescope').load_extension("noice")
require("setupbufferline") require("setupbufferline")
require("setupterminal") require("setupterminal")
require("setuphover")
require("colorizer").setup()

View file

@ -5,10 +5,10 @@ require("presence").setup({
neovim_image_text = "A text editor of all time", -- Text displayed when hovered over the Neovim image 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") main_image = "neovim", -- Main image display (either "neovim" or "file")
client_id = "793271441293967371", -- Use your own Discord application client id (not recommended) 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(<filename>, true)`) debounce_timeout = 5, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`)
enable_line_number = true, -- Displays the current line number instead of the current project 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 = { buttons = {
{ {
label = "Git", label = "Git",

View file

@ -1,8 +1,83 @@
vim.opt.termguicolors = true 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({ require("bufferline").setup({
options = { options = {
mode = "buffers", mode = "buffers",
numbers = "buffer_id", numbers = "buffer_id",
close_command = close,
right_mouse_command = close,
indicator = { indicator = {
-- icon = "| ", -- icon = "| ",
style = "icon", style = "icon",

View file

@ -15,7 +15,7 @@ require("formatter").setup({
require("formatter.filetypes.nix").nixpkgs_fmt, require("formatter.filetypes.nix").nixpkgs_fmt,
function() function()
return { return {
exe = "nixpkgs-fmt", exe = "nixfmt",
stdin = true, stdin = true,
args = {}, args = {},
} }

23
lua/setuphover.lua Normal file
View file

@ -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", "<RightMouse>", h.hover_mouse, {
noremap = true,
})
vim.o.mousemoveevent = true

View file

@ -1,7 +1,4 @@
-- https://github.com/neovim/nvim-lspconfig/blob/master/dloc/server_configurations.md -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
require("neodev").setup({
-- add any options here, or leave empty to use the default settings
})
local capabilities = require("cmp_nvim_lsp").default_capabilities() local capabilities = require("cmp_nvim_lsp").default_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true capabilities.textDocument.completion.completionItem.snippetSupport = true
@ -10,40 +7,64 @@ capabilities.textDocument.foldingRange = {
lineFoldingOnly = true, lineFoldingOnly = true,
} }
local root_file = { local root_file = {
'.eslintrc', ".eslintrc",
'.eslintrc.js', ".eslintrc.js",
'.eslintrc.cjs', ".eslintrc.cjs",
'.eslintrc.yaml', ".eslintrc.yaml",
'.eslintrc.yml', ".eslintrc.yml",
'.eslintrc.json', ".eslintrc.json",
'eslint.config.js', "eslint.config.js",
'eslint.config.mjs', "eslint.config.mjs",
'eslint.config.cjs', "eslint.config.cjs",
'eslint.config.ts', "eslint.config.ts",
'eslint.config.mts', "eslint.config.mts",
'eslint.config.cts', "eslint.config.cts",
} }
require"lspconfig".eslint.setup({ require("lspconfig").rust_analyzer.setup({
capabilities = capabilities, settings = {
-- root_dir = function (fname) ["rust-analyzer"] = {
-- local rootDir = vim.fs.dirname(vim.fs.find({"package.json", "pnpm-lock.yaml", "node_modules"}, {upward = true})[1]) imports = {
-- local eCode = os.execute([[bash -c "ls -alh -- ]].. rootDir ..[[ | grep --perl-regexp .eslintrc\..\{2,4\}\|eslint.config\..\{2,3\}"]]) granularity = {
-- -- if eCode ~= 0 then group = "module",
-- -- print("funny") },
-- -- return vim.fs.normalize("~/src/estest") prefix = "self",
-- -- end },
-- local util = require"lspconfig.util" cargo = {
-- root_file = util.insert_package_json(root_file, 'eslintConfig', fname) buildScripts = {
-- local a = util.root_pattern(unpack(root_file))(fname) enable = true,
-- print(a) },
-- return a },
-- end, procMacro = {
-- fix format command on attach enable = true,
on_attach = function (client, bufnr) },
vim.keymap.set({"n"}, "<A-F>", "<cmd>EslintFixAll<cr>", { },
buffer = bufnr, },
}) on_attach = function(client, bufnr)
end 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" }, "<A-F>", "<cmd>EslintFixAll<cr>", {
buffer = bufnr,
})
end,
}) })
-- jdtls -- jdtls
local function setupJDTLS() 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')) -- -- 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 function makeandgetpath()
local root = require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'}); local root = require("jdtls.setup").find_root({ ".git", "mvnw", "gradlew" })
if root == nil then if root == nil then
return "" return ""
end end
local path = root .. "/data" local path = root .. "/data"
os.execute("mkdir -p " .. path) os.execute("mkdir -p " .. path)
return path return path
end end
@ -144,7 +165,7 @@ end
-- }) -- })
-- ENDjdtls -- ENDjdtls
require("lspconfig").emmet_language_server.setup({ require("lspconfig").emmet_language_server.setup({
filetypes = {"css", "scss", "sass", "less", "html"}, filetypes = { "css", "scss", "sass", "less", "html" },
capabilities = capabilities, capabilities = capabilities,
}) })
require("lspconfig").cssls.setup({ require("lspconfig").cssls.setup({
@ -202,9 +223,11 @@ require("lspconfig").kotlin_language_server.setup({
require("lspconfig").lua_ls.setup({ require("lspconfig").lua_ls.setup({
capabilities = capabilities, capabilities = capabilities,
on_init = function(client) on_init = function(client)
local path = client.workspace_folders[1].name if client.workspace_folders then
if vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc") then local path = client.workspace_folders[1].name
return if vim.uv.fs_stat(path .. "/.luarc.json") or vim.uv.fs_stat(path .. "/.luarc.jsonc") then
return
end
end end
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, { 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 -- Make the server aware of Neovim runtime files
workspace = { workspace = {
checkThirdParty = false, checkThirdParty = false,
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower library = {
library = vim.api.nvim_get_runtime_file("", true), 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, end,
settings = { settings = {
Lua = { Lua = {},
completion = {
callSnippet = "Replace",
},
},
}, },
}) })
require("vencord")
local luasnip = require("luasnip") local luasnip = require("luasnip")
local pairs = require("nvim-autopairs.completion.cmp") local pairs = require("nvim-autopairs.completion.cmp")
local cmp = require("cmp") local cmp = require("cmp")
@ -244,11 +269,11 @@ cmp.setup({
-- ['<C-d>'] = cmp.mapping.scroll_docs(4), -- Down -- ['<C-d>'] = cmp.mapping.scroll_docs(4), -- Down
-- C-b (back) C-f (forward) for snippet placeholder navigation. -- C-b (back) C-f (forward) for snippet placeholder navigation.
["<C-Space>"] = cmp.mapping.complete(), ["<C-Space>"] = cmp.mapping.complete(),
["<CR>"] = cmp.mapping.confirm({ ["<Tab>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = true, select = true,
}), }),
["<Tab>"] = cmp.mapping(function(fallback) ["<CR>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then elseif luasnip.expand_or_jumpable() then
@ -268,6 +293,10 @@ cmp.setup({
end, { "i", "s" }), end, { "i", "s" }),
}), }),
sources = { sources = {
{
name = "lazydev",
group_index = 0,
},
{ name = "nvim_lsp" }, { name = "nvim_lsp" },
{ name = "luasnip" }, { name = "luasnip" },
{ name = "hrsh7th/cmp-nvim-lsp-signature-help" }, { name = "hrsh7th/cmp-nvim-lsp-signature-help" },

View file

@ -1,40 +1,47 @@
require('lualine').setup { require("lualine").setup({
options = { options = {
icons_enabled = true, icons_enabled = true,
theme = 'tokyonight', theme = "tokyonight",
component_separators = { left = '', right = ''}, component_separators = { left = "", right = "" },
section_separators = { left = '', right = ''}, section_separators = { left = "", right = "" },
disabled_filetypes = { disabled_filetypes = {
statusline = {}, statusline = {},
winbar = {}, winbar = {},
}, },
ignore_focus = {}, ignore_focus = {},
always_divide_middle = true, always_divide_middle = true,
globalstatus = false, globalstatus = false,
refresh = { refresh = {
statusline = 1000, statusline = 1000,
tabline = 1000, tabline = 1000,
winbar = 1000, winbar = 1000,
} },
}, },
sections = { sections = {
lualine_a = {'mode'}, lualine_a = { "mode" },
lualine_b = {'branch', 'diff', 'diagnostics'}, lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = {'filename'}, lualine_c = {
lualine_x = {'encoding', 'fileformat', 'filetype'}, "filename",
lualine_y = {'progress'}, },
lualine_z = {'location'} lualine_x = {
}, "%S",
inactive_sections = { "encoding",
lualine_a = {}, "fileformat",
lualine_b = {}, "filetype",
lualine_c = {'filename'}, },
lualine_x = {'location'}, lualine_y = { "progress" },
lualine_y = {}, lualine_z = { "location" },
lualine_z = {} },
}, inactive_sections = {
tabline = {}, lualine_a = {},
winbar = {}, lualine_b = {},
inactive_winbar = {}, lualine_c = { "filename" },
extensions = {} lualine_x = { "location" },
} lualine_y = {},
lualine_z = {},
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {},
})

211
lua/setupnoice.lua Normal file
View file

@ -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<string, CmdlineFormat>
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<string, NoiceCommand>
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<string, NoiceFilter>
status = {}, --- @see section on statusline components
---@type NoiceFormatOptions
format = {}, --- @see section on formatting
})

0
lua/setupnotify.lua Normal file
View file

View file

@ -1,11 +1,11 @@
require("tabout").setup({ require("tabout").setup({
tabkey = "<Tab>", -- key to trigger tabout, set to an empty string to disable tabkey = "<Tab>", -- key to trigger tabout, set to an empty string to disable
backwards_tabkey = "<S-Tab>", -- key to trigger backwards tabout, set to an empty string to disable backwards_tabkey = "<S-Tab>", -- 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 <S-Tab>) act_as_shift_tab = false, -- reverse shift content if tab out is not possible (if your keyboard/terminal supports <S-Tab>)
default_tab = "<C-t>", -- shift default action (only at the beginning of a line, otherwise <TAB> is used) default_tab = "<C-t>", -- shift default action (only at the beginning of a line, otherwise <TAB> is used)
default_shift_tab = "<C-d>", -- reverse shift default action, default_shift_tab = "<C-d>", -- reverse shift default action,
enable_backwards = true, -- well ... enable_backwards = false, -- well ...
completion = true, -- if the tabkey is used in a completion pum completion = true, -- if the tabkey is used in a completion pum
tabouts = { tabouts = {
{ open = "'", close = "'" }, { open = "'", close = "'" },
@ -15,6 +15,7 @@ require("tabout").setup({
{ open = "[", close = "]" }, { open = "[", close = "]" },
{ open = "{", close = "}" }, { 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 ]] 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 exclude = {}, -- tabout will ignore these filetypes

View file

@ -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.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
vim.o.foldlevelstart = 99 vim.o.foldlevelstart = 99
vim.o.foldenable = true 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 -- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself
vim.keymap.set("n", "zR", require("ufo").openAllFolds) vim.keymap.set("n", "zR", require("ufo").openAllFolds)

17
lua/vencord.lua Normal file
View file

@ -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{}