358 current 2024-04-16 14:38:00 24.05.20240416.c04952a 6.8.4-zen1 *

This commit is contained in:
zackartz 2024-04-16 14:38:07 -04:00
parent 76e98d422e
commit 38c95e923d
No known key found for this signature in database
GPG key ID: 5B53E53A9A514DBA
47 changed files with 1991 additions and 1876 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake;

16
flake.lock generated
View file

@ -557,6 +557,7 @@
"neovim-nightly-overlay": "neovim-nightly-overlay", "neovim-nightly-overlay": "neovim-nightly-overlay",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_3",
"rio-term": "rio-term", "rio-term": "rio-term",
"systems": "systems_6",
"waybar": "waybar" "waybar": "waybar"
} }
}, },
@ -674,6 +675,21 @@
"type": "github" "type": "github"
} }
}, },
"systems_6": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"waybar": { "waybar": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",

View file

@ -48,11 +48,14 @@
rio-term = { rio-term = {
url = "github:zackartz/rio"; url = "github:zackartz/rio";
}; };
systems.url = "github:nix-systems/default";
}; };
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,
systems,
... ...
} @ inputs: let } @ inputs: let
system = "x86_64-linux"; system = "x86_64-linux";
@ -60,6 +63,11 @@
overlays = [ overlays = [
inputs.neovim-nightly-overlay.overlay inputs.neovim-nightly-overlay.overlay
]; ];
eachSystem = f:
nixpkgs.lib.genAttrs (import systems) (
system:
f nixpkgs.legacyPackages.${system}
);
in { in {
nixosConfigurations.earth = nixpkgs.lib.nixosSystem { nixosConfigurations.earth = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs;}; specialArgs = {inherit inputs;};
@ -68,5 +76,15 @@
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
]; ];
}; };
devShells = eachSystem (pkgs: {
default = pkgs.mkShell {
buildInputs = [
pkgs.nil
pkgs.stylua
pkgs.nodePackages.coc-sumneko-lua
];
};
});
}; };
} }

View file

@ -1,106 +1,106 @@
local M = {} local M = {}
M.ui = { M.ui = {
------------------------------- base46 ------------------------------------- ------------------------------- base46 -------------------------------------
-- hl = highlights -- hl = highlights
hl_add = {}, hl_add = {},
hl_override = {}, hl_override = {},
changed_themes = {}, changed_themes = {},
theme_toggle = { "rosepine", "one_light" }, theme_toggle = { "rosepine", "one_light" },
theme = "rosepine", -- default theme theme = "rosepine", -- default theme
transparency = true, transparency = true,
cmp = { cmp = {
icons = true, icons = true,
lspkind_text = true, lspkind_text = true,
style = "default", -- default/flat_light/flat_dark/atom/atom_colored style = "default", -- default/flat_light/flat_dark/atom/atom_colored
}, },
telescope = { style = "borderless" }, -- borderless / bordered telescope = { style = "borderless" }, -- borderless / bordered
------------------------------- nvchad_ui modules ----------------------------- ------------------------------- nvchad_ui modules -----------------------------
statusline = { statusline = {
theme = "default", -- default/vscode/vscode_colored/minimal theme = "default", -- default/vscode/vscode_colored/minimal
-- default/round/block/arrow separators work only for default statusline theme -- default/round/block/arrow separators work only for default statusline theme
-- round and block will work for minimal theme only -- round and block will work for minimal theme only
separator_style = "default", separator_style = "default",
order = nil, order = nil,
modules = nil, modules = nil,
}, },
-- lazyload it when there are 1+ buffers -- lazyload it when there are 1+ buffers
tabufline = { tabufline = {
enabled = true, enabled = true,
lazyload = true, lazyload = true,
order = { "treeOffset", "buffers", "tabs", "btns" }, order = { "treeOffset", "buffers", "tabs", "btns" },
modules = nil, modules = nil,
}, },
nvdash = { nvdash = {
load_on_startup = false, load_on_startup = false,
header = { header = {
" ▄ ▄ ", " ▄ ▄ ",
" ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ ", " ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ ",
" █ ▄ █▄█ ▄▄▄ █ █▄█ █ █ ", " █ ▄ █▄█ ▄▄▄ █ █▄█ █ █ ",
" ▄▄ █▄█▄▄▄█ █▄█▄█▄▄█▄▄█ █ ", " ▄▄ █▄█▄▄▄█ █▄█▄█▄▄█▄▄█ █ ",
" ▄ █▄▄█ ▄ ▄▄ ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ", " ▄ █▄▄█ ▄ ▄▄ ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ",
" █▄▄▄▄ ▄▄▄ █ ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ █ ▄", " █▄▄▄▄ ▄▄▄ █ ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ █ ▄",
"▄ █ █▄█ █▄█ █ █ █▄█ █ █▄█ ▄▄▄ █ █", "▄ █ █▄█ █▄█ █ █ █▄█ █ █▄█ ▄▄▄ █ █",
"█▄█ ▄ █▄▄█▄▄█ █ ▄▄█ █ ▄ █ █▄█▄█ █", "█▄█ ▄ █▄▄█▄▄█ █ ▄▄█ █ ▄ █ █▄█▄█ █",
" █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ █▄█▄▄▄█ ", " █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ █▄█▄▄▄█ ",
}, },
buttons = { buttons = {
{ " Find File", "Spc f f", "Telescope find_files" }, { " Find File", "Spc f f", "Telescope find_files" },
{ "󰈚 Recent Files", "Spc f o", "Telescope oldfiles" }, { "󰈚 Recent Files", "Spc f o", "Telescope oldfiles" },
{ "󰈭 Find Word", "Spc f w", "Telescope live_grep" }, { "󰈭 Find Word", "Spc f w", "Telescope live_grep" },
{ " Bookmarks", "Spc m a", "Telescope marks" }, { " Bookmarks", "Spc m a", "Telescope marks" },
{ " Themes", "Spc t h", "Telescope themes" }, { " Themes", "Spc t h", "Telescope themes" },
{ " Mappings", "Spc c h", "NvCheatsheet" }, { " Mappings", "Spc c h", "NvCheatsheet" },
}, },
}, },
cheatsheet = { theme = "grid" }, -- simple/grid cheatsheet = { theme = "grid" }, -- simple/grid
lsp = { lsp = {
signature = true, signature = true,
semantic_tokens = false, semantic_tokens = false,
}, },
term = { term = {
-- hl = "Normal:term,WinSeparator:WinSeparator", -- hl = "Normal:term,WinSeparator:WinSeparator",
sizes = { sp = 0.3, vsp = 0.2 }, sizes = { sp = 0.3, vsp = 0.2 },
float = { float = {
relative = "editor", relative = "editor",
row = 0.3, row = 0.3,
col = 0.25, col = 0.25,
width = 0.5, width = 0.5,
height = 0.4, height = 0.4,
border = "single", border = "single",
}, },
}, },
} }
M.base46 = { M.base46 = {
integrations = { integrations = {
"blankline", "blankline",
"cmp", "cmp",
"defaults", "defaults",
"devicons", "devicons",
"git", "git",
"lsp", "lsp",
"mason", "mason",
"nvcheatsheet", "nvcheatsheet",
"nvdash", "nvdash",
"nvimtree", "nvimtree",
"statusline", "statusline",
"syntax", "syntax",
"treesitter", "treesitter",
"tbline", "tbline",
"telescope", "telescope",
"whichkey", "whichkey",
}, },
} }
return M return M

View file

@ -1,21 +1,21 @@
return { return {
{ {
event = "LspAttach", event = "LspAttach",
opts = { opts = {
callback = function(args) callback = function(args)
local bufnr = args.buf local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id) local client = vim.lsp.get_client_by_id(args.data.client_id)
local lsp = require("lsp.config") local lsp = require("lsp.config")
lsp.set_keymaps(client, bufnr) lsp.set_keymaps(client, bufnr)
lsp.set_autocmd(client, bufnr) lsp.set_autocmd(client, bufnr)
end, end,
}, },
}, },
{ {
event = { "FileType" }, event = { "FileType" },
opts = { opts = {
pattern = { "help" }, pattern = { "help" },
callback = require("utils.win").open_help_float, callback = require("utils.win").open_help_float,
}, },
}, },
} }

View file

@ -1,10 +1,10 @@
return { return {
extension = { extension = {
ic = "icelang", ic = "icelang",
rasi = "rasi", rasi = "rasi",
ebnf = "ebnf", ebnf = "ebnf",
}, },
pattern = { pattern = {
[".*/hypr/.*%.conf"] = "hyprlang", [".*/hypr/.*%.conf"] = "hyprlang",
}, },
} }

View file

@ -4,266 +4,265 @@ local fmt = require("utils.icons").fmt
local l, cmd, rcmd, lua = map.leader, map.cmd, map.rcmd, map.lua local l, cmd, rcmd, lua = map.leader, map.cmd, map.rcmd, map.lua
return { return {
i = { i = {
["jj"] = { "<esc>", "Exit insert mode" }, ["jj"] = { "<esc>", "Exit insert mode" },
}, },
n = { n = {
-- utils -- utils
["vv"] = { "V", "Linewise visual" }, ["vv"] = { "V", "Linewise visual" },
[l("w")] = { cmd("w"), fmt("Save", "Save file") }, [l("w")] = { cmd("w"), fmt("Save", "Save file") },
[l("W")] = { cmd("w!"), fmt("Save", "Save file!") }, [l("W")] = { cmd("w!"), fmt("Save", "Save file!") },
[l("q")] = { cmd("q"), fmt("Exit", "Exit window") }, [l("q")] = { cmd("q"), fmt("Exit", "Exit window") },
[l("Q")] = { cmd("q!"), fmt("Exit", "Exit window!") }, [l("Q")] = { cmd("q!"), fmt("Exit", "Exit window!") },
[l("p")] = { '"+p', fmt("Clipboard", "Paste from clipboard") }, [l("p")] = { '"+p', fmt("Clipboard", "Paste from clipboard") },
[l("P")] = { '"+P', fmt("Clipboard", "Paste from clipboard") }, [l("P")] = { '"+P', fmt("Clipboard", "Paste from clipboard") },
[l(":")] = { ":lua ", fmt("Lua", "Lua prompt") }, [l(":")] = { ":lua ", fmt("Lua", "Lua prompt") },
[l("%")] = { cmd("luafile %"), fmt("Lua", "Luafile") }, [l("%")] = { cmd("luafile %"), fmt("Lua", "Luafile") },
[l(";")] = { f.comment_line, fmt("Comment", "Comment line") }, [l(";")] = { f.comment_line, fmt("Comment", "Comment line") },
[l(" ")] = { cmd("wincmd w"), fmt("Window", "Switch window") }, [l(" ")] = { cmd("wincmd w"), fmt("Window", "Switch window") },
-- UI utils -- UI utils
[l("uw")] = { f.toggle_wrap, fmt("LineWrap", "Toggle wrap") }, [l("uw")] = { f.toggle_wrap, fmt("LineWrap", "Toggle wrap") },
[l("ug")] = { cmd("GuessIndent"), fmt("Indent", "Guess indent") }, [l("ug")] = { cmd("GuessIndent"), fmt("Indent", "Guess indent") },
[l("uf")] = { f.set_filetype, fmt("DefaultFile", "Set filetype") }, [l("uf")] = { f.set_filetype, fmt("DefaultFile", "Set filetype") },
[l("ui")] = { f.set_indent, fmt("Indent", "Set indentation") }, [l("ui")] = { f.set_indent, fmt("Indent", "Set indentation") },
[l("uI")] = { f.set_indent_type, fmt("Indent", "Set indentation type") }, [l("uI")] = { f.set_indent_type, fmt("Indent", "Set indentation type") },
[l("us")] = { cmd("nohlsearch"), fmt("Clear", "Clear search highlights") }, [l("us")] = { cmd("nohlsearch"), fmt("Clear", "Clear search highlights") },
["<C-F12>"] = { cmd("OverseerRun"), "Overseer Run" },
["<C-S-F12>"] = { cmd("OverseerToggle"), "Overseer Toggle" },
-- Neotree
[l("e")] = { cmd("Neotree toggle"), fmt("FileTree", "Toggle Neotree") },
["<F36>"] = { cmd("OverseerRun"), "Overseer Run" }, -- move.nvim
["<F48>"] = { cmd("OverseerToggle"), "Overseer Toggle" }, ["<A-j>"] = { cmd("MoveLine(1)"), "Move line down" },
-- Neotree ["<A-k>"] = { cmd("MoveLine(-1)"), "Move line up" },
[l("e")] = { cmd("Neotree toggle"), fmt("FileTree", "Toggle Neotree") }, ["<A-h>"] = { cmd("MoveHChar(-1)"), "Move character left" },
["<A-l>"] = { cmd("MoveHChar(1)"), "Move character right" },
-- move.nvim -- ccc
["<A-j>"] = { cmd("MoveLine(1)"), "Move line down" }, [l("cp")] = { cmd("CccPick"), fmt("ColorPicker", "Pick color") },
["<A-k>"] = { cmd("MoveLine(-1)"), "Move line up" }, [l("cc")] = { cmd("CccConvert"), fmt("Swap", "Convert color") },
["<A-h>"] = { cmd("MoveHChar(-1)"), "Move character left" }, [l("ce")] = { cmd("CccHighlighterEnable"), fmt("ColorOn", "Enable highlights") },
["<A-l>"] = { cmd("MoveHChar(1)"), "Move character right" }, [l("cd")] = { cmd("CccHighlighterDisable"), fmt("ColorOff", "Disable highlights") },
-- ccc -- buffer utils
[l("cp")] = { cmd("CccPick"), fmt("ColorPicker", "Pick color") }, [l("bq")] = { cmd("BufDel"), fmt("Close", "Close current buffer") },
[l("cc")] = { cmd("CccConvert"), fmt("Swap", "Convert color") }, [l("bQ")] = { cmd("BufDel!"), fmt("Close", "close current buffer!") },
[l("ce")] = { cmd("CccHighlighterEnable"), fmt("ColorOn", "Enable highlights") }, [l("bb")] = { cmd("BufferLinePick"), fmt("Open", "Pick to open buffer") },
[l("cd")] = { cmd("CccHighlighterDisable"), fmt("ColorOff", "Disable highlights") }, [l("bd")] = { cmd("BufferLinePickClose"), fmt("Close", "Pick to close buffer") },
[l("bl")] = { cmd("BufferLineCloseLeft"), fmt("CloseMultiple", "Close buffers to the left") },
[l("br")] = { cmd("BufferLineCloseRight"), fmt("CloseMultiple", "Close buffers to the right") },
[l("bn")] = { cmd("BufferLineCycleNext"), fmt("NextBuffer", "Move to next buffer") },
[l("bp")] = { cmd("BufferLineCyclePrev"), fmt("PrevBuffer", "Move to previous buffer") },
[l("bi")] = { cmd("BufferLineTogglePin"), fmt("Pin", "Pin buffer") },
[l("bg")] = { f.first_buffer, fmt("PrevBuffer", "Move to first buffer") },
[l("bG")] = { f.last_buffer, fmt("NextBuffer", "Move to last buffer") },
[l("bv")] = { f.buf_vsplit, fmt("Vertical", "Vertical split") },
[l("bh")] = { f.buf_hsplit, fmt("Horizontal", "Horizontal split") },
-- buffer utils -- gitsigns
[l("bq")] = { cmd("BufDel"), fmt("Close", "Close current buffer") }, [l("gb")] = { cmd("Gitsigns toggle_current_line_blame"), fmt("GitDiff", "Line blame") },
[l("bQ")] = { cmd("BufDel!"), fmt("Close", "close current buffer!") }, [l("gd")] = { cmd("Gitsigns diffthis"), fmt("GitDiff", "Show diff") },
[l("bb")] = { cmd("BufferLinePick"), fmt("Open", "Pick to open buffer") }, [l("gD")] = { cmd("Gitsigns toggle_deleted"), fmt("DiffRemoved", "Toggle deleted") },
[l("bd")] = { cmd("BufferLinePickClose"), fmt("Close", "Pick to close buffer") }, [l("gp")] = { cmd("Gitsigns preview_hunk"), fmt("Popup", "Preview hunk") },
[l("bl")] = { cmd("BufferLineCloseLeft"), fmt("CloseMultiple", "Close buffers to the left") }, [l("gP")] = { cmd("Gitsigns preview_hunk_inline"), fmt("Popup", "Preview hunk inline") },
[l("br")] = { cmd("BufferLineCloseRight"), fmt("CloseMultiple", "Close buffers to the right") }, [l("gn")] = { cmd("Gitsigns next_hunk"), fmt("Down", "Next hunk") },
[l("bn")] = { cmd("BufferLineCycleNext"), fmt("NextBuffer", "Move to next buffer") }, [l("gN")] = { cmd("Gitsigns prev_hunk"), fmt("Up", "Previous hunk") },
[l("bp")] = { cmd("BufferLineCyclePrev"), fmt("PrevBuffer", "Move to previous buffer") }, [l("gr")] = { cmd("Gitsigns reset_hunk"), fmt("Restore", "Revert hunk") },
[l("bi")] = { cmd("BufferLineTogglePin"), fmt("Pin", "Pin buffer") }, [l("gs")] = { cmd("Gitsigns stage_hunk"), fmt("Save", "Stage hunk") },
[l("bg")] = { f.first_buffer, fmt("PrevBuffer", "Move to first buffer") }, [l("gv")] = { cmd("Gitsigns select_hunk"), fmt("Visual", "Select hunk") },
[l("bG")] = { f.last_buffer, fmt("NextBuffer", "Move to last buffer") }, [l("gw")] = { cmd("Gitsigns toggle_word_diff"), fmt("GitDiff", "Toggle word diff") },
[l("bv")] = { f.buf_vsplit, fmt("Vertical", "Vertical split") }, [l("gg")] = { cmd("Telescope git_status"), fmt("Git", "Git status") },
[l("bh")] = { f.buf_hsplit, fmt("Horizontal", "Horizontal split") },
-- gitsigns -- toggleterm
[l("gb")] = { cmd("Gitsigns toggle_current_line_blame"), fmt("GitDiff", "Line blame") }, [l("th")] = { cmd("ToggleTerm direction=horizontal"), fmt("Horizontal", "Horizontal terminal") },
[l("gd")] = { cmd("Gitsigns diffthis"), fmt("GitDiff", "Show diff") }, [l("tv")] = {
[l("gD")] = { cmd("Gitsigns toggle_deleted"), fmt("DiffRemoved", "Toggle deleted") }, cmd("ToggleTerm direction=vertical size=60"),
[l("gp")] = { cmd("Gitsigns preview_hunk"), fmt("Popup", "Preview hunk") }, fmt("Vertical", "Vertical terminal"),
[l("gP")] = { cmd("Gitsigns preview_hunk_inline"), fmt("Popup", "Preview hunk inline") }, },
[l("gn")] = { cmd("Gitsigns next_hunk"), fmt("Down", "Next hunk") }, [l("tf")] = { cmd("ToggleTerm direction=float"), fmt("Window", "Floating terminal") },
[l("gN")] = { cmd("Gitsigns prev_hunk"), fmt("Up", "Previous hunk") }, [l("tl")] = { f.open_lazygit, fmt("GitBranch", "Lazygit terminal") },
[l("gr")] = { cmd("Gitsigns reset_hunk"), fmt("Restore", "Revert hunk") }, [l("tg")] = { f.open_glow, fmt("Markdown", "Glow terminal") },
[l("gs")] = { cmd("Gitsigns stage_hunk"), fmt("Save", "Stage hunk") },
[l("gv")] = { cmd("Gitsigns select_hunk"), fmt("Visual", "Select hunk") },
[l("gw")] = { cmd("Gitsigns toggle_word_diff"), fmt("GitDiff", "Toggle word diff") },
[l("gg")] = { cmd("Telescope git_status"), fmt("Git", "Git status") },
-- toggleterm -- wincmd
[l("th")] = { cmd("ToggleTerm direction=horizontal"), fmt("Horizontal", "Horizontal terminal") }, ["<C-h>"] = { cmd("wincmd h"), "Move right" },
[l("tv")] = { ["<C-j>"] = { cmd("wincmd j"), "Move down" },
cmd("ToggleTerm direction=vertical size=60"), ["<C-k>"] = { cmd("wincmd k"), "Move up" },
fmt("Vertical", "Vertical terminal"), ["<C-l>"] = { cmd("wincmd l"), "Move left" },
},
[l("tf")] = { cmd("ToggleTerm direction=float"), fmt("Window", "Floating terminal") },
[l("tl")] = { f.open_lazygit, fmt("GitBranch", "Lazygit terminal") },
[l("tg")] = { f.open_glow, fmt("Markdown", "Glow terminal") },
-- wincmd -- telescope
["<C-h>"] = { cmd("wincmd h"), "Move right" }, [l("ff")] = { cmd("Telescope find_files"), fmt("FileSearch", "Find files") },
["<C-j>"] = { cmd("wincmd j"), "Move down" }, [l("fF")] = { cmd("Telescope find_files hidden=true"), fmt("FileSearch", "Find all files") },
["<C-k>"] = { cmd("wincmd k"), "Move up" }, [l("fg")] = { cmd("Telescope live_grep"), fmt("TextSearch", "Live grep") },
["<C-l>"] = { cmd("wincmd l"), "Move left" }, [l("fb")] = { cmd("Telescope buffers"), fmt("TabSearch", "Find buffer") },
[l("fh")] = { cmd("Telescope help_tags"), fmt("Help", "Find help") },
[l("fd")] = { cmd("Telescope diagnostics"), fmt("Warn", "Find diagnostic") },
[l("fs")] = { cmd("Telescope lsp_document_symbols"), fmt("Braces", "Document symbol") },
[l("fr")] = { cmd("Telescope resume"), fmt("Run", "Resume search") },
[l("fn")] = { cmd("Telescope notify"), fmt("Notification", "Show notifications") },
[l("fo")] = { cmd("Telescope vim_options"), fmt("Config", "Vim options") },
[l("f:")] = { cmd("Telescope command_history"), fmt("History", "Command history") },
[l("fm")] = { cmd("Telescope man_pages"), fmt("Info", "Search man") },
[l("fR")] = { cmd("Telescope reloader"), fmt("Restore", "Reload module") },
[l("fH")] = { cmd("Telescope highlights"), fmt("Color", "Highlight group") },
[l("ft")] = { cmd("Telescope treesitter"), fmt("Symbol", "Treesitter") },
[l("fz")] = { cmd("Telescope current_buffer_fuzzy_find"), fmt("Search", "Buffer fuzzy find") },
[l("fp")] = { cmd("Telescope registers"), fmt("Clipboard", "Registers") },
[l("fq")] = { cmd("Telescope quickfix"), fmt("Fix", "Quickfix") },
[l("gc")] = { cmd("Telescope git_bcommits"), fmt("GitCommit", "Find branch commit") },
[l("gC")] = { cmd("Telescope git_commits"), fmt("GitCommit", "Find commit") },
[l("gB")] = { cmd("Telescope git_branches"), fmt("GitBranch", "Find git branch") },
-- telescope -- Lazy
[l("ff")] = { cmd("Telescope find_files"), fmt("FileSearch", "Find files") }, [l("L")] = { cmd("Lazy"), fmt("Package", "Plugin manager") },
[l("fF")] = { cmd("Telescope find_files hidden=true"), fmt("FileSearch", "Find all files") },
[l("fg")] = { cmd("Telescope live_grep"), fmt("TextSearch", "Live grep") },
[l("fb")] = { cmd("Telescope buffers"), fmt("TabSearch", "Find buffer") },
[l("fh")] = { cmd("Telescope help_tags"), fmt("Help", "Find help") },
[l("fd")] = { cmd("Telescope diagnostics"), fmt("Warn", "Find diagnostic") },
[l("fs")] = { cmd("Telescope lsp_document_symbols"), fmt("Braces", "Document symbol") },
[l("fr")] = { cmd("Telescope resume"), fmt("Run", "Resume search") },
[l("fn")] = { cmd("Telescope notify"), fmt("Notification", "Show notifications") },
[l("fo")] = { cmd("Telescope vim_options"), fmt("Config", "Vim options") },
[l("f:")] = { cmd("Telescope command_history"), fmt("History", "Command history") },
[l("fm")] = { cmd("Telescope man_pages"), fmt("Info", "Search man") },
[l("fR")] = { cmd("Telescope reloader"), fmt("Restore", "Reload module") },
[l("fH")] = { cmd("Telescope highlights"), fmt("Color", "Highlight group") },
[l("ft")] = { cmd("Telescope treesitter"), fmt("Symbol", "Treesitter") },
[l("fz")] = { cmd("Telescope current_buffer_fuzzy_find"), fmt("Search", "Buffer fuzzy find") },
[l("fp")] = { cmd("Telescope registers"), fmt("Clipboard", "Registers") },
[l("fq")] = { cmd("Telescope quickfix"), fmt("Fix", "Quickfix") },
[l("gc")] = { cmd("Telescope git_bcommits"), fmt("GitCommit", "Find branch commit") },
[l("gC")] = { cmd("Telescope git_commits"), fmt("GitCommit", "Find commit") },
[l("gB")] = { cmd("Telescope git_branches"), fmt("GitBranch", "Find git branch") },
-- Lazy -- Mason
[l("L")] = { cmd("Lazy"), fmt("Package", "Plugin manager") }, [l("M")] = { cmd("Mason"), fmt("Package", "Mason") },
-- Mason -- DAP
[l("M")] = { cmd("Mason"), fmt("Package", "Mason") }, [l("do")] = { f.open_dapui, fmt("Open", "Open debugger UI") },
[l("dq")] = { f.close_dapui, fmt("Close", "Close debugger UI") },
[l("dt")] = { f.toggle_dapui, fmt("Toggle", "Toggle debugger") },
[l("dc")] = { cmd("DapTerminate"), fmt("Stop", "Terminate session") },
[l("dr")] = { cmd("DapRestartFrame"), fmt("Restart", "Restart frame") },
[l("db")] = { cmd("DapToggleBreakpoint"), fmt("Toggle", "Toggle breakpoint") },
[l("dl")] = { cmd("DapShowLog"), fmt("DefaultFile", "Show logs") },
["<F5>"] = { cmd("DapContinue"), "Continue session" },
["<F9>"] = { cmd("DapToggleBreakpoint"), "Toggle breakpoint" },
["<F11>"] = { cmd("DapStepInto"), "Step into" },
["<F23>"] = { cmd("DapStepOut"), "Step out" },
["<F12>"] = { cmd("DapStepOver"), "Step over" },
-- DAP -- telescope DAP
[l("do")] = { f.open_dapui, fmt("Open", "Open debugger UI") }, [l("dB")] = {
[l("dq")] = { f.close_dapui, fmt("Close", "Close debugger UI") }, lua("require('telescope').extensions.dap.list_breakpoints()"),
[l("dt")] = { f.toggle_dapui, fmt("Toggle", "Toggle debugger") }, fmt("Breakpoint", "List breakpoints"),
[l("dc")] = { cmd("DapTerminate"), fmt("Stop", "Terminate session") }, },
[l("dr")] = { cmd("DapRestartFrame"), fmt("Restart", "Restart frame") }, [l("dv")] = {
[l("db")] = { cmd("DapToggleBreakpoint"), fmt("Toggle", "Toggle breakpoint") }, lua("require('telescope').extensions.dap.variables()"),
[l("dl")] = { cmd("DapShowLog"), fmt("DefaultFile", "Show logs") }, fmt("Variable", "List variables"),
["<F5>"] = { cmd("DapContinue"), "Continue session" }, },
["<F9>"] = { cmd("DapToggleBreakpoint"), "Toggle breakpoint" }, [l("df")] = {
["<F11>"] = { cmd("DapStepInto"), "Step into" }, lua("require('telescope').extensions.dap.frames()"),
["<F23>"] = { cmd("DapStepOut"), "Step out" }, fmt("Stack", "List frames"),
["<F12>"] = { cmd("DapStepOver"), "Step over" }, },
[l("dF")] = {
lua("require('telescope').extensions.dap.configurations()"),
fmt("Config", "List configurations"),
},
[l("dC")] = {
lua("require('telescope').extensions.dap.commands()"),
fmt("Command", "List commands"),
},
-- telescope DAP -- session-manager
[l("dB")] = { [l("Ss")] = { cmd("SessionManager save_current_session"), fmt("Save", "Save session") },
lua("require('telescope').extensions.dap.list_breakpoints()"), [l("Sl")] = { cmd("SessionManager load_session"), fmt("Restore", "Load session") },
fmt("Breakpoint", "List breakpoints"), [l("SL")] = { cmd("SessionManager load_last_session"), fmt("Restore", "Load last session") },
}, [l("Sd")] = { cmd("SessionManager delete_session"), fmt("Trash", "Delete session") },
[l("dv")] = { [l("SD")] = {
lua("require('telescope').extensions.dap.variables()"), cmd("SessionManager load_current_dir_session"),
fmt("Variable", "List variables"), fmt("FolderClock", "Load current directory session"),
}, },
[l("df")] = {
lua("require('telescope').extensions.dap.frames()"),
fmt("Stack", "List frames"),
},
[l("dF")] = {
lua("require('telescope').extensions.dap.configurations()"),
fmt("Config", "List configurations"),
},
[l("dC")] = {
lua("require('telescope').extensions.dap.commands()"),
fmt("Command", "List commands"),
},
-- session-manager -- notify
[l("Ss")] = { cmd("SessionManager save_current_session"), fmt("Save", "Save session") }, [l("nn")] = {
[l("Sl")] = { cmd("SessionManager load_session"), fmt("Restore", "Load session") }, lua("require('notify').dismiss()"),
[l("SL")] = { cmd("SessionManager load_last_session"), fmt("Restore", "Load last session") }, fmt("NotificationDismiss", "Dismiss notifications"),
[l("Sd")] = { cmd("SessionManager delete_session"), fmt("Trash", "Delete session") }, },
[l("SD")] = {
cmd("SessionManager load_current_dir_session"),
fmt("FolderClock", "Load current directory session"),
},
-- notify -- lspconfig
[l("nn")] = { [l("li")] = { cmd("LspInfo"), fmt("Info", "Server info") },
lua("require('notify').dismiss()"), [l("lI")] = { cmd("LspLog"), fmt("DefaultFile", "Server logs") },
fmt("NotificationDismiss", "Dismiss notifications"), [l("lS")] = { ":LspStart ", fmt("Run", "Start server") },
}, [l("lq")] = { ":LspStop ", fmt("Stop", "Stop server") },
[l("lR")] = { cmd("LspRestart"), fmt("Restart", "Restart server") },
-- lspconfig -- dropbar
[l("li")] = { cmd("LspInfo"), fmt("Info", "Server info") }, [l("ok")] = { lua("require('dropbar.api').goto_context_start()"), fmt("Up", "Context start") },
[l("lI")] = { cmd("LspLog"), fmt("DefaultFile", "Server logs") }, [l("oo")] = { lua("require('dropbar.api').pick()"), fmt("Check", "Pick node") },
[l("lS")] = { ":LspStart ", fmt("Run", "Start server") },
[l("lq")] = { ":LspStop ", fmt("Stop", "Stop server") },
[l("lR")] = { cmd("LspRestart"), fmt("Restart", "Restart server") },
-- dropbar -- DbUI
[l("ok")] = { lua("require('dropbar.api').goto_context_start()"), fmt("Up", "Context start") }, [l("Dd")] = { cmd("DBUIToggle"), fmt("Toggle", "Toggle DbUI") },
[l("oo")] = { lua("require('dropbar.api').pick()"), fmt("Check", "Pick node") }, [l("Da")] = { cmd("DBUIAddConnection"), fmt("Add", "Add connection") },
-- DbUI -- nvim-devdocs
[l("Dd")] = { cmd("DBUIToggle"), fmt("Toggle", "Toggle DbUI") }, [l("v ")] = { cmd("DevdocsToggle"), fmt("Window", "Toggle floating window") },
[l("Da")] = { cmd("DBUIAddConnection"), fmt("Add", "Add connection") }, [l("vc")] = { cmd("DevdocsOpenCurrentFloat"), fmt("BookmarkSearch", "Open current file docs") },
[l("vv")] = { cmd("DevdocsOpenFloat"), fmt("BookmarkSearch", "Open in floating window") },
[l("vV")] = { cmd("DevdocsOpen"), fmt("BookmarkSearch", "Open in a normal buffer") },
[l("vf")] = { ":DevdocsOpenFloat ", fmt("BookmarkSearch", "Open documentation") },
[l("vi")] = { ":DevdocsInstall ", fmt("Install", "Install documentation") },
[l("vu")] = { ":DevdocsUninstall ", fmt("Trash", "Install documentation") },
-- nvim-devdocs -- crates
[l("v ")] = { cmd("DevdocsToggle"), fmt("Window", "Toggle floating window") }, [l("Cv")] = {
[l("vc")] = { cmd("DevdocsOpenCurrentFloat"), fmt("BookmarkSearch", "Open current file docs") }, lua("require('crates').show_versions_popup()"),
[l("vv")] = { cmd("DevdocsOpenFloat"), fmt("BookmarkSearch", "Open in floating window") }, fmt("Info", "Show versions popup"),
[l("vV")] = { cmd("DevdocsOpen"), fmt("BookmarkSearch", "Open in a normal buffer") }, },
[l("vf")] = { ":DevdocsOpenFloat ", fmt("BookmarkSearch", "Open documentation") }, [l("Cf")] = {
[l("vi")] = { ":DevdocsInstall ", fmt("Install", "Install documentation") }, lua("require('crates').show_features_popup()"),
[l("vu")] = { ":DevdocsUninstall ", fmt("Trash", "Install documentation") }, fmt("Stack", "Show features popup"),
},
[l("Cd")] = {
lua("require('crates').show_dependencies_popup()"),
fmt("Dependencies", "Show dependencies popup"),
},
[l("Cu")] = {
lua("require('crates').update_crate()"),
fmt("Update", "Update crate"),
},
[l("CU")] = {
lua("require('crates').update_all_crates()"),
fmt("Update", "Update all crates"),
},
[l("CD")] = {
lua("require('crates').open_documentation()"),
fmt("DefaultFile", "Open documentation"),
},
[l("Ch")] = {
lua("require('crates').open_homepage()"),
fmt("Web", "Open homepage"),
},
[l("Cc")] = {
lua("require('crates').open_crates_io()"),
fmt("Package", "Open crates.io"),
},
[l("Cr")] = {
lua("require('crates').open_repository()"),
fmt("Github", "Open repository"),
},
},
v = {
-- move.nvim
["<A-k>"] = { rcmd("MoveBlock(-1)"), "Move line up" },
["<A-j>"] = { rcmd("MoveBlock(1)"), "Move line down" },
["<A-h>"] = { rcmd("MoveHBlock(-1)"), "Move character left" },
["<A-l>"] = { rcmd("MoveHBlock(1)"), "Move character right" },
-- crates -- utils
[l("Cv")] = { ["q"] = { "<esc>" },
lua("require('crates').show_versions_popup()"), [l("y")] = { '"+y', fmt("Clipboard", "yank to clipboard") },
fmt("Info", "Show versions popup"), [l("p")] = { '"+p', fmt("Clipboard", "Paste from clipboard") },
}, [l("P")] = { '"+P', fmt("Clipboard", "Paste from clipboard") },
[l("Cf")] = { [l(";")] = { f.comment_selection, fmt("Comment", "Comment selection") },
lua("require('crates').show_features_popup()"),
fmt("Stack", "Show features popup"),
},
[l("Cd")] = {
lua("require('crates').show_dependencies_popup()"),
fmt("Dependencies", "Show dependencies popup"),
},
[l("Cu")] = {
lua("require('crates').update_crate()"),
fmt("Update", "Update crate"),
},
[l("CU")] = {
lua("require('crates').update_all_crates()"),
fmt("Update", "Update all crates"),
},
[l("CD")] = {
lua("require('crates').open_documentation()"),
fmt("DefaultFile", "Open documentation"),
},
[l("Ch")] = {
lua("require('crates').open_homepage()"),
fmt("Web", "Open homepage"),
},
[l("Cc")] = {
lua("require('crates').open_crates_io()"),
fmt("Package", "Open crates.io"),
},
[l("Cr")] = {
lua("require('crates').open_repository()"),
fmt("Github", "Open repository"),
},
},
v = {
-- move.nvim
["<A-k>"] = { rcmd("MoveBlock(-1)"), "Move line up" },
["<A-j>"] = { rcmd("MoveBlock(1)"), "Move line down" },
["<A-h>"] = { rcmd("MoveHBlock(-1)"), "Move character left" },
["<A-l>"] = { rcmd("MoveHBlock(1)"), "Move character right" },
-- utils -- gitsigns
["q"] = { "<esc>" }, [l("gr")] = { cmd("Gitsigns reset_hunk"), fmt("Restore", "Revert hunk") },
[l("y")] = { '"+y', fmt("Clipboard", "yank to clipboard") },
[l("p")] = { '"+p', fmt("Clipboard", "Paste from clipboard") },
[l("P")] = { '"+P', fmt("Clipboard", "Paste from clipboard") },
[l(";")] = { f.comment_selection, fmt("Comment", "Comment selection") },
-- gitsigns -- crates
[l("gr")] = { cmd("Gitsigns reset_hunk"), fmt("Restore", "Revert hunk") }, [l("Cu")] = { lua("require('crates').update_crates()"), fmt("Update", "Update crates") },
},
-- crates t = {
[l("Cu")] = { lua("require('crates').update_crates()"), fmt("Update", "Update crates") }, -- toggleterm
}, ["<esc>"] = { [[<C-\><C-n>]] },
t = { -- wincmd
-- toggleterm ["<C-h>"] = { cmd("wincmd h"), "Move right" },
["<esc>"] = { [[<C-\><C-n>]] }, ["<C-j>"] = { cmd("wincmd j"), "Move down" },
["<C-k>"] = { cmd("wincmd k"), "Move up" },
-- wincmd ["<C-l>"] = { cmd("wincmd l"), "Move left" },
["<C-h>"] = { cmd("wincmd h"), "Move right" }, },
["<C-j>"] = { cmd("wincmd j"), "Move down" },
["<C-k>"] = { cmd("wincmd k"), "Move up" },
["<C-l>"] = { cmd("wincmd l"), "Move left" },
},
} }

View file

@ -1,9 +1,9 @@
local icons = require("utils.icons").icons local icons = require("utils.icons").icons
return { return {
{ name = "DiagnosticSignError", text = icons.Error, texthl = "DiagnosticError" }, { name = "DiagnosticSignError", text = icons.Error, texthl = "DiagnosticError" },
{ name = "DiagnosticSignHint", text = icons.Hint, texthl = "DiagnosticHint" }, { name = "DiagnosticSignHint", text = icons.Hint, texthl = "DiagnosticHint" },
{ name = "DiagnosticSignWarn", text = icons.Warn, texthl = "DiagnosticWarn" }, { name = "DiagnosticSignWarn", text = icons.Warn, texthl = "DiagnosticWarn" },
{ name = "DiagnosticSignInfo", text = icons.Info, texthl = "DiagnosticInfo" }, { name = "DiagnosticSignInfo", text = icons.Info, texthl = "DiagnosticInfo" },
{ name = "DapBreakpoint", text = icons.Breakpoint, texthl = "Breakpoint" }, { name = "DapBreakpoint", text = icons.Breakpoint, texthl = "Breakpoint" },
} }

View file

@ -1,18 +1,18 @@
local lsp = require("lsp.functions") local lsp = require("lsp.functions")
return { return {
["textDocument/codeLens"] = { ["textDocument/codeLens"] = {
event = { "BufEnter", "InsertLeave" }, event = { "BufEnter", "InsertLeave" },
opts = { opts = {
group = vim.api.nvim_create_augroup("LspCodelens", {}), group = vim.api.nvim_create_augroup("LspCodelens", {}),
callback = lsp.refresh_codelens, callback = lsp.refresh_codelens,
}, },
}, },
["textDocument/formatting"] = { ["textDocument/formatting"] = {
event = "BufWritePost", event = "BufWritePost",
opts = { opts = {
group = vim.api.nvim_create_augroup("LspFormatting", {}), group = vim.api.nvim_create_augroup("LspFormatting", {}),
callback = lsp.format, callback = lsp.format,
}, },
}, },
} }

View file

@ -1,42 +1,72 @@
local M = {} local M = {}
M.definitions = function() vim.cmd("Telescope lsp_definitions") end M.definitions = function()
M.type_definition = function() vim.lsp.buf.type_definition() end vim.cmd("Telescope lsp_definitions")
M.declarations = function() vim.lsp.buf.declaration() end end
M.implementations = function() vim.cmd("Telescope lsp_implementations") end M.type_definition = function()
M.references = function() vim.cmd("Telescope lsp_references") end vim.lsp.buf.type_definition()
M.hover = function() vim.lsp.buf.hover() end end
M.rename = function() vim.lsp.buf.rename() end M.declarations = function()
M.signature_help = function() vim.lsp.buf.signature_help() end vim.lsp.buf.declaration()
M.symbols = function() vim.cmd("Telescope lsp_workspace_symbols") end end
M.refresh_codelens = function() vim.lsp.codelens.refresh() end M.implementations = function()
M.run_codelens = function() vim.lsp.codelens.run() end vim.cmd("Telescope lsp_implementations")
M.toggle_inlay_hint = function() vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled(0)) end end
M.references = function()
vim.cmd("Telescope lsp_references")
end
M.hover = function()
vim.lsp.buf.hover()
end
M.rename = function()
vim.lsp.buf.rename()
end
M.signature_help = function()
vim.lsp.buf.signature_help()
end
M.symbols = function()
vim.cmd("Telescope lsp_workspace_symbols")
end
M.refresh_codelens = function()
vim.lsp.codelens.refresh()
end
M.run_codelens = function()
vim.lsp.codelens.run()
end
M.toggle_inlay_hint = function()
vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled(0))
end
M.diagnostics = function() M.diagnostics = function()
local _, win = vim.diagnostic.open_float() local _, win = vim.diagnostic.open_float()
if win then if win then
vim.api.nvim_win_set_config(win, { border = "rounded" }) vim.api.nvim_win_set_config(win, { border = "rounded" })
vim.wo[win].signcolumn = "yes:1" vim.wo[win].signcolumn = "yes:1"
end end
end
M.next_diagnostic = function()
vim.diagnostic.goto_next()
end
M.prev_diagnostic = function()
vim.diagnostic.goto_prev()
end end
M.next_diagnostic = function() vim.diagnostic.goto_next() end
M.prev_diagnostic = function() vim.diagnostic.goto_prev() end
M.format = function() M.format = function()
vim.api.nvim_create_autocmd("TextChanged", { vim.api.nvim_create_autocmd("TextChanged", {
group = vim.api.nvim_create_augroup("ApplyFormattingEdit", {}), group = vim.api.nvim_create_augroup("ApplyFormattingEdit", {}),
buffer = vim.api.nvim_get_current_buf(), buffer = vim.api.nvim_get_current_buf(),
callback = function() callback = function()
vim.cmd("silent noautocmd update") vim.cmd("silent noautocmd update")
vim.diagnostic.show() vim.diagnostic.show()
vim.api.nvim_del_augroup_by_name("ApplyFormattingEdit") vim.api.nvim_del_augroup_by_name("ApplyFormattingEdit")
end, end,
}) })
vim.lsp.buf.format({ vim.lsp.buf.format({
async = true, async = true,
filter = function(client) return client.name == "null-ls" end, filter = function(client)
}) return client.name == "null-ls"
end,
})
end end
return M return M

View file

@ -1,59 +1,63 @@
local M = {} local M = {}
local make_config = function(name, config) local make_config = function(name, config)
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.colorProvider = { dynamicRegistration = true } capabilities.textDocument.colorProvider = { dynamicRegistration = true }
local extended_config = vim.tbl_extend("error", { capabilities = capabilities }, config) local extended_config = vim.tbl_extend("error", { capabilities = capabilities }, config)
return function() require("lspconfig")[name].setup(extended_config) end return function()
require("lspconfig")[name].setup(extended_config)
end
end end
-- Default handler -- Default handler
M[1] = function(server_name) make_config(server_name, {})() end M[1] = function(server_name)
make_config(server_name, {})()
end
M.lua_ls = make_config("lua_ls", { M.lua_ls = make_config("lua_ls", {
settings = { settings = {
Lua = { Lua = {
hint = { hint = {
enable = true, enable = true,
}, },
diagnostics = { diagnostics = {
globals = { "vim" }, globals = { "vim" },
}, },
workspace = { workspace = {
library = { library = {
"/usr/local/share/nvim/runtime/lua", "/usr/local/share/nvim/runtime/lua",
"~/.local/share/nvim/lazy/neodev.nvim/types/stable", "~/.local/share/nvim/lazy/neodev.nvim/types/stable",
}, },
}, },
}, },
}, },
}) })
M.cssls = make_config("cssls", { M.cssls = make_config("cssls", {
settings = { settings = {
css = { css = {
validate = true, validate = true,
lint = { lint = {
unknownAtRules = "ignore", unknownAtRules = "ignore",
}, },
}, },
}, },
}) })
M.tailwindcss = make_config("tailwindcss", { M.tailwindcss = make_config("tailwindcss", {
on_attach = function() on_attach = function()
local bufnr = vim.api.nvim_get_current_buf() local bufnr = vim.api.nvim_get_current_buf()
require("document-color").buf_attach(bufnr) require("document-color").buf_attach(bufnr)
end, end,
}) })
M.clangd = make_config("clangd", { M.clangd = make_config("clangd", {
cmd = { cmd = {
"clangd", "clangd",
"--offset-encoding=utf-16", "--offset-encoding=utf-16",
}, },
}) })
return M return M

View file

@ -4,49 +4,49 @@ local l, cmd = map.leader, map.cmd
local fmt = require("utils.icons").fmt local fmt = require("utils.icons").fmt
return { return {
["textDocument/formatting"] = { ["textDocument/formatting"] = {
[l("lf")] = { lsp.format, fmt("Format", "Format buffer") }, [l("lf")] = { lsp.format, fmt("Format", "Format buffer") },
}, },
["textDocument/publishDiagnostics"] = { ["textDocument/publishDiagnostics"] = {
[l("ld")] = { lsp.diagnostics, fmt("Warn", "Hover diagnostic") }, [l("ld")] = { lsp.diagnostics, fmt("Warn", "Hover diagnostic") },
["<A-i>"] = { lsp.next_diagnostic, "Next diagnostic" }, ["<A-i>"] = { lsp.next_diagnostic, "Next diagnostic" },
["<A-o>"] = { lsp.prev_diagnostic, "Previous diagnostic" }, ["<A-o>"] = { lsp.prev_diagnostic, "Previous diagnostic" },
}, },
["textDocument/codeAction"] = { ["textDocument/codeAction"] = {
[l("a ")] = { cmd("CodeActionToggleLabel"), fmt("Toggle", "Toggle label") }, [l("a ")] = { cmd("CodeActionToggleLabel"), fmt("Toggle", "Toggle label") },
}, },
["textDocument/definition"] = { ["textDocument/definition"] = {
["gd"] = { lsp.definitions, "Go to definition" }, ["gd"] = { lsp.definitions, "Go to definition" },
}, },
["textDocument/declaration"] = { ["textDocument/declaration"] = {
["gD"] = { lsp.declarations, "Go to declaration" }, ["gD"] = { lsp.declarations, "Go to declaration" },
}, },
["textDocument/hover"] = { ["textDocument/hover"] = {
["K"] = { lsp.hover, "Hover info" }, ["K"] = { lsp.hover, "Hover info" },
}, },
["textDocument/implementation"] = { ["textDocument/implementation"] = {
["gI"] = { lsp.implementations, "Symbol implementation" }, ["gI"] = { lsp.implementations, "Symbol implementation" },
}, },
["textDocument/references"] = { ["textDocument/references"] = {
["gr"] = { lsp.references, "Go to reference" }, ["gr"] = { lsp.references, "Go to reference" },
}, },
["textDocument/rename"] = { ["textDocument/rename"] = {
["<leader>lr"] = { lsp.rename, fmt("Edit", "Rename symbol") }, ["<leader>lr"] = { lsp.rename, fmt("Edit", "Rename symbol") },
}, },
["textDocument/signatureHelp"] = { ["textDocument/signatureHelp"] = {
["<leader>lH"] = { lsp.signature_help, fmt("Help", "Signature help") }, ["<leader>lH"] = { lsp.signature_help, fmt("Help", "Signature help") },
}, },
["textDocument/typeDefinition"] = { ["textDocument/typeDefinition"] = {
["gT"] = { lsp.type_definition, "Go to type definition" }, ["gT"] = { lsp.type_definition, "Go to type definition" },
}, },
["textDocument/codeLens"] = { ["textDocument/codeLens"] = {
["<leader>ll"] = { lsp.run_codelens, fmt("Run", "Run codelens") }, ["<leader>ll"] = { lsp.run_codelens, fmt("Run", "Run codelens") },
["<leader>lL"] = { lsp.refresh_codelens, fmt("Restart", "Refresh codelens") }, ["<leader>lL"] = { lsp.refresh_codelens, fmt("Restart", "Refresh codelens") },
}, },
["workspace/symbol"] = { ["workspace/symbol"] = {
["<leader>ls"] = { lsp.symbols, fmt("Symbol", "Workspace symbols") }, ["<leader>ls"] = { lsp.symbols, fmt("Symbol", "Workspace symbols") },
}, },
["workspace/inlayHint"] = { ["workspace/inlayHint"] = {
["<leader>lh"] = { lsp.toggle_inlay_hint, fmt("Toggle", "Toggle inlay hint") }, ["<leader>lh"] = { lsp.toggle_inlay_hint, fmt("Toggle", "Toggle inlay hint") },
}, },
} }

View file

@ -1,102 +1,106 @@
local format = require("utils.icons").fmt local format = require("utils.icons").fmt
return { return {
{ {
"psliwka/vim-smoothie", "psliwka/vim-smoothie",
keys = { "<C-u>", "<C-d>", "zz" }, keys = { "<C-u>", "<C-d>", "zz" },
}, },
{ {
"numToStr/Comment.nvim", "numToStr/Comment.nvim",
dependencies = { "JoosepAlviste/nvim-ts-context-commentstring" }, dependencies = { "JoosepAlviste/nvim-ts-context-commentstring" },
keys = { keys = {
{ "gcc", mode = { "n" }, desc = "Comment line" }, { "gcc", mode = { "n" }, desc = "Comment line" },
{ "gc", mode = { "v" }, desc = "Comment selection" }, { "gc", mode = { "v" }, desc = "Comment selection" },
}, },
config = function() config = function()
local ft = require("Comment.ft") local ft = require("Comment.ft")
ft.hypr = { "# %s" } ft.hypr = { "# %s" }
require("Comment").setup({ require("Comment").setup({
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(), pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
}) })
end, end,
}, },
{ {
"NMAC427/guess-indent.nvim", "NMAC427/guess-indent.nvim",
event = { "BufReadPost", "BufNewFile" }, event = { "BufReadPost", "BufNewFile" },
opts = { opts = {
autocmd = true, autocmd = true,
}, },
}, },
{ {
"ojroques/nvim-bufdel", "ojroques/nvim-bufdel",
cmd = { "BufDel", "BufDelAll", "BufDelOthers" }, cmd = { "BufDel", "BufDelAll", "BufDelOthers" },
opts = { quit = false }, opts = { quit = false },
}, },
{ {
"fedepujol/move.nvim", "fedepujol/move.nvim",
cmd = { cmd = {
"MoveLine", "MoveLine",
"MoveHChar", "MoveHChar",
"MoveBlock", "MoveBlock",
"MoveHBlock", "MoveHBlock",
}, },
}, },
{ {
"windwp/nvim-autopairs", "windwp/nvim-autopairs",
event = "InsertEnter", event = "InsertEnter",
opts = {}, opts = {},
}, },
{ {
"kylechui/nvim-surround", "kylechui/nvim-surround",
keys = { keys = {
{ "cs", mode = { "n" }, desc = "Change surrounding pair" }, { "cs", mode = { "n" }, desc = "Change surrounding pair" },
{ "ds", mode = { "n" }, desc = "Delete surrounding pair" }, { "ds", mode = { "n" }, desc = "Delete surrounding pair" },
{ "ys", mode = { "n" }, desc = "Add surrounding pair" }, { "ys", mode = { "n" }, desc = "Add surrounding pair" },
{ "S", mode = { "v" }, desc = "Add surrounding pair" }, { "S", mode = { "v" }, desc = "Add surrounding pair" },
}, },
config = function() require("nvim-surround").setup() end, config = function()
}, require("nvim-surround").setup()
end,
},
{ {
"kevinhwang91/nvim-ufo", "kevinhwang91/nvim-ufo",
event = { "BufReadPost", "BufNewFile" }, event = { "BufReadPost", "BufNewFile" },
dependencies = { "kevinhwang91/promise-async" }, dependencies = { "kevinhwang91/promise-async" },
opts = { opts = {
provider_selector = function() return { "treesitter", "indent" } end, provider_selector = function()
}, return { "treesitter", "indent" }
}, end,
},
},
{ {
"RRethy/vim-illuminate", "RRethy/vim-illuminate",
event = { "BufReadPost", "BufNewFile" }, event = { "BufReadPost", "BufNewFile" },
config = function() config = function()
require("illuminate").configure({ require("illuminate").configure({
filetypes_denylist = { filetypes_denylist = {
"neo-tree", "neo-tree",
"dropbar_menu", "dropbar_menu",
"CodeAction", "CodeAction",
}, },
}) })
end, end,
}, },
{ {
"Wansmer/treesj", "Wansmer/treesj",
dependencies = { "nvim-treesitter/nvim-treesitter" }, dependencies = { "nvim-treesitter/nvim-treesitter" },
keys = { keys = {
{ "<leader>j", mode = { "n" }, ":TSJSplit<CR>", desc = format("Down", "Split node") }, { "<leader>j", mode = { "n" }, ":TSJSplit<CR>", desc = format("Down", "Split node") },
{ "<leader>J", mode = { "n" }, ":TSJJoin<CR>", desc = format("Up", "Join node") }, { "<leader>J", mode = { "n" }, ":TSJJoin<CR>", desc = format("Up", "Join node") },
}, },
opts = { opts = {
use_default_keymaps = false, use_default_keymaps = false,
}, },
}, },
} }

View file

@ -1,17 +1,17 @@
return { return {
"lewis6991/gitsigns.nvim", "lewis6991/gitsigns.nvim",
event = { "BufReadPre", "BufNewFile" }, event = { "BufReadPre", "BufNewFile" },
opts = { opts = {
signs = { signs = {
add = { hl = "GitSignsAdd", text = "" }, add = { hl = "GitSignsAdd", text = "" },
change = { hl = "GitSignsChange", text = "" }, change = { hl = "GitSignsChange", text = "" },
untracked = { hl = "GitSignsAdd", text = "" }, untracked = { hl = "GitSignsAdd", text = "" },
delete = { hl = "GitSignsDelete", text = "" }, delete = { hl = "GitSignsDelete", text = "" },
topdelete = { hl = "GitSignsDelete", text = "" }, topdelete = { hl = "GitSignsDelete", text = "" },
changedelete = { hl = "GitSignsChange", text = "" }, changedelete = { hl = "GitSignsChange", text = "" },
}, },
preview_config = { preview_config = {
border = "none", border = "none",
}, },
}, },
} }

View file

@ -1,126 +1,131 @@
return { return {
{ {
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
dependencies = { "rafamadriz/friendly-snippets" }, dependencies = { "rafamadriz/friendly-snippets" },
event = "InsertEnter", event = "InsertEnter",
build = "make install_jsregexp", build = "make install_jsregexp",
config = function() require("luasnip.loaders.from_vscode").lazy_load() end, config = function()
}, require("luasnip.loaders.from_vscode").lazy_load()
end,
},
{ {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
event = { "InsertEnter", "CmdlineEnter" }, event = { "InsertEnter", "CmdlineEnter" },
dependencies = { dependencies = {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer", "hrsh7th/cmp-buffer",
"hrsh7th/cmp-path", "hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline", "hrsh7th/cmp-cmdline",
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip", "saadparwaiz1/cmp_luasnip",
"onsails/lspkind-nvim", "onsails/lspkind-nvim",
"windwp/nvim-autopairs", "windwp/nvim-autopairs",
}, },
opts = function() opts = function()
local cmp = require("cmp") local cmp = require("cmp")
local cmp_autopairs = require("nvim-autopairs.completion.cmp") local cmp_autopairs = require("nvim-autopairs.completion.cmp")
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
cmp.setup.cmdline(":", { cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = "path" }, { name = "path" },
}, { }, {
{ name = "cmdline" }, { name = "cmdline" },
}), }),
}) })
local lspkind_status_ok, lspkind = pcall(require, "lspkind") local lspkind_status_ok, lspkind = pcall(require, "lspkind")
local snip_status_ok, luasnip = pcall(require, "luasnip") local snip_status_ok, luasnip = pcall(require, "luasnip")
if not snip_status_ok then return end if not snip_status_ok then
return
end
local win_conf = cmp.config.window.bordered({ local win_conf = cmp.config.window.bordered({
winhighlight = "FloatBorder:FloatBorder", winhighlight = "FloatBorder:FloatBorder",
scrollbar = false, scrollbar = false,
}) })
return { return {
snippet = { snippet = {
expand = function(args) luasnip.lsp_expand(args.body) end, expand = function(args)
}, luasnip.lsp_expand(args.body)
window = { end,
completion = win_conf, },
documentation = win_conf, window = {
}, completion = win_conf,
sources = cmp.config.sources({ documentation = win_conf,
{ name = "nvim_lsp", priority = 1000 }, },
{ name = "crates", priority = 1000 }, sources = cmp.config.sources({
{ name = "vim-dadbod-completion", priority = 1000 }, { name = "nvim_lsp", priority = 1000 },
{ name = "luasnip", priority = 750 }, { name = "crates", priority = 1000 },
{ name = "buffer", priority = 500 }, { name = "vim-dadbod-completion", priority = 1000 },
{ name = "path", priority = 250 }, { name = "luasnip", priority = 750 },
}), { name = "buffer", priority = 500 },
mapping = { { name = "path", priority = 250 },
["<Up>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), }),
["<Down>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), mapping = {
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), ["<Up>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), ["<Down>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), ["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), ["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-u>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }), ["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }), ["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), ["<C-u>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
["<C-y>"] = cmp.config.disable, ["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
["<C-e>"] = cmp.mapping({ i = cmp.mapping.abort(), c = cmp.mapping.close() }), ["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<CR>"] = cmp.mapping.confirm({ select = false }), ["<C-y>"] = cmp.config.disable,
["<Tab>"] = cmp.mapping(function(fallback) ["<C-e>"] = cmp.mapping({ i = cmp.mapping.abort(), c = cmp.mapping.close() }),
if cmp.visible() then ["<CR>"] = cmp.mapping.confirm({ select = false }),
cmp.select_next_item() ["<Tab>"] = cmp.mapping(function(fallback)
elseif luasnip.expand_or_jumpable() then if cmp.visible() then
luasnip.expand_or_jump() cmp.select_next_item()
else elseif luasnip.expand_or_jumpable() then
fallback() luasnip.expand_or_jump()
end else
end, { "i", "s" }), fallback()
["<S-Tab>"] = cmp.mapping(function(fallback) end
if cmp.visible() then end, { "i", "s" }),
cmp.select_prev_item() ["<S-Tab>"] = cmp.mapping(function(fallback)
elseif luasnip.jumpable(-1) then if cmp.visible() then
luasnip.jump(-1) cmp.select_prev_item()
else elseif luasnip.jumpable(-1) then
fallback() luasnip.jump(-1)
end else
end, { "i", "s" }), fallback()
}, end
formatting = { end, { "i", "s" }),
format = lspkind_status_ok },
and lspkind.cmp_format({ formatting = {
mode = "symbol", format = lspkind_status_ok and lspkind.cmp_format({
maxwidth = 25, mode = "symbol",
ellipsis_char = "...", maxwidth = 25,
before = function(entry, vim_item) ellipsis_char = "...",
if vim_item.kind == "Color" and entry.completion_item.documentation then before = function(entry, vim_item)
local _, _, r, g, b = if vim_item.kind == "Color" and entry.completion_item.documentation then
string.find(entry.completion_item.documentation, "^rgb%((%d+), (%d+), (%d+)") local _, _, r, g, b =
if r then string.find(entry.completion_item.documentation, "^rgb%((%d+), (%d+), (%d+)")
local color = string.format("%02x", r) if r then
.. string.format("%02x", g) local color = string.format("%02x", r)
.. string.format("%02x", b) .. string.format("%02x", g)
local group = "Tw_" .. color .. string.format("%02x", b)
if vim.fn.hlID(group) < 1 then local group = "Tw_" .. color
vim.api.nvim_set_hl(0, group, { fg = "#" .. color }) if vim.fn.hlID(group) < 1 then
end vim.api.nvim_set_hl(0, group, { fg = "#" .. color })
vim_item.kind_hl_group = group end
return vim_item vim_item.kind_hl_group = group
end return vim_item
end end
return vim_item end
end, return vim_item
}), end,
}, }),
} },
end, }
}, end,
},
} }

View file

@ -1,17 +1,17 @@
return { return {
"mfussenegger/nvim-dap", "mfussenegger/nvim-dap",
keys = { keys = {
{ "<leader>d", mode = { "n" } }, { "<leader>d", mode = { "n" } },
}, },
cmd = { "DapContinue", "DapToggleBreakpoint" }, cmd = { "DapContinue", "DapToggleBreakpoint" },
dependencies = { dependencies = {
{ "rcarriga/nvim-dap-ui", opts = {} }, { "rcarriga/nvim-dap-ui", opts = {} },
{ "nvim-neotest/nvim-nio" }, { "nvim-neotest/nvim-nio" },
{ {
"theHamsta/nvim-dap-virtual-text", "theHamsta/nvim-dap-virtual-text",
opts = { opts = {
virt_text_pos = "eol", virt_text_pos = "eol",
}, },
}, },
}, },
} }

View file

@ -1,65 +1,69 @@
return { return {
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
dependencies = { "windwp/nvim-ts-autotag" }, dependencies = { "windwp/nvim-ts-autotag" },
event = { "BufReadPost", "BufNewFile" }, event = { "BufReadPost", "BufNewFile" },
cmd = { cmd = {
"TSBufDisable", "TSBufDisable",
"TSBufEnable", "TSBufEnable",
"TSBufToggle", "TSBufToggle",
"TSDisable", "TSDisable",
"TSEnable", "TSEnable",
"TSToggle", "TSToggle",
"TSInstall", "TSInstall",
"TSInstallInfo", "TSInstallInfo",
"TSInstallSync", "TSInstallSync",
"TSModuleInfo", "TSModuleInfo",
"TSUninstall", "TSUninstall",
"TSUpdate", "TSUpdate",
"TSUpdateSync", "TSUpdateSync",
}, },
build = ":TSUpdate", build = ":TSUpdate",
opts = { opts = {
highlight = { highlight = {
enable = true, enable = true,
disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end, disable = function(_, bufnr)
}, return vim.api.nvim_buf_line_count(bufnr) > 10000
incremental_selection = { enable = true }, end,
indent = { enable = true }, },
autotag = { enable = true }, incremental_selection = { enable = true },
context_commentstring = { indent = { enable = true },
enable = true, autotag = { enable = true },
enable_autocmd = false, context_commentstring = {
}, enable = true,
ensure_installed = { enable_autocmd = false,
"bash", },
"c", ensure_installed = {
"html", "bash",
"css", "c",
"javascript", "html",
"json", "css",
"toml", "javascript",
"lua", "json",
"luadoc", "toml",
"luap", "lua",
"markdown", "luadoc",
"markdown_inline", "luap",
"python", "markdown",
"rust", "markdown_inline",
"tsx", "python",
"typescript", "rust",
"vim", "tsx",
"vimdoc", "typescript",
"yaml", "vim",
"sql", "vimdoc",
"query", "yaml",
"java", "sql",
"http", "query",
"rasi", "java",
"haskell", "http",
"ebnf", "rasi",
}, "haskell",
}, "ebnf",
config = function(_, opts) require("nvim-treesitter.configs").setup(opts) end, },
}, },
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
end,
},
} }

View file

@ -1,14 +1,14 @@
return { return {
'stevearc/overseer.nvim', "stevearc/overseer.nvim",
opts = { opts = {
task_list = { task_list = {
direction = "bottom", direction = "bottom",
}, },
}, },
dependencies = { dependencies = {
{ {
'stevearc/dressing.nvim', "stevearc/dressing.nvim",
opts = {}, opts = {},
} },
}, },
} }

View file

@ -1,10 +1,10 @@
return { return {
"Shatur/neovim-session-manager", "Shatur/neovim-session-manager",
cmd = { "SessionManager" }, cmd = { "SessionManager" },
config = function() config = function()
local config = require("session_manager.config") local config = require("session_manager.config")
require("session_manager").setup({ require("session_manager").setup({
autoload_mode = config.AutoloadMode.Disabled, autoload_mode = config.AutoloadMode.Disabled,
}) })
end, end,
} }

View file

@ -1,25 +1,25 @@
local format = require("utils.icons").fmt local format = require("utils.icons").fmt
return { return {
{ {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
cmd = { "Telescope" }, cmd = { "Telescope" },
dependencies = { dependencies = {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
"nvim-telescope/telescope-fzf-native.nvim", "nvim-telescope/telescope-fzf-native.nvim",
"nvim-telescope/telescope-dap.nvim", "nvim-telescope/telescope-dap.nvim",
}, },
opts = { opts = {
defaults = { defaults = {
border = true, border = true,
prompt_prefix = " ", prompt_prefix = " ",
selection_caret = format("Right", ""), selection_caret = format("Right", ""),
}, },
extensions = { extensions = {
fzf = {}, fzf = {},
aerial = {}, aerial = {},
dap = {}, dap = {},
}, },
}, },
}, },
} }

View file

@ -1,17 +1,17 @@
return { return {
"akinsho/toggleterm.nvim", "akinsho/toggleterm.nvim",
cmd = { "ToggleTerm" }, cmd = { "ToggleTerm" },
opts = { opts = {
shade_terminals = false, shade_terminals = false,
direction = "float", direction = "float",
float_opts = { float_opts = {
border = "rounded", border = "rounded",
width = 80, width = 80,
}, },
highlights = { highlights = {
FloatBorder = { FloatBorder = {
link = "FloatBorder", link = "FloatBorder",
}, },
}, },
}, },
} }

View file

@ -1,6 +1,6 @@
return { return {
{ import = "plugins.ui" }, { import = "plugins.ui" },
{ import = "plugins.editor" }, { import = "plugins.editor" },
{ import = "plugins.lsp" }, { import = "plugins.lsp" },
{ import = "plugins.tools" }, { import = "plugins.tools" },
} }

View file

@ -1,13 +1,13 @@
return { return {
"uga-rosa/ccc.nvim", "uga-rosa/ccc.nvim",
cmd = { cmd = {
"CccPick", "CccPick",
"CccConvert", "CccConvert",
"CccHighlighterEnable", "CccHighlighterEnable",
"CccHighlighterDisable", "CccHighlighterDisable",
"CccHighlighterToggle", "CccHighlighterToggle",
}, },
opts = { opts = {
alpha_show = "show" alpha_show = "show",
}, },
} }

View file

@ -1,44 +1,44 @@
local format = require("utils.icons").fmt local format = require("utils.icons").fmt
return { return {
"luckasRanarison/clear-action.nvim", "luckasRanarison/clear-action.nvim",
event = "LspAttach", event = "LspAttach",
opts = { opts = {
signs = { signs = {
show_count = false, show_count = false,
show_label = true, show_label = true,
combine = true, combine = true,
}, },
popup = { popup = {
hide_cursor = true, hide_cursor = true,
}, },
mappings = { mappings = {
code_action = { "<leader>la", format("Fix", "Code action") }, code_action = { "<leader>la", format("Fix", "Code action") },
apply_first = { "<leader>aa", format("Fix", "Apply") }, apply_first = { "<leader>aa", format("Fix", "Apply") },
quickfix = { "<leader>aq", format("Fix", "Quickfix") }, quickfix = { "<leader>aq", format("Fix", "Quickfix") },
quickfix_next = { "<leader>an", format("Fix", "Quickfix next") }, quickfix_next = { "<leader>an", format("Fix", "Quickfix next") },
quickfix_prev = { "<leader>ap", format("Fix", "Quickfix prev") }, quickfix_prev = { "<leader>ap", format("Fix", "Quickfix prev") },
refactor = { "<leader>ar", format("Fix", "Refactor") }, refactor = { "<leader>ar", format("Fix", "Refactor") },
refactor_inline = { "<leader>aR", format("Fix", "Refactor inline") }, refactor_inline = { "<leader>aR", format("Fix", "Refactor inline") },
actions = { actions = {
["rust_analyzer"] = { ["rust_analyzer"] = {
["Import"] = { "<leader>ai", format("Fix", "Import") }, ["Import"] = { "<leader>ai", format("Fix", "Import") },
["Replace if"] = { "<leader>am", format("Fix", "Replace if with match") }, ["Replace if"] = { "<leader>am", format("Fix", "Replace if with match") },
["Fill match"] = { "<leader>af", format("Fix", "Fill match arms") }, ["Fill match"] = { "<leader>af", format("Fix", "Fill match arms") },
["Wrap"] = { "<leader>aw", format("Fix", "Wrap") }, ["Wrap"] = { "<leader>aw", format("Fix", "Wrap") },
["Insert `mod"] = { "<leader>aM", format("Fix", "Insert mod") }, ["Insert `mod"] = { "<leader>aM", format("Fix", "Insert mod") },
["Insert `pub"] = { "<leader>aP", format("Fix", "Insert pub mod") }, ["Insert `pub"] = { "<leader>aP", format("Fix", "Insert pub mod") },
["Add braces"] = { "<leader>ab", format("Fix", "Add braces") }, ["Add braces"] = { "<leader>ab", format("Fix", "Add braces") },
}, },
}, },
}, },
quickfix_filters = { quickfix_filters = {
["rust_analyzer"] = { ["rust_analyzer"] = {
["E0412"] = "Import", ["E0412"] = "Import",
["E0425"] = "Import", ["E0425"] = "Import",
["E0433"] = "Import", ["E0433"] = "Import",
["unused_imports"] = "remove", ["unused_imports"] = "remove",
}, },
}, },
}, },
} }

View file

@ -1,14 +1,14 @@
return { return {
"saecki/crates.nvim", "saecki/crates.nvim",
dependencies = { dependencies = {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
"jose-elias-alvarez/null-ls.nvim", "jose-elias-alvarez/null-ls.nvim",
}, },
event = { "BufRead Cargo.toml" }, event = { "BufRead Cargo.toml" },
opts = { opts = {
null_ls = { null_ls = {
enabled = true, enabled = true,
name = "Crates", name = "Crates",
}, },
}, },
} }

View file

@ -1,5 +1,5 @@
return { return {
"mrshmllow/document-color.nvim", "mrshmllow/document-color.nvim",
lazy = true, lazy = true,
opts = {}, opts = {},
} }

View file

@ -1,18 +1,18 @@
local lua = require("utils.mappings").lua local lua = require("utils.mappings").lua
return { return {
"folke/flash.nvim", "folke/flash.nvim",
keys = { keys = {
{ "f", mode = { "n", "v" } }, { "f", mode = { "n", "v" } },
{ "F", mode = { "n", "v" } }, { "F", mode = { "n", "v" } },
{ "t", mode = { "n", "v" } }, { "t", mode = { "n", "v" } },
{ "T", mode = { "n", "v" } }, { "T", mode = { "n", "v" } },
{ "s", mode = { "n", "v" }, lua('require("flash").jump()') }, { "s", mode = { "n", "v" }, lua('require("flash").jump()') },
{ "ß", mode = "n", lua("require('flash').jump({ pattern = vim.fn.expand('<cword>') })") }, { "ß", mode = "n", lua("require('flash').jump({ pattern = vim.fn.expand('<cword>') })") },
{ "S", mode = "n", lua("require('flash').treesitter()") }, { "S", mode = "n", lua("require('flash').treesitter()") },
{ "o", mode = "o", lua("require('flash').jump()"), desc = "Search jump" }, { "o", mode = "o", lua("require('flash').jump()"), desc = "Search jump" },
{ "O", mode = "o", lua("require('flash').treesitter()"), desc = "Tresitter jump" }, { "O", mode = "o", lua("require('flash').treesitter()"), desc = "Tresitter jump" },
}, },
opts = {}, opts = {},
} }

View file

@ -1,52 +1,52 @@
return { return {
-- "luckasRanarison/nvim-devdocs", -- "luckasRanarison/nvim-devdocs",
dir = "~/Projects/nvim-devdocs", dir = "~/Projects/nvim-devdocs",
branch = "master", branch = "master",
dependencies = { dependencies = {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
}, },
cmd = { cmd = {
"DevdocsFetch", "DevdocsFetch",
"DevdocsInstall", "DevdocsInstall",
"DevdocsUninstall", "DevdocsUninstall",
"DevdocsOpen", "DevdocsOpen",
"DevdocsOpenFloat", "DevdocsOpenFloat",
"DevdocsOpenCurrent", "DevdocsOpenCurrent",
"DevdocsOpenCurrentFloat", "DevdocsOpenCurrentFloat",
"DevdocsUpdate", "DevdocsUpdate",
"DevdocsUpdateAll", "DevdocsUpdateAll",
"DevdocsBuild", "DevdocsBuild",
}, },
opts = { opts = {
format = "markdown", format = "markdown",
filetypes = { filetypes = {
javascript = { "html", "javascript" }, javascript = { "html", "javascript" },
}, },
-- use_node = false, -- use_node = false,
ensure_installed = { ensure_installed = {
-- "git", -- "git",
-- "bash", -- "bash",
-- "rust", -- "rust",
-- "lua-5.4", -- "lua-5.4",
-- "html", -- "html",
-- "css", -- "css",
-- "javascript", -- "javascript",
-- "typescript", -- "typescript",
-- "react", -- "react",
-- "web_extensions", -- "web_extensions",
}, },
wrap = true, wrap = true,
previewer_cmd = "glow", previewer_cmd = "glow",
cmd_args = { "-s", "auto", "-w", "97" }, cmd_args = { "-s", "auto", "-w", "97" },
cmd_ignore = {}, cmd_ignore = {},
picker_cmd = true, picker_cmd = true,
picker_cmd_args = { "-s", "auto", "-w", "45" }, picker_cmd_args = { "-s", "auto", "-w", "45" },
mappings = { mappings = {
open_in_browser = "<leader>vb", open_in_browser = "<leader>vb",
toggle_rendering = "<leader>vr", toggle_rendering = "<leader>vr",
}, },
log_level = "debug", log_level = "debug",
}, },
} }

View file

@ -1,20 +1,20 @@
return { return {
"kristijanhusak/vim-dadbod-ui", "kristijanhusak/vim-dadbod-ui",
dependencies = { dependencies = {
"tpope/vim-dadbod", "tpope/vim-dadbod",
"kristijanhusak/vim-dadbod-completion", "kristijanhusak/vim-dadbod-completion",
}, },
cmd = { cmd = {
"DBUI", "DBUI",
"DBUIAddConnection", "DBUIAddConnection",
"DBUIClose", "DBUIClose",
"DBUIToggle", "DBUIToggle",
"DBUIFindBuffer", "DBUIFindBuffer",
"DBUIRenameBuffer", "DBUIRenameBuffer",
"DBUILastQueryInfo", "DBUILastQueryInfo",
}, },
config = function() config = function()
vim.g.db_ui_notification_width = 1 vim.g.db_ui_notification_width = 1
vim.g.db_ui_debug = 1 vim.g.db_ui_debug = 1
end, end,
} }

View file

@ -1,35 +1,31 @@
local format = require("utils.icons").fmt local format = require("utils.icons").fmt
return { return {
"goolord/alpha-nvim", "goolord/alpha-nvim",
config = function() config = function()
local alpha = require("alpha") local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard") local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = { dashboard.section.header.val = {
[[ ]], [[ ]],
[[  ]], [[  ]],
[[ ████ ██████ █████ ██ ]], [[ ████ ██████ █████ ██ ]],
[[ ███████████ █████  ]], [[ ███████████ █████  ]],
[[ █████████ ███████████████████ ███ ███████████ ]], [[ █████████ ███████████████████ ███ ███████████ ]],
[[ █████████ ███ █████████████ █████ ██████████████ ]], [[ █████████ ███ █████████████ █████ ██████████████ ]],
[[ █████████ ██████████ █████████ █████ █████ ████ █████ ]], [[ █████████ ██████████ █████████ █████ █████ ████ █████ ]],
[[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]], [[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]],
[[ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]], [[ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]],
[[ ]], [[ ]],
} }
dashboard.section.buttons.val = { dashboard.section.buttons.val = {
dashboard.button("n", format("NewFile", "New file", 2), ":ene <BAR> startinsert <CR>"), dashboard.button("n", format("NewFile", "New file", 2), ":ene <BAR> startinsert <CR>"),
dashboard.button("f", format("Search", "Find file", 2), ":Telescope find_files<CR>"), dashboard.button("f", format("Search", "Find file", 2), ":Telescope find_files<CR>"),
dashboard.button("l", format("History", "Recents", 2), ":SessionManager load_session<CR>"), dashboard.button("l", format("History", "Recents", 2), ":SessionManager load_session<CR>"),
dashboard.button( dashboard.button("L", format("FolderOpened", "Last session", 2), ":SessionManager load_last_session<CR>"),
"L", dashboard.button("q", format("Exit", "Quit", 2), ":qa<CR>"),
format("FolderOpened", "Last session", 2), }
":SessionManager load_last_session<CR>" dashboard.config.layout[1].val = vim.fn.max({ 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) })
), dashboard.config.layout[3].val = 2
dashboard.button("q", format("Exit", "Quit", 2), ":qa<CR>"), alpha.setup(dashboard.config)
} end,
dashboard.config.layout[1].val = vim.fn.max({ 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) })
dashboard.config.layout[3].val = 2
alpha.setup(dashboard.config)
end,
} }

View file

@ -1,49 +1,49 @@
local format = require("utils.icons").fmt local format = require("utils.icons").fmt
return { return {
"akinsho/bufferline.nvim", "akinsho/bufferline.nvim",
event = { "BufReadPost", "BufNewFile" }, event = { "BufReadPost", "BufNewFile" },
dependencies = "nvim-tree/nvim-web-devicons", dependencies = "nvim-tree/nvim-web-devicons",
opts = { opts = {
options = { options = {
diagnostics = "nvim_lsp", diagnostics = "nvim_lsp",
diagnostics_update_in_insert = true, diagnostics_update_in_insert = true,
diagnostics_indicator = nil, diagnostics_indicator = nil,
indicator = "none", indicator = "none",
offsets = { offsets = {
{ {
filetype = "neo-tree", filetype = "neo-tree",
text = format("Folder", "NeoTree"), text = format("Folder", "NeoTree"),
text_align = "left", text_align = "left",
separator = "", separator = "",
}, },
{ {
filetype = "dapui_watches", filetype = "dapui_watches",
text = format("Debugger", "DapUI"), text = format("Debugger", "DapUI"),
text_align = "left", text_align = "left",
separator = "", separator = "",
}, },
{ {
filetype = "dbui", filetype = "dbui",
text = format("Database", "DbUI"), text = format("Database", "DbUI"),
text_align = "left", text_align = "left",
separator = "", separator = "",
}, },
}, },
}, },
}, },
config = function(_, opts) config = function(_, opts)
local colors = require("tokyonight.colors") local colors = require("tokyonight.colors")
vim.opt.showtabline = 2 vim.opt.showtabline = 2
opts.highlights = { opts.highlights = {
background = { bg = colors.night.bg }, background = { bg = colors.night.bg },
close_button = { bg = colors.night.bg }, close_button = { bg = colors.night.bg },
separator = { fg = colors.night.bg, bg = colors.night.bg }, separator = { fg = colors.night.bg, bg = colors.night.bg },
offset_separator = { bg = colors.night.bg }, offset_separator = { bg = colors.night.bg },
pick = { bg = colors.night.bg }, pick = { bg = colors.night.bg },
} }
require("bufferline").setup(opts) require("bufferline").setup(opts)
end, end,
} }

View file

@ -1,22 +1,22 @@
return { return {
"stevearc/dressing.nvim", "stevearc/dressing.nvim",
event = "VeryLazy", event = "VeryLazy",
config = function() config = function()
local theme = require("telescope.themes").get_dropdown() local theme = require("telescope.themes").get_dropdown()
theme.layout_config = { theme.layout_config = {
width = 60, width = 60,
height = 17, height = 17,
} }
require("dressing").setup({ require("dressing").setup({
input = { input = {
enabled = false, enabled = false,
}, },
select = { select = {
backend = { "telescope" }, backend = { "telescope" },
telescope = theme, telescope = theme,
}, },
}) })
end, end,
} }

View file

@ -1,41 +1,41 @@
return { return {
"lukas-reineke/indent-blankline.nvim", "lukas-reineke/indent-blankline.nvim",
event = { "BufReadPost", "BufNewFile" }, event = { "BufReadPost", "BufNewFile" },
main = "ibl", main = "ibl",
opts = { opts = {
exclude = { exclude = {
buftypes = { buftypes = {
"nofile", "nofile",
"terminal", "terminal",
}, },
filetypes = { filetypes = {
"help", "help",
"startify", "startify",
"aerial", "aerial",
"alpha", "alpha",
"dashboard", "dashboard",
"lazy", "lazy",
"neogitstatus", "neogitstatus",
"neo-tree", "neo-tree",
"Trouble", "Trouble",
"dbout", "dbout",
"TelescopePrompt", "TelescopePrompt",
}, },
}, },
scope = { scope = {
show_start = false, show_start = false,
show_end = false, show_end = false,
highlight = { "@keyword" }, highlight = { "@keyword" },
char = "", char = "",
include = { include = {
node_type = { node_type = {
lua = { "table_constructor" }, lua = { "table_constructor" },
}, },
}, },
}, },
whitespace = { whitespace = {
remove_blankline_trail = true, remove_blankline_trail = true,
}, },
indent = { char = "" }, indent = { char = "" },
}, },
} }

View file

@ -1,31 +1,31 @@
local sources = require("plugins.utils.lualine_sources") local sources = require("plugins.utils.lualine_sources")
return { return {
"nvim-lualine/lualine.nvim", "nvim-lualine/lualine.nvim",
event = { "BufReadPost", "BufNewFile" }, event = { "BufReadPost", "BufNewFile" },
dependencies = { "nvim-tree/nvim-web-devicons" }, dependencies = { "nvim-tree/nvim-web-devicons" },
config = function(_, opts) config = function(_, opts)
local colors = require("tokyonight.colors") local colors = require("tokyonight.colors")
local tokyonight = require("lualine.themes.tokyonight") local tokyonight = require("lualine.themes.tokyonight")
vim.opt.laststatus = 3 vim.opt.laststatus = 3
tokyonight.normal.c.bg = colors.night.bg tokyonight.normal.c.bg = colors.night.bg
opts.options.theme = tokyonight opts.options.theme = tokyonight
require("lualine").setup(opts) require("lualine").setup(opts)
end, end,
opts = { opts = {
options = { options = {
component_separators = { left = "", right = "" }, component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" }, section_separators = { left = "", right = "" },
}, },
sections = { sections = {
lualine_a = { sources.mode }, lualine_a = { sources.mode },
lualine_b = { sources.branch, sources.diff }, lualine_b = { sources.branch, sources.diff },
lualine_c = { sources.filetype, sources.macro }, lualine_c = { sources.filetype, sources.macro },
lualine_x = { sources.lsp, sources.diagnostics }, lualine_x = { sources.lsp, sources.diagnostics },
lualine_y = { sources.indentation, sources.encoding, sources.fileformat }, lualine_y = { sources.indentation, sources.encoding, sources.fileformat },
lualine_z = { sources.progress, sources.location }, lualine_z = { sources.progress, sources.location },
}, },
}, },
} }

View file

@ -1,84 +1,84 @@
local icons = require("utils.icons").icons local icons = require("utils.icons").icons
return { return {
{ {
"nvim-neo-tree/neo-tree.nvim", "nvim-neo-tree/neo-tree.nvim",
dependencies = { dependencies = {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim", "MunifTanjim/nui.nvim",
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
"luckasRanarison/neo-rename.nvim", "luckasRanarison/neo-rename.nvim",
}, },
cmd = "Neotree", cmd = "Neotree",
opts = { opts = {
enable_git_status = true, enable_git_status = true,
close_if_last_window = true, close_if_last_window = true,
auto_clean_after_session_restore = true, auto_clean_after_session_restore = true,
window = { window = {
width = 30, width = 30,
mappings = { mappings = {
["<space>"] = false, ["<space>"] = false,
["s"] = false, ["s"] = false,
["l"] = "open", ["l"] = "open",
["v"] = "open_vsplit", ["v"] = "open_vsplit",
["gA"] = "git_add_all", ["gA"] = "git_add_all",
["ga"] = "git_add_file", ["ga"] = "git_add_file",
["gu"] = "git_unstage_file", ["gu"] = "git_unstage_file",
["gr"] = "git_revert_file", ["gr"] = "git_revert_file",
}, },
}, },
filesystem = { filesystem = {
follow_current_file = { enabled = true }, follow_current_file = { enabled = true },
hijack_netrw_behavior = "open_current", hijack_netrw_behavior = "open_current",
use_libuv_file_watcher = true, use_libuv_file_watcher = true,
}, },
default_component_configs = { default_component_configs = {
icon = { icon = {
folder_empty = icons.EmptyFolder, folder_empty = icons.EmptyFolder,
default = icons.DefaultFile, default = icons.DefaultFile,
}, },
indent = { indent = {
padding = 0, padding = 0,
indent_size = 1, indent_size = 1,
}, },
modified = { modified = {
symbol = icons.SmallDot, symbol = icons.SmallDot,
}, },
name = { name = {
use_git_status_colors = true, use_git_status_colors = true,
}, },
git_status = { git_status = {
symbols = { symbols = {
deleted = "D", deleted = "D",
renamed = "R", renamed = "R",
modified = "M", modified = "M",
added = "A", added = "A",
untracked = "U", untracked = "U",
ignored = "", ignored = "",
staged = "", staged = "",
unstaged = "!", unstaged = "!",
conflict = "C", conflict = "C",
}, },
}, },
diagnostics = { diagnostics = {
symbols = { symbols = {
hint = icons.Hint, hint = icons.Hint,
info = icons.Info, info = icons.Info,
warn = icons.Warn, warn = icons.Warn,
error = icons.Error, error = icons.Error,
}, },
highlights = { highlights = {
hint = "DiagnosticSignHint", hint = "DiagnosticSignHint",
info = "DiagnosticSignInfo", info = "DiagnosticSignInfo",
warn = "DiagnosticSignWarn", warn = "DiagnosticSignWarn",
error = "DiagnosticSignError", error = "DiagnosticSignError",
}, },
}, },
}, },
}, },
config = function(_, opts) config = function(_, opts)
require("neo-tree").setup(opts) require("neo-tree").setup(opts)
require("neo-rename").setup() require("neo-rename").setup()
end, end,
}, },
} }

View file

@ -1,34 +1,34 @@
local icons = require("utils.icons").icons local icons = require("utils.icons").icons
return { return {
"folke/noice.nvim", "folke/noice.nvim",
event = "VeryLazy", event = "VeryLazy",
dependencies = { dependencies = {
"MunifTanjim/nui.nvim", "MunifTanjim/nui.nvim",
{ "rcarriga/nvim-notify" }, { "rcarriga/nvim-notify" },
}, },
opts = { opts = {
cmdline = { cmdline = {
format = { format = {
cmdline = { pattern = "^:", icon = icons.Command, lang = "vim" }, cmdline = { pattern = "^:", icon = icons.Command, lang = "vim" },
}, },
}, },
lsp = { lsp = {
override = { override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true, ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true, ["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true, ["cmp.entry.get_documentation"] = true,
}, },
hover = { hover = {
silent = true, silent = true,
}, },
}, },
presets = { presets = {
bottom_search = false, bottom_search = false,
command_palette = true, command_palette = true,
long_message_to_split = true, long_message_to_split = true,
inc_rename = false, inc_rename = false,
lsp_doc_border = "rounded", lsp_doc_border = "rounded",
}, },
}, },
} }

View file

@ -1,158 +1,160 @@
return { return {
"folke/tokyonight.nvim", "folke/tokyonight.nvim",
lazy = false, lazy = false,
priority = 1000, priority = 1000,
init = function() vim.cmd.colorscheme("tokyonight-night") end, init = function()
opts = { vim.cmd.colorscheme("tokyonight-night")
styles = { end,
keywords = { italic = false }, opts = {
}, styles = {
on_colors = function(colors) keywords = { italic = false },
colors.gitSigns.add = colors.green },
colors.gitSigns.change = colors.blue on_colors = function(colors)
colors.gitSigns.delete = colors.red colors.gitSigns.add = colors.green
colors.gitSigns.ignored = colors.bg colors.gitSigns.change = colors.blue
colors.status_line = colors.none colors.gitSigns.delete = colors.red
return colors colors.gitSigns.ignored = colors.bg
end, colors.status_line = colors.none
on_highlights = function(hl, c) return colors
local highlights = { end,
NormalSB = { bg = nil }, on_highlights = function(hl, c)
NormalFloat = { bg = nil }, local highlights = {
FloatBorder = { fg = c.dark3 }, NormalSB = { bg = nil },
FloatTitle = { fg = c.dark3 }, NormalFloat = { bg = nil },
CursorLineNr = { fg = c.blue }, FloatBorder = { fg = c.dark3 },
Breakpoint = { fg = c.orange }, FloatTitle = { fg = c.dark3 },
WinSeparator = { fg = c.terminal_black }, CursorLineNr = { fg = c.blue },
WinBar = { bg = nil }, Breakpoint = { fg = c.orange },
WinBarNC = { bg = nil }, WinSeparator = { fg = c.terminal_black },
LspInlayHint = { fg = c.comment }, WinBar = { bg = nil },
WinBarNC = { bg = nil },
LspInlayHint = { fg = c.comment },
DiagnosticSignError = { fg = c.red }, DiagnosticSignError = { fg = c.red },
DiagnosticSignWarn = { fg = c.yellow }, DiagnosticSignWarn = { fg = c.yellow },
DiagnosticSignHint = { fg = c.blue }, DiagnosticSignHint = { fg = c.blue },
DiagnosticSignInfo = { fg = c.blue }, DiagnosticSignInfo = { fg = c.blue },
DiagnosticError = { fg = c.red }, DiagnosticError = { fg = c.red },
DiagnosticWarn = { fg = c.yellow }, DiagnosticWarn = { fg = c.yellow },
DiagnosticHint = { fg = c.blue }, DiagnosticHint = { fg = c.blue },
DiagnosticInfo = { fg = c.blue }, DiagnosticInfo = { fg = c.blue },
BufferLineFill = { bg = c.bg }, BufferLineFill = { bg = c.bg },
BufferLineCloseButtonSelected = { fg = c.red }, BufferLineCloseButtonSelected = { fg = c.red },
BufferLineError = { fg = c.red, bg = c.bg, bold = true }, BufferLineError = { fg = c.red, bg = c.bg, bold = true },
BufferLineWarning = { fg = c.yellow, bg = c.bg, bold = true }, BufferLineWarning = { fg = c.yellow, bg = c.bg, bold = true },
BufferLineHint = { fg = c.blue, bg = c.bg, bold = true }, BufferLineHint = { fg = c.blue, bg = c.bg, bold = true },
BufferLineInfo = { fg = c.blue, bg = c.bg, bold = true }, BufferLineInfo = { fg = c.blue, bg = c.bg, bold = true },
BufferLineModified = { fg = c.green, bg = c.bg }, BufferLineModified = { fg = c.green, bg = c.bg },
BufferLineDuplicate = { fg = c.comment, bg = c.bg, bold = true }, BufferLineDuplicate = { fg = c.comment, bg = c.bg, bold = true },
BufferLineDuplicateSelected = { fg = c.fg, bg = c.bg, bold = true, italic = true }, BufferLineDuplicateSelected = { fg = c.fg, bg = c.bg, bold = true, italic = true },
BufferLineTruncMarker = { bg = c.bg }, BufferLineTruncMarker = { bg = c.bg },
NeoTreeDirectoryName = { fg = c.fg }, NeoTreeDirectoryName = { fg = c.fg },
NeoTreeNormalNC = { bg = c.bg }, NeoTreeNormalNC = { bg = c.bg },
NeoTreeNormal = { bg = c.bg }, NeoTreeNormal = { bg = c.bg },
NeoTreeGitUntracked = { fg = c.orange }, NeoTreeGitUntracked = { fg = c.orange },
NeoTreeGitUnstaged = { fg = c.cyan }, NeoTreeGitUnstaged = { fg = c.cyan },
WhichKeyFloat = { bg = c.bg }, WhichKeyFloat = { bg = c.bg },
FlashLabel = { fg = c.red, bg = c.bg }, FlashLabel = { fg = c.red, bg = c.bg },
FlashCurrent = { bg = c.fg }, FlashCurrent = { bg = c.fg },
TelescopeNormal = { bg = nil }, TelescopeNormal = { bg = nil },
TelescopePromptPrefix = { fg = c.dark3 }, TelescopePromptPrefix = { fg = c.dark3 },
TelescopeBorder = { link = "FloatBorder" }, TelescopeBorder = { link = "FloatBorder" },
NotifyINFOBorder = { fg = c.blue }, NotifyINFOBorder = { fg = c.blue },
NotifyINFOTitle = { fg = c.blue }, NotifyINFOTitle = { fg = c.blue },
NotifyINFOIcon = { fg = c.blue }, NotifyINFOIcon = { fg = c.blue },
NotifyERRORBorder = { fg = c.red }, NotifyERRORBorder = { fg = c.red },
NotifyERRORTitle = { fg = c.red }, NotifyERRORTitle = { fg = c.red },
NotifyERRORIcon = { fg = c.red }, NotifyERRORIcon = { fg = c.red },
NotifyWARNBorder = { fg = c.yellow }, NotifyWARNBorder = { fg = c.yellow },
NotifyWARNTitle = { fg = c.yellow }, NotifyWARNTitle = { fg = c.yellow },
NotifyWARNIcon = { fg = c.yellow }, NotifyWARNIcon = { fg = c.yellow },
ErrorMsg = { fg = c.red }, ErrorMsg = { fg = c.red },
diffAdded = { fg = c.green }, diffAdded = { fg = c.green },
diffRemoved = { fg = c.red }, diffRemoved = { fg = c.red },
diffChanged = { fg = c.blue }, diffChanged = { fg = c.blue },
diffNewFile = { fg = c.cyan }, diffNewFile = { fg = c.cyan },
diffOldFile = { fg = c.comment }, diffOldFile = { fg = c.comment },
DiffAdd = { fg = c.green }, DiffAdd = { fg = c.green },
DiffChange = { fg = c.blue }, DiffChange = { fg = c.blue },
DiffDelete = { fg = c.red }, DiffDelete = { fg = c.red },
DiffText = { fg = c.purple }, DiffText = { fg = c.purple },
DropBarSeparator = { fg = c.dark5 }, DropBarSeparator = { fg = c.dark5 },
DropBarPick = { fg = c.red, bold = true, italic = true }, DropBarPick = { fg = c.red, bold = true, italic = true },
DropBarKind = { fg = c.fg }, DropBarKind = { fg = c.fg },
DropBarKindFolder = { fg = c.dark5 }, DropBarKindFolder = { fg = c.dark5 },
DropBarIconUIPickPivot = { link = "DropBarPick" }, DropBarIconUIPickPivot = { link = "DropBarPick" },
DropBarIconUISeparator = { link = "DropBarSeparator" }, DropBarIconUISeparator = { link = "DropBarSeparator" },
} }
for key, value in pairs(highlights) do for key, value in pairs(highlights) do
hl[key] = value hl[key] = value
end end
local dropbar_hl = { local dropbar_hl = {
"Array", "Array",
"Boolean", "Boolean",
"Constant", "Constant",
"Constructor", "Constructor",
"Enum", "Enum",
"EnumMember", "EnumMember",
"Field", "Field",
"Function", "Function",
"Identifier", "Identifier",
"List", "List",
"Macro", "Macro",
"Number", "Number",
"Object", "Object",
"Operator", "Operator",
"Package", "Package",
"Property", "Property",
"Reference", "Reference",
"String", "String",
"Type", "Type",
"TypeParameter", "TypeParameter",
"Unit", "Unit",
"Value", "Value",
"Variable", "Variable",
"Null", "Null",
"Specifier", "Specifier",
"BreakStatement", "BreakStatement",
"CaseStatement", "CaseStatement",
"ContinueStatement", "ContinueStatement",
"Declaration", "Declaration",
"Delete", "Delete",
"DoStatement", "DoStatement",
"ElseStatement", "ElseStatement",
"ForStatement", "ForStatement",
"IfStatement", "IfStatement",
"Repeat", "Repeat",
"Scope", "Scope",
"Specifier", "Specifier",
"Statement", "Statement",
"SwitchStatement", "SwitchStatement",
"WhileStatement", "WhileStatement",
"Class", "Class",
"Event", "Event",
"Interface", "Interface",
"Method", "Method",
"Module", "Module",
"Namespace", "Namespace",
"MarkdownH1", "MarkdownH1",
"MarkdownH2", "MarkdownH2",
"MarkdownH3", "MarkdownH3",
"MarkdownH4", "MarkdownH4",
"MarkdownH5", "MarkdownH5",
"MarkdownH6", "MarkdownH6",
} }
for _, value in pairs(dropbar_hl) do for _, value in pairs(dropbar_hl) do
hl["DropBarKind" .. value] = { link = "DropBarKind" } hl["DropBarKind" .. value] = { link = "DropBarKind" }
end end
end, end,
}, },
} }

View file

@ -1,37 +1,37 @@
local format = require("utils.icons").fmt local format = require("utils.icons").fmt
return { return {
"folke/which-key.nvim", "folke/which-key.nvim",
event = "VeryLazy", event = "VeryLazy",
init = function() init = function()
require("which-key").register({ require("which-key").register({
a = { name = format("Fix", "Actions") }, a = { name = format("Fix", "Actions") },
c = { name = format("Color", "Color") }, c = { name = format("Color", "Color") },
b = { name = format("Windows", "Buffers") }, b = { name = format("Windows", "Buffers") },
u = { name = format("Window", "UI") }, u = { name = format("Window", "UI") },
g = { name = format("Git", "Git") }, g = { name = format("Git", "Git") },
t = { name = format("Terminal", "Terminal") }, t = { name = format("Terminal", "Terminal") },
f = { name = format("Search", "Telescope") }, f = { name = format("Search", "Telescope") },
l = { name = format("Braces", "LSP") }, l = { name = format("Braces", "LSP") },
d = { name = format("Debugger", "Debugger") }, d = { name = format("Debugger", "Debugger") },
n = { name = format("Notification", "Notification") }, n = { name = format("Notification", "Notification") },
S = { name = format("FolderClock", "Session") }, S = { name = format("FolderClock", "Session") },
r = { name = format("Code", "SnipRun") }, r = { name = format("Code", "SnipRun") },
o = { name = format("DropDown", "Dropbar") }, o = { name = format("DropDown", "Dropbar") },
v = { name = format("Book", "DevDocs") }, v = { name = format("Book", "DevDocs") },
C = { name = format("Package", "Crates") }, C = { name = format("Package", "Crates") },
D = { name = format("Database", "DbUI") }, D = { name = format("Database", "DbUI") },
}, { prefix = "<leader>" }) }, { prefix = "<leader>" })
end, end,
opts = { opts = {
key_labels = { key_labels = {
["<space>"] = " ", ["<space>"] = " ",
}, },
icons = { icons = {
group = "", group = "",
}, },
window = { window = {
border = "rounded", border = "rounded",
}, },
}, },
} }

View file

@ -3,154 +3,166 @@ local fmt = require("utils.icons").fmt
local M = {} local M = {}
M.mode = { M.mode = {
"mode", "mode",
fmt = function(name) fmt = function(name)
local map = { local map = {
NORMAL = icons.Normal, NORMAL = icons.Normal,
INSERT = icons.Insert, INSERT = icons.Insert,
TERMINAL = icons.Terminal, TERMINAL = icons.Terminal,
VISUAL = icons.Visual, VISUAL = icons.Visual,
["V-LINE"] = icons.Visual, ["V-LINE"] = icons.Visual,
["V-BLOCK"] = icons.Visual, ["V-BLOCK"] = icons.Visual,
["O-PENDING"] = icons.Ellipsis, ["O-PENDING"] = icons.Ellipsis,
COMMAND = icons.Command, COMMAND = icons.Command,
REPLACE = icons.Edit, REPLACE = icons.Edit,
SELECT = icons.Visual, SELECT = icons.Visual,
} }
local icon = map[name] and map[name] or icons.Vim local icon = map[name] and map[name] or icons.Vim
return icon .. " " .. name return icon .. " " .. name
end, end,
color = function() color = function()
local colors = require("tokyonight.colors") local colors = require("tokyonight.colors")
local mode = vim.fn.mode() local mode = vim.fn.mode()
local map = { local map = {
n = colors.default.blue, n = colors.default.blue,
i = colors.default.green, i = colors.default.green,
c = colors.default.yellow, c = colors.default.yellow,
t = colors.default.cyan, t = colors.default.cyan,
R = colors.default.red, R = colors.default.red,
v = colors.default.magenta, v = colors.default.magenta,
V = colors.default.magenta, V = colors.default.magenta,
s = colors.default.magenta, s = colors.default.magenta,
S = colors.default.magenta, S = colors.default.magenta,
} }
return { return {
fg = map[mode] or colors.default.magenta, fg = map[mode] or colors.default.magenta,
bg = colors.night.bg, bg = colors.night.bg,
} }
end, end,
} }
M.branch = { M.branch = {
"branch", "branch",
icon = icons.GitBranch, icon = icons.GitBranch,
color = function() color = function()
local colors = require("tokyonight.colors") local colors = require("tokyonight.colors")
return { bg = colors.night.bg } return { bg = colors.night.bg }
end, end,
} }
M.diff = { M.diff = {
"diff", "diff",
symbols = { symbols = {
added = fmt("Add", ""), added = fmt("Add", ""),
modified = fmt("Modified", ""), modified = fmt("Modified", ""),
removed = fmt("Removed", ""), removed = fmt("Removed", ""),
}, },
color = function() color = function()
local colors = require("tokyonight.colors") local colors = require("tokyonight.colors")
return { bg = colors.night.bg } return { bg = colors.night.bg }
end, end,
} }
M.filetype = { "filetype" } M.filetype = { "filetype" }
M.diagnostics = { M.diagnostics = {
"diagnostics", "diagnostics",
color = function() color = function()
local colors = require("tokyonight.colors") local colors = require("tokyonight.colors")
return { bg = colors.night.bg } return { bg = colors.night.bg }
end, end,
} }
M.encoding = { M.encoding = {
"encoding", "encoding",
color = function() color = function()
local colors = require("tokyonight.colors") local colors = require("tokyonight.colors")
return { fg = colors.default.blue, bg = colors.night.bg } return { fg = colors.default.blue, bg = colors.night.bg }
end, end,
} }
M.fileformat = { M.fileformat = {
"fileformat", "fileformat",
color = function() color = function()
local colors = require("tokyonight.colors") local colors = require("tokyonight.colors")
return { fg = colors.default.blue, bg = colors.night.bg } return { fg = colors.default.blue, bg = colors.night.bg }
end, end,
} }
M.indentation = { M.indentation = {
"indentation", "indentation",
fmt = function() fmt = function()
local type = vim.bo[0].expandtab and "spaces" or "tabs" local type = vim.bo[0].expandtab and "spaces" or "tabs"
local value = vim.bo[0].shiftwidth local value = vim.bo[0].shiftwidth
return type .. ": " .. value return type .. ": " .. value
end, end,
color = function() color = function()
local colors = require("tokyonight.colors") local colors = require("tokyonight.colors")
return { fg = colors.default.blue, bg = colors.night.bg } return { fg = colors.default.blue, bg = colors.night.bg }
end, end,
} }
M.progress = { M.progress = {
"progress", "progress",
fmt = function(location) return vim.trim(location) end, fmt = function(location)
color = function() return vim.trim(location)
local colors = require("tokyonight.colors") end,
return { fg = colors.default.purple, bg = colors.night.bg } color = function()
end, local colors = require("tokyonight.colors")
return { fg = colors.default.purple, bg = colors.night.bg }
end,
} }
M.location = { M.location = {
"location", "location",
fmt = function(location) return vim.trim(location) end, fmt = function(location)
color = function() return vim.trim(location)
local colors = require("tokyonight.colors") end,
return { fg = colors.default.purple, bg = colors.night.bg } color = function()
end, local colors = require("tokyonight.colors")
return { fg = colors.default.purple, bg = colors.night.bg }
end,
} }
M.macro = { M.macro = {
function() return vim.fn.reg_recording() end, function()
icon = icons.Recording, return vim.fn.reg_recording()
color = function() end,
local colors = require("tokyonight.colors") icon = icons.Recording,
return { fg = colors.default.red } color = function()
end, local colors = require("tokyonight.colors")
return { fg = colors.default.red }
end,
} }
M.lsp = { M.lsp = {
function() function()
local bufnr = vim.api.nvim_get_current_buf() local bufnr = vim.api.nvim_get_current_buf()
local clients = vim.lsp.get_clients({ bufnr = bufnr }) local clients = vim.lsp.get_clients({ bufnr = bufnr })
if next(clients) == nil then return "" end if next(clients) == nil then
local attached_clients = vim.tbl_map(function(client) return client.name end, clients) return ""
return table.concat(attached_clients, ", ") end
end, local attached_clients = vim.tbl_map(function(client)
icon = icons.Braces, return client.name
color = function() end, clients)
local colors = require("tokyonight.colors") return table.concat(attached_clients, ", ")
return { fg = colors.default.comment, bg = colors.night.bg } end,
end, icon = icons.Braces,
color = function()
local colors = require("tokyonight.colors")
return { fg = colors.default.comment, bg = colors.night.bg }
end,
} }
M.gap = { M.gap = {
function() return " " end, function()
color = function() return " "
local colors = require("tokyonight.colors") end,
return { bg = colors.night.bg } color = function()
end, local colors = require("tokyonight.colors")
padding = 0, return { bg = colors.night.bg }
end,
padding = 0,
} }
return M return M

View file

@ -1,48 +1,48 @@
local M = {} local M = {}
local set_options = function(options) local set_options = function(options)
for prop, variables in pairs(options) do for prop, variables in pairs(options) do
for key, value in pairs(variables) do for key, value in pairs(variables) do
vim[prop][key] = value vim[prop][key] = value
end end
end end
end end
local set_keymaps = function(keymaps) local set_keymaps = function(keymaps)
for mode, maps in pairs(keymaps) do for mode, maps in pairs(keymaps) do
for key, map in pairs(maps) do for key, map in pairs(maps) do
vim.keymap.set(mode, key, map[1], { desc = map[2] }) vim.keymap.set(mode, key, map[1], { desc = map[2] })
end end
end end
end end
local set_autocmd = function(autocmd) local set_autocmd = function(autocmd)
for _, cmd in ipairs(autocmd) do for _, cmd in ipairs(autocmd) do
vim.api.nvim_create_autocmd(cmd.event, cmd.opts) vim.api.nvim_create_autocmd(cmd.event, cmd.opts)
end end
end end
local set_signs = function(signs) local set_signs = function(signs)
for _, sign in ipairs(signs) do for _, sign in ipairs(signs) do
vim.fn.sign_define(sign.name, sign) vim.fn.sign_define(sign.name, sign)
end end
end end
local init_lazy = function(spec) local init_lazy = function(spec)
local opts = { local opts = {
ui = { border = "rounded" }, ui = { border = "rounded" },
spec = { import = spec }, spec = { import = spec },
} }
require("lazy").setup(opts) require("lazy").setup(opts)
end end
M.setup = function(opts) M.setup = function(opts)
set_options(opts.options or {}) set_options(opts.options or {})
set_keymaps(opts.keymaps or {}) set_keymaps(opts.keymaps or {})
set_autocmd(opts.autocmd or {}) set_autocmd(opts.autocmd or {})
set_signs(opts.signs or {}) set_signs(opts.signs or {})
init_lazy(opts.spec) init_lazy(opts.spec)
end end
return M return M

View file

@ -1,128 +1,138 @@
local M = {} local M = {}
local input = function(prompt, callback) local input = function(prompt, callback)
local value = vim.fn.input(prompt) local value = vim.fn.input(prompt)
if value:len() ~= 0 then callback(value) end if value:len() ~= 0 then
callback(value)
end
end end
local select = function(prompt, callback) local select = function(prompt, callback)
vim.ui.select({ "tabs", "spaces" }, { vim.ui.select({ "tabs", "spaces" }, {
prompt = prompt, prompt = prompt,
}, function(choice) }, function(choice)
if choice then callback(choice) end if choice then
end) callback(choice)
end
end)
end end
M.set_filetype = function() M.set_filetype = function()
input("Set filetype: ", function(value) input("Set filetype: ", function(value)
vim.bo[0].filetype = value vim.bo[0].filetype = value
vim.notify("Filetype set to " .. value) vim.notify("Filetype set to " .. value)
end) end)
end end
M.set_indent = function() M.set_indent = function()
input("Set indentation: ", function(value) input("Set indentation: ", function(value)
local type = vim.bo[0].expandtab and "spaces" or "tabs" local type = vim.bo[0].expandtab and "spaces" or "tabs"
local parsed = tonumber(value) local parsed = tonumber(value)
if parsed then if parsed then
vim.bo[0].shiftwidth = parsed vim.bo[0].shiftwidth = parsed
vim.notify("Indentation set to " .. value .. " " .. type) vim.notify("Indentation set to " .. value .. " " .. type)
else else
vim.notify("Invalid value", vim.log.levels.ERROR) vim.notify("Invalid value", vim.log.levels.ERROR)
end end
end) end)
end end
M.set_indent_type = function() M.set_indent_type = function()
select("Indent using: ", function(choice) select("Indent using: ", function(choice)
if choice == "spaces" then if choice == "spaces" then
vim.o.expandtab = true vim.o.expandtab = true
else else
vim.o.expandtab = false vim.o.expandtab = false
end end
vim.notify("Indentation using " .. choice) vim.notify("Indentation using " .. choice)
end) end)
end end
M.toggle_wrap = function() M.toggle_wrap = function()
vim.wo.wrap = not vim.wo.wrap vim.wo.wrap = not vim.wo.wrap
vim.wo.linebreak = not vim.wo.linebreak vim.wo.linebreak = not vim.wo.linebreak
end end
M.comment_line = function() M.comment_line = function()
require("Comment.api").toggle.linewise.count(vim.v.count > 0 and vim.v.count or 1) require("Comment.api").toggle.linewise.count(vim.v.count > 0 and vim.v.count or 1)
end end
M.comment_selection = function() M.comment_selection = function()
vim.cmd("normal <esc>") vim.cmd("normal <esc>")
require("Comment.api").toggle.linewise(vim.fn.visualmode()) require("Comment.api").toggle.linewise(vim.fn.visualmode())
end end
M.first_buffer = function() require("bufferline").go_to(1) end M.first_buffer = function()
M.last_buffer = function() require("bufferline").go_to(-1) end require("bufferline").go_to(1)
end
M.last_buffer = function()
require("bufferline").go_to(-1)
end
M.buf_hsplit = function() M.buf_hsplit = function()
require("bufferline.pick").choose_then(function(id) require("bufferline.pick").choose_then(function(id)
local name = vim.api.nvim_buf_get_name(id) local name = vim.api.nvim_buf_get_name(id)
vim.cmd("sp" .. name) vim.cmd("sp" .. name)
vim.cmd("wincmd x") vim.cmd("wincmd x")
vim.cmd("wincmd w") vim.cmd("wincmd w")
end) end)
end end
M.buf_vsplit = function() M.buf_vsplit = function()
require("bufferline.pick").choose_then(function(id) require("bufferline.pick").choose_then(function(id)
local name = vim.api.nvim_buf_get_name(id) local name = vim.api.nvim_buf_get_name(id)
vim.cmd("vsp" .. name) vim.cmd("vsp" .. name)
vim.cmd("wincmd x") vim.cmd("wincmd x")
vim.cmd("wincmd w") vim.cmd("wincmd w")
end) end)
end end
M.open_lazygit = function() M.open_lazygit = function()
require("toggleterm.terminal").Terminal require("toggleterm.terminal").Terminal
:new({ :new({
cmd = "lazygit", cmd = "lazygit",
hidden = true, hidden = true,
float_opts = { float_opts = {
width = 100, width = 100,
height = 25, height = 25,
}, },
on_close = function() on_close = function()
if package.loaded["neo-tree"] then require("neo-tree.events").fire_event("git_event") end if package.loaded["neo-tree"] then
end, require("neo-tree.events").fire_event("git_event")
}) end
:open() end,
})
:open()
end end
M.open_glow = function() M.open_glow = function()
require("toggleterm.terminal").Terminal require("toggleterm.terminal").Terminal
:new({ :new({
cmd = "glow", cmd = "glow",
hidden = true, hidden = true,
float_opts = { float_opts = {
width = 100, width = 100,
height = 25, height = 25,
}, },
}) })
:open() :open()
end end
M.open_dapui = function() M.open_dapui = function()
require("neo-tree").close_all() require("neo-tree").close_all()
require("dapui").open() require("dapui").open()
end end
M.close_dapui = function() M.close_dapui = function()
require("neo-tree").show() require("neo-tree").show()
require("dapui").close() require("dapui").close()
end end
M.toggle_dapui = function() M.toggle_dapui = function()
vim.cmd("NeoTreeShowToggle") vim.cmd("NeoTreeShowToggle")
require("dapui").toggle() require("dapui").toggle()
end end
return M return M

View file

@ -1,111 +1,113 @@
local M = {} local M = {}
M.icons = { M.icons = {
Vim = "", Vim = "",
Config = "", Config = "",
Normal = "󰡛", Normal = "󰡛",
Insert = "󰌌", Insert = "󰌌",
Terminal = "", Terminal = "",
Visual = "󰉸", Visual = "󰉸",
Command = "", Command = "",
Save = "󰳻", Save = "󰳻",
NotSaved = "󱙃", NotSaved = "󱙃",
Restore = "", Restore = "",
Trash = "", Trash = "",
Fedora = "", Fedora = "",
Lua = "", Lua = "",
Github = "", Github = "",
Git = "󰊢", Git = "󰊢",
GitDiff = "", GitDiff = "",
GitBranch = "", GitBranch = "",
GitCommit = "", GitCommit = "",
Add = "󰐕", Add = "󰐕",
Modified = "󰜥", Modified = "󰜥",
Removed = "󰍴", Removed = "󰍴",
DiffRemoved = "", DiffRemoved = "",
Error = "󰅚", Error = "󰅚",
Info = "󰋽", Info = "󰋽",
Warn = "", Warn = "",
Hint = "", Hint = "",
Package = "󰏖", Package = "󰏖",
FileTree = "󰙅", FileTree = "󰙅",
Folder = "", Folder = "",
EmptyFolder = "", EmptyFolder = "",
FolderClock = "󰪻", FolderClock = "󰪻",
FolderOpened = "", FolderOpened = "",
File = "", File = "",
NewFile = "", NewFile = "",
DefaultFile = "󰈙", DefaultFile = "󰈙",
Color = "", Color = "",
ColorPicker = "󰴱", ColorPicker = "󰴱",
ColorOn = "󰌁", ColorOn = "󰌁",
ColorOff = "󰹊", ColorOff = "󰹊",
Swap = "󰓡", Swap = "󰓡",
Minimap = "", Minimap = "",
Window = "", Window = "",
Windows = "", Windows = "",
Ellipsis = "", Ellipsis = "",
Search = "", Search = "",
TextSearch = "󱩾", TextSearch = "󱩾",
TabSearch = "󱦞", TabSearch = "󱦞",
FileSearch = "󰱼", FileSearch = "󰱼",
Clear = "", Clear = "",
Braces = "󰅩", Braces = "󰅩",
Exit = "", Exit = "",
Debugger = "", Debugger = "",
Breakpoint = "", Breakpoint = "",
History = "", History = "",
Check = "󰄵", Check = "󰄵",
SmallDot = "󰧞", SmallDot = "󰧞",
Dots = "󰇘", Dots = "󰇘",
Install = "", Install = "",
Help = "󰋖", Help = "󰋖",
Clipboard = "󰅌", Clipboard = "󰅌",
Indent = "", Indent = "",
LineWrap = "󰖶", LineWrap = "󰖶",
Comment = "󱋄", Comment = "󱋄",
Close = "󰅘", Close = "󰅘",
Open = "󰏋", Open = "󰏋",
Toggle = "󰔡", Toggle = "󰔡",
Stop = "", Stop = "",
Restart = "", Restart = "",
CloseMultiple = "󰱞", CloseMultiple = "󰱞",
NextBuffer = "󰮱,", NextBuffer = "󰮱,",
PrevBuffer = "󰮳", PrevBuffer = "󰮳",
FoldClose = "", FoldClose = "",
FoldOpen = "", FoldOpen = "",
Popup = "󰕛", Popup = "󰕛",
Vertical = "", Vertical = "",
Horizontal = "", Horizontal = "",
Markdown = "󰽛", Markdown = "󰽛",
Up = "", Up = "",
Down = "", Down = "",
Left = "", Left = "",
Right = "", Right = "",
Variable = "", Variable = "",
Symbol = "", Symbol = "",
Stack = "", Stack = "",
Format = "󰉣", Format = "󰉣",
Edit = "󰤌", Edit = "󰤌",
Fix = "", Fix = "",
Run = "󰐍", Run = "󰐍",
Twilight = "󰖚", Twilight = "󰖚",
Recording = "󰑋", Recording = "󰑋",
Notification = "󰍢", Notification = "󰍢",
NotificationDismiss = "󱙍", NotificationDismiss = "󱙍",
NotificationLog = "󰍩", NotificationLog = "󰍩",
Code = "", Code = "",
DropDown = "󰁊", DropDown = "󰁊",
Web = "󰖟", Web = "󰖟",
Dependencies = "", Dependencies = "",
Update = "󰚰", Update = "󰚰",
Database = "", Database = "",
Pin = "", Pin = "",
Book = "󰂽", Book = "󰂽",
BookmarkSearch = "󰺄", BookmarkSearch = "󰺄",
Download = "󰇚", Download = "󰇚",
} }
M.fmt = function(icon, text, space) return M.icons[icon] .. string.rep(" ", space or 1) .. text end M.fmt = function(icon, text, space)
return M.icons[icon] .. string.rep(" ", space or 1) .. text
end
return M return M

View file

@ -1,9 +1,19 @@
local M = {} local M = {}
M.leader = function(key) return "<leader>" .. key end M.leader = function(key)
M.cmd = function(cmd) return "<cmd>" .. cmd .. "<CR>" end return "<leader>" .. key
M.rcmd = function(cmd) return ":" .. cmd .. "<CR>" end end
M.lua = function(cmd) return "<cmd>lua " .. cmd .. "<CR>" end M.cmd = function(cmd)
M.notify = function(cmd) return M.cmd("call VSCodeNotify('" .. cmd .. "')") end return "<cmd>" .. cmd .. "<CR>"
end
M.rcmd = function(cmd)
return ":" .. cmd .. "<CR>"
end
M.lua = function(cmd)
return "<cmd>lua " .. cmd .. "<CR>"
end
M.notify = function(cmd)
return M.cmd("call VSCodeNotify('" .. cmd .. "')")
end
return M return M

View file

@ -1,59 +1,61 @@
local M = {} local M = {}
local make_float_config = function(minimal) local make_float_config = function(minimal)
local ui = vim.api.nvim_list_uis()[1] local ui = vim.api.nvim_list_uis()[1]
local width = 80 local width = 80
local height = 25 local height = 25
local row = (ui.height - height) * 0.4 local row = (ui.height - height) * 0.4
local col = (ui.width - width) * 0.5 local col = (ui.width - width) * 0.5
return { return {
col = col, col = col,
row = row, row = row,
width = width, width = width,
height = height, height = height,
border = "rounded", border = "rounded",
relative = "editor", relative = "editor",
style = minimal and "minimal" or nil, style = minimal and "minimal" or nil,
zindex = 10, zindex = 10,
} }
end end
M.open_help_float = function() M.open_help_float = function()
local win = vim.api.nvim_get_current_win() local win = vim.api.nvim_get_current_win()
local buf = vim.api.nvim_win_get_buf(win) local buf = vim.api.nvim_win_get_buf(win)
local config = make_float_config(true) local config = make_float_config(true)
vim.api.nvim_win_set_config(win, config) vim.api.nvim_win_set_config(win, config)
vim.api.nvim_create_autocmd("WinClosed", { vim.api.nvim_create_autocmd("WinClosed", {
pattern = tostring(win), pattern = tostring(win),
callback = function() vim.api.nvim_buf_delete(buf, {}) end, callback = function()
}) vim.api.nvim_buf_delete(buf, {})
end,
})
end end
M.open_lua_win = function() M.open_lua_win = function()
local buf = vim.api.nvim_create_buf(true, false) local buf = vim.api.nvim_create_buf(true, false)
local config = make_float_config(false) local config = make_float_config(false)
local temp = vim.fn.tempname() local temp = vim.fn.tempname()
local win = vim.api.nvim_open_win(buf, true, config) local win = vim.api.nvim_open_win(buf, true, config)
vim.bo[buf].ft = "lua" vim.bo[buf].ft = "lua"
vim.api.nvim_buf_set_name(buf, temp) vim.api.nvim_buf_set_name(buf, temp)
vim.cmd("silent w") vim.cmd("silent w")
vim.keymap.set("n", "<leader>w", function() vim.keymap.set("n", "<leader>w", function()
vim.cmd("w") vim.cmd("w")
vim.cmd("luafile %") vim.cmd("luafile %")
vim.lsp.buf.format({ async = true }) vim.lsp.buf.format({ async = true })
end, { buffer = buf, remap = true, silent = true }) end, { buffer = buf, remap = true, silent = true })
vim.api.nvim_create_autocmd("WinClosed", { vim.api.nvim_create_autocmd("WinClosed", {
pattern = tostring(win), pattern = tostring(win),
callback = function() callback = function()
vim.fn.delete(temp) vim.fn.delete(temp)
vim.api.nvim_buf_delete(buf, { force = true }) vim.api.nvim_buf_delete(buf, { force = true })
end, end,
}) })
end end
return M return M

View file

@ -2,49 +2,49 @@ local map = require("utils.mappings")
local l, cmd, rcmd, notify = map.leader, map.cmd, map.rcmd, map.notify local l, cmd, rcmd, notify = map.leader, map.cmd, map.rcmd, map.notify
return { return {
n = { n = {
-- utils -- utils
[l("p")] = { '"+p' }, [l("p")] = { '"+p' },
[l("P")] = { '"+P' }, [l("P")] = { '"+P' },
[l(":")] = { ":lua " }, [l(":")] = { ":lua " },
[l("us")] = { cmd("nohlsearch") }, [l("us")] = { cmd("nohlsearch") },
[l(";")] = { cmd("VSCodeCommentary") }, [l(";")] = { cmd("VSCodeCommentary") },
-- vscode actions -- vscode actions
[l("w")] = { notify("workbench.action.files.save") }, [l("w")] = { notify("workbench.action.files.save") },
[l("e")] = { notify("workbench.view.explorer") }, [l("e")] = { notify("workbench.view.explorer") },
[l("bq")] = { notify("workbench.action.closeActiveEditor") }, [l("bq")] = { notify("workbench.action.closeActiveEditor") },
[l("bn")] = { notify("workbench.action.nextEditorInGroup") }, [l("bn")] = { notify("workbench.action.nextEditorInGroup") },
[l("bp")] = { notify("workbench.action.previousEditorInGroup") }, [l("bp")] = { notify("workbench.action.previousEditorInGroup") },
[l("um")] = { notify("editor.action.toggleMinimap") }, [l("um")] = { notify("editor.action.toggleMinimap") },
[l("ff")] = { notify("workbench.action.quickOpen") }, [l("ff")] = { notify("workbench.action.quickOpen") },
[l("fs")] = { notify("workbench.action.gotoSymbol") }, [l("fs")] = { notify("workbench.action.gotoSymbol") },
[l("nn")] = { notify("notifications.clearAll") }, [l("nn")] = { notify("notifications.clearAll") },
[l("nl")] = { notify("notifications.showList") }, [l("nl")] = { notify("notifications.showList") },
["gr"] = { notify("editor.action.goToReferences") }, ["gr"] = { notify("editor.action.goToReferences") },
[l("lr")] = { notify("editor.action.rename") }, [l("lr")] = { notify("editor.action.rename") },
-- move.nvim -- move.nvim
["<A-j>"] = { cmd("MoveLine(1)") }, ["<A-j>"] = { cmd("MoveLine(1)") },
["<A-k>"] = { cmd("MoveLine(-1)") }, ["<A-k>"] = { cmd("MoveLine(-1)") },
["<A-h>"] = { cmd("MoveHChar(-1)") }, ["<A-h>"] = { cmd("MoveHChar(-1)") },
["<A-l>"] = { cmd("MoveHChar(1)") }, ["<A-l>"] = { cmd("MoveHChar(1)") },
}, },
v = { v = {
-- utils -- utils
["q"] = { "<esc>" }, ["q"] = { "<esc>" },
[l("y")] = { '"+y' }, [l("y")] = { '"+y' },
[l("p")] = { '"+p' }, [l("p")] = { '"+p' },
[l("P")] = { '"+P' }, [l("P")] = { '"+P' },
[l(";")] = { cmd("VSCodeCommentary") }, [l(";")] = { cmd("VSCodeCommentary") },
-- move.nvim -- move.nvim
["<A-j>"] = { rcmd("MoveBlock(1)") }, ["<A-j>"] = { rcmd("MoveBlock(1)") },
["<A-k>"] = { rcmd("MoveBlock(-1)") }, ["<A-k>"] = { rcmd("MoveBlock(-1)") },
["<A-h>"] = { rcmd("MoveHBlock(-1)") }, ["<A-h>"] = { rcmd("MoveHBlock(-1)") },
["<A-l>"] = { rcmd("MoveHBlock(1)") }, ["<A-l>"] = { rcmd("MoveHBlock(1)") },
}, },
} }

View file

@ -1,5 +1,5 @@
return { return {
g = { g = {
mapleader = " ", mapleader = " ",
}, },
} }

View file

@ -1,38 +1,38 @@
local lua = require("utils.mappings").lua local lua = require("utils.mappings").lua
return { return {
{ {
"kylechui/nvim-surround", "kylechui/nvim-surround",
keys = { keys = {
{ "cs", mode = { "n" } }, { "cs", mode = { "n" } },
{ "ds", mode = { "n" } }, { "ds", mode = { "n" } },
{ "ys", mode = { "n" } }, { "ys", mode = { "n" } },
{ "S", mode = { "v" } }, { "S", mode = { "v" } },
}, },
opts = {}, opts = {},
}, },
{ {
"fedepujol/move.nvim", "fedepujol/move.nvim",
cmd = { cmd = {
"MoveLine", "MoveLine",
"MoveHChar", "MoveHChar",
"MoveBlock", "MoveBlock",
"MoveHBlock", "MoveHBlock",
}, },
}, },
{ {
"folke/flash.nvim", "folke/flash.nvim",
keys = { keys = {
{ "f", mode = { "n", "v" } }, { "f", mode = { "n", "v" } },
{ "F", mode = { "n", "v" } }, { "F", mode = { "n", "v" } },
{ "t", mode = { "n", "v" } }, { "t", mode = { "n", "v" } },
{ "T", mode = { "n", "v" } }, { "T", mode = { "n", "v" } },
{ "s", mode = { "n", "v" }, lua('require("flash").jump()') }, { "s", mode = { "n", "v" }, lua('require("flash").jump()') },
{ "ß", mode = "n", lua("require('flash').jump({ pattern = vim.fn.expand('<cword>') })") }, { "ß", mode = "n", lua("require('flash').jump({ pattern = vim.fn.expand('<cword>') })") },
{ "S", mode = "n", lua("require('flash').treesitter()") }, { "S", mode = "n", lua("require('flash').treesitter()") },
{ "o", mode = "o", lua("require('flash').jump()"), desc = "Search jump" }, { "o", mode = "o", lua("require('flash').jump()"), desc = "Search jump" },
{ "O", mode = "o", lua("require('flash').treesitter()"), desc = "Tresitter jump" }, { "O", mode = "o", lua("require('flash').treesitter()"), desc = "Tresitter jump" },
}, },
opts = {}, opts = {},
}, },
} }