mirror of
https://github.com/boxpositron/absolute-vim.git
synced 2026-02-28 19:50:38 +00:00
feat: added neovim configuration
This commit is contained in:
10
lua/absolute/after/harpoon.lua
Normal file
10
lua/absolute/after/harpoon.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
local mark = require("harpoon.mark")
|
||||
local ui = require("harpoon.ui")
|
||||
|
||||
vim.keymap.set("n", "<leader>a", mark.add_file)
|
||||
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
|
||||
|
||||
vim.keymap.set("n", "<C-1>", function() ui.nav_file(1) end)
|
||||
vim.keymap.set("n", "<C-2>", function() ui.nav_file(2) end)
|
||||
vim.keymap.set("n", "<C-3>", function() ui.nav_file(3) end)
|
||||
vim.keymap.set("n", "<C-4>", function() ui.nav_file(4) end)
|
||||
51
lua/absolute/after/lsp-zero.lua
Normal file
51
lua/absolute/after/lsp-zero.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
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()
|
||||
32
lua/absolute/after/nvim-cmp.lua
Normal file
32
lua/absolute/after/nvim-cmp.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
-- 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
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
-- 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 = {
|
||||
format = lspkind.cmp_format({
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
},
|
||||
})
|
||||
47
lua/absolute/after/nvim-tree.lua
Normal file
47
lua/absolute/after/nvim-tree.lua
Normal file
@@ -0,0 +1,47 @@
|
||||
local nvimtree = require("nvim-tree")
|
||||
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
vim.cmd([[ highlight NvimTreeIndentMarker guifg=#3FC5FF ]])
|
||||
|
||||
vim.cmd([[ highlight NvimTreeFolderArrowClosed guifg=#3FC5FF ]])
|
||||
vim.cmd([[ highlight NvimTreeFolderArrowOpen guifg=#3FC5FF ]])
|
||||
|
||||
nvimtree.setup({
|
||||
view = {
|
||||
width = 45,
|
||||
relativenumber = true,
|
||||
},
|
||||
renderer = {
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
},
|
||||
icons = {
|
||||
glyphs = {
|
||||
|
||||
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 = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
filters = {
|
||||
custom = { ".DS_Store" },
|
||||
},
|
||||
git = {
|
||||
ignore = false,
|
||||
}
|
||||
|
||||
})
|
||||
22
lua/absolute/after/nvim-treesitter.lua
Normal file
22
lua/absolute/after/nvim-treesitter.lua
Normal file
@@ -0,0 +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" },
|
||||
|
||||
-- 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,
|
||||
|
||||
---- 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,
|
||||
},
|
||||
}
|
||||
4
lua/absolute/after/rose-pine.lua
Normal file
4
lua/absolute/after/rose-pine.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
vim.cmd.colorscheme("rose-pine")
|
||||
vim.api.nvim_set_hl(0, "Normal", {bg = "none"})
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", {bg = "none"})
|
||||
|
||||
6
lua/absolute/after/telescope.lua
Normal file
6
lua/absolute/after/telescope.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
|
||||
vim.keymap.set('n', '<leader>ps', function()
|
||||
builtin.grep_string({search = vim.fn.input("Grep > ") });
|
||||
end)
|
||||
1
lua/absolute/after/undotree.lua
Normal file
1
lua/absolute/after/undotree.lua
Normal file
@@ -0,0 +1 @@
|
||||
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
||||
1
lua/absolute/after/vim-fugitive.lua
Normal file
1
lua/absolute/after/vim-fugitive.lua
Normal file
@@ -0,0 +1 @@
|
||||
vim.keymap.set("n", "<leader>gs", vim.cmd.Git);
|
||||
Reference in New Issue
Block a user