commit
This commit is contained in:
parent
bdaf917c15
commit
cf4346ffed
57 changed files with 2505 additions and 53 deletions
|
|
@ -13,6 +13,7 @@
|
|||
inputs.nixvim.homeManagerModules.nixvim
|
||||
|
||||
./swayidle.nix
|
||||
./vim
|
||||
|
||||
../rice/hyprland
|
||||
# ../rice/sway
|
||||
|
|
@ -103,8 +104,6 @@
|
|||
pkgs.parsec-bin
|
||||
pkgs.filezilla
|
||||
|
||||
pkgs.neovim-nightly
|
||||
|
||||
# # You can also create simple shell scripts directly inside your
|
||||
# # configuration. For example, this adds a command 'my-hello' to your
|
||||
# # environment:
|
||||
|
|
@ -154,13 +153,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
home.file.".config/nvim" = {
|
||||
source = builtins.fetchGit {
|
||||
url = "https://github.com/luckasRanarison/nvimrc";
|
||||
rev = "87c72e79fcc9a2dda9fd04211a946bba78f9f70b";
|
||||
};
|
||||
};
|
||||
|
||||
# programs.nixvim = ./vim.nix;
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 87c72e79fcc9a2dda9fd04211a946bba78f9f70b
|
||||
26
modules/home-manager/vim/config/README.md
Normal file
26
modules/home-manager/vim/config/README.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# nvimrc
|
||||
|
||||
**NOTE:** Neovim [nightly](https://github.com/neovim/neovim/releases/nightly) is required for inlay hint.
|
||||
|
||||
This repository contains my personal Neovim configuration, designed to be comprehensive and to provide a feature-rich IDE experience with a polished UI.
|
||||
|
||||
It's my daily driver for Rust, Lua and Web stuff. I also have a backup configuration for Vscode Neovim just in case I'll be forced to use Vscode.
|
||||
|
||||

|
||||
|
||||
## Structure
|
||||
|
||||
```shell
|
||||
.
|
||||
├── after
|
||||
├── core
|
||||
├── lsp
|
||||
├── plugins
|
||||
│ ├── editor
|
||||
│ ├── lsp
|
||||
│ ├── tools
|
||||
│ ├── ui
|
||||
│ └── utils
|
||||
├── utils
|
||||
└── vscode
|
||||
```
|
||||
22
modules/home-manager/vim/config/init.lua
Executable file
22
modules/home-manager/vim/config/init.lua
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
local filetypes = require("core.filetypes")
|
||||
local configurer = require("utils.configurer")
|
||||
local opts = {}
|
||||
|
||||
if vim.g.vscode then
|
||||
-- VSCode Neovim
|
||||
opts.spec = "vscode.plugins"
|
||||
opts.options = require("vscode.options")
|
||||
opts.keymaps = require("vscode.keymaps")
|
||||
else
|
||||
-- Normal Neovim
|
||||
opts.spec = "plugins"
|
||||
opts.options = require("core.options")
|
||||
opts.keymaps = require("core.keymaps")
|
||||
opts.autocmd = require("core.autocmd")
|
||||
opts.signs = require("core.signs")
|
||||
end
|
||||
|
||||
configurer.setup(opts)
|
||||
|
||||
-- vim.lsp.log.set_level(vim.lsp.log_levels.INFO)
|
||||
vim.filetype.add(filetypes)
|
||||
71
modules/home-manager/vim/config/lazy-lock.json
Normal file
71
modules/home-manager/vim/config/lazy-lock.json
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "176e85eeb63f1a5970d6b88f1725039d85ca0055" },
|
||||
"LuaSnip": { "branch": "master", "commit": "0b4950a237ce441a6a3a947d501622453f6860ea" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" },
|
||||
"better-escape.nvim": { "branch": "master", "commit": "7031dc734add47bb71c010e0551829fa5799375f" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "d24378edc14a675c820a303b4512af3bbc5761e9" },
|
||||
"ccc.nvim": { "branch": "main", "commit": "4a0ddaf787cc82796e84ab8a7f70d086f250aeb6" },
|
||||
"clear-action.nvim": { "branch": "master", "commit": "e36fad3b9ebb85acdd5c41651b51a3cf70991323" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||
"crates.nvim": { "branch": "main", "commit": "4ce7c51b881e58f1e2f8f437f30e4e583cbac319" },
|
||||
"document-color.nvim": { "branch": "main", "commit": "74c487f0e5accfaae033755451b9e367220693fd" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "39611852fd7bbac117e939a26759bb37361f0c90" },
|
||||
"dropbar.nvim": { "branch": "master", "commit": "ee3a356254ab494c0e280b809969a7a3a7e38fb7" },
|
||||
"flash.nvim": { "branch": "main", "commit": "6d76c5dee65181ab55cbdfb0760260e800d643f4" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "ea84a710262cb2c286d439070bad37d36fd3db25" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "ff01d34daaed72f271a8ffa088a7e839a60c640f" },
|
||||
"guess-indent.nvim": { "branch": "main", "commit": "b8ae749fce17aa4c267eec80a6984130b94f80b2" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "877c1db2bf957300097dd5348a665666a4d900cb" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "25beed5e2e935ebc00d7e3eed1dc502df3c40e39" },
|
||||
"lspkind-nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "828a538ac8419f586c010996aefa5df6eb7c250b" },
|
||||
"mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" },
|
||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "e4d56b400e9757b1dc77d620fd3069396e92d5fc" },
|
||||
"mason.nvim": { "branch": "main", "commit": "5ad3e113b0c3fde3caba8630599373046f6197e8" },
|
||||
"move.nvim": { "branch": "main", "commit": "d663b74b4e38f257aae757541c9076b8047844d6" },
|
||||
"neo-rename.nvim": { "branch": "master", "commit": "24ce4264971620d182c14fef1af46a20e8c90806" },
|
||||
"neo-tree.nvim": { "branch": "v2.x", "commit": "80dc74d081823649809f78370fa5b204aa9a853a" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "f8592cc143a5512b98a2c3683aa43c73f98e34f7" },
|
||||
"neovim-session-manager": { "branch": "master", "commit": "df544e17798dd0e6e33ecf0991dfde9174367837" },
|
||||
"noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" },
|
||||
"nui.nvim": { "branch": "main", "commit": "9e3916e784660f55f47daa6f26053ad044db5d6a" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "db09b6c691def0038c456551e4e2772186449f35" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "ae5b41ce880a6d850055e262d6dfebd362bb276e" },
|
||||
"nvim-bufdel": { "branch": "main", "commit": "96c4f7ab053ddab0025bebe5f7c71e4795430e47" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
|
||||
"nvim-dap": { "branch": "master", "commit": "9d81c11fd185a131f81841e64941859305f6c42d" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "85b16ac2309d85c88577cd8ee1733ce52be8227e" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "57f1dbd0458dd84a286b27768c142e1567f3ce3b" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "fcf153fbbf1facd16a71d46b92be8be495123a9f" },
|
||||
"nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" },
|
||||
"nvim-surround": { "branch": "main", "commit": "10b20ca7d9da1ac8df8339e140ffef94f9ab3b18" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "143a342bd860d6e3d584edeb447fb49febab3355" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "7f625207f225eea97ef7a6abe7611e556c396d2f" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "43e39ec74cd57c45ca9d8229a796750f6083b850" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "efbfed0567ef4bfac3ce630524a0f6c8451c5534" },
|
||||
"playground": { "branch": "master", "commit": "2b81a018a49f8e476341dfcb228b7b808baba68b" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" },
|
||||
"promise-async": { "branch": "main", "commit": "e94f35161b8c5d4a4ca3b6ff93dd073eb9214c0e" },
|
||||
"rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" },
|
||||
"schemastore.nvim": { "branch": "main", "commit": "43b2ef9a1b716752dcdcb9fafddfdb871a59051f" },
|
||||
"telescope-dap.nvim": { "branch": "master", "commit": "313d2ea12ae59a1ca51b62bf01fc941a983d9c9c" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "8c69f58427f98b2ca39a90a36db830c06e30351c" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "00c13dccc78c09fa5da4c5edda990a363e75035e" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "610179f7f12db3d08540b6cc61434db2eaecbcff" },
|
||||
"tree-sitter-icelang": { "branch": "master", "commit": "1473d5a547264ea024ca5c32dd52f4c0d2cbf493" },
|
||||
"treesj": { "branch": "main", "commit": "3203aa553217921fd4dcb79245f9df07278910b2" },
|
||||
"twilight.nvim": { "branch": "main", "commit": "a4843e6e67092a1e6fa9666f02bf0ab59174c1df" },
|
||||
"vim-dadbod": { "branch": "master", "commit": "7d80bbd11c407a09e0f7b869c38f3dec3902805f" },
|
||||
"vim-dadbod-completion": { "branch": "master", "commit": "fc7321a17f4c55db11fae89a884ddf4724020bae" },
|
||||
"vim-dadbod-ui": { "branch": "master", "commit": "95fd22469507e86b78aa55d868c14108adee2881" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "a2907275a6899c570d16e95b9db5fd921c167502" },
|
||||
"vim-smoothie": { "branch": "master", "commit": "df1e324e9f3395c630c1c523d0555a01d2eb1b7e" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "38b990f6eabf62014018b4aae70a97d7a6c2eb88" }
|
||||
}
|
||||
1
modules/home-manager/vim/config/lua/after/plugin/c.lua
Normal file
1
modules/home-manager/vim/config/lua/after/plugin/c.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
vim.opt_local.shiftwidth = 4
|
||||
21
modules/home-manager/vim/config/lua/core/autocmd.lua
Normal file
21
modules/home-manager/vim/config/lua/core/autocmd.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
return {
|
||||
{
|
||||
event = "LspAttach",
|
||||
opts = {
|
||||
callback = function(args)
|
||||
local bufnr = args.buf
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
local lsp = require("lsp.config")
|
||||
lsp.set_keymaps(client, bufnr)
|
||||
lsp.set_autocmd(client, bufnr)
|
||||
end,
|
||||
},
|
||||
},
|
||||
{
|
||||
event = { "FileType" },
|
||||
opts = {
|
||||
pattern = { "help" },
|
||||
callback = require("utils.win").open_help_float,
|
||||
},
|
||||
},
|
||||
}
|
||||
10
modules/home-manager/vim/config/lua/core/filetypes.lua
Normal file
10
modules/home-manager/vim/config/lua/core/filetypes.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
extension = {
|
||||
ic = "icelang",
|
||||
rasi = "rasi",
|
||||
ebnf = "ebnf",
|
||||
},
|
||||
pattern = {
|
||||
[".*/hypr/.*%.conf"] = "hyprlang",
|
||||
},
|
||||
}
|
||||
266
modules/home-manager/vim/config/lua/core/keymaps.lua
Normal file
266
modules/home-manager/vim/config/lua/core/keymaps.lua
Normal file
|
|
@ -0,0 +1,266 @@
|
|||
local map = require("utils.mappings")
|
||||
local f = require("utils.functions")
|
||||
local fmt = require("utils.icons").fmt
|
||||
local l, cmd, rcmd, lua = map.leader, map.cmd, map.rcmd, map.lua
|
||||
|
||||
return {
|
||||
i = {
|
||||
["jj"] = { "<esc>", "Exit insert mode" },
|
||||
},
|
||||
n = {
|
||||
-- utils
|
||||
["vv"] = { "V", "Linewise visual" },
|
||||
[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("p")] = { '"+p', fmt("Clipboard", "Paste from clipboard") },
|
||||
[l("P")] = { '"+P', fmt("Clipboard", "Paste from clipboard") },
|
||||
[l(":")] = { ":lua ", fmt("Lua", "Lua prompt") },
|
||||
[l("%")] = { cmd("luafile %"), fmt("Lua", "Luafile") },
|
||||
[l(";")] = { f.comment_line, fmt("Comment", "Comment line") },
|
||||
[l(" ")] = { cmd("wincmd w"), fmt("Window", "Switch window") },
|
||||
|
||||
-- UI utils
|
||||
[l("uw")] = { f.toggle_wrap, fmt("LineWrap", "Toggle wrap") },
|
||||
[l("ug")] = { cmd("GuessIndent"), fmt("Indent", "Guess indent") },
|
||||
[l("uf")] = { f.set_filetype, fmt("DefaultFile", "Set filetype") },
|
||||
[l("ui")] = { f.set_indent, fmt("Indent", "Set indentation") },
|
||||
[l("uI")] = { f.set_indent_type, fmt("Indent", "Set indentation type") },
|
||||
[l("us")] = { cmd("nohlsearch"), fmt("Clear", "Clear search highlights") },
|
||||
|
||||
-- Neotree
|
||||
[l("e")] = { cmd("Neotree toggle"), fmt("FileTree", "Toggle Neotree") },
|
||||
|
||||
-- move.nvim
|
||||
["<A-j>"] = { cmd("MoveLine(1)"), "Move line down" },
|
||||
["<A-k>"] = { cmd("MoveLine(-1)"), "Move line up" },
|
||||
["<A-h>"] = { cmd("MoveHChar(-1)"), "Move character left" },
|
||||
["<A-l>"] = { cmd("MoveHChar(1)"), "Move character right" },
|
||||
|
||||
-- ccc
|
||||
[l("cp")] = { cmd("CccPick"), fmt("ColorPicker", "Pick color") },
|
||||
[l("cc")] = { cmd("CccConvert"), fmt("Swap", "Convert color") },
|
||||
[l("ce")] = { cmd("CccHighlighterEnable"), fmt("ColorOn", "Enable highlights") },
|
||||
[l("cd")] = { cmd("CccHighlighterDisable"), fmt("ColorOff", "Disable highlights") },
|
||||
|
||||
-- buffer utils
|
||||
[l("bq")] = { cmd("BufDel"), fmt("Close", "Close current buffer") },
|
||||
[l("bQ")] = { cmd("BufDel!"), fmt("Close", "close current buffer!") },
|
||||
[l("bb")] = { cmd("BufferLinePick"), fmt("Open", "Pick to open buffer") },
|
||||
[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") },
|
||||
|
||||
-- gitsigns
|
||||
[l("gb")] = { cmd("Gitsigns toggle_current_line_blame"), fmt("GitDiff", "Line blame") },
|
||||
[l("gd")] = { cmd("Gitsigns diffthis"), fmt("GitDiff", "Show diff") },
|
||||
[l("gD")] = { cmd("Gitsigns toggle_deleted"), fmt("DiffRemoved", "Toggle deleted") },
|
||||
[l("gp")] = { cmd("Gitsigns preview_hunk"), fmt("Popup", "Preview hunk") },
|
||||
[l("gP")] = { cmd("Gitsigns preview_hunk_inline"), fmt("Popup", "Preview hunk inline") },
|
||||
[l("gn")] = { cmd("Gitsigns next_hunk"), fmt("Down", "Next hunk") },
|
||||
[l("gN")] = { cmd("Gitsigns prev_hunk"), fmt("Up", "Previous hunk") },
|
||||
[l("gr")] = { cmd("Gitsigns reset_hunk"), fmt("Restore", "Revert hunk") },
|
||||
[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
|
||||
[l("th")] = { cmd("ToggleTerm direction=horizontal"), fmt("Horizontal", "Horizontal terminal") },
|
||||
[l("tv")] = {
|
||||
cmd("ToggleTerm direction=vertical size=60"),
|
||||
fmt("Vertical", "Vertical terminal"),
|
||||
},
|
||||
[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
|
||||
["<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" },
|
||||
|
||||
-- telescope
|
||||
[l("ff")] = { cmd("Telescope find_files"), fmt("FileSearch", "Find files") },
|
||||
[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
|
||||
[l("L")] = { cmd("Lazy"), fmt("Package", "Plugin manager") },
|
||||
|
||||
-- Mason
|
||||
[l("M")] = { cmd("Mason"), fmt("Package", "Mason") },
|
||||
|
||||
-- DAP
|
||||
[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" },
|
||||
|
||||
-- telescope DAP
|
||||
[l("dB")] = {
|
||||
lua("require('telescope').extensions.dap.list_breakpoints()"),
|
||||
fmt("Breakpoint", "List breakpoints"),
|
||||
},
|
||||
[l("dv")] = {
|
||||
lua("require('telescope').extensions.dap.variables()"),
|
||||
fmt("Variable", "List variables"),
|
||||
},
|
||||
[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
|
||||
[l("Ss")] = { cmd("SessionManager save_current_session"), fmt("Save", "Save session") },
|
||||
[l("Sl")] = { cmd("SessionManager load_session"), fmt("Restore", "Load session") },
|
||||
[l("SL")] = { cmd("SessionManager load_last_session"), fmt("Restore", "Load last session") },
|
||||
[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
|
||||
[l("nn")] = {
|
||||
lua("require('notify').dismiss()"),
|
||||
fmt("NotificationDismiss", "Dismiss notifications"),
|
||||
},
|
||||
|
||||
-- lspconfig
|
||||
[l("li")] = { cmd("LspInfo"), fmt("Info", "Server info") },
|
||||
[l("lI")] = { cmd("LspLog"), fmt("DefaultFile", "Server logs") },
|
||||
[l("lS")] = { ":LspStart ", fmt("Run", "Start server") },
|
||||
[l("lq")] = { ":LspStop ", fmt("Stop", "Stop server") },
|
||||
[l("lR")] = { cmd("LspRestart"), fmt("Restart", "Restart server") },
|
||||
|
||||
-- dropbar
|
||||
[l("ok")] = { lua("require('dropbar.api').goto_context_start()"), fmt("Up", "Context start") },
|
||||
[l("oo")] = { lua("require('dropbar.api').pick()"), fmt("Check", "Pick node") },
|
||||
|
||||
-- DbUI
|
||||
[l("Dd")] = { cmd("DBUIToggle"), fmt("Toggle", "Toggle DbUI") },
|
||||
[l("Da")] = { cmd("DBUIAddConnection"), fmt("Add", "Add connection") },
|
||||
|
||||
-- nvim-devdocs
|
||||
[l("v ")] = { cmd("DevdocsToggle"), fmt("Window", "Toggle floating window") },
|
||||
[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") },
|
||||
|
||||
-- crates
|
||||
[l("Cv")] = {
|
||||
lua("require('crates').show_versions_popup()"),
|
||||
fmt("Info", "Show versions popup"),
|
||||
},
|
||||
[l("Cf")] = {
|
||||
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
|
||||
["q"] = { "<esc>" },
|
||||
[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
|
||||
[l("gr")] = { cmd("Gitsigns reset_hunk"), fmt("Restore", "Revert hunk") },
|
||||
|
||||
-- crates
|
||||
[l("Cu")] = { lua("require('crates').update_crates()"), fmt("Update", "Update crates") },
|
||||
},
|
||||
|
||||
t = {
|
||||
-- toggleterm
|
||||
["<esc>"] = { [[<C-\><C-n>]] },
|
||||
|
||||
-- wincmd
|
||||
["<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" },
|
||||
},
|
||||
}
|
||||
33
modules/home-manager/vim/config/lua/core/options.lua
Normal file
33
modules/home-manager/vim/config/lua/core/options.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
return {
|
||||
opt = {
|
||||
fileencoding = "utf-8",
|
||||
cmdheight = 0,
|
||||
number = true,
|
||||
relativenumber = true,
|
||||
history = 100,
|
||||
termguicolors = true,
|
||||
filetype = "on",
|
||||
cursorline = true,
|
||||
foldenable = true,
|
||||
foldlevel = 99,
|
||||
foldlevelstart = 99,
|
||||
ignorecase = true,
|
||||
shiftwidth = 2,
|
||||
showtabline = 0,
|
||||
tabstop = 2,
|
||||
expandtab = true,
|
||||
wrap = false,
|
||||
writebackup = false,
|
||||
laststatus = 0,
|
||||
updatetime = 200,
|
||||
fillchars = "eob: ",
|
||||
modeline = false,
|
||||
conceallevel = 2,
|
||||
mouse = "",
|
||||
},
|
||||
|
||||
g = {
|
||||
mapleader = " ",
|
||||
highlighturl_enabled = true,
|
||||
},
|
||||
}
|
||||
9
modules/home-manager/vim/config/lua/core/signs.lua
Normal file
9
modules/home-manager/vim/config/lua/core/signs.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
local icons = require("utils.icons").icons
|
||||
|
||||
return {
|
||||
{ name = "DiagnosticSignError", text = icons.Error, texthl = "DiagnosticError" },
|
||||
{ name = "DiagnosticSignHint", text = icons.Hint, texthl = "DiagnosticHint" },
|
||||
{ name = "DiagnosticSignWarn", text = icons.Warn, texthl = "DiagnosticWarn" },
|
||||
{ name = "DiagnosticSignInfo", text = icons.Info, texthl = "DiagnosticInfo" },
|
||||
{ name = "DapBreakpoint", text = icons.Breakpoint, texthl = "Breakpoint" },
|
||||
}
|
||||
18
modules/home-manager/vim/config/lua/lsp/autocmd.lua
Normal file
18
modules/home-manager/vim/config/lua/lsp/autocmd.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
local lsp = require("lsp.functions")
|
||||
|
||||
return {
|
||||
["textDocument/codeLens"] = {
|
||||
event = { "BufEnter", "InsertLeave" },
|
||||
opts = {
|
||||
group = vim.api.nvim_create_augroup("LspCodelens", {}),
|
||||
callback = lsp.refresh_codelens,
|
||||
},
|
||||
},
|
||||
["textDocument/formatting"] = {
|
||||
event = "BufWritePost",
|
||||
opts = {
|
||||
group = vim.api.nvim_create_augroup("LspFormatting", {}),
|
||||
callback = lsp.format,
|
||||
},
|
||||
},
|
||||
}
|
||||
27
modules/home-manager/vim/config/lua/lsp/config.lua
Normal file
27
modules/home-manager/vim/config/lua/lsp/config.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
local M = {}
|
||||
|
||||
M.set_autocmd = function(client, bufnr)
|
||||
local capability_map = require("lsp.autocmd")
|
||||
|
||||
for capability, map in pairs(capability_map) do
|
||||
if client.supports_method(capability) then
|
||||
vim.api.nvim_clear_autocmds({ group = map.opts.group, buffer = bufnr })
|
||||
map.opts.buffer = bufnr
|
||||
vim.api.nvim_create_autocmd(map.event, map.opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
M.set_keymaps = function(client, bufnr)
|
||||
local capability_map = require("lsp.keymaps")
|
||||
|
||||
for capability, maps in pairs(capability_map) do
|
||||
if client.supports_method(capability) then
|
||||
for key, map in pairs(maps) do
|
||||
vim.keymap.set("n", key, map[1], { desc = map[2], buffer = bufnr })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
42
modules/home-manager/vim/config/lua/lsp/functions.lua
Normal file
42
modules/home-manager/vim/config/lua/lsp/functions.lua
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
local M = {}
|
||||
|
||||
M.definitions = function() vim.cmd("Telescope lsp_definitions") end
|
||||
M.type_definition = function() vim.lsp.buf.type_definition() end
|
||||
M.declarations = function() vim.lsp.buf.declaration() end
|
||||
M.implementations = function() vim.cmd("Telescope lsp_implementations") 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()
|
||||
local _, win = vim.diagnostic.open_float()
|
||||
if win then
|
||||
vim.api.nvim_win_set_config(win, { border = "rounded" })
|
||||
vim.wo[win].signcolumn = "yes:1"
|
||||
end
|
||||
end
|
||||
M.next_diagnostic = function() vim.diagnostic.goto_next() end
|
||||
M.prev_diagnostic = function() vim.diagnostic.goto_prev() end
|
||||
|
||||
M.format = function()
|
||||
vim.api.nvim_create_autocmd("TextChanged", {
|
||||
group = vim.api.nvim_create_augroup("ApplyFormattingEdit", {}),
|
||||
buffer = vim.api.nvim_get_current_buf(),
|
||||
callback = function()
|
||||
vim.cmd("silent noautocmd update")
|
||||
vim.diagnostic.show()
|
||||
vim.api.nvim_del_augroup_by_name("ApplyFormattingEdit")
|
||||
end,
|
||||
})
|
||||
vim.lsp.buf.format({
|
||||
async = true,
|
||||
filter = function(client) return client.name == "null-ls" end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
59
modules/home-manager/vim/config/lua/lsp/handlers.lua
Normal file
59
modules/home-manager/vim/config/lua/lsp/handlers.lua
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
local M = {}
|
||||
|
||||
local make_config = function(name, config)
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
capabilities.textDocument.colorProvider = { dynamicRegistration = true }
|
||||
local extended_config = vim.tbl_extend("error", { capabilities = capabilities }, config)
|
||||
|
||||
return function() require("lspconfig")[name].setup(extended_config) end
|
||||
end
|
||||
|
||||
-- Default handler
|
||||
M[1] = function(server_name) make_config(server_name, {})() end
|
||||
|
||||
M.lua_ls = make_config("lua_ls", {
|
||||
settings = {
|
||||
Lua = {
|
||||
hint = {
|
||||
enable = true,
|
||||
},
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
"/usr/local/share/nvim/runtime/lua",
|
||||
"~/.local/share/nvim/lazy/neodev.nvim/types/stable",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
M.cssls = make_config("cssls", {
|
||||
settings = {
|
||||
css = {
|
||||
validate = true,
|
||||
lint = {
|
||||
unknownAtRules = "ignore",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
M.tailwindcss = make_config("tailwindcss", {
|
||||
on_attach = function()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
require("document-color").buf_attach(bufnr)
|
||||
end,
|
||||
})
|
||||
|
||||
M.clangd = make_config("clangd", {
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--offset-encoding=utf-16",
|
||||
},
|
||||
})
|
||||
|
||||
return M
|
||||
52
modules/home-manager/vim/config/lua/lsp/keymaps.lua
Normal file
52
modules/home-manager/vim/config/lua/lsp/keymaps.lua
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
local map = require("utils.mappings")
|
||||
local lsp = require("lsp.functions")
|
||||
local l, cmd = map.leader, map.cmd
|
||||
local fmt = require("utils.icons").fmt
|
||||
|
||||
return {
|
||||
["textDocument/formatting"] = {
|
||||
[l("lf")] = { lsp.format, fmt("Format", "Format buffer") },
|
||||
},
|
||||
["textDocument/publishDiagnostics"] = {
|
||||
[l("ld")] = { lsp.diagnostics, fmt("Warn", "Hover diagnostic") },
|
||||
["<A-i>"] = { lsp.next_diagnostic, "Next diagnostic" },
|
||||
["<A-o>"] = { lsp.prev_diagnostic, "Previous diagnostic" },
|
||||
},
|
||||
["textDocument/codeAction"] = {
|
||||
[l("a ")] = { cmd("CodeActionToggleLabel"), fmt("Toggle", "Toggle label") },
|
||||
},
|
||||
["textDocument/definition"] = {
|
||||
["gd"] = { lsp.definitions, "Go to definition" },
|
||||
},
|
||||
["textDocument/declaration"] = {
|
||||
["gD"] = { lsp.declarations, "Go to declaration" },
|
||||
},
|
||||
["textDocument/hover"] = {
|
||||
["K"] = { lsp.hover, "Hover info" },
|
||||
},
|
||||
["textDocument/implementation"] = {
|
||||
["gI"] = { lsp.implementations, "Symbol implementation" },
|
||||
},
|
||||
["textDocument/references"] = {
|
||||
["gr"] = { lsp.references, "Go to reference" },
|
||||
},
|
||||
["textDocument/rename"] = {
|
||||
["<leader>lr"] = { lsp.rename, fmt("Edit", "Rename symbol") },
|
||||
},
|
||||
["textDocument/signatureHelp"] = {
|
||||
["<leader>lH"] = { lsp.signature_help, fmt("Help", "Signature help") },
|
||||
},
|
||||
["textDocument/typeDefinition"] = {
|
||||
["gT"] = { lsp.type_definition, "Go to type definition" },
|
||||
},
|
||||
["textDocument/codeLens"] = {
|
||||
["<leader>ll"] = { lsp.run_codelens, fmt("Run", "Run codelens") },
|
||||
["<leader>lL"] = { lsp.refresh_codelens, fmt("Restart", "Refresh codelens") },
|
||||
},
|
||||
["workspace/symbol"] = {
|
||||
["<leader>ls"] = { lsp.symbols, fmt("Symbol", "Workspace symbols") },
|
||||
},
|
||||
["workspace/inlayHint"] = {
|
||||
["<leader>lh"] = { lsp.toggle_inlay_hint, fmt("Toggle", "Toggle inlay hint") },
|
||||
},
|
||||
}
|
||||
102
modules/home-manager/vim/config/lua/plugins/editor/core.lua
Normal file
102
modules/home-manager/vim/config/lua/plugins/editor/core.lua
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
local format = require("utils.icons").fmt
|
||||
|
||||
return {
|
||||
{
|
||||
"psliwka/vim-smoothie",
|
||||
keys = { "<C-u>", "<C-d>", "zz" },
|
||||
},
|
||||
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
dependencies = { "JoosepAlviste/nvim-ts-context-commentstring" },
|
||||
keys = {
|
||||
{ "gcc", mode = { "n" }, desc = "Comment line" },
|
||||
{ "gc", mode = { "v" }, desc = "Comment selection" },
|
||||
},
|
||||
config = function()
|
||||
local ft = require("Comment.ft")
|
||||
|
||||
ft.hypr = { "# %s" }
|
||||
|
||||
require("Comment").setup({
|
||||
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"NMAC427/guess-indent.nvim",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
opts = {
|
||||
autocmd = true,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"ojroques/nvim-bufdel",
|
||||
cmd = { "BufDel", "BufDelAll", "BufDelOthers" },
|
||||
opts = { quit = false },
|
||||
},
|
||||
|
||||
{
|
||||
"fedepujol/move.nvim",
|
||||
cmd = {
|
||||
"MoveLine",
|
||||
"MoveHChar",
|
||||
"MoveBlock",
|
||||
"MoveHBlock",
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
opts = {},
|
||||
},
|
||||
|
||||
{
|
||||
"kylechui/nvim-surround",
|
||||
keys = {
|
||||
{ "cs", mode = { "n" }, desc = "Change surrounding pair" },
|
||||
{ "ds", mode = { "n" }, desc = "Delete surrounding pair" },
|
||||
{ "ys", mode = { "n" }, desc = "Add surrounding pair" },
|
||||
{ "S", mode = { "v" }, desc = "Add surrounding pair" },
|
||||
},
|
||||
config = function() require("nvim-surround").setup() end,
|
||||
},
|
||||
|
||||
{
|
||||
"kevinhwang91/nvim-ufo",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
dependencies = { "kevinhwang91/promise-async" },
|
||||
opts = {
|
||||
provider_selector = function() return { "treesitter", "indent" } end,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"RRethy/vim-illuminate",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
config = function()
|
||||
require("illuminate").configure({
|
||||
filetypes_denylist = {
|
||||
"neo-tree",
|
||||
"dropbar_menu",
|
||||
"CodeAction",
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"Wansmer/treesj",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
keys = {
|
||||
{ "<leader>j", mode = { "n" }, ":TSJSplit<CR>", desc = format("Down", "Split node") },
|
||||
{ "<leader>J", mode = { "n" }, ":TSJJoin<CR>", desc = format("Up", "Join node") },
|
||||
},
|
||||
opts = {
|
||||
use_default_keymaps = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
opts = {
|
||||
signs = {
|
||||
add = { hl = "GitSignsAdd", text = "▎" },
|
||||
change = { hl = "GitSignsChange", text = "▎" },
|
||||
untracked = { hl = "GitSignsAdd", text = "▎" },
|
||||
delete = { hl = "GitSignsDelete", text = "▎" },
|
||||
topdelete = { hl = "GitSignsDelete", text = "▎" },
|
||||
changedelete = { hl = "GitSignsChange", text = "▎" },
|
||||
},
|
||||
preview_config = {
|
||||
border = "none",
|
||||
},
|
||||
},
|
||||
}
|
||||
126
modules/home-manager/vim/config/lua/plugins/editor/nvim-cmp.lua
Normal file
126
modules/home-manager/vim/config/lua/plugins/editor/nvim-cmp.lua
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
return {
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = { "rafamadriz/friendly-snippets" },
|
||||
event = "InsertEnter",
|
||||
build = "make install_jsregexp",
|
||||
config = function() require("luasnip.loaders.from_vscode").lazy_load() end,
|
||||
},
|
||||
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = { "InsertEnter", "CmdlineEnter" },
|
||||
dependencies = {
|
||||
"neovim/nvim-lspconfig",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"onsails/lspkind-nvim",
|
||||
"windwp/nvim-autopairs",
|
||||
},
|
||||
opts = function()
|
||||
local cmp = require("cmp")
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
||||
|
||||
local lspkind_status_ok, lspkind = pcall(require, "lspkind")
|
||||
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||
|
||||
if not snip_status_ok then return end
|
||||
|
||||
local win_conf = cmp.config.window.bordered({
|
||||
winhighlight = "FloatBorder:FloatBorder",
|
||||
scrollbar = false,
|
||||
})
|
||||
|
||||
return {
|
||||
snippet = {
|
||||
expand = function(args) luasnip.lsp_expand(args.body) end,
|
||||
},
|
||||
window = {
|
||||
completion = win_conf,
|
||||
documentation = win_conf,
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp", priority = 1000 },
|
||||
{ name = "crates", priority = 1000 },
|
||||
{ name = "vim-dadbod-completion", priority = 1000 },
|
||||
{ name = "luasnip", priority = 750 },
|
||||
{ name = "buffer", priority = 500 },
|
||||
{ name = "path", priority = 250 },
|
||||
}),
|
||||
mapping = {
|
||||
["<Up>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<Down>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-u>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
|
||||
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||
["<C-y>"] = cmp.config.disable,
|
||||
["<C-e>"] = cmp.mapping({ i = cmp.mapping.abort(), c = cmp.mapping.close() }),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
formatting = {
|
||||
format = lspkind_status_ok
|
||||
and lspkind.cmp_format({
|
||||
mode = "symbol",
|
||||
maxwidth = 25,
|
||||
ellipsis_char = "...",
|
||||
before = function(entry, vim_item)
|
||||
if vim_item.kind == "Color" and entry.completion_item.documentation then
|
||||
local _, _, r, g, b =
|
||||
string.find(entry.completion_item.documentation, "^rgb%((%d+), (%d+), (%d+)")
|
||||
if r then
|
||||
local color = string.format("%02x", r)
|
||||
.. string.format("%02x", g)
|
||||
.. string.format("%02x", b)
|
||||
local group = "Tw_" .. color
|
||||
if vim.fn.hlID(group) < 1 then
|
||||
vim.api.nvim_set_hl(0, group, { fg = "#" .. color })
|
||||
end
|
||||
vim_item.kind_hl_group = group
|
||||
return vim_item
|
||||
end
|
||||
end
|
||||
return vim_item
|
||||
end,
|
||||
}),
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
return {
|
||||
"mfussenegger/nvim-dap",
|
||||
keys = {
|
||||
{ "<leader>d", mode = { "n" } },
|
||||
},
|
||||
cmd = { "DapContinue", "DapToggleBreakpoint" },
|
||||
dependencies = {
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
dependencies = { "nvim-dap" },
|
||||
cmd = { "DapInstall", "DapUninstall" },
|
||||
opts = {
|
||||
handlers = {},
|
||||
ensure_installed = {
|
||||
"codelldb",
|
||||
"node-debug2-adapter",
|
||||
},
|
||||
},
|
||||
},
|
||||
{ "rcarriga/nvim-dap-ui", opts = {} },
|
||||
{
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
opts = {
|
||||
virt_text_pos = "eol",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
dependencies = { "windwp/nvim-ts-autotag" },
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
cmd = {
|
||||
"TSBufDisable",
|
||||
"TSBufEnable",
|
||||
"TSBufToggle",
|
||||
"TSDisable",
|
||||
"TSEnable",
|
||||
"TSToggle",
|
||||
"TSInstall",
|
||||
"TSInstallInfo",
|
||||
"TSInstallSync",
|
||||
"TSModuleInfo",
|
||||
"TSUninstall",
|
||||
"TSUpdate",
|
||||
"TSUpdateSync",
|
||||
},
|
||||
build = ":TSUpdate",
|
||||
opts = {
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end,
|
||||
},
|
||||
incremental_selection = { enable = true },
|
||||
indent = { enable = true },
|
||||
autotag = { enable = true },
|
||||
context_commentstring = {
|
||||
enable = true,
|
||||
enable_autocmd = false,
|
||||
},
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"html",
|
||||
"css",
|
||||
"javascript",
|
||||
"json",
|
||||
"toml",
|
||||
"lua",
|
||||
"luadoc",
|
||||
"luap",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python",
|
||||
"rust",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"yaml",
|
||||
"sql",
|
||||
"query",
|
||||
"icelang",
|
||||
"java",
|
||||
"http",
|
||||
"rasi",
|
||||
"haskell",
|
||||
"ebnf",
|
||||
},
|
||||
},
|
||||
config = function(_, opts) require("nvim-treesitter.configs").setup(opts) end,
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
"Shatur/neovim-session-manager",
|
||||
cmd = { "SessionManager" },
|
||||
config = function()
|
||||
local config = require("session_manager.config")
|
||||
require("session_manager").setup({
|
||||
autoload_mode = config.AutoloadMode.Disabled,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
local format = require("utils.icons").fmt
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
cmd = { "Telescope" },
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
"nvim-telescope/telescope-dap.nvim",
|
||||
},
|
||||
opts = {
|
||||
defaults = {
|
||||
border = true,
|
||||
prompt_prefix = " ",
|
||||
selection_caret = format("Right", ""),
|
||||
},
|
||||
extensions = {
|
||||
fzf = {},
|
||||
aerial = {},
|
||||
dap = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
return {
|
||||
"akinsho/toggleterm.nvim",
|
||||
cmd = { "ToggleTerm" },
|
||||
opts = {
|
||||
shade_terminals = false,
|
||||
direction = "float",
|
||||
float_opts = {
|
||||
border = "rounded",
|
||||
width = 80,
|
||||
},
|
||||
highlights = {
|
||||
FloatBorder = {
|
||||
link = "FloatBorder",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
6
modules/home-manager/vim/config/lua/plugins/init.lua
Normal file
6
modules/home-manager/vim/config/lua/plugins/init.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
{ import = "plugins.ui" },
|
||||
{ import = "plugins.editor" },
|
||||
{ import = "plugins.lsp" },
|
||||
{ import = "plugins.tools" },
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
return {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
dependencies = { "neovim/nvim-lspconfig" },
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
opts = {
|
||||
handlers = require("lsp.handlers"),
|
||||
ensure_installed = {
|
||||
"rust_analyzer",
|
||||
"tsserver",
|
||||
"lua_ls",
|
||||
"bashls",
|
||||
"html",
|
||||
"cssls",
|
||||
"emmet_ls",
|
||||
"tailwindcss",
|
||||
"clangd",
|
||||
"vimls",
|
||||
"jsonls",
|
||||
"taplo",
|
||||
"jdtls",
|
||||
},
|
||||
},
|
||||
}
|
||||
16
modules/home-manager/vim/config/lua/plugins/lsp/mason.lua
Normal file
16
modules/home-manager/vim/config/lua/plugins/lsp/mason.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
local icons = require("utils.icons").icons
|
||||
|
||||
return {
|
||||
"williamboman/mason.nvim",
|
||||
build = ":MasonUpdate",
|
||||
opts = {
|
||||
ui = {
|
||||
border = "rounded",
|
||||
icons = {
|
||||
package_installed = icons.Check,
|
||||
package_pending = icons.Dots,
|
||||
package_uninstalled = icons.Install,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
37
modules/home-manager/vim/config/lua/plugins/lsp/null-ls.lua
Normal file
37
modules/home-manager/vim/config/lua/plugins/lsp/null-ls.lua
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
return {
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
dependencies = {
|
||||
{
|
||||
"jay-babu/mason-null-ls.nvim",
|
||||
cmd = { "NullLsInstall", "NullLsUninstall" },
|
||||
opts = { handlers = {} },
|
||||
},
|
||||
},
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
null_ls.setup({
|
||||
debug = false,
|
||||
ensure_installed = {
|
||||
"clang-format",
|
||||
"prettierd",
|
||||
"rustfmt",
|
||||
"shfmt",
|
||||
"stylua",
|
||||
},
|
||||
sources = {
|
||||
null_ls.builtins.formatting.rustfmt.with({
|
||||
extra_args = { "--edition=2021" },
|
||||
}),
|
||||
null_ls.builtins.formatting.shfmt.with({
|
||||
filetypes = { "sh", "zsh" },
|
||||
extra_args = { "--indent-type Spaces" },
|
||||
}),
|
||||
null_ls.builtins.formatting.clang_format.with({
|
||||
extra_args = { "-style={IndentWidth: 4, AllowShortFunctionsOnASingleLine: Empty}" },
|
||||
}),
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
return {
|
||||
{ "folke/neodev.nvim", ft = "lua", opts = {} },
|
||||
{
|
||||
"b0o/schemastore.nvim",
|
||||
ft = "json",
|
||||
config = function()
|
||||
require("lspconfig").jsonls.setup({
|
||||
capabilities = require("lsp.capabilities"),
|
||||
settings = {
|
||||
json = {
|
||||
schemas = require("schemastore").json.schemas(),
|
||||
validate = { enable = true },
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"simrat39/rust-tools.nvim",
|
||||
ft = "rust",
|
||||
config = function()
|
||||
require("rust-tools").setup({
|
||||
tools = {
|
||||
inlay_hints = {
|
||||
auto = false,
|
||||
},
|
||||
},
|
||||
server = {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
cargo = {
|
||||
features = "all",
|
||||
},
|
||||
checkOnSave = {
|
||||
features = "all",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
dap = {
|
||||
adapter = require("rust-tools.dap").get_codelldb_adapter(
|
||||
"/home/luckas/.local/share/nvim/mason/packages/codelldb/extension/adapter/codelldb",
|
||||
"/home/luckas/.local/share/nvim/mason/packages/codelldb/extension/lldb/lib/liblldb.so"
|
||||
),
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
13
modules/home-manager/vim/config/lua/plugins/tools/ccc.lua
Normal file
13
modules/home-manager/vim/config/lua/plugins/tools/ccc.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
return {
|
||||
"uga-rosa/ccc.nvim",
|
||||
cmd = {
|
||||
"CccPick",
|
||||
"CccConvert",
|
||||
"CccHighlighterEnable",
|
||||
"CccHighlighterDisable",
|
||||
"CccHighlighterToggle",
|
||||
},
|
||||
opts = {
|
||||
alpha_show = "show"
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
local format = require("utils.icons").fmt
|
||||
|
||||
return {
|
||||
"luckasRanarison/clear-action.nvim",
|
||||
event = "LspAttach",
|
||||
opts = {
|
||||
signs = {
|
||||
show_count = false,
|
||||
show_label = true,
|
||||
combine = true,
|
||||
},
|
||||
popup = {
|
||||
hide_cursor = true,
|
||||
},
|
||||
mappings = {
|
||||
code_action = { "<leader>la", format("Fix", "Code action") },
|
||||
apply_first = { "<leader>aa", format("Fix", "Apply") },
|
||||
quickfix = { "<leader>aq", format("Fix", "Quickfix") },
|
||||
quickfix_next = { "<leader>an", format("Fix", "Quickfix next") },
|
||||
quickfix_prev = { "<leader>ap", format("Fix", "Quickfix prev") },
|
||||
refactor = { "<leader>ar", format("Fix", "Refactor") },
|
||||
refactor_inline = { "<leader>aR", format("Fix", "Refactor inline") },
|
||||
actions = {
|
||||
["rust_analyzer"] = {
|
||||
["Import"] = { "<leader>ai", format("Fix", "Import") },
|
||||
["Replace if"] = { "<leader>am", format("Fix", "Replace if with match") },
|
||||
["Fill match"] = { "<leader>af", format("Fix", "Fill match arms") },
|
||||
["Wrap"] = { "<leader>aw", format("Fix", "Wrap") },
|
||||
["Insert `mod"] = { "<leader>aM", format("Fix", "Insert mod") },
|
||||
["Insert `pub"] = { "<leader>aP", format("Fix", "Insert pub mod") },
|
||||
["Add braces"] = { "<leader>ab", format("Fix", "Add braces") },
|
||||
},
|
||||
},
|
||||
},
|
||||
quickfix_filters = {
|
||||
["rust_analyzer"] = {
|
||||
["E0412"] = "Import",
|
||||
["E0425"] = "Import",
|
||||
["E0433"] = "Import",
|
||||
["unused_imports"] = "remove",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
14
modules/home-manager/vim/config/lua/plugins/tools/crates.lua
Normal file
14
modules/home-manager/vim/config/lua/plugins/tools/crates.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
return {
|
||||
"saecki/crates.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
},
|
||||
event = { "BufRead Cargo.toml" },
|
||||
opts = {
|
||||
null_ls = {
|
||||
enabled = true,
|
||||
name = "Crates",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
"mrshmllow/document-color.nvim",
|
||||
lazy = true,
|
||||
opts = {},
|
||||
}
|
||||
18
modules/home-manager/vim/config/lua/plugins/tools/flash.lua
Normal file
18
modules/home-manager/vim/config/lua/plugins/tools/flash.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
local lua = require("utils.mappings").lua
|
||||
|
||||
return {
|
||||
"folke/flash.nvim",
|
||||
keys = {
|
||||
{ "f", mode = { "n", "v" } },
|
||||
{ "F", mode = { "n", "v" } },
|
||||
{ "t", mode = { "n", "v" } },
|
||||
{ "T", mode = { "n", "v" } },
|
||||
|
||||
{ "s", mode = { "n", "v" }, lua('require("flash").jump()') },
|
||||
{ "ß", mode = "n", lua("require('flash').jump({ pattern = vim.fn.expand('<cword>') })") },
|
||||
{ "S", mode = "n", lua("require('flash').treesitter()") },
|
||||
{ "o", mode = "o", lua("require('flash').jump()"), desc = "Search jump" },
|
||||
{ "O", mode = "o", lua("require('flash').treesitter()"), desc = "Tresitter jump" },
|
||||
},
|
||||
opts = {},
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
return {
|
||||
-- "luckasRanarison/nvim-devdocs",
|
||||
dir = "~/Projects/nvim-devdocs",
|
||||
branch = "master",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
cmd = {
|
||||
"DevdocsFetch",
|
||||
"DevdocsInstall",
|
||||
"DevdocsUninstall",
|
||||
"DevdocsOpen",
|
||||
"DevdocsOpenFloat",
|
||||
"DevdocsOpenCurrent",
|
||||
"DevdocsOpenCurrentFloat",
|
||||
"DevdocsUpdate",
|
||||
"DevdocsUpdateAll",
|
||||
"DevdocsBuild",
|
||||
},
|
||||
opts = {
|
||||
format = "markdown",
|
||||
filetypes = {
|
||||
javascript = { "html", "javascript" },
|
||||
},
|
||||
-- use_node = false,
|
||||
ensure_installed = {
|
||||
-- "git",
|
||||
-- "bash",
|
||||
-- "rust",
|
||||
-- "lua-5.4",
|
||||
-- "html",
|
||||
-- "css",
|
||||
-- "javascript",
|
||||
-- "typescript",
|
||||
-- "react",
|
||||
-- "web_extensions",
|
||||
},
|
||||
wrap = true,
|
||||
previewer_cmd = "glow",
|
||||
cmd_args = { "-s", "auto", "-w", "97" },
|
||||
cmd_ignore = {},
|
||||
picker_cmd = true,
|
||||
picker_cmd_args = { "-s", "auto", "-w", "45" },
|
||||
mappings = {
|
||||
open_in_browser = "<leader>vb",
|
||||
toggle_rendering = "<leader>vr",
|
||||
},
|
||||
log_level = "debug",
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
return {
|
||||
"kristijanhusak/vim-dadbod-ui",
|
||||
dependencies = {
|
||||
"tpope/vim-dadbod",
|
||||
"kristijanhusak/vim-dadbod-completion",
|
||||
},
|
||||
cmd = {
|
||||
"DBUI",
|
||||
"DBUIAddConnection",
|
||||
"DBUIClose",
|
||||
"DBUIToggle",
|
||||
"DBUIFindBuffer",
|
||||
"DBUIRenameBuffer",
|
||||
"DBUILastQueryInfo",
|
||||
},
|
||||
config = function()
|
||||
vim.g.db_ui_notification_width = 1
|
||||
vim.g.db_ui_debug = 1
|
||||
end,
|
||||
}
|
||||
35
modules/home-manager/vim/config/lua/plugins/ui/alpha.lua
Normal file
35
modules/home-manager/vim/config/lua/plugins/ui/alpha.lua
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
local format = require("utils.icons").fmt
|
||||
|
||||
return {
|
||||
"goolord/alpha-nvim",
|
||||
config = function()
|
||||
local alpha = require("alpha")
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
dashboard.section.header.val = {
|
||||
[[ ]],
|
||||
[[ ]],
|
||||
[[ ████ ██████ █████ ██ ]],
|
||||
[[ ███████████ █████ ]],
|
||||
[[ █████████ ███████████████████ ███ ███████████ ]],
|
||||
[[ █████████ ███ █████████████ █████ ██████████████ ]],
|
||||
[[ █████████ ██████████ █████████ █████ █████ ████ █████ ]],
|
||||
[[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]],
|
||||
[[ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]],
|
||||
[[ ]],
|
||||
}
|
||||
dashboard.section.buttons.val = {
|
||||
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("l", format("History", "Recents", 2), ":SessionManager load_session<CR>"),
|
||||
dashboard.button(
|
||||
"L",
|
||||
format("FolderOpened", "Last session", 2),
|
||||
":SessionManager load_last_session<CR>"
|
||||
),
|
||||
dashboard.button("q", format("Exit", "Quit", 2), ":qa<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
|
||||
alpha.setup(dashboard.config)
|
||||
end,
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
local format = require("utils.icons").fmt
|
||||
|
||||
return {
|
||||
"akinsho/bufferline.nvim",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
dependencies = "nvim-tree/nvim-web-devicons",
|
||||
opts = {
|
||||
options = {
|
||||
diagnostics = "nvim_lsp",
|
||||
diagnostics_update_in_insert = true,
|
||||
diagnostics_indicator = nil,
|
||||
indicator = "none",
|
||||
offsets = {
|
||||
{
|
||||
filetype = "neo-tree",
|
||||
text = format("Folder", "NeoTree"),
|
||||
text_align = "left",
|
||||
separator = "│",
|
||||
},
|
||||
{
|
||||
filetype = "dapui_watches",
|
||||
text = format("Debugger", "DapUI"),
|
||||
text_align = "left",
|
||||
separator = "│",
|
||||
},
|
||||
{
|
||||
filetype = "dbui",
|
||||
text = format("Database", "DbUI"),
|
||||
text_align = "left",
|
||||
separator = "│",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local colors = require("tokyonight.colors")
|
||||
|
||||
vim.opt.showtabline = 2
|
||||
opts.highlights = {
|
||||
background = { bg = colors.night.bg },
|
||||
close_button = { bg = colors.night.bg },
|
||||
separator = { fg = colors.night.bg, bg = colors.night.bg },
|
||||
offset_separator = { bg = colors.night.bg },
|
||||
pick = { bg = colors.night.bg },
|
||||
}
|
||||
|
||||
require("bufferline").setup(opts)
|
||||
end,
|
||||
}
|
||||
22
modules/home-manager/vim/config/lua/plugins/ui/dressing.lua
Normal file
22
modules/home-manager/vim/config/lua/plugins/ui/dressing.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
return {
|
||||
"stevearc/dressing.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
local theme = require("telescope.themes").get_dropdown()
|
||||
|
||||
theme.layout_config = {
|
||||
width = 60,
|
||||
height = 17,
|
||||
}
|
||||
|
||||
require("dressing").setup({
|
||||
input = {
|
||||
enabled = false,
|
||||
},
|
||||
select = {
|
||||
backend = { "telescope" },
|
||||
telescope = theme,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
18
modules/home-manager/vim/config/lua/plugins/ui/dropbar.lua
Normal file
18
modules/home-manager/vim/config/lua/plugins/ui/dropbar.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
return {
|
||||
{
|
||||
"Bekaboo/dropbar.nvim",
|
||||
event = { "BufRead", "BufNewFile" },
|
||||
opts = {
|
||||
icons = {
|
||||
enable = true,
|
||||
kinds = {
|
||||
use_devicons = false,
|
||||
symbols = {
|
||||
File = "",
|
||||
Folder = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
return {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
main = "ibl",
|
||||
opts = {
|
||||
exclude = {
|
||||
buftypes = {
|
||||
"nofile",
|
||||
"terminal",
|
||||
},
|
||||
filetypes = {
|
||||
"help",
|
||||
"startify",
|
||||
"aerial",
|
||||
"alpha",
|
||||
"dashboard",
|
||||
"lazy",
|
||||
"neogitstatus",
|
||||
"neo-tree",
|
||||
"Trouble",
|
||||
"dbout",
|
||||
"TelescopePrompt",
|
||||
},
|
||||
},
|
||||
scope = {
|
||||
show_start = false,
|
||||
show_end = false,
|
||||
highlight = { "@keyword" },
|
||||
char = "▏",
|
||||
include = {
|
||||
node_type = {
|
||||
lua = { "table_constructor" },
|
||||
},
|
||||
},
|
||||
},
|
||||
whitespace = {
|
||||
remove_blankline_trail = true,
|
||||
},
|
||||
indent = { char = "▏" },
|
||||
},
|
||||
}
|
||||
31
modules/home-manager/vim/config/lua/plugins/ui/lualine.lua
Normal file
31
modules/home-manager/vim/config/lua/plugins/ui/lualine.lua
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
local sources = require("plugins.utils.lualine_sources")
|
||||
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function(_, opts)
|
||||
local colors = require("tokyonight.colors")
|
||||
local tokyonight = require("lualine.themes.tokyonight")
|
||||
|
||||
vim.opt.laststatus = 3
|
||||
tokyonight.normal.c.bg = colors.night.bg
|
||||
opts.options.theme = tokyonight
|
||||
|
||||
require("lualine").setup(opts)
|
||||
end,
|
||||
opts = {
|
||||
options = {
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { sources.mode },
|
||||
lualine_b = { sources.branch, sources.diff },
|
||||
lualine_c = { sources.filetype, sources.macro },
|
||||
lualine_x = { sources.lsp, sources.diagnostics },
|
||||
lualine_y = { sources.indentation, sources.encoding, sources.fileformat },
|
||||
lualine_z = { sources.progress, sources.location },
|
||||
},
|
||||
},
|
||||
}
|
||||
84
modules/home-manager/vim/config/lua/plugins/ui/neo-tree.lua
Normal file
84
modules/home-manager/vim/config/lua/plugins/ui/neo-tree.lua
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
local icons = require("utils.icons").icons
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"MunifTanjim/nui.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"luckasRanarison/neo-rename.nvim",
|
||||
},
|
||||
cmd = "Neotree",
|
||||
opts = {
|
||||
enable_git_status = true,
|
||||
close_if_last_window = true,
|
||||
auto_clean_after_session_restore = true,
|
||||
window = {
|
||||
width = 30,
|
||||
mappings = {
|
||||
["<space>"] = false,
|
||||
["s"] = false,
|
||||
["l"] = "open",
|
||||
["v"] = "open_vsplit",
|
||||
["gA"] = "git_add_all",
|
||||
["ga"] = "git_add_file",
|
||||
["gu"] = "git_unstage_file",
|
||||
["gr"] = "git_revert_file",
|
||||
},
|
||||
},
|
||||
filesystem = {
|
||||
follow_current_file = true,
|
||||
hijack_netrw_behavior = "open_current",
|
||||
use_libuv_file_watcher = true,
|
||||
},
|
||||
default_component_configs = {
|
||||
icon = {
|
||||
folder_empty = icons.EmptyFolder,
|
||||
default = icons.DefaultFile,
|
||||
},
|
||||
indent = {
|
||||
padding = 0,
|
||||
indent_size = 1,
|
||||
},
|
||||
modified = {
|
||||
symbol = icons.SmallDot,
|
||||
},
|
||||
name = {
|
||||
use_git_status_colors = true,
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
deleted = "D",
|
||||
renamed = "R",
|
||||
modified = "M",
|
||||
added = "A",
|
||||
untracked = "U",
|
||||
ignored = "",
|
||||
staged = "",
|
||||
unstaged = "!",
|
||||
conflict = "C",
|
||||
},
|
||||
},
|
||||
diagnostics = {
|
||||
symbols = {
|
||||
hint = icons.Hint,
|
||||
info = icons.Info,
|
||||
warn = icons.Warn,
|
||||
error = icons.Error,
|
||||
},
|
||||
highlights = {
|
||||
hint = "DiagnosticSignHint",
|
||||
info = "DiagnosticSignInfo",
|
||||
warn = "DiagnosticSignWarn",
|
||||
error = "DiagnosticSignError",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("neo-tree").setup(opts)
|
||||
require("neo-rename").setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
34
modules/home-manager/vim/config/lua/plugins/ui/noice.lua
Normal file
34
modules/home-manager/vim/config/lua/plugins/ui/noice.lua
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
local icons = require("utils.icons").icons
|
||||
|
||||
return {
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
{ "rcarriga/nvim-notify" },
|
||||
},
|
||||
opts = {
|
||||
cmdline = {
|
||||
format = {
|
||||
cmdline = { pattern = "^:", icon = icons.Command, lang = "vim" },
|
||||
},
|
||||
},
|
||||
lsp = {
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
hover = {
|
||||
silent = true,
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
bottom_search = false,
|
||||
command_palette = true,
|
||||
long_message_to_split = true,
|
||||
inc_rename = false,
|
||||
lsp_doc_border = "rounded",
|
||||
},
|
||||
},
|
||||
}
|
||||
158
modules/home-manager/vim/config/lua/plugins/ui/tokyonight.lua
Normal file
158
modules/home-manager/vim/config/lua/plugins/ui/tokyonight.lua
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
return {
|
||||
"folke/tokyonight.nvim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
init = function() vim.cmd.colorscheme("tokyonight-night") end,
|
||||
opts = {
|
||||
styles = {
|
||||
keywords = { italic = false },
|
||||
},
|
||||
on_colors = function(colors)
|
||||
colors.gitSigns.add = colors.green
|
||||
colors.gitSigns.change = colors.blue
|
||||
colors.gitSigns.delete = colors.red
|
||||
colors.gitSigns.ignored = colors.bg
|
||||
colors.status_line = colors.none
|
||||
return colors
|
||||
end,
|
||||
on_highlights = function(hl, c)
|
||||
local highlights = {
|
||||
NormalSB = { bg = nil },
|
||||
NormalFloat = { bg = nil },
|
||||
FloatBorder = { fg = c.dark3 },
|
||||
FloatTitle = { fg = c.dark3 },
|
||||
CursorLineNr = { fg = c.blue },
|
||||
Breakpoint = { fg = c.orange },
|
||||
WinSeparator = { fg = c.terminal_black },
|
||||
WinBar = { bg = nil },
|
||||
WinBarNC = { bg = nil },
|
||||
LspInlayHint = { fg = c.comment },
|
||||
|
||||
DiagnosticSignError = { fg = c.red },
|
||||
DiagnosticSignWarn = { fg = c.yellow },
|
||||
DiagnosticSignHint = { fg = c.blue },
|
||||
DiagnosticSignInfo = { fg = c.blue },
|
||||
DiagnosticError = { fg = c.red },
|
||||
DiagnosticWarn = { fg = c.yellow },
|
||||
DiagnosticHint = { fg = c.blue },
|
||||
DiagnosticInfo = { fg = c.blue },
|
||||
|
||||
BufferLineFill = { bg = c.bg },
|
||||
BufferLineCloseButtonSelected = { fg = c.red },
|
||||
BufferLineError = { fg = c.red, bg = c.bg, bold = true },
|
||||
BufferLineWarning = { fg = c.yellow, bg = c.bg, bold = true },
|
||||
BufferLineHint = { fg = c.blue, bg = c.bg, bold = true },
|
||||
BufferLineInfo = { fg = c.blue, bg = c.bg, bold = true },
|
||||
BufferLineModified = { fg = c.green, bg = c.bg },
|
||||
BufferLineDuplicate = { fg = c.comment, bg = c.bg, bold = true },
|
||||
BufferLineDuplicateSelected = { fg = c.fg, bg = c.bg, bold = true, italic = true },
|
||||
BufferLineTruncMarker = { bg = c.bg },
|
||||
|
||||
NeoTreeDirectoryName = { fg = c.fg },
|
||||
NeoTreeNormalNC = { bg = c.bg },
|
||||
NeoTreeNormal = { bg = c.bg },
|
||||
NeoTreeGitUntracked = { fg = c.orange },
|
||||
NeoTreeGitUnstaged = { fg = c.cyan },
|
||||
|
||||
WhichKeyFloat = { bg = c.bg },
|
||||
FlashLabel = { fg = c.red, bg = c.bg },
|
||||
FlashCurrent = { bg = c.fg },
|
||||
|
||||
TelescopeNormal = { bg = nil },
|
||||
TelescopePromptPrefix = { fg = c.dark3 },
|
||||
TelescopeBorder = { link = "FloatBorder" },
|
||||
|
||||
NotifyINFOBorder = { fg = c.blue },
|
||||
NotifyINFOTitle = { fg = c.blue },
|
||||
NotifyINFOIcon = { fg = c.blue },
|
||||
NotifyERRORBorder = { fg = c.red },
|
||||
NotifyERRORTitle = { fg = c.red },
|
||||
NotifyERRORIcon = { fg = c.red },
|
||||
NotifyWARNBorder = { fg = c.yellow },
|
||||
NotifyWARNTitle = { fg = c.yellow },
|
||||
NotifyWARNIcon = { fg = c.yellow },
|
||||
ErrorMsg = { fg = c.red },
|
||||
|
||||
diffAdded = { fg = c.green },
|
||||
diffRemoved = { fg = c.red },
|
||||
diffChanged = { fg = c.blue },
|
||||
diffNewFile = { fg = c.cyan },
|
||||
diffOldFile = { fg = c.comment },
|
||||
DiffAdd = { fg = c.green },
|
||||
DiffChange = { fg = c.blue },
|
||||
DiffDelete = { fg = c.red },
|
||||
DiffText = { fg = c.purple },
|
||||
|
||||
DropBarSeparator = { fg = c.dark5 },
|
||||
DropBarPick = { fg = c.red, bold = true, italic = true },
|
||||
DropBarKind = { fg = c.fg },
|
||||
DropBarKindFolder = { fg = c.dark5 },
|
||||
DropBarIconUIPickPivot = { link = "DropBarPick" },
|
||||
DropBarIconUISeparator = { link = "DropBarSeparator" },
|
||||
}
|
||||
|
||||
for key, value in pairs(highlights) do
|
||||
hl[key] = value
|
||||
end
|
||||
|
||||
local dropbar_hl = {
|
||||
"Array",
|
||||
"Boolean",
|
||||
"Constant",
|
||||
"Constructor",
|
||||
"Enum",
|
||||
"EnumMember",
|
||||
"Field",
|
||||
"Function",
|
||||
"Identifier",
|
||||
"List",
|
||||
"Macro",
|
||||
"Number",
|
||||
"Object",
|
||||
"Operator",
|
||||
"Package",
|
||||
"Property",
|
||||
"Reference",
|
||||
"String",
|
||||
"Type",
|
||||
"TypeParameter",
|
||||
"Unit",
|
||||
"Value",
|
||||
"Variable",
|
||||
"Null",
|
||||
"Specifier",
|
||||
"BreakStatement",
|
||||
"CaseStatement",
|
||||
"ContinueStatement",
|
||||
"Declaration",
|
||||
"Delete",
|
||||
"DoStatement",
|
||||
"ElseStatement",
|
||||
"ForStatement",
|
||||
"IfStatement",
|
||||
"Repeat",
|
||||
"Scope",
|
||||
"Specifier",
|
||||
"Statement",
|
||||
"SwitchStatement",
|
||||
"WhileStatement",
|
||||
"Class",
|
||||
"Event",
|
||||
"Interface",
|
||||
"Method",
|
||||
"Module",
|
||||
"Namespace",
|
||||
"MarkdownH1",
|
||||
"MarkdownH2",
|
||||
"MarkdownH3",
|
||||
"MarkdownH4",
|
||||
"MarkdownH5",
|
||||
"MarkdownH6",
|
||||
}
|
||||
|
||||
for _, value in pairs(dropbar_hl) do
|
||||
hl["DropBarKind" .. value] = { link = "DropBarKind" }
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
37
modules/home-manager/vim/config/lua/plugins/ui/which-key.lua
Normal file
37
modules/home-manager/vim/config/lua/plugins/ui/which-key.lua
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
local format = require("utils.icons").fmt
|
||||
|
||||
return {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
require("which-key").register({
|
||||
a = { name = format("Fix", "Actions") },
|
||||
c = { name = format("Color", "Color") },
|
||||
b = { name = format("Windows", "Buffers") },
|
||||
u = { name = format("Window", "UI") },
|
||||
g = { name = format("Git", "Git") },
|
||||
t = { name = format("Terminal", "Terminal") },
|
||||
f = { name = format("Search", "Telescope") },
|
||||
l = { name = format("Braces", "LSP") },
|
||||
d = { name = format("Debugger", "Debugger") },
|
||||
n = { name = format("Notification", "Notification") },
|
||||
S = { name = format("FolderClock", "Session") },
|
||||
r = { name = format("Code", "SnipRun") },
|
||||
o = { name = format("DropDown", "Dropbar") },
|
||||
v = { name = format("Book", "DevDocs") },
|
||||
C = { name = format("Package", "Crates") },
|
||||
D = { name = format("Database", "DbUI") },
|
||||
}, { prefix = "<leader>" })
|
||||
end,
|
||||
opts = {
|
||||
key_labels = {
|
||||
["<space>"] = " ",
|
||||
},
|
||||
icons = {
|
||||
group = "",
|
||||
},
|
||||
window = {
|
||||
border = "rounded",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
local icons = require("utils.icons").icons
|
||||
local fmt = require("utils.icons").fmt
|
||||
local M = {}
|
||||
|
||||
M.mode = {
|
||||
"mode",
|
||||
fmt = function(name)
|
||||
local map = {
|
||||
NORMAL = icons.Normal,
|
||||
INSERT = icons.Insert,
|
||||
TERMINAL = icons.Terminal,
|
||||
VISUAL = icons.Visual,
|
||||
["V-LINE"] = icons.Visual,
|
||||
["V-BLOCK"] = icons.Visual,
|
||||
["O-PENDING"] = icons.Ellipsis,
|
||||
COMMAND = icons.Command,
|
||||
REPLACE = icons.Edit,
|
||||
SELECT = icons.Visual,
|
||||
}
|
||||
local icon = map[name] and map[name] or icons.Vim
|
||||
return icon .. " " .. name
|
||||
end,
|
||||
color = function()
|
||||
local colors = require("tokyonight.colors")
|
||||
local mode = vim.fn.mode()
|
||||
local map = {
|
||||
n = colors.default.blue,
|
||||
i = colors.default.green,
|
||||
c = colors.default.yellow,
|
||||
t = colors.default.cyan,
|
||||
R = colors.default.red,
|
||||
v = colors.default.magenta,
|
||||
V = colors.default.magenta,
|
||||
s = colors.default.magenta,
|
||||
S = colors.default.magenta,
|
||||
}
|
||||
return {
|
||||
fg = map[mode] or colors.default.magenta,
|
||||
bg = colors.night.bg,
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
M.branch = {
|
||||
"branch",
|
||||
icon = icons.GitBranch,
|
||||
color = function()
|
||||
local colors = require("tokyonight.colors")
|
||||
return { bg = colors.night.bg }
|
||||
end,
|
||||
}
|
||||
|
||||
M.diff = {
|
||||
"diff",
|
||||
symbols = {
|
||||
added = fmt("Add", ""),
|
||||
modified = fmt("Modified", ""),
|
||||
removed = fmt("Removed", ""),
|
||||
},
|
||||
color = function()
|
||||
local colors = require("tokyonight.colors")
|
||||
return { bg = colors.night.bg }
|
||||
end,
|
||||
}
|
||||
|
||||
M.filetype = { "filetype" }
|
||||
|
||||
M.diagnostics = {
|
||||
"diagnostics",
|
||||
color = function()
|
||||
local colors = require("tokyonight.colors")
|
||||
return { bg = colors.night.bg }
|
||||
end,
|
||||
}
|
||||
|
||||
M.encoding = {
|
||||
"encoding",
|
||||
color = function()
|
||||
local colors = require("tokyonight.colors")
|
||||
return { fg = colors.default.blue, bg = colors.night.bg }
|
||||
end,
|
||||
}
|
||||
|
||||
M.fileformat = {
|
||||
"fileformat",
|
||||
color = function()
|
||||
local colors = require("tokyonight.colors")
|
||||
return { fg = colors.default.blue, bg = colors.night.bg }
|
||||
end,
|
||||
}
|
||||
|
||||
M.indentation = {
|
||||
"indentation",
|
||||
fmt = function()
|
||||
local type = vim.bo[0].expandtab and "spaces" or "tabs"
|
||||
local value = vim.bo[0].shiftwidth
|
||||
return type .. ": " .. value
|
||||
end,
|
||||
color = function()
|
||||
local colors = require("tokyonight.colors")
|
||||
return { fg = colors.default.blue, bg = colors.night.bg }
|
||||
end,
|
||||
}
|
||||
|
||||
M.progress = {
|
||||
"progress",
|
||||
fmt = function(location) return vim.trim(location) end,
|
||||
color = function()
|
||||
local colors = require("tokyonight.colors")
|
||||
return { fg = colors.default.purple, bg = colors.night.bg }
|
||||
end,
|
||||
}
|
||||
|
||||
M.location = {
|
||||
"location",
|
||||
fmt = function(location) return vim.trim(location) end,
|
||||
color = function()
|
||||
local colors = require("tokyonight.colors")
|
||||
return { fg = colors.default.purple, bg = colors.night.bg }
|
||||
end,
|
||||
}
|
||||
|
||||
M.macro = {
|
||||
function() return vim.fn.reg_recording() end,
|
||||
icon = icons.Recording,
|
||||
color = function()
|
||||
local colors = require("tokyonight.colors")
|
||||
return { fg = colors.default.red }
|
||||
end,
|
||||
}
|
||||
|
||||
M.lsp = {
|
||||
function()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local clients = vim.lsp.get_clients({ bufnr = bufnr })
|
||||
if next(clients) == nil then return "" end
|
||||
local attached_clients = vim.tbl_map(function(client) return client.name end, clients)
|
||||
return table.concat(attached_clients, ", ")
|
||||
end,
|
||||
icon = icons.Braces,
|
||||
color = function()
|
||||
local colors = require("tokyonight.colors")
|
||||
return { fg = colors.default.comment, bg = colors.night.bg }
|
||||
end,
|
||||
}
|
||||
|
||||
M.gap = {
|
||||
function() return " " end,
|
||||
color = function()
|
||||
local colors = require("tokyonight.colors")
|
||||
return { bg = colors.night.bg }
|
||||
end,
|
||||
padding = 0,
|
||||
}
|
||||
|
||||
return M
|
||||
63
modules/home-manager/vim/config/lua/utils/configurer.lua
Normal file
63
modules/home-manager/vim/config/lua/utils/configurer.lua
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
local M = {}
|
||||
|
||||
local set_options = function(options)
|
||||
for prop, variables in pairs(options) do
|
||||
for key, value in pairs(variables) do
|
||||
vim[prop][key] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local set_keymaps = function(keymaps)
|
||||
for mode, maps in pairs(keymaps) do
|
||||
for key, map in pairs(maps) do
|
||||
vim.keymap.set(mode, key, map[1], { desc = map[2] })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local set_autocmd = function(autocmd)
|
||||
for _, cmd in ipairs(autocmd) do
|
||||
vim.api.nvim_create_autocmd(cmd.event, cmd.opts)
|
||||
end
|
||||
end
|
||||
|
||||
local set_signs = function(signs)
|
||||
for _, sign in ipairs(signs) do
|
||||
vim.fn.sign_define(sign.name, sign)
|
||||
end
|
||||
end
|
||||
|
||||
local init_lazy = function(spec)
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
local opts = {
|
||||
ui = { border = "rounded" },
|
||||
spec = { import = spec },
|
||||
}
|
||||
|
||||
require("lazy").setup(opts)
|
||||
end
|
||||
|
||||
M.setup = function(opts)
|
||||
set_options(opts.options or {})
|
||||
set_keymaps(opts.keymaps or {})
|
||||
set_autocmd(opts.autocmd or {})
|
||||
set_signs(opts.signs or {})
|
||||
init_lazy(opts.spec)
|
||||
end
|
||||
|
||||
return M
|
||||
128
modules/home-manager/vim/config/lua/utils/functions.lua
Normal file
128
modules/home-manager/vim/config/lua/utils/functions.lua
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
local M = {}
|
||||
|
||||
local input = function(prompt, callback)
|
||||
local value = vim.fn.input(prompt)
|
||||
if value:len() ~= 0 then callback(value) end
|
||||
end
|
||||
|
||||
local select = function(prompt, callback)
|
||||
vim.ui.select({ "tabs", "spaces" }, {
|
||||
prompt = prompt,
|
||||
}, function(choice)
|
||||
if choice then callback(choice) end
|
||||
end)
|
||||
end
|
||||
|
||||
M.set_filetype = function()
|
||||
input("Set filetype: ", function(value)
|
||||
vim.bo[0].filetype = value
|
||||
vim.notify("Filetype set to " .. value)
|
||||
end)
|
||||
end
|
||||
|
||||
M.set_indent = function()
|
||||
input("Set indentation: ", function(value)
|
||||
local type = vim.bo[0].expandtab and "spaces" or "tabs"
|
||||
local parsed = tonumber(value)
|
||||
|
||||
if parsed then
|
||||
vim.bo[0].shiftwidth = parsed
|
||||
vim.notify("Indentation set to " .. value .. " " .. type)
|
||||
else
|
||||
vim.notify("Invalid value", vim.log.levels.ERROR)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
M.set_indent_type = function()
|
||||
select("Indent using: ", function(choice)
|
||||
if choice == "spaces" then
|
||||
vim.o.expandtab = true
|
||||
else
|
||||
vim.o.expandtab = false
|
||||
end
|
||||
|
||||
vim.notify("Indentation using " .. choice)
|
||||
end)
|
||||
end
|
||||
|
||||
M.toggle_wrap = function()
|
||||
vim.wo.wrap = not vim.wo.wrap
|
||||
vim.wo.linebreak = not vim.wo.linebreak
|
||||
end
|
||||
|
||||
M.comment_line = function()
|
||||
require("Comment.api").toggle.linewise.count(vim.v.count > 0 and vim.v.count or 1)
|
||||
end
|
||||
|
||||
M.comment_selection = function()
|
||||
vim.cmd("normal <esc>")
|
||||
require("Comment.api").toggle.linewise(vim.fn.visualmode())
|
||||
end
|
||||
|
||||
M.first_buffer = function() require("bufferline").go_to(1) end
|
||||
M.last_buffer = function() require("bufferline").go_to(-1) end
|
||||
|
||||
M.buf_hsplit = function()
|
||||
require("bufferline.pick").choose_then(function(id)
|
||||
local name = vim.api.nvim_buf_get_name(id)
|
||||
vim.cmd("sp" .. name)
|
||||
vim.cmd("wincmd x")
|
||||
vim.cmd("wincmd w")
|
||||
end)
|
||||
end
|
||||
|
||||
M.buf_vsplit = function()
|
||||
require("bufferline.pick").choose_then(function(id)
|
||||
local name = vim.api.nvim_buf_get_name(id)
|
||||
vim.cmd("vsp" .. name)
|
||||
vim.cmd("wincmd x")
|
||||
vim.cmd("wincmd w")
|
||||
end)
|
||||
end
|
||||
|
||||
M.open_lazygit = function()
|
||||
require("toggleterm.terminal").Terminal
|
||||
:new({
|
||||
cmd = "lazygit",
|
||||
hidden = true,
|
||||
float_opts = {
|
||||
width = 100,
|
||||
height = 25,
|
||||
},
|
||||
on_close = function()
|
||||
if package.loaded["neo-tree"] then require("neo-tree.events").fire_event("git_event") end
|
||||
end,
|
||||
})
|
||||
:open()
|
||||
end
|
||||
|
||||
M.open_glow = function()
|
||||
require("toggleterm.terminal").Terminal
|
||||
:new({
|
||||
cmd = "glow",
|
||||
hidden = true,
|
||||
float_opts = {
|
||||
width = 100,
|
||||
height = 25,
|
||||
},
|
||||
})
|
||||
:open()
|
||||
end
|
||||
|
||||
M.open_dapui = function()
|
||||
require("neo-tree").close_all()
|
||||
require("dapui").open()
|
||||
end
|
||||
|
||||
M.close_dapui = function()
|
||||
require("neo-tree").show()
|
||||
require("dapui").close()
|
||||
end
|
||||
|
||||
M.toggle_dapui = function()
|
||||
vim.cmd("NeoTreeShowToggle")
|
||||
require("dapui").toggle()
|
||||
end
|
||||
|
||||
return M
|
||||
111
modules/home-manager/vim/config/lua/utils/icons.lua
Normal file
111
modules/home-manager/vim/config/lua/utils/icons.lua
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
local M = {}
|
||||
|
||||
M.icons = {
|
||||
Vim = "",
|
||||
Config = "",
|
||||
Normal = "",
|
||||
Insert = "",
|
||||
Terminal = "",
|
||||
Visual = "",
|
||||
Command = "",
|
||||
Save = "",
|
||||
NotSaved = "",
|
||||
Restore = "",
|
||||
Trash = "",
|
||||
Fedora = "",
|
||||
Lua = "",
|
||||
Github = "",
|
||||
Git = "",
|
||||
GitDiff = "",
|
||||
GitBranch = "",
|
||||
GitCommit = "",
|
||||
Add = "",
|
||||
Modified = "",
|
||||
Removed = "",
|
||||
DiffRemoved = "",
|
||||
Error = "",
|
||||
Info = "",
|
||||
Warn = "",
|
||||
Hint = "",
|
||||
Package = "",
|
||||
FileTree = "",
|
||||
Folder = "",
|
||||
EmptyFolder = "",
|
||||
FolderClock = "",
|
||||
FolderOpened = "",
|
||||
File = "",
|
||||
NewFile = "",
|
||||
DefaultFile = "",
|
||||
Color = "",
|
||||
ColorPicker = "",
|
||||
ColorOn = "",
|
||||
ColorOff = "",
|
||||
Swap = "",
|
||||
Minimap = "",
|
||||
Window = "",
|
||||
Windows = "",
|
||||
Ellipsis = "…",
|
||||
Search = "",
|
||||
TextSearch = "",
|
||||
TabSearch = "",
|
||||
FileSearch = "",
|
||||
Clear = "",
|
||||
Braces = "",
|
||||
Exit = "",
|
||||
Debugger = "",
|
||||
Breakpoint = "",
|
||||
History = "",
|
||||
Check = "",
|
||||
SmallDot = "",
|
||||
Dots = "",
|
||||
Install = "",
|
||||
Help = "",
|
||||
Clipboard = "",
|
||||
Indent = "",
|
||||
LineWrap = "",
|
||||
Comment = "",
|
||||
Close = "",
|
||||
Open = "",
|
||||
Toggle = "",
|
||||
Stop = "",
|
||||
Restart = "",
|
||||
CloseMultiple = "",
|
||||
NextBuffer = ",",
|
||||
PrevBuffer = "",
|
||||
FoldClose = "",
|
||||
FoldOpen = "",
|
||||
Popup = "",
|
||||
Vertical = "",
|
||||
Horizontal = "",
|
||||
Markdown = "",
|
||||
Up = "",
|
||||
Down = "",
|
||||
Left = "",
|
||||
Right = "",
|
||||
Variable = "",
|
||||
Symbol = "",
|
||||
Stack = "",
|
||||
Format = "",
|
||||
Edit = "",
|
||||
Fix = "",
|
||||
Run = "",
|
||||
Twilight = "",
|
||||
Recording = "",
|
||||
Notification = "",
|
||||
NotificationDismiss = "",
|
||||
NotificationLog = "",
|
||||
Code = "",
|
||||
DropDown = "",
|
||||
Web = "",
|
||||
Dependencies = "",
|
||||
Update = "",
|
||||
Database = "",
|
||||
Pin = "",
|
||||
Book = "",
|
||||
BookmarkSearch = "",
|
||||
Download = "",
|
||||
}
|
||||
|
||||
M.fmt = function(icon, text, space) return M.icons[icon] .. string.rep(" ", space or 1) .. text end
|
||||
|
||||
return M
|
||||
9
modules/home-manager/vim/config/lua/utils/mappings.lua
Normal file
9
modules/home-manager/vim/config/lua/utils/mappings.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
local M = {}
|
||||
|
||||
M.leader = function(key) return "<leader>" .. key end
|
||||
M.cmd = function(cmd) 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
|
||||
59
modules/home-manager/vim/config/lua/utils/win.lua
Normal file
59
modules/home-manager/vim/config/lua/utils/win.lua
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
local M = {}
|
||||
|
||||
local make_float_config = function(minimal)
|
||||
local ui = vim.api.nvim_list_uis()[1]
|
||||
local width = 80
|
||||
local height = 25
|
||||
local row = (ui.height - height) * 0.4
|
||||
local col = (ui.width - width) * 0.5
|
||||
|
||||
return {
|
||||
col = col,
|
||||
row = row,
|
||||
width = width,
|
||||
height = height,
|
||||
border = "rounded",
|
||||
relative = "editor",
|
||||
style = minimal and "minimal" or nil,
|
||||
zindex = 10,
|
||||
}
|
||||
end
|
||||
|
||||
M.open_help_float = function()
|
||||
local win = vim.api.nvim_get_current_win()
|
||||
local buf = vim.api.nvim_win_get_buf(win)
|
||||
local config = make_float_config(true)
|
||||
|
||||
vim.api.nvim_win_set_config(win, config)
|
||||
vim.api.nvim_create_autocmd("WinClosed", {
|
||||
pattern = tostring(win),
|
||||
callback = function() vim.api.nvim_buf_delete(buf, {}) end,
|
||||
})
|
||||
end
|
||||
|
||||
M.open_lua_win = function()
|
||||
local buf = vim.api.nvim_create_buf(true, false)
|
||||
local config = make_float_config(false)
|
||||
local temp = vim.fn.tempname()
|
||||
local win = vim.api.nvim_open_win(buf, true, config)
|
||||
|
||||
vim.bo[buf].ft = "lua"
|
||||
vim.api.nvim_buf_set_name(buf, temp)
|
||||
vim.cmd("silent w")
|
||||
|
||||
vim.keymap.set("n", "<leader>w", function()
|
||||
vim.cmd("w")
|
||||
vim.cmd("luafile %")
|
||||
vim.lsp.buf.format({ async = true })
|
||||
end, { buffer = buf, remap = true, silent = true })
|
||||
|
||||
vim.api.nvim_create_autocmd("WinClosed", {
|
||||
pattern = tostring(win),
|
||||
callback = function()
|
||||
vim.fn.delete(temp)
|
||||
vim.api.nvim_buf_delete(buf, { force = true })
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
50
modules/home-manager/vim/config/lua/vscode/keymaps.lua
Normal file
50
modules/home-manager/vim/config/lua/vscode/keymaps.lua
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
local map = require("utils.mappings")
|
||||
local l, cmd, rcmd, notify = map.leader, map.cmd, map.rcmd, map.notify
|
||||
|
||||
return {
|
||||
n = {
|
||||
-- utils
|
||||
[l("p")] = { '"+p' },
|
||||
[l("P")] = { '"+P' },
|
||||
[l(":")] = { ":lua " },
|
||||
|
||||
[l("us")] = { cmd("nohlsearch") },
|
||||
[l(";")] = { cmd("VSCodeCommentary") },
|
||||
|
||||
-- vscode actions
|
||||
[l("w")] = { notify("workbench.action.files.save") },
|
||||
[l("e")] = { notify("workbench.view.explorer") },
|
||||
[l("bq")] = { notify("workbench.action.closeActiveEditor") },
|
||||
[l("bn")] = { notify("workbench.action.nextEditorInGroup") },
|
||||
[l("bp")] = { notify("workbench.action.previousEditorInGroup") },
|
||||
[l("um")] = { notify("editor.action.toggleMinimap") },
|
||||
[l("ff")] = { notify("workbench.action.quickOpen") },
|
||||
[l("fs")] = { notify("workbench.action.gotoSymbol") },
|
||||
[l("nn")] = { notify("notifications.clearAll") },
|
||||
[l("nl")] = { notify("notifications.showList") },
|
||||
|
||||
["gr"] = { notify("editor.action.goToReferences") },
|
||||
[l("lr")] = { notify("editor.action.rename") },
|
||||
|
||||
-- move.nvim
|
||||
["<A-j>"] = { cmd("MoveLine(1)") },
|
||||
["<A-k>"] = { cmd("MoveLine(-1)") },
|
||||
["<A-h>"] = { cmd("MoveHChar(-1)") },
|
||||
["<A-l>"] = { cmd("MoveHChar(1)") },
|
||||
},
|
||||
v = {
|
||||
-- utils
|
||||
["q"] = { "<esc>" },
|
||||
[l("y")] = { '"+y' },
|
||||
[l("p")] = { '"+p' },
|
||||
[l("P")] = { '"+P' },
|
||||
|
||||
[l(";")] = { cmd("VSCodeCommentary") },
|
||||
|
||||
-- move.nvim
|
||||
["<A-j>"] = { rcmd("MoveBlock(1)") },
|
||||
["<A-k>"] = { rcmd("MoveBlock(-1)") },
|
||||
["<A-h>"] = { rcmd("MoveHBlock(-1)") },
|
||||
["<A-l>"] = { rcmd("MoveHBlock(1)") },
|
||||
},
|
||||
}
|
||||
5
modules/home-manager/vim/config/lua/vscode/options.lua
Normal file
5
modules/home-manager/vim/config/lua/vscode/options.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
g = {
|
||||
mapleader = " ",
|
||||
},
|
||||
}
|
||||
38
modules/home-manager/vim/config/lua/vscode/plugins.lua
Normal file
38
modules/home-manager/vim/config/lua/vscode/plugins.lua
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
local lua = require("utils.mappings").lua
|
||||
|
||||
return {
|
||||
{
|
||||
"kylechui/nvim-surround",
|
||||
keys = {
|
||||
{ "cs", mode = { "n" } },
|
||||
{ "ds", mode = { "n" } },
|
||||
{ "ys", mode = { "n" } },
|
||||
{ "S", mode = { "v" } },
|
||||
},
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"fedepujol/move.nvim",
|
||||
cmd = {
|
||||
"MoveLine",
|
||||
"MoveHChar",
|
||||
"MoveBlock",
|
||||
"MoveHBlock",
|
||||
},
|
||||
},
|
||||
{
|
||||
"folke/flash.nvim",
|
||||
keys = {
|
||||
{ "f", mode = { "n", "v" } },
|
||||
{ "F", mode = { "n", "v" } },
|
||||
{ "t", mode = { "n", "v" } },
|
||||
{ "T", mode = { "n", "v" } },
|
||||
{ "s", mode = { "n", "v" }, lua('require("flash").jump()') },
|
||||
{ "ß", mode = "n", lua("require('flash').jump({ pattern = vim.fn.expand('<cword>') })") },
|
||||
{ "S", mode = "n", lua("require('flash').treesitter()") },
|
||||
{ "o", mode = "o", lua("require('flash').jump()"), desc = "Search jump" },
|
||||
{ "O", mode = "o", lua("require('flash').treesitter()"), desc = "Tresitter jump" },
|
||||
},
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
|
|
@ -3,7 +3,9 @@
|
|||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
}: let
|
||||
nvimDir = "${config.my.configDir}/modules/home/config/programs/neovim";
|
||||
in {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
package = pkgs.neovim-nightly;
|
||||
|
|
@ -40,43 +42,29 @@
|
|||
xdg.configFile = {
|
||||
# Raw symlink to the plugin manager lock file, so that it stays writeable
|
||||
"nvim/lazy-lock.json".source = config.lib.file.mkOutOfStoreSymlink "${nvimDir}/lazy-lock.json";
|
||||
"nvim/lua/nix/palette.lua".text = "return ${lib.generators.toLua {} palette}";
|
||||
"nvim/lua/nix/tools.lua".text = ''
|
||||
vim.g.sqlite_clib_path = '${pkgs.sqlite.out}/lib/libsqlite3.so'
|
||||
|
||||
return {
|
||||
gcc = '${lib.getExe pkgs.gcc}';
|
||||
}
|
||||
'';
|
||||
"nvim" = {
|
||||
source = ./config;
|
||||
recursive = true;
|
||||
};
|
||||
"${config.my.configDir}/.nixd.json".text = builtins.toJSON {
|
||||
options = {
|
||||
enable = true;
|
||||
target.installable = ".#homeConfigurations.nixd.options";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
home.activation.neovim = lib.home-manager.hm.dag.entryAfter ["linkGeneration"] ''
|
||||
#! /bin/bash
|
||||
NVIM_WRAPPER=~/.nix-profile/bin/nvim
|
||||
STATE_DIR=~/.local/state/nix/
|
||||
STATE_FILE=$STATE_DIR/lazy-lock-checksum
|
||||
LOCK_FILE=~/.config/nvim/lazy-lock.json
|
||||
HASH=$(nix-hash --flat $LOCK_FILE)
|
||||
|
||||
[ ! -d $STATE_DIR ] && mkdir -p $STATE_DIR
|
||||
[ ! -f $STATE_FILE ] && touch $STATE_FILE
|
||||
|
||||
if [ "$(cat $STATE_FILE)" != "$HASH" ]; then
|
||||
echo "Syncing neovim plugins"
|
||||
PATH="$PATH:${pkgs.git}/bin" $DRY_RUN_CMD $NVIM_WRAPPER --headless "+Lazy! restore" +qa
|
||||
$DRY_RUN_CMD echo $HASH >$STATE_FILE
|
||||
else
|
||||
$VERBOSE_ECHO "Neovim plugins already synced, skipping"
|
||||
fi
|
||||
'';
|
||||
# home.activation.neovim = hm.dag.entryAfter ["linkGeneration"] ''
|
||||
# #! /bin/bash
|
||||
# NVIM_WRAPPER=~/.nix-profile/bin/nvim
|
||||
# STATE_DIR=~/.local/state/nix/
|
||||
# STATE_FILE=$STATE_DIR/lazy-lock-checksum
|
||||
# LOCK_FILE=~/.config/nvim/lazy-lock.json
|
||||
# HASH=$(nix-hash --flat $LOCK_FILE)
|
||||
#
|
||||
# [ ! -d $STATE_DIR ] && mkdir -p $STATE_DIR
|
||||
# [ ! -f $STATE_FILE ] && touch $STATE_FILE
|
||||
#
|
||||
# if [ "$(cat $STATE_FILE)" != "$HASH" ]; then
|
||||
# echo "Syncing neovim plugins"
|
||||
# PATH="$PATH:${pkgs.git}/bin" $DRY_RUN_CMD $NVIM_WRAPPER --headless "+Lazy! restore" +qa
|
||||
# $DRY_RUN_CMD echo $HASH >$STATE_FILE
|
||||
# else
|
||||
# $VERBOSE_ECHO "Neovim plugins already synced, skipping"
|
||||
# fi
|
||||
# '';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue