add formatters and cool stuff
This commit is contained in:
parent
adcd621763
commit
c3ee469ed5
10 changed files with 766 additions and 697 deletions
|
@ -1 +1,2 @@
|
||||||
indent_type = "Spaces"
|
indent_type = "Spaces"
|
||||||
|
indent_width = 2
|
||||||
|
|
|
@ -151,6 +151,12 @@
|
||||||
lua-language-server
|
lua-language-server
|
||||||
nixd
|
nixd
|
||||||
nixfmt-rfc-style
|
nixfmt-rfc-style
|
||||||
|
nodePackages_latest.prettier
|
||||||
|
taplo
|
||||||
|
typstyle
|
||||||
|
rustfmt
|
||||||
|
black
|
||||||
|
stylua
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -226,6 +232,7 @@
|
||||||
diffview-nvim
|
diffview-nvim
|
||||||
barbecue-nvim
|
barbecue-nvim
|
||||||
undotree
|
undotree
|
||||||
|
conform-nvim
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,10 @@ vim.keymap.set("t", "<C-Esc>", "<C-\\><C-n>")
|
||||||
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>mr", function ()
|
vim.keymap.set("n", "<leader>mr", function()
|
||||||
vim.cmd.CellularAutomaton("make_it_rain")
|
vim.cmd.CellularAutomaton("make_it_rain")
|
||||||
end)
|
end)
|
||||||
vim.keymap.set("n", "<leader>bruh", function ()
|
vim.keymap.set("n", "<leader>bruh", function()
|
||||||
vim.cmd.CellularAutomaton("game_of_life")
|
vim.cmd.CellularAutomaton("game_of_life")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -21,21 +21,39 @@ vim.keymap.set("n", "n", "nzzzv")
|
||||||
vim.keymap.set("n", "N", "Nzzzv")
|
vim.keymap.set("n", "N", "Nzzzv")
|
||||||
|
|
||||||
-- The greatest remap of all time -- the primeagen
|
-- The greatest remap of all time -- the primeagen
|
||||||
vim.keymap.set({"n", "v"}, "<leader>d",'"_d', { desc = "same as `d` but send to black hole register"})
|
vim.keymap.set({ "n", "v" }, "<leader>d", '"_d', { desc = "same as `d` but send to black hole register" })
|
||||||
vim.keymap.set({"n", "v"}, "<leader>D",'"_D', { desc = "same as `D` but send to black hole register"})
|
vim.keymap.set({ "n", "v" }, "<leader>D", '"_D', { desc = "same as `D` but send to black hole register" })
|
||||||
-- The real greatest remap(s) of all time -- me
|
-- The real greatest remap(s) of all time -- me
|
||||||
vim.keymap.set({"n", "v"}, "<leader>y",'"+y', { desc = "yank to clipboard"})
|
vim.keymap.set({ "n", "v" }, "<leader>y", '"+y', { desc = "yank to clipboard" })
|
||||||
vim.keymap.set({"n", "v"}, "<leader>Y",'"+Y', { desc = "yank rest of line to clipboard"})
|
vim.keymap.set({ "n", "v" }, "<leader>Y", '"+Y', { desc = "yank rest of line to clipboard" })
|
||||||
vim.keymap.set({"n", "v"}, "<leader>p",'"+p', { desc = "put after cursor from clipboard"})
|
vim.keymap.set({ "n", "v" }, "<leader>p", '"+p', { desc = "put after cursor from clipboard" })
|
||||||
vim.keymap.set({"n", "v"}, "<leader>P",'"+P', { desc = "put before cursor from clipboard"})
|
vim.keymap.set({ "n", "v" }, "<leader>P", '"+P', { desc = "put before cursor from clipboard" })
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>gg", function ()
|
vim.keymap.set("n", "<leader>gg", function()
|
||||||
vim.cmd.Neogit()
|
vim.cmd.Neogit()
|
||||||
end, { desc = "Open neogit" })
|
end, { desc = "Open neogit" })
|
||||||
vim.keymap.set("n", "<leader>gc", function ()
|
vim.keymap.set("n", "<leader>gc", function()
|
||||||
vim.cmd.Neogit("kind=floating commit")
|
vim.cmd.Neogit("kind=floating commit")
|
||||||
end, { desc = "Open neogit commit menu" })
|
end, { desc = "Open neogit commit menu" })
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>u", function ()
|
vim.keymap.set("n", "<leader>u", function()
|
||||||
vim.cmd.UndotreeToggle()
|
vim.cmd.UndotreeToggle()
|
||||||
end, {desc = "Toggle undotree"})
|
end, { desc = "Toggle undotree" })
|
||||||
|
|
||||||
|
vim.keymap.set({ "n", "v" }, "<leader>cf", function()
|
||||||
|
require("conform").format({ async = true })
|
||||||
|
end)
|
||||||
|
vim.keymap.set({ "n", "v" }, "<leader>ctf", function()
|
||||||
|
if vim.g.disable_autoformat then
|
||||||
|
vim.g.disable_autoformat = false
|
||||||
|
else
|
||||||
|
vim.g.disable_autoformat = true
|
||||||
|
end
|
||||||
|
end, { desc = "Disable autoformat on save globally" })
|
||||||
|
vim.keymap.set({ "n", "v" }, "<leader>cbf", function()
|
||||||
|
if vim.b[0].disable_autoformat then
|
||||||
|
vim.b[0].disable_autoformat = false
|
||||||
|
else
|
||||||
|
vim.b[0].disable_autoformat = true
|
||||||
|
end
|
||||||
|
end, { desc = "Disable autoformat on save buffer" })
|
||||||
|
|
|
@ -1,242 +1,242 @@
|
||||||
return {
|
return {
|
||||||
"blink-cmp",
|
"blink-cmp",
|
||||||
event = "BufEnter",
|
event = "BufEnter",
|
||||||
after = function()
|
after = function()
|
||||||
require("blink-cmp").setup({
|
require("blink-cmp").setup({
|
||||||
-- for keymap, all values may be string | string[]
|
-- for keymap, all values may be string | string[]
|
||||||
-- use an empty table to disable a keymap
|
-- use an empty table to disable a keymap
|
||||||
keymap = {
|
keymap = {
|
||||||
show = "<C-space>",
|
show = "<C-space>",
|
||||||
hide = "<C-e>",
|
hide = "<C-e>",
|
||||||
accept = "<Tab>",
|
accept = "<Tab>",
|
||||||
select_prev = { "<Up>", "<C-p>" },
|
select_prev = { "<Up>", "<C-p>" },
|
||||||
select_next = { "<Down>", "<C-n>" },
|
select_next = { "<Down>", "<C-n>" },
|
||||||
|
|
||||||
show_documentation = {},
|
show_documentation = {},
|
||||||
hide_documentation = {},
|
hide_documentation = {},
|
||||||
scroll_documentation_up = "<C-b>",
|
scroll_documentation_up = "<C-b>",
|
||||||
scroll_documentation_down = "<C-f>",
|
scroll_documentation_down = "<C-f>",
|
||||||
|
|
||||||
snippet_forward = "<Tab>",
|
snippet_forward = "<Tab>",
|
||||||
snippet_backward = "<S-Tab>",
|
snippet_backward = "<S-Tab>",
|
||||||
|
},
|
||||||
|
|
||||||
|
accept = {
|
||||||
|
create_undo_point = true,
|
||||||
|
auto_brackets = {
|
||||||
|
enabled = false,
|
||||||
|
default_brackets = { "(", ")" },
|
||||||
|
override_brackets_for_filetypes = {},
|
||||||
|
-- Overrides the default blocked filetypes
|
||||||
|
force_allow_filetypes = {},
|
||||||
|
blocked_filetypes = {},
|
||||||
|
-- Synchronously use the kind of the item to determine if brackets should be added
|
||||||
|
kind_resolution = {
|
||||||
|
enabled = true,
|
||||||
|
blocked_filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact", "vue" },
|
||||||
|
},
|
||||||
|
-- Asynchronously use semantic token to determine if brackets should be added
|
||||||
|
semantic_token_resolution = {
|
||||||
|
enabled = true,
|
||||||
|
blocked_filetypes = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
trigger = {
|
||||||
|
completion = {
|
||||||
|
-- regex used to get the text when fuzzy matching
|
||||||
|
-- changing this may break some sources, so please report if you run into issues
|
||||||
|
-- todo: shouldnt this also affect the accept command? should this also be per language?
|
||||||
|
keyword_regex = "[%w_\\-]",
|
||||||
|
-- LSPs can indicate when to show the completion window via trigger characters
|
||||||
|
-- however, some LSPs (*cough* tsserver *cough*) return characters that would essentially
|
||||||
|
-- always show the window. We block these by default
|
||||||
|
blocked_trigger_characters = { " ", "\n", "\t" },
|
||||||
|
-- when true, will show the completion window when the cursor comes after a trigger character when entering insert mode
|
||||||
|
show_on_insert_on_trigger_character = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
signature_help = {
|
||||||
|
enabled = false,
|
||||||
|
blocked_trigger_characters = {},
|
||||||
|
blocked_retrigger_characters = {},
|
||||||
|
-- when true, will show the signature help window when the cursor comes after a trigger character when entering insert mode
|
||||||
|
show_on_insert_on_trigger_character = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
fuzzy = {
|
||||||
|
-- frencency tracks the most recently/frequently used items and boosts the score of the item
|
||||||
|
use_frecency = true,
|
||||||
|
-- proximity bonus boosts the score of items with a value in the buffer
|
||||||
|
use_proximity = true,
|
||||||
|
max_items = 200,
|
||||||
|
-- controls which sorts to use and in which order, these three are currently the only allowed options
|
||||||
|
sorts = { "label", "kind", "score" },
|
||||||
|
|
||||||
|
prebuiltBinaries = {
|
||||||
|
-- Whether or not to automatically download a prebuilt binary from github. If this is set to `false`
|
||||||
|
-- you will need to manually build the fuzzy binary dependencies by running `cargo build --release`
|
||||||
|
download = false,
|
||||||
|
-- When downloading a prebuilt binary force the downloader to resolve this version. If this is uset
|
||||||
|
-- then the downloader will attempt to infer the version from the checked out git tag (if any).
|
||||||
|
--
|
||||||
|
-- Beware that if the FFI ABI changes while tracking main then this may result in blink breaking.
|
||||||
|
forceVersion = nil,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
sources = {
|
||||||
|
-- similar to nvim-cmp's sources, but we point directly to the source's lua module
|
||||||
|
-- multiple groups can be provided, where it'll fallback to the next group if the previous
|
||||||
|
-- returns no completion items
|
||||||
|
-- WARN: This API will have breaking changes during the beta
|
||||||
|
providers = {
|
||||||
|
{
|
||||||
|
{ "blink.cmp.sources.lsp" },
|
||||||
|
{ "blink.cmp.sources.path" },
|
||||||
|
{ "blink.cmp.sources.snippets", score_offset = -3 },
|
||||||
|
},
|
||||||
|
{ { "blink.cmp.sources.buffer" } },
|
||||||
|
},
|
||||||
|
-- FOR REF: full example
|
||||||
|
providers = {
|
||||||
|
{
|
||||||
|
-- all of these properties work on every source
|
||||||
|
{
|
||||||
|
"blink.cmp.sources.lsp",
|
||||||
|
keyword_length = 0,
|
||||||
|
score_offset = 0,
|
||||||
|
trigger_characters = { "f", "o", "o" },
|
||||||
|
opts = {},
|
||||||
},
|
},
|
||||||
|
-- the follow two sources have additional options
|
||||||
accept = {
|
{
|
||||||
create_undo_point = true,
|
"blink.cmp.sources.path",
|
||||||
auto_brackets = {
|
opts = {
|
||||||
enabled = false,
|
trailing_slash = false,
|
||||||
default_brackets = { "(", ")" },
|
label_trailing_slash = true,
|
||||||
override_brackets_for_filetypes = {},
|
get_cwd = function(context)
|
||||||
-- Overrides the default blocked filetypes
|
return vim.fn.expand(("#%d:p:h"):format(context.bufnr))
|
||||||
force_allow_filetypes = {},
|
end,
|
||||||
blocked_filetypes = {},
|
show_hidden_files_by_default = true,
|
||||||
-- Synchronously use the kind of the item to determine if brackets should be added
|
},
|
||||||
kind_resolution = {
|
|
||||||
enabled = true,
|
|
||||||
blocked_filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact", "vue" },
|
|
||||||
},
|
|
||||||
-- Asynchronously use semantic token to determine if brackets should be added
|
|
||||||
semantic_token_resolution = {
|
|
||||||
enabled = true,
|
|
||||||
blocked_filetypes = {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
{
|
||||||
trigger = {
|
"blink.cmp.sources.snippets",
|
||||||
completion = {
|
score_offset = -3,
|
||||||
-- regex used to get the text when fuzzy matching
|
-- similar to https://github.com/garymjr/nvim-snippets
|
||||||
-- changing this may break some sources, so please report if you run into issues
|
opts = {
|
||||||
-- todo: shouldnt this also affect the accept command? should this also be per language?
|
friendly_snippets = true,
|
||||||
keyword_regex = "[%w_\\-]",
|
search_paths = { vim.fn.stdpath("config") .. "/snippets" },
|
||||||
-- LSPs can indicate when to show the completion window via trigger characters
|
global_snippets = { "all" },
|
||||||
-- however, some LSPs (*cough* tsserver *cough*) return characters that would essentially
|
extended_filetypes = {},
|
||||||
-- always show the window. We block these by default
|
ignored_filetypes = {},
|
||||||
blocked_trigger_characters = { " ", "\n", "\t" },
|
},
|
||||||
-- when true, will show the completion window when the cursor comes after a trigger character when entering insert mode
|
|
||||||
show_on_insert_on_trigger_character = true,
|
|
||||||
},
|
|
||||||
|
|
||||||
signature_help = {
|
|
||||||
enabled = false,
|
|
||||||
blocked_trigger_characters = {},
|
|
||||||
blocked_retrigger_characters = {},
|
|
||||||
-- when true, will show the signature help window when the cursor comes after a trigger character when entering insert mode
|
|
||||||
show_on_insert_on_trigger_character = true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
{ { "blink.cmp.sources.buffer" } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
fuzzy = {
|
windows = {
|
||||||
-- frencency tracks the most recently/frequently used items and boosts the score of the item
|
autocomplete = {
|
||||||
use_frecency = true,
|
min_width = 30,
|
||||||
-- proximity bonus boosts the score of items with a value in the buffer
|
max_width = 60,
|
||||||
use_proximity = true,
|
max_height = 10,
|
||||||
max_items = 200,
|
border = "none",
|
||||||
-- controls which sorts to use and in which order, these three are currently the only allowed options
|
winhighlight = "Normal:BlinkCmpMenu,FloatBorder:BlinkCmpMenuBorder,CursorLine:BlinkCmpMenuSelection,Search:None",
|
||||||
sorts = { "label", "kind", "score" },
|
-- keep the cursor X lines away from the top/bottom of the window
|
||||||
|
scrolloff = 2,
|
||||||
|
-- which directions to show the window,
|
||||||
|
-- falling back to the next direction when there's not enough space
|
||||||
|
direction_priority = { "s", "n" },
|
||||||
|
-- whether to preselect the first item in the completion list
|
||||||
|
preselect = true,
|
||||||
|
-- Controls how the completion items are rendered on the popup window
|
||||||
|
-- 'simple' will render the item's kind icon the left alongside the label
|
||||||
|
-- 'reversed' will render the label on the left and the kind icon + name on the right
|
||||||
|
-- 'function(blink.cmp.CompletionRenderContext): blink.cmp.Component[]' for custom rendering
|
||||||
|
draw = "simple",
|
||||||
|
-- Controls the cycling behavior when reaching the beginning or end of the completion list.
|
||||||
|
cycle = {
|
||||||
|
-- When `true`, calling `select_next` at the *bottom* of the completion list will select the *first* completion item.
|
||||||
|
from_bottom = true,
|
||||||
|
-- When `true`, calling `select_prev` at the *top* of the completion list will select the *last* completion item.
|
||||||
|
from_top = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
documentation = {
|
||||||
|
min_width = 10,
|
||||||
|
max_width = 60,
|
||||||
|
max_height = 20,
|
||||||
|
border = "padded",
|
||||||
|
winhighlight = "Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,CursorLine:BlinkCmpDocCursorLine,Search:None",
|
||||||
|
-- which directions to show the documentation window,
|
||||||
|
-- for each of the possible autocomplete window directions,
|
||||||
|
-- falling back to the next direction when there's not enough space
|
||||||
|
direction_priority = {
|
||||||
|
autocomplete_north = { "e", "w", "n", "s" },
|
||||||
|
autocomplete_south = { "e", "w", "s", "n" },
|
||||||
|
},
|
||||||
|
auto_show = true,
|
||||||
|
auto_show_delay_ms = 500,
|
||||||
|
update_delay_ms = 100,
|
||||||
|
},
|
||||||
|
signature_help = {
|
||||||
|
min_width = 1,
|
||||||
|
max_width = 100,
|
||||||
|
max_height = 10,
|
||||||
|
border = "padded",
|
||||||
|
winhighlight = "Normal:BlinkCmpSignatureHelp,FloatBorder:BlinkCmpSignatureHelpBorder",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
prebuiltBinaries = {
|
highlight = {
|
||||||
-- Whether or not to automatically download a prebuilt binary from github. If this is set to `false`
|
ns = vim.api.nvim_create_namespace("blink_cmp"),
|
||||||
-- you will need to manually build the fuzzy binary dependencies by running `cargo build --release`
|
-- sets the fallback highlight groups to nvim-cmp's highlight groups
|
||||||
download = true,
|
-- useful for when your theme doesn't support blink.cmp
|
||||||
-- When downloading a prebuilt binary force the downloader to resolve this version. If this is uset
|
-- will be removed in a future release, assuming themes add support
|
||||||
-- then the downloader will attempt to infer the version from the checked out git tag (if any).
|
use_nvim_cmp_as_default = false,
|
||||||
--
|
},
|
||||||
-- Beware that if the FFI ABI changes while tracking main then this may result in blink breaking.
|
|
||||||
forceVersion = nil,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
sources = {
|
-- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||||
-- similar to nvim-cmp's sources, but we point directly to the source's lua module
|
-- adjusts spacing to ensure icons are aligned
|
||||||
-- multiple groups can be provided, where it'll fallback to the next group if the previous
|
nerd_font_variant = "normal",
|
||||||
-- returns no completion items
|
|
||||||
-- WARN: This API will have breaking changes during the beta
|
|
||||||
providers = {
|
|
||||||
{
|
|
||||||
{ "blink.cmp.sources.lsp" },
|
|
||||||
{ "blink.cmp.sources.path" },
|
|
||||||
{ "blink.cmp.sources.snippets", score_offset = -3 },
|
|
||||||
},
|
|
||||||
{ { "blink.cmp.sources.buffer" } },
|
|
||||||
},
|
|
||||||
-- FOR REF: full example
|
|
||||||
providers = {
|
|
||||||
{
|
|
||||||
-- all of these properties work on every source
|
|
||||||
{
|
|
||||||
"blink.cmp.sources.lsp",
|
|
||||||
keyword_length = 0,
|
|
||||||
score_offset = 0,
|
|
||||||
trigger_characters = { "f", "o", "o" },
|
|
||||||
opts = {},
|
|
||||||
},
|
|
||||||
-- the follow two sources have additional options
|
|
||||||
{
|
|
||||||
"blink.cmp.sources.path",
|
|
||||||
opts = {
|
|
||||||
trailing_slash = false,
|
|
||||||
label_trailing_slash = true,
|
|
||||||
get_cwd = function(context)
|
|
||||||
return vim.fn.expand(("#%d:p:h"):format(context.bufnr))
|
|
||||||
end,
|
|
||||||
show_hidden_files_by_default = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"blink.cmp.sources.snippets",
|
|
||||||
score_offset = -3,
|
|
||||||
-- similar to https://github.com/garymjr/nvim-snippets
|
|
||||||
opts = {
|
|
||||||
friendly_snippets = true,
|
|
||||||
search_paths = { vim.fn.stdpath("config") .. "/snippets" },
|
|
||||||
global_snippets = { "all" },
|
|
||||||
extended_filetypes = {},
|
|
||||||
ignored_filetypes = {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ { "blink.cmp.sources.buffer" } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
windows = {
|
kind_icons = {
|
||||||
autocomplete = {
|
Text = "",
|
||||||
min_width = 30,
|
Method = "",
|
||||||
max_width = 60,
|
Function = "",
|
||||||
max_height = 10,
|
Constructor = "",
|
||||||
border = "none",
|
|
||||||
winhighlight = "Normal:BlinkCmpMenu,FloatBorder:BlinkCmpMenuBorder,CursorLine:BlinkCmpMenuSelection,Search:None",
|
|
||||||
-- keep the cursor X lines away from the top/bottom of the window
|
|
||||||
scrolloff = 2,
|
|
||||||
-- which directions to show the window,
|
|
||||||
-- falling back to the next direction when there's not enough space
|
|
||||||
direction_priority = { "s", "n" },
|
|
||||||
-- whether to preselect the first item in the completion list
|
|
||||||
preselect = true,
|
|
||||||
-- Controls how the completion items are rendered on the popup window
|
|
||||||
-- 'simple' will render the item's kind icon the left alongside the label
|
|
||||||
-- 'reversed' will render the label on the left and the kind icon + name on the right
|
|
||||||
-- 'function(blink.cmp.CompletionRenderContext): blink.cmp.Component[]' for custom rendering
|
|
||||||
draw = "simple",
|
|
||||||
-- Controls the cycling behavior when reaching the beginning or end of the completion list.
|
|
||||||
cycle = {
|
|
||||||
-- When `true`, calling `select_next` at the *bottom* of the completion list will select the *first* completion item.
|
|
||||||
from_bottom = true,
|
|
||||||
-- When `true`, calling `select_prev` at the *top* of the completion list will select the *last* completion item.
|
|
||||||
from_top = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
documentation = {
|
|
||||||
min_width = 10,
|
|
||||||
max_width = 60,
|
|
||||||
max_height = 20,
|
|
||||||
border = "padded",
|
|
||||||
winhighlight = "Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,CursorLine:BlinkCmpDocCursorLine,Search:None",
|
|
||||||
-- which directions to show the documentation window,
|
|
||||||
-- for each of the possible autocomplete window directions,
|
|
||||||
-- falling back to the next direction when there's not enough space
|
|
||||||
direction_priority = {
|
|
||||||
autocomplete_north = { "e", "w", "n", "s" },
|
|
||||||
autocomplete_south = { "e", "w", "s", "n" },
|
|
||||||
},
|
|
||||||
auto_show = true,
|
|
||||||
auto_show_delay_ms = 500,
|
|
||||||
update_delay_ms = 100,
|
|
||||||
},
|
|
||||||
signature_help = {
|
|
||||||
min_width = 1,
|
|
||||||
max_width = 100,
|
|
||||||
max_height = 10,
|
|
||||||
border = "padded",
|
|
||||||
winhighlight = "Normal:BlinkCmpSignatureHelp,FloatBorder:BlinkCmpSignatureHelpBorder",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
highlight = {
|
Field = "",
|
||||||
ns = vim.api.nvim_create_namespace("blink_cmp"),
|
Variable = "",
|
||||||
-- sets the fallback highlight groups to nvim-cmp's highlight groups
|
Property = "",
|
||||||
-- useful for when your theme doesn't support blink.cmp
|
|
||||||
-- will be removed in a future release, assuming themes add support
|
|
||||||
use_nvim_cmp_as_default = false,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
Class = "",
|
||||||
-- adjusts spacing to ensure icons are aligned
|
Interface = "",
|
||||||
nerd_font_variant = "normal",
|
Struct = "",
|
||||||
|
Module = "",
|
||||||
|
|
||||||
kind_icons = {
|
Unit = "",
|
||||||
Text = "",
|
Value = "",
|
||||||
Method = "",
|
Enum = "",
|
||||||
Function = "",
|
EnumMember = "",
|
||||||
Constructor = "",
|
|
||||||
|
|
||||||
Field = "",
|
Keyword = "",
|
||||||
Variable = "",
|
Constant = "",
|
||||||
Property = "",
|
|
||||||
|
|
||||||
Class = "",
|
Snippet = "",
|
||||||
Interface = "",
|
Color = "",
|
||||||
Struct = "",
|
File = "",
|
||||||
Module = "",
|
Reference = "",
|
||||||
|
Folder = "",
|
||||||
Unit = "",
|
Event = "",
|
||||||
Value = "",
|
Operator = "",
|
||||||
Enum = "",
|
TypeParameter = "",
|
||||||
EnumMember = "",
|
},
|
||||||
|
})
|
||||||
Keyword = "",
|
end,
|
||||||
Constant = "",
|
|
||||||
|
|
||||||
Snippet = "",
|
|
||||||
Color = "",
|
|
||||||
File = "",
|
|
||||||
Reference = "",
|
|
||||||
Folder = "",
|
|
||||||
Event = "",
|
|
||||||
Operator = "",
|
|
||||||
TypeParameter = "",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
}
|
||||||
|
|
34
lua/plugins/conform.lua
Normal file
34
lua/plugins/conform.lua
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
return {
|
||||||
|
"conform.nvim",
|
||||||
|
event = "BufWritePre",
|
||||||
|
cmd = "ConformInfo",
|
||||||
|
after = function()
|
||||||
|
require("conform").setup({
|
||||||
|
format_on_save = function(bufnr)
|
||||||
|
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
return { timeout_ms = 500, lsp_fallback = true }
|
||||||
|
end,
|
||||||
|
default_format_opts = {
|
||||||
|
lsp_format = "fallback",
|
||||||
|
},
|
||||||
|
formatters_by_ft = {
|
||||||
|
lua = { "stylua" },
|
||||||
|
python = { "black" },
|
||||||
|
rust = { "rustfmt" },
|
||||||
|
javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
typescript = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
nix = { "nixfmt" },
|
||||||
|
haskell = { "fourmolu", "ormolu", stop_after_first = true },
|
||||||
|
json = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
toml = { "taplo", stop_after_first = true },
|
||||||
|
yaml = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
typst = { "typstyle" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
|
||||||
|
end,
|
||||||
|
}
|
|
@ -1,45 +1,45 @@
|
||||||
return {
|
return {
|
||||||
"harpoon2",
|
"harpoon2",
|
||||||
after = function()
|
after = function()
|
||||||
local harpoon = require("harpoon")
|
local harpoon = require("harpoon")
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>a", function()
|
vim.keymap.set("n", "<leader>a", function()
|
||||||
harpoon:list():add()
|
harpoon:list():add()
|
||||||
end)
|
end)
|
||||||
vim.keymap.set("n", "<C-h><C-a>", function()
|
vim.keymap.set("n", "<C-h><C-a>", function()
|
||||||
harpoon:list():select(1)
|
harpoon:list():select(1)
|
||||||
end)
|
end)
|
||||||
vim.keymap.set("n", "<C-h><C-s>", function()
|
vim.keymap.set("n", "<C-h><C-s>", function()
|
||||||
harpoon:list():select(2)
|
harpoon:list():select(2)
|
||||||
end)
|
end)
|
||||||
vim.keymap.set("n", "<C-h><C-d>", function()
|
vim.keymap.set("n", "<C-h><C-d>", function()
|
||||||
harpoon:list():select(3)
|
harpoon:list():select(3)
|
||||||
end)
|
end)
|
||||||
vim.keymap.set("n", "<C-h><C-f>", function()
|
vim.keymap.set("n", "<C-h><C-f>", function()
|
||||||
harpoon:list():select(4)
|
harpoon:list():select(4)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local conf = require("telescope.config").values
|
local conf = require("telescope.config").values
|
||||||
local function toggle_telescope(harpoon_files)
|
local function toggle_telescope(harpoon_files)
|
||||||
local file_paths = {}
|
local file_paths = {}
|
||||||
for _, item in ipairs(harpoon_files.items) do
|
for _, item in ipairs(harpoon_files.items) do
|
||||||
table.insert(file_paths, item.value)
|
table.insert(file_paths, item.value)
|
||||||
end
|
end
|
||||||
|
|
||||||
require("telescope.pickers")
|
require("telescope.pickers")
|
||||||
.new({}, {
|
.new({}, {
|
||||||
prompt_title = "Harpoon",
|
prompt_title = "Harpoon",
|
||||||
finder = require("telescope.finders").new_table({
|
finder = require("telescope.finders").new_table({
|
||||||
results = file_paths,
|
results = file_paths,
|
||||||
}),
|
}),
|
||||||
previewer = conf.file_previewer({}),
|
previewer = conf.file_previewer({}),
|
||||||
sorter = conf.generic_sorter({}),
|
sorter = conf.generic_sorter({}),
|
||||||
})
|
})
|
||||||
:find()
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.keymap.set("n", "<C-h><C-h>", function()
|
vim.keymap.set("n", "<C-h><C-h>", function()
|
||||||
toggle_telescope(harpoon:list())
|
toggle_telescope(harpoon:list())
|
||||||
end, { desc = "Open harpoon window" })
|
end, { desc = "Open harpoon window" })
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,58 +1,57 @@
|
||||||
return {
|
return {
|
||||||
"lualine.nvim",
|
"lualine.nvim",
|
||||||
event = "BufEnter",
|
event = "BufEnter",
|
||||||
after = function()
|
after = function()
|
||||||
require("lualine").setup({
|
require("lualine").setup({
|
||||||
options = {
|
options = {
|
||||||
icons_enabled = true,
|
icons_enabled = true,
|
||||||
theme = "auto",
|
theme = "auto",
|
||||||
component_separators = { left = "", right = "" },
|
component_separators = { left = "", right = "" },
|
||||||
section_separators = { left = "", right = "" },
|
section_separators = { left = "", right = "" },
|
||||||
disabled_filetypes = {
|
disabled_filetypes = {
|
||||||
statusline = { "ministarter" },
|
statusline = { "ministarter" },
|
||||||
winbar = {},
|
winbar = {},
|
||||||
},
|
},
|
||||||
ignore_focus = {},
|
ignore_focus = {},
|
||||||
always_divide_middle = true,
|
always_divide_middle = true,
|
||||||
globalstatus = true,
|
globalstatus = true,
|
||||||
refresh = {
|
refresh = {
|
||||||
statusline = 1000,
|
statusline = 1000,
|
||||||
tabline = 1000,
|
tabline = 1000,
|
||||||
winbar = 1000,
|
winbar = 1000,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
sections = {
|
sections = {
|
||||||
lualine_a = { "branch" },
|
lualine_a = { "branch" },
|
||||||
lualine_b = {
|
lualine_b = {
|
||||||
function()
|
function()
|
||||||
return require("lsp-progress").progress()
|
return require("lsp-progress").progress()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
lualine_c = { "progress", "filetype" },
|
lualine_c = { "progress", "filetype" },
|
||||||
lualine_x = { "encoding", "fileformat" },
|
lualine_x = { "encoding", "fileformat" },
|
||||||
lualine_y = { "diff", "diagnostics" },
|
lualine_y = { "diff", "diagnostics" },
|
||||||
lualine_z = { "location" },
|
lualine_z = { "location" },
|
||||||
},
|
},
|
||||||
inactive_sections = {
|
inactive_sections = {
|
||||||
lualine_a = {},
|
lualine_a = {},
|
||||||
lualine_b = {},
|
lualine_b = {},
|
||||||
lualine_c = { "filename" },
|
lualine_c = { "filename" },
|
||||||
lualine_x = { "location" },
|
lualine_x = { "location" },
|
||||||
lualine_y = {},
|
lualine_y = {},
|
||||||
lualine_z = {},
|
lualine_z = {},
|
||||||
},
|
},
|
||||||
tabline = {},
|
tabline = {},
|
||||||
winbar = {},
|
winbar = {},
|
||||||
inactive_winbar = {},
|
inactive_winbar = {},
|
||||||
extensions = {},
|
extensions = {},
|
||||||
})
|
})
|
||||||
-- listen lsp-progress event and refresh lualine
|
-- listen lsp-progress event and refresh lualine
|
||||||
vim.api.nvim_create_augroup("lualine_augroup", { clear = true })
|
vim.api.nvim_create_augroup("lualine_augroup", { clear = true })
|
||||||
vim.api.nvim_create_autocmd("User", {
|
vim.api.nvim_create_autocmd("User", {
|
||||||
group = "lualine_augroup",
|
group = "lualine_augroup",
|
||||||
pattern = "LspProgressStatusUpdated",
|
pattern = "LspProgressStatusUpdated",
|
||||||
callback = require("lualine").refresh,
|
callback = require("lualine").refresh,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,192 +1,190 @@
|
||||||
return {
|
return {
|
||||||
require("plugins.blink-cmp"),
|
require("plugins.blink-cmp"),
|
||||||
require("plugins.telescope"),
|
require("plugins.telescope"),
|
||||||
require("plugins.oil"),
|
require("plugins.oil"),
|
||||||
require("plugins.harpoon"),
|
require("plugins.harpoon"),
|
||||||
require("plugins.lualine"),
|
require("plugins.lualine"),
|
||||||
{ "lsp-progress",
|
require("plugins.conform"),
|
||||||
after = function()
|
{
|
||||||
require("lsp-progress").setup({
|
"lsp-progress",
|
||||||
client_format = function(client_name, spinner, series_messages)
|
after = function()
|
||||||
if #series_messages == 0 then
|
require("lsp-progress").setup({
|
||||||
return nil
|
client_format = function(client_name, spinner, series_messages)
|
||||||
end
|
if #series_messages == 0 then
|
||||||
return {
|
return nil
|
||||||
name = client_name,
|
end
|
||||||
body = spinner .. " " .. table.concat(series_messages, ", "),
|
return {
|
||||||
}
|
name = client_name,
|
||||||
end,
|
body = spinner .. " " .. table.concat(series_messages, ", "),
|
||||||
format = function(client_messages)
|
}
|
||||||
--- @param name string
|
end,
|
||||||
--- @param msg string?
|
format = function(client_messages)
|
||||||
--- @return string
|
--- @param name string
|
||||||
local function stringify(name, msg)
|
--- @param msg string?
|
||||||
return msg and string.format("%s %s", name, msg) or name
|
--- @return string
|
||||||
end
|
local function stringify(name, msg)
|
||||||
|
return msg and string.format("%s %s", name, msg) or name
|
||||||
|
end
|
||||||
|
|
||||||
local sign = "" -- nf-fa-gear \uf013
|
local sign = "" -- nf-fa-gear \uf013
|
||||||
local lsp_clients = vim.lsp.get_clients()
|
local lsp_clients = vim.lsp.get_clients()
|
||||||
local messages_map = {}
|
local messages_map = {}
|
||||||
for _, climsg in ipairs(client_messages) do
|
for _, climsg in ipairs(client_messages) do
|
||||||
messages_map[climsg.name] = climsg.body
|
messages_map[climsg.name] = climsg.body
|
||||||
end
|
end
|
||||||
|
|
||||||
if #lsp_clients > 0 then
|
if #lsp_clients > 0 then
|
||||||
table.sort(lsp_clients, function(a, b)
|
table.sort(lsp_clients, function(a, b)
|
||||||
return a.name < b.name
|
return a.name < b.name
|
||||||
end)
|
end)
|
||||||
local builder = {}
|
local builder = {}
|
||||||
for _, cli in ipairs(lsp_clients) do
|
for _, cli in ipairs(lsp_clients) do
|
||||||
if
|
if type(cli) == "table" and type(cli.name) == "string" and string.len(cli.name) > 0 then
|
||||||
type(cli) == "table"
|
if messages_map[cli.name] then
|
||||||
and type(cli.name) == "string"
|
table.insert(builder, stringify(cli.name, messages_map[cli.name]))
|
||||||
and string.len(cli.name) > 0
|
else
|
||||||
then
|
table.insert(builder, stringify(cli.name))
|
||||||
if messages_map[cli.name] then
|
end
|
||||||
table.insert(builder, stringify(cli.name, messages_map[cli.name]))
|
|
||||||
else
|
|
||||||
table.insert(builder, stringify(cli.name))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if #builder > 0 then
|
||||||
|
return sign .. " " .. table.concat(builder, ", ")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if #builder > 0 then
|
return ""
|
||||||
return sign .. " " .. table.concat(builder, ", ")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return ""
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
},
|
|
||||||
{ "telescope-ui-select.nvim", priority = 70 },
|
|
||||||
{
|
|
||||||
"nvim-autopairs",
|
|
||||||
event = "BufEnter",
|
|
||||||
after = function()
|
|
||||||
require("nvim-autopairs").setup()
|
|
||||||
end,
|
end,
|
||||||
},
|
})
|
||||||
{
|
end,
|
||||||
"nvim-lspconfig",
|
},
|
||||||
event = "BufEnter",
|
{ "telescope-ui-select.nvim", priority = 70 },
|
||||||
after = function()
|
{
|
||||||
require("lsp")
|
"nvim-autopairs",
|
||||||
end,
|
event = "BufEnter",
|
||||||
},
|
after = function()
|
||||||
{
|
require("nvim-autopairs").setup()
|
||||||
"sleuth",
|
end,
|
||||||
event = "BufEnter",
|
},
|
||||||
},
|
{
|
||||||
{
|
"nvim-lspconfig",
|
||||||
"which-key.nvim",
|
event = "BufEnter",
|
||||||
after = function()
|
after = function()
|
||||||
require("which-key").setup({
|
require("lsp")
|
||||||
delay = 1000,
|
end,
|
||||||
})
|
},
|
||||||
end,
|
{
|
||||||
},
|
"sleuth",
|
||||||
{ "nvim-web-devicons" },
|
event = "BufEnter",
|
||||||
{ "rose-pine" },
|
},
|
||||||
{ "render-markdown.nvim" },
|
{
|
||||||
{ "markdown-preview.nvim" },
|
"which-key.nvim",
|
||||||
{
|
after = function()
|
||||||
"trouble.nvim",
|
require("which-key").setup({
|
||||||
event = "LspAttach",
|
delay = 1000,
|
||||||
after = function()
|
})
|
||||||
require("trouble").setup()
|
end,
|
||||||
vim.keymap.set("n", "<leader>xx", function()
|
},
|
||||||
vim.cmd("Trouble diagnostics toggle")
|
{ "nvim-web-devicons" },
|
||||||
end, { desc = "Diagnostics" })
|
{ "rose-pine" },
|
||||||
vim.keymap.set("n", "<leader>xX", function()
|
{ "render-markdown.nvim" },
|
||||||
vim.cmd("Trouble diagnostics toggle filter.buf=0")
|
{ "markdown-preview.nvim" },
|
||||||
end, { desc = "Buffer diagnostics" })
|
{
|
||||||
vim.keymap.set("n", "<leader>cs", function()
|
"trouble.nvim",
|
||||||
vim.cmd("Trouble symbols toggle")
|
event = "LspAttach",
|
||||||
end, { desc = "Symbols" })
|
after = function()
|
||||||
vim.keymap.set("n", "<leader>cl", function()
|
require("trouble").setup()
|
||||||
vim.cmd("Trouble lsp toggle win.position=right")
|
vim.keymap.set("n", "<leader>xx", function()
|
||||||
end, { desc = "LSP definitions / references /..." })
|
vim.cmd("Trouble diagnostics toggle")
|
||||||
vim.keymap.set("n", "<leader>ql", function()
|
end, { desc = "Diagnostics" })
|
||||||
vim.cmd("Trouble qflist toggle")
|
vim.keymap.set("n", "<leader>xX", function()
|
||||||
end, { desc = "Quickfix list (trouble)" })
|
vim.cmd("Trouble diagnostics toggle filter.buf=0")
|
||||||
end,
|
end, { desc = "Buffer diagnostics" })
|
||||||
},
|
vim.keymap.set("n", "<leader>cs", function()
|
||||||
{
|
vim.cmd("Trouble symbols toggle")
|
||||||
"typst-preview",
|
end, { desc = "Symbols" })
|
||||||
after = function()
|
vim.keymap.set("n", "<leader>cl", function()
|
||||||
require("typst-preview").setup({
|
vim.cmd("Trouble lsp toggle win.position=right")
|
||||||
dependencies_bin = {
|
end, { desc = "LSP definitions / references /..." })
|
||||||
["typst-preview"] = nixCats("bin.tinymist"),
|
vim.keymap.set("n", "<leader>ql", function()
|
||||||
["websocat"] = nixCats("bin.websocat"),
|
vim.cmd("Trouble qflist toggle")
|
||||||
},
|
end, { desc = "Quickfix list (trouble)" })
|
||||||
})
|
end,
|
||||||
end,
|
},
|
||||||
},
|
{
|
||||||
{
|
"typst-preview",
|
||||||
"toggleterm.nvim",
|
after = function()
|
||||||
after = function()
|
require("typst-preview").setup({
|
||||||
require("toggleterm").setup({
|
dependencies_bin = {
|
||||||
shade_terminals = false,
|
["typst-preview"] = nixCats("bin.tinymist"),
|
||||||
})
|
["websocat"] = nixCats("bin.websocat"),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"toggleterm.nvim",
|
||||||
|
after = function()
|
||||||
|
require("toggleterm").setup({
|
||||||
|
shade_terminals = false,
|
||||||
|
})
|
||||||
|
|
||||||
vim.keymap.set({ "n", "t", "v" }, "<C-l>", function()
|
vim.keymap.set({ "n", "t", "v" }, "<C-l>", function()
|
||||||
vim.cmd("ToggleTerm direction=float")
|
vim.cmd("ToggleTerm direction=float")
|
||||||
end)
|
end)
|
||||||
vim.keymap.set("n", "<leader>tv", function()
|
vim.keymap.set("n", "<leader>tv", function()
|
||||||
vim.cmd("ToggleTerm direction=vertical")
|
vim.cmd("ToggleTerm direction=vertical")
|
||||||
end)
|
end)
|
||||||
vim.keymap.set("n", "<leader>tt", function()
|
vim.keymap.set("n", "<leader>tt", function()
|
||||||
vim.cmd("ToggleTerm direction=horizontal")
|
vim.cmd("ToggleTerm direction=horizontal")
|
||||||
end)
|
end)
|
||||||
vim.keymap.set("n", "<leader>ts", function()
|
vim.keymap.set("n", "<leader>ts", function()
|
||||||
vim.cmd("TermSelect")
|
vim.cmd("TermSelect")
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mini.ai",
|
"mini.ai",
|
||||||
event = "BufEnter",
|
event = "BufEnter",
|
||||||
after = function()
|
after = function()
|
||||||
require("mini.ai").setup()
|
require("mini.ai").setup()
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mini.surround",
|
"mini.surround",
|
||||||
event = "BufEnter",
|
event = "BufEnter",
|
||||||
after = function()
|
after = function()
|
||||||
require("mini.surround").setup()
|
require("mini.surround").setup()
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mini.starter",
|
"mini.starter",
|
||||||
after = function ()
|
after = function()
|
||||||
require("mini.starter").setup()
|
require("mini.starter").setup()
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mini.notify",
|
"mini.notify",
|
||||||
event = "BufEnter",
|
event = "BufEnter",
|
||||||
after = function ()
|
after = function()
|
||||||
require("mini.notify").setup({
|
require("mini.notify").setup({
|
||||||
lsp_progress = { enable = false }
|
lsp_progress = { enable = false },
|
||||||
})
|
})
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mini.trailspace",
|
"mini.trailspace",
|
||||||
event = "BufEnter",
|
event = "BufEnter",
|
||||||
after = function ()
|
after = function()
|
||||||
require("mini.trailspace").setup()
|
require("mini.trailspace").setup()
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cellular-automaton.nvim",
|
"cellular-automaton.nvim",
|
||||||
cmd = "CellularAutomaton",
|
cmd = "CellularAutomaton",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"indent-blankline.nvim",
|
"indent-blankline.nvim",
|
||||||
after = function ()
|
after = function()
|
||||||
require("ibl").setup({
|
require("ibl").setup({
|
||||||
indent = {
|
indent = {
|
||||||
char = "│",
|
char = "│",
|
||||||
tab_char = "│",
|
tab_char = "│",
|
||||||
|
@ -201,127 +199,134 @@ return {
|
||||||
"toggleterm",
|
"toggleterm",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
)
|
end,
|
||||||
end
|
},
|
||||||
},
|
{
|
||||||
{
|
"mini.bufremove",
|
||||||
"mini.bufremove",
|
event = "BufEnter",
|
||||||
event = "BufEnter",
|
after = function()
|
||||||
after = function ()
|
require("mini.bufremove").setup()
|
||||||
require("mini.bufremove").setup()
|
|
||||||
|
|
||||||
vim.keymap.set({"n", "v"}, "<leader>bd", function ()
|
vim.keymap.set({ "n", "v" }, "<leader>bd", function()
|
||||||
MiniBufremove.delete()
|
MiniBufremove.delete()
|
||||||
end)
|
end)
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mini.hipatterns",
|
"mini.hipatterns",
|
||||||
event = "BufEnter",
|
event = "BufEnter",
|
||||||
after = function ()
|
after = function()
|
||||||
require("mini.hipatterns").setup()
|
require("mini.hipatterns").setup()
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"gitsigns.nvim",
|
"gitsigns.nvim",
|
||||||
event = "BufEnter",
|
event = "BufEnter",
|
||||||
after = function ()
|
after = function()
|
||||||
require('gitsigns').setup{
|
require("gitsigns").setup({
|
||||||
on_attach = function(bufnr)
|
on_attach = function(bufnr)
|
||||||
local gitsigns = require('gitsigns')
|
local gitsigns = require("gitsigns")
|
||||||
|
|
||||||
local function map(mode, l, r, opts)
|
local function map(mode, l, r, opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
opts.buffer = bufnr
|
opts.buffer = bufnr
|
||||||
vim.keymap.set(mode, l, r, opts)
|
vim.keymap.set(mode, l, r, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Navigation
|
-- Navigation
|
||||||
map('n', ']c', function()
|
map("n", "]c", function()
|
||||||
if vim.wo.diff then
|
if vim.wo.diff then
|
||||||
vim.cmd.normal({']c', bang = true})
|
vim.cmd.normal({ "]c", bang = true })
|
||||||
else
|
else
|
||||||
gitsigns.nav_hunk('next')
|
gitsigns.nav_hunk("next")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
map('n', '[c', function()
|
map("n", "[c", function()
|
||||||
if vim.wo.diff then
|
if vim.wo.diff then
|
||||||
vim.cmd.normal({'[c', bang = true})
|
vim.cmd.normal({ "[c", bang = true })
|
||||||
else
|
else
|
||||||
gitsigns.nav_hunk('prev')
|
gitsigns.nav_hunk("prev")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Actions
|
-- Actions
|
||||||
map('n', '<leader>gs', gitsigns.stage_hunk)
|
map("n", "<leader>gs", gitsigns.stage_hunk)
|
||||||
map('n', '<leader>gr', gitsigns.reset_hunk)
|
map("n", "<leader>gr", gitsigns.reset_hunk)
|
||||||
map('v', '<leader>gs', function() gitsigns.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end)
|
map("v", "<leader>gs", function()
|
||||||
map('v', '<leader>gr', function() gitsigns.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end)
|
gitsigns.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||||
map('n', '<leader>gS', gitsigns.stage_buffer)
|
end)
|
||||||
map('n', '<leader>gu', gitsigns.undo_stage_hunk)
|
map("v", "<leader>gr", function()
|
||||||
map('n', '<leader>gR', gitsigns.reset_buffer)
|
gitsigns.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||||
map('n', '<leader>gp', gitsigns.preview_hunk)
|
end)
|
||||||
map('n', '<leader>gb', function() gitsigns.blame_line{full=true} end)
|
map("n", "<leader>gS", gitsigns.stage_buffer)
|
||||||
map('n', '<leader>gb', gitsigns.toggle_current_line_blame)
|
map("n", "<leader>gu", gitsigns.undo_stage_hunk)
|
||||||
map('n', '<leader>gd', gitsigns.diffthis)
|
map("n", "<leader>gR", gitsigns.reset_buffer)
|
||||||
map('n', '<leader>gD', function() gitsigns.diffthis('~') end)
|
map("n", "<leader>gp", gitsigns.preview_hunk)
|
||||||
map('n', '<leader>gtd', gitsigns.toggle_deleted)
|
map("n", "<leader>gb", function()
|
||||||
|
gitsigns.blame_line({ full = true })
|
||||||
|
end)
|
||||||
|
map("n", "<leader>gb", gitsigns.toggle_current_line_blame)
|
||||||
|
map("n", "<leader>gd", gitsigns.diffthis)
|
||||||
|
map("n", "<leader>gD", function()
|
||||||
|
gitsigns.diffthis("~")
|
||||||
|
end)
|
||||||
|
map("n", "<leader>gtd", gitsigns.toggle_deleted)
|
||||||
|
|
||||||
-- Text object
|
-- Text object
|
||||||
map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
|
||||||
end
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neogit",
|
||||||
|
cmd = "Neogit",
|
||||||
|
after = function()
|
||||||
|
require("neogit").setup({
|
||||||
|
graph_style = "unicode",
|
||||||
|
integrations = {
|
||||||
|
telescope = true,
|
||||||
|
diffview = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"diffiew.nvim",
|
||||||
|
cmd = { "DiffviewOpen", "DiffviewClose", "DiffviewToggleFiles", "DiffviewFocusFiles", "DiffviewRefresh" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"barbecue.nvim",
|
||||||
|
event = "BufEnter",
|
||||||
|
after = function()
|
||||||
|
require("barbecue").setup()
|
||||||
|
-- triggers CursorHold event faster
|
||||||
|
vim.opt.updatetime = 200
|
||||||
|
|
||||||
|
require("barbecue").setup({
|
||||||
|
create_autocmd = false, -- prevent barbecue from updating itself automatically
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({
|
||||||
|
"WinResized",
|
||||||
|
"BufWinEnter",
|
||||||
|
"CursorHold",
|
||||||
|
"InsertLeave",
|
||||||
|
|
||||||
|
-- include this if you have set `show_modified` to `true`
|
||||||
|
"BufModifiedSet",
|
||||||
|
}, {
|
||||||
|
group = vim.api.nvim_create_augroup("barbecue.updater", {}),
|
||||||
|
callback = function()
|
||||||
|
require("barbecue.ui").update()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"undotree",
|
||||||
|
cmd = "UndotreeToggle",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
end
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"neogit",
|
|
||||||
cmd = "Neogit",
|
|
||||||
after = function ()
|
|
||||||
require("neogit").setup({
|
|
||||||
graph_style = "unicode",
|
|
||||||
integrations = {
|
|
||||||
telescope = true,
|
|
||||||
diffview = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"diffiew.nvim",
|
|
||||||
cmd = {"DiffviewOpen", "DiffviewClose", "DiffviewToggleFiles", "DiffviewFocusFiles", "DiffviewRefresh"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"barbecue.nvim",
|
|
||||||
event = "BufEnter",
|
|
||||||
after = function()
|
|
||||||
require("barbecue").setup()
|
|
||||||
-- triggers CursorHold event faster
|
|
||||||
vim.opt.updatetime = 200
|
|
||||||
|
|
||||||
require("barbecue").setup({
|
|
||||||
create_autocmd = false, -- prevent barbecue from updating itself automatically
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({
|
|
||||||
"WinResized",
|
|
||||||
"BufWinEnter",
|
|
||||||
"CursorHold",
|
|
||||||
"InsertLeave",
|
|
||||||
|
|
||||||
-- include this if you have set `show_modified` to `true`
|
|
||||||
"BufModifiedSet",
|
|
||||||
}, {
|
|
||||||
group = vim.api.nvim_create_augroup("barbecue.updater", {}),
|
|
||||||
callback = function()
|
|
||||||
require("barbecue.ui").update()
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"undotree",
|
|
||||||
cmd = "UndotreeToggle"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,39 +1,39 @@
|
||||||
return {
|
return {
|
||||||
"oil.nvim",
|
"oil.nvim",
|
||||||
after = function()
|
after = function()
|
||||||
require("oil").setup({
|
require("oil").setup({
|
||||||
columns = {
|
columns = {
|
||||||
"size",
|
"size",
|
||||||
"icon",
|
"icon",
|
||||||
},
|
},
|
||||||
use_default_keymaps = false,
|
use_default_keymaps = false,
|
||||||
keymaps = {
|
keymaps = {
|
||||||
["J"] = "actions.parent",
|
["J"] = "actions.parent",
|
||||||
["Q"] = "actions.close",
|
["Q"] = "actions.close",
|
||||||
["<C-h>"] = "actions.select_split",
|
["<C-h>"] = "actions.select_split",
|
||||||
["<C-l>"] = "actions.refresh",
|
["<C-l>"] = "actions.refresh",
|
||||||
["<C-p>"] = "actions.preview",
|
["<C-p>"] = "actions.preview",
|
||||||
["<C-s>"] = "actions.select_vsplit",
|
["<C-s>"] = "actions.select_vsplit",
|
||||||
["<C-t>"] = "actions.select_tab",
|
["<C-t>"] = "actions.select_tab",
|
||||||
["<CR>"] = "actions.select",
|
["<CR>"] = "actions.select",
|
||||||
["K"] = "actions.select",
|
["K"] = "actions.select",
|
||||||
["_"] = "actions.open_cwd",
|
["_"] = "actions.open_cwd",
|
||||||
["`"] = "actions.cd",
|
["`"] = "actions.cd",
|
||||||
["g."] = "actions.toggle_hidden",
|
["g."] = "actions.toggle_hidden",
|
||||||
["g?"] = "actions.show_help",
|
["g?"] = "actions.show_help",
|
||||||
["g\\"] = "actions.toggle_trash",
|
["g\\"] = "actions.toggle_trash",
|
||||||
["gs"] = "actions.change_sort",
|
["gs"] = "actions.change_sort",
|
||||||
["gx"] = "actions.open_external",
|
["gx"] = "actions.open_external",
|
||||||
["~"] = "actions.tcd",
|
["~"] = "actions.tcd",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>e", function()
|
vim.keymap.set("n", "<leader>e", function()
|
||||||
vim.cmd("Oil")
|
vim.cmd("Oil")
|
||||||
end, { desc = "Open file explorer in current file directory" })
|
end, { desc = "Open file explorer in current file directory" })
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>fe", function()
|
vim.keymap.set("n", "<leader>fe", function()
|
||||||
vim.cmd("Oil " .. vim.fn.getcwd())
|
vim.cmd("Oil " .. vim.fn.getcwd())
|
||||||
end, { desc = "Open file explorer in current working directory" })
|
end, { desc = "Open file explorer in current working directory" })
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,41 @@
|
||||||
return {
|
return {
|
||||||
"telescope.nvim",
|
"telescope.nvim",
|
||||||
after = function()
|
after = function()
|
||||||
require("telescope").setup({
|
require("telescope").setup({
|
||||||
extensions = {
|
extensions = {
|
||||||
["ui-select"] = {
|
["ui-select"] = {
|
||||||
require("telescope.themes").get_dropdown({}),
|
require("telescope.themes").get_dropdown({}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
require("telescope").load_extension("ui-select")
|
require("telescope").load_extension("ui-select")
|
||||||
|
|
||||||
local builtin = require("telescope.builtin")
|
local builtin = require("telescope.builtin")
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader> ", function()
|
vim.keymap.set("n", "<leader> ", function()
|
||||||
local is_git = vim.fn.finddir(".git", vim.fn.getcwd() .. ";")
|
local is_git = vim.fn.finddir(".git", vim.fn.getcwd() .. ";")
|
||||||
if is_git then
|
if is_git then
|
||||||
builtin.git_files()
|
builtin.git_files()
|
||||||
else
|
else
|
||||||
builtin.find_files()
|
builtin.find_files()
|
||||||
end
|
end
|
||||||
end, { desc = "Grep through all files tracked by git, or fall back to just cwd" })
|
end, { desc = "Grep through all files tracked by git, or fall back to just cwd" })
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Grep through all files in cwd" })
|
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Grep through all files in cwd" })
|
||||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action)
|
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action)
|
||||||
vim.keymap.set("n", "<leader>/", builtin.live_grep)
|
vim.keymap.set("n", "<leader>/", builtin.live_grep)
|
||||||
vim.keymap.set("n", "<leader>k", builtin.buffers)
|
vim.keymap.set("n", "<leader>k", builtin.buffers)
|
||||||
vim.keymap.set("n", "<leader>gd", builtin.lsp_definitions, { desc = "Go to LSP definition" })
|
vim.keymap.set("n", "<leader>gd", builtin.lsp_definitions, { desc = "Go to LSP definition" })
|
||||||
vim.keymap.set("n", "<leader>gi", builtin.lsp_implementations, { desc = "Go to implementations" })
|
vim.keymap.set("n", "<leader>gi", builtin.lsp_implementations, { desc = "Go to implementations" })
|
||||||
vim.keymap.set("n", "<leader>j", builtin.lsp_document_symbols, { desc = "Search through document symbols" })
|
vim.keymap.set("n", "<leader>j", builtin.lsp_document_symbols, { desc = "Search through document symbols" })
|
||||||
vim.keymap.set("n", "<leader>fs", builtin.lsp_workspace_symbols, { desc = "Search through entire workspace symbols" })
|
vim.keymap.set(
|
||||||
vim.keymap.set("n", "<leader>fd", builtin.diagnostics, { desc = "Search through LSP diagnostics" })
|
"n",
|
||||||
end,
|
"<leader>fs",
|
||||||
priority = 60
|
builtin.lsp_workspace_symbols,
|
||||||
|
{ desc = "Search through entire workspace symbols" }
|
||||||
|
)
|
||||||
|
vim.keymap.set("n", "<leader>fd", builtin.diagnostics, { desc = "Search through LSP diagnostics" })
|
||||||
|
end,
|
||||||
|
priority = 60,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue