diff options
Diffstat (limited to 'pkgs/custom-neovim/config/lua/plugins')
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/alpha.lua | 68 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/lspconfig.lua | 91 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/lualine.lua | 88 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/persisted.lua | 3 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/presence.lua | 3 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/snacks.lua | 60 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/tabby.lua | 53 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/telescope.lua | 1 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/which-key.lua | 3 |
9 files changed, 370 insertions, 0 deletions
diff --git a/pkgs/custom-neovim/config/lua/plugins/alpha.lua b/pkgs/custom-neovim/config/lua/plugins/alpha.lua new file mode 100644 index 0000000..f377b0d --- /dev/null +++ b/pkgs/custom-neovim/config/lua/plugins/alpha.lua @@ -0,0 +1,68 @@ +local alpha = require("alpha") +local dashboard = require("alpha.themes.dashboard") + +-- -- Set header +-- dashboard.section.header.val = Art.misc.hydra + +-- -- Set menu +-- dashboard.section.buttons.val = { +-- dashboard.button( "f", " > Find file", ":cd $HOME | Telescope find_files<CR>" ), +-- dashboard.button( "r", " > Find recent file", ":Telescope oldfiles<CR>" ), +-- dashboard.button( "s", " > Load session", ":Telescope persisted<cr>" ), +-- dashboard.button( "l", " > Load last session", ":SessionLoadLast<cr>" ), +-- dashboard.button( "q", " > Quit", ":qa<CR>" ), +-- } + +-- -- Center components. +-- dashboard.section.header.opts.position = "center" +-- dashboard.section.footer.opts.position = "center" + +-- -- Send config to alpha +-- alpha.setup(dashboard.opts) + +require("alpha").setup { + dashboard = { + config = {}, + opts = { + autostart = true + }, + section = { + buttons = { + entries = { { "f", " Find File", "<CMD>Telescope find_files<CR>" }, { "n", " New File", "<CMD>ene!<CR>" }, { "p", " Projects ", "<CMD>Telescope projects<CR>" }, { "r", " Recent files", +":Telescope oldfiles <CR>" }, { "t", " Find Text", "<CMD>Telescope live_grep<CR>" }, { "c", " Configuration", "<CMD>edit /home/lucas/.config/lvim/config.lua <CR>" }, { "q", " Quit", "<CMD>quit<CR>" +} }, + opts = { + hl_shortcut = "Include", + spacing = 1 + } + }, + footer = { + opts = { + hl = "Number", + position = "center" + }, + type = "text", + val = { " ", " lunarvim.org", "release-1.4/neovim-0.9-d15c8d7" } + }, + header = { + opts = { + hl = "Label", + position = "center" + }, + type = "text", + } + } + }, + mode = "dashboard", +} + +-- Set options just for the dashboard. +vim.api.nvim_create_autocmd("BufEnter", { + pattern = "alpha", + callback = function() + vim.opt_local.foldenable = false -- disable folding + vim.opt_local.relativenumber = false + vim.opt_local.number = false + end, +}) + diff --git a/pkgs/custom-neovim/config/lua/plugins/lspconfig.lua b/pkgs/custom-neovim/config/lua/plugins/lspconfig.lua new file mode 100644 index 0000000..445caee --- /dev/null +++ b/pkgs/custom-neovim/config/lua/plugins/lspconfig.lua @@ -0,0 +1,91 @@ +-- vim.keymap.set('n', '<space>d', vim.diagnostic.setloclist, {desc = "Add buffer diagnostics to the location list."}) + +-- Disable semantic tokens to stop weird highlighting. +vim.api.nvim_create_autocmd('LspAttach', { + callback = function(ev) + local client = vim.lsp.get_client_by_id(ev.data.client_id) + if client then + client.server_capabilities.semanticTokensProvider = nil + end + end +}) + +-- Use LspAttach autocommand to only map the following keys +-- after the language server attaches to the current buffer +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + -- Enable completion triggered by <c-x><c-o> + vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + + local keymap = function(mode, key, desc, action) + vim.keymap.set(mode, key, action, {noremap = true, silent = true, desc = desc}) + end + + keymap('n', 'gD', "Go to declaration", vim.lsp.buf.declaration) + keymap('n', 'gd', "Go to definition", vim.lsp.buf.definition) + keymap('n', 'gy', "Go to type definition", vim.lsp.buf.type_definition) + keymap('n', 'gi', "Go to implementation", vim.lsp.buf.implementation) + keymap('n', '<M-k>', "Signature Help", vim.lsp.buf.signature_help) + keymap('i', '<M-k>', "Signature Help", vim.lsp.buf.signature_help) + keymap('n', "<space>o", "Manage LSP workspace", "") + keymap('n', '<space>oa', "Add Workspace Folder", vim.lsp.buf.add_workspace_folder) + keymap('n', '<space>or', "Remove Workspace Folder", vim.lsp.buf.remove_workspace_folder) + keymap('n', '<space>ol', "List Workspace Folders", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end) + keymap('n', '<space>r', "Rename Symbol", vim.lsp.buf.rename) + keymap("n", "<leader>s", "Open symbol picker", ":Telescope lsp_document_symbols<cr>") + keymap("n", "<leader>S", "Open workspace symbol picker", ":Telescope lsp_workspace_symbols<cr>") + + -- LSP Pickers + keymap({'n', 'v'}, "<leader>a", "Perform code action", require("actions-preview").code_actions) + keymap("n", "<leader>D", "Open workspace diagnostic picker", ":Pick diagnostic<cr>") + keymap("n", "<leader>d", "Open diagnostic picker", [[:Pick diagnostic scope="current"<cr>]]) + + keymap('n', 'gr', "Buffer References", vim.lsp.buf.references) + keymap('n', '<localleader>f', "Format Buffer", function() + vim.lsp.buf.format { async = true } + end) + end, +}) + +local lspconfig = require('lspconfig') + +-- Configure individual lsps +lspconfig.nil_ls.setup {} +lspconfig.lua_ls.setup { + 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 + end + + client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, { + runtime = { + -- Tell the language server which version of Lua you're using + -- (most likely LuaJIT in the case of Neovim) + version = 'LuaJIT' + }, + -- Make the server aware of Neovim runtime files + workspace = { + checkThirdParty = false, + 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 + -- library = vim.api.nvim_get_runtime_file("", true) + } + }) + end, + settings = { + Lua = {} + } +} +lspconfig.marksman.setup {} diff --git a/pkgs/custom-neovim/config/lua/plugins/lualine.lua b/pkgs/custom-neovim/config/lua/plugins/lualine.lua new file mode 100644 index 0000000..b38d3ed --- /dev/null +++ b/pkgs/custom-neovim/config/lua/plugins/lualine.lua @@ -0,0 +1,88 @@ +local generate_lualine_theme = function() + local colors = utils.generate_theme_from_lualine() + return { + normal = { + a = {bg = colors.modes.normal, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.background, fg = colors.text.light}, + c = {bg = colors.background, fg = colors.text.light}, + x = {bg = colors.background, fg = colors.text.light}, + y = {bg = colors.background, fg = colors.text.light}, + z = {bg = colors.modes.normal, fg = colors.text.dark, gui = 'bold'}, + }, + insert = { + a = {bg = colors.modes.insert, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.background, fg = colors.text.light}, + c = {bg = colors.background, fg = colors.text.light}, + x = {bg = colors.background, fg = colors.text.light}, + y = {bg = colors.background, fg = colors.text.light}, + z = {bg = colors.modes.insert, fg = colors.text.dark, gui = 'bold'}, + }, + visual = { + a = {bg = colors.modes.visual, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.background, fg = colors.text.light}, + c = {bg = colors.background, fg = colors.text.light}, + x = {bg = colors.background, fg = colors.text.light}, + y = {bg = colors.background, fg = colors.text.light}, + z = {bg = colors.modes.visual, fg = colors.text.dark, gui = 'bold'}, + }, + replace = { + a = {bg = colors.modes.replace, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.background, fg = colors.text.light}, + c = {bg = colors.background, fg = colors.text.light}, + x = {bg = colors.background, fg = colors.text.light}, + y = {bg = colors.background, fg = colors.text.light}, + z = {bg = colors.modes.replace, fg = colors.text.dark, gui = 'bold'}, + }, + command = { + a = {bg = colors.modes.command, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.background, fg = colors.text.light}, + c = {bg = colors.background, fg = colors.text.light}, + x = {bg = colors.background, fg = colors.text.light}, + y = {bg = colors.background, fg = colors.text.light}, + z = {bg = colors.modes.command, fg = colors.text.dark, gui = 'bold'}, + }, + inactive = { + a = {bg = colors.modes.inactive, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.background, fg = colors.text.light}, + c = {bg = colors.background, fg = colors.text.light}, + x = {bg = colors.background, fg = colors.text.light}, + y = {bg = colors.background, fg = colors.text.light}, + z = {bg = colors.modes.inactive, fg = colors.text.dark, gui = 'bold'}, + }, + }; +end + +require('lualine').setup { + options = { + theme = generate_lualine_theme(), + component_separators = "", + section_separators = { left = '', right = '' }, + }, + sections = { + lualine_a = { { 'mode', separator = { left = '', rignt = '' }, right_padding = 2 } }, -- { left = '', rignt = '' } + lualine_b = { 'filename', 'diff' }, + lualine_c = { 'branch' }, + lualine_x = { {'diagnostics', sources = { 'nvim_lsp' } } }, + lualine_y = { 'lsp_status', 'progress' }, + lualine_z = { + { 'location', separator = { left = '', right = '' }, left_padding = 2 }, + }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = { 'filename' }, + lualine_c = {}, + lualine_x = {}, + lualine_y = { 'location' }, + lualine_z = {}, + }, + tabline = {}, + extensions = {}, +} + +-- vim.api.nvim_create_autocmd("ColorScheme", { +-- callback = function() +-- setup_lualine() +-- print "colorscheme changed" +-- end, +-- }) diff --git a/pkgs/custom-neovim/config/lua/plugins/persisted.lua b/pkgs/custom-neovim/config/lua/plugins/persisted.lua new file mode 100644 index 0000000..d3a5814 --- /dev/null +++ b/pkgs/custom-neovim/config/lua/plugins/persisted.lua @@ -0,0 +1,3 @@ +require("persisted").setup() + +require("telescope").load_extension("persisted") diff --git a/pkgs/custom-neovim/config/lua/plugins/presence.lua b/pkgs/custom-neovim/config/lua/plugins/presence.lua new file mode 100644 index 0000000..7ffb57f --- /dev/null +++ b/pkgs/custom-neovim/config/lua/plugins/presence.lua @@ -0,0 +1,3 @@ +require('presence').setup({ + neovim_image_text = "Neovim Text Editor", +}) diff --git a/pkgs/custom-neovim/config/lua/plugins/snacks.lua b/pkgs/custom-neovim/config/lua/plugins/snacks.lua new file mode 100644 index 0000000..324b013 --- /dev/null +++ b/pkgs/custom-neovim/config/lua/plugins/snacks.lua @@ -0,0 +1,60 @@ +require("snacks").setup { + bigfile = { enabled = true }, + picker = { enabled = true }, + dashboard = { + width = 60, + row = nil, -- dashboard position. nil for center + col = nil, -- dashboard position. nil for center + pane_gap = 4, -- empty columns between vertical panes + autokeys = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", -- autokey sequence + -- These settings are used by some built-in sections + preset = { + -- Defaults to a picker that supports `fzf-lua`, `telescope.nvim` and `mini.pick` + ---@type fun(cmd:string, opts:table)|nil + pick = nil, + -- Used by the `keys` section to show keymaps. + -- Set your custom keymaps here. + -- When using a function, the `items` argument are the default keymaps. + ---@type snacks.dashboard.Item[] + keys = { + { icon = " ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" }, + { icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" }, + { icon = " ", key = "g", desc = "Find Text", action = ":lua Snacks.dashboard.pick('live_grep')" }, + { icon = " ", key = "r", desc = "Recent Files", action = ":lua Snacks.dashboard.pick('oldfiles')" }, + { icon = " ", key = "c", desc = "Config", action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})" }, + { icon = " ", key = "q", desc = "Quit", action = ":qa" }, + }, + -- Used by the `header` section + header = table.concat(Art.misc.hydra, "\n"), + }, + -- item field formatters + formats = { + icon = function(item) + if item.file and item.icon == "file" or item.icon == "directory" then + return M.icon(item.file, item.icon) + end + return { item.icon, width = 2, hl = "icon" } + end, + footer = { "%s", align = "center" }, + header = { "%s", align = "center" }, + file = function(item, ctx) + local fname = vim.fn.fnamemodify(item.file, ":~") + fname = ctx.width and #fname > ctx.width and vim.fn.pathshorten(fname) or fname + if #fname > ctx.width then + local dir = vim.fn.fnamemodify(fname, ":h") + local file = vim.fn.fnamemodify(fname, ":t") + if dir and file then + file = file:sub(-(ctx.width - #dir - 2)) + fname = dir .. "/…" .. file + end + end + local dir, file = fname:match("^(.*)/(.+)$") + return dir and { { dir .. "/", hl = "dir" }, { file, hl = "file" } } or { { fname, hl = "file" } } + end, + }, + sections = { + { section = "header" }, + { section = "keys", gap = 1, padding = 1 }, + }, + } +} diff --git a/pkgs/custom-neovim/config/lua/plugins/tabby.lua b/pkgs/custom-neovim/config/lua/plugins/tabby.lua new file mode 100644 index 0000000..211c0c0 --- /dev/null +++ b/pkgs/custom-neovim/config/lua/plugins/tabby.lua @@ -0,0 +1,53 @@ +local general_theme = utils.generate_theme_from_lualine() +local colors = { + current = { fg = general_theme.modes.insert, bg = general_theme.background, style = 'bold'}, + not_current = { fg = general_theme.text.light, bg = general_theme.background }; + fill = { bg = general_theme.background }; +}; +local theme = { + fill = colors.fill, + head = colors.fill, + current_tab = colors.current, + tab = colors.not_current, + win = colors.fill, + tail = colors.fill, +} +require('tabby').setup({ + line = function(line) + return { + { + -- { ' ', hl = theme.head }, + -- line.sep('', theme.head, theme.fill), + }, + line.tabs().foreach(function(tab) + local hl = tab.is_current() and theme.current_tab or theme.tab + return { + line.sep('', hl, theme.fill), + -- tab.is_current() and '' or '', + tab.number(), + tab.name(), + line.sep('', hl, theme.fill), + hl = hl, + margin = ' ', + } + end), + line.spacer(), + line.wins_in_tab(line.api.get_current_tab()).foreach(function(win) + return { + line.sep('', theme.win, theme.fill), + -- win.is_current() and '' or '', + win.buf_name(), + line.sep('', theme.win, theme.fill), + hl = theme.win, + margin = ' ', + } + end), + { + line.sep('', theme.tail, theme.fill), + { ' ', hl = theme.tail }, + }, + hl = theme.fill, + } + end, + -- option = {}, -- setup modules' option, +}) diff --git a/pkgs/custom-neovim/config/lua/plugins/telescope.lua b/pkgs/custom-neovim/config/lua/plugins/telescope.lua new file mode 100644 index 0000000..be3366b --- /dev/null +++ b/pkgs/custom-neovim/config/lua/plugins/telescope.lua @@ -0,0 +1 @@ +require("telescope").setup() diff --git a/pkgs/custom-neovim/config/lua/plugins/which-key.lua b/pkgs/custom-neovim/config/lua/plugins/which-key.lua new file mode 100644 index 0000000..612af14 --- /dev/null +++ b/pkgs/custom-neovim/config/lua/plugins/which-key.lua @@ -0,0 +1,3 @@ +require("which-key").setup { + preset = "modern", +} |
