1
0

fixes and improvements

This commit is contained in:
2025-02-13 20:23:23 +01:00
parent 6136857a05
commit d063a5461c
8 changed files with 112 additions and 70 deletions

0
keystrokes.txt Normal file
View File

View File

@@ -52,10 +52,6 @@ vim.opt.foldlevelstart = 99
vim.opt.foldnestmax = 6
vim.opt.incsearch = true -- search as characters are entered
vim.opt.tags:append({ ".git/tags", "tags" })
vim.opt.shell = "/bin/zsh"
-- remove trailing whitespace
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
pattern = { "*" },
@@ -97,4 +93,3 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
end,
desc = "Enable spellcheck for defined filetypes", -- Description for clarity
})

View File

@@ -47,10 +47,10 @@ map("n", "gl", "`.", { desc = "Jump to the last change in the file" })
-- map('n', '<C-up>', 'zr', { desc = 'Open all folds' })
-- map('n', '<C-S-up>', 'zR', { desc = 'Open all folds' })
map("n", "<S-up>", "<C-w><up>", { desc = "Move to split upwards" })
map("n", "<S-down>", "<C-w><down>", { desc = "Move to split upwards" })
map("n", "<S-left>", "<C-w><left>", { desc = "Move to split left" })
map("n", "<S-right>", "<C-w><right>", { desc = "Move to split right" })
-- map("n", "<S-up>", "<C-w><up>", { desc = "Move to split upwards" })
-- map("n", "<S-down>", "<C-w><down>", { desc = "Move to split upwards" })
-- map("n", "<S-left>", "<C-w><left>", { desc = "Move to split left" })
-- map("n", "<S-right>", "<C-w><right>", { desc = "Move to split right" })
map("n", "<C-up>", "<C-y>", { desc = "Move screen up one line" })
map("n", "<C-down>", "<C-e>", { desc = "Move screen down one line" })

View File

@@ -228,6 +228,8 @@ return {
["rust-analyzer"] = {},
},
},
-- brew install bash-language-server
bashls = {},
-- lua_ls = {
-- settings = {
-- Lua = {

View File

@@ -6,6 +6,7 @@ return {
local lint = require("lint")
lint.linters_by_ft = {
lua = { "luacheck" },
bash = { "bash" },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })

View File

@@ -8,12 +8,27 @@ return {
disable_when_zoomed = true, -- defaults to false
})
vim.keymap.set("n", "<S-left>", nvim_tmux_nav.NvimTmuxNavigateLeft)
vim.keymap.set("n", "<S-down>", nvim_tmux_nav.NvimTmuxNavigateDown)
vim.keymap.set("n", "<S-up>", nvim_tmux_nav.NvimTmuxNavigateUp)
vim.keymap.set("n", "<S-right>", nvim_tmux_nav.NvimTmuxNavigateRight)
vim.keymap.set("n", "<C-\\>", nvim_tmux_nav.NvimTmuxNavigateLastActive)
vim.keymap.set("n", "<C-Space>", nvim_tmux_nav.NvimTmuxNavigateNext)
vim.keymap.set(
"n",
"<S-left>",
nvim_tmux_nav.NvimTmuxNavigateLeft,
{ desc = "Move to the split to the left" }
)
vim.keymap.set("n", "<S-down>", nvim_tmux_nav.NvimTmuxNavigateDown, { desc = "Move to the split below" })
vim.keymap.set("n", "<S-up>", nvim_tmux_nav.NvimTmuxNavigateUp, { desc = "Move to the split above" })
vim.keymap.set(
"n",
"<S-right>",
nvim_tmux_nav.NvimTmuxNavigateRight,
{ desc = "Move to the split to the right" }
)
vim.keymap.set(
"n",
"<C-\\>",
nvim_tmux_nav.NvimTmuxNavigateLastActive,
{ desc = "Move to the last active split" }
)
vim.keymap.set("n", "<C-Space>", nvim_tmux_nav.NvimTmuxNavigateNext, { desc = "Move to the next split" })
end,
},
}

25
tmux/.is_vim.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Usage: is_vim.sh <tty>
# tty: Specify tty to check for vim process.
tty=$1
# Construct process tree.
children=();
pids=( $(ps -o pid= -t $tty) )
while read -r pid ppid
do
[[ -n pid && pid -ne ppid ]] && children[ppid]+=" $pid"
done <<< "$(ps -Ao pid=,ppid=)"
# Get all descendant pids of processes in $tty with BFS
idx=0
while (( ${#pids[@]} > idx ))
do
pid=${pids[idx++]}
pids+=( ${children[pid]-} )
done
# Check whether any child pids are vim
ps -o state=,comm= -p "${pids[@]}" | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'
exit $?

View File

@@ -29,8 +29,8 @@ set -g @tmux_window_name_shells "['bash', 'fish', 'sh', 'zsh']"
set -g @tmux_window_dir_programs "['nvim', 'vim', 'vi', 'git']"
set -g @tmux_window_name_use_tilde "True"
set -g @tmux_window_name_max_name_len "100"
set-option -g default-shell $SHELL
set -g default-command "$SHELL -i"
# set-option -g default-shell $SHELL
# set -g default-command "$SHELL -i"
# Other examples:
# set -g @plugin 'github_username/plugin_name'
@@ -61,8 +61,12 @@ setw -g mode-keys vi
# decide whether we're in a Vim process
#is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
# | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
is_vim="~/.is_vim.sh '#{pane_tty}'"
# is_vim="children=(); i=0; pids=( $(ps -o pid=,tty= | grep -iE '#{s|/dev/||:pane_tty}' | awk '\{print $1\}') ); \
# while read -r c p; do [[ -n c && c -ne p && p -ne 0 ]] && children[p]+=\" $\{c\}\"; done <<< \"$(ps -Ao pid=,ppid=)\"; \
# while (( $\{#pids[@]\} > i )); do pid=$\{pids[i++]\}; pids+=( $\{children[pid]-\} ); done; \
# ps -o state=,comm= -p \"$\{pids[@]\}\" | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
is_vim="~/is_vim.sh '#{pane_tty}'"
bind-key -n 'S-Left' if-shell "$is_vim" 'send-keys S-Left' 'select-pane -L'
bind-key -n 'S-Down' if-shell "$is_vim" 'send-keys S-Down' 'select-pane -D'