add nvim configs
This commit is contained in:
22
.config/nvim/lua/plug_init/aerial_init.lua
Normal file
22
.config/nvim/lua/plug_init/aerial_init.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
local wk = require("which-key")
|
||||
require("aerial").setup({
|
||||
lazy_load = true,
|
||||
backends = { "treesitter", "lsp", "markdown", "man" },
|
||||
layout = {
|
||||
-- max_width = {40, 0.2} means "the lesser of 40 columns or 20% of total"
|
||||
max_width = { 40, 0.2 },
|
||||
width = nil,
|
||||
min_width = 10,
|
||||
default_direction = "prefer_right",
|
||||
-- Determines where the aerial window will be opened
|
||||
-- edge - open aerial at the far right/left of the editor
|
||||
-- window - open aerial to the right/left of the current window
|
||||
placement = "edge",
|
||||
resize_to_content = true,
|
||||
},
|
||||
wk.add({
|
||||
{ "{", "<cmd>AerialPrev<CR>", desc = "Jump to prev Symbol" },
|
||||
{ "}", "<cmd>AerialNext<CR>", desc = "Jump to prev Symbol" },
|
||||
{ "<leader>a", "<cmd>AerialToggle!<CR>", desc = "Toggle Outline" },
|
||||
}),
|
||||
})
|
||||
24
.config/nvim/lua/plug_init/color-picker_init.lua
Normal file
24
.config/nvim/lua/plug_init/color-picker_init.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
vim.keymap.set("n", "<C-c>", "<cmd>PickColor<cr>", opts)
|
||||
vim.keymap.set("i", "<C-c>", "<cmd>PickColorInsert<cr>", opts)
|
||||
|
||||
-- vim.keymap.set("n", "your_keymap", "<cmd>ConvertHEXandRGB<cr>", opts)
|
||||
-- vim.keymap.set("n", "your_keymap", "<cmd>ConvertHEXandHSL<cr>", opts)
|
||||
|
||||
require("color-picker").setup({ -- for changing icons & mappings
|
||||
-- ["icons"] = { "ﱢ", "" },
|
||||
-- ["icons"] = { "ﮊ", "" },
|
||||
-- ["icons"] = { "", "ﰕ" },
|
||||
-- ["icons"] = { "", "" },
|
||||
-- ["icons"] = { "", "" },
|
||||
["icons"] = { "ﱢ", "" },
|
||||
["border"] = "rounded", -- none | single | double | rounded | solid | shadow
|
||||
["keymap"] = { -- mapping example:
|
||||
["U"] = "<Plug>ColorPickerSlider5Decrease",
|
||||
["O"] = "<Plug>ColorPickerSlider5Increase",
|
||||
},
|
||||
["background_highlight_group"] = "Normal", -- default
|
||||
["border_highlight_group"] = "FloatBorder", -- default ["text_highlight_group"] = "Normal", --default })
|
||||
})
|
||||
vim.cmd([[hi FloatBorder guibg=NONE]]) -- if you don't want weird border background colors around the popup.
|
||||
52
.config/nvim/lua/plug_init/crates_init.lua
Normal file
52
.config/nvim/lua/plug_init/crates_init.lua
Normal file
@@ -0,0 +1,52 @@
|
||||
local crates = require("crates")
|
||||
local opts = { silent = true }
|
||||
|
||||
vim.keymap.set("n", "<leader>ct", crates.toggle, opts)
|
||||
vim.keymap.set("n", "<leader>cr", crates.reload, opts)
|
||||
|
||||
vim.keymap.set("n", "<leader>cv", crates.show_versions_popup, opts)
|
||||
vim.keymap.set("n", "<leader>cf", crates.show_features_popup, opts)
|
||||
vim.keymap.set("n", "<leader>cd", crates.show_dependencies_popup, opts)
|
||||
|
||||
vim.keymap.set("n", "<leader>cu", crates.update_crate, opts)
|
||||
vim.keymap.set("v", "<leader>cu", crates.update_crates, opts)
|
||||
vim.keymap.set("n", "<leader>ca", crates.update_all_crates, opts)
|
||||
vim.keymap.set("n", "<leader>cU", crates.upgrade_crate, opts)
|
||||
vim.keymap.set("v", "<leader>cU", crates.upgrade_crates, opts)
|
||||
vim.keymap.set("n", "<leader>cA", crates.upgrade_all_crates, opts)
|
||||
|
||||
vim.keymap.set("n", "<leader>cx", crates.expand_plain_crate_to_inline_table, opts)
|
||||
vim.keymap.set("n", "<leader>cX", crates.extract_crate_into_table, opts)
|
||||
|
||||
vim.keymap.set("n", "<leader>cH", crates.open_homepage, opts)
|
||||
vim.keymap.set("n", "<leader>cR", crates.open_repository, opts)
|
||||
vim.keymap.set("n", "<leader>cD", crates.open_documentation, opts)
|
||||
vim.keymap.set("n", "<leader>cC", crates.open_crates_io, opts)
|
||||
|
||||
local wk = require("which-key")
|
||||
wk.add({
|
||||
{
|
||||
mode = { "n" },
|
||||
{ "<leader>c", group = "crates" },
|
||||
{ "<leader>cA", desc = "Upgrade all crates" },
|
||||
{ "<leader>cC", desc = "Open crates.io" },
|
||||
{ "<leader>cD", desc = "Open documentation" },
|
||||
{ "<leader>cH", desc = "Open homepage" },
|
||||
{ "<leader>cR", desc = "Open repository" },
|
||||
{ "<leader>cU", desc = "Upgrade crate" },
|
||||
{ "<leader>cX", desc = "Extract crate into table" },
|
||||
{ "<leader>ca", desc = "Update all crates" },
|
||||
{ "<leader>cd", desc = "Show dependencies popup" },
|
||||
{ "<leader>cf", desc = "Show features popup" },
|
||||
{ "<leader>cr", desc = "Reload" },
|
||||
{ "<leader>ct", desc = "Toggle" },
|
||||
{ "<leader>cu", desc = "Update crate" },
|
||||
{ "<leader>cv", desc = "Show versions popup" },
|
||||
{ "<leader>cx", desc = "Expand plain crate to inline table" },
|
||||
},
|
||||
{
|
||||
mode = { "v" },
|
||||
{ "<leader>cu", desc = "Update crates" },
|
||||
{ "<leader>cU", desc = "Upgrade crates" },
|
||||
},
|
||||
})
|
||||
39
.config/nvim/lua/plug_init/gitsigns.lua
Normal file
39
.config/nvim/lua/plug_init/gitsigns.lua
Normal file
@@ -0,0 +1,39 @@
|
||||
require('gitsigns').setup {
|
||||
signs = {
|
||||
add = { text = '│' },
|
||||
change = { text = '│' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
untracked = { text = '┆' },
|
||||
},
|
||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||
numhl = true, -- Toggle with `:Gitsigns toggle_numhl`
|
||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||
watch_gitdir = {
|
||||
follow_files = true
|
||||
},
|
||||
attach_to_untracked = true,
|
||||
current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
||||
delay = 150,
|
||||
ignore_whitespace = false,
|
||||
virt_text_priority = 100,
|
||||
},
|
||||
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil, -- Use default
|
||||
max_file_length = 40000, -- Disable if file is longer than this (in lines)
|
||||
preview_config = {
|
||||
-- Options passed to nvim_open_win
|
||||
border = 'single',
|
||||
style = 'minimal',
|
||||
relative = 'cursor',
|
||||
row = 0,
|
||||
col = 1
|
||||
},
|
||||
}
|
||||
35
.config/nvim/lua/plug_init/init.lua
Normal file
35
.config/nvim/lua/plug_init/init.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
require("plug_init.vim_init")
|
||||
require("plug_init.lazy_path")
|
||||
require("lazy").setup("plugins")
|
||||
--require("onedarkpro").setup({
|
||||
-- filetypes = {
|
||||
-- all = true
|
||||
-- },
|
||||
-- options = {
|
||||
-- transparency = true
|
||||
-- }
|
||||
--})
|
||||
--require("onedarkpro").load()
|
||||
require("everforest").load()
|
||||
require("plug_init.which_key_init")
|
||||
require("plug_init.lualine_init")
|
||||
require("plug_init.aerial_init")
|
||||
require("plug_init.crates_init")
|
||||
require("plug_init.wilder_init")
|
||||
require("plug_init.telescope_init")
|
||||
require("plug_init.nvim_possession_init")
|
||||
require("plug_init.treesitter_init")
|
||||
--require("plug_init.noice_init")
|
||||
require("plugins.lsp_config")
|
||||
require("plug_init.lsp_init")
|
||||
require("plug_init.smart-open_init")
|
||||
require("plug_init.gitsigns")
|
||||
require("colorizer").setup {
|
||||
'css',
|
||||
'scss',
|
||||
'javascript',
|
||||
html = {
|
||||
mode = 'foreground',
|
||||
}
|
||||
}
|
||||
require("plug_init.color-picker_init")
|
||||
12
.config/nvim/lua/plug_init/lazy_path.lua
Normal file
12
.config/nvim/lua/plug_init/lazy_path.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
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)
|
||||
63
.config/nvim/lua/plug_init/lsp_init.lua
Normal file
63
.config/nvim/lua/plug_init/lsp_init.lua
Normal file
@@ -0,0 +1,63 @@
|
||||
local lsp_zero = require('lsp-zero')
|
||||
lsp_zero.extend_lspconfig()
|
||||
------------
|
||||
|
||||
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'
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', "]d", vim.diagnostic.goto_next)
|
||||
vim.keymap.set('n', '<leader>le', vim.diagnostic.open_float)
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set('n', '<leader>rr', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', '<leader>K', vim.lsp.buf.hover, 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>i', function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
-----------------
|
||||
lsp_zero.on_attach(function(client, bufnr)
|
||||
-- see :help lsp-zero-keybindings
|
||||
-- to learn the available actions
|
||||
lsp_zero.default_keymaps({buffer = bufnr})
|
||||
end)
|
||||
|
||||
require('lspconfig').lua_ls.setup(lsp_zero.nvim_lua_ls())
|
||||
|
||||
require('lspconfig').rust_analyzer.setup{
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
imports = {
|
||||
granularity = {
|
||||
group = "module",
|
||||
},
|
||||
prefix = "self",
|
||||
},
|
||||
cargo = {
|
||||
buildScripts = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
procMacro = {
|
||||
enable = true
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
require('mason').setup({})
|
||||
require('mason-lspconfig').setup({
|
||||
-- Replace the language servers listed here
|
||||
-- with the ones you want to install
|
||||
ensure_installed = {'rust_analyzer', 'ruff', 'quick_lint_js',
|
||||
'html', 'cssls', 'lua_ls', 'vimls'},
|
||||
handlers = {
|
||||
lsp_zero.default_setup,
|
||||
},
|
||||
})
|
||||
84
.config/nvim/lua/plug_init/lualine_init.lua
Normal file
84
.config/nvim/lua/plug_init/lualine_init.lua
Normal file
@@ -0,0 +1,84 @@
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'everforest',
|
||||
component_separators = { left = '', right = '' },
|
||||
--component_separators = { left = '', right = '' },
|
||||
section_separators = { left = '', right = '' },
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = false,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 2000,
|
||||
winbar = 20000,
|
||||
},
|
||||
symbols = {
|
||||
modified = ' ●', -- Text to show when the buffer is modified
|
||||
alternate_file = '#', -- Text to show to identify the alternate file
|
||||
directory = '', -- Text to show when the buffer is a directory
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = { 'branch', 'diff', 'diagnostics' },
|
||||
lualine_c = {
|
||||
-- {
|
||||
-- require("noice").api.status.mode.get,
|
||||
-- cond = require("noice").api.status.mode.has,
|
||||
-- color = { fg = "#ff9e64" },
|
||||
-- },
|
||||
-- {
|
||||
-- require("noice").api.status.search.get,
|
||||
-- cond = require("noice").api.status.search.has,
|
||||
-- color = { fg = "#ff9e64" },
|
||||
-- },
|
||||
},
|
||||
lualine_x = {
|
||||
-- {
|
||||
-- require("noice").api.status.command.get,
|
||||
-- cond = require("noice").api.status.command.has,
|
||||
-- color = { fg = "#ff9e64" },
|
||||
-- },
|
||||
'filesize',
|
||||
'filetype',
|
||||
'require"lsp-status".status()'
|
||||
},
|
||||
lualine_y = { 'searchcount', 'progress' },
|
||||
lualine_z = { 'selectioncount', 'location' },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { 'filename' },
|
||||
lualine_d = {},
|
||||
lualine_x = { 'filesize', 'filetype' },
|
||||
lualine_y = { 'location' },
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {
|
||||
lualine_a = {
|
||||
{
|
||||
'tabs',
|
||||
mode = 2,
|
||||
path = 1,
|
||||
max_length = 60,
|
||||
tab_max_length = 13,
|
||||
use_mode_colors = true,
|
||||
},
|
||||
},
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_d = {},
|
||||
lualine_x = {},
|
||||
lualine_y = { { 'datetime', style = "%H:%M" } },
|
||||
lualine_z = {},
|
||||
},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {}
|
||||
}
|
||||
18
.config/nvim/lua/plug_init/noice_init.lua
Normal file
18
.config/nvim/lua/plug_init/noice_init.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
require("noice").setup({
|
||||
lsp = {
|
||||
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||
-- override = {
|
||||
-- ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
-- ["vim.lsp.util.stylize_markdown"] = true,
|
||||
-- ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
|
||||
-- },
|
||||
},
|
||||
-- you can enable a preset for easier configuration
|
||||
-- presets = {
|
||||
-- --bottom_search = cmdline, -- use a classic bottom cmdline for search
|
||||
-- command_palette = true, -- position the cmdline and popupmenu together
|
||||
-- long_message_to_split = true, -- long messages will be sent to a split
|
||||
-- inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
-- lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||
-- },
|
||||
})
|
||||
21
.config/nvim/lua/plug_init/nvim_possession_init.lua
Normal file
21
.config/nvim/lua/plug_init/nvim_possession_init.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
local possession = require("nvim-possession")
|
||||
local wk = require("which-key")
|
||||
|
||||
require("nvim-possession").setup({
|
||||
autoload = true, -- default false
|
||||
autosave = true,
|
||||
autoswitch = {
|
||||
enable = true
|
||||
},
|
||||
lazy = true,
|
||||
sessions = {
|
||||
sessions_path = "/home/felix/.cache/nvim/sessions/"
|
||||
},
|
||||
wk.add({
|
||||
{ "<leader>s", group="Sessions" },
|
||||
{ "<leader>sl", function() possession.list() end, desc="List sesssions" },
|
||||
{ "<leader>sn", function() possession.new() end, desc="Create new session" },
|
||||
{ "<leader>su", function() possession.update() end, desc="Update Session" },
|
||||
{ "<leader>sd", function() possession.delete() end, desc="Delete Session" },
|
||||
}),
|
||||
})
|
||||
9
.config/nvim/lua/plug_init/smart-open_init.lua
Normal file
9
.config/nvim/lua/plug_init/smart-open_init.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
local wk = require("which-key")
|
||||
|
||||
require("telescope").load_extension("smart_open")
|
||||
require("smart-open").setup({
|
||||
lazy = true,
|
||||
wk.add({
|
||||
{ "<leader><leader>", "<cmd>Telescope smart_open<cr>", desc="Smart open" },
|
||||
})
|
||||
})
|
||||
21
.config/nvim/lua/plug_init/telescope_init.lua
Normal file
21
.config/nvim/lua/plug_init/telescope_init.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
require('telescope').setup({
|
||||
defaults = {
|
||||
sorting_strategy = 'descending',
|
||||
scroll_strategy = 'limit',
|
||||
scroll_speed = 7,
|
||||
layout_strategy = 'vertical',
|
||||
layout_config = {
|
||||
prompt_position = 'top',
|
||||
preview_cutoff = 0,
|
||||
horizontal = {
|
||||
height = 0.9,
|
||||
},
|
||||
vertical = {
|
||||
prompt_position = 'top',
|
||||
height = 0.9,
|
||||
width = 0.8,
|
||||
mirror = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
15
.config/nvim/lua/plug_init/treesitter-context_init.lua
Normal file
15
.config/nvim/lua/plug_init/treesitter-context_init.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
require('treesitter-context').setup{
|
||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||
max_lines = 4, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||
min_window_height = 35, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
|
||||
line_numbers = true,
|
||||
lazy = true,
|
||||
multiline_threshold = 4, -- Maximum number of lines to show for a single context
|
||||
trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
|
||||
mode = 'topline', -- Line used to calculate context. Choices: 'cursor', 'topline'.
|
||||
-- Separator between context and content. Should be a single character string, like '-'.
|
||||
-- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
|
||||
separator = '—',
|
||||
zindex = 20, -- The Z-index of the context window
|
||||
on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching
|
||||
}
|
||||
21
.config/nvim/lua/plug_init/treesitter_init.lua
Normal file
21
.config/nvim/lua/plug_init/treesitter_init.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
require("nvim-treesitter.configs").setup {
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
ensure_installed = {
|
||||
"html",
|
||||
"javascript",
|
||||
"lua",
|
||||
"php",
|
||||
"python",
|
||||
"rust",
|
||||
"typescript",
|
||||
"vim",
|
||||
},
|
||||
}
|
||||
52
.config/nvim/lua/plug_init/vim_init.lua
Normal file
52
.config/nvim/lua/plug_init/vim_init.lua
Normal file
@@ -0,0 +1,52 @@
|
||||
vim.opt.compatible = false
|
||||
vim.opt.showmatch = true
|
||||
vim.opt.hlsearch = true
|
||||
vim.opt.incsearch = false
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.expandtab = true -- spaces not tabs
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.autoindent = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.number = true
|
||||
vim.opt.wildmode = "longest,list"
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.ttyfast = true
|
||||
vim.opt.scrolloff = 5
|
||||
vim.opt.wrap = false
|
||||
vim.opt.mouse = ""
|
||||
vim.opt.termguicolors = true -- enable truecolor
|
||||
vim.opt.undofile = true
|
||||
vim.opt.undodir = os.getenv("HOME").."/.local/share/nvim/undodir"
|
||||
vim.opt.updatetime = 50
|
||||
vim.opt.colorcolumn = "79"
|
||||
vim.opt.cmdheight = 0 -- remove the last interface line under statusline
|
||||
---
|
||||
vim.g.netrw_preview = 1
|
||||
vim.g.netrw_liststyle = 3
|
||||
vim.g.netrw_winsize = 25
|
||||
--
|
||||
--These will:
|
||||
--
|
||||
-- 1. Make vertical splitting the default for previewing files
|
||||
-- 2. Make the default listing style "tree"
|
||||
-- 3. When a vertical preview window is opened, the directory listing
|
||||
-- will use only 30% of the columns available; the rest of the window
|
||||
-- is used for the preview window.
|
||||
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- move highlighted lines up and down, automatic indentation
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||
|
||||
-- replace highlighted area without adding to register
|
||||
vim.keymap.set("x", "<leader>p", "\"_dP")
|
||||
|
||||
-- copy to system clipboard
|
||||
vim.keymap.set("n", "<leader>y", "\"+y")
|
||||
vim.keymap.set("v", "<leader>y", "\"+y")
|
||||
vim.keymap.set("n", "<leader>Y", "\"+Y")
|
||||
|
||||
-- open side panel explorer
|
||||
vim.keymap.set("n", "<leader>e", ":Lexplore<CR>")
|
||||
95
.config/nvim/lua/plug_init/which_key_init.lua
Normal file
95
.config/nvim/lua/plug_init/which_key_init.lua
Normal file
@@ -0,0 +1,95 @@
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.add({
|
||||
{ "<leader>c", group = "crates" },
|
||||
{ "<leader>cA", desc = "Upgrade all crates" },
|
||||
{ "<leader>cC", desc = "Open crates.io" },
|
||||
{ "<leader>cD", desc = "Open documentation" },
|
||||
{ "<leader>cH", desc = "Open homepage" },
|
||||
{ "<leader>cR", desc = "Open repository" },
|
||||
{ "<leader>cU", desc = "Upgrade crate" },
|
||||
{ "<leader>cX", desc = "Extract crate into table" },
|
||||
{ "<leader>ca", desc = "Update all crates" },
|
||||
{ "<leader>cd", desc = "Show dependencies popup" },
|
||||
{ "<leader>cf", desc = "Show features popup" },
|
||||
{ "<leader>cr", desc = "Reload" },
|
||||
{ "<leader>ct", desc = "Toggle" },
|
||||
{ "<leader>cu", desc = "Update crate" },
|
||||
{ "<leader>cv", desc = "Show versions popup" },
|
||||
{ "<leader>cx", desc = "Expand plain crate to inline table" },
|
||||
|
||||
{ "<leader>f", group = "Telescope" },
|
||||
{ "<leader>fb", "<cmd>Telescope buffers<cr>", desc = "Find Buffer" },
|
||||
{ "<leader>fd", "<cmd>Telescope lsp_document_symbols<cr>", desc = "Find LSP Symbols" },
|
||||
{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find File" },
|
||||
{ "<leader>fh", "<cmd>Telescope help_tags<cr>", desc = "Find Help" },
|
||||
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Open Recent File", remap = true },
|
||||
{ "<leader>fs", "<cmd>Telescope live_grep<cr>", desc = "Live Grep" },
|
||||
{ "<leader>fw", "<cmd>Telescope grep_string<cr>", desc = "Find string under cursor" },
|
||||
|
||||
{ "<leader>g", group = "Gitsigns" },
|
||||
{ "<leader>gB", "<cmd>Gitsigns blame<cr>", desc = "Toggle Blame Sidebar" },
|
||||
{ "<leader>gb", "<cmd>Gitsigns blameline<cr>", desc = "Show Blame Inline" },
|
||||
{ "<leader>gh", group = "hunks" },
|
||||
{ "<leader>ghl", "<cmd>Gitsigns setloclist<cr>", desc = "List file Changes" },
|
||||
{ "<leader>ghn", "<cmd>Gitsigns nav_hunk<cr>", desc = "Nav Hunk" },
|
||||
{ "<leader>gr", group = "reset" },
|
||||
{ "<leader>grb", "<cmd>Gitsigns reset_buffer<cr>", desc = "Reset Buffer" },
|
||||
{ "<leader>grh", "<cmd>Gitsigns reset_hunk<cr>", desc = "Reset Hunk" },
|
||||
{ "<leader>gd", "<cmd>Gitsigns toggle_deleted<cr>", desc = "Toggle deleted lines" },
|
||||
{ "<leader>gs", group = "stage" },
|
||||
{ "<leader>gsb", "<cmd>Gitsigns stage_buffer<cr>", desc = "Stage Buffer" },
|
||||
{ "<leader>gsh", "<cmd>Gitsigns stage_hunk<cr>", desc = "Stage Hunk" },
|
||||
{ "<leader>gu", "<cmd>Gitsigns undo_stage_hunk<cr>", desc = "Undo Stage Hunk" },
|
||||
|
||||
{ "<leader>i", desc = "Auto format file with linter(?), also on F3" },
|
||||
{ "<leader>le", desc = "Open diagnostic float" },
|
||||
{ "<leader>K", desc = "Show definition" },
|
||||
{ "<leader>n", "<cmd>nohl<cr>", desc = "Stop highlighting search results" },
|
||||
|
||||
{ "<leader>r", group = "Rename" },
|
||||
{ "<leader>rr", desc = "Rename Variable" },
|
||||
|
||||
{ "<leader>s", group = "Sessions" },
|
||||
{ "<leader>sd", desc = "Delete Session" },
|
||||
{ "<leader>sl", desc = "Load Session" },
|
||||
{ "<leader>sn", desc = "New Session" },
|
||||
{ "<leader>su", desc = "Update Session" },
|
||||
|
||||
{ "<leader>t", group = "tabs" },
|
||||
{ "<leader>ta", "<cmd>tabnew<cr>", desc = "Add new Tab" },
|
||||
{ "<leader>tc", "<cmd>tabclose<cr>", desc = "Close Tab" },
|
||||
{ "<leader>tf", "<cmd>tabfirst<cr>", desc = "First Tab" },
|
||||
{ "<leader>tl", "<cmd>tablast<cr>", desc = "Last Tab" },
|
||||
{ "<leader>tm", group = "Move Tab" },
|
||||
{ "<leader>tmf", "<cmd>tabmove 0<cr>", desc = "Move Tab to First" },
|
||||
{ "<leader>tmi", ":tabmove ", desc = "Input position to move Tab to" },
|
||||
{ "<leader>tml", "<cmd>tabmove $<cr>", desc = "Move Tab to Last" },
|
||||
{ "<leader>tn", "<cmd>tabnext<cr>", desc = "Next Tab" },
|
||||
{ "<leader>tp", "<cmd>tabprevious<cr>", desc = "Previous Tab" },
|
||||
|
||||
{ "<leader>u", desc = "Toggle undo-tree" },
|
||||
{ "<leader>w", group = "Workspaces + Whichkey" },
|
||||
{ "<leader>wa", desc = "Add workspace folder" },
|
||||
{ "<leader>wr", desc = "Remove workspace folder" },
|
||||
{ "<leader>ww", "<cmd>WhichKey<cr>", desc = "Show keybindings" },
|
||||
{ "<leader>y", desc = "Copy to system clipboard" },
|
||||
{ "<leader>Y", desc = "Copy line to system clipboard" },
|
||||
})
|
||||
|
||||
wk.add({
|
||||
{ "K", desc = "Show definition" },
|
||||
{ "[", group = "jump backward" },
|
||||
{ "[c", desc = "Previous diff change" },
|
||||
{ "[d", desc = "Previous Diagnostic" },
|
||||
{ "[h", "<cmd>Gitsigns prev_hunk<cr><cr>", desc = "Previous changed git block" },
|
||||
{ "]", group = "jump forward" },
|
||||
{ "]c", desc = "Next diff change" },
|
||||
{ "]d", desc = "Next Diagnostic" },
|
||||
{ "]h", "<cmd>Gitsigns next_hunk<cr><cr>", desc = "Next changed git block" },
|
||||
{ "g", group = "lsp functions" },
|
||||
{ "gD", desc = "go to declaration" },
|
||||
{ "gd", desc = "go to definition" },
|
||||
{ "gi", desc = "show implementations" },
|
||||
{ "gr", desc = "list all references to symbol under cursor" },
|
||||
})
|
||||
107
.config/nvim/lua/plug_init/which_key_init.lua.old
Normal file
107
.config/nvim/lua/plug_init/which_key_init.lua.old
Normal file
@@ -0,0 +1,107 @@
|
||||
local wk = require("which-key")
|
||||
|
||||
local mappings = {
|
||||
f = {
|
||||
name = "Telescope", --optional group name
|
||||
b = { "<cmd>Telescope buffers<cr>", "Find Buffer" },
|
||||
f = { "<cmd>Telescope find_files<cr>", "Find File" },
|
||||
s = { "<cmd>Telescope live_grep<cr>", "Live Grep" },
|
||||
h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
|
||||
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File", noremap = false },
|
||||
w = { "<cmd>Telescope grep_string<cr>", "Find string under cursor" },
|
||||
d = { "<cmd>Telescope lsp_document_symbols<cr>", "Find LSP Symbols" },
|
||||
-- does not work as of now: --i = { "<cmd>AdvancedGitSearch<cr>", "Git Search" },
|
||||
--n = { "New File" }, --just a label, don't create any mapping
|
||||
--e = "Edit File", --same as above
|
||||
},
|
||||
t = {
|
||||
name = "tabs",
|
||||
n = { "<cmd>tabnext<cr>", "Next Tab" },
|
||||
p = { "<cmd>tabprevious<cr>", "Previous Tab" },
|
||||
f = { "<cmd>tabfirst<cr>", "First Tab" },
|
||||
l = { "<cmd>tablast<cr>", "Last Tab" },
|
||||
a = { "<cmd>tabnew<cr>", "Add new Tab" },
|
||||
c = { "<cmd>tabclose<cr>", "Close Tab" },
|
||||
m = {
|
||||
name = "Move Tab",
|
||||
f = { "<cmd>tabmove 0<cr>", "Move Tab to First" },
|
||||
l = { "<cmd>tabmove $<cr>", "Move Tab to Last" },
|
||||
i = { ":tabmove ", "Input position to move Tab to" },
|
||||
}
|
||||
},
|
||||
K = { "Show definition" },
|
||||
u = { "Toggle undo-tree" },
|
||||
i = { "Auto format file with linter(?), also on F3" },
|
||||
r = {
|
||||
name = "Rename",
|
||||
r = { "Rename Variable" }
|
||||
},
|
||||
l = {
|
||||
e = { "Open diagnostic float" }
|
||||
},
|
||||
w = {
|
||||
name = "Workspaces + Whichkey",
|
||||
a = { "Add workspace folder" },
|
||||
r = { "Remove workspace folder" },
|
||||
w = { "<cmd>WhichKey<cr>", "Show keybindings" },
|
||||
},
|
||||
s = {
|
||||
name = "Sessions",
|
||||
n = { "New Session" },
|
||||
u = { "Update Session" },
|
||||
d = { "Delete Session" },
|
||||
l = { "Load Session" },
|
||||
},
|
||||
g = {
|
||||
name = "Gitsigns",
|
||||
b = { "<cmd>Gitsigns blameline<cr>", "Show Blame Inline" },
|
||||
B = { "<cmd>Gitsigns blame<cr>", "Toggle Blame Sidebar" },
|
||||
s = {
|
||||
name = "stage",
|
||||
h = { "<cmd>Gitsigns stage_hunk<cr>", "Stage Hunk"},
|
||||
b = { "<cmd>Gitsigns stage_buffer<cr>", "Stage Buffer"},
|
||||
},
|
||||
h = {
|
||||
name = "hunks",
|
||||
l = { "<cmd>Gitsigns setloclist<cr>", "List file Changes" },
|
||||
n = { "<cmd>Gitsigns nav_hunk<cr>", "Nav Hunk"},
|
||||
},
|
||||
r = {
|
||||
name = "reset",
|
||||
h = { "<cmd>Gitsigns reset_hunk<cr>", "Reset Hunk"},
|
||||
b = { "<cmd>Gitsigns reset_buffer<cr>", "Reset Buffer"},
|
||||
},
|
||||
u = { "<cmd>Gitsigns undo_stage_hunk<cr>", "Undo Stage Hunk"},
|
||||
},
|
||||
n = { "<cmd>nohl<cr>", "Stop highlighting search results" },
|
||||
}
|
||||
|
||||
local opts = {
|
||||
mode = "n",
|
||||
prefix = '<leader>'
|
||||
}
|
||||
|
||||
wk.register({ mappings, opts, prefix = "<leader>" })
|
||||
local mappings_leaderless = {
|
||||
K = { "Show definition" },
|
||||
g = {
|
||||
name = "lsp functions",
|
||||
d = { "go to definition" },
|
||||
D = { "go to declaration" },
|
||||
i = { "show implementations" },
|
||||
r = { "list all references to symbol under cursor" },
|
||||
},
|
||||
["["] = {
|
||||
name = "jump backward",
|
||||
d = "Previous Diagnostic",
|
||||
c = "Previous diff change",
|
||||
h = { "<cmd>Gitsigns prev_hunk<cr><cr>", "Previous changed git block" },
|
||||
},
|
||||
["]"] = {
|
||||
name = "jump forward",
|
||||
d = "Next Diagnostic",
|
||||
c = "Next diff change",
|
||||
h = { "<cmd>Gitsigns next_hunk<cr><cr>", "Next changed git block" },
|
||||
},
|
||||
}
|
||||
wk.register({ mappings_leaderless, opts })
|
||||
30
.config/nvim/lua/plug_init/wilder_init.lua
Normal file
30
.config/nvim/lua/plug_init/wilder_init.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
local wilder = require('wilder')
|
||||
local gradient = {
|
||||
'#f4468f', '#fd4a85', '#ff507a', '#ff566f', '#ff5e63',
|
||||
'#ff6658', '#ff704e', '#ff7a45', '#ff843d', '#ff9036',
|
||||
'#f89b31', '#efa72f', '#e6b32e', '#dcbe30', '#d2c934',
|
||||
'#c8d43a', '#bfde43', '#b6e84e', '#aff05b'
|
||||
}
|
||||
wilder.setup({modes = {':', '/', '?'} })
|
||||
wilder.set_option('pipeline', {
|
||||
wilder.branch(
|
||||
wilder.cmdline_pipeline({
|
||||
fuzzy = 1,
|
||||
}),
|
||||
wilder.search_pipeline()
|
||||
),
|
||||
})
|
||||
for i, fg in ipairs(gradient) do
|
||||
gradient[i] = wilder.make_hl('WilderGradient' .. i, 'Pmenu', {{a = 1}, {a = 1}, {foreground = fg}})
|
||||
end
|
||||
|
||||
wilder.set_option('renderer', wilder.wildmenu_renderer({
|
||||
highlights = {
|
||||
gradient = gradient, -- must be set
|
||||
-- selected_gradient key can be set to apply gradient highlighting for the selected candidate.
|
||||
},
|
||||
highlighter = wilder.highlighter_with_gradient({
|
||||
wilder.basic_highlighter(), -- or wilder.lua_fzy_highlighter(),
|
||||
}),
|
||||
}))
|
||||
29
.config/nvim/lua/plugins/coq_nvim.lua
Normal file
29
.config/nvim/lua/plugins/coq_nvim.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
return {
|
||||
"neovim/nvim-lspconfig", -- REQUIRED: for native Neovim LSP integration
|
||||
lazy = false, -- REQUIRED: tell lazy.nvim to start this plugin at startup
|
||||
dependencies = {
|
||||
-- main one
|
||||
{ "ms-jpq/coq_nvim", branch = "coq" },
|
||||
|
||||
-- 9000+ Snippets
|
||||
{ "ms-jpq/coq.artifacts", branch = "artifacts" },
|
||||
|
||||
-- lua & third party sources -- See https://github.com/ms-jpq/coq.thirdparty
|
||||
-- Need to **configure separately**
|
||||
{ 'ms-jpq/coq.thirdparty', branch = "3p" }
|
||||
-- - shell repl
|
||||
-- - nvim lua api
|
||||
-- - scientific calculator
|
||||
-- - comment banner
|
||||
-- - etc
|
||||
},
|
||||
init = function()
|
||||
vim.g.coq_settings = {
|
||||
auto_start = true, -- if you want to start COQ at startup
|
||||
-- Your COQ settings here
|
||||
}
|
||||
end,
|
||||
config = function()
|
||||
-- Your LSP settings here
|
||||
end,
|
||||
}
|
||||
8
.config/nvim/lua/plugins/crates.lua
Normal file
8
.config/nvim/lua/plugins/crates.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
'saecki/crates.nvim',
|
||||
event = { "BufRead Cargo.toml" },
|
||||
lazy = true,
|
||||
config = function()
|
||||
require('crates').setup()
|
||||
end,
|
||||
}
|
||||
32
.config/nvim/lua/plugins/lsp_config.lua
Normal file
32
.config/nvim/lua/plugins/lsp_config.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
return {
|
||||
-- LSP Support
|
||||
{
|
||||
'VonHeikemen/lsp-zero.nvim',
|
||||
branch = "v3.x",
|
||||
lazy = true,
|
||||
config = false,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
{"hrsh7th/cmp-nvim-lsp"},
|
||||
},
|
||||
lazy = true,
|
||||
},
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
lazy = true,
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
lazy = true,
|
||||
},
|
||||
-- Autocompletion
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
{"L3MON4D3/LuaSnip"}
|
||||
},
|
||||
lazy = true,
|
||||
},
|
||||
}
|
||||
9
.config/nvim/lua/plugins/nvim-possession.lua
Normal file
9
.config/nvim/lua/plugins/nvim-possession.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
{ "gennaro-tedesco/nvim-possession",
|
||||
dependencies = {
|
||||
"ibhagwan/fzf-lua",
|
||||
},
|
||||
lazy = true,
|
||||
config = true,
|
||||
},
|
||||
}
|
||||
53
.config/nvim/lua/plugins/peanuts.lua
Normal file
53
.config/nvim/lua/plugins/peanuts.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
return {
|
||||
-- not deps
|
||||
--{ "xiyaowong/transparent.nvim" },
|
||||
-- { "olimorris/onedarkpro.nvim" },
|
||||
{ "neanias/everforest-nvim" },
|
||||
{ "ibhagwan/fzf-lua", lazy = true },
|
||||
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", lazy=true},
|
||||
{ "nvim-treesitter/nvim-treesitter-context", lazy=true },
|
||||
{ "nvim-telescope/telescope.nvim", tag = "0.1.2",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim"
|
||||
},
|
||||
lazy = true,
|
||||
},
|
||||
{ "nvim-lualine/lualine.nvim",
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
lazy = false
|
||||
},
|
||||
{ "stevearc/aerial.nvim" },
|
||||
-- {
|
||||
-- "folke/noice.nvim",
|
||||
-- event = "VeryLazy",
|
||||
-- opts = {},
|
||||
-- dependencies = {
|
||||
-- "MunifTanjim/nui.nvim",
|
||||
-- --OPTIONAL:
|
||||
-- -- `nvim-notify` is only needed, if you want to use the notification view.
|
||||
-- -- If not available, we use `mini` as the fallback
|
||||
-- --"rcarriga/nvim-notify",
|
||||
-- }
|
||||
-- },
|
||||
{
|
||||
"danielfalk/smart-open.nvim",
|
||||
branch = "0.2.x",
|
||||
lazy = true,
|
||||
dependencies = {
|
||||
"kkharji/sqlite.lua",
|
||||
-- Only required if using match_algorithm fzf
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
-- Optional. If installed, native fzy will be used when match_algorithm is fzy
|
||||
{ "nvim-telescope/telescope-fzy-native.nvim" },
|
||||
},
|
||||
},
|
||||
{ "gelguy/wilder.nvim", lazy = true },
|
||||
{ "tpope/vim-fugitive", lazy = true },
|
||||
{ "norcalli/nvim-colorizer.lua", verylazy = true },
|
||||
{ "ziontee113/color-picker.nvim", verylazy = true },
|
||||
{ "lewis6991/gitsigns.nvim", verylazy = true },
|
||||
{ "MunifTanjim/nui.nvim", verylazy = true }, --dependency for telescope
|
||||
--{ "elkowar/yuck.vim", verylazy = true },--helper for eww widget configuration
|
||||
-- optional
|
||||
{ "nvim-treesitter/nvim-treesitter-textobjects", lazy = true },
|
||||
}
|
||||
8
.config/nvim/lua/plugins/undotree.lua
Executable file
8
.config/nvim/lua/plugins/undotree.lua
Executable file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
"jiaoshijie/undotree",
|
||||
dependencies = "nvim-lua/plenary.nvim",
|
||||
config = true,
|
||||
keys = { -- load the plugin only when using it's keybinding:
|
||||
{ "<leader>u", "<cmd>lua require('undotree').toggle()<cr>" },
|
||||
},
|
||||
}
|
||||
9
.config/nvim/lua/plugins/which-key.lua
Normal file
9
.config/nvim/lua/plugins/which-key.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 100
|
||||
end,
|
||||
opts = {}
|
||||
}
|
||||
Reference in New Issue
Block a user