Update neovim configs

Signed-off-by: The-Repo-Club <wayne6324@gmail.com>
This commit is contained in:
The-Repo-Club 2022-08-16 17:45:51 +01:00
parent 25a8fe783e
commit 37908c0944
No known key found for this signature in database
GPG Key ID: E30EC2FBFB05C44F
15 changed files with 662 additions and 632 deletions

View File

@ -1,12 +1,13 @@
local alpha = require("alpha")
-- General Settings auto commands -- General Settings auto commands
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
group = vim.api.nvim_create_augroup("_general_settings", { clear = true }), group = vim.api.nvim_create_augroup("_general_settings_filetype", { clear = true }),
pattern = { "qf", "help", "man", "lspinfo" }, pattern = { "qf", "help", "man", "lspinfo", "lazygit" },
command = "nnoremap <silent> <buffer> q :close<CR>", command = "nnoremap <silent> <buffer> q :close<CR>",
}) })
vim.api.nvim_create_autocmd("TextYankPost", { vim.api.nvim_create_autocmd("TextYankPost", {
group = vim.api.nvim_create_augroup("_general_settings", { clear = true }), group = vim.api.nvim_create_augroup("_general_settings_yank_text", { clear = true }),
pattern = "*", pattern = "*",
callback = function() callback = function()
require("vim.highlight").on_yank({ higroup = "Visual", timeout = 200 }) require("vim.highlight").on_yank({ higroup = "Visual", timeout = 200 })
@ -14,13 +15,13 @@ vim.api.nvim_create_autocmd("TextYankPost", {
}) })
vim.api.nvim_create_autocmd("BufWinEnter", { vim.api.nvim_create_autocmd("BufWinEnter", {
group = vim.api.nvim_create_augroup("_general_settings", { clear = true }), group = vim.api.nvim_create_augroup("_general_settings_buffer_enter", { clear = true }),
pattern = "*", pattern = "*",
command = "set formatoptions-=cro", command = "set formatoptions-=cro",
}) })
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
group = vim.api.nvim_create_augroup("_general_settings", { clear = true }), group = vim.api.nvim_create_augroup("_general_settings_filetype", { clear = true }),
pattern = "qf", pattern = "qf",
command = "set nobuflisted", command = "set nobuflisted",
}) })
@ -48,15 +49,23 @@ vim.api.nvim_create_autocmd("VimResized", {
-- Alpha dashboard auto commands -- Alpha dashboard auto commands
vim.api.nvim_create_autocmd("User", { vim.api.nvim_create_autocmd("User", {
group = vim.api.nvim_create_augroup("_alpha", { clear = true }), group = vim.api.nvim_create_augroup("_alpha_user", { clear = true }),
pattern = "AlphaReady", pattern = "AlphaReady",
command = "<buffer> set laststatus=0 | <buffer> set showtabline=0 | <buffer> set mouse=a", command = "set laststatus=0 | set showtabline=0 | set mouse=",
}) })
vim.api.nvim_create_autocmd("BufUnload", { vim.api.nvim_create_autocmd("BufUnload", {
group = vim.api.nvim_create_augroup("_alpha", { clear = true }), group = vim.api.nvim_create_augroup("_alpha_buffer", { clear = true }),
pattern = "AlphaReady", pattern = "*",
command = "<buffer> set laststatus=2 | <buffer> set showtabline=2 | <buffer> set mouse=a", command = "set laststatus=2 | set showtabline=2 | set mouse=a",
})
vim.api.nvim_create_autocmd("TabNewEntered", {
group = vim.api.nvim_create_augroup("_alpha_newtab", { clear = true }),
pattern = "*",
callback = function()
alpha.start()
end,
}) })
-- LSP auto commands -- LSP auto commands

View File

@ -1,33 +1,33 @@
-- Setup nvim-cmp. -- Setup nvim-cmp.
local status_ok, npairs = pcall(require, "nvim-autopairs") local status_ok, npairs = pcall(require, "nvim-autopairs")
if not status_ok then if not status_ok then
return return
end end
npairs.setup { npairs.setup({
check_ts = true, check_ts = true,
ts_config = { ts_config = {
lua = { "string", "source" }, lua = { "string", "source" },
javascript = { "string", "template_string" }, javascript = { "string", "template_string" },
java = false, java = false,
}, },
disable_filetype = { "TelescopePrompt", "spectre_panel" }, disable_filetype = { "TelescopePrompt", "spectre_panel" },
fast_wrap = { fast_wrap = {
map = "<M-e>", map = "<M-e>",
chars = { "{", "[", "(", '"', "'" }, chars = { "{", "[", "(", '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
offset = 0, -- Offset from pattern match offset = 0, -- Offset from pattern match
end_key = "$", end_key = "$",
keys = "qwertyuiopzxcvbnmasdfghjkl", keys = "qwertyuiopzxcvbnmasdfghjkl",
check_comma = true, check_comma = true,
highlight = "PmenuSel", highlight = "PmenuSel",
highlight_grey = "LineNr", highlight_grey = "LineNr",
}, },
} })
local cmp_autopairs = require "nvim-autopairs.completion.cmp" local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp_status_ok, cmp = pcall(require, "cmp") local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then if not cmp_status_ok then
return return
end end
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = { tex = "" } }) cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))

View File

@ -1,143 +1,143 @@
local cmp_status_ok, cmp = pcall(require, "cmp") local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then if not cmp_status_ok then
return return
end end
local snip_status_ok, luasnip = pcall(require, "luasnip") local snip_status_ok, luasnip = pcall(require, "luasnip")
if not snip_status_ok then if not snip_status_ok then
return return
end end
require("luasnip/loaders/from_vscode").lazy_load() require("luasnip/loaders/from_vscode").lazy_load()
local check_backspace = function() local check_backspace = function()
local col = vim.fn.col "." - 1 local col = vim.fn.col(".") - 1
return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" return col == 0 or vim.fn.getline("."):sub(col, col):match("%s")
end end
--   פּ ﯟ   some other good icons --   פּ ﯟ   some other good icons
local kind_icons = { local kind_icons = {
Text = "", Text = "",
Method = "m", Method = "m",
Function = "", Function = "",
Constructor = "", Constructor = "",
Field = "", Field = "",
Variable = "", Variable = "",
Class = "", Class = "",
Interface = "", Interface = "",
Module = "", Module = "",
Property = "", Property = "",
Unit = "", Unit = "",
Value = "", Value = "",
Enum = "", Enum = "",
Keyword = "", Keyword = "",
Snippet = "", Snippet = "",
Color = "", Color = "",
File = "", File = "",
Reference = "", Reference = "",
Folder = "", Folder = "",
EnumMember = "", EnumMember = "",
Constant = "", Constant = "",
Struct = "", Struct = "",
Event = "", Event = "",
Operator = "", Operator = "",
TypeParameter = "", TypeParameter = "",
} }
-- find more here: https://www.nerdfonts.com/cheat-sheet -- find more here: https://www.nerdfonts.com/cheat-sheet
cmp.setup { cmp.setup({
snippet = { snippet = {
expand = function(args) expand = function(args)
luasnip.lsp_expand(args.body) -- For `luasnip` users. luasnip.lsp_expand(args.body) -- For `luasnip` users.
end, end,
}, },
mapping = { mapping = {
["<C-k>"] = cmp.mapping.select_prev_item(), ["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-j>"] = cmp.mapping.select_next_item(), ["<C-j>"] = cmp.mapping.select_next_item(),
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), ["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), ["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), ["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping. ["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
["<C-e>"] = cmp.mapping { ["<C-e>"] = cmp.mapping({
i = cmp.mapping.abort(), i = cmp.mapping.abort(),
c = cmp.mapping.close(), c = cmp.mapping.close(),
}, }),
-- Accept currently selected item. If none selected, `select` first item. -- Accept currently selected item. If none selected, `select` first item.
-- Set `select` to `false` to only confirm explicitly selected items. -- Set `select` to `false` to only confirm explicitly selected items.
["<CR>"] = cmp.mapping.confirm { select = true }, ["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
elseif luasnip.expandable() then elseif luasnip.expandable() then
luasnip.expand() luasnip.expand()
elseif luasnip.expand_or_jumpable() then elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump() luasnip.expand_or_jump()
elseif check_backspace() then elseif check_backspace() then
fallback() fallback()
else else
fallback() fallback()
end end
end, { end, {
"i", "i",
"s", "s",
}), }),
["<S-Tab>"] = cmp.mapping(function(fallback) ["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item() cmp.select_prev_item()
elseif luasnip.jumpable(-1) then elseif luasnip.jumpable(-1) then
luasnip.jump(-1) luasnip.jump(-1)
else else
fallback() fallback()
end end
end, { end, {
"i", "i",
"s", "s",
}), }),
}, },
formatting = { formatting = {
fields = { "kind", "abbr", "menu" }, fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item) format = function(entry, vim_item)
-- Kind icons -- Kind icons
vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
-- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
vim_item.menu = ({ vim_item.menu = ({
nvim_lsp = "[LSP]", nvim_lsp = "[LSP]",
luasnip = "[Snippet]", luasnip = "[Snippet]",
buffer = "[Buffer]", buffer = "[Buffer]",
path = "[Path]", path = "[Path]",
})[entry.source.name] })[entry.source.name]
return vim_item return vim_item
end, end,
}, },
sources = { sources = {
{ name = "nvim_lsp" }, { name = "nvim_lsp" },
{ name = "luasnip" }, { name = "luasnip" },
{ name = "buffer" }, { name = "buffer" },
{ name = "path" }, { name = "path" },
}, },
confirm_opts = { confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = false, select = false,
}, },
window = { window = {
documentation = { documentation = {
border = { "", "", "", "", "", "", "", "" }, border = { "", "", "", "", "", "", "", "" },
}, },
}, },
experimental = { experimental = {
ghost_text = false, ghost_text = false,
native_menu = false, native_menu = false,
}, },
}
cmp.setup.cmdline(':', {
sources = {
{ name = 'cmdline' }
}
}) })
cmp.setup.cmdline('/', { cmp.setup.cmdline(":", {
sources = { sources = {
{ name = 'buffer' } { name = "cmdline" },
} },
}) })
cmp.setup.cmdline("/", {
sources = {
{ name = "buffer" },
},
})

View File

@ -1,8 +1,8 @@
vim.cmd [[ vim.cmd([[
try try
colorscheme minimalmistakes colorscheme minimalmistakes
catch /^Vim\%((\a\+)\)\=:E185/ catch /^Vim\%((\a\+)\)\=:E185/
colorscheme default colorscheme default
set background=dark set background=dark
endtry endtry
]] ]])

View File

@ -1,22 +1,22 @@
local status_ok, comment = pcall(require, "Comment") local status_ok, comment = pcall(require, "Comment")
if not status_ok then if not status_ok then
return return
end end
comment.setup { comment.setup({
pre_hook = function(ctx) pre_hook = function(ctx)
local U = require "Comment.utils" local U = require("Comment.utils")
local location = nil local location = nil
if ctx.ctype == U.ctype.block then if ctx.ctype == U.ctype.block then
location = require("ts_context_commentstring.utils").get_cursor_location() location = require("ts_context_commentstring.utils").get_cursor_location()
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
location = require("ts_context_commentstring.utils").get_visual_start_location() location = require("ts_context_commentstring.utils").get_visual_start_location()
end end
return require("ts_context_commentstring.internal").calculate_commentstring { return require("ts_context_commentstring.internal").calculate_commentstring({
key = ctx.ctype == U.ctype.line and "__default" or "__multiline", key = ctx.ctype == U.ctype.line and "__default" or "__multiline",
location = location, location = location,
} })
end, end,
} })

View File

@ -1,48 +1,48 @@
local status_ok, gitsigns = pcall(require, "gitsigns") local status_ok, gitsigns = pcall(require, "gitsigns")
if not status_ok then if not status_ok then
return return
end end
gitsigns.setup { gitsigns.setup({
signs = { signs = {
add = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, add = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
change = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, change = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
delete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, delete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
topdelete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, topdelete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
changedelete = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, changedelete = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
}, },
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl` numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl` linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = { watch_gitdir = {
interval = 1000, interval = 1000,
follow_files = true, follow_files = true,
}, },
attach_to_untracked = true, attach_to_untracked = true,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = { current_line_blame_opts = {
virt_text = true, virt_text = true,
virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
delay = 1000, delay = 1000,
ignore_whitespace = false, ignore_whitespace = false,
}, },
current_line_blame_formatter_opts = { current_line_blame_formatter_opts = {
relative_time = false, relative_time = false,
}, },
sign_priority = 6, sign_priority = 6,
update_debounce = 100, update_debounce = 100,
status_formatter = nil, -- Use default status_formatter = nil, -- Use default
max_file_length = 40000, max_file_length = 40000,
preview_config = { preview_config = {
-- Options passed to nvim_open_win -- Options passed to nvim_open_win
border = "single", border = "single",
style = "minimal", style = "minimal",
relative = "cursor", relative = "cursor",
row = 0, row = 0,
col = 1, col = 1,
}, },
yadm = { yadm = {
enable = false, enable = false,
}, },
} })

View File

@ -1,6 +1,6 @@
local status_ok, impatient = pcall(require, "impatient") local status_ok, impatient = pcall(require, "impatient")
if not status_ok then if not status_ok then
return return
end end
impatient.enable_profile() impatient.enable_profile()

View File

@ -40,7 +40,7 @@ keymap("n", "<A-j>", "<Esc>:m .+1<CR>==gi", opts)
keymap("n", "<A-k>", "<Esc>:m .-2<CR>==gi", opts) keymap("n", "<A-k>", "<Esc>:m .-2<CR>==gi", opts)
-- Insert -- -- Insert --
-- Press jk fast to exit insert mode -- Press jk fast to exit insert mode
keymap("i", "jk", "<ESC>", opts) keymap("i", "jk", "<ESC>", opts)
-- Visual -- -- Visual --
@ -66,4 +66,3 @@ keymap("t", "<C-h>", "<C-\\><C-N><C-w>h", term_opts)
keymap("t", "<C-j>", "<C-\\><C-N><C-w>j", term_opts) keymap("t", "<C-j>", "<C-\\><C-N><C-w>j", term_opts)
keymap("t", "<C-k>", "<C-\\><C-N><C-w>k", term_opts) keymap("t", "<C-k>", "<C-\\><C-N><C-w>k", term_opts)
keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", term_opts) keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", term_opts)

View File

@ -1,78 +1,98 @@
local status_ok, lualine = pcall(require, "lualine") local status_ok, lualine = pcall(require, "lualine")
if not status_ok then return end if not status_ok then
return
end
local hide_in_width = function() return vim.fn.winwidth(0) > 80 end local hide_in_width = function()
return vim.fn.winwidth(0) > 80
end
local diagnostics = { local diagnostics = {
"diagnostics", "diagnostics",
sources = {"nvim_diagnostic"}, sources = { "nvim_diagnostic" },
sections = {"error", "warn"}, sections = { "error", "warn" },
symbols = {error = "", warn = ""}, symbols = { error = "", warn = "" },
colored = false, colored = false,
update_in_insert = false, update_in_insert = false,
always_visible = true always_visible = true,
} }
local diff = { local diff = {
"diff", "diff",
colored = false, colored = false,
symbols = {added = "", modified = "", removed = ""}, -- changes diff symbols symbols = { added = "", modified = "", removed = "" }, -- changes diff symbols
cond = hide_in_width cond = hide_in_width,
} }
local mode = {"mode", fmt = function(str) return "-- " .. str .. " --" end} local mode = {
"mode",
fmt = function(str)
return "-- " .. str .. " --"
end,
}
local filetype = {"filetype", icons_enabled = false, icon = nil} local filetype = { "filetype", icons_enabled = false, icon = nil }
local branch = {"branch", icons_enabled = true, icon = ""} local branch = { "branch", icons_enabled = true, icon = "" }
local location = {"location", padding = 0} local location = { "location", padding = 0 }
-- cool function for progress -- cool function for progress
local progress = function() local progress = function()
local current_line = vim.fn.line(".") local current_line = vim.fn.line(".")
local total_lines = vim.fn.line("$") local total_lines = vim.fn.line("$")
local chars = { local chars = {
"__", "▁▁", "▂▂", "▃▃", "▄▄", "▅▅", "▆▆", "__",
"▇▇", "██" "▁▁",
} "▂▂",
local line_ratio = current_line / total_lines "▃▃",
local index = math.ceil(line_ratio * #chars) "▄▄",
return chars[index] "▅▅",
"▆▆",
"▇▇",
"██",
}
local line_ratio = current_line / total_lines
local index = math.ceil(line_ratio * #chars)
return chars[index]
end end
local spaces = function() local spaces = function()
return "spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") return "spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth")
end end
lualine.setup({ lualine.setup({
options = { options = {
icons_enabled = true, icons_enabled = true,
theme = "minimalmistakes-nvim", theme = "minimalmistakes-nvim",
component_separators = {left = "", right = ""}, component_separators = { left = "", right = "" },
section_separators = {left = "", right = ""}, section_separators = { left = "", right = "" },
disabled_filetypes = { disabled_filetypes = {
"alpha", "dashboard", "NvimTree", "Outline", "packer" "alpha",
}, "dashboard",
always_divide_middle = true "NvimTree",
}, "Outline",
sections = { "packer",
lualine_a = {branch, diagnostics}, },
lualine_b = {mode}, always_divide_middle = true,
lualine_c = {}, },
-- lualine_x = { "encoding", "fileformat", "filetype" }, sections = {
lualine_x = {diff, spaces, "encoding", filetype}, lualine_a = { branch, diagnostics },
lualine_y = {location}, lualine_b = { mode },
lualine_z = {progress} lualine_c = {},
}, -- lualine_x = { "encoding", "fileformat", "filetype" },
inactive_sections = { lualine_x = { diff, spaces, "encoding", filetype },
lualine_a = {}, lualine_y = { location },
lualine_b = {}, lualine_z = { progress },
lualine_c = {"filename"}, },
lualine_x = {"location"}, inactive_sections = {
lualine_y = {}, lualine_a = {},
lualine_z = {} lualine_b = {},
}, lualine_c = { "filename" },
tabline = {}, lualine_x = { "location" },
extensions = {"nvim-tree"} lualine_y = {},
lualine_z = {},
},
tabline = {},
extensions = { "nvim-tree" },
}) })

View File

@ -1,68 +1,68 @@
local status_ok, nvim_tree = pcall(require, "nvim-tree") local status_ok, nvim_tree = pcall(require, "nvim-tree")
if not status_ok then if not status_ok then
return return
end end
local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
if not config_status_ok then if not config_status_ok then
return return
end end
local tree_cb = nvim_tree_config.nvim_tree_callback local tree_cb = nvim_tree_config.nvim_tree_callback
nvim_tree.setup { nvim_tree.setup({
update_focused_file = { update_focused_file = {
enable = true, enable = true,
update_cwd = true, update_cwd = true,
}, },
renderer = { renderer = {
root_folder_modifier = ":t", root_folder_modifier = ":t",
icons = { icons = {
glyphs = { glyphs = {
default = "", default = "",
symlink = "", symlink = "",
folder = { folder = {
arrow_open = "", arrow_open = "",
arrow_closed = "", arrow_closed = "",
default = "", default = "",
open = "", open = "",
empty = "", empty = "",
empty_open = "", empty_open = "",
symlink = "", symlink = "",
symlink_open = "", symlink_open = "",
}, },
git = { git = {
unstaged = "", unstaged = "",
staged = "S", staged = "S",
unmerged = "", unmerged = "",
renamed = "", renamed = "",
untracked = "U", untracked = "U",
deleted = "", deleted = "",
ignored = "", ignored = "",
}, },
}, },
}, },
}, },
diagnostics = { diagnostics = {
enable = true, enable = true,
show_on_dirs = true, show_on_dirs = true,
icons = { icons = {
hint = "", hint = "",
info = "", info = "",
warning = "", warning = "",
error = "", error = "",
}, },
}, },
view = { view = {
width = 30, width = 30,
height = 30, height = 30,
side = "left", side = "left",
mappings = { mappings = {
list = { list = {
{ key = { "l", "<CR>", "o" }, cb = tree_cb "edit" }, { key = { "l", "<CR>", "o" }, cb = tree_cb("edit") },
{ key = "h", cb = tree_cb "close_node" }, { key = "h", cb = tree_cb("close_node") },
{ key = "v", cb = tree_cb "vsplit" }, { key = "v", cb = tree_cb("vsplit") },
}, },
}, },
}, },
} })

View File

@ -1,48 +1,50 @@
local options = { local options = {
list = true, list = true,
backup = false, -- creates a backup file backup = false, -- creates a backup file
clipboard = "unnamedplus", -- allows neovim to access the system clipboard clipboard = "unnamedplus", -- allows neovim to access the system clipboard
cmdheight = 1, -- more space in the neovim command line for displaying messages cmdheight = 1, -- more space in the neovim command line for displaying messages
completeopt = {"menuone", "noselect"}, -- mostly just for cmp completeopt = { "menuone", "noselect" }, -- mostly just for cmp
conceallevel = 0, -- so that `` is visible in markdown files conceallevel = 0, -- so that `` is visible in markdown files
fileencoding = "utf-8", -- the encoding written to a file fileencoding = "utf-8", -- the encoding written to a file
hlsearch = true, -- highlight all matches on previous search pattern hlsearch = true, -- highlight all matches on previous search pattern
ignorecase = true, -- ignore case in search patterns ignorecase = true, -- ignore case in search patterns
mouse = "a", -- allow the mouse to be used in neovim mouse = "a", -- allow the mouse to be used in neovim
pumheight = 10, -- pop up menu height pumheight = 10, -- pop up menu height
showmode = false, -- we don't need to see things like -- INSERT -- anymore showmode = false, -- we don't need to see things like -- INSERT -- anymore
showtabline = 2, -- always show tabs showtabline = 2, -- always show tabs
smartcase = true, -- smart case smartcase = true, -- smart case
smartindent = true, -- make indenting smarter again smartindent = true, -- make indenting smarter again
splitbelow = true, -- force all horizontal splits to go below current window splitbelow = true, -- force all horizontal splits to go below current window
splitright = true, -- force all vertical splits to go to the right of current window splitright = true, -- force all vertical splits to go to the right of current window
swapfile = false, -- creates a swapfile swapfile = false, -- creates a swapfile
termguicolors = true, -- set term gui colors (most terminals support this) termguicolors = true, -- set term gui colors (most terminals support this)
timeoutlen = 100, -- time to wait for a mapped sequence to complete (in milliseconds) timeoutlen = 100, -- time to wait for a mapped sequence to complete (in milliseconds)
undofile = true, -- enable persistent undo undofile = true, -- enable persistent undo
updatetime = 300, -- faster completion (4000ms default) updatetime = 300, -- faster completion (4000ms default)
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
expandtab = true, -- convert tabs to spaces expandtab = true, -- convert tabs to spaces
shiftwidth = 2, -- the number of spaces inserted for each indentation shiftwidth = 2, -- the number of spaces inserted for each indentation
tabstop = 2, -- insert 2 spaces for a tab tabstop = 2, -- insert 2 spaces for a tab
cursorline = true, -- highlight the current line cursorline = true, -- highlight the current line
number = true, -- set numbered lines number = true, -- set numbered lines
relativenumber = true, -- set relative numbered lines relativenumber = true, -- set relative numbered lines
numberwidth = 4, -- set number column width to 2 {default 4} numberwidth = 4, -- set number column width to 2 {default 4}
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
wrap = false, -- display lines as one long line wrap = false, -- display lines as one long line
scrolloff = 8, -- is one of my fav scrolloff = 8, -- is one of my fav
sidescrolloff = 8, sidescrolloff = 8,
laststatus = 2, laststatus = 2,
guifont = "monospace:h17" -- the font used in graphical neovim applications guifont = "monospace:h17", -- the font used in graphical neovim applications
} }
vim.opt.shortmess:append "c" vim.opt.shortmess:append("c")
vim.opt.listchars:append "space:⋅" vim.opt.listchars:append("space:⋅")
vim.opt.listchars:append "eol:↴" vim.opt.listchars:append("eol:↴")
for k, v in pairs(options) do vim.opt[k] = v end for k, v in pairs(options) do
vim.opt[k] = v
end
vim.cmd "set whichwrap+=<,>,[,],h,l" vim.cmd("set whichwrap+=<,>,[,],h,l")
vim.cmd [[set iskeyword+=-]] vim.cmd([[set iskeyword+=-]])
vim.cmd [[set formatoptions-=cro]] -- TODO: this doesn't seem to work vim.cmd([[set formatoptions-=cro]]) -- TODO: this doesn't seem to work

View File

@ -37,7 +37,7 @@ project.setup({
---@type string ---@type string
---@usage path to store the project history for use in telescope ---@usage path to store the project history for use in telescope
datapath = vim.fn.stdpath("data"), datapath = vim.fn.stdpath("data"),
}) })
local tele_status_ok, telescope = pcall(require, "telescope") local tele_status_ok, telescope = pcall(require, "telescope")
@ -45,4 +45,4 @@ if not tele_status_ok then
return return
end end
telescope.load_extension('projects') telescope.load_extension("projects")

View File

@ -1,96 +1,96 @@
local status_ok, telescope = pcall(require, "telescope") local status_ok, telescope = pcall(require, "telescope")
if not status_ok then if not status_ok then
return return
end end
local actions = require "telescope.actions" local actions = require("telescope.actions")
telescope.setup { telescope.setup({
defaults = { defaults = {
prompt_prefix = "", prompt_prefix = "",
selection_caret = "", selection_caret = "",
path_display = { "smart" }, path_display = { "smart" },
mappings = { mappings = {
i = { i = {
["<C-n>"] = actions.cycle_history_next, ["<C-n>"] = actions.cycle_history_next,
["<C-p>"] = actions.cycle_history_prev, ["<C-p>"] = actions.cycle_history_prev,
["<C-j>"] = actions.move_selection_next, ["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous, ["<C-k>"] = actions.move_selection_previous,
["<C-c>"] = actions.close, ["<C-c>"] = actions.close,
["<Down>"] = actions.move_selection_next, ["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous, ["<Up>"] = actions.move_selection_previous,
["<CR>"] = actions.select_default, ["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal, ["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical, ["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab, ["<C-t>"] = actions.select_tab,
["<C-u>"] = actions.preview_scrolling_up, ["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down, ["<C-d>"] = actions.preview_scrolling_down,
["<PageUp>"] = actions.results_scrolling_up, ["<PageUp>"] = actions.results_scrolling_up,
["<PageDown>"] = actions.results_scrolling_down, ["<PageDown>"] = actions.results_scrolling_down,
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse, ["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better, ["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
["<C-q>"] = actions.send_to_qflist + actions.open_qflist, ["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist, ["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["<C-l>"] = actions.complete_tag, ["<C-l>"] = actions.complete_tag,
["<C-_>"] = actions.which_key, -- keys from pressing <C-/> ["<C-_>"] = actions.which_key, -- keys from pressing <C-/>
}, },
n = { n = {
["<esc>"] = actions.close, ["<esc>"] = actions.close,
["<CR>"] = actions.select_default, ["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal, ["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical, ["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab, ["<C-t>"] = actions.select_tab,
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse, ["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better, ["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
["<C-q>"] = actions.send_to_qflist + actions.open_qflist, ["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist, ["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["j"] = actions.move_selection_next, ["j"] = actions.move_selection_next,
["k"] = actions.move_selection_previous, ["k"] = actions.move_selection_previous,
["H"] = actions.move_to_top, ["H"] = actions.move_to_top,
["M"] = actions.move_to_middle, ["M"] = actions.move_to_middle,
["L"] = actions.move_to_bottom, ["L"] = actions.move_to_bottom,
["<Down>"] = actions.move_selection_next, ["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous, ["<Up>"] = actions.move_selection_previous,
["gg"] = actions.move_to_top, ["gg"] = actions.move_to_top,
["G"] = actions.move_to_bottom, ["G"] = actions.move_to_bottom,
["<C-u>"] = actions.preview_scrolling_up, ["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down, ["<C-d>"] = actions.preview_scrolling_down,
["<PageUp>"] = actions.results_scrolling_up, ["<PageUp>"] = actions.results_scrolling_up,
["<PageDown>"] = actions.results_scrolling_down, ["<PageDown>"] = actions.results_scrolling_down,
["?"] = actions.which_key, ["?"] = actions.which_key,
}, },
}, },
}, },
pickers = { pickers = {
-- Default configuration for builtin pickers goes here: -- Default configuration for builtin pickers goes here:
-- picker_name = { -- picker_name = {
-- picker_config_key = value, -- picker_config_key = value,
-- ... -- ...
-- } -- }
-- Now the picker_config_key will be applied every time you call this -- Now the picker_config_key will be applied every time you call this
-- builtin picker -- builtin picker
}, },
extensions = { extensions = {
-- Your extension configuration goes here: -- Your extension configuration goes here:
-- extension_name = { -- extension_name = {
-- extension_config_key = value, -- extension_config_key = value,
-- } -- }
-- please take a look at the readme of the extension you want to configure -- please take a look at the readme of the extension you want to configure
}, },
} })

View File

@ -27,16 +27,16 @@ toggleterm.setup({
}) })
function _G.set_terminal_keymaps() function _G.set_terminal_keymaps()
local opts = {noremap = true} local opts = { noremap = true }
vim.api.nvim_buf_set_keymap(0, 't', '<esc>', [[<C-\><C-n>]], opts) vim.api.nvim_buf_set_keymap(0, "t", "<esc>", [[<C-\><C-n>]], opts)
vim.api.nvim_buf_set_keymap(0, 't', 'jk', [[<C-\><C-n>]], opts) vim.api.nvim_buf_set_keymap(0, "t", "jk", [[<C-\><C-n>]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-h>', [[<C-\><C-n><C-W>h]], opts) vim.api.nvim_buf_set_keymap(0, "t", "<C-h>", [[<C-\><C-n><C-W>h]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-j>', [[<C-\><C-n><C-W>j]], opts) vim.api.nvim_buf_set_keymap(0, "t", "<C-j>", [[<C-\><C-n><C-W>j]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-k>', [[<C-\><C-n><C-W>k]], opts) vim.api.nvim_buf_set_keymap(0, "t", "<C-k>", [[<C-\><C-n><C-W>k]], opts)
vim.api.nvim_buf_set_keymap(0, 't', '<C-l>', [[<C-\><C-n><C-W>l]], opts) vim.api.nvim_buf_set_keymap(0, "t", "<C-l>", [[<C-\><C-n><C-W>l]], opts)
end end
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()') vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()")
local Terminal = require("toggleterm.terminal").Terminal local Terminal = require("toggleterm.terminal").Terminal
local lazygit = Terminal:new({ cmd = "lazygit", hidden = true }) local lazygit = Terminal:new({ cmd = "lazygit", hidden = true })

View File

@ -1,187 +1,187 @@
local status_ok, which_key = pcall(require, "which-key") local status_ok, which_key = pcall(require, "which-key")
if not status_ok then if not status_ok then
return return
end end
local setup = { local setup = {
plugins = { plugins = {
marks = true, -- shows a list of your marks on ' and ` marks = true, -- shows a list of your marks on ' and `
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
spelling = { spelling = {
enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
suggestions = 20, -- how many suggestions should be shown in the list? suggestions = 20, -- how many suggestions should be shown in the list?
}, },
-- the presets plugin, adds help for a bunch of default keybindings in Neovim -- the presets plugin, adds help for a bunch of default keybindings in Neovim
-- No actual key bindings are created -- No actual key bindings are created
presets = { presets = {
operators = false, -- adds help for operators like d, y, ... and registers them for motion / text object completion operators = false, -- adds help for operators like d, y, ... and registers them for motion / text object completion
motions = true, -- adds help for motions motions = true, -- adds help for motions
text_objects = true, -- help for text objects triggered after entering an operator text_objects = true, -- help for text objects triggered after entering an operator
windows = true, -- default bindings on <c-w> windows = true, -- default bindings on <c-w>
nav = true, -- misc bindings to work with windows nav = true, -- misc bindings to work with windows
z = true, -- bindings for folds, spelling and others prefixed with z z = true, -- bindings for folds, spelling and others prefixed with z
g = true, -- bindings for prefixed with g g = true, -- bindings for prefixed with g
}, },
}, },
-- add operators that will trigger motion and text object completion -- add operators that will trigger motion and text object completion
-- to enable all native operators, set the preset / operators plugin above -- to enable all native operators, set the preset / operators plugin above
-- operators = { gc = "Comments" }, -- operators = { gc = "Comments" },
key_labels = { key_labels = {
-- override the label used to display some keys. It doesn't effect WK in any other way. -- override the label used to display some keys. It doesn't effect WK in any other way.
-- For example: -- For example:
-- ["<space>"] = "SPC", -- ["<space>"] = "SPC",
-- ["<cr>"] = "RET", -- ["<cr>"] = "RET",
-- ["<tab>"] = "TAB", -- ["<tab>"] = "TAB",
}, },
icons = { icons = {
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
separator = "", -- symbol used between a key and it's label separator = "", -- symbol used between a key and it's label
group = "+", -- symbol prepended to a group group = "+", -- symbol prepended to a group
}, },
popup_mappings = { popup_mappings = {
scroll_down = "<c-d>", -- binding to scroll down inside the popup scroll_down = "<c-d>", -- binding to scroll down inside the popup
scroll_up = "<c-u>", -- binding to scroll up inside the popup scroll_up = "<c-u>", -- binding to scroll up inside the popup
}, },
window = { window = {
border = "rounded", -- none, single, double, shadow border = "rounded", -- none, single, double, shadow
position = "bottom", -- bottom, top position = "bottom", -- bottom, top
margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left] margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left] padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
winblend = 0, winblend = 0,
}, },
layout = { layout = {
height = { min = 4, max = 25 }, -- min and max height of the columns height = { min = 4, max = 25 }, -- min and max height of the columns
width = { min = 20, max = 50 }, -- min and max width of the columns width = { min = 20, max = 50 }, -- min and max width of the columns
spacing = 3, -- spacing between columns spacing = 3, -- spacing between columns
align = "left", -- align columns left, center or right align = "left", -- align columns left, center or right
}, },
ignore_missing = true, -- enable this to hide mappings for which you didn't specify a label ignore_missing = true, -- enable this to hide mappings for which you didn't specify a label
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
show_help = true, -- show help message on the command line when the popup is visible show_help = true, -- show help message on the command line when the popup is visible
triggers = "auto", -- automatically setup triggers triggers = "auto", -- automatically setup triggers
-- triggers = {"<leader>"} -- or specify a list manually -- triggers = {"<leader>"} -- or specify a list manually
triggers_blacklist = { triggers_blacklist = {
-- list of mode / prefixes that should never be hooked by WhichKey -- list of mode / prefixes that should never be hooked by WhichKey
-- this is mostly relevant for key maps that start with a native binding -- this is mostly relevant for key maps that start with a native binding
-- most people should not need to change this -- most people should not need to change this
i = { "j", "k" }, i = { "j", "k" },
v = { "j", "k" }, v = { "j", "k" },
}, },
} }
local opts = { local opts = {
mode = "n", -- NORMAL mode mode = "n", -- NORMAL mode
prefix = "<leader>", prefix = "<leader>",
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
silent = true, -- use `silent` when creating keymaps silent = true, -- use `silent` when creating keymaps
noremap = true, -- use `noremap` when creating keymaps noremap = true, -- use `noremap` when creating keymaps
nowait = true, -- use `nowait` when creating keymaps nowait = true, -- use `nowait` when creating keymaps
} }
local mappings = { local mappings = {
["a"] = { "<cmd>Alpha<cr>", "Alpha" }, ["a"] = { "<cmd>lua require('alpha').start()<cr>", "Alpha" },
["b"] = { ["b"] = {
"<cmd>lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{previewer = false})<cr>", "<cmd>lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{previewer = false})<cr>",
"Buffers", "Buffers",
}, },
["e"] = { "<cmd>NvimTreeToggle<cr>", "Explorer" }, ["e"] = { "<cmd>NvimTreeToggle<cr>", "Explorer" },
["w"] = { "<cmd>w!<CR>", "Save" }, ["w"] = { "<cmd>w!<CR>", "Save" },
["q"] = { "<cmd>q!<CR>", "Quit" }, ["q"] = { "<cmd>q!<CR>", "Quit" },
["c"] = { "<cmd>Bdelete!<CR>", "Close Buffer" }, ["c"] = { "<cmd>Bdelete!<CR>", "Close Buffer" },
["h"] = { "<cmd>nohlsearch<CR>", "No Highlight" }, ["h"] = { "<cmd>nohlsearch<CR>", "No Highlight" },
["f"] = { ["f"] = {
"<cmd>lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})<cr>", "<cmd>lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})<cr>",
"Find files", "Find files",
}, },
["F"] = { "<cmd>Telescope live_grep theme=ivy<cr>", "Find Text" }, ["F"] = { "<cmd>Telescope live_grep theme=ivy<cr>", "Find Text" },
["P"] = { "<cmd>lua require('telescope').extensions.projects.projects()<cr>", "Projects" }, ["P"] = { "<cmd>lua require('telescope').extensions.projects.projects()<cr>", "Projects" },
p = { p = {
name = "Packer", name = "Packer",
c = { "<cmd>PackerCompile<cr>", "Compile" }, c = { "<cmd>PackerCompile<cr>", "Compile" },
i = { "<cmd>PackerInstall<cr>", "Install" }, i = { "<cmd>PackerInstall<cr>", "Install" },
s = { "<cmd>PackerSync<cr>", "Sync" }, s = { "<cmd>PackerSync<cr>", "Sync" },
S = { "<cmd>PackerStatus<cr>", "Status" }, S = { "<cmd>PackerStatus<cr>", "Status" },
u = { "<cmd>PackerUpdate<cr>", "Update" }, u = { "<cmd>PackerUpdate<cr>", "Update" },
}, },
g = { g = {
name = "Git", name = "Git",
g = { "<cmd>lua _LAZYGIT_TOGGLE()<CR>", "Lazygit" }, g = { "<cmd>lua _LAZYGIT_TOGGLE()<CR>", "Lazygit" },
j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" }, j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" },
k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" }, k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" },
l = { "<cmd>lua require 'gitsigns'.blame_line()<cr>", "Blame" }, l = { "<cmd>lua require 'gitsigns'.blame_line()<cr>", "Blame" },
p = { "<cmd>lua require 'gitsigns'.preview_hunk()<cr>", "Preview Hunk" }, p = { "<cmd>lua require 'gitsigns'.preview_hunk()<cr>", "Preview Hunk" },
r = { "<cmd>lua require 'gitsigns'.reset_hunk()<cr>", "Reset Hunk" }, r = { "<cmd>lua require 'gitsigns'.reset_hunk()<cr>", "Reset Hunk" },
R = { "<cmd>lua require 'gitsigns'.reset_buffer()<cr>", "Reset Buffer" }, R = { "<cmd>lua require 'gitsigns'.reset_buffer()<cr>", "Reset Buffer" },
s = { "<cmd>lua require 'gitsigns'.stage_hunk()<cr>", "Stage Hunk" }, s = { "<cmd>lua require 'gitsigns'.stage_hunk()<cr>", "Stage Hunk" },
u = { u = {
"<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>", "<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>",
"Undo Stage Hunk", "Undo Stage Hunk",
}, },
o = { "<cmd>Telescope git_status<cr>", "Open changed file" }, o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" }, b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" }, c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
d = { d = {
"<cmd>Gitsigns diffthis HEAD<cr>", "<cmd>Gitsigns diffthis HEAD<cr>",
"Diff", "Diff",
}, },
}, },
l = { l = {
name = "LSP", name = "LSP",
a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" }, a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" },
d = { d = {
"<cmd>Telescope lsp_document_diagnostics<cr>", "<cmd>Telescope lsp_document_diagnostics<cr>",
"Document Diagnostics", "Document Diagnostics",
}, },
w = { w = {
"<cmd>Telescope lsp_workspace_diagnostics<cr>", "<cmd>Telescope lsp_workspace_diagnostics<cr>",
"Workspace Diagnostics", "Workspace Diagnostics",
}, },
f = { "<cmd>lua vim.lsp.buf.format{async=true}<cr>", "Format" }, f = { "<cmd>lua vim.lsp.buf.format{async=true}<cr>", "Format" },
i = { "<cmd>LspInfo<cr>", "Info" }, i = { "<cmd>LspInfo<cr>", "Info" },
I = { "<cmd>LspInstallInfo<cr>", "Installer Info" }, I = { "<cmd>LspInstallInfo<cr>", "Installer Info" },
j = { j = {
"<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>",
"Next Diagnostic", "Next Diagnostic",
}, },
k = { k = {
"<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>", "<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>",
"Prev Diagnostic", "Prev Diagnostic",
}, },
l = { "<cmd>lua vim.lsp.codelens.run()<cr>", "CodeLens Action" }, l = { "<cmd>lua vim.lsp.codelens.run()<cr>", "CodeLens Action" },
q = { "<cmd>lua vim.lsp.diagnostic.set_loclist()<cr>", "Quickfix" }, q = { "<cmd>lua vim.lsp.diagnostic.set_loclist()<cr>", "Quickfix" },
r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" }, r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
s = { "<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols" }, s = { "<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols" },
S = { S = {
"<cmd>Telescope lsp_dynamic_workspace_symbols<cr>", "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>",
"Workspace Symbols", "Workspace Symbols",
}, },
}, },
s = { s = {
name = "Search", name = "Search",
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" }, b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" }, c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
h = { "<cmd>Telescope help_tags<cr>", "Find Help" }, h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
M = { "<cmd>Telescope man_pages<cr>", "Man Pages" }, M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" }, r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
R = { "<cmd>Telescope registers<cr>", "Registers" }, R = { "<cmd>Telescope registers<cr>", "Registers" },
k = { "<cmd>Telescope keymaps<cr>", "Keymaps" }, k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
C = { "<cmd>Telescope commands<cr>", "Commands" }, C = { "<cmd>Telescope commands<cr>", "Commands" },
}, },
t = { t = {
name = "Terminal", name = "Terminal",
n = { "<cmd>lua _NODE_TOGGLE()<cr>", "Node" }, n = { "<cmd>lua _NODE_TOGGLE()<cr>", "Node" },
u = { "<cmd>lua _NCDU_TOGGLE()<cr>", "NCDU" }, u = { "<cmd>lua _NCDU_TOGGLE()<cr>", "NCDU" },
t = { "<cmd>lua _HTOP_TOGGLE()<cr>", "Htop" }, t = { "<cmd>lua _HTOP_TOGGLE()<cr>", "Htop" },
l = { "<cmd>lua _LAZYGIT_TOGGLE()<cr>", "Lazygit" }, l = { "<cmd>lua _LAZYGIT_TOGGLE()<cr>", "Lazygit" },
p = { "<cmd>lua _PYTHON_TOGGLE()<cr>", "Python" }, p = { "<cmd>lua _PYTHON_TOGGLE()<cr>", "Python" },
f = { "<cmd>ToggleTerm direction=float<cr>", "Float" }, f = { "<cmd>ToggleTerm direction=float<cr>", "Float" },
h = { "<cmd>ToggleTerm size=10 direction=horizontal<cr>", "Horizontal" }, h = { "<cmd>ToggleTerm size=10 direction=horizontal<cr>", "Horizontal" },
v = { "<cmd>ToggleTerm size=80 direction=vertical<cr>", "Vertical" }, v = { "<cmd>ToggleTerm size=80 direction=vertical<cr>", "Vertical" },
}, },
} }
which_key.setup(setup) which_key.setup(setup)