Compare commits
10 Commits
fded58696a
...
1ee41e1c5b
| Author | SHA1 | Date | |
|---|---|---|---|
|
1ee41e1c5b
|
|||
|
4802abee17
|
|||
|
068a8fe9d2
|
|||
|
bf61d01b42
|
|||
|
5539a5e437
|
|||
|
39486a6f45
|
|||
|
d9feb1d468
|
|||
|
bc0de45375
|
|||
|
0e7171bd5f
|
|||
|
db9aad5dcd
|
@@ -1 +1 @@
|
||||
autocmd BufNewFile,BufRead *.asl set filetype=c.asl
|
||||
autocmd BufNewFile,BufRead *.asl,*.ASL set filetype=c.asl
|
||||
|
||||
3
.config/vim/ftplugin/asl.vim
Normal file
3
.config/vim/ftplugin/asl.vim
Normal file
@@ -0,0 +1,3 @@
|
||||
" most files I've encountered use two spaces for indentation
|
||||
setlocal tabstop=2
|
||||
setlocal expandtab
|
||||
@@ -1,2 +0,0 @@
|
||||
" Exclude `-` in keyword characters
|
||||
setlocal iskeyword-=-
|
||||
@@ -93,8 +93,6 @@ set shortmess+=A
|
||||
" probably expected. See corresponding autocommand or:
|
||||
" https://vi.stackexchange.com/questions/2702
|
||||
set autoread
|
||||
" Include `-` in keyword characters
|
||||
set iskeyword+=-
|
||||
" Do not automatically insert <EOL> at EOF if missing
|
||||
set nofixendofline
|
||||
" Let the cursor move beyond the EOL when in visual-block mode.
|
||||
|
||||
@@ -140,12 +140,14 @@ nnoremap <expr> gp '`[' . strpart(getregtype(), 0, 1) . '`]'
|
||||
|
||||
" Git bindings
|
||||
|
||||
" Insert a commit's subject behind the SHA1 that the cursor is currently on.
|
||||
" Mnemonic: "git reference commit"
|
||||
" Reference the commit that the cursor is currently on with the 'reference'
|
||||
" format (Mnemonic: "git reference commit").
|
||||
" NOTE: I can't use --pretty=reference since it would insert the abbreviated
|
||||
" hash additionally to the existing hash.
|
||||
" NOTE: This uses `system` and not `:r!` to insert the text directly at the
|
||||
" cursor. `subject[:-2]` cuts off the trailing newline.
|
||||
" cursor. `subject[:-1]` cuts off the trailing newline.
|
||||
" TODO: print error message but insert nothing on git error
|
||||
nmap <leader>grc :let subject=system('git show -s --format="(\"%s\")" <C-R><C-W>')<CR>viw<Esc>a <C-R>=subject[:-2]<CR><Esc>
|
||||
nmap <leader>grc :let subject=system('git show -s --date=short --pretty="format:(%s, %ad)" <C-R><C-W>')<CR>viw<Esc>a <C-R>=subject[:-1]<CR><Esc>
|
||||
|
||||
" Insert a Signed-off-by trailer
|
||||
nmap <leader>gso :r!git config --get user.name<CR>:r!git config --get user.email<CR>I<<ESC>A><ESC>kJISigned-off-by: <ESC>
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Use sqlite backend - plain is deprecated
|
||||
set database sqlite
|
||||
|
||||
# Use system clipboard for selection.
|
||||
set selection-clipboard "clipboard"
|
||||
|
||||
@@ -34,10 +37,10 @@ set recolor-keephue true
|
||||
set recolor-reverse-video true
|
||||
|
||||
# vim-like fold mappings in index
|
||||
map [index] zo navigate-index expand
|
||||
map [index] zc navigate-index collapse
|
||||
map [index] zR navigate-index expand-all
|
||||
map [index] zM navigate-index collapse-all
|
||||
map [index] zo navigate_index expand
|
||||
map [index] zc navigate_index collapse
|
||||
map [index] zR navigate_index expand-all
|
||||
map [index] zM navigate_index collapse-all
|
||||
|
||||
# Recoloring should also work in presentation mode
|
||||
map [presentation] i recolor
|
||||
|
||||
@@ -584,6 +584,20 @@ finddup() {
|
||||
| cut -d' ' -f3-
|
||||
}
|
||||
|
||||
# Find in parent directories
|
||||
findup() {
|
||||
(( $# )) || return 1
|
||||
|
||||
# TODO: support passing different entry point
|
||||
dir="$PWD:A"
|
||||
|
||||
while true; do
|
||||
find "$dir" -maxdepth 1 \( "$@" \)
|
||||
[[ $dir != / ]] || break
|
||||
dir="$dir:h"
|
||||
done
|
||||
}
|
||||
|
||||
# Wrapper around tmsu that searches for .tmsu/db in all parent directories and
|
||||
# fallbacks to XDG_DATA_HOME if not found.
|
||||
tag() {
|
||||
@@ -673,13 +687,16 @@ diffcmds() {
|
||||
# TODO: Support own arguments for example to switch the placeholder or the
|
||||
# diffcmd
|
||||
# TODO: Find better way to dequote pipes. (e.g. `%|` to use a pipe?)
|
||||
local diff_cmd i arg ps_sub
|
||||
local i arg ps_sub
|
||||
local -a template args final_cmd
|
||||
|
||||
if (( $+commands[vimdiff] && ! $+commands[diff] )); then
|
||||
cmd=vimdiff
|
||||
local diff_cmd="$diff_cmd"
|
||||
if [[ -n $diff_cmd ]]; then
|
||||
# already set by caller
|
||||
elif (( $+commands[vimdiff] && ! $+commands[diff] )); then
|
||||
diff_cmd=vimdiff
|
||||
elif (( $+commands[diff] && ! $+commands[vimdiff] )); then
|
||||
cmd=diff
|
||||
diff_cmd=diff
|
||||
elif (( $+commands[diff] && $+commands[vimdiff] )); then
|
||||
if [[ $EDITOR =~ vi || $VISUAL =~ vi ]]; then
|
||||
diff_cmd=vimdiff
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
lf # lf shell (https://github.com/gokcehan/lf)
|
||||
xplr # xplr shell (https://github.com/sayanarijit/xplr)
|
||||
vim_shell # vim shell indicator (:sh)
|
||||
my_vim_session # vim session file (Session.vim)
|
||||
midnight_commander # midnight commander shell (https://midnight-commander.org/)
|
||||
nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
|
||||
chezmoi_shell # chezmoi shell (https://www.chezmoi.io/)
|
||||
@@ -1670,6 +1671,29 @@
|
||||
prompt_example
|
||||
}
|
||||
|
||||
#########################[ my_vim_session: existence of Session.vim ]#########################
|
||||
function prompt_my_vim_session() {
|
||||
if [[ -e Session.vim ]]; then
|
||||
p10k segment -s CURRENT -t "Session.vim"
|
||||
return
|
||||
fi
|
||||
|
||||
# TODO: do we actually want :A?
|
||||
local dir="${${PWD:A}:h}"
|
||||
while [[ $dir != / ]]; do
|
||||
if [[ -e "$dir/Session.vim" ]]; then
|
||||
p10k segment -s PARENT -t "Session.vim"
|
||||
return
|
||||
fi
|
||||
|
||||
dir="${dir:h}"
|
||||
done
|
||||
}
|
||||
# Color when Session.vim exists in current directory
|
||||
typeset -g POWERLEVEL9K_MY_VIM_SESSION_CURRENT_FOREGROUND=3
|
||||
# Color when Session.vim exists in parent directory
|
||||
typeset -g POWERLEVEL9K_MY_VIM_SESSION_PARENT_FOREGROUND=239
|
||||
|
||||
# User-defined prompt segments can be customized the same way as built-in segments.
|
||||
# typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=208
|
||||
# typeset -g POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||
|
||||
Reference in New Issue
Block a user