Clean up nvim and add new lsp, use vim mode in zsh, reorganize tmux
This commit is contained in:
parent
5d38c262cd
commit
6cdf9123c0
@ -1 +1,24 @@
|
||||
{}
|
||||
{
|
||||
"runtime": {
|
||||
"version": "LuaJIT",
|
||||
"path": [
|
||||
"lua/?.lua",
|
||||
"lua/?/init.lua"
|
||||
]
|
||||
},
|
||||
"diagnostics": {
|
||||
"globals": ["vim", "Snacks"]
|
||||
},
|
||||
"workspace": {
|
||||
"checkThirdParty": false,
|
||||
"library": [
|
||||
"${3rd}/luv/library",
|
||||
"~/.local/share/nvim/lazy/oil.nvim/lua",
|
||||
"~/.local/share/nvim/lazy/snacks.nvim/lua"
|
||||
]
|
||||
},
|
||||
"telemetry": {
|
||||
"enable": false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
-- Setup leader keys before loading lazy.nvim
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
-- Initialize lazy.nvim
|
||||
require("config.lazy")
|
||||
|
||||
@ -22,6 +22,7 @@ require("lazy").setup({
|
||||
-- import your plugins
|
||||
{ import = "plugins" },
|
||||
{ import = "plugins.file_navigation" },
|
||||
{ import = "plugins.git" },
|
||||
{ import = "plugins.language_support" },
|
||||
{ import = "plugins.lsp" },
|
||||
{ import = "plugins.ui" },
|
||||
|
||||
@ -15,7 +15,7 @@ function M.setup()
|
||||
local workspace_dir = home .. "/.cache/jdtls/workspace/" .. project_name
|
||||
|
||||
local path_to_nvim_packages = home .. "/.local/share/nvim"
|
||||
local path_to_mason_packages = home .. "/.local/share/nvim/mason/packages"
|
||||
local path_to_mason_packages = path_to_nvim_packages .. "/mason/packages"
|
||||
|
||||
local path_to_jdtls = path_to_mason_packages .. "/jdtls"
|
||||
local path_to_java_dap = path_to_mason_packages .. "/java-debug-adapter"
|
||||
@ -27,7 +27,7 @@ function M.setup()
|
||||
local path_to_jar = vim.fn.glob(path_to_jdtls .. "/plugins/org.eclipse.equinox.launcher_*.jar", true)
|
||||
|
||||
local bundles = {
|
||||
-- vim.fn.glob(path_to_java_dap .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", true),
|
||||
vim.fn.glob(path_to_java_dap .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", true),
|
||||
vim.fn.glob(
|
||||
path_to_nvim_packages
|
||||
.. "/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar"
|
||||
@ -35,61 +35,40 @@ function M.setup()
|
||||
}
|
||||
vim.list_extend(bundles, vim.split(vim.fn.glob(path_to_nvim_packages .. "/vscode-java-test/server/*.jar"), "\n"))
|
||||
|
||||
-- vim.list_extend(bundles, vim.split(vim.fn.glob(path_to_jtest .. "/extension/server/*.jar", true), "\n"))
|
||||
vim.list_extend(bundles, vim.split(vim.fn.glob(path_to_jtest .. "/extension/server/*.jar", true), "\n"))
|
||||
|
||||
local on_attach = function(_, bufnr)
|
||||
-- Regular Neovim LSP client keymappings
|
||||
local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||
local telescope = require("telescope.builtin")
|
||||
utils.nmapkey("gR", telescope.lsp_references, "Go to references", opts)
|
||||
utils.nmapkey("gD", jdtls.declaration, "Go to declaration", opts)
|
||||
utils.nmapkey("K", jdtls.hover, "Hover text", opts)
|
||||
utils.nmapkey("gd", jdtls.definition, "Go to definition", opts)
|
||||
utils.nmapkey("gi", jdtls.implementation, "Go to implementation", opts)
|
||||
utils.nmapkey("gt", telescope.lsp_type_definitions, "Show LSP type definitions", opts)
|
||||
utils.nmapkey("<C-k>", jdtls.signature_help, "Show signature", opts)
|
||||
local on_attach = function(ev, bufnr)
|
||||
local opts = { buffer = ev.buf, silent = true }
|
||||
utils.common_mappings(opts)
|
||||
|
||||
utils.nmapkey("<leader>wa", jdtls.add_workspace_folder, "Add workspace folder", opts)
|
||||
utils.nmapkey("<leader>wr", jdtls.remove_workspace_folder, "Remove workspace folder", opts)
|
||||
utils.nmapkey("<leader>wl", function()
|
||||
print(vim.inspect(jdtls.list_workspace_folders()))
|
||||
end, "List workspace folders", opts)
|
||||
|
||||
utils.nmapkey("<leader>D", telescope.diagnostics({ bufnr = 0 }), "Show buffer diagnostics", opts) -- show diagnostics for file
|
||||
utils.nmapkey("<leader>d", vim.diagnostic.open_float, "Show line diagnostics", opts) -- show diagnostics for line
|
||||
utils.nmapkey("[d", function()
|
||||
vim.diagnostic.jump({ count = -1, float = true })
|
||||
end, "Go to previous diagnostic", opts) -- jump to previous diagnostic in buffer
|
||||
utils.nmapkey("]d", function()
|
||||
vim.diagnostic.jump({ count = 1, float = true })
|
||||
end, "Go to next diagnostic", opts) -- jump to next diagnostic in buffer
|
||||
utils.nmapkey("<leader>rs", "<cmd>LspRestart<cr>", "Restart LSP", opts) -- mapping to restart lsp if necessary
|
||||
|
||||
-- Java extensions provided by jdtls
|
||||
-- Java specific
|
||||
utils.nmapkey("<leader>di", jdtls.organize_imports, "Organize imports", opts)
|
||||
utils.nmapkey("<leader>dt", jdtls.test_class, "Test class", opts)
|
||||
utils.nmapkey("<leader>dn", jdtls.test_nearest_method, "Test nearest method", opts)
|
||||
utils.nvmapkey("<leader>dm", jdtls.extract_method, "Extract method", opts)
|
||||
utils.nvmapkey("<leader>dv", jdtls.extract_variable, "Extract variable", opts)
|
||||
utils.nvmapkey("<leader>dc", jdtls.extract_constant, "Extract constant", opts)
|
||||
jdtls.setup_dap({ hotcodereplace = "auto" })
|
||||
jdtls_dap.setup_dap_main_class_configs()
|
||||
jdtls_setup.add_commands()
|
||||
|
||||
utils.nmapkey("<leader>cf", jdtls.formatting, "LSP Format", opts)
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
|
||||
vim.lsp.buf.format()
|
||||
end, { desc = "Format current buffer with LSP" })
|
||||
|
||||
utils.nmapkey("<C-o>", jdtls.organize_imports, "Organize imports", opts)
|
||||
utils.mapkey({ "n", "v" }, "<leader>ev", jdtls.extract_variable, "Extract variable", opts)
|
||||
utils.mapkey({ "n", "v" }, "<leader>ec", jdtls.extract_constant, "Extract constant", opts)
|
||||
utils.mapkey({ "n", "v" }, "<leader>em", jdtls.extract_variable, "Extract method", opts)
|
||||
require("lsp_signature").on_attach({
|
||||
bind = true,
|
||||
padding = "",
|
||||
handler_opts = {
|
||||
border = "rounded",
|
||||
},
|
||||
hint_prefix = " ",
|
||||
}, bufnr)
|
||||
end
|
||||
|
||||
local config = {
|
||||
init_options = {
|
||||
bundles = vim.split(vim.fn.glob("/home/iborrelli/pde/extension/server/*.jar"), "\n"),
|
||||
},
|
||||
flags = {
|
||||
allow_incremental_sync = true,
|
||||
},
|
||||
on_attach = on_attach, -- We pass our on_attach keybindings to the configuration map
|
||||
}
|
||||
|
||||
config.cmd = {
|
||||
"/usr/lib/jvm/java-21-openjdk/bin/java",
|
||||
local cmd = {
|
||||
"/usr/lib/jvm/java-1.21.0-openjdk-amd64/bin/java",
|
||||
|
||||
"-Declipse.application=org.eclipse.jdt.ls.core.id1",
|
||||
"-Dosgi.bundles.defaultStartLevel=4",
|
||||
@ -113,29 +92,28 @@ function M.setup()
|
||||
"-data",
|
||||
workspace_dir,
|
||||
}
|
||||
-- print(table.concat(config.cmd, " "))
|
||||
-- print(vim.inspect(config.cmd))
|
||||
|
||||
config.settings = {
|
||||
local settings = {
|
||||
java = {
|
||||
references = {
|
||||
includeDecompiledSources = true,
|
||||
},
|
||||
-- format = {
|
||||
-- enabled = true,
|
||||
-- settings = {
|
||||
-- url = vim.fn.stdpath("config") .. "/lang_servers/intellij-java-google-style.xml",
|
||||
-- profile = "GoogleStyle",
|
||||
-- },
|
||||
-- },
|
||||
-- TODO: enable
|
||||
format = {
|
||||
enabled = false,
|
||||
settings = {
|
||||
url = vim.fn.stdpath("config") .. "/lang_servers/intellij-java-google-style.xml",
|
||||
profile = "GoogleStyle",
|
||||
},
|
||||
},
|
||||
eclipse = {
|
||||
downloadSources = true,
|
||||
},
|
||||
maven = {
|
||||
downloadSources = true,
|
||||
},
|
||||
-- signatureHelp = { enabled = true },
|
||||
-- contentProvider = { preferred = "fernflower" },
|
||||
signatureHelp = { enabled = true },
|
||||
contentProvider = { preferred = "fernflower" },
|
||||
implementationsCodeLens = {
|
||||
enabled = true,
|
||||
},
|
||||
@ -176,89 +154,77 @@ function M.setup()
|
||||
staticStarThreshold = 9999,
|
||||
},
|
||||
},
|
||||
-- codeGeneration = {
|
||||
-- toString = {
|
||||
-- template = "${object.className}{${member.name()}=${member.value}, ${otherMembers}}",
|
||||
-- -- flags = {
|
||||
-- -- allow_incremental_sync = true,
|
||||
-- -- },
|
||||
-- },
|
||||
-- useBlocks = true,
|
||||
-- },
|
||||
codeGeneration = {
|
||||
toString = {
|
||||
template = "${object.className}{${member.name()}=${member.value}, ${otherMembers}}",
|
||||
},
|
||||
useBlocks = true,
|
||||
},
|
||||
configuration = {
|
||||
updateBuildConfiguration = "automatic",
|
||||
runtimes = {
|
||||
{
|
||||
name = "JavaSE-17",
|
||||
path = "/usr/lib/jvm/java-17-openjdk/",
|
||||
path = os.getenv("JAVA_17_HOME"),
|
||||
},
|
||||
{
|
||||
name = "JavaSE-21",
|
||||
path = "/usr/lib/jvm/java-21-openjdk/",
|
||||
path = os.getenv("JAVA_21_HOME"),
|
||||
},
|
||||
},
|
||||
},
|
||||
-- project = {
|
||||
-- referencedLibraries = {
|
||||
-- "**/lib/*.jar",
|
||||
-- },
|
||||
-- },
|
||||
},
|
||||
}
|
||||
-- -- LSP settings for Java.
|
||||
-- local on_attach = function(_, bufnr)
|
||||
-- jdtls.setup_dap({ hotcodereplace = "auto" })
|
||||
-- jdtls_dap.setup_dap_main_class_configs()
|
||||
-- jdtls_setup.add_commands()
|
||||
--
|
||||
-- -- Create a command `:Format` local to the LSP buffer
|
||||
-- vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
|
||||
-- vim.lsp.buf.format()
|
||||
-- end, { desc = "Format current buffer with LSP" })
|
||||
--
|
||||
-- require("lsp_signature").on_attach({
|
||||
-- bind = true,
|
||||
-- padding = "",
|
||||
-- handler_opts = {
|
||||
-- border = "rounded",
|
||||
-- },
|
||||
-- hint_prefix = " ",
|
||||
-- }, bufnr)
|
||||
--
|
||||
-- -- NOTE: comment out if you don't use Lspsaga
|
||||
-- -- require("lspsaga").init_lsp_saga()
|
||||
-- end
|
||||
|
||||
local capabilities = {
|
||||
workspace = {
|
||||
configuration = true,
|
||||
},
|
||||
textDocument = {
|
||||
completion = {
|
||||
completionItem = {
|
||||
snippetSupport = true,
|
||||
project = {
|
||||
referencedLibraries = {
|
||||
"**/lib/*.jar",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
config.on_attach = on_attach
|
||||
config.capabilities = capabilities
|
||||
config.on_init = function(client, _)
|
||||
client.notify("workspace/didChangeConfiguration", { settings = config.settings })
|
||||
end
|
||||
|
||||
local extendedClientCapabilities = require("jdtls").extendedClientCapabilities
|
||||
local extendedClientCapabilities = jdtls.extendedClientCapabilities
|
||||
extendedClientCapabilities.resolveAdditionalTextEditsSupport = true
|
||||
|
||||
config.init_options = {
|
||||
extendedClientCapabilities = extendedClientCapabilities,
|
||||
local config = {
|
||||
flags = {
|
||||
allow_incremental_sync = true,
|
||||
},
|
||||
init_options = {
|
||||
bundles = vim.split(vim.fn.glob("/home/iborrelli/pde/extension/server/*.jar"), "\n"),
|
||||
extendedClientCapabilities = extendedClientCapabilities,
|
||||
},
|
||||
on_init = function(client)
|
||||
client.notify("workspace/didChangeConfiguration", { settings = settings })
|
||||
end,
|
||||
settings = settings,
|
||||
|
||||
cmd = cmd,
|
||||
on_attach = on_attach,
|
||||
capabilities = {
|
||||
workspace = {
|
||||
configuration = true,
|
||||
},
|
||||
textDocument = {
|
||||
completion = {
|
||||
completionItem = {
|
||||
snippetSupport = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Start Server
|
||||
require("jdtls").start_or_attach(config)
|
||||
jdtls.start_or_attach(config)
|
||||
|
||||
-- -- Set Java Specific Keymaps
|
||||
-- require("jdtls.keymaps")
|
||||
vim.cmd(
|
||||
"command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_compile JdtCompile lua require('jdtls').compile(<f-args>)"
|
||||
)
|
||||
vim.cmd(
|
||||
"command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_set_runtime JdtSetRuntime lua require('jdtls').set_runtime(<f-args>)"
|
||||
)
|
||||
vim.cmd("command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config()")
|
||||
vim.cmd("command! -buffer JdtJol lua require('jdtls').jol()")
|
||||
vim.cmd("command! -buffer JdtBytecode lua require('jdtls').javap()")
|
||||
vim.cmd("command! -buffer JdtJshell lua require('jdtls').jshell()")
|
||||
end
|
||||
return M
|
||||
|
||||
@ -1,104 +0,0 @@
|
||||
-- NOTE: Java specific keymaps with which key
|
||||
vim.cmd(
|
||||
"command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_compile JdtCompile lua require('jdtls').compile(<f-args>)"
|
||||
)
|
||||
vim.cmd(
|
||||
"command! -buffer -nargs=? -complete=custom,v:lua.require'jdtls'._complete_set_runtime JdtSetRuntime lua require('jdtls').set_runtime(<f-args>)"
|
||||
)
|
||||
vim.cmd("command! -buffer JdtUpdateConfig lua require('jdtls').update_project_config()")
|
||||
vim.cmd("command! -buffer JdtJol lua require('jdtls').jol()")
|
||||
vim.cmd("command! -buffer JdtBytecode lua require('jdtls').javap()")
|
||||
vim.cmd("command! -buffer JdtJshell lua require('jdtls').jshell()")
|
||||
|
||||
local status_ok, which_key = pcall(require, "which-key")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local opts = {
|
||||
mode = "n", -- NORMAL mode
|
||||
prefix = "<leader>",
|
||||
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
|
||||
silent = true, -- use `silent` when creating keymaps
|
||||
noremap = true, -- use `noremap` when creating keymaps
|
||||
nowait = true, -- use `nowait` when creating keymaps
|
||||
}
|
||||
|
||||
local vopts = {
|
||||
mode = "v", -- VISUAL mode
|
||||
prefix = "<leader>",
|
||||
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
|
||||
silent = true, -- use `silent` when creating keymaps
|
||||
noremap = true, -- use `noremap` when creating keymaps
|
||||
nowait = true, -- use `nowait` when creating keymaps
|
||||
}
|
||||
|
||||
local mappings = {
|
||||
J = {
|
||||
name = "Java",
|
||||
o = { "<Cmd>lua require'jdtls'.organize_imports()<CR>", "Organize Imports" },
|
||||
v = { "<Cmd>lua require('jdtls').extract_variable()<CR>", "Extract Variable" },
|
||||
c = { "<Cmd>lua require('jdtls').extract_constant()<CR>", "Extract Constant" },
|
||||
t = { "<Cmd>lua require'jdtls'.test_nearest_method()<CR>", "Test Method" },
|
||||
T = { "<Cmd>lua require'jdtls'.test_class()<CR>", "Test Class" },
|
||||
u = { "<Cmd>JdtUpdateConfig<CR>", "Update Config" },
|
||||
},
|
||||
}
|
||||
|
||||
local vmappings = {
|
||||
J = {
|
||||
name = "Java",
|
||||
v = { "<Esc><Cmd>lua require('jdtls').extract_variable(true)<CR>", "Extract Variable" },
|
||||
c = { "<Esc><Cmd>lua require('jdtls').extract_constant(true)<CR>", "Extract Constant" },
|
||||
m = { "<Esc><Cmd>lua require('jdtls').extract_method(true)<CR>", "Extract Method" },
|
||||
},
|
||||
}
|
||||
|
||||
which_key.register(mappings, opts)
|
||||
which_key.register(vmappings, vopts)
|
||||
|
||||
-- If you want you can add here Old School Mappings. Me I setup Telescope, LSP and Lspsaga mapping somewhere else and I just reuse them
|
||||
|
||||
-- vim.keymap.set("gI", vim.lsp.buf.implementation,{ desc = "[G]oto [I]mplementation" })
|
||||
-- vim.keymap.set("<leader>D", vim.lsp.buf.type_definition,{ desc = "Type [D]definition" })
|
||||
-- vim.keymap.set("<leader>hh", vim.lsp.buf.signature_help,{ desc = "Signature [H][H]elp Documentation" })
|
||||
|
||||
-- vim.keymap.set("gD", vim.lsp.buf.declaration,{ desc = "[G]oto [D]eclaration" })
|
||||
-- vim.keymap.set("<leader>wa", vim.lsp.buf.add_workspace_folder,{ desc = "[W]orkspace [A]dd Folder" })
|
||||
-- vim.keymap.set("<leader>wr", vim.lsp.buf.remove_workspace_folder,{ desc = "[W]orkspace [R]emove Folder" })
|
||||
-- vim.keymap.set("<leader>wl", function()
|
||||
-- print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
-- end, "[W]orkspace [L]ist Folders")
|
||||
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
-- vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
|
||||
-- vim.lsp.buf.format()
|
||||
-- end, { desc = "Format current buffer with LSP" })
|
||||
|
||||
-- vim.keymap.set("n", "gr", vim.lsp.buf.references, { desc = "[G]oto [R]eferences - Java", expr = true, silent = true })
|
||||
vim.keymap.set("n", "gr", require("telescope.builtin").lsp_references, { desc = "[G]oto [R]eferences" })
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { desc = "" })
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "" })
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, { desc = "" })
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = "" })
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, { desc = "" })
|
||||
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, { desc = "" })
|
||||
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, { desc = "" })
|
||||
vim.keymap.set('n', '<leader>wl', print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', { desc = "" })
|
||||
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, { desc = "" })
|
||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, { desc = "" })
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references() && vim.cmd("copen")<CR>', { desc = "" })
|
||||
vim.keymap.set('n', '<leader>e', vim.lsp.diagnostic.show_line_diagnostics, { desc = "" })
|
||||
vim.keymap.set('n', '[d', vim.lsp.diagnostic.goto_prev, { desc = "" })
|
||||
vim.keymap.set('n', ']d', vim.lsp.diagnostic.goto_next, { desc = "" })
|
||||
vim.keymap.set('n', '<leader>q', vim.lsp.diagnostic.set_loclist, { desc = "" })
|
||||
|
||||
-- Java specific
|
||||
vim.keymap.set("n", "<leader>di", "<Cmd>lua require'jdtls'.organize_imports()<CR>", { desc = "" })
|
||||
vim.keymap.set("n", "<leader>dt", "<Cmd>lua require'jdtls'.test_class()<CR>", { desc = "" })
|
||||
vim.keymap.set("n", "<leader>dn", "<Cmd>lua require'jdtls'.test_nearest_method()<CR>", { desc = "" })
|
||||
vim.keymap.set("v", "<leader>de", "<Esc><Cmd>lua require('jdtls').extract_variable(true)<CR>", { desc = "" })
|
||||
vim.keymap.set("n", "<leader>de", "<Cmd>lua require('jdtls').extract_variable()<CR>", { desc = "" })
|
||||
vim.keymap.set("v", "<leader>dm", "<Esc><Cmd>lua require('jdtls').extract_method(true)<CR>", { desc = "" })
|
||||
|
||||
vim.keymap.set("n", "<leader>cf", "<cmd>lua vim.lsp.buf.formatting()<CR>", { desc = "" })
|
||||
@ -13,8 +13,8 @@ map("n", "<leader>k", "<C-w>k", opts)
|
||||
opts.desc = "Navigate window right"
|
||||
map("n", "<leader>l", "<C-w>l", opts)
|
||||
|
||||
opts.desc = "Save session, write all buffers and quit"
|
||||
map("n", "<leader>qqq", ':lua require("auto-session").SaveSession()<CR>:wqa<CR>', opts)
|
||||
opts.desc = "Visual copy"
|
||||
map("v", "<C-c>", '"+y', opts)
|
||||
|
||||
opts.desc = "Visual copy"
|
||||
map("v", "<C-c>", '"*y', opts)
|
||||
map("v", "<C-S-c>", '"+y', opts)
|
||||
|
||||
73
.config/nvim/lua/plugins/file_navigation/harpoon.lua
Normal file
73
.config/nvim/lua/plugins/file_navigation/harpoon.lua
Normal file
@ -0,0 +1,73 @@
|
||||
local utils = require("utils")
|
||||
return {
|
||||
"ThePrimeagen/harpoon",
|
||||
branch = "harpoon2",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
|
||||
config = function()
|
||||
local harpoon = require("harpoon")
|
||||
harpoon:setup()
|
||||
local list = harpoon:list()
|
||||
|
||||
utils.nmapkey("<leader>a", function()
|
||||
list:add()
|
||||
end, "Add to harpoon buffers")
|
||||
|
||||
utils.nmapkey("<C-h>", function()
|
||||
list:select(1)
|
||||
end, "Navigate to harpoon buffer 1")
|
||||
utils.nmapkey("<C-t>", function()
|
||||
list:select(2)
|
||||
end, "Navigate to harpoon buffer 2")
|
||||
utils.nmapkey("<C-n>", function()
|
||||
list:select(3)
|
||||
end, "Navigate to harpoon buffer 3")
|
||||
utils.nmapkey("<C-s>", function()
|
||||
list:select(4)
|
||||
end, "Navigate to harpoon buffer 1")
|
||||
|
||||
-- Toggle previous & next buffers stored within Harpoon list
|
||||
utils.nmapkey("<C-A-p>", function()
|
||||
list:prev()
|
||||
end, "Go to previous harpoon buffer")
|
||||
utils.nmapkey("<C-A-n>", function()
|
||||
list:next()
|
||||
end, "Go to next harpoon buffer")
|
||||
|
||||
-- Remove current buffer from list
|
||||
utils.nmapkey("<C-A-e>", function()
|
||||
list:remove()
|
||||
end, "Remove current buffer from harpoon list")
|
||||
|
||||
-- Reset buffer
|
||||
utils.nmapkey("<C-A-r>", function()
|
||||
for _, item in ipairs(list.items) do
|
||||
list:remove(item)
|
||||
end
|
||||
end, "Reset harpoon list")
|
||||
|
||||
-- basic telescope configuration
|
||||
local conf = require("telescope.config").values
|
||||
local function toggle_telescope(harpoon_files)
|
||||
local file_paths = {}
|
||||
for _, item in ipairs(harpoon_files.items) do
|
||||
table.insert(file_paths, item.value)
|
||||
end
|
||||
|
||||
require("telescope.pickers")
|
||||
.new({}, {
|
||||
prompt_title = "Harpoon",
|
||||
finder = require("telescope.finders").new_table({
|
||||
results = file_paths,
|
||||
}),
|
||||
previewer = conf.file_previewer({}),
|
||||
sorter = conf.generic_sorter({}),
|
||||
})
|
||||
:find()
|
||||
end
|
||||
|
||||
utils.nmapkey("<C-e>", function()
|
||||
toggle_telescope(list)
|
||||
end, "Open harpoon window")
|
||||
end,
|
||||
}
|
||||
@ -1,62 +0,0 @@
|
||||
local utils = require("utils")
|
||||
return {
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v2.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
opts = {
|
||||
window = { position = "current" },
|
||||
},
|
||||
config = function()
|
||||
require("neo-tree").setup({
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
visible = true, -- Show files and folders starting with a dot `.`
|
||||
hide_dotfiles = false,
|
||||
hide_gitignored = false,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local keymap = vim.keymap
|
||||
local opts = { noremap = true, silent = true }
|
||||
utils.nmapkey("<leader>e", function()
|
||||
require("neo-tree.command").execute({
|
||||
position = "left",
|
||||
action = "toggle",
|
||||
})
|
||||
end, "Toggle Neotree", opts)
|
||||
utils.nmapkey("<leader>ee", function()
|
||||
require("neo-tree.command").execute({
|
||||
position = "left",
|
||||
focus = "true",
|
||||
})
|
||||
end, "Open Neotree", opts)
|
||||
utils.nmapkey("<leader>qe", function()
|
||||
require("neo-tree.command").execute({
|
||||
position = "left",
|
||||
action = "close",
|
||||
focus = "true",
|
||||
})
|
||||
end, "Close Neotree", opts)
|
||||
|
||||
utils.mapkey({ "n", "v" }, "|", "<cmd>Neotree reveal<cr>", "Reveal file in Neotree", opts)
|
||||
utils.nmapkey(
|
||||
"<leader>eb",
|
||||
"<cmd>Neotree toggle show buffers right<cr>",
|
||||
"Show buffers (Neotree)",
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
utils.nmapkey(
|
||||
"<leader>gs",
|
||||
"<cmd>Neotree float git_status<cr>",
|
||||
"Show git status (Neotree)",
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
end,
|
||||
},
|
||||
}
|
||||
38
.config/nvim/lua/plugins/file_navigation/oil.lua
Normal file
38
.config/nvim/lua/plugins/file_navigation/oil.lua
Normal file
@ -0,0 +1,38 @@
|
||||
return {
|
||||
{
|
||||
"stevearc/oil.nvim",
|
||||
---@module 'oil'
|
||||
---@type oil.SetupOpts
|
||||
opts = {},
|
||||
dependencies = { { "echasnovski/mini.icons", opts = {} } },
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("oil").setup({
|
||||
delete_to_trash = true,
|
||||
keymaps = {
|
||||
["<esc>"] = { "actions.close", mode = "n" },
|
||||
},
|
||||
win_options = {
|
||||
signcolumn = "yes:2",
|
||||
},
|
||||
})
|
||||
local utils = require("utils")
|
||||
utils.nmapkey("-", "<cmd>Oil --float<cr>", "Open parent directory")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"JezerM/oil-lsp-diagnostics.nvim",
|
||||
dependencies = { "stevearc/oil.nvim" },
|
||||
},
|
||||
{
|
||||
"benomahony/oil-git.nvim",
|
||||
dependencies = { "stevearc/oil.nvim" },
|
||||
},
|
||||
{
|
||||
"refractalize/oil-git-status.nvim",
|
||||
dependencies = {
|
||||
"stevearc/oil.nvim",
|
||||
},
|
||||
config = true,
|
||||
},
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
local utils = require("utils")
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.8",
|
||||
@ -5,7 +6,7 @@ return {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"folke/todo-comments.nvim",
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, -- fuzzy search
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
},
|
||||
config = function()
|
||||
local telescope = require("telescope")
|
||||
@ -13,11 +14,10 @@ return {
|
||||
local actions = require("telescope.actions")
|
||||
local open_with_trouble = trouble_telescope.open
|
||||
|
||||
-- Use this to add more results without clearing the trouble list
|
||||
local add_to_trouble = require("trouble.sources.telescope").add
|
||||
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
layout_strategy = "center",
|
||||
layout_config = { width = 120 },
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
@ -26,29 +26,22 @@ return {
|
||||
["<PageDown>"] = actions.preview_scrolling_down,
|
||||
["<C-t>"] = open_with_trouble,
|
||||
},
|
||||
n = { ["<C-t>"] = open_with_trouble },
|
||||
},
|
||||
},
|
||||
})
|
||||
telescope.load_extension("fzf")
|
||||
|
||||
-- Set keymaps to load pickers
|
||||
local keymap = vim.keymap
|
||||
keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "Fuzzy find files in cwd (Telescope)" })
|
||||
keymap.set(
|
||||
"n",
|
||||
"<leader>fr",
|
||||
"<cmd>Telescope oldfiles cwd_only=true<cr>",
|
||||
{ desc = "Fuzzy find recent files (Telescope)" }
|
||||
)
|
||||
keymap.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>", { desc = "Find string in cwd (Telescope)" })
|
||||
keymap.set("v", "fs", "<cmd>Telescope live_grep<cr>", { desc = "Find string in cwd (Telescope)" })
|
||||
keymap.set(
|
||||
"n",
|
||||
"<leader>fc",
|
||||
"<cmd>Telescope grep_string<cr>",
|
||||
{ desc = "Find string under cursor in cwd (Telescope)" }
|
||||
)
|
||||
keymap.set("n", "<leader>ft", "<cmd>TodoTelescope<cr>", { desc = "Find todos (Telescope)" })
|
||||
local builtin = require("telescope.builtin")
|
||||
utils.nmapkey("<leader>ff", function()
|
||||
builtin.find_files(require("telescope.themes").get_dropdown({}))
|
||||
end, "Telescope [f]ind [f]iles in cwd")
|
||||
utils.nmapkey("<leader>fr", function()
|
||||
builtin.oldfiles({ cwd_only = true })
|
||||
end, "Telescope [f]ind [r]ecent files")
|
||||
utils.nmapkey("<leader>fs", builtin.live_grep, "Telescope [f]ind [s]tring in cwd")
|
||||
utils.nmapkey("<leader>fc", builtin.grep_string, "Telescope [f]ind string under [c]ursor in cwd")
|
||||
utils.nmapkey("<leader>ft", "<cmd>TodoTelescope<cr>", "Telescope [f]ind [t]odos")
|
||||
utils.nmapkey("<leader>fb", builtin.buffers, "Telescope [f]ind [b]uffer")
|
||||
end,
|
||||
}
|
||||
|
||||
3
.config/nvim/lua/plugins/git/diffview.lua
Normal file
3
.config/nvim/lua/plugins/git/diffview.lua
Normal file
@ -0,0 +1,3 @@
|
||||
return {
|
||||
"sindrets/diffview.nvim",
|
||||
}
|
||||
3
.config/nvim/lua/plugins/git/fugitive.lua
Normal file
3
.config/nvim/lua/plugins/git/fugitive.lua
Normal file
@ -0,0 +1,3 @@
|
||||
return {
|
||||
"tpope/vim-fugitive",
|
||||
}
|
||||
@ -4,9 +4,8 @@ return {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"sindrets/diffview.nvim",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"ibhagwan/fzf-lua",
|
||||
"echasnovski/mini.pick",
|
||||
"folke/snacks.nvim",
|
||||
},
|
||||
keys = { { "<leader>gg", "<cmd>Neogit<cr>", desc = "Open Neogit (Neogit)" } },
|
||||
config = function()
|
||||
local neogit = require("neogit")
|
||||
end,
|
||||
}
|
||||
@ -48,7 +48,6 @@ return {
|
||||
typescriptreact = { decide_js_formatter() },
|
||||
yaml = { "yamlfmt" },
|
||||
xml = { "xmlformatter" },
|
||||
["*"] = { "codespell" },
|
||||
},
|
||||
|
||||
formatters = {
|
||||
|
||||
@ -6,5 +6,5 @@ return {
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
opts = {}, -- options, see default configuration
|
||||
keys = { { "<Leader>G", "<cmd>Gradle<cr>", desc = "Gradle" } },
|
||||
keys = { { "<leader>lg", "<cmd>Gradle<cr>", desc = "Gradle" } },
|
||||
}
|
||||
|
||||
@ -24,9 +24,53 @@ return {
|
||||
-- Loads vscode style snippets from installed plugins (e.g. friendly-snippets)
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
local mapping = cmp.mapping.preset.insert({
|
||||
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
||||
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4), -- scroll down in docs
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4), -- scroll up in docs
|
||||
["<C-Up>"] = cmp.mapping.scroll_docs(-4), -- scroll down in docs
|
||||
["<C-Down>"] = cmp.mapping.scroll_docs(4), -- scroll up in docs
|
||||
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
||||
|
||||
-- On CR, insert selected snippet or completion
|
||||
["<CR>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
if luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
else
|
||||
cmp.confirm({
|
||||
select = true,
|
||||
})
|
||||
end
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
|
||||
-- On tab with completion open, go to next option
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s", "c" }),
|
||||
|
||||
-- On shift tab with completion open, go to prev option
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s", "c" }),
|
||||
})
|
||||
|
||||
-- `/` cmdline setup.
|
||||
cmp.setup.cmdline("/", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
mapping = mapping,
|
||||
sources = {
|
||||
{ name = "buffer" },
|
||||
},
|
||||
@ -34,7 +78,10 @@ return {
|
||||
|
||||
-- `:` cmdline setup.
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
completion = {
|
||||
completeopt = "menu,menuone,preview,noselect",
|
||||
},
|
||||
mapping = mapping,
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
@ -55,7 +102,7 @@ return {
|
||||
-- preview: preview window explaining the offered completion
|
||||
-- select: select an option automatically (noselect is the reverse)
|
||||
completion = {
|
||||
completeopt = "menu,menuone,preview,select",
|
||||
completeopt = "menu,menuone,preview,noselect",
|
||||
},
|
||||
-- Configure how nvim-cmp interacts with snippet engine
|
||||
snippet = {
|
||||
@ -63,15 +110,8 @@ return {
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
||||
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4), -- scroll down in docs
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4), -- scroll up in docs
|
||||
["<C-Up>"] = cmp.mapping.scroll_docs(-4), -- scroll down in docs
|
||||
["<C-Down>"] = cmp.mapping.scroll_docs(4), -- scroll up in docs
|
||||
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
||||
|
||||
mapping = mapping.insert({
|
||||
["<C-l>"] = cmp.mapping.complete({
|
||||
config = { sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
@ -82,22 +122,6 @@ return {
|
||||
{ name = "luasnip" },
|
||||
} },
|
||||
}), -- show only snippet completions
|
||||
|
||||
-- On CR, insert selected snippet or completion
|
||||
["<CR>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
if luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
else
|
||||
cmp.confirm({
|
||||
select = true,
|
||||
})
|
||||
end
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
|
||||
-- On tab with completion open, go to next option
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
|
||||
@ -29,6 +29,7 @@ return {
|
||||
"emmet_ls",
|
||||
"eslint",
|
||||
"groovyls",
|
||||
"hls",
|
||||
"html",
|
||||
"jdtls",
|
||||
"jsonls",
|
||||
@ -51,13 +52,13 @@ return {
|
||||
"black",
|
||||
"checkstyle",
|
||||
"chrome-debug-adapter",
|
||||
"codespell",
|
||||
"eslint_d",
|
||||
"firefox-debug-adapter",
|
||||
"flake8",
|
||||
"fourmolu",
|
||||
"isort",
|
||||
"java-debug-adapter",
|
||||
"java-test",
|
||||
"jq",
|
||||
"markdownlint",
|
||||
"matlab-language-server",
|
||||
|
||||
@ -24,25 +24,7 @@ return {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = function(ev)
|
||||
local opts = { buffer = ev.buf, silent = true }
|
||||
local telescope = require("telescope.builtin")
|
||||
|
||||
utils.nmapkey("gR", telescope.lsp_references, "Show LSP references", opts) -- show definition, references
|
||||
utils.nmapkey("gD", vim.lsp.buf.declaration, "Go to declaration", opts) -- go to declaration
|
||||
utils.nmapkey("K", vim.lsp.buf.hover, "Show documentation for what is under cursor", opts) -- show documentation for what is under cursor
|
||||
utils.nmapkey("gd", telescope.lsp_definitions, "Show LSP definitions", opts)
|
||||
utils.nmapkey("gi", telescope.lsp_implementations, "Show LSP implementations", opts)
|
||||
utils.nmapkey("gt", telescope.lsp_type_definitions, "Show LSP type definitions", opts)
|
||||
utils.mapkey({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, "See available code actions", opts) -- see available code actions
|
||||
utils.nmapkey("<leader>rn", vim.lsp.buf.rename, "Smart rename", opts) -- smart rename
|
||||
utils.nmapkey("<leader>D", telescope.diagnostics, "Show buffer diagnostics", opts) -- show diagnostics for file
|
||||
utils.nmapkey("<leader>d", vim.diagnostic.open_float, "Show line diagnostics", opts) -- show diagnostics for line
|
||||
utils.nmapkey("[d", function()
|
||||
vim.diagnostic.jump({ count = -1, float = true })
|
||||
end, "Go to previous diagnostic", opts) -- jump to previous diagnostic in buffer
|
||||
utils.nmapkey("]d", function()
|
||||
vim.diagnostic.jump({ count = 1, float = true })
|
||||
end, "Go to next diagnostic", opts) -- jump to next diagnostic in buffer
|
||||
utils.nmapkey("<leader>rs", "<cmd>LspRestart<cr>", "Restart LSP", opts) -- mapping to restart lsp if necessary
|
||||
utils.common_mappings(opts)
|
||||
end,
|
||||
})
|
||||
|
||||
@ -50,46 +32,25 @@ return {
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
-- Configure for language servers
|
||||
-- lua_ls
|
||||
vim.lsp.config("lua_ls", {
|
||||
settings = {
|
||||
Lua = {
|
||||
capabilities = capabilities,
|
||||
},
|
||||
},
|
||||
on_init = function(client)
|
||||
print(client.root_dir)
|
||||
if client.workspace_folders then
|
||||
local path = client.workspace_folders[1].name
|
||||
print(path)
|
||||
if
|
||||
path ~= vim.fn.stdpath("config")
|
||||
and (vim.uv.fs_stat(path .. "/.luarc.json") or vim.uv.fs_stat(path .. "/.luarc.jsonc"))
|
||||
then
|
||||
print(path)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
-- Tell the language server how to find Lua modules same way as Neovim
|
||||
-- (see `:h lua-module-load`)
|
||||
path = {
|
||||
"lua/?.lua",
|
||||
"lua/?/init.lua",
|
||||
},
|
||||
},
|
||||
-- Make the server aware of Neovim runtime files
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
"${3rd}/luv/library",
|
||||
},
|
||||
},
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- ts_ls
|
||||
vim.lsp.config("ts_ls", {
|
||||
on_attach = function(client)
|
||||
-- Disable formatting capability for tsserver (see conform.lua and nvim-lint.lua)
|
||||
@ -141,5 +102,15 @@ return {
|
||||
},
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
vim.lsp.config("hls", {
|
||||
capabilities = capabilities,
|
||||
filetypes = { "haskell", "lhaskell", "cabal" },
|
||||
settings = {
|
||||
haskell = {
|
||||
formattingProvider = "fourmolu",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ return {
|
||||
themery.setup({
|
||||
-- List of swappable colorschemes.
|
||||
themes = {
|
||||
"cuddlefish",
|
||||
"cuddlefish",
|
||||
"deeper-night",
|
||||
"onedark_dark",
|
||||
"dracula",
|
||||
|
||||
@ -1,61 +0,0 @@
|
||||
return {
|
||||
"romgrk/barbar.nvim",
|
||||
dependencies = {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
init = function()
|
||||
vim.g.barbar_auto_setup = false
|
||||
end,
|
||||
config = function()
|
||||
require("barbar").setup({
|
||||
animation = true,
|
||||
auto_hide = true,
|
||||
clickable = true,
|
||||
})
|
||||
|
||||
local map = vim.api.nvim_set_keymap
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- Move to previous/next
|
||||
map("n", "<leader>,", "<cmd>BufferPrevious<CR>", opts)
|
||||
map("n", "<leader>.", "<cmd>BufferNext<CR>", opts)
|
||||
map("n", "<leader><S-Tab>", "<cmd>BufferPrevious<CR>", opts)
|
||||
map("n", "<leader><Tab>", "<cmd>BufferNext<CR>", opts)
|
||||
|
||||
-- Re-order to previous/next
|
||||
map("n", "<leader><", "<cmd>BufferMovePrevious<CR>", opts)
|
||||
map("n", "<leader>>", "<cmd>BufferMoveNext<CR>", opts)
|
||||
|
||||
-- Goto buffer in position...
|
||||
map("n", "<leader>1", "<cmd>BufferGoto 1<CR>", opts)
|
||||
map("n", "<leader>2", "<cmd>BufferGoto 2<CR>", opts)
|
||||
map("n", "<leader>3", "<cmd>BufferGoto 3<CR>", opts)
|
||||
map("n", "<leader>4", "<cmd>BufferGoto 4<CR>", opts)
|
||||
map("n", "<leader>5", "<cmd>BufferGoto 5<CR>", opts)
|
||||
map("n", "<leader>6", "<cmd>BufferGoto 6<CR>", opts)
|
||||
map("n", "<leader>7", "<cmd>BufferGoto 7<CR>", opts)
|
||||
map("n", "<leader>8", "<cmd>BufferGoto 8<CR>", opts)
|
||||
map("n", "<leader>9", "<cmd>BufferGoto 9<CR>", opts)
|
||||
map("n", "<leader>0", "<cmd>BufferLast<CR>", opts)
|
||||
|
||||
-- Pin/unpin buffer
|
||||
map("n", "<leader>p", "<cmd>BufferPin<CR>", opts)
|
||||
|
||||
-- Close buffer
|
||||
map("n", "<leader>c", "<cmd>BufferClose<CR>", opts)
|
||||
|
||||
-- Magic buffer-picking mode
|
||||
map("n", "<C-p>", "<cmd>BufferPick<CR>", opts)
|
||||
map("n", "<C-x>", "<cmd>BufferPickDelete<CR>", opts)
|
||||
|
||||
-- Sort automatically by...
|
||||
map("n", "<leader>bb", "<cmd>BufferOrderByBufferNumber<CR>", opts)
|
||||
map("n", "<leader>bn", "<cmd>BufferOrderByName<CR>", opts)
|
||||
map("n", "<leader>bd", "<cmd>BufferOrderByDirectory<CR>", opts)
|
||||
--
|
||||
-- Wipeout buffer
|
||||
map("n", "<leader>bl", "<cmd>BufferOrderByLanguage<CR>", opts)
|
||||
map("n", "<leader>bw", "<cmd>BufferOrderByWindowNumber<CR>", opts)
|
||||
end,
|
||||
}
|
||||
@ -1,172 +0,0 @@
|
||||
return {
|
||||
"stevearc/dressing.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("dressing").setup({
|
||||
input = {
|
||||
-- Set to false to disable the vim.ui.input implementation
|
||||
enabled = true,
|
||||
|
||||
-- Default prompt string
|
||||
default_prompt = "Input",
|
||||
|
||||
-- Trim trailing `:` from prompt
|
||||
trim_prompt = true,
|
||||
|
||||
-- Can be 'left', 'right', or 'center'
|
||||
title_pos = "left",
|
||||
|
||||
-- The initial mode when the window opens (insert|normal|visual|select).
|
||||
start_mode = "insert",
|
||||
|
||||
-- These are passed to nvim_open_win
|
||||
border = "rounded",
|
||||
-- 'editor' and 'win' will default to being centered
|
||||
relative = "cursor",
|
||||
|
||||
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
|
||||
prefer_width = 40,
|
||||
width = nil,
|
||||
-- min_width and max_width can be a list of mixed types.
|
||||
-- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total"
|
||||
max_width = { 140, 0.9 },
|
||||
min_width = { 20, 0.2 },
|
||||
|
||||
buf_options = {},
|
||||
win_options = {
|
||||
-- Disable line wrapping
|
||||
wrap = false,
|
||||
-- Indicator for when text exceeds window
|
||||
list = true,
|
||||
listchars = "precedes:…,extends:…",
|
||||
-- Increase this for more context when text scrolls off the window
|
||||
sidescrolloff = 0,
|
||||
},
|
||||
|
||||
-- Set to `false` to disable
|
||||
mappings = {
|
||||
n = {
|
||||
["<Esc>"] = "Close",
|
||||
["<CR>"] = "Confirm",
|
||||
},
|
||||
i = {
|
||||
["<C-c>"] = "Close",
|
||||
["<CR>"] = "Confirm",
|
||||
["<Up>"] = "HistoryPrev",
|
||||
["<Down>"] = "HistoryNext",
|
||||
},
|
||||
},
|
||||
|
||||
override = function(conf)
|
||||
-- This is the config that will be passed to nvim_open_win.
|
||||
-- Change values here to customize the layout
|
||||
return conf
|
||||
end,
|
||||
|
||||
-- see :help dressing_get_config
|
||||
get_config = nil,
|
||||
},
|
||||
select = {
|
||||
-- Set to false to disable the vim.ui.select implementation
|
||||
enabled = true,
|
||||
|
||||
-- Priority list of preferred vim.select implementations
|
||||
backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" },
|
||||
|
||||
-- Trim trailing `:` from prompt
|
||||
trim_prompt = true,
|
||||
|
||||
-- Options for telescope selector
|
||||
-- These are passed into the telescope picker directly. Can be used like:
|
||||
-- telescope = require('telescope.themes').get_ivy({...})
|
||||
telescope = nil,
|
||||
|
||||
-- Options for fzf selector
|
||||
fzf = {
|
||||
window = {
|
||||
width = 0.5,
|
||||
height = 0.4,
|
||||
},
|
||||
},
|
||||
|
||||
-- Options for fzf-lua
|
||||
fzf_lua = {
|
||||
-- winopts = {
|
||||
-- height = 0.5,
|
||||
-- width = 0.5,
|
||||
-- },
|
||||
},
|
||||
|
||||
-- Options for nui Menu
|
||||
nui = {
|
||||
position = "50%",
|
||||
size = nil,
|
||||
relative = "editor",
|
||||
border = {
|
||||
style = "rounded",
|
||||
},
|
||||
buf_options = {
|
||||
swapfile = false,
|
||||
filetype = "DressingSelect",
|
||||
},
|
||||
win_options = {
|
||||
winblend = 0,
|
||||
},
|
||||
max_width = 80,
|
||||
max_height = 40,
|
||||
min_width = 40,
|
||||
min_height = 10,
|
||||
},
|
||||
|
||||
-- Options for built-in selector
|
||||
builtin = {
|
||||
-- Display numbers for options and set up keymaps
|
||||
show_numbers = true,
|
||||
-- These are passed to nvim_open_win
|
||||
border = "rounded",
|
||||
-- 'editor' and 'win' will default to being centered
|
||||
relative = "editor",
|
||||
|
||||
buf_options = {},
|
||||
win_options = {
|
||||
cursorline = true,
|
||||
cursorlineopt = "both",
|
||||
-- disable highlighting for the brackets around the numbers
|
||||
winhighlight = "MatchParen:",
|
||||
-- adds padding at the left border
|
||||
statuscolumn = " ",
|
||||
},
|
||||
|
||||
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
|
||||
-- the min_ and max_ options can be a list of mixed types.
|
||||
-- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total"
|
||||
width = nil,
|
||||
max_width = { 140, 0.8 },
|
||||
min_width = { 40, 0.2 },
|
||||
height = nil,
|
||||
max_height = 0.9,
|
||||
min_height = { 10, 0.2 },
|
||||
|
||||
-- Set to `false` to disable
|
||||
mappings = {
|
||||
["<Esc>"] = "Close",
|
||||
["<C-c>"] = "Close",
|
||||
["<CR>"] = "Confirm",
|
||||
},
|
||||
|
||||
override = function(conf)
|
||||
-- This is the config that will be passed to nvim_open_win.
|
||||
-- Change values here to customize the layout
|
||||
return conf
|
||||
end,
|
||||
},
|
||||
|
||||
-- Used to override format_item. See :help dressing-format
|
||||
format_item_override = {},
|
||||
|
||||
-- see :help dressing_get_config
|
||||
get_config = nil,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
555
.config/nvim/lua/plugins/ui/snacks.lua
Normal file
555
.config/nvim/lua/plugins/ui/snacks.lua
Normal file
@ -0,0 +1,555 @@
|
||||
return {
|
||||
"folke/snacks.nvim",
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
---@type snacks.Config
|
||||
opts = {
|
||||
bigfile = { enabled = true },
|
||||
dashboard = { enabled = true },
|
||||
explorer = { enabled = true },
|
||||
indent = { enabled = true },
|
||||
input = { enabled = true },
|
||||
notifier = {
|
||||
enabled = true,
|
||||
timeout = 3000,
|
||||
},
|
||||
picker = { enabled = true },
|
||||
quickfile = { enabled = true },
|
||||
scope = { enabled = true },
|
||||
scroll = { enabled = true },
|
||||
statuscolumn = { enabled = true },
|
||||
words = { enabled = true },
|
||||
styles = {
|
||||
notification = {
|
||||
-- wo = { wrap = true } -- Wrap notifications
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
-- Top Pickers & Explorer
|
||||
{
|
||||
"<leader><space>",
|
||||
function()
|
||||
Snacks.picker.smart()
|
||||
end,
|
||||
desc = "Smart Find Files",
|
||||
},
|
||||
{
|
||||
"<leader>,",
|
||||
function()
|
||||
Snacks.picker.buffers()
|
||||
end,
|
||||
desc = "Buffers",
|
||||
},
|
||||
{
|
||||
"<leader>/",
|
||||
function()
|
||||
Snacks.picker.grep()
|
||||
end,
|
||||
desc = "Grep",
|
||||
},
|
||||
{
|
||||
"<leader>:",
|
||||
function()
|
||||
Snacks.picker.command_history()
|
||||
end,
|
||||
desc = "Command History",
|
||||
},
|
||||
{
|
||||
"<leader>n",
|
||||
function()
|
||||
Snacks.picker.notifications()
|
||||
end,
|
||||
desc = "Notification History",
|
||||
},
|
||||
{
|
||||
"<leader>e",
|
||||
function()
|
||||
Snacks.explorer()
|
||||
end,
|
||||
desc = "File Explorer",
|
||||
},
|
||||
-- find
|
||||
{
|
||||
"<leader>fb",
|
||||
function()
|
||||
Snacks.picker.buffers()
|
||||
end,
|
||||
desc = "Buffers",
|
||||
},
|
||||
{
|
||||
"<leader>fc",
|
||||
function()
|
||||
Snacks.picker.files({ cwd = vim.fn.stdpath("config") })
|
||||
end,
|
||||
desc = "Find Config File",
|
||||
},
|
||||
{
|
||||
"<leader>ff",
|
||||
function()
|
||||
Snacks.picker.files()
|
||||
end,
|
||||
desc = "Find Files",
|
||||
},
|
||||
{
|
||||
"<leader>fg",
|
||||
function()
|
||||
Snacks.picker.git_files()
|
||||
end,
|
||||
desc = "Find Git Files",
|
||||
},
|
||||
{
|
||||
"<leader>fp",
|
||||
function()
|
||||
Snacks.picker.projects()
|
||||
end,
|
||||
desc = "Projects",
|
||||
},
|
||||
{
|
||||
"<leader>fr",
|
||||
function()
|
||||
Snacks.picker.recent()
|
||||
end,
|
||||
desc = "Recent",
|
||||
},
|
||||
-- git
|
||||
{
|
||||
"<leader>gb",
|
||||
function()
|
||||
Snacks.picker.git_branches()
|
||||
end,
|
||||
desc = "Git Branches",
|
||||
},
|
||||
{
|
||||
"<leader>gl",
|
||||
function()
|
||||
Snacks.picker.git_log()
|
||||
end,
|
||||
desc = "Git Log",
|
||||
},
|
||||
{
|
||||
"<leader>gL",
|
||||
function()
|
||||
Snacks.picker.git_log_line()
|
||||
end,
|
||||
desc = "Git Log Line",
|
||||
},
|
||||
{
|
||||
"<leader>gs",
|
||||
function()
|
||||
Snacks.picker.git_status()
|
||||
end,
|
||||
desc = "Git Status",
|
||||
},
|
||||
{
|
||||
"<leader>gS",
|
||||
function()
|
||||
Snacks.picker.git_stash()
|
||||
end,
|
||||
desc = "Git Stash",
|
||||
},
|
||||
{
|
||||
"<leader>gd",
|
||||
function()
|
||||
Snacks.picker.git_diff()
|
||||
end,
|
||||
desc = "Git Diff (Hunks)",
|
||||
},
|
||||
{
|
||||
"<leader>gf",
|
||||
function()
|
||||
Snacks.picker.git_log_file()
|
||||
end,
|
||||
desc = "Git Log File",
|
||||
},
|
||||
-- Grep
|
||||
{
|
||||
"<leader>sb",
|
||||
function()
|
||||
Snacks.picker.lines()
|
||||
end,
|
||||
desc = "Buffer Lines",
|
||||
},
|
||||
{
|
||||
"<leader>sB",
|
||||
function()
|
||||
Snacks.picker.grep_buffers()
|
||||
end,
|
||||
desc = "Grep Open Buffers",
|
||||
},
|
||||
{
|
||||
"<leader>sg",
|
||||
function()
|
||||
Snacks.picker.grep()
|
||||
end,
|
||||
desc = "Grep",
|
||||
},
|
||||
{
|
||||
"<leader>sw",
|
||||
function()
|
||||
Snacks.picker.grep_word()
|
||||
end,
|
||||
desc = "Visual selection or word",
|
||||
mode = { "n", "x" },
|
||||
},
|
||||
-- search
|
||||
{
|
||||
'<leader>s"',
|
||||
function()
|
||||
Snacks.picker.registers()
|
||||
end,
|
||||
desc = "Registers",
|
||||
},
|
||||
{
|
||||
"<leader>s/",
|
||||
function()
|
||||
Snacks.picker.search_history()
|
||||
end,
|
||||
desc = "Search History",
|
||||
},
|
||||
{
|
||||
"<leader>sa",
|
||||
function()
|
||||
Snacks.picker.autocmds()
|
||||
end,
|
||||
desc = "Autocmds",
|
||||
},
|
||||
{
|
||||
"<leader>sb",
|
||||
function()
|
||||
Snacks.picker.lines()
|
||||
end,
|
||||
desc = "Buffer Lines",
|
||||
},
|
||||
{
|
||||
"<leader>sc",
|
||||
function()
|
||||
Snacks.picker.command_history()
|
||||
end,
|
||||
desc = "Command History",
|
||||
},
|
||||
{
|
||||
"<leader>sC",
|
||||
function()
|
||||
Snacks.picker.commands()
|
||||
end,
|
||||
desc = "Commands",
|
||||
},
|
||||
{
|
||||
"<leader>sd",
|
||||
function()
|
||||
Snacks.picker.diagnostics()
|
||||
end,
|
||||
desc = "Diagnostics",
|
||||
},
|
||||
{
|
||||
"<leader>sD",
|
||||
function()
|
||||
Snacks.picker.diagnostics_buffer()
|
||||
end,
|
||||
desc = "Buffer Diagnostics",
|
||||
},
|
||||
{
|
||||
"<leader>sh",
|
||||
function()
|
||||
Snacks.picker.help()
|
||||
end,
|
||||
desc = "Help Pages",
|
||||
},
|
||||
{
|
||||
"<leader>sH",
|
||||
function()
|
||||
Snacks.picker.highlights()
|
||||
end,
|
||||
desc = "Highlights",
|
||||
},
|
||||
{
|
||||
"<leader>si",
|
||||
function()
|
||||
Snacks.picker.icons()
|
||||
end,
|
||||
desc = "Icons",
|
||||
},
|
||||
{
|
||||
"<leader>sj",
|
||||
function()
|
||||
Snacks.picker.jumps()
|
||||
end,
|
||||
desc = "Jumps",
|
||||
},
|
||||
{
|
||||
"<leader>sk",
|
||||
function()
|
||||
Snacks.picker.keymaps()
|
||||
end,
|
||||
desc = "Keymaps",
|
||||
},
|
||||
{
|
||||
"<leader>sl",
|
||||
function()
|
||||
Snacks.picker.loclist()
|
||||
end,
|
||||
desc = "Location List",
|
||||
},
|
||||
{
|
||||
"<leader>sm",
|
||||
function()
|
||||
Snacks.picker.marks()
|
||||
end,
|
||||
desc = "Marks",
|
||||
},
|
||||
{
|
||||
"<leader>sM",
|
||||
function()
|
||||
Snacks.picker.man()
|
||||
end,
|
||||
desc = "Man Pages",
|
||||
},
|
||||
{
|
||||
"<leader>sp",
|
||||
function()
|
||||
Snacks.picker.lazy()
|
||||
end,
|
||||
desc = "Search for Plugin Spec",
|
||||
},
|
||||
{
|
||||
"<leader>sq",
|
||||
function()
|
||||
Snacks.picker.qflist()
|
||||
end,
|
||||
desc = "Quickfix List",
|
||||
},
|
||||
{
|
||||
"<leader>sR",
|
||||
function()
|
||||
Snacks.picker.resume()
|
||||
end,
|
||||
desc = "Resume",
|
||||
},
|
||||
{
|
||||
"<leader>su",
|
||||
function()
|
||||
Snacks.picker.undo()
|
||||
end,
|
||||
desc = "Undo History",
|
||||
},
|
||||
{
|
||||
"<leader>uC",
|
||||
function()
|
||||
Snacks.picker.colorschemes()
|
||||
end,
|
||||
desc = "Colorschemes",
|
||||
},
|
||||
-- LSP
|
||||
{
|
||||
"gd",
|
||||
function()
|
||||
Snacks.picker.lsp_definitions()
|
||||
end,
|
||||
desc = "Goto Definition",
|
||||
},
|
||||
{
|
||||
"gD",
|
||||
function()
|
||||
Snacks.picker.lsp_declarations()
|
||||
end,
|
||||
desc = "Goto Declaration",
|
||||
},
|
||||
{
|
||||
"gr",
|
||||
function()
|
||||
Snacks.picker.lsp_references()
|
||||
end,
|
||||
nowait = true,
|
||||
desc = "References",
|
||||
},
|
||||
{
|
||||
"gI",
|
||||
function()
|
||||
Snacks.picker.lsp_implementations()
|
||||
end,
|
||||
desc = "Goto Implementation",
|
||||
},
|
||||
{
|
||||
"gy",
|
||||
function()
|
||||
Snacks.picker.lsp_type_definitions()
|
||||
end,
|
||||
desc = "Goto T[y]pe Definition",
|
||||
},
|
||||
{
|
||||
"<leader>ss",
|
||||
function()
|
||||
Snacks.picker.lsp_symbols()
|
||||
end,
|
||||
desc = "LSP Symbols",
|
||||
},
|
||||
{
|
||||
"<leader>sS",
|
||||
function()
|
||||
Snacks.picker.lsp_workspace_symbols()
|
||||
end,
|
||||
desc = "LSP Workspace Symbols",
|
||||
},
|
||||
-- Other
|
||||
{
|
||||
"<leader>z",
|
||||
function()
|
||||
Snacks.zen()
|
||||
end,
|
||||
desc = "Toggle Zen Mode",
|
||||
},
|
||||
{
|
||||
"<leader>Z",
|
||||
function()
|
||||
Snacks.zen.zoom()
|
||||
end,
|
||||
desc = "Toggle Zoom",
|
||||
},
|
||||
{
|
||||
"<leader>.",
|
||||
function()
|
||||
Snacks.scratch()
|
||||
end,
|
||||
desc = "Toggle Scratch Buffer",
|
||||
},
|
||||
{
|
||||
"<leader>S",
|
||||
function()
|
||||
Snacks.scratch.select()
|
||||
end,
|
||||
desc = "Select Scratch Buffer",
|
||||
},
|
||||
{
|
||||
"<leader>n",
|
||||
function()
|
||||
Snacks.notifier.show_history()
|
||||
end,
|
||||
desc = "Notification History",
|
||||
},
|
||||
{
|
||||
"<leader>bd",
|
||||
function()
|
||||
Snacks.bufdelete()
|
||||
end,
|
||||
desc = "Delete Buffer",
|
||||
},
|
||||
{
|
||||
"<leader>cR",
|
||||
function()
|
||||
Snacks.rename.rename_file()
|
||||
end,
|
||||
desc = "Rename File",
|
||||
},
|
||||
{
|
||||
"<leader>gB",
|
||||
function()
|
||||
Snacks.gitbrowse()
|
||||
end,
|
||||
desc = "Git Browse",
|
||||
mode = { "n", "v" },
|
||||
},
|
||||
{
|
||||
"<leader>gg",
|
||||
function()
|
||||
Snacks.lazygit()
|
||||
end,
|
||||
desc = "Lazygit",
|
||||
},
|
||||
{
|
||||
"<leader>un",
|
||||
function()
|
||||
Snacks.notifier.hide()
|
||||
end,
|
||||
desc = "Dismiss All Notifications",
|
||||
},
|
||||
{
|
||||
"<c-/>",
|
||||
function()
|
||||
Snacks.terminal()
|
||||
end,
|
||||
desc = "Toggle Terminal",
|
||||
},
|
||||
{
|
||||
"<c-_>",
|
||||
function()
|
||||
Snacks.terminal()
|
||||
end,
|
||||
desc = "which_key_ignore",
|
||||
},
|
||||
{
|
||||
"]]",
|
||||
function()
|
||||
Snacks.words.jump(vim.v.count1)
|
||||
end,
|
||||
desc = "Next Reference",
|
||||
mode = { "n", "t" },
|
||||
},
|
||||
{
|
||||
"[[",
|
||||
function()
|
||||
Snacks.words.jump(-vim.v.count1)
|
||||
end,
|
||||
desc = "Prev Reference",
|
||||
mode = { "n", "t" },
|
||||
},
|
||||
{
|
||||
"<leader>N",
|
||||
desc = "Neovim News",
|
||||
function()
|
||||
Snacks.win({
|
||||
file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1],
|
||||
width = 0.6,
|
||||
height = 0.6,
|
||||
wo = {
|
||||
spell = false,
|
||||
wrap = false,
|
||||
signcolumn = "yes",
|
||||
statuscolumn = " ",
|
||||
conceallevel = 3,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "VeryLazy",
|
||||
callback = function()
|
||||
-- Setup some globals for debugging (lazy-loaded)
|
||||
_G.dd = function(...)
|
||||
Snacks.debug.inspect(...)
|
||||
end
|
||||
_G.bt = function()
|
||||
Snacks.debug.backtrace()
|
||||
end
|
||||
|
||||
-- Override print to use snacks for `:=` command
|
||||
if vim.fn.has("nvim-0.11") == 1 then
|
||||
vim._print = function(_, ...)
|
||||
dd(...)
|
||||
end
|
||||
else
|
||||
vim.print = _G.dd
|
||||
end
|
||||
|
||||
-- Create some toggle mappings
|
||||
Snacks.toggle.option("spell", { name = "Spelling" }):map("<leader>us")
|
||||
Snacks.toggle.option("wrap", { name = "Wrap" }):map("<leader>uw")
|
||||
Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("<leader>uL")
|
||||
Snacks.toggle.diagnostics():map("<leader>ud")
|
||||
Snacks.toggle.line_number():map("<leader>ul")
|
||||
Snacks.toggle
|
||||
.option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 })
|
||||
:map("<leader>uc")
|
||||
Snacks.toggle.treesitter():map("<leader>uT")
|
||||
Snacks.toggle
|
||||
.option("background", { off = "light", on = "dark", name = "Dark Background" })
|
||||
:map("<leader>ub")
|
||||
Snacks.toggle.inlay_hints():map("<leader>uh")
|
||||
Snacks.toggle.indent():map("<leader>ug")
|
||||
Snacks.toggle.dim():map("<leader>uD")
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
@ -1,21 +1,9 @@
|
||||
return {
|
||||
"rmagatti/auto-session",
|
||||
config = function()
|
||||
local auto_session = require("auto-session")
|
||||
|
||||
auto_session.setup({
|
||||
require("auto-session").setup({
|
||||
auto_restore_enabled = true,
|
||||
auto_session_suppress_dirs = { "~/", "~/Code/", "~/Downloads", "~/Documents", "~/Desktop/" },
|
||||
})
|
||||
|
||||
local keymap = vim.keymap
|
||||
|
||||
keymap.set("n", "<leader>wr", "<cmd>SessionRestore<CR>", { desc = "Restore session for cwd (auto-session)" }) -- restore last workspace session for current directory
|
||||
keymap.set(
|
||||
"n",
|
||||
"<leader>ws",
|
||||
"<cmd>SessionSave<CR>",
|
||||
{ desc = "Save session for auto session root dir (auto-session)" }
|
||||
)
|
||||
end,
|
||||
}
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
return {
|
||||
"stevearc/oil.nvim",
|
||||
---@module 'oil'
|
||||
---@type oil.SetupOpts
|
||||
opts = {},
|
||||
-- Optional dependencies
|
||||
dependencies = { { "echasnovski/mini.icons", opts = {} } },
|
||||
-- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons
|
||||
-- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations.
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("oil").setup()
|
||||
vim.keymap.set("n", "-", "<CMD>Oil --float<CR>", { desc = "Open parent directory" })
|
||||
end,
|
||||
}
|
||||
@ -1,21 +1,16 @@
|
||||
-- TODO Get todo-comments working
|
||||
local utils = require("utils")
|
||||
return {
|
||||
"folke/todo-comments.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
local todo_comments = require("todo-comments")
|
||||
utils.nmapkey("]t", function()
|
||||
require("todo-comments").jump_next()
|
||||
end, "Next todo comment (todo-comments)")
|
||||
utils.nmapkey("[t", function()
|
||||
require("todo-comments").jump_previous()
|
||||
end, "Previous todo comment (todo-comments)")
|
||||
|
||||
-- Set keymaps
|
||||
local keymap = vim.keymap
|
||||
keymap.set("n", "]t", function()
|
||||
todo_comments.jump_next()
|
||||
end, { desc = "Next todo comment (todo-comments)" })
|
||||
|
||||
keymap.set("n", "[t", function()
|
||||
todo_comments.jump_prev()
|
||||
end, { desc = "Previous todo comment (todo-comments)" })
|
||||
|
||||
todo_comments.setup()
|
||||
require("todo-comments").setup()
|
||||
end,
|
||||
}
|
||||
|
||||
3
.config/nvim/lua/plugins/util/undotree.lua
Normal file
3
.config/nvim/lua/plugins/util/undotree.lua
Normal file
@ -0,0 +1,3 @@
|
||||
return {
|
||||
"mbbill/undotree",
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
-- Other utilities
|
||||
return {
|
||||
{
|
||||
"lambdalisue/vim-suda",
|
||||
config = function()
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>sw",
|
||||
"<cmd>SudaWrite<cr>",
|
||||
{ desc = "Write the current file with sudo (vim-suda)" }
|
||||
)
|
||||
end,
|
||||
},
|
||||
}
|
||||
9
.config/nvim/lua/plugins/util/vim-suda.lua
Normal file
9
.config/nvim/lua/plugins/util/vim-suda.lua
Normal file
@ -0,0 +1,9 @@
|
||||
local utils = require("utils")
|
||||
return {
|
||||
{
|
||||
"lambdalisue/vim-suda",
|
||||
config = function()
|
||||
utils.nmapkey("<leader>ws", "<cmd>SudaWrite<cr>", "Write the current file with sudo (vim-suda)")
|
||||
end,
|
||||
},
|
||||
}
|
||||
@ -2,11 +2,7 @@ return {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
},
|
||||
opts = {},
|
||||
keys = {
|
||||
{
|
||||
"<leader>!",
|
||||
|
||||
@ -32,4 +32,40 @@ function M.vmapkey(lhs, rhs, desc, bufopts)
|
||||
M.mapkey("v", lhs, rhs, desc, bufopts)
|
||||
end
|
||||
|
||||
--- Sets a non-recursive keymap for normal and visual mode.
|
||||
---@param lhs string Left-hand side of the keymap.
|
||||
---@param rhs string|function Right-hand side of the keymap.
|
||||
---@param desc string|nil Description for the keymap.
|
||||
---@param bufopts table|nil Additional options for the keymap.
|
||||
function M.nvmapkey(lhs, rhs, desc, bufopts)
|
||||
M.mapkey({ "n", "v" }, lhs, rhs, desc, bufopts)
|
||||
end
|
||||
|
||||
function M.common_mappings(opts)
|
||||
local telescope = require("telescope.builtin")
|
||||
M.nmapkey("gr", telescope.lsp_references, "[g]et [r]eferences", opts)
|
||||
M.nmapkey("gd", telescope.lsp_definitions, "[g]et [d]definitions", opts)
|
||||
M.nmapkey("gi", telescope.lsp_implementations, "[g]et [i]mplementations", opts)
|
||||
M.nmapkey("gt", telescope.lsp_type_definitions, "[g]et [t]ype definitions", opts)
|
||||
M.nmapkey("gD", vim.lsp.buf.declaration, "[g]o to [D]eclaration", opts)
|
||||
M.nmapkey("K", vim.lsp.buf.hover, "Show do[K]umentation for what is under cursor", opts)
|
||||
M.nmapkey("<leader>hh", vim.lsp.buf.signature_help, "Signature [hh]elp", opts)
|
||||
|
||||
M.nmapkey("<leader>wa", vim.lsp.buf.add_workspace_folder, "[w]orkspace [a]dd folder", opts)
|
||||
M.nmapkey("<leader>wr", vim.lsp.buf.remove_workspace_folder, "[w]orkspace [r]emove folder", opts)
|
||||
M.nmapkey("<leader>wl", vim.lsp.buf.list_workspace_folders, "[w]orkspace [l]ist folder", opts)
|
||||
M.nvmapkey("<leader>ca", vim.lsp.buf.code_action, "See available [c]ode [a]ctions", opts)
|
||||
M.nmapkey("<leader>rn", vim.lsp.buf.rename, "Smart [r]e[n]ame", opts)
|
||||
M.nmapkey("<leader>d", vim.diagnostic.open_float, "Show line [d]iagnostics", opts)
|
||||
M.nmapkey("<leader>D", telescope.diagnostics, "Show buffer [D]iagnostics", opts)
|
||||
M.nmapkey("[d", function()
|
||||
vim.diagnostic.jump({ count = -1, float = true })
|
||||
end, "Go to previous diagnostic", opts)
|
||||
M.nmapkey("]d", function()
|
||||
vim.diagnostic.jump({ count = 1, float = true })
|
||||
end, "Go to next diagnostic", opts)
|
||||
M.nmapkey("<leader>q", vim.diagnostic.setloclist, "Add buffer diagnostics to location list", opts)
|
||||
M.nmapkey("<leader>rs", "<cmd>LspRestart<cr>", "Restart LSP", opts)
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
##################
|
||||
### CATPPUCCIN ###
|
||||
##################
|
||||
|
||||
set -g @catppuccin_flavor "frappe"
|
||||
|
||||
set -g status-right-length 100
|
||||
set -g status-left-length 100
|
||||
|
||||
# Window
|
||||
set -g @catppuccin_window_status_style "rounded"
|
||||
|
||||
run ~/.config/tmux/plugins/tmux/catppuccin.tmux
|
||||
|
||||
## Window global/default configuration
|
||||
set -g @catppuccin_window_text " #W"
|
||||
set -g @catppuccin_window_status "icon"
|
||||
set -g @catppuccin_window_default_fill "number"
|
||||
set -g @catppuccin_window_number_position "left"
|
||||
|
||||
## Window current configuration
|
||||
set -g @catppuccin_window_current_text " #W"
|
||||
set -g @catppuccin_window_current_fill "all"
|
||||
set -g @catppuccin_window_current_number_color "#{@thm_maroon}"
|
||||
|
||||
set -g @catppuccin_window_text_color "#{@thm_surface_0}"
|
||||
set -g @catppuccin_window_number_color "#{@thm_rosewater}"
|
||||
|
||||
# Status
|
||||
set -gF status-left ""
|
||||
set -gF status-right "#{@catppuccin_status_session}"
|
||||
set -agF status-right "#{@catppuccin_status_directory}"
|
||||
set -agF status-right "#{@catppuccin_status_user}"
|
||||
set -agF status-right "#{@catppuccin_status_host}"
|
||||
set -agF status-right "#{E:@catppuccin_status_date_time}"
|
||||
132
.config/tmux/scripts/cal.sh
Executable file
132
.config/tmux/scripts/cal.sh
Executable file
@ -0,0 +1,132 @@
|
||||
#!/bin/bash
|
||||
|
||||
ALERT_IF_IN_NEXT_MINUTES=10
|
||||
ALERT_POPUP_BEFORE_SECONDS=10
|
||||
NERD_FONT_FREE=" "
|
||||
NERD_FONT_MEETING=""
|
||||
|
||||
get_attendees() {
|
||||
attendees=$(
|
||||
icalBuddy \
|
||||
--includeEventProps "attendees" \
|
||||
--propertyOrder "datetime,title" \
|
||||
--noCalendarNames \
|
||||
--dateFormat "%A" \
|
||||
--includeOnlyEventsFromNowOn \
|
||||
--limitItems 1 \
|
||||
--excludeAllDayEvents \
|
||||
--separateByDate \
|
||||
--excludeEndDates \
|
||||
--bullet "" \
|
||||
--excludeCals "training,omerxx@gmail.com" \
|
||||
eventsToday
|
||||
)
|
||||
}
|
||||
|
||||
parse_attendees() {
|
||||
attendees_array=()
|
||||
for line in $attendees; do
|
||||
attendees_array+=("$line")
|
||||
done
|
||||
number_of_attendees=$((${#attendees_array[@]} - 3))
|
||||
}
|
||||
|
||||
get_next_meeting() {
|
||||
next_meeting=$(icalBuddy \
|
||||
--includeEventProps "title,datetime" \
|
||||
--propertyOrder "datetime,title" \
|
||||
--noCalendarNames \
|
||||
--dateFormat "%A" \
|
||||
--includeOnlyEventsFromNowOn \
|
||||
--limitItems 1 \
|
||||
--excludeAllDayEvents \
|
||||
--separateByDate \
|
||||
--bullet "" \
|
||||
--excludeCals "training,omerxx@gmail.com" \
|
||||
eventsToday)
|
||||
}
|
||||
|
||||
get_next_next_meeting() {
|
||||
end_timestamp=$(date +"%Y-%m-%d ${end_time}:01 %z")
|
||||
tonight=$(date +"%Y-%m-%d 23:59:00 %z")
|
||||
next_next_meeting=$(
|
||||
icalBuddy \
|
||||
--includeEventProps "title,datetime" \
|
||||
--propertyOrder "datetime,title" \
|
||||
--noCalendarNames \
|
||||
--dateFormat "%A" \
|
||||
--limitItems 1 \
|
||||
--excludeAllDayEvents \
|
||||
--separateByDate \
|
||||
--bullet "" \
|
||||
--excludeCals "training,omerxx@gmail.com" \
|
||||
eventsFrom:"${end_timestamp}" to:"${tonight}"
|
||||
)
|
||||
}
|
||||
|
||||
parse_result() {
|
||||
array=()
|
||||
for line in $1; do
|
||||
array+=("$line")
|
||||
done
|
||||
time="${array[2]}"
|
||||
end_time="${array[4]}"
|
||||
title="${array[*]:5:30}"
|
||||
}
|
||||
|
||||
calculate_times() {
|
||||
epoc_meeting=$(date -j -f "%T" "$time:00" +%s)
|
||||
epoc_now=$(date +%s)
|
||||
epoc_diff=$((epoc_meeting - epoc_now))
|
||||
minutes_till_meeting=$((epoc_diff / 60))
|
||||
}
|
||||
|
||||
display_popup() {
|
||||
tmux display-popup \
|
||||
-S "fg=#eba0ac" \
|
||||
-w50% \
|
||||
-h50% \
|
||||
-d '#{pane_current_path}' \
|
||||
-T meeting \
|
||||
icalBuddy \
|
||||
--propertyOrder "datetime,title" \
|
||||
--noCalendarNames \
|
||||
--formatOutput \
|
||||
--includeEventProps "title,datetime,notes,url,attendees" \
|
||||
--includeOnlyEventsFromNowOn \
|
||||
--limitItems 1 \
|
||||
--excludeAllDayEvents \
|
||||
--excludeCals "training" \
|
||||
eventsToday
|
||||
}
|
||||
|
||||
print_tmux_status() {
|
||||
if [[ $minutes_till_meeting -lt $ALERT_IF_IN_NEXT_MINUTES &&
|
||||
$minutes_till_meeting -gt -60 ]]; then
|
||||
echo "$NERD_FONT_MEETING \
|
||||
$time $title ($minutes_till_meeting minutes)"
|
||||
else
|
||||
echo "$NERD_FONT_FREE"
|
||||
fi
|
||||
|
||||
if [[ $epoc_diff -gt $ALERT_POPUP_BEFORE_SECONDS && epoc_diff -lt $ALERT_POPUP_BEFORE_SECONDS+10 ]]; then
|
||||
display_popup
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
get_attendees
|
||||
parse_attendees
|
||||
get_next_meeting
|
||||
parse_result "$next_meeting"
|
||||
calculate_times
|
||||
if [[ "$next_meeting" != "" && $number_of_attendees -lt 2 ]]; then
|
||||
get_next_next_meeting
|
||||
parse_result "$next_next_meeting"
|
||||
calculate_times
|
||||
fi
|
||||
print_tmux_status
|
||||
# echo "$minutes_till_meeting | $number_of_attendees"
|
||||
}
|
||||
|
||||
main
|
||||
@ -1,81 +1,26 @@
|
||||
###############
|
||||
### PLUGINS ###
|
||||
###############
|
||||
|
||||
set -g default-terminal "tmux-256color"
|
||||
|
||||
set -g @plugin 'catppuccin/tmux#v2.1.3'
|
||||
set -g @plugin 'tmux-plugins/tmux-sensible'
|
||||
set -g @plugin 'tmux-plugins/tpm'
|
||||
|
||||
|
||||
################
|
||||
### BINDINGS ###
|
||||
################
|
||||
|
||||
### PREFIXED ###
|
||||
|
||||
# r : RELOAD
|
||||
bind r source-file ~/.config/tmux/tmux.conf
|
||||
|
||||
# | : HORIZONTAL SPLIT
|
||||
bind | split-window -h
|
||||
|
||||
# - : VERTICAL SPLIT
|
||||
bind - split-window -v
|
||||
|
||||
# X : KILL PANE
|
||||
bind X kill-pane
|
||||
|
||||
# Alt-arrow : RESIZE 1 ROW
|
||||
bind M-Left resize-pane -L 1 \; switch-client -T prefix
|
||||
bind M-Down resize-pane -D 1 \; switch-client -T prefix
|
||||
bind M-Up resize-pane -U 1 \; switch-client -T prefix
|
||||
bind M-Right resize-pane -R 1 \; switch-client -T prefix
|
||||
|
||||
# C-arrow : RESIZE 5 ROWS
|
||||
bind C-Left resize-pane -L 5 \; switch-client -T prefix
|
||||
bind C-Down resize-pane -D 5 \; switch-client -T prefix
|
||||
bind C-Up resize-pane -U 5 \; switch-client -T prefix
|
||||
bind C-Right resize-pane -R 5 \; switch-client -T prefix
|
||||
|
||||
# Alt-c : CHANGE SESSION ROOT DIR
|
||||
bind M-c attach-session -c "#{pane_current_path}"
|
||||
|
||||
|
||||
### UNPREFIXED ###
|
||||
|
||||
# Alt-arrow : SWITCH PANES
|
||||
bind -n M-Left select-pane -L
|
||||
bind -n M-Down select-pane -D
|
||||
bind -n M-Up select-pane -U
|
||||
bind -n M-Right select-pane -R
|
||||
|
||||
# Alt-hjkl : SWITCH PANES
|
||||
bind -n M-h select-pane -L
|
||||
bind -n M-j select-pane -D
|
||||
bind -n M-k select-pane -U
|
||||
bind -n M-l select-pane -R
|
||||
|
||||
# Alt-z : FULL SCREEN
|
||||
bind -n M-z resize-pane -Z
|
||||
|
||||
|
||||
################
|
||||
### SETTINGS ###
|
||||
################
|
||||
|
||||
# Enable mouse
|
||||
set -g default-terminal "screen-256color"
|
||||
set -g terminal-overrides ",xterm-256color:RGB"
|
||||
|
||||
set -g prefix ^B
|
||||
set -g base-index 1 # start indexing windows at 1 instead of 0
|
||||
set -g detach-on-destroy off # don't exit from tmux when closing a session
|
||||
set -g escape-time 0 # zero-out escape time delay
|
||||
set -g history-limit 1000000 # increase history size (from 2,000)
|
||||
set -g renumber-windows on # renumber all windows when any window is closed
|
||||
set -g set-clipboard on # use system clipboard
|
||||
set -g status-position top # macOS / darwin style
|
||||
set -g default-terminal "${TERM}"
|
||||
set -g pane-active-border-style "fg=magenta,bg=default"
|
||||
set -g pane-border-style "fg=brightblack,bg=default"
|
||||
|
||||
set -g mouse on
|
||||
|
||||
# Don't rename windows automatically
|
||||
set-option -g allow-rename off
|
||||
|
||||
# Don't do anything when a 'bell' rings
|
||||
set -g allow-rename off
|
||||
set -g visual-activity off
|
||||
set -g visual-bell off
|
||||
set -g visual-silence off
|
||||
setw -g monitor-activity off
|
||||
set -g bell-action none
|
||||
|
||||
|
||||
@ -83,27 +28,34 @@ set -g bell-action none
|
||||
### VI MODE COPYING ###
|
||||
#######################
|
||||
|
||||
# Enable Vi keybindings in copy mode
|
||||
set-window-option -g mode-keys vi
|
||||
setw -g mode-keys vi
|
||||
|
||||
# Bind 'v' to start selection in copy mode
|
||||
# Bind "v" to start selection (unchanged)
|
||||
bind-key -T copy-mode-vi v send -X begin-selection
|
||||
|
||||
# Bind 'y' to copy the selection to the system clipboard
|
||||
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel
|
||||
# Bind "y" to copy selection to system clipboard (xclip)
|
||||
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel "xclip -in -selection clipboard"
|
||||
|
||||
# Bind 'Y' to copy the entire buffer to the system clipboard
|
||||
bind-key -T copy-mode-vi Y send -X copy-pipe-and-cancel
|
||||
# Bind "Y" to copy entire visible buffer to system clipboard
|
||||
bind-key -T copy-mode-vi Y send -X copy-pipe-and-cancel "xclip -in -selection clipboard"
|
||||
|
||||
# Bind "Enter" to copy selection (like "y") and exit copy mode
|
||||
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
|
||||
|
||||
# Optional: Bind "p" to paste from system clipboard into tmux
|
||||
bind-key p run-shell "xclip -out -selection clipboard | tmux load-buffer - && tmux paste-buffer"
|
||||
|
||||
############
|
||||
### LOAD ###
|
||||
############
|
||||
|
||||
# Catppuccin conf
|
||||
source-file ~/.config/tmux/catppuccin.conf
|
||||
# Load plugins & plugin settings
|
||||
source-file ~/.config/tmux/tmux.plugins.conf
|
||||
|
||||
# Local conf if using
|
||||
# Load keybindings
|
||||
source-file ~/.config/tmux/tmux.keybindings.conf
|
||||
|
||||
# Load local configuration if given
|
||||
if-shell "[ -f ~/.config/tmux/local.tmux.conf ]" "source-file ~/.config/tmux/local.tmux.conf"
|
||||
|
||||
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
|
||||
|
||||
52
.config/tmux/tmux.keybindings.conf
Normal file
52
.config/tmux/tmux.keybindings.conf
Normal file
@ -0,0 +1,52 @@
|
||||
################
|
||||
### PREFIXED ###
|
||||
################
|
||||
|
||||
bind R source-file ~/.config/tmux/tmux.conf
|
||||
|
||||
bind "\"" split-window -v -c "#{pane_current_path}"
|
||||
bind - split-window -v -l 12 -c "#{pane_current_path}"
|
||||
bind | split-window -h -l 60 -c "#{pane_current_path}"
|
||||
|
||||
bind C command-prompt 'neww -n %%'
|
||||
bind a command-prompt "new-session -A -s %%"
|
||||
|
||||
bind r command-prompt "rename-window %%"
|
||||
bind e command-prompt "rename-session %%"
|
||||
|
||||
bind X kill-pane
|
||||
|
||||
# C-arrow : RESIZE 20 ROWS
|
||||
bind C-Left resize-pane -L 10 \; switch-client
|
||||
bind C-Down resize-pane -D 10 \; switch-client
|
||||
bind C-Up resize-pane -U 10 \; switch-client
|
||||
bind C-Right resize-pane -R 10 \; switch-client
|
||||
|
||||
# Alt-arrow : RESIZE 7 ROWS
|
||||
bind M-Left resize-pane -L 7 \; switch-client
|
||||
bind M-Down resize-pane -D 7 \; switch-client
|
||||
bind M-Up resize-pane -U 7 \; switch-client
|
||||
bind M-Right resize-pane -R 7 \; switch-client
|
||||
|
||||
# Alt-c : CHANGE SESSION ROOT DIR
|
||||
bind M-c attach-session -c "#{pane_current_path}"
|
||||
|
||||
|
||||
##################
|
||||
### UNPREFIXED ###
|
||||
##################
|
||||
|
||||
# Alt-arrow : SWITCH PANES
|
||||
bind -n M-Left select-pane -L
|
||||
bind -n M-Down select-pane -D
|
||||
bind -n M-Up select-pane -U
|
||||
bind -n M-Right select-pane -R
|
||||
|
||||
# Alt-hjkl : SWITCH PANES
|
||||
bind -n M-h select-pane -L
|
||||
bind -n M-j select-pane -D
|
||||
bind -n M-k select-pane -U
|
||||
bind -n M-l select-pane -R
|
||||
|
||||
# Alt-z : FULL SCREEN
|
||||
bind -n M-z resize-pane -Z
|
||||
73
.config/tmux/tmux.plugins.conf
Normal file
73
.config/tmux/tmux.plugins.conf
Normal file
@ -0,0 +1,73 @@
|
||||
|
||||
set -g @fzf-url-fzf-options '-p 60%,30% --prompt=" " --border-label=" Open URL "'
|
||||
set -g @fzf-url-history-limit "2000"
|
||||
|
||||
set -g @floax-width "80%"
|
||||
set -g @floax-height "80%"
|
||||
set -g @floax-border-color "magenta"
|
||||
set -g @floax-text-color "blue"
|
||||
set -g @floax-bind "p"
|
||||
set -g @floax-change-path "true"
|
||||
|
||||
set -g @continuum-restore "on"
|
||||
set -g @resurrect-strategy-nvim "session"
|
||||
|
||||
##################
|
||||
### CATPPUCCIN ###
|
||||
##################
|
||||
|
||||
set -g @catppuccin_flavor "frappe"
|
||||
|
||||
set -g status-right-length 100
|
||||
set -g status-left-length 100
|
||||
|
||||
# Window
|
||||
set -g @catppuccin_window_status_style "rounded"
|
||||
set -g @catppuccin_window_status "icon"
|
||||
|
||||
set -g @catppuccin_window_current_fill "all"
|
||||
set -g @catppuccin_window_current_number_color "#{@thm_blue}"
|
||||
|
||||
set -g @catppuccin_window_text_color "#{@thm_surface_0}"
|
||||
set -g @catppuccin_window_number_color "#{@thm_overlay_0}"
|
||||
|
||||
set -g @catppuccin_window_text "#W"
|
||||
set -g @catppuccin_window_number_position "right"
|
||||
set -g @catppuccin_window_default_fill "number"
|
||||
set -g @catppuccin_window_default_text "#W"
|
||||
set -g @catppuccin_window_current_fill "number"
|
||||
set -g @catppuccin_window_current_text "#{?window_zoomed_flag, ,}#W"
|
||||
|
||||
set -g @catppuccin_status_fill "icon"
|
||||
set -g @catppuccin_date_time_text " %a %d %b %Y %H:%M %Z"
|
||||
set -g @catppuccin_directory_text " #{b:pane_current_path}"
|
||||
set -gF status-left " "
|
||||
set -gF status-right "#{@catppuccin_status_session}"
|
||||
set -agF status-right "#{@catppuccin_status_directory}"
|
||||
set -agF status-right "#{@catppuccin_status_user}"
|
||||
set -agF status-right "#{@catppuccin_status_host}"
|
||||
set -agF status-right "#{E:@catppuccin_status_date_time}"
|
||||
|
||||
set -g @catppuccin_meetings_text "#($HOME/.config/tmux/scripts/cal.sh)"
|
||||
|
||||
###############
|
||||
### PLUGINS ###
|
||||
###############
|
||||
|
||||
set -g @plugin "catppuccin/tmux#v2.1.3"
|
||||
set -g @plugin "tmux-plugins/tpm"
|
||||
set -g @plugin "tmux-plugins/tmux-sensible"
|
||||
set -g @plugin "tmux-plugins/tmux-yank"
|
||||
set -g @plugin "tmux-plugins/tmux-resurrect"
|
||||
set -g @plugin "tmux-plugins/tmux-continuum"
|
||||
# set -g @plugin "fcsonline/tmux-thumbs"
|
||||
# set -g @plugin "sainnhe/tmux-fzf"
|
||||
# set -g @plugin "wfxr/tmux-fzf-url"
|
||||
# set -g @plugin "omerxx/tmux-floax"
|
||||
# set -g @plugin "ThePrimeagen/tmux-sessionizer"
|
||||
#
|
||||
# bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
|
||||
# bind-key -r M-h run-shell "tmux neww tmux-sessionizer -s 0"
|
||||
# bind-key -r M-t run-shell "tmux neww tmux-sessionizer -s 1"
|
||||
# bind-key -r M-n run-shell "tmux neww tmux-sessionizer -s 2"
|
||||
# bind-key -r M-s run-shell "tmux neww tmux-sessionizer -s 3"
|
||||
40
.config/tmux/tmux.reset.conf
Normal file
40
.config/tmux/tmux.reset.conf
Normal file
@ -0,0 +1,40 @@
|
||||
# First remove *all* keybindings
|
||||
# unbind-key -a
|
||||
# Now reinsert all the regular tmux keys
|
||||
# bind ^X lock-server
|
||||
# bind ^C new-window -c "$HOME"
|
||||
# bind ^D detach
|
||||
# bind * list-clients
|
||||
#
|
||||
# bind H previous-window
|
||||
# bind L next-window
|
||||
#
|
||||
# bind r command-prompt "rename-window %%"
|
||||
# bind R source-file ~/.config/tmux/tmux.conf
|
||||
# bind ^A last-window
|
||||
# bind ^W list-windows
|
||||
# bind w list-windows
|
||||
# bind z resize-pane -Z
|
||||
# bind ^L refresh-client
|
||||
# bind l refresh-client
|
||||
# bind | split-window
|
||||
# bind s split-window -v -c "#{pane_current_path}"
|
||||
# bind v split-window -h -c "#{pane_current_path}"
|
||||
# bind '"' choose-window
|
||||
# bind h select-pane -L
|
||||
# bind j select-pane -D
|
||||
# bind k select-pane -U
|
||||
# bind l select-pane -R
|
||||
# bind -r -T prefix , resize-pane -L 20
|
||||
# bind -r -T prefix . resize-pane -R 20
|
||||
# bind -r -T prefix - resize-pane -D 7
|
||||
# bind -r -T prefix = resize-pane -U 7
|
||||
# bind : command-prompt
|
||||
# bind * setw synchronize-panes
|
||||
# bind P set pane-border-status
|
||||
# bind c kill-pane
|
||||
# bind x swap-pane -D
|
||||
# bind S choose-session
|
||||
# bind R source-file ~/.config/tmux/tmux.conf
|
||||
# bind K send-keys "clear"\; send-keys "Enter"
|
||||
# bind-key -T copy-mode-vi v send-keys -X begin-selection
|
||||
63
.zinit.zsh
63
.zinit.zsh
@ -2,10 +2,12 @@
|
||||
### INSTALL ZINIT ###
|
||||
#####################
|
||||
|
||||
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
|
||||
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
|
||||
|
||||
if [[ ! -f "${ZINIT_HOME}/zinit.zsh" ]]; then
|
||||
print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
|
||||
command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
|
||||
command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \
|
||||
command mkdir -p "$(dirname $ZINIT_HOME)" && command chmod g-rwX "$(dirname $ZINIT_HOME)"
|
||||
command git clone https://github.com/zdharma-continuum/zinit "$ZINIT_HOME" && \
|
||||
print -P "%F{33} %F{34}Installation successful.%f%b" || \
|
||||
print -P "%F{160} The clone has failed.%f%b"
|
||||
fi
|
||||
@ -28,6 +30,19 @@ zinit ice depth=1; zinit light romkatv/powerlevel10k
|
||||
### PLUGINS ###
|
||||
###############
|
||||
|
||||
# AUTOSUGGESTIONS, TRIGGER PRECMD HOOK UPON LOAD
|
||||
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
|
||||
zinit ice wait"0a" lucid atload"_zsh_autosuggest_start"
|
||||
zinit light zsh-users/zsh-autosuggestions
|
||||
|
||||
#SYNTAX HIGHLIGHTING
|
||||
zinit ice wait"0c" lucid atinit"zpcompinit;zpcdreplay"
|
||||
zinit light zdharma-continuum/fast-syntax-highlighting
|
||||
|
||||
# TAB COMPLETIONS
|
||||
zinit ice wait"0b" lucid blockf
|
||||
zinit light zsh-users/zsh-completions
|
||||
|
||||
# FZF
|
||||
zinit ice from"gh-r" as"command" bpick"*linux_amd64*"
|
||||
zinit light junegunn/fzf
|
||||
@ -44,24 +59,38 @@ zinit light junegunn/fzf
|
||||
zinit ice wait="1" lucid
|
||||
zinit light Aloxaf/fzf-tab
|
||||
|
||||
# AUTOSUGGESTIONS, TRIGGER PRECMD HOOK UPON LOAD
|
||||
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
|
||||
zinit ice wait"0a" lucid atload"_zsh_autosuggest_start;bindkey \"^[[A\" history-search-backward;bindkey \"^[[B\" history-search-forward"
|
||||
zinit light zsh-users/zsh-autosuggestions
|
||||
|
||||
# # ENHANCED
|
||||
# ENHANCD
|
||||
zinit ice wait="0b" lucid
|
||||
zinit light b4b4r07/enhanced
|
||||
zinit light babarot/enhancd
|
||||
export ENHANCD_FILTER=fzf:fzy:peco
|
||||
|
||||
#SYNTAX HIGHLIGHTING
|
||||
zinit ice wait"0c" lucid atinit"zpcompinit;zpcdreplay"
|
||||
zinit light zdharma-continuum/fast-syntax-highlighting
|
||||
|
||||
# ZOXIDE
|
||||
zinit ice wait"0a" lucid from"gh-r" as"program" pick"zoxide-*/zoxide -> zoxide" cp"zoxide-*/completions/_zoxide -> _zoxide" atclone"./zoxide init zsh > init.zsh" atpull"%atclone" src"init.zsh"
|
||||
zinit light ajeetdsouza/zoxide
|
||||
|
||||
# TAB COMPLETIONS
|
||||
zinit ice wait="0b" lucid blockf
|
||||
zinit light zsh-users/zsh-completions
|
||||
# EZA
|
||||
zinit ice wait lucid from'gh-r' id-as as'completion' bpick'man-*' atpull'%atclone' atclone'
|
||||
local VERSION=$(ls target | sed "s/man-//")
|
||||
if [[ "$(uname -s)" = "Darwin"* ]]; then
|
||||
local -A ICE=(ver eza-$VERSION)
|
||||
.zinit-get-latest-gh-r-url-part cargo-bins cargo-quickinstall
|
||||
else
|
||||
local -A ICE=(bpick "eza*")
|
||||
.zinit-get-latest-gh-r-url-part eza-community eza
|
||||
fi
|
||||
[ -n "$reply" ] && wget https://github.com/$reply -O eza.tar.gz && tar -xzf eza.tar.gz && rm -f eza.tar.gz && ln -svf $PWD/eza $ZPFX/bin
|
||||
wget https://raw.githubusercontent.com/eza-community/eza/main/completions/zsh/_eza -O _eza
|
||||
for man in $PWD/target/*/*.1; do ln -svf $man $ZPFX/man/man1; done
|
||||
for man in $PWD/target/*/*.5; do ln -svf $man $ZPFX/man/man5; done'
|
||||
zinit light eza-community/eza
|
||||
|
||||
################
|
||||
### SNIPPETS ###
|
||||
################
|
||||
|
||||
zinit snippet OMZP::git
|
||||
zinit snippet OMZP::sudo
|
||||
zinit snippet OMZP::command-not-found
|
||||
|
||||
# replay cached completions
|
||||
zinit cdreplay -q
|
||||
|
||||
51
.zshrc
51
.zshrc
@ -1,7 +1,3 @@
|
||||
if [[ ! $(tmux ls) ]] 2> /dev/null; then
|
||||
tmux new -s λ
|
||||
fi
|
||||
|
||||
############
|
||||
### P10K ###
|
||||
############
|
||||
@ -23,10 +19,16 @@ source ~/.zstyle.zsh
|
||||
### PATHS ###
|
||||
#############
|
||||
|
||||
# local bin
|
||||
export PATH=$HOME/.local/bin:$PATH
|
||||
|
||||
# n
|
||||
export N_PREFIX=$HOME/.n
|
||||
export PATH=$N_PREFIX/bin:$PATH
|
||||
|
||||
# ghcup-env
|
||||
[ -f "/home/iborrelli/.ghcup/env" ] && . "/home/iborrelli/.ghcup/env"
|
||||
|
||||
#####################
|
||||
### ENV VARIABLES ###
|
||||
#####################
|
||||
@ -35,25 +37,60 @@ export SUDO_EDITOR="nvim"
|
||||
export EDITOR="nvim"
|
||||
export VISUAL="nvim"
|
||||
|
||||
###############
|
||||
### HISTORY ###
|
||||
###############
|
||||
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=50000
|
||||
HISTFILE=${XDG_STATE_HOME:-$HOME/.local/state}/.zsh_history
|
||||
HISTDUP=erase
|
||||
setopt appendhistory
|
||||
setopt sharehistory
|
||||
setopt hist_ignore_space
|
||||
setopt hist_ignore_all_dups
|
||||
setopt hist_save_no_dups
|
||||
setopt hist_ignore_all_dups
|
||||
setopt hist_find_no_dups
|
||||
|
||||
###############
|
||||
### ALIASES ###
|
||||
###############
|
||||
|
||||
alias svim="sudo -E -s nvim"
|
||||
alias dots='/usr/bin/git --git-dir=$HOME/.git/ --work-tree=$HOME'
|
||||
alias dots="/usr/bin/git --git-dir=$HOME/.git/ --work-tree=$HOME"
|
||||
alias vim="nvim"
|
||||
alias vi="nvim"
|
||||
alias python="python3"
|
||||
alias ls="ls --color"
|
||||
alias c="clear"
|
||||
alias bat=batcat
|
||||
alias cat=bat
|
||||
|
||||
###################
|
||||
### KEYBINDINGS ###
|
||||
###################
|
||||
|
||||
bindkey -v
|
||||
|
||||
# If wsl.conf exists we're probably in WSL and need some changes for terminal commands to work correctly
|
||||
[[ ! -f /etc/wsl.conf ]] || source ~/.wslrc.zsh
|
||||
[[ $(uname -a) =~ 'Ubuntu' ]] && source ~/.ubunturc.zsh
|
||||
|
||||
[[ ! -f ~/.localrc.zsh ]] || source ~/.localrc.zsh
|
||||
|
||||
eval $(thefuck --alias)
|
||||
# >>> conda initialize >>>
|
||||
# !! Contents within this block are managed by 'conda init' !!
|
||||
__conda_setup="$('/home/iborrelli/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "$__conda_setup"
|
||||
else
|
||||
if [ -f "/home/iborrelli/miniconda3/etc/profile.d/conda.sh" ]; then
|
||||
. "/home/iborrelli/miniconda3/etc/profile.d/conda.sh"
|
||||
else
|
||||
export PATH="/home/iborrelli/miniconda3/bin:$PATH"
|
||||
fi
|
||||
fi
|
||||
unset __conda_setup
|
||||
# <<< conda initialize <<<
|
||||
|
||||
[ -f /opt/miniconda3/etc/profile.d/conda.sh ] && source /opt/miniconda3/etc/profile.d/conda.sh
|
||||
|
||||
79
.zstyle.zsh
79
.zstyle.zsh
@ -2,65 +2,66 @@
|
||||
### COMPLETIONS ###
|
||||
###################
|
||||
|
||||
compctl -g '~/.teamocil/*(:t:r)' teamocil
|
||||
# man zshcompsys
|
||||
|
||||
# Specify the order of completers to use:
|
||||
# - `_expand`: Expand variables and globs.
|
||||
# - `_complete`: Standard completion.
|
||||
# - `_ignored`: Ignore certain completions.
|
||||
# - `_approximate`: Approximate matching for fuzzy completions.
|
||||
zstyle ':completion:*' completer _expand _complete _ignored _approximate
|
||||
zstyle ":completion:*" completer _expand _complete _ignored _approximate
|
||||
|
||||
# Enable case-insensitive matching
|
||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
|
||||
zstyle ":completion:*" matcher-list "m:{a-z}={A-Z}"
|
||||
|
||||
# Disable the menu selection feature (automatically select the first match)
|
||||
# Wrap descriptions in square brackets.
|
||||
zstyle ":completion:*:descriptions" format "[%d]"
|
||||
|
||||
# Customize the prompt shown when scrolling through completions
|
||||
# - `%SScrolling active: current selection at %p%s`: Shows a message indicating that scrolling is active and the current selection.
|
||||
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
|
||||
# List processes for the current user when completing process names.
|
||||
zstyle ":completion:*:processes" command "ps -au$USER"
|
||||
|
||||
# Format descriptions in completion lists
|
||||
# - `[%d]`: Wrap descriptions in square brackets.
|
||||
zstyle ':completion:*:descriptions' format '[%d]'
|
||||
|
||||
# Specify the command to use for completing process names
|
||||
# - `ps -au$USER`: List processes for the current user.
|
||||
zstyle ':completion:*:processes' command 'ps -au$USER'
|
||||
|
||||
# Specify the command to use for completing process names with fzf-tab
|
||||
# - `ps -u $USER -o pid,user,comm,cmd -w -w`: List processes with detailed information.
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm,cmd -w -w"
|
||||
|
||||
# Disable sorting of completion options
|
||||
zstyle ':completion:complete:*:options' sort false
|
||||
# List processes with detailed information when completing processes with fzf-tab.
|
||||
zstyle ":completion:*:*:*:*:processes" command "ps -u $USER -o pid,user,comm,cmd -w -w"
|
||||
|
||||
# Apply LS_COLORS to completion lists for colored output
|
||||
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
|
||||
zstyle ":completion:*" list-colors ${(s.:.)LS_COLORS}
|
||||
|
||||
zstyle ":completion:*:matches" group "yes"
|
||||
zstyle ":completion:*:corrections" format "%U%F{red}-- %d (errors: %e) --%f%u"
|
||||
zstyle ":completion:*:descriptions" format "%U%F{yellow}-- %d --%f%u"
|
||||
zstyle ":completion:*:messages" format "%F{purple} -- %d --%f"
|
||||
zstyle ":completion:*:warnings" format "%F{red} -- no matches found --%f"
|
||||
|
||||
# Disable sorting of completion options
|
||||
zstyle ":completion:complete:*:options" sort false
|
||||
zstyle ":completion:*:options" description "yes"
|
||||
zstyle ":completion:*:options" auto-description "%d"
|
||||
|
||||
#########################
|
||||
### FZF TAB BEHAVIOUR ###
|
||||
#########################
|
||||
|
||||
# Use default fzf options for fzf-tab
|
||||
zstyle ":fzf-tab:*" use-fzf-default-opts yes
|
||||
|
||||
zstyle ':completion:*:matches' group 'yes'
|
||||
zstyle ':completion:*:options' description 'yes'
|
||||
zstyle ':completion:*:options' auto-description '%d'
|
||||
zstyle ':completion:*:corrections' format '%U%F{red}-- %d (errors: %e) --%f%u'
|
||||
zstyle ':completion:*:descriptions' format '%U%F{yellow}-- %d --%f%u'
|
||||
zstyle ':completion:*:messages' format '%F{purple} -- %d --%f'
|
||||
zstyle ':completion:*:warnings' format '%F{red} -- no matches found --%f'
|
||||
#
|
||||
# Configure fzf-tab behavior
|
||||
# Use the input string as the query string for _zlua completions
|
||||
zstyle ':fzf-tab:complete:_zlua:*' query-string input
|
||||
zstyle ":fzf-tab:complete:_zlua:*" query-string input
|
||||
|
||||
# Customize the kill command completion with fzf-tab
|
||||
# - `extra-opts`: Additional options for fzf, including a preview window showing the command of the selected process.
|
||||
zstyle ':fzf-tab:complete:kill:argument-rest' extra-opts --preview=$extract'ps --pid=$in[(w)1] -o cmd --no-headers -w -w' --preview-window=down:3:wrap
|
||||
zstyle ":fzf-tab:complete:kill:argument-rest" extra-opts --preview=$extract"ps --pid=$in[(w)1] -o cmd --no-headers -w -w" --preview-window=down:3:wrap
|
||||
|
||||
# Customize the cd command completion with fzf-tab
|
||||
# - `fzf-preview`: Show a preview of directories using `eza` (a modern replacement for `ls`).
|
||||
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
|
||||
zstyle ":fzf-tab:complete:cd:*" fzf-preview "eza -1 --color $realpath"
|
||||
|
||||
# Customize the z command completion with fzf-tab
|
||||
# - `fzf-preview`: Show a preview of directories using `eza`.
|
||||
zstyle ':fzf-tab:complete:z:*' fzf-preview 'eza -1 --color=always $realpath'
|
||||
zstyle ":fzf-tab:complete:z:*" fzf-preview "eza -1 --color $realpath"
|
||||
|
||||
##########################
|
||||
### CUSTOM COMPLETIONS ###
|
||||
##########################
|
||||
|
||||
# man zshcompctl
|
||||
|
||||
compctl -g "~/.teamocil/*(:t:r)" teamocil
|
||||
|
||||
# Use default fzf options for fzf-tab
|
||||
zstyle ':fzf-tab:*' use-fzf-default-opts yes
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user