fixes and improvements
This commit is contained in:
0
keystrokes.txt
Normal file
0
keystrokes.txt
Normal file
@@ -5,43 +5,43 @@ vim.wo.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.mouse = "a"
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
vim.opt.breakindent = true -- Enable break indent
|
||||
vim.opt.undofile = true -- Save undo history
|
||||
vim.opt.ignorecase = true -- ignore case in searches by default
|
||||
vim.opt.smartcase = true -- but make it case sensitive if an uppercase is entered
|
||||
vim.w.signcolumn = "yes" -- Keep signcolumn on by default
|
||||
vim.opt.updatetime = 250 -- Decrease update time
|
||||
vim.opt.timeoutlen = 300 -- time to wait for a mapped sequence to complete (in milliseconds)
|
||||
vim.opt.backup = false -- creates a backup file
|
||||
vim.opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
|
||||
vim.opt.breakindent = true -- Enable break indent
|
||||
vim.opt.undofile = true -- Save undo history
|
||||
vim.opt.ignorecase = true -- ignore case in searches by default
|
||||
vim.opt.smartcase = true -- but make it case sensitive if an uppercase is entered
|
||||
vim.w.signcolumn = "yes" -- Keep signcolumn on by default
|
||||
vim.opt.updatetime = 250 -- Decrease update time
|
||||
vim.opt.timeoutlen = 300 -- time to wait for a mapped sequence to complete (in milliseconds)
|
||||
vim.opt.backup = false -- creates a backup file
|
||||
vim.opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
|
||||
vim.opt.completeopt = "menuone,noselect" -- Set completeopt to have a better completion experience
|
||||
vim.opt.termguicolors = true -- set termguicolors to enable highlight groups
|
||||
vim.opt.whichwrap = "bs<>[]hl" -- which "horizontal" keys are allowed to travel to prev/next line
|
||||
vim.opt.wrap = false -- display lines as one long line
|
||||
vim.opt.linebreak = true -- companion to wrap don't split words
|
||||
vim.opt.scrolloff = 4 -- minimal number of screen lines to keep above and below the cursor
|
||||
vim.opt.sidescrolloff = 8 -- minimal number of screen columns either side of cursor if wrap is `false`
|
||||
vim.opt.numberwidth = 2 -- set number column width to 2 {default 4}
|
||||
vim.opt.shiftwidth = 4 -- Number of spaces inserted when indenting
|
||||
vim.opt.tabstop = 4 -- A TAB character looks like 4 spaces
|
||||
vim.opt.softtabstop = 4 -- Number of spaces inserted instead of a TAB character
|
||||
vim.opt.expandtab = true -- Pressing the TAB key will insert spaces instead of a TAB character
|
||||
vim.opt.termguicolors = true -- set termguicolors to enable highlight groups
|
||||
vim.opt.whichwrap = "bs<>[]hl" -- which "horizontal" keys are allowed to travel to prev/next line
|
||||
vim.opt.wrap = false -- display lines as one long line
|
||||
vim.opt.linebreak = true -- companion to wrap don't split words
|
||||
vim.opt.scrolloff = 4 -- minimal number of screen lines to keep above and below the cursor
|
||||
vim.opt.sidescrolloff = 8 -- minimal number of screen columns either side of cursor if wrap is `false`
|
||||
vim.opt.numberwidth = 2 -- set number column width to 2 {default 4}
|
||||
vim.opt.shiftwidth = 4 -- Number of spaces inserted when indenting
|
||||
vim.opt.tabstop = 4 -- A TAB character looks like 4 spaces
|
||||
vim.opt.softtabstop = 4 -- Number of spaces inserted instead of a TAB character
|
||||
vim.opt.expandtab = true -- Pressing the TAB key will insert spaces instead of a TAB character
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.splitbelow = true -- open new vertical split bottom
|
||||
vim.opt.splitright = true -- open new horizontal splits right
|
||||
vim.opt.swapfile = false -- creates a swapfile
|
||||
vim.opt.smartindent = true -- make indenting smarter again
|
||||
vim.opt.showtabline = 2 -- always show tabs
|
||||
vim.opt.backspace = "indent,eol,start" -- allow backspace on
|
||||
vim.opt.pumheight = 10 -- pop up menu height
|
||||
vim.wo.conceallevel = 0 -- so that `` is visible in markdown files
|
||||
vim.opt.encoding = "utf-8" -- the encoding written to a file
|
||||
vim.opt.cmdheight = 1 -- more space in the neovim command line for displaying messages
|
||||
vim.opt.splitbelow = true -- open new vertical split bottom
|
||||
vim.opt.splitright = true -- open new horizontal splits right
|
||||
vim.opt.swapfile = false -- creates a swapfile
|
||||
vim.opt.smartindent = true -- make indenting smarter again
|
||||
vim.opt.showtabline = 2 -- always show tabs
|
||||
vim.opt.backspace = "indent,eol,start" -- allow backspace on
|
||||
vim.opt.pumheight = 10 -- pop up menu height
|
||||
vim.wo.conceallevel = 0 -- so that `` is visible in markdown files
|
||||
vim.opt.encoding = "utf-8" -- the encoding written to a file
|
||||
vim.opt.cmdheight = 1 -- more space in the neovim command line for displaying messages
|
||||
vim.opt.autoindent = true
|
||||
|
||||
vim.opt.shortmess:append("c") -- don't give |ins-completion-menu| messages
|
||||
vim.opt.iskeyword:append("-") -- hyphenated words recognized by searches
|
||||
vim.opt.formatoptions:remove({ "c", "r", "o" }) -- don't insert the current comment leader automatically for auto-wrapping comments using 'textwidth', hitting <Enter> in insert mode, or hitting 'o' or 'O' in normal mode.
|
||||
vim.opt.shortmess:append("c") -- don't give |ins-completion-menu| messages
|
||||
vim.opt.iskeyword:append("-") -- hyphenated words recognized by searches
|
||||
vim.opt.formatoptions:remove({ "c", "r", "o" }) -- don't insert the current comment leader automatically for auto-wrapping comments using 'textwidth', hitting <Enter> in insert mode, or hitting 'o' or 'O' in normal mode.
|
||||
vim.opt.runtimepath:remove("/usr/share/vim/vimfiles") -- separate vim plugins from neovim in case vim still in use
|
||||
|
||||
vim.opt.foldmethod = "expr"
|
||||
@@ -52,31 +52,27 @@ 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 = { "*" },
|
||||
callback = function()
|
||||
local save_cursor = vim.fn.getpos(".")
|
||||
pcall(function()
|
||||
vim.cmd([[%s/\s\+$//e]])
|
||||
end)
|
||||
vim.fn.setpos(".", save_cursor)
|
||||
end,
|
||||
pattern = { "*" },
|
||||
callback = function()
|
||||
local save_cursor = vim.fn.getpos(".")
|
||||
pcall(function()
|
||||
vim.cmd([[%s/\s\+$//e]])
|
||||
end)
|
||||
vim.fn.setpos(".", save_cursor)
|
||||
end,
|
||||
})
|
||||
|
||||
-- local uv = vim.uv
|
||||
local uv = vim.loop
|
||||
|
||||
vim.api.nvim_create_autocmd({ "VimEnter", "VimLeave" }, {
|
||||
callback = function()
|
||||
if vim.env.TMUX_PLUGIN_MANAGER_PATH then
|
||||
uv.spawn(vim.env.TMUX_PLUGIN_MANAGER_PATH .. "/tmux-window-name/scripts/rename_session_windows.py", {})
|
||||
end
|
||||
end,
|
||||
callback = function()
|
||||
if vim.env.TMUX_PLUGIN_MANAGER_PATH then
|
||||
uv.spawn(vim.env.TMUX_PLUGIN_MANAGER_PATH .. "/tmux-window-name/scripts/rename_session_windows.py", {})
|
||||
end
|
||||
end,
|
||||
})
|
||||
--
|
||||
-- Filetypes to enable spellcheck
|
||||
@@ -90,11 +86,10 @@ vim.api.nvim_create_augroup("Spellcheck", { clear = true })
|
||||
|
||||
-- Create an autocommand to enable spellcheck for specified file types
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
group = "Spellcheck", -- Grouping the command for easier management
|
||||
pattern = spell_types, -- Only apply to these file types
|
||||
callback = function()
|
||||
vim.opt_local.spell = true -- Enable spellcheck for these file types
|
||||
end,
|
||||
desc = "Enable spellcheck for defined filetypes", -- Description for clarity
|
||||
group = "Spellcheck", -- Grouping the command for easier management
|
||||
pattern = spell_types, -- Only apply to these file types
|
||||
callback = function()
|
||||
vim.opt_local.spell = true -- Enable spellcheck for these file types
|
||||
end,
|
||||
desc = "Enable spellcheck for defined filetypes", -- Description for clarity
|
||||
})
|
||||
|
||||
|
||||
@@ -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" })
|
||||
|
||||
@@ -228,6 +228,8 @@ return {
|
||||
["rust-analyzer"] = {},
|
||||
},
|
||||
},
|
||||
-- brew install bash-language-server
|
||||
bashls = {},
|
||||
-- lua_ls = {
|
||||
-- settings = {
|
||||
-- Lua = {
|
||||
|
||||
@@ -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 })
|
||||
|
||||
|
||||
@@ -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
25
tmux/.is_vim.sh
Executable 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 $?
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user