🪄 Substitution/Navigation
- Faster/smarter plugin loading - Substitution motions with the 'x' and 'X' keys - Fold navigation with Ctrl+hjkl - Various small tweaks for usability
This commit is contained in:
+31
-2
@@ -5,9 +5,8 @@
|
||||
-- -------------------------------- Commands -----------------------------------
|
||||
-- Make :Q close all of the buffers
|
||||
vim.api.nvim_create_user_command("Q", function()
|
||||
vim.cmd.bdelete()
|
||||
vim.cmd.qall()
|
||||
end, { force = true })
|
||||
end, { force = true, desc = "Close all buffers" })
|
||||
|
||||
-- Yank line without leading/trailing whitespace
|
||||
vim.api.nvim_create_user_command("YankLine", function()
|
||||
@@ -22,6 +21,12 @@ vim.api.nvim_create_user_command("RestoreColorscheme", function()
|
||||
)
|
||||
end, { force = true })
|
||||
|
||||
-- Load/start Remote
|
||||
vim.api.nvim_create_user_command("LoadRemote", function()
|
||||
require("remote-nvim").setup()
|
||||
vim.cmd("RemoteStart")
|
||||
end, { force = true, desc = "Load/start Remote" })
|
||||
|
||||
-- ------------------------------ Auto-Commands --------------------------------
|
||||
-- Autosave Colorscheme
|
||||
-- When the colorscheme changes, store the name in .colorscheme
|
||||
@@ -36,6 +41,30 @@ vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
end,
|
||||
})
|
||||
|
||||
-- Define cursor color/icon based on mode
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
autocmd({ "ModeChanged", "BufEnter" }, {
|
||||
callback = function()
|
||||
local current_mode = vim.fn.mode()
|
||||
if current_mode == "n" then
|
||||
vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#8aa8f3" })
|
||||
vim.fn.sign_define("smoothcursor", { text = "" })
|
||||
elseif current_mode == "v" then
|
||||
vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#d298eb" })
|
||||
vim.fn.sign_define("smoothcursor", { text = "" })
|
||||
elseif current_mode == "V" then
|
||||
vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#d298eb" })
|
||||
vim.fn.sign_define("smoothcursor", { text = "" })
|
||||
elseif current_mode == "�" then
|
||||
vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#bf616a" })
|
||||
vim.fn.sign_define("smoothcursor", { text = "" })
|
||||
elseif current_mode == "i" then
|
||||
vim.api.nvim_set_hl(0, "SmoothCursor", { fg = "#9bd482" })
|
||||
vim.fn.sign_define("smoothcursor", { text = "" })
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- GIT CONFLICT MARKERS
|
||||
-- if there are conflicts, jump to first conflict, highlight conflict markers,
|
||||
-- and disable diagnostics (simplified version of `git-conflict.nvim`)
|
||||
|
||||
+20
-2
@@ -45,7 +45,9 @@ wk.add({
|
||||
},
|
||||
{
|
||||
"<leader>gS",
|
||||
"<cmd>LazyGit<cr>",
|
||||
rhs = function()
|
||||
require("lazygit").lazygit()
|
||||
end,
|
||||
desc = "LazyGit",
|
||||
},
|
||||
{
|
||||
@@ -196,7 +198,9 @@ wk.add({
|
||||
},
|
||||
{
|
||||
"<leader>wt",
|
||||
"<cmd>TransparentToggle<cr>",
|
||||
rhs = function()
|
||||
require("transparent").toggle()
|
||||
end,
|
||||
desc = "Toggle Transparency",
|
||||
},
|
||||
{
|
||||
@@ -220,7 +224,21 @@ wk.add({
|
||||
end,
|
||||
desc = "Toggle Hardmode",
|
||||
},
|
||||
{ -- Toggle ZenMode
|
||||
"<leader>z",
|
||||
rhs = function()
|
||||
require("zen-mode").toggle()
|
||||
end,
|
||||
desc = "Toggle ZenMode",
|
||||
},
|
||||
})
|
||||
|
||||
-- Substitute
|
||||
-- Define substitue mappings
|
||||
vim.keymap.set("n", "x", require("substitute").operator, { noremap = true })
|
||||
vim.keymap.set("n", "xx", require("substitute").line, { noremap = true })
|
||||
vim.keymap.set("n", "X", require("substitute").eol, { noremap = true })
|
||||
vim.keymap.set("x", "x", require("substitute").visual, { noremap = true })
|
||||
|
||||
-- ---------------------------- Spell Correction -------------------------------
|
||||
require("config.spellcheck")
|
||||
|
||||
@@ -18,6 +18,11 @@ STORED_THEME = vim.fn.readfile(vim.fn.stdpath("config") .. "/.colorscheme")[1]
|
||||
vim.g.loaded_perl_provider = 0
|
||||
vim.g.lazyvim_python_lsp = "basedpyright"
|
||||
|
||||
-- ----------------------------------- FOLDS --------------------------------------
|
||||
vim.opt.foldmethod = "expr"
|
||||
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
vim.opt.foldlevelstart = 99 -- load buffers with folds open
|
||||
|
||||
-- ------------------------------- CLIENT APPS ---------------------------------
|
||||
if vim.g.neovide then
|
||||
-- ----------------------- Neovide -------------------------
|
||||
|
||||
+1
-5
@@ -11,7 +11,7 @@ return {
|
||||
},
|
||||
{ -- Transparent
|
||||
"xiyaowong/transparent.nvim",
|
||||
event = "VeryLazy",
|
||||
lazy = true,
|
||||
config = true,
|
||||
},
|
||||
{ -- Auto Dark Mode
|
||||
@@ -117,8 +117,4 @@ return {
|
||||
require("hlchunk").setup(common_config)
|
||||
end,
|
||||
},
|
||||
{ -- Alternate
|
||||
"ton/vim-alternate",
|
||||
event = "VeryLazy",
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user