nvim lazy

This commit is contained in:
unintendedfraud
2024-01-10 00:22:40 +01:00
parent f8889da8d8
commit b0c78d7ddf
24 changed files with 927 additions and 11 deletions
+1
View File
@@ -0,0 +1 @@
require("Comment").setup();
+1
View File
@@ -0,0 +1 @@
vim.keymap.set("n", "<leader>gs", vim.cmd.Git);
+10
View 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-h>", function() ui.nav_file(1) end)
vim.keymap.set("n", "<C-t>", function() ui.nav_file(2) end)
vim.keymap.set("n", "<C-n>", function() ui.nav_file(3) end)
vim.keymap.set("n", "<C-s>", function() ui.nav_file(4) end)
+90
View File
@@ -0,0 +1,90 @@
-- Learn the keybindings, see :help lsp-zero-keybindings
-- Learn to configure LSP servers, see :help lsp-zero-api-showcase
local lsp = require("lsp-zero")
lsp.preset({
manage_nvim_cmp = {
set_sources = "lsp",
},
})
lsp.ensure_installed({
"tsserver",
"eslint",
"lua_ls",
"rust_analyzer",
"gopls",
})
local cmp = require("cmp")
local cmp_select = { behaviour = 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.setup_nvim_cmp({
mapping = cmp_mappings,
})
lsp.on_attach(function(client, bufnr)
local opts = { buffer = bufnr, remap = false }
lsp.default_keymaps({ buffer = bufnr })
lsp.buffer_autoformat()
vim.keymap.set("n", "gd", function()
vim.lsp.buf.definition()
end, opts)
vim.keymap.set("n", "gr", function()
vim.lsp.buf.references()
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.diagnostic.open_float()
end, opts)
vim.keymap.set("n", "[d", function()
vim.lsp.diagnostic.goto_next()
end, opts)
vim.keymap.set("n", "]d", function()
vim.lsp.diagnostic.goto_prev()
end, opts)
vim.keymap.set("n", "<leader>vca", function()
vim.lsp.buf.code_action()
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()
vim.diagnostic.config({
virtual_text = true,
signs = false,
update_in_insert = false,
underline = true,
severity_sort = true,
float = {
focusable = false,
style = "minimal",
border = "rounded",
source = "always",
header = "",
prefix = "",
},
})
+8
View File
@@ -0,0 +1,8 @@
require("lualine").setup({
options = {
icons_enabled = false,
theme = "onedark",
component_separators = "|",
section_separators = "",
}
});
+246
View File
@@ -0,0 +1,246 @@
local nvimtree = require('nvim-tree')
-- disable netrw at the very start of your init.lua (strongly advised)
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
require("nvim-tree").setup { -- BEGIN_DEFAULT_OPTS
auto_reload_on_write = true,
disable_netrw = false,
hijack_cursor = false,
hijack_netrw = true,
hijack_unnamed_buffer_when_opening = false,
sort_by = "name",
root_dirs = {},
prefer_startup_root = false,
sync_root_with_cwd = false,
reload_on_bufenter = false,
respect_buf_cwd = true,
on_attach = "default",
remove_keymaps = false,
select_prompts = false,
view = {
centralize_selection = false,
cursorline = true,
debounce_delay = 15,
width = 30,
hide_root_folder = false,
side = "left",
preserve_window_proportions = false,
number = false,
relativenumber = false,
signcolumn = "yes",
mappings = {
custom_only = false,
list = {
-- user mappings go here
},
},
float = {
enable = false,
quit_on_focus_loss = true,
open_win_config = {
relative = "editor",
border = "rounded",
width = 30,
height = 30,
row = 1,
col = 1,
},
},
},
renderer = {
add_trailing = false,
group_empty = true,
highlight_git = false,
full_name = false,
highlight_opened_files = "none",
highlight_modified = "none",
root_folder_label = ":~:s?$?/..?",
indent_width = 2,
indent_markers = {
enable = false,
inline_arrows = true,
icons = {
corner = "└",
edge = "│",
item = "│",
bottom = "─",
none = " ",
},
},
icons = {
webdev_colors = false,
git_placement = "before",
modified_placement = "after",
padding = " ",
symlink_arrow = " ➛ ",
show = {
file = false,
folder = false,
folder_arrow = false,
git = false,
modified = false,
},
glyphs = {
default = " ",
symlink = " ",
bookmark = " ",
modified = "●",
folder = {
arrow_closed = " ",
arrow_open = " ",
default = " ",
open = " ",
empty = " ",
empty_open = " ",
symlink = " ",
symlink_open = " ",
},
git = {
unstaged = "✗",
staged = "✓",
unmerged = "",
renamed = "➜",
untracked = "★",
deleted = "",
ignored = "◌",
},
},
},
special_files = {},
symlink_destination = true,
},
hijack_directories = {
enable = true,
auto_open = true,
},
update_focused_file = {
enable = false,
update_root = false,
ignore_list = {},
},
system_open = {
cmd = "",
args = {},
},
diagnostics = {
enable = false,
show_on_dirs = false,
show_on_open_dirs = true,
debounce_delay = 50,
severity = {
min = vim.diagnostic.severity.HINT,
max = vim.diagnostic.severity.ERROR,
},
icons = {
hint = "",
info = "",
warning = "",
error = "",
},
},
filters = {
dotfiles = false,
git_clean = false,
no_buffer = false,
custom = {},
exclude = {},
},
filesystem_watchers = {
enable = true,
debounce_delay = 50,
ignore_dirs = {},
},
git = {
enable = false,
ignore = true,
show_on_dirs = true,
show_on_open_dirs = true,
timeout = 400,
},
modified = {
enable = false,
show_on_dirs = true,
show_on_open_dirs = true,
},
actions = {
use_system_clipboard = true,
change_dir = {
enable = true,
global = false,
restrict_above_cwd = false,
},
expand_all = {
max_folder_discovery = 300,
exclude = {},
},
file_popup = {
open_win_config = {
col = 1,
row = 1,
relative = "cursor",
border = "shadow",
style = "minimal",
},
},
open_file = {
quit_on_open = false,
resize_window = true,
window_picker = {
enable = true,
picker = "default",
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" },
},
},
},
remove_file = {
close_window = true,
},
},
trash = {
cmd = "gio trash",
},
live_filter = {
prefix = "[FILTER]: ",
always_show_folders = true,
},
tab = {
sync = {
open = false,
close = false,
ignore = {},
},
},
notify = {
threshold = vim.log.levels.INFO,
},
ui = {
confirm = {
remove = true,
trash = true,
},
},
experimental = {
git = {
async = true,
},
},
log = {
enable = false,
truncate = false,
types = {
all = false,
config = false,
copy_paste = false,
dev = false,
diagnostics = false,
git = false,
profile = false,
watcher = false,
},
},
} -- END_DEFAULT_OPTS
@@ -0,0 +1,8 @@
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>pb", builtin.buffers, {})
vim.keymap.set("n", "<leader>pd", builtin.diagnostics, {})
vim.keymap.set("n", "<leader>ps", function()
builtin.grep_string({ search = vim.fn.input("Grep > ") })
end)
@@ -0,0 +1,22 @@
require 'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the four listed parsers should always be installed)
ensure_installed = { "javascript", "typescript", "c", "lua", "vim", "rust", "go" },
-- 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,
highlight = {
-- `false` will disable the whole extension
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- 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
View File
@@ -0,0 +1 @@
require("mimu")
+15
View File
@@ -0,0 +1,15 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"gitsigns": { "branch": "main", "commit": "3e6e91b09f0468c32d3b96dcacf4b947f037ce25" },
"harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
"lush": { "branch": "main", "commit": "e8a58f36c256af65cda36878f6f2024a612154c3" },
"mellifluous.nvim": { "branch": "main", "commit": "d4a52152997907598715d341cad10a4000cf7152" },
"nvim-tree.lua": { "branch": "master", "commit": "b8c3a23e76f861d5f0ff3f6714b9b56388984d0b" },
"nvim-treesitter": { "branch": "master", "commit": "8cd2b230174efbf7b5d9f49fe2f90bda6b5eb16e" },
"plenary": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
"telescope.nvim": { "branch": "master", "commit": "87e92ea31b2b61d45ad044cf7b2d9b66dad2a618" },
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
"vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" }
}
+4
View File
@@ -0,0 +1,4 @@
require("mimu.set")
require("mimu.remap")
require("mimu.lazy")
+14
View File
@@ -0,0 +1,14 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup("mimu.plugins")
+43
View File
@@ -0,0 +1,43 @@
local fzf_make_cmd = "make"
if vim.loop.os_uname().machine == "arm64" then
plenaryzf_make_cmd = " arch -arm64 make"
end
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
return require("lazy").setup({
-- LSP
-- {
-- "VonHeikemen/lsp-zero.nvim",
-- branch = "v1.x",
-- dependencies = {
-- -- LSP Support
-- { "neovim/nvim-lspconfig" }, -- Required
-- { "williamboman/mason.nvim" }, -- Optional
-- { "williamboman/mason-lspconfig.nvim" }, -- Optional
--
-- -- Autocompletion
-- { "hrsh7th/nvim-cmp" }, -- Required
-- { "hrsh7th/cmp-nvim-lsp" }, -- Required
-- { "hrsh7th/cmp-buffer" }, -- Optional
-- { "hrsh7th/cmp-path" }, -- Optional
-- { "saadparwaiz1/cmp_luasnip" }, -- Optional
-- { "hrsh7th/cmp-nvim-lua" }, -- Optional
--
-- -- Snippets
-- { "L3MON4D3/LuaSnip" }, -- Required
-- { "rafamadriz/friendly-snippets" }, -- Optional
-- },
-- },
})
+51
View File
@@ -0,0 +1,51 @@
return {
-- Color scheme
{
"rktjmp/lush.nvim",
name = "lush",
priority = 1000,
},
{
"ramojus/mellifluous.nvim",
dependencies = {
"lush"
},
config = function()
vim.cmd("colorscheme mellifluous")
end,
},
-- telescope
{
"nvim-lua/plenary.nvim",
name = "plenary"
},
-- trouble / diagnostics
{
"folke/trouble.nvim",
config = function()
require("trouble").setup({
icons = false,
})
end
},
-- fugitive / git
{
"lewis6991/gitsigns.nvim",
name = "gitsigns",
},
-- Comment
{
"numToStr/Comment.nvim",
event = "BufRead",
config = function()
require("Comment").setup()
end
},
}
+14
View File
@@ -0,0 +1,14 @@
return {
"tpope/vim-fugitive",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"gitsigns"
},
config = function()
vim.keymap.set("n", "<leader>gs", vim.cmd.Git);
require("gitsigns").setup({
current_line_blame = true,
})
end,
}
+20
View File
@@ -0,0 +1,20 @@
return {
"theprimeagen/harpoon",
event = "BufRead",
dependencies = {
"plenary",
},
config = function()
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-h>", function() ui.nav_file(1) end)
vim.keymap.set("n", "<C-t>", function() ui.nav_file(2) end)
vim.keymap.set("n", "<C-n>", function() ui.nav_file(3) end)
vim.keymap.set("n", "<C-s>", function() ui.nav_file(4) end)
end
}
+13
View File
@@ -0,0 +1,13 @@
return {
"nvim-lualine/lualine.nvim",
config = function()
require("lualine").setup({
options = {
icons_enabled = false,
theme = "onedark",
component_separators = "|",
section_separators = "",
}
});
end
}
+243
View File
@@ -0,0 +1,243 @@
return {
{
"nvim-tree/nvim-tree.lua",
config = function()
-- disable netrw at the very start of your init.lua (strongly advised)
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
require("nvim-tree").setup({
auto_reload_on_write = true,
disable_netrw = false,
hijack_cursor = false,
hijack_netrw = true,
hijack_unnamed_buffer_when_opening = false,
sort_by = "name",
root_dirs = {},
prefer_startup_root = false,
sync_root_with_cwd = false,
reload_on_bufenter = false,
respect_buf_cwd = true,
on_attach = "default",
select_prompts = false,
view = {
centralize_selection = false,
cursorline = true,
debounce_delay = 15,
width = 30,
side = "left",
preserve_window_proportions = false,
number = false,
relativenumber = false,
signcolumn = "yes",
float = {
enable = false,
quit_on_focus_loss = true,
open_win_config = {
relative = "editor",
border = "rounded",
width = 30,
height = 30,
row = 1,
col = 1,
},
},
},
renderer = {
add_trailing = false,
group_empty = true,
highlight_git = false,
full_name = false,
highlight_opened_files = "none",
highlight_modified = "none",
root_folder_label = ":~:s?$?/..?",
indent_width = 2,
indent_markers = {
enable = false,
inline_arrows = true,
icons = {
corner = "└",
edge = "│",
item = "│",
bottom = "─",
none = " ",
},
},
icons = {
webdev_colors = false,
git_placement = "before",
modified_placement = "after",
padding = " ",
symlink_arrow = " ➛ ",
show = {
file = false,
folder = false,
folder_arrow = false,
git = false,
modified = false,
},
glyphs = {
default = " ",
symlink = " ",
bookmark = " ",
modified = "●",
folder = {
arrow_closed = " ",
arrow_open = " ",
default = " ",
open = " ",
empty = " ",
empty_open = " ",
symlink = " ",
symlink_open = " ",
},
git = {
unstaged = "✗",
staged = "✓",
unmerged = "",
renamed = "➜",
untracked = "★",
deleted = "",
ignored = "◌",
},
},
},
special_files = {},
symlink_destination = true,
},
hijack_directories = {
enable = true,
auto_open = true,
},
update_focused_file = {
enable = false,
update_root = false,
ignore_list = {},
},
system_open = {
cmd = "",
args = {},
},
diagnostics = {
enable = false,
show_on_dirs = false,
show_on_open_dirs = true,
debounce_delay = 50,
severity = {
min = vim.diagnostic.severity.HINT,
max = vim.diagnostic.severity.ERROR,
},
icons = {
hint = "",
info = "",
warning = "",
error = "",
},
},
filters = {
dotfiles = false,
git_clean = false,
no_buffer = false,
custom = {},
exclude = {},
},
filesystem_watchers = {
enable = true,
debounce_delay = 50,
ignore_dirs = {},
},
git = {
enable = false,
ignore = true,
show_on_dirs = true,
show_on_open_dirs = true,
timeout = 400,
},
modified = {
enable = false,
show_on_dirs = true,
show_on_open_dirs = true,
},
actions = {
use_system_clipboard = true,
change_dir = {
enable = true,
global = false,
restrict_above_cwd = false,
},
expand_all = {
max_folder_discovery = 300,
exclude = {},
},
file_popup = {
open_win_config = {
col = 1,
row = 1,
relative = "cursor",
border = "shadow",
style = "minimal",
},
},
open_file = {
quit_on_open = false,
resize_window = true,
window_picker = {
enable = true,
picker = "default",
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" },
},
},
},
remove_file = {
close_window = true,
},
},
trash = {
cmd = "gio trash",
},
live_filter = {
prefix = "[FILTER]: ",
always_show_folders = true,
},
tab = {
sync = {
open = false,
close = false,
ignore = {},
},
},
notify = {
threshold = vim.log.levels.INFO,
},
ui = {
confirm = {
remove = true,
trash = true,
},
},
experimental = {
git = {
async = true,
},
},
log = {
enable = false,
truncate = false,
types = {
all = false,
config = false,
copy_paste = false,
dev = false,
diagnostics = false,
git = false,
profile = false,
watcher = false,
},
},
})
end
},
}
+19
View File
@@ -0,0 +1,19 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = {
"plenary"
},
config = function()
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>pb", builtin.buffers, {})
vim.keymap.set("n", "<leader>pd", builtin.diagnostics, {})
vim.keymap.set("n", "<leader>ps", function()
builtin.grep_string({ search = vim.fn.input("Grep > ") })
end)
end
}
+32
View File
@@ -0,0 +1,32 @@
return {
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPost", "BufNewFile" },
build = function()
require("nvim-treesitter.install").update({ with_sync = true })
end,
config = function()
require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all" (the four listed parsers should always be installed)
ensure_installed = { "javascript", "typescript", "c", "lua", "vim", "rust", "go" },
-- 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,
highlight = {
-- `false` will disable the whole extension
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- 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,
},
})
end
}
+34
View File
@@ -0,0 +1,34 @@
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
-- allow to move selected lines up and down
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set("n", "J", "mzJ`z")
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
-- keep search term in the middle
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")
-- paste without losing the copied stuff
vim.keymap.set("x", "<leader>p", "\"_dp")
-- copy to system clipboard instead of vim
vim.keymap.set("n", "<leader>y", "\"+y")
vim.keymap.set("v", "<leader>y", "\"+y")
vim.keymap.set("n", "<leader>Y", "\"+Y")
-- quick fix navigation
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
-- replace in file
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
-- toggle nvim-tree
vim.keymap.set("n", "<C-f>", "<cmd>NvimTreeFindFileToggle<CR>")
+27
View File
@@ -0,0 +1,27 @@
vim.cmd [[autocmd BufWritePre <buffer> lua vim.lsp.buf.format()]]
vim.opt.nu = true
vim.opt.relativenumber = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
-- highlight search
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.termguicolors = true
vim.opt.scrolloff = 10
-- vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50
vim.opt.colorcolumn = "120"
vim.g.mapleader = " "
vim.o.cmdheight = 0