Feat: updated nvim config to use lazy vim and fixed dependencies
This commit is contained in:
parent
897bc92c94
commit
6c156422be
@ -1,42 +1,8 @@
|
||||
require "keymap"
|
||||
require "options"
|
||||
require "plugins"
|
||||
require "lazy-setup"
|
||||
require "vars"
|
||||
|
||||
-- Color Theme
|
||||
vim.cmd [[
|
||||
try
|
||||
colorscheme everforest
|
||||
endtry
|
||||
]]
|
||||
|
||||
-- Mason Setup
|
||||
require("mason").setup({
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "",
|
||||
package_pending = "",
|
||||
package_uninstalled = "",
|
||||
},
|
||||
}
|
||||
})
|
||||
require("mason-lspconfig").setup()
|
||||
require'lspconfig'.clangd.setup{}
|
||||
require'lspconfig'.pylsp.setup{}
|
||||
|
||||
-- Rust Tools Setup
|
||||
local rt = require("rust-tools")
|
||||
rt.setup({
|
||||
server = {
|
||||
on_attach = function(_, bufnr)
|
||||
-- Hover actions
|
||||
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
|
||||
-- Code action groups
|
||||
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
-- LSP Diagnostics Options Setup
|
||||
local sign = function(opts)
|
||||
vim.fn.sign_define(opts.name, {
|
||||
@ -46,10 +12,10 @@ local sign = function(opts)
|
||||
})
|
||||
end
|
||||
|
||||
sign({name = 'DiagnosticSignError', text = ''})
|
||||
sign({name = 'DiagnosticSignWarn', text = ''})
|
||||
sign({name = 'DiagnosticSignHint', text = ''})
|
||||
sign({name = 'DiagnosticSignInfo', text = ''})
|
||||
sign({name = 'DiagnosticSignError', text = ''})
|
||||
sign({name = 'DiagnosticSignWarn', text = ''})
|
||||
sign({name = 'DiagnosticSignHint', text = ''})
|
||||
sign({name = 'DiagnosticSignInfo', text = ''})
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
@ -68,298 +34,3 @@ vim.cmd([[
|
||||
set signcolumn=yes
|
||||
autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false })
|
||||
]])
|
||||
|
||||
-- Completion Plugin Setup
|
||||
local cmp = require'cmp'
|
||||
cmp.setup({
|
||||
-- Enable LSP snippets
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
-- Add tab support
|
||||
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||
['<Tab>'] = cmp.mapping.select_next_item(),
|
||||
['<C-S-f>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<CR>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
})
|
||||
},
|
||||
-- Installed sources:
|
||||
sources = {
|
||||
{ name = 'path' }, -- file paths
|
||||
{ name = 'nvim_lsp', keyword_length = 3 }, -- from language server
|
||||
{ name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized
|
||||
{ name = 'nvim_lua', keyword_length = 2}, -- complete neovim's Lua runtime API such vim.lsp.*
|
||||
{ name = 'buffer', keyword_length = 2 }, -- source current buffer
|
||||
{ name = 'vsnip', keyword_length = 2 }, -- nvim-cmp source for vim-vsnip
|
||||
{ name = 'calc'}, -- source for math calculation
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
formatting = {
|
||||
fields = {'menu', 'abbr', 'kind'},
|
||||
format = function(entry, item)
|
||||
local menu_icon ={
|
||||
nvim_lsp = 'λ',
|
||||
vsnip = '⋗',
|
||||
buffer = 'Ω',
|
||||
path = '🖫',
|
||||
}
|
||||
item.menu = menu_icon[entry.source.name]
|
||||
return item
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
||||
-- Treesitter Plugin Setup
|
||||
--require('nvim-treesitter.configs').setup {
|
||||
-- ensure_installed = { "bash", "c", "cpp", "javascript", "json", "python", "css", "rust", "markdown", "markdown_inline" },
|
||||
-- auto_install = true,
|
||||
-- highlight = {
|
||||
-- enable = true,
|
||||
-- additional_vim_regex_highlighting=false,
|
||||
-- },
|
||||
-- ident = { enable = true },
|
||||
-- rainbow = {
|
||||
-- enable = true,
|
||||
-- extended_mode = true,
|
||||
-- max_file_lines = nil,
|
||||
-- }
|
||||
--}
|
||||
|
||||
-- nvim-tree Setup
|
||||
-- following options are the default
|
||||
-- each of these are documented in `:help nvim-tree.OPTION_NAME`
|
||||
|
||||
local nvimtree = require("nvim-tree")
|
||||
|
||||
nvimtree.setup {
|
||||
on_attach = function(bufnr)
|
||||
local api = require("nvim-tree.api")
|
||||
|
||||
local function opts(desc)
|
||||
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||
end
|
||||
api.config.mappings.default_on_attach(bufnr)
|
||||
vim.keymap.set("n", "<space>", api.node.open.edit, opts("Open"))
|
||||
end,
|
||||
renderer = {
|
||||
icons = {
|
||||
webdev_colors = true,
|
||||
git_placement = "before",
|
||||
padding = " ",
|
||||
symlink_arrow = " ➛ ",
|
||||
show = {
|
||||
file = true,
|
||||
folder = true,
|
||||
folder_arrow = true,
|
||||
git = true,
|
||||
},
|
||||
glyphs = {
|
||||
default = "",
|
||||
symlink = "",
|
||||
git = {
|
||||
unstaged = "",
|
||||
staged = "S",
|
||||
unmerged = "",
|
||||
renamed = "➜",
|
||||
deleted = "",
|
||||
untracked = "U",
|
||||
ignored = "◌",
|
||||
},
|
||||
folder = {
|
||||
default = "",
|
||||
open = "",
|
||||
empty = "",
|
||||
empty_open = "",
|
||||
symlink = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
highlight_git = true,
|
||||
root_folder_modifier = ":t",
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
hijack_directories = {
|
||||
enable = true,
|
||||
auto_open = true,
|
||||
},
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
hijack_cursor = false,
|
||||
update_cwd = true,
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
},
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = true,
|
||||
ignore_list = {},
|
||||
},
|
||||
system_open = {
|
||||
cmd = nil,
|
||||
args = {},
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
custom = {},
|
||||
},
|
||||
git = {
|
||||
enable = true,
|
||||
ignore = true,
|
||||
timeout = 500,
|
||||
},
|
||||
view = {
|
||||
width = 35,
|
||||
side = "left",
|
||||
float = {
|
||||
quit_on_focus_loss = true,
|
||||
},
|
||||
},
|
||||
trash = {
|
||||
cmd = "trash",
|
||||
require_confirm = true,
|
||||
},
|
||||
actions = {
|
||||
open_file = {
|
||||
resize_window = true,
|
||||
quit_on_open = false,
|
||||
window_picker = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Statusline
|
||||
require('lualine').setup {
|
||||
options = { theme = 'everforest' }
|
||||
}
|
||||
|
||||
local status_ok, bufferline = pcall(require, "bufferline")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
require('bufferline').setup {
|
||||
options = {
|
||||
mode = "buffers", -- set to "tabs" to only show tabpages instead
|
||||
style_preset = bufferline.style_preset.default, -- or bufferline.style_preset.minimal,
|
||||
themable = true, -- allows highlight groups to be overriden i.e. sets highlights as default
|
||||
numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string,
|
||||
close_command = "bdelete! %d", -- can be a string | function, | false see "Mouse actions"
|
||||
right_mouse_command = "bdelete! %d", -- can be a string | function | false, see "Mouse actions"
|
||||
left_mouse_command = "buffer %d", -- can be a string | function, | false see "Mouse actions"
|
||||
middle_mouse_command = nil, -- can be a string | function, | false see "Mouse actions"
|
||||
indicator = {
|
||||
icon = '▎', -- this should be omitted if indicator style is not 'icon'
|
||||
style = 'icon', --| 'underline' | 'none',
|
||||
},
|
||||
buffer_close_icon = '',
|
||||
modified_icon = '● ',
|
||||
close_icon = ' ',
|
||||
left_trunc_marker = ' ',
|
||||
right_trunc_marker = ' ',
|
||||
max_name_length = 30,
|
||||
max_prefix_length = 30, -- prefix used when a buffer is de-duplicated
|
||||
truncate_names = true, -- whether or not tab names should be truncated
|
||||
tab_size = 25,
|
||||
diagnostics = "nvim_lsp",
|
||||
diagnostics_update_in_insert = false, -- only applies to coc
|
||||
diagnostics_update_on_event = true, -- use nvim's diagnostic handler
|
||||
-- The diagnostics indicator can be set to nil to keep the buffer name highlight but delete the highlighting
|
||||
offsets = {
|
||||
{
|
||||
filetype = "NvimTree",
|
||||
text = "File Explorer",-- | function ,
|
||||
text_align = "left",-- | "center" | "right"
|
||||
separator = true
|
||||
}
|
||||
},
|
||||
color_icons = true, -- whether or not to add the filetype icon highlights
|
||||
show_buffer_icons = true , -- disable filetype icons for buffers
|
||||
show_buffer_close_icons = true ,
|
||||
show_close_icon = true,
|
||||
show_tab_indicators = true ,
|
||||
show_duplicate_prefix = true , -- whether to show duplicate buffer prefix
|
||||
duplicates_across_groups = true, -- whether to consider duplicate paths in different groups as duplicates
|
||||
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
|
||||
move_wraps_at_ends = false, -- whether or not the move command "wraps" at the first or last position
|
||||
-- can also be a table containing 2 custom separators
|
||||
-- [focused and unfocused]. eg: { '|', '|' }
|
||||
separator_style = "thin", --| "slope" | "thick" | "thin" | { 'any', 'any' },
|
||||
enforce_regular_tabs = true,--| true,
|
||||
always_show_bufferline = true,-- | false,
|
||||
auto_toggle_bufferline = true,-- | false,
|
||||
hover = {
|
||||
enabled = true,
|
||||
delay = 200,
|
||||
reveal = {'close'}
|
||||
},
|
||||
sort_by = 'insert_after_current',
|
||||
}
|
||||
}
|
||||
|
||||
-- Git sign
|
||||
require("gitsigns").setup {
|
||||
signs = {
|
||||
add = { text = '┃' },
|
||||
change = { text = '┃' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
untracked = { text = '┆' },
|
||||
},
|
||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||
watch_gitdir = {
|
||||
interval = 1000,
|
||||
follow_files = true
|
||||
},
|
||||
attach_to_untracked = true,
|
||||
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
||||
delay = 1000,
|
||||
ignore_whitespace = false,
|
||||
},
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil, -- Use default
|
||||
max_file_length = 40000,
|
||||
preview_config = {
|
||||
-- Options passed to nvim_open_win
|
||||
border = 'single',
|
||||
style = 'minimal',
|
||||
relative = 'cursor',
|
||||
row = 0,
|
||||
col = 1
|
||||
},
|
||||
}
|
||||
|
||||
require('telescope').setup{
|
||||
}
|
||||
|
||||
30
nvim/.config/nvim/lazy-lock.json
Normal file
30
nvim/.config/nvim/lazy-lock.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "fd3e882e56956675c620898bf1ffcf4fcbe7ec84" },
|
||||
"cmp-nvim-lua": { "branch": "main", "commit": "e3a22cb071eb9d6508a156306b102c45cd2d573d" },
|
||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||
"cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" },
|
||||
"dashboard-nvim": { "branch": "master", "commit": "0775e567b6c0be96d01a61795f7b64c1758262f6" },
|
||||
"everforest-nvim": { "branch": "main", "commit": "557bce922401e247a596583679bc181d4d688554" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "cdafc320f03f2572c40ab93a4eecb733d4016d07" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "b1d9a914b02ba5660f1e272a03314b31d4576fe2" },
|
||||
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "d97d85e01339f01b842e6ec1502f639b080cb0fc" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "1eda2569394f866360e61f590f1796877388cb8a" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
|
||||
"rustaceanvim": { "branch": "master", "commit": "e9c5aaba16fead831379d5f44617547a90b913c7" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"vim-bbye": { "branch": "master", "commit": "25ef93ac5a87526111f43e5110675032dbcacf56" },
|
||||
"vim-floaterm": { "branch": "master", "commit": "a11b930f55324e9b05e2ef16511fe713f1b456a7" },
|
||||
"vim-vsnip": { "branch": "master", "commit": "9bcfabea653abdcdac584283b5097c3f8760abaa" },
|
||||
"vimtex": { "branch": "master", "commit": "32bcb3922c20588e00de68f73c86312eda2141ad" },
|
||||
"vimwiki": { "branch": "dev", "commit": "72792615e739d0eb54a9c8f7e0a46a6e2407c9e8" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
|
||||
}
|
||||
@ -29,13 +29,20 @@ keymap("n", "<Down>", "<Nop>", opts)
|
||||
keymap("n", "<Left>", "<Nop>", opts)
|
||||
keymap("n", "<Right>", "<Nop>", opts)
|
||||
|
||||
-- Remap some language specific stuff --
|
||||
-- German ISO-DE keyboard friendly mappings --
|
||||
-- On German keyboard, { and } require AltGr+7/0 which is awkward
|
||||
-- These mappings make paragraph navigation much easier
|
||||
keymap("n", "ü", "{", opts)
|
||||
keymap("n", "<C-ü>", "<C-{>", opts)
|
||||
|
||||
keymap("n", "+", "}", opts)
|
||||
keymap("n", "<C-+>", "<C-}>", opts)
|
||||
|
||||
-- Alternative: You could also use ö and ä for other bracket operations
|
||||
-- Uncomment if needed:
|
||||
-- keymap("n", "ö", "[", opts)
|
||||
-- keymap("n", "ä", "]", opts)
|
||||
|
||||
-- Normal --
|
||||
-- Better window navigation
|
||||
keymap("n", "<C-h>", "<C-w>h", opts)
|
||||
@ -45,11 +52,11 @@ keymap("n", "<C-l>", "<C-w>l", opts)
|
||||
|
||||
keymap("n", "<leader>e", ":NvimTreeToggle<cr>", opts)
|
||||
|
||||
-- Resize with arrows
|
||||
keymap("n", "<C-Up>", ":resize -2<CR>", opts)
|
||||
keymap("n", "<C-Down>", ":resize +2<CR>", opts)
|
||||
keymap("n", "<C-Left>", ":vertical resize -2<CR>", opts)
|
||||
keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts)
|
||||
-- Resize with hjkl instead of arrows (stay disciplined!)
|
||||
keymap("n", "<C-S-k>", ":resize -2<CR>", opts)
|
||||
keymap("n", "<C-S-j>", ":resize +2<CR>", opts)
|
||||
keymap("n", "<C-S-h>", ":vertical resize -2<CR>", opts)
|
||||
keymap("n", "<C-S-l>", ":vertical resize +2<CR>", opts)
|
||||
|
||||
-- Navigate buffers
|
||||
keymap("n", "<S-l>", ":bnext<CR>", opts)
|
||||
@ -64,6 +71,12 @@ keymap("n", "<A-k>", "<Esc>:m .-2<CR>==gi", opts)
|
||||
keymap("i", "jk", "<ESC>", opts)
|
||||
|
||||
-- Visual --
|
||||
-- Disable arrow keys in visual mode too
|
||||
keymap("v", "<Up>", "<Nop>", opts)
|
||||
keymap("v", "<Down>", "<Nop>", opts)
|
||||
keymap("v", "<Left>", "<Nop>", opts)
|
||||
keymap("v", "<Right>", "<Nop>", opts)
|
||||
|
||||
-- Stay in indent mode
|
||||
keymap("v", "<", "<gv", opts)
|
||||
keymap("v", ">", ">gv", opts)
|
||||
@ -74,6 +87,12 @@ keymap("v", "<A-k>", ":m .-2<CR>==", opts)
|
||||
keymap("v", "p", '"_dP', opts)
|
||||
|
||||
-- Visual Block --
|
||||
-- Disable arrow keys in visual block mode
|
||||
keymap("x", "<Up>", "<Nop>", opts)
|
||||
keymap("x", "<Down>", "<Nop>", opts)
|
||||
keymap("x", "<Left>", "<Nop>", opts)
|
||||
keymap("x", "<Right>", "<Nop>", opts)
|
||||
|
||||
-- Move text up and down
|
||||
keymap("x", "J", ":move '>+1<CR>gv-gv", opts)
|
||||
keymap("x", "K", ":move '<-2<CR>gv-gv", opts)
|
||||
|
||||
34
nvim/.config/nvim/lua/lazy-setup.lua
Normal file
34
nvim/.config/nvim/lua/lazy-setup.lua
Normal file
@ -0,0 +1,34 @@
|
||||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- Import all plugin specs from lua/plugins/
|
||||
{ import = "plugins" },
|
||||
},
|
||||
install = {
|
||||
colorscheme = { "everforest" },
|
||||
},
|
||||
checker = {
|
||||
enabled = true,
|
||||
notify = false,
|
||||
},
|
||||
change_detection = {
|
||||
notify = false,
|
||||
},
|
||||
})
|
||||
@ -5,6 +5,7 @@ local options = {
|
||||
conceallevel = 0, -- so that `` is visible in markdown files
|
||||
fileencoding = "utf-8", -- the encoding written to a file
|
||||
hlsearch = true, -- highlight all matches on previous search pattern
|
||||
incsearch = true, -- show search matches as you type
|
||||
ignorecase = true, -- ignore case in search patterns
|
||||
mouse = "a", -- allow the mouse to be used in neovim
|
||||
pumheight = 10, -- pop up menu height
|
||||
|
||||
@ -57,7 +57,7 @@ return packer.startup(function(use)
|
||||
use "mason-org/mason.nvim" -- simple to use language server installer
|
||||
use "mason-org/mason-lspconfig.nvim" -- simple to use language server installer
|
||||
|
||||
use 'simrat39/rust-tools.nvim'
|
||||
use 'mrcjkb/rustaceanvim'
|
||||
|
||||
-- Completion framework:
|
||||
use 'hrsh7th/nvim-cmp'
|
||||
10
nvim/.config/nvim/lua/plugins/colorscheme.lua
Normal file
10
nvim/.config/nvim/lua/plugins/colorscheme.lua
Normal file
@ -0,0 +1,10 @@
|
||||
return {
|
||||
{
|
||||
"neanias/everforest-nvim",
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("everforest").setup()
|
||||
vim.cmd([[colorscheme everforest]])
|
||||
end,
|
||||
},
|
||||
}
|
||||
68
nvim/.config/nvim/lua/plugins/completion.lua
Normal file
68
nvim/.config/nvim/lua/plugins/completion.lua
Normal file
@ -0,0 +1,68 @@
|
||||
return {
|
||||
-- Completion framework
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
"hrsh7th/cmp-vsnip",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/vim-vsnip",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require('cmp')
|
||||
cmp.setup({
|
||||
-- Enable LSP snippets
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
-- Add tab support
|
||||
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||
['<Tab>'] = cmp.mapping.select_next_item(),
|
||||
['<C-S-f>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<CR>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
})
|
||||
},
|
||||
-- Installed sources:
|
||||
sources = {
|
||||
{ name = 'path' }, -- file paths
|
||||
{ name = 'nvim_lsp', keyword_length = 3 }, -- from language server
|
||||
{ name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized
|
||||
{ name = 'nvim_lua', keyword_length = 2}, -- complete neovim's Lua runtime API such vim.lsp.*
|
||||
{ name = 'buffer', keyword_length = 2 }, -- source current buffer
|
||||
{ name = 'vsnip', keyword_length = 2 }, -- nvim-cmp source for vim-vsnip
|
||||
{ name = 'calc'}, -- source for math calculation
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
formatting = {
|
||||
fields = {'menu', 'abbr', 'kind'},
|
||||
format = function(entry, item)
|
||||
local menu_icon = {
|
||||
nvim_lsp = 'λ',
|
||||
vsnip = '⋗',
|
||||
buffer = 'Ω',
|
||||
path = '🖫',
|
||||
}
|
||||
item.menu = menu_icon[entry.source.name]
|
||||
return item
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
81
nvim/.config/nvim/lua/plugins/editor.lua
Normal file
81
nvim/.config/nvim/lua/plugins/editor.lua
Normal file
@ -0,0 +1,81 @@
|
||||
return {
|
||||
-- Fuzzy finder
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.8",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
require('telescope').setup{}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Git signs
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
config = function()
|
||||
require("gitsigns").setup {
|
||||
signs = {
|
||||
add = { text = '┃' },
|
||||
change = { text = '┃' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
untracked = { text = '┆' },
|
||||
},
|
||||
signcolumn = true,
|
||||
numhl = false,
|
||||
linehl = false,
|
||||
word_diff = false,
|
||||
watch_gitdir = {
|
||||
interval = 1000,
|
||||
follow_files = true
|
||||
},
|
||||
attach_to_untracked = true,
|
||||
current_line_blame = false,
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = 'eol',
|
||||
delay = 1000,
|
||||
ignore_whitespace = false,
|
||||
},
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil,
|
||||
max_file_length = 40000,
|
||||
preview_config = {
|
||||
border = 'single',
|
||||
style = 'minimal',
|
||||
relative = 'cursor',
|
||||
row = 0,
|
||||
col = 1
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Floating terminal
|
||||
{
|
||||
"voldikss/vim-floaterm",
|
||||
},
|
||||
|
||||
-- VimWiki
|
||||
{
|
||||
"vimwiki/vimwiki",
|
||||
branch = "dev",
|
||||
},
|
||||
|
||||
-- Discord presence
|
||||
{
|
||||
"andweeb/presence.nvim",
|
||||
},
|
||||
|
||||
-- LaTeX support
|
||||
{
|
||||
"lervag/vimtex",
|
||||
},
|
||||
|
||||
-- Better buffer closing
|
||||
{
|
||||
"moll/vim-bbye",
|
||||
},
|
||||
}
|
||||
30
nvim/.config/nvim/lua/plugins/lsp.lua
Normal file
30
nvim/.config/nvim/lua/plugins/lsp.lua
Normal file
@ -0,0 +1,30 @@
|
||||
return {
|
||||
-- Mason: LSP installer
|
||||
{
|
||||
"mason-org/mason.nvim",
|
||||
config = function()
|
||||
require("mason").setup({
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "",
|
||||
package_pending = "",
|
||||
package_uninstalled = "",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- Mason LSP Config bridge
|
||||
{
|
||||
"mason-org/mason-lspconfig.nvim",
|
||||
dependencies = { "mason-org/mason.nvim" },
|
||||
config = function()
|
||||
require("mason-lspconfig").setup()
|
||||
|
||||
-- Setup LSP servers using vim.lsp.config (new API)
|
||||
vim.lsp.config('clangd', {})
|
||||
vim.lsp.config('pylsp', {})
|
||||
end,
|
||||
},
|
||||
}
|
||||
24
nvim/.config/nvim/lua/plugins/rust.lua
Normal file
24
nvim/.config/nvim/lua/plugins/rust.lua
Normal file
@ -0,0 +1,24 @@
|
||||
return {
|
||||
{
|
||||
"mrcjkb/rustaceanvim",
|
||||
version = "^5",
|
||||
lazy = false,
|
||||
ft = { "rust" },
|
||||
config = function()
|
||||
vim.g.rustaceanvim = {
|
||||
server = {
|
||||
on_attach = function(client, bufnr)
|
||||
-- Hover actions
|
||||
vim.keymap.set("n", "<C-space>", function()
|
||||
vim.cmd.RustLsp('hover', 'actions')
|
||||
end, { buffer = bufnr, desc = "Rust hover actions" })
|
||||
-- Code action groups
|
||||
vim.keymap.set("n", "<Leader>a", function()
|
||||
vim.cmd.RustLsp('codeAction')
|
||||
end, { buffer = bufnr, desc = "Rust code actions" })
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
17
nvim/.config/nvim/lua/plugins/treesitter.lua
Normal file
17
nvim/.config/nvim/lua/plugins/treesitter.lua
Normal file
@ -0,0 +1,17 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = { "bash", "c", "cpp", "javascript", "json", "python", "css", "rust", "lua", "markdown", "markdown_inline" },
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = { enable = true },
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
206
nvim/.config/nvim/lua/plugins/ui.lua
Normal file
206
nvim/.config/nvim/lua/plugins/ui.lua
Normal file
@ -0,0 +1,206 @@
|
||||
return {
|
||||
-- File explorer
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
local nvimtree = require("nvim-tree")
|
||||
nvimtree.setup {
|
||||
on_attach = function(bufnr)
|
||||
local api = require("nvim-tree.api")
|
||||
local function opts(desc)
|
||||
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||
end
|
||||
api.config.mappings.default_on_attach(bufnr)
|
||||
vim.keymap.set("n", "<space>", api.node.open.edit, opts("Open"))
|
||||
end,
|
||||
renderer = {
|
||||
icons = {
|
||||
webdev_colors = true,
|
||||
git_placement = "before",
|
||||
padding = " ",
|
||||
symlink_arrow = " ➛ ",
|
||||
show = {
|
||||
file = true,
|
||||
folder = true,
|
||||
folder_arrow = true,
|
||||
git = true,
|
||||
},
|
||||
glyphs = {
|
||||
default = "",
|
||||
symlink = "",
|
||||
git = {
|
||||
unstaged = "",
|
||||
staged = "S",
|
||||
unmerged = "",
|
||||
renamed = "➜",
|
||||
deleted = "",
|
||||
untracked = "U",
|
||||
ignored = "◌",
|
||||
},
|
||||
folder = {
|
||||
default = "",
|
||||
open = "",
|
||||
empty = "",
|
||||
empty_open = "",
|
||||
symlink = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
highlight_git = true,
|
||||
root_folder_modifier = ":t",
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
hijack_directories = {
|
||||
enable = true,
|
||||
auto_open = true,
|
||||
},
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
hijack_cursor = false,
|
||||
update_cwd = true,
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
},
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = true,
|
||||
ignore_list = {},
|
||||
},
|
||||
system_open = {
|
||||
cmd = nil,
|
||||
args = {},
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
custom = {},
|
||||
},
|
||||
git = {
|
||||
enable = true,
|
||||
ignore = true,
|
||||
timeout = 500,
|
||||
},
|
||||
view = {
|
||||
width = 35,
|
||||
side = "left",
|
||||
float = {
|
||||
quit_on_focus_loss = true,
|
||||
},
|
||||
},
|
||||
trash = {
|
||||
cmd = "trash",
|
||||
require_confirm = true,
|
||||
},
|
||||
actions = {
|
||||
open_file = {
|
||||
resize_window = true,
|
||||
quit_on_open = false,
|
||||
window_picker = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Status line
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons", "neanias/everforest-nvim" },
|
||||
config = function()
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
theme = 'everforest',
|
||||
component_separators = { left = '', right = '' },
|
||||
section_separators = { left = '', right = '' },
|
||||
}
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Buffer line
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
local bufferline = require("bufferline")
|
||||
bufferline.setup {
|
||||
options = {
|
||||
mode = "buffers",
|
||||
style_preset = bufferline.style_preset.default,
|
||||
themable = true,
|
||||
numbers = "none",
|
||||
close_command = "bdelete! %d",
|
||||
right_mouse_command = "bdelete! %d",
|
||||
left_mouse_command = "buffer %d",
|
||||
middle_mouse_command = nil,
|
||||
indicator = {
|
||||
icon = '▎',
|
||||
style = 'icon',
|
||||
},
|
||||
buffer_close_icon = '',
|
||||
modified_icon = '● ',
|
||||
close_icon = ' ',
|
||||
left_trunc_marker = ' ',
|
||||
right_trunc_marker = ' ',
|
||||
max_name_length = 30,
|
||||
max_prefix_length = 30,
|
||||
truncate_names = true,
|
||||
tab_size = 25,
|
||||
diagnostics = "nvim_lsp",
|
||||
diagnostics_update_in_insert = false,
|
||||
diagnostics_update_on_event = true,
|
||||
offsets = {
|
||||
{
|
||||
filetype = "NvimTree",
|
||||
text = "File Explorer",
|
||||
text_align = "left",
|
||||
separator = true
|
||||
}
|
||||
},
|
||||
color_icons = true,
|
||||
show_buffer_icons = true,
|
||||
show_buffer_close_icons = true,
|
||||
show_close_icon = true,
|
||||
show_tab_indicators = true,
|
||||
show_duplicate_prefix = true,
|
||||
duplicates_across_groups = true,
|
||||
persist_buffer_sort = true,
|
||||
move_wraps_at_ends = false,
|
||||
separator_style = "thin",
|
||||
enforce_regular_tabs = true,
|
||||
always_show_bufferline = true,
|
||||
auto_toggle_bufferline = true,
|
||||
hover = {
|
||||
enabled = true,
|
||||
delay = 200,
|
||||
reveal = {'close'}
|
||||
},
|
||||
sort_by = 'insert_after_current',
|
||||
}
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Dashboard
|
||||
{
|
||||
"nvimdev/dashboard-nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
require('dashboard').setup {}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Icons
|
||||
{ "nvim-tree/nvim-web-devicons" },
|
||||
}
|
||||
91
nvim/.config/nvim/lua/plugins/which-key.lua
Normal file
91
nvim/.config/nvim/lua/plugins/which-key.lua
Normal file
@ -0,0 +1,91 @@
|
||||
return {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
config = function()
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.setup({
|
||||
plugins = {
|
||||
marks = true,
|
||||
registers = true,
|
||||
spelling = {
|
||||
enabled = true,
|
||||
suggestions = 20,
|
||||
},
|
||||
presets = {
|
||||
operators = true,
|
||||
motions = true,
|
||||
text_objects = true,
|
||||
windows = true,
|
||||
nav = true,
|
||||
z = true,
|
||||
g = true,
|
||||
},
|
||||
},
|
||||
window = {
|
||||
border = "rounded",
|
||||
position = "bottom",
|
||||
margin = { 1, 0, 1, 0 },
|
||||
padding = { 2, 2, 2, 2 },
|
||||
winblend = 0,
|
||||
},
|
||||
layout = {
|
||||
height = { min = 4, max = 25 },
|
||||
width = { min = 20, max = 50 },
|
||||
spacing = 3,
|
||||
align = "left",
|
||||
},
|
||||
})
|
||||
|
||||
-- Register leader key mappings with descriptions
|
||||
wk.add({
|
||||
{ "<leader>e", desc = "Toggle File Explorer" },
|
||||
{ "<leader>q", desc = "Close Buffer" },
|
||||
{ "<leader>w", desc = "Toggle Whitespace" },
|
||||
{ "<leader>f", desc = "Find Files" },
|
||||
{ "<leader>rn", desc = "LSP Rename" },
|
||||
{ "<leader>a", desc = "Code Actions (Rust)" },
|
||||
{ "<leader><leader>f", desc = "Format Code" },
|
||||
})
|
||||
|
||||
-- Register LSP mappings (global, not buffer-specific)
|
||||
wk.add({
|
||||
{ "gD", desc = "Go to Declaration" },
|
||||
{ "gd", desc = "Go to Definition" },
|
||||
{ "gi", desc = "Go to Implementation" },
|
||||
{ "gr", desc = "Find References" },
|
||||
{ "K", desc = "Hover Documentation" },
|
||||
})
|
||||
|
||||
-- Register German keyboard specific mappings
|
||||
wk.add({
|
||||
{ "ü", desc = "Jump to previous paragraph {" },
|
||||
{ "+", desc = "Jump to next paragraph }" },
|
||||
})
|
||||
|
||||
-- Register buffer navigation
|
||||
wk.add({
|
||||
{ "<S-h>", desc = "Previous Buffer" },
|
||||
{ "<S-l>", desc = "Next Buffer" },
|
||||
})
|
||||
|
||||
-- Register Telescope
|
||||
wk.add({
|
||||
{ "<c-t>", desc = "Live Grep" },
|
||||
})
|
||||
|
||||
-- Register Floaterm
|
||||
wk.add({
|
||||
{ "<F7>", desc = "New Float Terminal" },
|
||||
{ "<F8>", desc = "Previous Float Terminal" },
|
||||
{ "<F9>", desc = "Next Float Terminal" },
|
||||
{ "<F12>", desc = "Toggle Float Terminal" },
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user