mirror of
https://github.com/boxpositron/absolute-vim.git
synced 2026-02-28 19:50:38 +00:00
feat: updated plugins and editor configuration
This commit is contained in:
20
lua/absolute/after/bufferline.lua
Normal file
20
lua/absolute/after/bufferline.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
require("bufferline").setup {
|
||||
options = {
|
||||
mode = "tabs",
|
||||
separator_style = "slant",
|
||||
}
|
||||
}
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<leader>1", "<cmd>BufferLineGoToBuffer 1<CR>", opts)
|
||||
vim.api.nvim_set_keymap("n", "<leader>2", "<cmd>BufferLineGoToBuffer 2<CR>", opts)
|
||||
vim.api.nvim_set_keymap("n", "<leader>3", "<cmd>BufferLineGoToBuffer 3<CR>", opts)
|
||||
vim.api.nvim_set_keymap("n", "<leader>4", "<cmd>BufferLineGoToBuffer 4<CR>", opts)
|
||||
|
||||
|
||||
-- I want to be to close the current tab with a single keypress
|
||||
vim.api.nvim_set_keymap("n", "<leader>w", "<cmd>tabclose<CR>", opts)
|
||||
|
||||
-- I want to be able to create a new tab with a single keypress
|
||||
vim.api.nvim_set_keymap("n", "<leader>t", "<cmd>tabnew<CR>", opts)
|
||||
8
lua/absolute/after/colorscheme.lua
Normal file
8
lua/absolute/after/colorscheme.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
function SetTheme(color)
|
||||
color = color or "rose-pine"
|
||||
vim.cmd.colorscheme(color)
|
||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||
end
|
||||
|
||||
SetTheme("nightfly")
|
||||
150
lua/absolute/after/lsp-config.lua
Normal file
150
lua/absolute/after/lsp-config.lua
Normal file
@@ -0,0 +1,150 @@
|
||||
-- Setup language servers.
|
||||
local lspconfig = require('lspconfig')
|
||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
local on_attach = function(client, bufnr)
|
||||
opts.buffer = bufnr
|
||||
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
-- vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
|
||||
|
||||
opts.desc = "Go to declaration"
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
|
||||
opts.desc = "Go to definitions"
|
||||
vim.keymap.set('n', 'gd', "<cmd>Telescope lsp_definitions<CR>", opts)
|
||||
|
||||
opts.desc = "Show documentation for what is under cursor"
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
|
||||
opts.desc = "Show LSP Implementation"
|
||||
vim.keymap.set('n', 'gi', "<cmd>Telescope lsp_implementations<CR>", opts)
|
||||
|
||||
opts.desc = "Get Help"
|
||||
vim.keymap.set('n', '<C-h>', vim.lsp.buf.signature_help, opts)
|
||||
|
||||
-- vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
-- vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
-- vim.keymap.set('n', '<leader>wl', function()
|
||||
-- print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
-- end, opts)
|
||||
|
||||
opts.desc = "Show LSP type definitions"
|
||||
vim.keymap.set('n', 'gt', "<cmd>Telescope lsp_type_definitions<CR>", opts)
|
||||
|
||||
opts.desc = "Smart rename"
|
||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
||||
|
||||
opts.desc = "See available code actions"
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>vca', vim.lsp.buf.code_action, opts)
|
||||
|
||||
opts.desc = "Show LSP references"
|
||||
vim.keymap.set('n', '<leader>vrr', "<cmd>Telescope lsp_references<CR>", opts)
|
||||
|
||||
opts.desc = "Format File"
|
||||
vim.keymap.set('n', '<leader>f', function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end, opts)
|
||||
|
||||
opts.desc = "Restart LSP"
|
||||
vim.keymap.set("n", "<leader>rs", "<cmd>LspRestart<CR>", opts)
|
||||
end
|
||||
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
|
||||
-- Change the Diagnostic symbols in the sign column (gutter)
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
|
||||
|
||||
-- configure html server
|
||||
lspconfig["html"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure typescript server with plugin
|
||||
lspconfig["tsserver"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure css server
|
||||
lspconfig["cssls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure tailwindcss server
|
||||
lspconfig["tailwindcss"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure svelte server
|
||||
lspconfig["svelte"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = function(client, bufnr)
|
||||
on_attach(client, bufnr)
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
pattern = { "*.js", "*.ts" },
|
||||
callback = function(ctx)
|
||||
if client.name == "svelte" then
|
||||
client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.file })
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
-- configure emmet language server
|
||||
lspconfig["emmet_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
|
||||
})
|
||||
|
||||
-- configure python server
|
||||
lspconfig["pyright"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig.rust_analyzer.setup({
|
||||
-- Server-specific settings. See `:help lspconfig-setup`
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
['rust-analyzer'] = {},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
||||
-- configure lua server (with special settings)
|
||||
lspconfig["lua_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = { -- custom settings for lua
|
||||
Lua = {
|
||||
-- make the language server recognize "vim" global
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- make language server aware of runtime files
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -1,51 +0,0 @@
|
||||
local lsp = require('lsp-zero')
|
||||
|
||||
|
||||
require("mason").setup();
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"tsserver",
|
||||
"eslint",
|
||||
"rust_analyzer"
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
lsp.preset("recommended")
|
||||
|
||||
|
||||
local cmp = require("cmp")
|
||||
local cmp_select = {behavior = cmp.SelectBehavior.Select}
|
||||
local cmp_mappings = lsp.defaults.cmp_mappings({
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
|
||||
["<C-y>"] = cmp.mapping.confirm({select = true}),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
})
|
||||
|
||||
|
||||
|
||||
lsp.set_preferences({
|
||||
sign_icons = { }
|
||||
})
|
||||
|
||||
|
||||
lsp.on_attach(function(client, bufnr)
|
||||
local opts = {buffer = bufnr, remap = false}
|
||||
|
||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
|
||||
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
|
||||
vim.keymap.set("n", "<leader>vd", function() vim.lsp.buf.open_float() end, opts)
|
||||
vim.keymap.set("n", "[d", function() vim.lsp.buf.goto_next() end, opts)
|
||||
vim.keymap.set("n", "]d", function() vim.lsp.buf.goto_prev() end, opts)
|
||||
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
|
||||
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
|
||||
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
|
||||
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
|
||||
|
||||
|
||||
end)
|
||||
|
||||
|
||||
lsp.setup()
|
||||
65
lua/absolute/after/lualine.lua
Normal file
65
lua/absolute/after/lualine.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
local lualine = require("lualine")
|
||||
local lazy_status = require("lazy.status") -- to configure lazy pending updates count
|
||||
|
||||
local colors = {
|
||||
blue = "#65D1FF",
|
||||
green = "#3EFFDC",
|
||||
violet = "#FF61EF",
|
||||
yellow = "#FFDA7B",
|
||||
red = "#FF4A4A",
|
||||
fg = "#c3ccdc",
|
||||
bg = "#112638",
|
||||
inactive_bg = "#2c3043",
|
||||
}
|
||||
|
||||
local my_lualine_theme = {
|
||||
normal = {
|
||||
a = { bg = colors.blue, fg = colors.bg, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.fg },
|
||||
c = { bg = colors.bg, fg = colors.fg },
|
||||
},
|
||||
insert = {
|
||||
a = { bg = colors.green, fg = colors.bg, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.fg },
|
||||
c = { bg = colors.bg, fg = colors.fg },
|
||||
},
|
||||
visual = {
|
||||
a = { bg = colors.violet, fg = colors.bg, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.fg },
|
||||
c = { bg = colors.bg, fg = colors.fg },
|
||||
},
|
||||
command = {
|
||||
a = { bg = colors.yellow, fg = colors.bg, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.fg },
|
||||
c = { bg = colors.bg, fg = colors.fg },
|
||||
},
|
||||
replace = {
|
||||
a = { bg = colors.red, fg = colors.bg, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.fg },
|
||||
c = { bg = colors.bg, fg = colors.fg },
|
||||
},
|
||||
inactive = {
|
||||
a = { bg = colors.inactive_bg, fg = colors.semilightgray, gui = "bold" },
|
||||
b = { bg = colors.inactive_bg, fg = colors.semilightgray },
|
||||
c = { bg = colors.inactive_bg, fg = colors.semilightgray },
|
||||
},
|
||||
}
|
||||
|
||||
-- configure lualine with modified theme
|
||||
lualine.setup({
|
||||
options = {
|
||||
theme = my_lualine_theme,
|
||||
},
|
||||
sections = {
|
||||
lualine_x = {
|
||||
{
|
||||
lazy_status.updates,
|
||||
cond = lazy_status.has_updates,
|
||||
color = { fg = "#ff9e64" },
|
||||
},
|
||||
{ "encoding" },
|
||||
{ "fileformat" },
|
||||
{ "filetype" },
|
||||
},
|
||||
},
|
||||
})
|
||||
16
lua/absolute/after/mason.lua
Normal file
16
lua/absolute/after/mason.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
require("mason").setup();
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"tsserver",
|
||||
"eslint",
|
||||
"rust_analyzer",
|
||||
"html",
|
||||
"emmet_ls",
|
||||
"lua_ls",
|
||||
"tailwindcss",
|
||||
"svelte",
|
||||
"cssls",
|
||||
"pyright"
|
||||
},
|
||||
automatic_installation = true,
|
||||
})
|
||||
11
lua/absolute/after/mini.lua
Normal file
11
lua/absolute/after/mini.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
local map = require("mini.map")
|
||||
require("mini.map").setup({
|
||||
integrations = {
|
||||
map.gen_integration.builtin_search(),
|
||||
map.gen_integration.gitsigns(),
|
||||
map.gen_integration.diagnostic()
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>mc", map.close)
|
||||
vim.keymap.set("n", "<leader>mo", map.open)
|
||||
@@ -2,31 +2,35 @@ local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
|
||||
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
|
||||
cmp.setup({
|
||||
|
||||
completion = {
|
||||
completeopt = "menu,menuone,preview,noselect",
|
||||
},
|
||||
snippet = { -- configure how nvim-cmp interacts with snippet engine
|
||||
},
|
||||
snippet = { -- configure how nvim-cmp interacts with snippet engine
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
-- sources for autocompletion
|
||||
sources = cmp.config.sources({
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }) -- accept current selection
|
||||
}),
|
||||
-- sources for autocompletion
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" }, -- snippets
|
||||
{ name = "buffer" }, -- text within current buffer
|
||||
{ name = "path" }, -- file system paths
|
||||
}),
|
||||
-- configure lspkind for vs-code like pictograms in completion menu
|
||||
formatting = {
|
||||
{ name = "buffer" }, -- text within current buffer
|
||||
{ name = "path" }, -- file system paths
|
||||
}),
|
||||
-- configure lspkind for vs-code like pictograms in completion menu
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
},
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
@@ -20,28 +20,28 @@ nvimtree.setup({
|
||||
icons = {
|
||||
glyphs = {
|
||||
|
||||
folder = {
|
||||
arrow_closed = "", -- arrow when folder is closed
|
||||
arrow_open = "", -- arrow when folder is open
|
||||
folder = {
|
||||
arrow_closed = "", -- arrow when folder is closed
|
||||
arrow_open = "", -- arrow when folder is open
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
-- disable window_picker for
|
||||
-- explorer to work well with
|
||||
-- window splits
|
||||
actions = {
|
||||
open_file = {
|
||||
window_picker = {
|
||||
-- explorer to work well with
|
||||
-- window splits
|
||||
actions = {
|
||||
open_file = {
|
||||
window_picker = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
filters = {
|
||||
custom = { ".DS_Store" },
|
||||
},
|
||||
},
|
||||
git = {
|
||||
ignore = false,
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
||||
ensure_installed = {"rust", "javascript", "typescript", "python", "c", "lua", "vim", "vimdoc", "query" },
|
||||
require 'nvim-treesitter.configs'.setup {
|
||||
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
||||
ensure_installed = { "rust", "javascript", "typescript", "python", "c", "lua", "vim", "vimdoc", "query" },
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||
auto_install = true,
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||
auto_install = true,
|
||||
|
||||
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
||||
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
||||
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
||||
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
highlight = {
|
||||
enable = true,
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
vim.cmd.colorscheme("rose-pine")
|
||||
vim.api.nvim_set_hl(0, "Normal", {bg = "none"})
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", {bg = "none"})
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
local telescope = require("telescope")
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
|
||||
|
||||
telescope.setup {}
|
||||
|
||||
vim.keymap.set("n", '<leader>pf', builtin.find_files, { desc = "Fuzzy find files in cwd" })
|
||||
vim.keymap.set("n", '<leader>pr', builtin.oldfiles, { desc = "Fuzzy find recent files" })
|
||||
vim.keymap.set("n", '<C-p>', builtin.git_files, { desc = "Fuzzy find files in git in cwd" })
|
||||
vim.keymap.set('n', '<leader>ps', function()
|
||||
builtin.grep_string({search = vim.fn.input("Grep > ") });
|
||||
end)
|
||||
builtin.grep_string({ search = vim.fn.input("Grep > ") });
|
||||
end, { desc = "Find string under cursor in cwd" })
|
||||
|
||||
Reference in New Issue
Block a user