Compare commits
37 Commits
7f83427749
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
316eefe916
|
|||
|
3a821d832b
|
|||
|
b291163a80
|
|||
|
2e2bad65a2
|
|||
|
c46b1c5ea1
|
|||
|
5f40b97e9a
|
|||
|
5599ce14d7
|
|||
|
4008bb543b
|
|||
|
d0abb14567
|
|||
|
9e18be760c
|
|||
|
04d3d6e87f
|
|||
|
526a37301a
|
|||
|
7dc9efc0e4
|
|||
|
9bc8b4b93f
|
|||
|
ead724b75b
|
|||
|
1c5beed613
|
|||
|
2dd1a80036
|
|||
|
4f2a74e546
|
|||
|
cb1821ba33
|
|||
|
5128d15251
|
|||
|
2b31632914
|
|||
|
27791acf50
|
|||
|
8aa76b3ee6
|
|||
|
6b866f5474
|
|||
|
4f6929bcce
|
|||
|
2495d835b4
|
|||
|
dda2ff640e
|
|||
|
87398bf712
|
|||
|
0a5b6d0767
|
|||
|
5b8f54b0cb
|
|||
|
ef5b2911bf
|
|||
|
768cb4ed4a
|
|||
|
f2ce78b6b3
|
|||
|
a3d2bf985c
|
|||
|
e8c5ec93f1
|
|||
|
ae52ba20d2
|
|||
|
ea2867fc9f
|
@@ -185,3 +185,6 @@ EXEC 01;92
|
||||
*.opus 00;36
|
||||
*.spx 00;36
|
||||
*.xspf 00;36
|
||||
|
||||
## Others
|
||||
*.pdf 01;95
|
||||
|
||||
@@ -79,6 +79,8 @@ bindsym $mod+Shift+v split horizontal
|
||||
bindsym $mod+f fullscreen toggle
|
||||
|
||||
# change container layout (stacked, tabbed, toggle split)
|
||||
#bindsym $mod+s layout stacking
|
||||
#bindsym $mod+w layout tabbed
|
||||
bindsym $mod+e layout toggle split
|
||||
|
||||
# toggle tiling / floating
|
||||
@@ -100,13 +102,15 @@ bindsym $mod+6 exec ~/.config/i3/multi-monitor-workspaces.sh -s 6
|
||||
bindsym $mod+7 exec ~/.config/i3/multi-monitor-workspaces.sh -s 7
|
||||
bindsym $mod+8 exec ~/.config/i3/multi-monitor-workspaces.sh -s 8
|
||||
bindsym $mod+9 exec ~/.config/i3/multi-monitor-workspaces.sh -s 9
|
||||
bindsym $mod+0 exec ~/.config/i3/multi-monitor-workspaces.sh -s 0
|
||||
bindsym $mod+0 exec ~/.config/i3/multi-monitor-workspaces.sh -s 10
|
||||
|
||||
# switch back to the previous workspace
|
||||
workspace_auto_back_and_forth yes
|
||||
bindsym $mod+Tab exec i3-msg workspace "$( \
|
||||
i3-msg -t get_workspaces | \
|
||||
jq -r '.[] | select(.focused).name')"
|
||||
bindsym $mod+Tab workspace back_and_forth
|
||||
|
||||
# switch workspaces forward and backward
|
||||
bindsym $mod+Next workspace next
|
||||
bindsym $mod+Prior workspace prev
|
||||
|
||||
# Switch visible workspaces (e.g. multi monitor setup)
|
||||
bindsym $mod+Shift+Tab exec i3-msg workspace "$( \
|
||||
@@ -124,7 +128,7 @@ bindsym $mod+Shift+6 exec ~/.config/i3/multi-monitor-workspaces.sh -m 6
|
||||
bindsym $mod+Shift+7 exec ~/.config/i3/multi-monitor-workspaces.sh -m 7
|
||||
bindsym $mod+Shift+8 exec ~/.config/i3/multi-monitor-workspaces.sh -m 8
|
||||
bindsym $mod+Shift+9 exec ~/.config/i3/multi-monitor-workspaces.sh -m 9
|
||||
bindsym $mod+Shift+0 exec ~/.config/i3/multi-monitor-workspaces.sh -m 0
|
||||
bindsym $mod+Shift+0 exec ~/.config/i3/multi-monitor-workspaces.sh -m 10
|
||||
|
||||
# move focused container and switch to workspace
|
||||
bindsym Mod1+Shift+1 exec ~/.config/i3/multi-monitor-workspaces.sh -ms 1
|
||||
@@ -136,7 +140,7 @@ bindsym Mod1+Shift+6 exec ~/.config/i3/multi-monitor-workspaces.sh -ms 6
|
||||
bindsym Mod1+Shift+7 exec ~/.config/i3/multi-monitor-workspaces.sh -ms 7
|
||||
bindsym Mod1+Shift+8 exec ~/.config/i3/multi-monitor-workspaces.sh -ms 8
|
||||
bindsym Mod1+Shift+9 exec ~/.config/i3/multi-monitor-workspaces.sh -ms 9
|
||||
bindsym Mod1+Shift+0 exec ~/.config/i3/multi-monitor-workspaces.sh -ms 0
|
||||
bindsym Mod1+Shift+0 exec ~/.config/i3/multi-monitor-workspaces.sh -ms 10
|
||||
|
||||
# reload the configuration file
|
||||
bindsym $mod+Shift+c reload
|
||||
|
||||
@@ -25,25 +25,12 @@ done
|
||||
shift $((OPTIND - 1))
|
||||
[ $# -gt 0 ] || usage
|
||||
|
||||
outputs="$(i3-msg -t get_outputs | jq -r '.[] | select(.active).name')"
|
||||
num_outs="$(printf "%s\n" "$outputs" | wc -l)"
|
||||
|
||||
if [ "$num_outs" -lt 2 ]; then
|
||||
# only one monitor
|
||||
workspace="$1"
|
||||
else
|
||||
name="$(i3-msg -t get_tree \
|
||||
| jq -r '.. | objects | select(.focused).output')"
|
||||
num="$(printf "%s\n" "$outputs" \
|
||||
| grep -Fxn "$name" \
|
||||
| cut -d: -f1)"
|
||||
num="$((num - 1))"
|
||||
|
||||
# Omit the number on the first monitor
|
||||
[ "$num" -gt 0 ] || num=
|
||||
|
||||
workspace="$num$1"
|
||||
fi
|
||||
# NOTE: See `strip-wsnames` in polybar config. With it every monitor has its own
|
||||
# 1-10 workspaces
|
||||
workspace="$1: $name"
|
||||
|
||||
if [ -z "$switch" ] && [ -z "$move" ]; then
|
||||
printf "%s\n" "$workspace"
|
||||
|
||||
@@ -7,21 +7,19 @@
|
||||
# Print the current working directory of the focused kitty window. Returns 4 if
|
||||
# none exist or is focused.
|
||||
|
||||
if [ -n "$KITTY_LISTEN_ON" ]; then
|
||||
socket_path="${KITTY_LISTEN_ON#unix:}"
|
||||
else
|
||||
socket_path="${TMPDIR:-/tmp}/kitty.$USER/kitty${1:+-$1}.sock"
|
||||
fi
|
||||
[ -e "$socket_path" ] || exit 1
|
||||
|
||||
# NOTE: the backticks are used for hacky line-continuation, taken from
|
||||
# https://stackoverflow.com/a/7729087/2092762c9
|
||||
kitten @ --to unix:"$socket_path" ls \
|
||||
| jq -er ".[]`
|
||||
` | select(.is_focused).tabs.[]`
|
||||
` | select(.is_focused).windows.[]`
|
||||
` | select(.is_focused).cwd"
|
||||
|
||||
# An alternative version that uses recursive descent to find focused objects
|
||||
# that also have a `.cwd` key:
|
||||
#
|
||||
# | jq -er "..`
|
||||
# ` | objects`
|
||||
# ` | select(.is_focused)`
|
||||
# ` | to_entries.[]`
|
||||
# ` | select(.key == \"cwd\").value"
|
||||
# NOTE: Unfortunately kitten-@-ls(1) is slow, so communicate with the socket
|
||||
# directly.
|
||||
printf '\eP@kitty-cmd{%s,%s,%s}\e\\' \
|
||||
'"cmd":"ls"' \
|
||||
'"version":[0,26,0]' \
|
||||
'"payload":{"match":"state:focused"}' \
|
||||
| nc -U -q0 "$socket_path" \
|
||||
| awk '{ print substr($0, 13, length($0) - 14) }' \
|
||||
| jq -er ".data | fromjson | .[].tabs.[].windows.[].cwd"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#: <https://sw.kovidgoyal.net/kitty/kittens/choose-fonts/#font-spec-
|
||||
#: syntax>.
|
||||
|
||||
# font_size 11.0
|
||||
font_size 12.0
|
||||
|
||||
#: Font size (in pts).
|
||||
|
||||
@@ -630,7 +630,7 @@ mouse_hide_wait -1
|
||||
#: If empty (default) select_by_word_characters will be used for both
|
||||
#: directions.
|
||||
|
||||
# click_interval -1.0
|
||||
click_interval 0.4
|
||||
|
||||
#: The interval between successive clicks to detect double/triple
|
||||
#: clicks (in seconds). Negative numbers will use the system default
|
||||
|
||||
@@ -6,11 +6,17 @@
|
||||
# NOTE: the current file can be edited with `v` already, but this doesn't work
|
||||
# when reading from stdin
|
||||
# NOTE: ^P omits the "done" message
|
||||
# NOTE: '' jumps back to the previous position
|
||||
#
|
||||
# edit in vim without any ANSI SGR sequences (e.g. color)
|
||||
e noaction g|$no-ansi-sgr | nvim -\n
|
||||
# edit in vim without any ANSI escape sequences (e.g. color)
|
||||
e noaction g|$no-ansi | nvim -\n''
|
||||
# edit in vim while keeping them
|
||||
E noaction g|$nvim -\n
|
||||
E noaction g|$nvim -\n''
|
||||
# edit current screen in vim
|
||||
^E noaction |.no-ansi | nvim -\n
|
||||
|
||||
# copy whole file
|
||||
^Y noaction g|$xclip -selection clipboard\n''
|
||||
|
||||
#env
|
||||
# NOTE: Lines need a trailing space when concatenating
|
||||
|
||||
@@ -40,6 +40,7 @@ enable-ipc = true
|
||||
type = internal/i3
|
||||
pin-workspaces = true
|
||||
format = <label-state> <label-mode>
|
||||
strip-wsnames = true
|
||||
index-sort = true
|
||||
wrapping-scroll = false
|
||||
|
||||
|
||||
@@ -22,10 +22,11 @@ done
|
||||
if ! pgrep -ax polybar >/dev/null 2>&1; then
|
||||
# launch Polybar on every monitor
|
||||
# https://github.com/polybar/polybar/issues/763
|
||||
while read -r m; do
|
||||
export MONITOR="${m%%:*}"
|
||||
polybar --list-monitors \
|
||||
| cut -d: -f1 \
|
||||
| xargs -I'{}' -P0 \
|
||||
env MONITOR='{}' \
|
||||
polybar --reload -c "$BASE_DIR/config" main &
|
||||
done <<<"$(polybar --list-monitors)"
|
||||
|
||||
echo "Polybar launched..."
|
||||
else
|
||||
|
||||
@@ -37,18 +37,30 @@ setlocal showbreak=NONE
|
||||
" This is very hacky.
|
||||
|
||||
" Only if WinResized is supported
|
||||
if has('##WinResized')
|
||||
if exists('##WinResized')
|
||||
|
||||
augroup man_resized
|
||||
" The reload has to be delayed slightly, since with an `edit` directly in
|
||||
" the autocmd, the buffer will just be cleared? (TODO)
|
||||
" NOTE: One could add a wrapper function that checks for the existence of
|
||||
" already running timers similar to how it's done in the
|
||||
" highlight_current group (see autocommands.vim), but this feels
|
||||
" overkill here.
|
||||
au! WinResized <buffer> call timer_start(10, function("s:redraw_delayed"))
|
||||
au! WinResized <buffer> call s:redraw_man(v:event)
|
||||
augroup END
|
||||
|
||||
function s:redraw_man(event)
|
||||
if exists('w:disable_man_resizing')
|
||||
return
|
||||
endif
|
||||
|
||||
if exists('w:man_resizing_timer_id')
|
||||
call timer_stop(w:man_resizing_timer_id)
|
||||
endif
|
||||
|
||||
echo a:event
|
||||
|
||||
" TODO: make sure that a:event contains window number and that the width
|
||||
" actually changed with getwininfo()
|
||||
let w:man_resizing_timer_id = timer_start(10, function("s:redraw_delayed"))
|
||||
endfunction
|
||||
|
||||
" The function can't be redefined during the reload of the ftplugin (i.e.
|
||||
" triggered by `edit`), since it is currently executing (i.e. `edit`):
|
||||
"
|
||||
@@ -56,6 +68,8 @@ augroup END
|
||||
"
|
||||
if !exists("*s:redraw_delayed")
|
||||
function s:redraw_delayed(timer_id)
|
||||
unlet w:man_resizing_timer_id
|
||||
|
||||
" Try to keep the position as close as possible, since edit will move to
|
||||
" the start of the file
|
||||
" TODO: this should be more accurate
|
||||
@@ -72,5 +86,5 @@ endif
|
||||
" lines, messing up the whole buffer. Since this is distracting, turn it off.
|
||||
setlocal nowrap
|
||||
|
||||
endif " has('##WinResized')
|
||||
endif " exists('##WinResized')
|
||||
" ------------------------------------------------------------------------------
|
||||
|
||||
@@ -3,6 +3,9 @@ setlocal colorcolumn+=51
|
||||
setlocal textwidth=72
|
||||
" Spell checking always enabled
|
||||
setlocal spell spelllang=en
|
||||
" Disable C-indentation as it messes up formatting of paragraphs containing
|
||||
" parentheses
|
||||
setlocal nocindent
|
||||
|
||||
" Disable gutentags as it seems to regenerate the entire tags file when editing
|
||||
" git-commits...
|
||||
@@ -17,3 +20,27 @@ let g:gutentags_enabled = 0
|
||||
" When aborting a commit I usually use :cq which I can't when committing through
|
||||
" fugitive. Abbreviate it to something that works.
|
||||
cabbrev <buffer> cq %d <Bar> x
|
||||
|
||||
" Fold file listings (staged, unstaged, untracked, ...) and diff
|
||||
setlocal foldmethod=syntax
|
||||
|
||||
" Unfold staged files and diff. inspired by:
|
||||
" https://vi.stackexchange.com/questions/4050/how-to-search-for-pattern-in-certain-syntax-regions/27008#27008
|
||||
if has("patch-8.2.0915") || has("nvim-0.7.0")
|
||||
|
||||
function s:open_fold(group, content)
|
||||
" Find line containing `content` that is highlighted with `group`
|
||||
let l:line_nr = search(a:content, "n", 0, 0, { ->
|
||||
\ synstack('.', col('.'))
|
||||
\ ->map('synIDattr(v:val, "name")')
|
||||
\ ->match(a:group) < 0 })
|
||||
if l:line_nr <= 0
|
||||
return
|
||||
endif
|
||||
execute l:line_nr->string() .. "foldopen"
|
||||
endfunction
|
||||
|
||||
call s:open_fold("gitcommitSelected", "Changes to be committed:")
|
||||
call s:open_fold("gitcommitDiff", "diff --")
|
||||
|
||||
endif " has("patch-8.2.0915") || has("nvim-0.7.0")
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
" Turn on line-wrapping
|
||||
setlocal wrap
|
||||
" Disable C-indentation as it messes up formatting of paragraphs containing
|
||||
" parentheses
|
||||
setlocal nocindent
|
||||
|
||||
" Fold by sections
|
||||
function! MdSectionFold()
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
" Turn on line-wrapping
|
||||
setlocal wrap
|
||||
" Disable C-indentation as it messes up formatting of paragraphs containing
|
||||
" parentheses
|
||||
setlocal nocindent
|
||||
|
||||
" Close the quickfix window after a cursor movement
|
||||
let g:vimtex_quickfix_autoclose_after_keystrokes = 1
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
" Disable C-indentation as it messes up formatting of paragraphs containing
|
||||
" parentheses
|
||||
setlocal nocindent
|
||||
|
||||
" Don't highlight Unicode table separator (e.g. vertical box drawing character).
|
||||
" See vimrc.d/looks.vim for w:ignore_non_ascii_chars
|
||||
if vimwiki#vars#get_syntaxlocal('rxTableSep') !~ '[\d0-\d127]'
|
||||
|
||||
@@ -26,10 +26,13 @@ endif
|
||||
" ctags
|
||||
if (executable('ctags'))
|
||||
packadd vim-gutentags
|
||||
" Don't index these folders
|
||||
let g:gutentags_ctags_exclude = [
|
||||
\ 'node_modules/*',
|
||||
\ '.git/*',
|
||||
\ 'build/*'
|
||||
\ 'build/*',
|
||||
\ 'venv/*',
|
||||
\ '__pycache__/*'
|
||||
\]
|
||||
endif
|
||||
|
||||
@@ -38,6 +41,12 @@ if (exists("g:loaded_tmux_navigator"))
|
||||
let g:tmux_navigator_disable_when_zoomed = 1
|
||||
endif
|
||||
|
||||
if (get(g:, 'loaded_fzf_vim'))
|
||||
let g:fzf_vim = {}
|
||||
" Use location list instead of quickfix list
|
||||
let g:fzf_vim.listproc = { list -> fzf#vim#listproc#location(list) }
|
||||
endif
|
||||
|
||||
if (get(g:, 'loaded_vimwiki'))
|
||||
" Use vertical box drawing character as table separator
|
||||
call vimwiki#vars#set_syntaxlocal('rxTableSep', '│')
|
||||
@@ -47,4 +56,6 @@ if exists("g:loaded_nrrw_rgn")
|
||||
" Open narrow window above or to the left of the current window (default
|
||||
" is topleft). See :h aboveleft etc.
|
||||
let g:nrrw_topbot_leftright = 'aboveleft'
|
||||
" Leave one more line of padding when the window is small
|
||||
let g:nrrw_rgn_pad = 1
|
||||
endif
|
||||
|
||||
@@ -64,7 +64,7 @@ endif
|
||||
|
||||
" Make <CR> to accept selected completion item or notify coc.nvim to format
|
||||
" <C-g>u starts a new undo break, please make your own choice.
|
||||
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
|
||||
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#_select_confirm()
|
||||
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
||||
|
||||
" Use `[g` and `]g` to navigate diagnostics
|
||||
|
||||
@@ -119,6 +119,15 @@ if (exists('g:loaded_gitgutter'))
|
||||
" lines have been changed.
|
||||
set foldtext=gitgutter#fold#foldtext()
|
||||
endif
|
||||
" Use the number column for the signcolumn (e.g. gitgutter, lsp diagnostics),
|
||||
" but don't fallback to 'auto' when &number is off
|
||||
" TODO: install autocommand to set signcolumn to yes when number is turned off
|
||||
" (and back to number when turned back on)
|
||||
if &number
|
||||
set signcolumn=number
|
||||
else
|
||||
set signcolumn=yes
|
||||
endif
|
||||
|
||||
" Netrw
|
||||
" Use tree style listing
|
||||
|
||||
@@ -108,26 +108,39 @@ if (get(g:, 'loaded_fzf'))
|
||||
endif
|
||||
|
||||
" Search for selected text.
|
||||
" Modified from https://vim.fandom.com/wiki/Search_for_visually_selected_text
|
||||
function! GetVisualSelection()
|
||||
let l:old_reg = getreg('"')
|
||||
let l:old_regtype = getregtype('"')
|
||||
" Modified version of:
|
||||
" https://vim.fandom.com/wiki/Search_for_visually_selected_text
|
||||
" and https://github.com/neovim/neovim/blob/08847a9ea15a/runtime/lua/vim/_defaults.lua#L73-L79
|
||||
function! GetVisualSelection(escape = "", byteescape = 'n')
|
||||
let l:save_reg = getreginfo('"')
|
||||
norm gvy
|
||||
let l:sel = getreg('"')
|
||||
call setreg('"', l:old_reg, l:old_regtype)
|
||||
call setreg('"', l:save_reg)
|
||||
|
||||
let l:sel = l:sel->escape(a:escape)
|
||||
for l:char in a:byteescape
|
||||
let l:sel = l:sel->substitute('\'..l:char, '\\'..l:char, 'g')
|
||||
endfor
|
||||
|
||||
return l:sel
|
||||
endfunction
|
||||
|
||||
vmap * /\V<C-R>=escape(GetVisualSelection(),'/\')<CR><CR>
|
||||
vmap # ?\V<C-R>=escape(GetVisualSelection(),'?\')<CR><CR>
|
||||
" In case these do not exist already (At the time of writing only Neovim adds
|
||||
" mappings for these)
|
||||
if maparg('*', 'v', 0, 1) == {}
|
||||
vmap * /\V<C-R>=GetVisualSelection('/\')<CR><CR>
|
||||
vmap # ?\V<C-R>=GetVisualSelection('?\')<CR><CR>
|
||||
endif
|
||||
|
||||
" Extended `*`. Starts vim search (without jump) and ripgrep
|
||||
nmap <leader>* :let @/ = '\<' . expand('<cword>') . '\>' <bar>
|
||||
\ set hlsearch <bar>
|
||||
\ Rg \b<C-R>=expand('<cword>')<CR>\b<CR>
|
||||
vmap <leader>* :<C-U>let @/ = "\\V<C-R>=escape(escape(GetVisualSelection(), '\'), '"\')<CR>" <bar>
|
||||
" TODO: pass --multiline to rg when multiple lines selected
|
||||
" TODO: Use ^ and $ anchors in visual-line mode
|
||||
vmap <leader>* :<C-U>let @/ = "\\V<C-R>=escape(GetVisualSelection('\'), '"\')<CR>" <bar>
|
||||
\ set hlsearch <bar>
|
||||
\ Rg <C-R>=escape(GetVisualSelection(), '.\[]<bar>*+?{}^$()')<CR><CR>
|
||||
\ Rg <C-R>=GetVisualSelection('.\[]<bar>*+?{}^$()', 'nt')<CR><CR>
|
||||
nmap <leader>g* :let @/ = expand('<cword>') <bar>
|
||||
\ set hlsearch <bar>
|
||||
\ Rg <C-R>=expand('<cword>')<CR><CR>
|
||||
@@ -168,6 +181,8 @@ if exists('g:loaded_fugitive')
|
||||
nmap <leader>gcc <Cmd>G commit<CR>
|
||||
" Amend the current commit and open the message in a split
|
||||
nmap <leader>gca <Cmd>G commit --amend<CR>
|
||||
" Commit with the last commit message as template
|
||||
nmap <leader>gclm <Cmd>G commit-last-msg<CR>
|
||||
" Move to root of directory
|
||||
nmap <leader>gcd <Cmd>Gcd<CR>
|
||||
" git blame in scroll bound vertical split (only the commit hashes, see
|
||||
@@ -437,7 +452,7 @@ vnoremap <leader><C-L> gu
|
||||
" `ExpandVisualSelection(1)` which results in a block selection that spans over
|
||||
" all other TODOs as well.
|
||||
function! ExpandVisualSelection(direction)
|
||||
let l:sel = escape(GetVisualSelection(), '\')
|
||||
let l:sel = GetVisualSelection('\')
|
||||
normal gv
|
||||
|
||||
" Move the cursor onto the side of the selection that points in the
|
||||
|
||||
@@ -50,14 +50,24 @@ if (get(g:, 'loaded_fzf'))
|
||||
endif
|
||||
endif
|
||||
|
||||
" Get red from my colorscheme
|
||||
let s:red = {}
|
||||
if exists("*onedark#GetColors")
|
||||
let s:red = onedark#GetColors()->get("red", {})
|
||||
endif
|
||||
let s:red_cterm = s:red->get("cterm", "red")
|
||||
let s:red_gui = s:red->get("gui", "red")
|
||||
|
||||
" Highlight trailing whitespaces
|
||||
if match(&listchars, 'trail: \@!') > -1 && match(&listchars, '\vtab:( +)@!') > -1
|
||||
" Use foreground for coloring if tabs and trailing spaces are displayed
|
||||
" as non-space characters
|
||||
highlight TrailingWhitespace ctermfg=red guifg=red
|
||||
execute "highlight TrailingWhitespace ctermfg=" .. s:red_cterm
|
||||
\ .. " guifg=" .. s:red_gui
|
||||
else
|
||||
" Background otherwise
|
||||
highlight TrailingWhitespace ctermbg=red guibg=red
|
||||
execute "highlight TrailingWhitespace ctermbg=" .. s:red_cterm
|
||||
\ .. " guibg=" .. s:red_gui
|
||||
endif
|
||||
augroup HighlightTrailingWhitespace
|
||||
au!
|
||||
@@ -74,8 +84,10 @@ let g:spl_special_chars = {
|
||||
\ 'fr': 'àâæçèéêëîïôœùûüÿÀÂÆÇÈÉÊËÎÏÔŒÙÛÜŸ',
|
||||
\ }
|
||||
|
||||
" Highlight non-ASCII characters in the red used by my color scheme "OneDark"
|
||||
highlight NonASCIIChars ctermfg=white guifg=white ctermbg=204 guibg=#e06c75
|
||||
" Highlight non-ASCII characters in red
|
||||
execute "highlight NonASCIIChars ctermfg=white guifg=white "
|
||||
\ .. "ctermbg=" .. s:red_cterm .. " guibg=" .. s:red_gui
|
||||
|
||||
" Do not highlight special characters that are valid in the respective spelllang
|
||||
function! HighlightNonASCIIChars()
|
||||
if exists('w:non_ascii_match_id')
|
||||
|
||||
@@ -49,7 +49,7 @@ fi
|
||||
|
||||
trap '
|
||||
errc=$?
|
||||
<&2 printf "Exiting abnormally. Check and possibly remove \"%s\" manually.\n" "'$WORKTREE_PATH'"
|
||||
printf >&2 "Exiting abnormally. Check and possibly remove \"%s\" manually.\n" "'"$WORKTREE_PATH"'"
|
||||
return $errc
|
||||
' INT QUIT TERM EXIT
|
||||
|
||||
@@ -77,7 +77,7 @@ unset GIT_PREFIX
|
||||
# Restart the shell (forcefully interactive) until the worktree is removed
|
||||
until [[ ! -e "$WORKTREE_PATH" ]] || git worktree remove "$WORKTREE_PATH"; do
|
||||
[[ -t 0 ]] ||
|
||||
>&2 printf "Dropping into interactive shell to resolve conflicts\n"
|
||||
printf >&2 "Dropping into interactive shell to resolve conflicts\n"
|
||||
"$SHELL" -i && errc=$? || errc=$?
|
||||
(( !errc )) || echo "shell exited with $errc"
|
||||
done
|
||||
|
||||
@@ -3,5 +3,26 @@
|
||||
# Copyright (c) 2025 Julian Prein
|
||||
#
|
||||
# Remove ANSI escape sequences.
|
||||
#
|
||||
# Additionally to the general form `\e[ -/]*[0-~]` this also tries to cover
|
||||
# sequences that are followed by additional bytes (e.g. CSI, OSC). This script
|
||||
# covers no C1 sequences.
|
||||
#
|
||||
# The patterns cover the following escape sequences (from top to bottom):
|
||||
# - CSI
|
||||
# - OSC, DCS, PM & APC
|
||||
# - SOS
|
||||
# - All remaining sequences
|
||||
#
|
||||
# See:
|
||||
# - https://en.wikipedia.org/wiki/ANSI_escape_code
|
||||
# - https://www.ecma-international.org/wp-content/uploads/ECMA-35_6th_edition_december_1994.pdf
|
||||
# - https://www.ecma-international.org/wp-content/uploads/ECMA-48_5th_edition_june_1991.pdf
|
||||
|
||||
env LC_ALL=C sed 's/\[[0-?]*[ -/]*[@-~]//g'
|
||||
env LC_ALL=C sed -E "$(printf "%b" \
|
||||
's/' \
|
||||
'\033\\[[0-?]*[ -/]*[@-~]' '|' \
|
||||
'\033[]P^_][\010-\015 -~]*\033\\\\' '|' \
|
||||
'\033X([^\033]|\033+[^\033X\\])*\033+\\\\' '|' \
|
||||
'\033[ -/]*[0-~]' \
|
||||
'//g')"
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
# Remove ANSI SGR (Select Graphic Rendition) escape sequences, e.g. setting
|
||||
# color or bold font.
|
||||
|
||||
env LC_ALL=C sed 's/\[[0-?]*[ -/]*m//g'
|
||||
env LC_ALL=C sed "$(printf 's/\033\\[[0-?]*[ -/]*m//g')"
|
||||
|
||||
Reference in New Issue
Block a user