Compare commits
162 Commits
Author | SHA1 | Date | |
---|---|---|---|
7f9cc9490c | |||
31033ddc21 | |||
c7b1bc4648 | |||
56e02498f9 | |||
88a311f59c | |||
0bb35e5e8d | |||
f0a071b71b | |||
3c116413e4 | |||
7a7b38bce3 | |||
b288f0dbc3 | |||
f2cf882a45 | |||
be951efd02 | |||
f01dc6d9f0 | |||
38203fbe76 | |||
18af4a2620 | |||
e4ba67ec8f | |||
b83af9b595 | |||
587c68e0fd | |||
8168c4bf04 | |||
472bfc9bcf | |||
13e4216fb4 | |||
ee8b983777 | |||
a3151f43c8 | |||
4528deddc2 | |||
70dc20bd74 | |||
7b45ac6ae8 | |||
d680871a34 | |||
74f0bcaf2f | |||
c26b298fc1 | |||
edfedf2f2f | |||
a6954a76c8 | |||
75213c2c4e | |||
4ebf5a91aa | |||
96d373a895 | |||
81b14a6b08 | |||
15a7611549 | |||
64b2a61360 | |||
d016fead7f | |||
e4c6d76b72 | |||
9195a341f5 | |||
775a1b54fa | |||
55ac079ff0 | |||
11e76be35f | |||
025e292d68 | |||
0f17d6f466 | |||
abfa098281 | |||
01c830d8ed | |||
6cff9c18aa | |||
7600e16f43 | |||
05a8e3f533 | |||
735f28b62d | |||
dd81949f0a | |||
e8eb13207d | |||
510e05e955 | |||
7a30a27a7d | |||
3ba1bf49cf | |||
a9cbdad4a6 | |||
e0f4b9bb0c | |||
8bf457ecd4 | |||
653083493f | |||
ab64fc60ee | |||
ee88eb7705 | |||
9aced65e10 | |||
a9f3c37f07 | |||
b618428276 | |||
77dfaabaef | |||
c15b1ae88f | |||
d084949ec3 | |||
0b83e97bcb | |||
125233d20f | |||
fe367cf5a1 | |||
c480408d54 | |||
ded6ea0440 | |||
9f3288eaf4 | |||
7f6ebe0c5d | |||
8166db5823 | |||
df3c5508a3 | |||
527884d396 | |||
ad09e704e8 | |||
b60f0c8457 | |||
0191b108ec | |||
b264ee47ef | |||
a14af6d590 | |||
871a816d5c | |||
35e5df4e19 | |||
c1e4554577 | |||
ca4f69f5a5 | |||
e5ae8a2995 | |||
7fdc488e57 | |||
26a4661475 | |||
68e05e29ec | |||
60064aa16d | |||
c581c9ff00 | |||
511ff73dc2 | |||
e3d6c1db6d | |||
a68ce68ec9 | |||
0ef219b200 | |||
67924c654d | |||
e1fdcb1145 | |||
33b64462fd | |||
793d33e952 | |||
839cbd80fe | |||
d5a95342b0 | |||
9dddd1aecd | |||
36261800c0 | |||
4ea16fa3f0 | |||
ab4f565cb5 | |||
00550d0e16 | |||
4b06ebd1d7 | |||
519fb4bfb6 | |||
1dd4feb44d | |||
36f171e562 | |||
bb19d85b65 | |||
e79bc5ab24 | |||
f0bdbb11a3 | |||
73b53d408a | |||
42f8655dbc | |||
7ae4f7eac2 | |||
1429815e27 | |||
07763873c6 | |||
0558e8d786 | |||
07322e2636 | |||
75e56fead9 | |||
eabe6335b3 | |||
2988dc3cb5 | |||
dcf462d26f | |||
b4ed22609a | |||
f02f751efb | |||
abc344eacf | |||
2c22b186c7 | |||
33a2e8aaa1 | |||
2eb9979462 | |||
02d2f4066e | |||
a6e93a6d76 | |||
0cdaba658f | |||
4b212bf384 | |||
12fadfcac6 | |||
fe56acdbe2 | |||
13564f5517 | |||
f6b53b4956 | |||
8af3f6724f | |||
c4a9c95473 | |||
13e1004eb4 | |||
4485d12309 | |||
6402f28de8 | |||
778159492b | |||
88c2022eb6 | |||
83479990d0 | |||
b8a83927ab | |||
3b48153637 | |||
c89e372140 | |||
b680a88e0d | |||
e002342c7f | |||
a71534ee68 | |||
34d17c0db9 | |||
1a645ecd7d | |||
60e3dce6f3 | |||
7d31d71431 | |||
c18ee3cd1b | |||
c0039f4a4c | |||
f4f5351df3 | |||
22ecb7eb3e |
21
init.lua
21
init.lua
@ -1,23 +1,6 @@
|
||||
require("valeth.options")
|
||||
require("valeth.keymaps")
|
||||
|
||||
local function lazy_setup()
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup("valeth.plugins")
|
||||
if vim.version().minor >= 10 then
|
||||
require("valeth.lazy")
|
||||
end
|
||||
|
||||
lazy_setup()
|
||||
|
@ -1,41 +1,42 @@
|
||||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||
"LuaSnip": { "branch": "master", "commit": "ea7d7ea510c641c4f15042becd27f35b3e5b3c2b" },
|
||||
"ayu-nvim": { "branch": "main", "commit": "4418a0c07d45026b05cfd948fd11644d3adb8ac6" },
|
||||
"cloak.nvim": { "branch": "main", "commit": "ff5e746e787de14675396beb642bf5010b8bc96d" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||
"crates.nvim": { "branch": "main", "commit": "1dffccc0a95f656ebe00cacb4de282473430c5a1" },
|
||||
"formatter.nvim": { "branch": "master", "commit": "44c89f09dcc220dc2a9b056e93c3a87c86e79804" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "00e191fea2cfbbdd378243f35b5953296537a116" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "44adf808ace6cb65a3353bd61fa585a2d8fe0db3" },
|
||||
"harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" },
|
||||
"lsp-zero.nvim": { "branch": "v2.x", "commit": "f084f4a6a716f55bf9c4026e73027bb24a0325a3" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "dfdd771b792fbb4bad8e057d72558255695aa1a7" },
|
||||
"mason.nvim": { "branch": "main", "commit": "0942198fb9a998b6ccee36fb8dd7495eb8ba659c" },
|
||||
"neogit": { "branch": "master", "commit": "08d23c7ae1e7c3c66802990d5aa16269bdd996a7" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "ae5b41ce880a6d850055e262d6dfebd362bb276e" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "a27356f1ef9c11e1f459cc96a3fcac5c265e72d6" },
|
||||
"nvim-nu": { "branch": "main", "commit": "f45f36a97fb0ea6e39f08cc2fac7a2fb3dc3999b" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "00741206c2df9c4b538055def19b99790f0c95c8" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "63260da18bf273c76b8e2ea0db84eb901cab49ce" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "31692b26d76ff1f7c6e0ab51814dd55e7417e96c" },
|
||||
"nvim-treesitter-endwise": { "branch": "master", "commit": "9298b3ac8fd6d0d8f9e321194c6d3fd37e417cf9" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "890b94870f052773d77175d07a51f2e083210632" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" },
|
||||
"overseer.nvim": { "branch": "master", "commit": "d8c5be15ff0f7ccecbaa8f3612a6764b22fc07ff" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "0dbe561ae023f02c2fb772b879e905055b939ce3" },
|
||||
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
|
||||
"promise-async": { "branch": "main", "commit": "e94f35161b8c5d4a4ca3b6ff93dd073eb9214c0e" },
|
||||
"rainbow_csv.nvim": { "branch": "main", "commit": "763994066877cebae2d5159a46f8b423c50f82da" },
|
||||
"resession.nvim": { "branch": "master", "commit": "635e83a204b6800ec501a80f867a524a14cfce51" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" },
|
||||
"undotree": { "branch": "main", "commit": "2685ce282702ab0b79c65916f352db2265b245dd" },
|
||||
"vim-wakatime": { "branch": "master", "commit": "0d2efa2daff34b27b0d227d4c3b136811c93db93" }
|
||||
}
|
||||
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
|
||||
"catppuccin": { "branch": "main", "commit": "5b5e3aef9ad7af84f463d17b5479f06b87d5c429" },
|
||||
"cloak.nvim": { "branch": "main", "commit": "648aca6d33ec011dc3166e7af3b38820d01a71e4" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
||||
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
|
||||
"crates.nvim": { "branch": "main", "commit": "fd2bbca7aa588f24ffc3517831934b4c4a9588e9" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
|
||||
"formatter.nvim": { "branch": "master", "commit": "eb89a1f3e079f1b9680bc7293b75fffccb5e1598" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "17ab794b6fce6fce768430ebc925347e349e1d60" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "482ae358c67aec2a4939d68a1a4fe4c8064ccd16" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
|
||||
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
|
||||
"mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" },
|
||||
"neoconf.nvim": { "branch": "main", "commit": "498eed9e00677e4f1a8259db43b0e90f8662f38b" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||
"neogit": { "branch": "master", "commit": "6d1bd94f7fca92a50a892f494920696b5defa8c8" },
|
||||
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
|
||||
"nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "059e89495b3ec09395262f16b1ad441a38081d04" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "cb33dea610b7eff240985be9f6fe219920e630ef" },
|
||||
"nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "523a9e148919f58eb5a013f76787e57696e00c93" },
|
||||
"nvim-treesitter-endwise": { "branch": "master", "commit": "63a8f855c6b6019ef9f7f63b5c59b8a00c215d0d" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "9937e5e356e5b227ec56d83d0a9d0a0f6bc9cad4" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "c15fed422506a130a62e5e79c2d754392231d7d8" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" },
|
||||
"oil.nvim": { "branch": "master", "commit": "302bbaceeafc690e6419e0c8296e804d60cb9446" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
|
||||
"render-markdown.nvim": { "branch": "main", "commit": "0ed141a60ca4befcaf923b21c36f6f2971d61b9e" },
|
||||
"resession.nvim": { "branch": "master", "commit": "fd08e476c4e2f826905c384a3a301a821758764b" },
|
||||
"statuscol.nvim": { "branch": "main", "commit": "c399884e8f64019ec9bb581251f9710915b7f996" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" },
|
||||
"tree-sitter-nu": { "branch": "main", "commit": "d5c71a10b4d1b02e38967b05f8de70e847448dd1" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||
}
|
||||
|
3
lua/.luarc.json
Normal file
3
lua/.luarc.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"workspace.checkThirdParty": false
|
||||
}
|
@ -1,27 +1,44 @@
|
||||
local map = vim.keymap.set
|
||||
local maps = {
|
||||
{ "n", "<Leader><CR>", "<cmd>noh<CR>", { desc = "Clear search highlighting" } },
|
||||
{ "n", "U", "<cmd>redo<CR>", { desc = "Redo the last action" } },
|
||||
{ "n", "Y", "y$", { desc = "Yank until the end of the line" } },
|
||||
{ { "n", "v", "i" }, "<C-s>", "<cmd>w<CR>", { desc = "Write current file" } },
|
||||
{ "n", "s", "<NOP>" },
|
||||
|
||||
map("n", "<Leader><CR>", "<cmd>noh<CR>")
|
||||
map("n", "U", "<cmd>redo<CR>")
|
||||
map("n", "Y", "y$")
|
||||
map("n", "j", "gj")
|
||||
map("n", "k", "gk")
|
||||
-- Yank to clipboard
|
||||
{ { "n", "v" }, "<Leader>y", [["+y]], { desc = "Yank to clipboard" } },
|
||||
{ { "n", "v" }, "<Leader>Y", [["+Y]], { desc = "Yank line to clipboard" } },
|
||||
{ { "n", "v" }, "<Leader>p", [["+p]], { desc = "Paste clipboard after cursor" } },
|
||||
{ { "n", "v" }, "<Leader>P", [["+P]], { desc = "Paste clipboard before cursor" } },
|
||||
|
||||
map({"n", "v"}, "H", "^")
|
||||
map({"n", "v"}, "L", "$")
|
||||
|
||||
map({"n", "v", "i"}, "<C-s>", "<cmd>w<CR>")
|
||||
map("n", "s", "<NOP>")
|
||||
-- Move up and down visual lines for the few times I need wrapping
|
||||
{ "n", "j", "gj" },
|
||||
{ "n", "k", "gk" },
|
||||
|
||||
-- Exit insert mode by quickly pressing jk
|
||||
map("i", "jk", "<ESC>l", { silent = true })
|
||||
{ { "n", "v" }, "H", "0", { desc = "Move to start of line" } },
|
||||
{ { "n", "v" }, "L", "$", { desc = "Move to end of line" } },
|
||||
|
||||
-- This avoids accidentially recording a macro
|
||||
map({"n", "v"}, "<F1>", "q")
|
||||
map({"n", "v"}, "q", "<NOP>")
|
||||
{ "i", "jk", "<ESC>l", { desc = "Exit insert mode", silent = true } },
|
||||
|
||||
-- Move selected lines up or down
|
||||
map("v", "J", ":move '>+1<CR>gv=gv")
|
||||
map("v", "K", ":move '<-2<CR>gv=gv")
|
||||
-- If I need help I'll use the :help command
|
||||
{ { "i" }, "<F1>", "<NOP>" },
|
||||
{ { "n", "i" }, "<D-F1>", "<NOP>" },
|
||||
|
||||
-- Join lines without moving the cursor
|
||||
map("n", "J", "mzJ`z")
|
||||
-- Replace default macro binding
|
||||
{ { "n", "v" }, "<F1>", "q", { desc = "Record a macro" } },
|
||||
{ { "n", "v" }, "q", "<NOP>" },
|
||||
|
||||
-- No manpages, LSP only
|
||||
{ { "n" }, "K", "<NOP>" },
|
||||
|
||||
{ "v", "J", ":move '>+1<CR>gv=gv", { desc = "Move selected lines down" } },
|
||||
{ "v", "K", ":move '<-2<CR>gv=gv", { desc = "Move selected lines up" } },
|
||||
|
||||
{ "n", "J", "mzJ`z", { desc = "Join lines without moving the cursor" } },
|
||||
{ "n", "<C-p>", "mzyyp`zj", { desc = "Duplicate current line" } },
|
||||
}
|
||||
|
||||
for _, m in pairs(maps) do
|
||||
vim.keymap.set(m[1], m[2], m[3], m[4])
|
||||
end
|
||||
|
34
lua/valeth/lazy.lua
Normal file
34
lua/valeth/lazy.lua
Normal file
@ -0,0 +1,34 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
local output = vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"--branch=stable",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
lazypath,
|
||||
})
|
||||
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.notify("Failed to clone lazy.nvim", vim.log.levels.ERROR)
|
||||
vim.notify(output, vim.log.levels.ERROR)
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
vim.notify("Installed lazy.nvim")
|
||||
end
|
||||
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
ui = {
|
||||
border = "rounded",
|
||||
},
|
||||
spec = {
|
||||
{ import = "valeth.plugins.colorschemes" },
|
||||
{ import = "valeth.plugins.core" },
|
||||
{ import = "valeth.plugins.extra" },
|
||||
}
|
||||
})
|
@ -1,3 +1,6 @@
|
||||
local augroup = vim.api.nvim_create_augroup
|
||||
local aucmd = vim.api.nvim_create_autocmd
|
||||
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
@ -10,22 +13,45 @@ vim.opt.incsearch = true
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.scrolloff = 8
|
||||
|
||||
vim.opt.signcolumn = "yes"
|
||||
vim.opt.colorcolumn = "100"
|
||||
vim.opt.foldcolumn = "0"
|
||||
|
||||
vim.opt.foldlevel = 99
|
||||
vim.opt.foldlevelstart = 99
|
||||
vim.opt.foldenable = true
|
||||
|
||||
vim.api.nvim_create_autocmd({"InsertEnter", "InsertLeave", "BufEnter"}, {
|
||||
vim.opt.fillchars:append({ eob = "·" })
|
||||
|
||||
vim.g.mapleader = " "
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
})
|
||||
|
||||
augroup("valeth", { clear = true })
|
||||
|
||||
-- Temporarily highlight yanked text
|
||||
aucmd("TextYankPost", {
|
||||
group = "valeth",
|
||||
callback = function()
|
||||
vim.highlight.on_yank({ timeout = 500 })
|
||||
end
|
||||
})
|
||||
|
||||
-- Hide cursor line while in insert mode
|
||||
aucmd({ "InsertEnter", "InsertLeave", "BufEnter" }, {
|
||||
group = "valeth",
|
||||
callback = function(args)
|
||||
local entered_insert_mode = args.event == "InsertEnter"
|
||||
vim.opt.cursorline = not entered_insert_mode
|
||||
end
|
||||
})
|
||||
|
||||
-- yank to clipboard, requires wl-copy command or equivalent
|
||||
vim.opt.clipboard:append("unnamedplus")
|
||||
|
||||
vim.g.mapleader = " "
|
||||
-- Open help window in a vertical split
|
||||
aucmd("BufWinEnter", {
|
||||
group = "valeth",
|
||||
pattern = "*/doc/*",
|
||||
callback = function()
|
||||
if vim.bo.filetype == "help" then
|
||||
vim.cmd.wincmd("H")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
1
lua/valeth/plugins/.gitignore
vendored
Normal file
1
lua/valeth/plugins/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
tmp-*.lua
|
@ -1,14 +0,0 @@
|
||||
local spec = {
|
||||
"windwp/nvim-autopairs",
|
||||
}
|
||||
|
||||
spec.config = function()
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
local cmp = require("cmp")
|
||||
|
||||
require("nvim-autopairs").setup()
|
||||
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end
|
||||
|
||||
return spec
|
16
lua/valeth/plugins/colorschemes/ayu.lua
Normal file
16
lua/valeth/plugins/colorschemes/ayu.lua
Normal file
@ -0,0 +1,16 @@
|
||||
local spec = {
|
||||
"valeth/ayu-nvim",
|
||||
branch = "fold-column-fg",
|
||||
enabled = false,
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
}
|
||||
|
||||
|
||||
spec.config = function()
|
||||
vim.g.ayu_mirage = true
|
||||
vim.cmd.colorscheme("ayu")
|
||||
end
|
||||
|
||||
|
||||
return spec
|
31
lua/valeth/plugins/colorschemes/catppuccin.lua
Normal file
31
lua/valeth/plugins/colorschemes/catppuccin.lua
Normal file
@ -0,0 +1,31 @@
|
||||
local spec = {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
enabled = true,
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
};
|
||||
|
||||
|
||||
spec.config = function()
|
||||
require("catppuccin").setup({
|
||||
custom_highlights = function(colors)
|
||||
return {
|
||||
Folded = { bg = colors.none },
|
||||
UfoFoldedEllipsis = { fg = colors.blue, bg = colors.none },
|
||||
}
|
||||
end,
|
||||
integrations = {
|
||||
mason = true,
|
||||
noice = true,
|
||||
harpoon = true,
|
||||
lsp_trouble = true,
|
||||
which_key = true,
|
||||
}
|
||||
})
|
||||
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
end
|
||||
|
||||
|
||||
return spec
|
70
lua/valeth/plugins/core/cmp.lua
Normal file
70
lua/valeth/plugins/core/cmp.lua
Normal file
@ -0,0 +1,70 @@
|
||||
local keymap = vim.keymap.set
|
||||
|
||||
local spec = {
|
||||
"hrsh7th/nvim-cmp",
|
||||
}
|
||||
|
||||
spec.dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
"onsails/lspkind.nvim",
|
||||
"L3MON4D3/LuaSnip", -- just here so snippets returned from LSP servers don't throw errors
|
||||
}
|
||||
|
||||
local function autocompletion_enabled()
|
||||
local cmp = require("cmp")
|
||||
local trigger_event = cmp.TriggerEvent.TextChanged
|
||||
return vim.tbl_contains(cmp.get_config().completion.autocomplete or {}, trigger_event)
|
||||
end
|
||||
|
||||
local function toggle_autocompletion()
|
||||
local cmp = require("cmp")
|
||||
if autocompletion_enabled() then
|
||||
cmp.get_config().completion.autocomplete = false
|
||||
else
|
||||
cmp.get_config().completion.autocomplete = { cmp.TriggerEvent.TextChanged }
|
||||
end
|
||||
end
|
||||
|
||||
spec.config = function()
|
||||
local cmp = require("cmp")
|
||||
local lspk = require("lspkind")
|
||||
|
||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||
|
||||
cmp.setup({
|
||||
-- Only trigger completion explicitly through keymapping, or when toggled
|
||||
completion = {
|
||||
autocomplete = false
|
||||
},
|
||||
---@diagnostic disable-next-line:missing-fields
|
||||
formatting = {
|
||||
format = lspk.cmp_format({
|
||||
mode = "symbol_text",
|
||||
})
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered()
|
||||
},
|
||||
mapping = {
|
||||
["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "path" },
|
||||
})
|
||||
})
|
||||
|
||||
keymap("n", "<Leader>cc", toggle_autocompletion, { desc = "Toggle autocompletion" })
|
||||
end
|
||||
|
||||
|
||||
return spec
|
147
lua/valeth/plugins/core/lsp.lua
Normal file
147
lua/valeth/plugins/core/lsp.lua
Normal file
@ -0,0 +1,147 @@
|
||||
local spec = {
|
||||
"neovim/nvim-lspconfig",
|
||||
}
|
||||
|
||||
spec.dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"folke/neodev.nvim",
|
||||
"folke/neoconf.nvim",
|
||||
}
|
||||
|
||||
local function rust_analyzer_setup(lsp_config)
|
||||
local rust_analyzer_settings = {
|
||||
cargo = {
|
||||
features = "all"
|
||||
},
|
||||
checkOnSave = true,
|
||||
}
|
||||
|
||||
if vim.fn.executable("cargo-clippy") == 1 then
|
||||
rust_analyzer_settings.check = { command = "clippy" }
|
||||
end
|
||||
|
||||
-- Don't have rustup available if using nix shell
|
||||
if vim.fn.executable("rustup") == 1 then
|
||||
rust_analyzer_settings = vim.tbl_extend("keep", rust_analyzer_settings, {
|
||||
rustfmt = { extraArgs = { "+nightly" } }
|
||||
})
|
||||
end
|
||||
|
||||
lsp_config.rust_analyzer.setup({
|
||||
settings = {
|
||||
["rust-analyzer"] = rust_analyzer_settings
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local function lua_ls_setup(lsp_config)
|
||||
lsp_config.lua_ls.setup({
|
||||
capabilities = {
|
||||
textDocument = {
|
||||
completion = {
|
||||
completionItem = {
|
||||
snippetSupport = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local function toggle_inlay_hints()
|
||||
-- the docs suggest this, so this should be fine
|
||||
---@diagnostic disable-next-line: missing-parameter
|
||||
local to_enable = not vim.lsp.inlay_hint.is_enabled()
|
||||
vim.lsp.inlay_hint.enable(to_enable)
|
||||
local status = to_enable and "enabled" or "disabled"
|
||||
vim.notify("Inlay hints " .. status, vim.log.levels.INFO)
|
||||
end
|
||||
|
||||
---@param buf buffer
|
||||
---@param mode string | string[]
|
||||
---@param rhs string
|
||||
---@param lhs string | function
|
||||
---@param desc? string
|
||||
local function bufmap(buf, mode, rhs, lhs, desc)
|
||||
local opts = {
|
||||
buffer = buf,
|
||||
remap = false,
|
||||
desc = desc
|
||||
}
|
||||
|
||||
vim.keymap.set(mode, rhs, lhs, opts)
|
||||
end
|
||||
|
||||
spec.config = function()
|
||||
local neoconf = require("neoconf")
|
||||
|
||||
neoconf.setup({
|
||||
import = {
|
||||
vscode = false,
|
||||
coc = false,
|
||||
nlsp = false,
|
||||
}
|
||||
})
|
||||
|
||||
local mason = require("mason")
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
mason.setup({
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"rust_analyzer",
|
||||
}
|
||||
})
|
||||
|
||||
local lsp_config = require("lspconfig")
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
local autogroup = vim.api.nvim_create_augroup
|
||||
|
||||
|
||||
autocmd("LspAttach", {
|
||||
group = autogroup("LspAttachConfig", {}),
|
||||
callback = function(event)
|
||||
local tsb = require("telescope.builtin")
|
||||
local buf = event.buf
|
||||
bufmap(buf, "n", "gd", tsb.lsp_definitions, "Go to definition")
|
||||
bufmap(buf, "n", "gr", tsb.lsp_references, "Go to reference")
|
||||
bufmap(buf, "n", "K", vim.lsp.buf.hover, "Show documentation in hover")
|
||||
bufmap(buf, "n", "<Leader>ca", vim.lsp.buf.code_action, "Run a code action")
|
||||
bufmap(buf, "n", "<Leader>ci", vim.diagnostic.open_float, "Show diagnostics")
|
||||
bufmap(buf, "n", "<Leader>re", vim.lsp.buf.rename, "Rename item under cursor")
|
||||
bufmap(buf, { "n", "i" }, "<C-h>", vim.lsp.buf.signature_help, "Open signature help")
|
||||
bufmap(buf, "n", "<Leader>ch", toggle_inlay_hints, "Toggle LSP inlay hints")
|
||||
end
|
||||
})
|
||||
|
||||
require("neodev").setup()
|
||||
|
||||
lua_ls_setup(lsp_config)
|
||||
|
||||
rust_analyzer_setup(lsp_config)
|
||||
|
||||
lsp_config.sqlls.setup({})
|
||||
|
||||
lsp_config.nil_ls.setup({})
|
||||
|
||||
lsp_config.ruby_lsp.setup({})
|
||||
|
||||
lsp_config.denols.setup({})
|
||||
-- lsp_config.ts_ls.setup({})
|
||||
|
||||
lsp_config.nushell.setup({})
|
||||
end
|
||||
|
||||
return spec
|
25
lua/valeth/plugins/core/neogit.lua
Normal file
25
lua/valeth/plugins/core/neogit.lua
Normal file
@ -0,0 +1,25 @@
|
||||
local spec = {
|
||||
"NeogitOrg/neogit",
|
||||
}
|
||||
|
||||
spec.dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
}
|
||||
|
||||
spec.keys = {
|
||||
{ "<Leader>vs", "<cmd>Neogit<CR>", desc = "Open NeoGit" },
|
||||
{ "<Leader>vc", "<cmd>Neogit commit<CR>", desc = "Open NeoGit commit" },
|
||||
{ "<Leader>vpp", "<cmd>Neogit push<CR>", desc = "Open NeoGit push" },
|
||||
{ "<Leader>vpup", "<cmd>!git push<CR>", desc = "Push local commits to upstream" },
|
||||
}
|
||||
|
||||
spec.opts = {
|
||||
-- handled by statuscol
|
||||
signs = {
|
||||
hunk = { "", "" },
|
||||
item = { "", "" },
|
||||
section = { "", "" },
|
||||
}
|
||||
}
|
||||
|
||||
return spec
|
77
lua/valeth/plugins/core/oil.lua
Normal file
77
lua/valeth/plugins/core/oil.lua
Normal file
@ -0,0 +1,77 @@
|
||||
local function get_directory_name(buf, line)
|
||||
local oil = require("oil")
|
||||
|
||||
local entry = oil.get_entry_on_line(buf, line)
|
||||
if entry == nil then
|
||||
return
|
||||
end
|
||||
|
||||
if entry.type == "directory" then
|
||||
return entry.name .. "/"
|
||||
else
|
||||
local dirname = entry.name:match("^(.*/).*$")
|
||||
if dirname == nil then
|
||||
return
|
||||
end
|
||||
|
||||
return dirname
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function insert_directory(direction)
|
||||
local cur_buf = vim.api.nvim_get_current_buf()
|
||||
local cur_win = vim.api.nvim_get_current_win()
|
||||
local cursor = vim.api.nvim_win_get_cursor(cur_win)
|
||||
|
||||
local dir = get_directory_name(cur_buf, cursor[1])
|
||||
|
||||
if dir == nil then
|
||||
return
|
||||
end
|
||||
|
||||
if direction == "below" then
|
||||
local line = cursor[1]
|
||||
vim.api.nvim_buf_set_lines(cur_buf, line, line, false, { dir })
|
||||
vim.api.nvim_win_set_cursor(cur_win, { line + 1, cursor[2] })
|
||||
else
|
||||
local line = cursor[1] - 1
|
||||
vim.api.nvim_buf_set_lines(cur_buf, line, line, false, { dir })
|
||||
vim.api.nvim_win_set_cursor(cur_win, { cursor[1], cursor[2] })
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local spec = {
|
||||
"stevearc/oil.nvim",
|
||||
}
|
||||
|
||||
spec.dependencies = {
|
||||
"nvim-lua/plenary.nvim"
|
||||
}
|
||||
|
||||
spec.opts = {
|
||||
view_options = {
|
||||
show_hidden = true,
|
||||
},
|
||||
columns = { "icon", "permissions" },
|
||||
keymaps = {
|
||||
["J"] = function()
|
||||
insert_directory("below")
|
||||
end,
|
||||
["K"] = function()
|
||||
insert_directory("above")
|
||||
end,
|
||||
}
|
||||
}
|
||||
|
||||
-- Will not replace netrw if we lazy load sadly
|
||||
spec.lazy = false
|
||||
|
||||
spec.cmd = { "Oil" }
|
||||
|
||||
spec.keys = {
|
||||
{ "<Leader>ft", "<cmd>Oil<CR>", mode = "n", desc = "Open oil file table" }
|
||||
}
|
||||
|
||||
return spec
|
52
lua/valeth/plugins/core/resession.lua
Normal file
52
lua/valeth/plugins/core/resession.lua
Normal file
@ -0,0 +1,52 @@
|
||||
local function started_without_args()
|
||||
return vim.fn.argc(-1) == 0
|
||||
end
|
||||
|
||||
local function session_name()
|
||||
local working_dir = vim.fn.getcwd()
|
||||
local git_branch = vim.fn.systemlist("git branch --show-current")[1]
|
||||
if vim.v.shell_error == 0 then
|
||||
return working_dir .. "-" .. git_branch .. ".git"
|
||||
else
|
||||
return working_dir
|
||||
end
|
||||
end
|
||||
|
||||
local function load_session()
|
||||
if not started_without_args() then
|
||||
return
|
||||
end
|
||||
|
||||
local ok = pcall(require("resession").load, session_name(), { dir = "dirsession", silence_errors = true })
|
||||
|
||||
if not ok then
|
||||
vim.notify("Failed to load session", vim.log.levels.WARN)
|
||||
end
|
||||
end
|
||||
|
||||
local function save_session()
|
||||
if not started_without_args() then
|
||||
return
|
||||
end
|
||||
|
||||
local ok = pcall(require("resession").save, session_name(), { dir = "dirsession", notify = false })
|
||||
|
||||
if not ok then
|
||||
vim.notify("Failed to save session", vim.log.levels.WARN)
|
||||
end
|
||||
end
|
||||
|
||||
local spec = {
|
||||
"stevearc/resession.nvim",
|
||||
}
|
||||
|
||||
spec.config = function()
|
||||
local resession = require("resession")
|
||||
|
||||
vim.api.nvim_create_autocmd("VimEnter", { callback = load_session, })
|
||||
vim.api.nvim_create_autocmd("VimLeavePre", { callback = save_session })
|
||||
|
||||
resession.setup({})
|
||||
end
|
||||
|
||||
return spec
|
92
lua/valeth/plugins/core/telescope.lua
Normal file
92
lua/valeth/plugins/core/telescope.lua
Normal file
@ -0,0 +1,92 @@
|
||||
local spec = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
}
|
||||
|
||||
spec.dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
}
|
||||
|
||||
spec.keys = {
|
||||
{ "<Leader>ff", "<cmd>Telescope find_files<CR>", desc = "Find in files" },
|
||||
{ "<Leader>fb", "<cmd>Telescope buffers<CR>", desc = "Find in buffers" },
|
||||
{ "<Leader>fg", "<cmd>Telescope live_grep<CR>", desc = "Find by grepping" },
|
||||
{ "<Leader>fc", "<cmd>Telescope git_status<CR>", desc = "Find changed files" },
|
||||
}
|
||||
|
||||
-- Not sure where in the state this is stored, so just track it here
|
||||
local find_files_show_hidden = false
|
||||
|
||||
spec.config = function()
|
||||
local telescope = require("telescope")
|
||||
local builtin = require("telescope.builtin")
|
||||
local actions = require("telescope.actions")
|
||||
|
||||
local function get_current_prompt(picker)
|
||||
local win = picker.prompt_win
|
||||
local bufnr = picker.prompt_bufnr
|
||||
local prefix = picker.prompt_prefix
|
||||
local lines = vim.api.nvim_win_get_cursor(win)
|
||||
local line_start = lines[1] - 1
|
||||
local line_end = line_start + 1
|
||||
local buf_line = vim.api.nvim_buf_get_lines(bufnr, line_start, line_end, false)[1]
|
||||
return buf_line:sub(#prefix + 1)
|
||||
end
|
||||
|
||||
local function cycle_picker(bufnr)
|
||||
local state = require("telescope.actions.state")
|
||||
local current_picker = state.get_current_picker(bufnr)
|
||||
local title = current_picker.prompt_title
|
||||
local current_prompt = get_current_prompt(current_picker)
|
||||
|
||||
if title == "Buffers" then
|
||||
builtin.find_files({ default_text = current_prompt })
|
||||
elseif title == "Find Files" then
|
||||
builtin.buffers({ default_text = current_prompt })
|
||||
end
|
||||
end
|
||||
|
||||
-- Very primitive solution, but good enough for now
|
||||
local function toggle_hidden(bufnr)
|
||||
local state = require("telescope.actions.state")
|
||||
local current_picker = state.get_current_picker(bufnr)
|
||||
local current_prompt = get_current_prompt(current_picker)
|
||||
|
||||
find_files_show_hidden = not find_files_show_hidden
|
||||
|
||||
builtin.find_files({ default_text = current_prompt, hidden = find_files_show_hidden })
|
||||
end
|
||||
|
||||
local find_prompt_prefix = "🔍";
|
||||
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
initial_mode = "insert"
|
||||
},
|
||||
pickers = {
|
||||
buffers = {
|
||||
prompt_prefix = find_prompt_prefix,
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-d>"] = actions.delete_buffer + actions.move_to_top,
|
||||
["<C-f>"] = cycle_picker,
|
||||
},
|
||||
n = {
|
||||
["dd"] = actions.delete_buffer,
|
||||
}
|
||||
}
|
||||
},
|
||||
find_files = {
|
||||
prompt_prefix = find_prompt_prefix,
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-f>"] = cycle_picker,
|
||||
["<C-h>"] = toggle_hidden,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
return spec
|
94
lua/valeth/plugins/core/treesitter.lua
Normal file
94
lua/valeth/plugins/core/treesitter.lua
Normal file
@ -0,0 +1,94 @@
|
||||
local spec = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
}
|
||||
|
||||
|
||||
spec.dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
"RRethy/nvim-treesitter-endwise",
|
||||
"nushell/tree-sitter-nu",
|
||||
}
|
||||
|
||||
|
||||
spec.build = ":TSUpdate"
|
||||
|
||||
|
||||
spec.config = function()
|
||||
---@diagnostic disable-next-line:missing-fields
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
-- programming languages
|
||||
"rust",
|
||||
"lua",
|
||||
"ruby",
|
||||
"python",
|
||||
"elixir",
|
||||
"javascript",
|
||||
"typescript",
|
||||
-- markup and config languages
|
||||
"html",
|
||||
"css",
|
||||
"json",
|
||||
"yaml",
|
||||
"toml",
|
||||
"regex",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
-- shell scripting and system configuration
|
||||
"bash",
|
||||
"nu",
|
||||
"nix",
|
||||
},
|
||||
|
||||
sync_install = false,
|
||||
|
||||
auto_install = true,
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
|
||||
endwise = { enable = true },
|
||||
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
["am"] = { query = "@function.outer", desc = "Select outer function" },
|
||||
["im"] = { query = "@function.inner", desc = "Select inner function" },
|
||||
["ab"] = { query = "@block.outer", desc = "Select outer block" },
|
||||
["ib"] = { query = "@block.inner", desc = "Select inner block" },
|
||||
},
|
||||
},
|
||||
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true,
|
||||
goto_next_start = {
|
||||
["]m"] = { query = "@function.outer", desc = "Go to start of next function" },
|
||||
["]b"] = { query = "@block.outer", desc = "Go to start of next block" },
|
||||
["]s"] = { query = "@class.outer", desc = "Go to start of next struct-like" },
|
||||
},
|
||||
goto_next_end = {
|
||||
["]M"] = { query = "@function.outer", desc = "Go to end of next function" },
|
||||
["]B"] = { query = "@block.outer", desc = "Go to end of next block" },
|
||||
["]S"] = { query = "@class.outer", desc = "Go to end of next struct-like" },
|
||||
},
|
||||
goto_previous_start = {
|
||||
["[m"] = { query = "@function.outer", desc = "Go to start of previous function" },
|
||||
["[b"] = { query = "@block.outer", desc = "Go to start of previous block" },
|
||||
["[s"] = { query = "@class.outer", desc = "Go to start of previous struct-like" },
|
||||
},
|
||||
goto_previous_end = {
|
||||
["[M"] = { query = "@function.outer", desc = "Go to end of previous function" },
|
||||
["[B"] = { query = "@block.outer", desc = "Go to end of previous block" },
|
||||
["[S"] = { query = "@class.outer", desc = "Go to end of previous struct-like" },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return spec
|
@ -1,6 +1,6 @@
|
||||
local spec = {
|
||||
"saecki/crates.nvim",
|
||||
tag = "v0.3.0",
|
||||
-- tag = "v0.4.0", -- non-main branches and tags lock up UI
|
||||
}
|
||||
|
||||
spec.dependencies = {
|
||||
@ -9,7 +9,7 @@ spec.dependencies = {
|
||||
}
|
||||
|
||||
spec.config = function()
|
||||
require("crates").setup()
|
||||
require("crates").setup({})
|
||||
|
||||
local cmp = require("cmp")
|
||||
|
4
lua/valeth/plugins/extra/dressing.lua
Normal file
4
lua/valeth/plugins/extra/dressing.lua
Normal file
@ -0,0 +1,4 @@
|
||||
return {
|
||||
"stevearc/dressing.nvim",
|
||||
opts = {},
|
||||
}
|
39
lua/valeth/plugins/extra/formatting.lua
Normal file
39
lua/valeth/plugins/extra/formatting.lua
Normal file
@ -0,0 +1,39 @@
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
local autogroup = vim.api.nvim_create_augroup
|
||||
|
||||
local spec = {
|
||||
"mhartington/formatter.nvim",
|
||||
}
|
||||
|
||||
spec.config = function()
|
||||
local formatter = require("formatter")
|
||||
|
||||
formatter.setup({
|
||||
filetype = {
|
||||
c = {
|
||||
require("formatter.filetypes.c").clangformat
|
||||
},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local function format_file()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local lsp_client = vim.lsp.get_clients({ bufnr = bufnr })
|
||||
|
||||
if #lsp_client ~= 0 then
|
||||
vim.lsp.buf.format({ async = false, timeout_ms = 5000 })
|
||||
else
|
||||
vim.cmd(":FormatWrite")
|
||||
end
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<Leader>fmt", format_file, { desc = "Format the current buffer" })
|
||||
|
||||
-- Format on save
|
||||
autocmd("BufWritePost", {
|
||||
group = autogroup("FormatOnSave", {}),
|
||||
callback = format_file,
|
||||
})
|
||||
|
||||
return spec
|
98
lua/valeth/plugins/extra/harpoon.lua
Normal file
98
lua/valeth/plugins/extra/harpoon.lua
Normal file
@ -0,0 +1,98 @@
|
||||
local spec = {
|
||||
"ThePrimeagen/harpoon",
|
||||
branch = "harpoon2",
|
||||
}
|
||||
|
||||
spec.dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
}
|
||||
|
||||
--- @param harpoon Harpoon
|
||||
local function toggle_telescope(harpoon)
|
||||
local file_paths = {}
|
||||
|
||||
for idx, item in pairs(harpoon:list().items) do
|
||||
table.insert(file_paths, { idx, item.value })
|
||||
end
|
||||
|
||||
local config = require("telescope.config").values
|
||||
local pickers = require("telescope.pickers")
|
||||
local finders = require("telescope.finders")
|
||||
local action_state = require("telescope.actions.state")
|
||||
|
||||
local function mappings(prompt_bufnr, map)
|
||||
map("i", "<C-d>", function()
|
||||
local cur_picker = action_state.get_current_picker(prompt_bufnr)
|
||||
local sel_entry = action_state.get_selected_entry().value[2]
|
||||
local sel_item = harpoon:list():get_by_value(sel_entry)
|
||||
|
||||
if sel_item == nil then
|
||||
return
|
||||
end
|
||||
|
||||
cur_picker:delete_selection(function(sel)
|
||||
harpoon:list():remove(sel_item)
|
||||
end)
|
||||
end)
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
local finder = finders.new_table({
|
||||
results = file_paths,
|
||||
entry_maker = function(entry)
|
||||
return {
|
||||
value = entry,
|
||||
display = entry[1] .. ": " .. entry[2],
|
||||
ordinal = entry[2],
|
||||
path = entry[2],
|
||||
}
|
||||
end
|
||||
})
|
||||
|
||||
local picker = pickers.new({}, {
|
||||
prompt_title = "Harpoon",
|
||||
finder = finder,
|
||||
previewer = config.file_previewer({}),
|
||||
sorter = config.generic_sorter({}),
|
||||
attach_mappings = mappings,
|
||||
})
|
||||
|
||||
picker:find()
|
||||
end
|
||||
|
||||
spec.config = function()
|
||||
local harpoon = require("harpoon")
|
||||
local keymap = vim.keymap.set
|
||||
|
||||
harpoon:setup()
|
||||
|
||||
keymap("n", "<Leader>fh", function()
|
||||
toggle_telescope(harpoon)
|
||||
end, { desc = "Show list of harpoon marks" })
|
||||
|
||||
keymap("n", "<Leader>ha", function()
|
||||
harpoon:list():add()
|
||||
end, { desc = "Add current file to marks" })
|
||||
|
||||
keymap("n", "<Leader>hr", function()
|
||||
harpoon:list():remove()
|
||||
end, { desc = "Remove current file from marks" })
|
||||
|
||||
keymap("n", "<Leader>hn", function()
|
||||
harpoon:list():next()
|
||||
end, { desc = "Go to next mark" })
|
||||
|
||||
keymap("n", "<Leader>hp", function()
|
||||
harpoon:list():prev()
|
||||
end, { desc = "Go to previous mark" })
|
||||
|
||||
for i = 1, 5 do
|
||||
keymap("n", "<Leader>h" .. i, function()
|
||||
harpoon:list():select(i)
|
||||
end, { desc = "Go to marked file " .. i })
|
||||
end
|
||||
end
|
||||
|
||||
return spec
|
13
lua/valeth/plugins/extra/indent-blankline.lua
Normal file
13
lua/valeth/plugins/extra/indent-blankline.lua
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
return {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
main = "ibl",
|
||||
opts = {
|
||||
scope = {
|
||||
show_start = false,
|
||||
}
|
||||
}
|
||||
}
|
@ -1,28 +1,29 @@
|
||||
local spec = {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
}
|
||||
}
|
||||
|
||||
spec.dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"stevearc/overseer.nvim",
|
||||
}
|
||||
|
||||
local function macro_recording()
|
||||
local reg = vim.fn.reg_recording()
|
||||
|
||||
if reg == "" then
|
||||
return ""
|
||||
end
|
||||
|
||||
return "REC @ " .. reg
|
||||
end
|
||||
|
||||
|
||||
spec.config = function()
|
||||
local overseer = require("overseer")
|
||||
|
||||
local task_status = {
|
||||
"overseer",
|
||||
colored = true,
|
||||
symbols = {
|
||||
[overseer.STATUS.FAILURE] = "✗ ",
|
||||
[overseer.STATUS.CANCELED] = "o ",
|
||||
[overseer.STATUS.SUCCESS] = "✓ ",
|
||||
[overseer.STATUS.RUNNING] = "⟳ ",
|
||||
},
|
||||
}
|
||||
|
||||
require("lualine").setup({
|
||||
sections = {
|
||||
lualine_a = {
|
||||
macro_recording,
|
||||
"mode",
|
||||
},
|
||||
lualine_b = {
|
||||
"branch",
|
||||
"diff",
|
||||
@ -32,7 +33,6 @@ spec.config = function()
|
||||
},
|
||||
},
|
||||
lualine_x = {
|
||||
task_status,
|
||||
"encoding",
|
||||
{ "fileformat", icons_enabled = false },
|
||||
"filetype"
|
||||
@ -41,4 +41,5 @@ spec.config = function()
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
return spec
|
36
lua/valeth/plugins/extra/noice.lua
Normal file
36
lua/valeth/plugins/extra/noice.lua
Normal file
@ -0,0 +1,36 @@
|
||||
return {
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
notify = {
|
||||
-- keep this disabled until I find a solution to make it less obnoxious
|
||||
enabled = false
|
||||
},
|
||||
lsp = {
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
command_palette = true,
|
||||
lsp_doc_border = true,
|
||||
},
|
||||
messages = {
|
||||
view = "mini",
|
||||
},
|
||||
views = {
|
||||
notify = {
|
||||
replace = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>nd", "<cmd>NoiceDismiss<CR>", desc = "Dismiss all noice messages" },
|
||||
},
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
"rcarriga/nvim-notify",
|
||||
}
|
||||
}
|
29
lua/valeth/plugins/extra/render-markdown.lua
Normal file
29
lua/valeth/plugins/extra/render-markdown.lua
Normal file
@ -0,0 +1,29 @@
|
||||
local spec = {
|
||||
"MeanderingProgrammer/render-markdown.nvim",
|
||||
}
|
||||
|
||||
spec.dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"echasnovski/mini.icons"
|
||||
}
|
||||
|
||||
spec.config = function()
|
||||
local render_md = require("render-markdown")
|
||||
|
||||
vim.api.nvim_set_hl(0, "RenderMarkdownHdNoBg", { bg = "NONE" })
|
||||
|
||||
render_md.setup({
|
||||
heading = {
|
||||
-- Disable the background for heading lines
|
||||
backgrounds = { "RenderMarkdownHdNoBg" },
|
||||
position = "inline",
|
||||
},
|
||||
|
||||
-- just extra clutter
|
||||
sign = {
|
||||
enabled = false
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return spec
|
58
lua/valeth/plugins/extra/statuscol.lua
Normal file
58
lua/valeth/plugins/extra/statuscol.lua
Normal file
@ -0,0 +1,58 @@
|
||||
local spec = {
|
||||
"luukvbaal/statuscol.nvim",
|
||||
lazy = true,
|
||||
}
|
||||
|
||||
spec.dependencies = {
|
||||
{ "lewis6991/gitsigns.nvim", opts = {} },
|
||||
}
|
||||
|
||||
spec.config = function()
|
||||
local statuscol = require("statuscol")
|
||||
local builtin = require("statuscol.builtin")
|
||||
|
||||
-- Give me fancy diagnostic signs
|
||||
for level, text in pairs({ Error = "✘", Warn = "▲", Info = "»", Hint = "⚑" }) do
|
||||
local name = "DiagnosticSign" .. level
|
||||
vim.fn.sign_define(name, { text = text, texthl = name })
|
||||
end
|
||||
|
||||
vim.opt.signcolumn = "yes"
|
||||
vim.opt.foldcolumn = "1"
|
||||
|
||||
-- This seems to work just fine
|
||||
---@diagnostic disable-next-line:param-type-mismatch
|
||||
vim.opt.fillchars:append({
|
||||
fold = " ",
|
||||
foldopen = "",
|
||||
foldsep = " ",
|
||||
foldclose = "",
|
||||
})
|
||||
|
||||
local function line_numbers(args, fa)
|
||||
if vim.api.nvim_get_mode().mode == "n" then
|
||||
return builtin.lnumfunc(args, fa)
|
||||
else
|
||||
return "%l"
|
||||
end
|
||||
end
|
||||
|
||||
local signs = {
|
||||
text = { "%s" },
|
||||
}
|
||||
local folds = {
|
||||
text = { builtin.foldfunc, " " },
|
||||
condition = { builtin.not_empty },
|
||||
}
|
||||
local numbers = {
|
||||
text = { line_numbers, " " },
|
||||
condition = { true, builtin.not_empty },
|
||||
}
|
||||
|
||||
statuscol.setup({
|
||||
relculright = true,
|
||||
segments = { signs, folds, numbers }
|
||||
})
|
||||
end
|
||||
|
||||
return spec
|
19
lua/valeth/plugins/extra/trouble.lua
Normal file
19
lua/valeth/plugins/extra/trouble.lua
Normal file
@ -0,0 +1,19 @@
|
||||
local spec = {
|
||||
"folke/trouble.nvim",
|
||||
}
|
||||
|
||||
spec.dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
}
|
||||
|
||||
spec.opts = {
|
||||
focus = true
|
||||
}
|
||||
|
||||
spec.cmd = "Trouble"
|
||||
|
||||
spec.keys = {
|
||||
{ "<Leader>ct", "<cmd>Trouble diagnostics toggle<CR>", desc = "Toggle trouble window" },
|
||||
}
|
||||
|
||||
return spec
|
33
lua/valeth/plugins/extra/ufo.lua
Normal file
33
lua/valeth/plugins/extra/ufo.lua
Normal file
@ -0,0 +1,33 @@
|
||||
local spec = {
|
||||
"kevinhwang91/nvim-ufo",
|
||||
}
|
||||
|
||||
spec.dependencies = {
|
||||
"kevinhwang91/promise-async",
|
||||
"luukvbaal/statuscol.nvim",
|
||||
}
|
||||
|
||||
spec.event = "LspAttach"
|
||||
|
||||
spec.config = function()
|
||||
local ufo = require("ufo")
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
local autogroup = vim.api.nvim_create_augroup
|
||||
|
||||
vim.opt.foldenable = true
|
||||
|
||||
autocmd("LspAttach", {
|
||||
group = autogroup("LspUfo", {}),
|
||||
callback = function(event)
|
||||
ufo.attach(event.buf)
|
||||
end
|
||||
})
|
||||
|
||||
ufo.setup({
|
||||
close_fold_kinds_for_ft = {
|
||||
default = { "comment", "imports" },
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return spec
|
15
lua/valeth/plugins/extra/whichkey.lua
Normal file
15
lua/valeth/plugins/extra/whichkey.lua
Normal file
@ -0,0 +1,15 @@
|
||||
local spec = {
|
||||
"folke/which-key.nvim"
|
||||
}
|
||||
|
||||
spec.init = function()
|
||||
vim.opt.timeout = true
|
||||
-- the keybinds help is shown after this timeout
|
||||
vim.opt.timeoutlen = 500
|
||||
end
|
||||
|
||||
spec.opts = {
|
||||
show_help = false
|
||||
}
|
||||
|
||||
return spec
|
@ -1,21 +0,0 @@
|
||||
return {
|
||||
{
|
||||
"CantoroMC/ayu-nvim",
|
||||
priority = 1000, -- make sure this is loaded first
|
||||
config = function()
|
||||
vim.g.ayu_mirage = true
|
||||
vim.cmd.colorscheme("ayu")
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
opts = {
|
||||
space_char_blankline = " ",
|
||||
show_current_context = true,
|
||||
show_current_context_start = false,
|
||||
}
|
||||
},
|
||||
|
||||
"lewis6991/gitsigns.nvim",
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
return {
|
||||
"cameron-wags/rainbow_csv.nvim",
|
||||
"LhKipp/nvim-nu",
|
||||
"stevearc/overseer.nvim",
|
||||
"numToStr/Comment.nvim",
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
local spec = {
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
branch = "v2.x",
|
||||
}
|
||||
|
||||
spec.dependencies = {
|
||||
"neovim/nvim-lspconfig",
|
||||
-- completion
|
||||
"hrsh7th/nvim-cmp",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
"onsails/lspkind.nvim",
|
||||
-- formatting
|
||||
"mhartington/formatter.nvim",
|
||||
-- snippets
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"rafamadriz/friendly-snippets",
|
||||
-- lsp manager
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
-- code folding
|
||||
"kevinhwang91/nvim-ufo",
|
||||
"kevinhwang91/promise-async",
|
||||
}
|
||||
|
||||
spec.config = function()
|
||||
local lsp_zero = require("lsp-zero").preset({})
|
||||
local ufo = require("ufo")
|
||||
local tsb = require("telescope.builtin")
|
||||
|
||||
lsp_zero.ensure_installed {
|
||||
"lua_ls",
|
||||
"rust_analyzer",
|
||||
}
|
||||
|
||||
lsp_zero.on_attach(function(_, buffnr)
|
||||
local opts = { buffer = buffnr, remap = false }
|
||||
|
||||
ufo.attach(buffnr)
|
||||
|
||||
vim.keymap.set("n", "gd", tsb.lsp_definitions, opts)
|
||||
vim.keymap.set("n", "gr", tsb.lsp_references, opts)
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set("n", "<Leader>ca", vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set("n", "<Leader>ci", vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set("n", "<Leader>re", vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set({ "n", "i" }, "<C-h>", vim.lsp.buf.signature_help, opts)
|
||||
|
||||
vim.keymap.set("n", "<Leader>fmt", function()
|
||||
vim.lsp.buf.format({ async = false, timeout_ms = 5000 })
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
-- NOTE: Format on save does not support async formatting
|
||||
lsp_zero.format_on_save({
|
||||
servers = {
|
||||
["rust_analyzer"] = { "rust" }
|
||||
}
|
||||
})
|
||||
|
||||
local lsp_config = require("lspconfig")
|
||||
|
||||
lsp_config.lua_ls.setup(lsp_zero.nvim_lua_ls())
|
||||
|
||||
lsp_config.rust_analyzer.setup {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
cargo = {
|
||||
features = "all"
|
||||
},
|
||||
rustfmt = {
|
||||
-- needs to use nightly channel to use unstable options
|
||||
extraArgs = { "+nightly" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ufo.setup {
|
||||
close_fold_kinds = {"comment", "imports"},
|
||||
}
|
||||
|
||||
lsp_zero.setup()
|
||||
|
||||
local cmp = require("cmp")
|
||||
local lspk = require("lspkind")
|
||||
|
||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||
cmp.setup {
|
||||
formatting = {
|
||||
format = lspk.cmp_format({}),
|
||||
},
|
||||
mapping = {
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<Tab>"] = nil,
|
||||
["<S-Tab>"] = nil,
|
||||
}
|
||||
}
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
})
|
||||
|
||||
-- Gimme pretty icons
|
||||
lsp_zero.set_sign_icons({
|
||||
error = '✘',
|
||||
warn = '▲',
|
||||
hint = '⚑',
|
||||
info = '»'
|
||||
})
|
||||
end
|
||||
|
||||
return spec
|
@ -1,26 +0,0 @@
|
||||
local spec = {
|
||||
"NeogitOrg/neogit",
|
||||
}
|
||||
|
||||
spec.dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
}
|
||||
|
||||
spec.config = function()
|
||||
local neogit = require("neogit")
|
||||
|
||||
local function git_status()
|
||||
neogit.open()
|
||||
end
|
||||
|
||||
local function git_commit()
|
||||
neogit.open({ "commit" })
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<Leader>vs", git_status)
|
||||
vim.keymap.set("n", "<Leader>vc", git_commit)
|
||||
|
||||
neogit.setup()
|
||||
end
|
||||
|
||||
return spec
|
@ -1,41 +0,0 @@
|
||||
local spec = {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
}
|
||||
|
||||
spec.dependencies = {
|
||||
"nvim-tree/nvim-web-devicons"
|
||||
}
|
||||
|
||||
spec.config = function()
|
||||
local nvim_tree = require("nvim-tree")
|
||||
local nvim_tree_api = require("nvim-tree.api")
|
||||
|
||||
vim.keymap.set("n", "<Leader>ft", nvim_tree_api.tree.open)
|
||||
|
||||
local function kmap_opts(bufnr, desc)
|
||||
return {
|
||||
desc = "nvim-tree: " .. desc,
|
||||
buffer = bufnr,
|
||||
noremap = true,
|
||||
silent = true,
|
||||
nowait = true
|
||||
}
|
||||
end
|
||||
|
||||
local function on_attach(bufnr)
|
||||
nvim_tree_api.config.mappings.default_on_attach(bufnr)
|
||||
|
||||
vim.keymap.set("n", "<ESC>", nvim_tree_api.tree.close, kmap_opts(bufnr, "Close"))
|
||||
end
|
||||
|
||||
nvim_tree.setup({
|
||||
view = {
|
||||
float = {
|
||||
enable = true
|
||||
}
|
||||
},
|
||||
on_attach = on_attach,
|
||||
})
|
||||
end
|
||||
|
||||
return spec
|
@ -1,51 +0,0 @@
|
||||
local spec = {
|
||||
"andweeb/presence.nvim",
|
||||
}
|
||||
|
||||
spec.config = function()
|
||||
local presence = require("presence")
|
||||
local presence_disabled = true
|
||||
|
||||
local presence_augroup = vim.api.nvim_create_augroup("PresenceEvents", { clear = true })
|
||||
local presence_autocmds = {
|
||||
{ "FocusGained", "handle_focus_gained" },
|
||||
{ "TextChanged", "handle_text_changed" },
|
||||
{ "VimLeavePre", "handle_vim_leave_pre" },
|
||||
{ "WinEnter", "handle_win_enter" },
|
||||
{ "WinLeave", "handle_win_leave" },
|
||||
{ "BufEnter", "handle_buf_enter" },
|
||||
{ "BufAdd", "handle_buf_add" },
|
||||
}
|
||||
for _, item in ipairs(presence_autocmds) do
|
||||
local event = item[1]
|
||||
local callback_fn = item[2]
|
||||
vim.api.nvim_create_autocmd(event, {
|
||||
group = presence_augroup,
|
||||
callback = function()
|
||||
if not presence_disabled then
|
||||
presence[callback_fn](presence)
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("DiscordToggle",
|
||||
function()
|
||||
if presence_disabled then
|
||||
presence_disabled = false
|
||||
presence:handle_win_enter()
|
||||
else
|
||||
presence_disabled = true
|
||||
presence:cancel()
|
||||
end
|
||||
end,
|
||||
{ nargs = 0 }
|
||||
)
|
||||
|
||||
presence.setup({
|
||||
auto_update = false,
|
||||
show_time = false,
|
||||
})
|
||||
end
|
||||
|
||||
return spec
|
@ -1,42 +0,0 @@
|
||||
local spec = {
|
||||
"stevearc/resession.nvim",
|
||||
}
|
||||
|
||||
spec.config = function()
|
||||
local resession = require("resession")
|
||||
|
||||
local function session_name()
|
||||
local working_dir = vim.fn.getcwd()
|
||||
local git_branch = vim.fn.system("git branch --show-current")
|
||||
if vim.v.shell_error == 0 then
|
||||
return working_dir .. git_branch
|
||||
else
|
||||
return working_dir
|
||||
end
|
||||
end
|
||||
|
||||
local function started_without_args()
|
||||
return vim.fn.argc(-1) == 0
|
||||
end
|
||||
|
||||
-- Only restore and save session if NeoVim was started without any arguments
|
||||
vim.api.nvim_create_autocmd("VimEnter", {
|
||||
callback = function()
|
||||
if started_without_args() then
|
||||
resession.load(session_name(), { dir = "dirsession", silence_errors = true })
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("VimLeavePre", {
|
||||
callback = function()
|
||||
if started_without_args() then
|
||||
resession.save(session_name(), { dir = "dirsession", notify = false })
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
resession.setup()
|
||||
end
|
||||
|
||||
return spec
|
@ -1,52 +0,0 @@
|
||||
local spec = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "0.1.x",
|
||||
}
|
||||
|
||||
spec.dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"ThePrimeagen/harpoon",
|
||||
}
|
||||
|
||||
spec.config = function()
|
||||
local telescope = require("telescope")
|
||||
local actions = require("telescope.actions")
|
||||
|
||||
telescope.load_extension("harpoon")
|
||||
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
initial_mode = "insert"
|
||||
},
|
||||
pickers = {
|
||||
buffers = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-d>"] = actions.delete_buffer + actions.move_to_top,
|
||||
},
|
||||
n = {
|
||||
["dd"] = actions.delete_buffer,
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
local telescope_builtin = require("telescope.builtin")
|
||||
|
||||
vim.keymap.set("n", "<Leader>ff", telescope_builtin.find_files)
|
||||
vim.keymap.set("n", "<Leader>fb", telescope_builtin.buffers)
|
||||
vim.keymap.set("n", "<Leader>fg", telescope_builtin.live_grep)
|
||||
|
||||
local telescope_ext = require("telescope").extensions
|
||||
local harpoon_mark = require("harpoon.mark")
|
||||
local harpoon_ui = require("harpoon.ui")
|
||||
|
||||
vim.keymap.set("n", "<Leader>fh", telescope_ext.harpoon.marks)
|
||||
vim.keymap.set("n", "<Leader>am", harpoon_mark.add_file)
|
||||
vim.keymap.set("n", "<Leader>gn", harpoon_ui.nav_next)
|
||||
vim.keymap.set("n", "<Leader>gp", harpoon_ui.nav_prev)
|
||||
end
|
||||
|
||||
return spec
|
@ -1,30 +0,0 @@
|
||||
local spec = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
tag = "v0.9.1",
|
||||
}
|
||||
|
||||
spec.dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
"RRethy/nvim-treesitter-endwise",
|
||||
}
|
||||
|
||||
spec.config = function()
|
||||
require("nvim-treesitter.configs").setup {
|
||||
ensure_installed = { "rust", "lua", "javascript", "typescript" },
|
||||
|
||||
auto_install = true,
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
|
||||
endwise = { enable = true }
|
||||
}
|
||||
|
||||
require("treesitter-context").setup()
|
||||
|
||||
require("nvim-treesitter.install").update({ with_sync = true })()
|
||||
end
|
||||
|
||||
return spec
|
@ -1,13 +0,0 @@
|
||||
local spec = {
|
||||
"jiaoshijie/undotree",
|
||||
}
|
||||
|
||||
spec.config = function()
|
||||
local undotree = require("undotree")
|
||||
|
||||
vim.keymap.set("n", "<Leader>u", undotree.toggle, { noremap = true, silent = true })
|
||||
|
||||
undotree.setup()
|
||||
end
|
||||
|
||||
return spec
|
@ -1,6 +0,0 @@
|
||||
return {
|
||||
"wakatime/vim-wakatime",
|
||||
cond = function()
|
||||
return not (os.getenv("WAKATIME_HOME") == nil)
|
||||
end
|
||||
}
|
Loading…
Reference in New Issue
Block a user