summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/nvim/init.lua68
-rw-r--r--.config/shell/envvarrc1
-rw-r--r--.config/via/shortcuts10
3 files changed, 69 insertions, 10 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index f100cd6..2c7e130 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -1,5 +1,5 @@
------------------------------------------------------------
--- Filip's neovim config
+-- Filip's config for the Zoomer Editor
------------------------------------------------------------
------------------------------------------------------------
@@ -16,7 +16,6 @@ vim.opt.ruler = true
vim.opt.cursorline = true
-- Modern / visual quality
-vim.opt.termguicolors = true
vim.opt.signcolumn = "yes"
vim.opt.pumblend = 10
vim.opt.winblend = 10
@@ -27,6 +26,17 @@ vim.opt.winblend = 10
vim.opt.splitbelow = true
vim.opt.splitright = true
+-- Preferred width and height for automatic window resizing
+vim.opt.winwidth = 10
+vim.opt.winheight = 10
+
+-- Minimum width and height a window can shrink to
+vim.opt.winminwidth = 10
+vim.opt.winminheight = 10
+
+-- Automatically balance windows when opening/closing
+vim.opt.equalalways = true
+
------------------------------------------------------------
-- Timing & performance related
------------------------------------------------------------
@@ -82,10 +92,13 @@ vim.opt.termguicolors = true
vim.cmd.colorscheme("pablo")
-- Transparency
-vim.api.nvim_set_hl(0, "Normal", { bg = "none", ctermbg = "none" })
-vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none", ctermbg = "none" })
-vim.api.nvim_set_hl(0, "SignColumn", { bg = "none" })
-vim.api.nvim_set_hl(0, "FoldColumn", { bg = "none" })
+local function transparent_hl(group)
+ vim.api.nvim_set_hl(0, group, { bg = "none", ctermbg = "none" })
+end
+
+for _, group in ipairs({ "Normal", "NormalFloat", "SignColumn", "FoldColumn" }) do
+ transparent_hl(group)
+end
------------------------------------------------------------
-- Autocommands
@@ -114,6 +127,28 @@ vim.api.nvim_create_autocmd("BufWritePre", {
end,
})
+vim.api.nvim_create_autocmd("BufUnload", {
+ pattern = "*.tex",
+ callback = function()
+ -- Get the full path of the file being closed
+ local file = vim.fn.expand("%:p")
+
+ -- Check if the file actually exists (to avoid errors on temporary buffers)
+ if file ~= "" then
+ -- Pass the file path as the first argument to the script
+ vim.fn.jobstart({ "texclear", file })
+ end
+ end,
+})
+
+-- Make help windows vertical splits
+vim.api.nvim_create_autocmd("FileType", {
+ pattern = "help",
+ callback = function()
+ vim.cmd("wincmd L")
+ end,
+})
+
------------------------------------------------------------
-- Key mappings
------------------------------------------------------------
@@ -160,6 +195,27 @@ map("v", "<C-j>", '"+y', { desc = "Yank selection to system clipboard" })
-- Toggle buffers
map("n", "<Tab><Tab>", "<C-^>", { desc = "Toggle last / alternate buffer" })
+-- Split window vertically
+map("n", "vv", "<C-w>v", { desc = "Split the current window vertically" })
+
+-- Pressing <leader>h will prompt for a help topic and open it in vsplit
+map("n", "<leader>h", ":vert help ", { desc = "Open help vertically" })
+
+-- Open messages in vplit
+map("n", "<leader>m", ":vnew | put =execute('messages')<CR>", { desc = "Open messages in vsplit" })
+
+-- Repeat action on visual block
+map("v", ".", ":normal .<CR>", { desc = "Repeat action on visual block" })
+
+-- Force write with sudo
+vim.cmd([[cabbrev w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!]])
+
+-- Resize windows
+map("n", "<C-Up>", ":resize +2<CR>", { desc = "Increase window height" })
+map("n", "<C-Down>", ":resize -2<CR>", { desc = "Decrease window height" })
+map("n", "<C-Left>", ":vertical resize +2<CR>", { desc = "Increase window width" })
+map("n", "<C-Right>", ":vertical resize -2<CR>", { desc = "Decrease window width" })
+
------------------------------------------------------------
-- Tabs & indentation
------------------------------------------------------------
diff --git a/.config/shell/envvarrc b/.config/shell/envvarrc
index b79294d..c38c178 100644
--- a/.config/shell/envvarrc
+++ b/.config/shell/envvarrc
@@ -76,6 +76,7 @@ export NVIMSNIPPETS="$XDG_CONFIG_HOME/nvim/lua/snips"
export TIGRC_USER="$XDG_CONFIG_HOME/tig/tigrc"
export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/starship.toml"
export STARSHIP_CACHE="$XDG_CACHE_HOME/starship/cache"
+export GIT_ASKPASS="$SCRIPTS/askpass"
export SSH_ASKPASS="$SCRIPTS/askpass"
export SUDO_ASKPASS="$SCRIPTS/askpass"
export MOZ_USE_XINPUT2=1
diff --git a/.config/via/shortcuts b/.config/via/shortcuts
index e00609d..6e74522 100644
--- a/.config/via/shortcuts
+++ b/.config/via/shortcuts
@@ -3,13 +3,15 @@
/home/filipek/.config/shell/envvarc
/home/filipek/.config/shell/aliasrc
/home/filipek/.config/vim/.vimrc
-zathura
-librewolf
-firefox
+anki
+bmks
deploy
dpass
+drecord
dtrans
dz
+firefox
+librewolf
mansplain
mounter
notesplain
@@ -20,4 +22,4 @@ testcam
todo
tutorialvids
wrocwttr
-anki
+zathura