shell fixings

This commit is contained in:
Daniel Lundin 2024-03-10 00:16:29 +01:00
parent 54417b92f7
commit c17e7aba3d
5 changed files with 68 additions and 12 deletions

View file

@ -1,9 +1,8 @@
{
"LazyVim": { "branch": "main", "commit": "e3bfcb9bf74292dc846f5d1710fbb2e8f36a687a" },
"LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" },
"SchemaStore.nvim": { "branch": "main", "commit": "6eb5d8d9ec9f81b75aaa6d15d0f6dc12a066fd3f" },
"SchemaStore.nvim": { "branch": "main", "commit": "b788bde023f9fbc2eb86e89d32c0bf98a60ae406" },
"alabaster.nvim": { "branch": "main", "commit": "ab61b9d3b7398e6c8ebd5207f609c24ebb37ebeb" },
"bufferline.nvim": { "branch": "main", "commit": "64e2c5def50dfd6b6f14d96a45fa3d815a4a1eef" },
"catppuccin": { "branch": "main", "commit": "045e3499d9ec8d84635fb08877ae44fd33f6a38d" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-emoji": { "branch": "main", "commit": "0acd702358230abeb6576769f7116e766bca28a0" },
@ -32,7 +31,7 @@
"mini.comment": { "branch": "main", "commit": "a4b7e46deb9ad2feb8902cc5dbf087eced112ee5" },
"mini.indentscope": { "branch": "main", "commit": "cf07f19e718ebb0bcc5b00999083ce11c37b8d40" },
"mini.surround": { "branch": "main", "commit": "a1b590cc3b676512de507328d6bbab5e43794720" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "459c60317cc1d251f6eb3b6f010d015d5d24b806" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "7f2ebdef3b55374390714ac7c0a7fe6b0dae498a" },
"neoconf.nvim": { "branch": "main", "commit": "db1d1bd45f4e91da6abc898281711fa47eda0ece" },
"neodev.nvim": { "branch": "main", "commit": "84e0290f5600e8b89c0dfcafc864f45496a53400" },
"noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" },
@ -44,20 +43,20 @@
"nvim-dap-ui": { "branch": "master", "commit": "9720eb5fa2f41988e8770f973cd11b76dd568a5d" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "a5fc69240869c0fee8ff176bc9e4efdf8bdfb596" },
"nvim-lint": { "branch": "master", "commit": "e824adb9bc01647f71e55457353a68f0f37f9931" },
"nvim-lspconfig": { "branch": "master", "commit": "94cf4adb81158817520e18d2174963d8e1424df9" },
"nvim-lspconfig": { "branch": "master", "commit": "16295b79410f131c4fa7870c663b4ace6a761fb2" },
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
"nvim-noirbuddy": { "branch": "master", "commit": "131b032debf1d9aebd096f41bb3fb7b9e1545b7c" },
"nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" },
"nvim-spectre": { "branch": "master", "commit": "3712ff0cdf4f9f877d9ca708d835a877d9a0abaf" },
"nvim-treesitter": { "branch": "master", "commit": "57205313dda0ac82ac69e21d5e2a80f3297c14cc" },
"nvim-treesitter": { "branch": "master", "commit": "7ff51f53b0efb6228df2e8539b51bb2e737b77f3" },
"nvim-treesitter-context": { "branch": "master", "commit": "b8b7e52c1517d401d7c519787d5dc4528c41291a" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "b7a0bfa3e93697ca5b61b15df633404bf8f45883" },
"nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "7ab799a9792f7cf3883cf28c6a00ad431f3d382a" },
"nvim-web-devicons": { "branch": "master", "commit": "4adea17610d140a99c313e3f79a9dc01825d59ae" },
"nvim-web-devicons": { "branch": "master", "commit": "75df79feb02d5e0ec114e447453775d4d291ea03" },
"persistence.nvim": { "branch": "main", "commit": "4982499c1636eac254b72923ab826ee7827b3084" },
"plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" },
"rustaceanvim": { "branch": "master", "commit": "387ca846d632f8c90631536341ca1778b4c2c497" },
"rustaceanvim": { "branch": "master", "commit": "19f12173ccb7993f86ea26b0e21bbb883c3b86c7" },
"sqlite.lua": { "branch": "master", "commit": "40701b6151f8883980c1548647116de39b763540" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
"telescope.nvim": { "branch": "master", "commit": "7472420f8734c710bd7009081cef9b97f08a3821" },

View file

@ -64,6 +64,7 @@ return {
Color.new("ColorColumn", "#171e26")
Group.new("ColorColumn", nil, colors.ColorColumn)
Color.new("normal", "#e3e0cd")
Group.new("Normal", colors.normal, nil)

View file

@ -37,6 +37,7 @@
# vcs # git status
# =========================[ Line #2 ]=========================
newline # \n
cwd
prompt_char # prompt symbol
)
@ -199,9 +200,9 @@
################################[ prompt_char: prompt symbol ]################################
# Green prompt symbol if the last command succeeded.
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=253
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=70 #253
# Red prompt symbol if the last command failed.
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=253
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=70 #253
# Default prompt symbol.
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='%%' #''
# Prompt symbol in command vi mode.
@ -228,7 +229,7 @@
typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=103
# Color of the anchor directory segments. Anchor segments are never shortened. The first
# segment is always an anchor.
typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=245
typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=246
# Display anchor directory segments in bold.
typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=false
# Don't shorten directories that contain any of these files. They are anchors.
@ -347,6 +348,11 @@
#
typeset -g POWERLEVEL9K_DIR_CLASSES=()
unset POWERLEVEL9K_DIR_ANCHOR_FOREGROUND
unset POWERLEVEL9K_DIR_SHORTENED_FOREGROUND
typeset -g POWERLEVEL9K_DIR_CONTENT_EXPANSION=$'%{\e[38;5;246;1;3m%}$P9K_CONTENT%b'
# Custom prefix.
# typeset -g POWERLEVEL9K_DIR_PREFIX='%fin '
@ -1661,6 +1667,10 @@
p10k segment -f 208 -i '⭐' -t 'hello, %n'
}
function prompt_cwd() {
p10k segment -f 66 -e -t "${PWD##*/}"
}
# User-defined prompt segments may optionally provide an instant_prompt_* function. Its job
# is to generate the prompt segment for display in instant prompt. See
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
@ -1678,6 +1688,7 @@
# instant_prompt_example. This will give us the same `example` prompt segment in the instant
# and regular prompts.
prompt_example
prompt_cwd
}
# User-defined prompt segments can be customized the same way as built-in segments.

38
.zsh/history.zsh Normal file
View file

@ -0,0 +1,38 @@
typeset -g MY_HISTORY_SEARCH_OFFSET=0
typeset -g MY_HISTORY_SEARCH_PREFIX=""
function my-history-prefix-search() {
if [[ $LASTWIDGET != my-history-prefix-search-* ]]; then
# start state machine
MY_HISTORY_SEARCH_OFFSET=-1
MY_HISTORY_SEARCH_PREFIX="$LBUFFER"
fi
local offset_delta=$1
local offset=$((MY_HISTORY_SEARCH_OFFSET + $offset_delta))
(($offset < 0)) && return
local result=$(
atuin search \
--search-mode prefix \
--limit 1 \
--offset $offset \
--format '{command}' \
"$MY_HISTORY_SEARCH_PREFIX"
)
if [[ -n "$result" ]]; then
BUFFER=$result
CURSOR=${#BUFFER}
MY_HISTORY_SEARCH_OFFSET=$offset
fi
}
function my-history-prefix-search-backward-widget() {
my-history-prefix-search +1
}
function my-history-prefix-search-forward-widget() {
my-history-prefix-search -1
}
zle -N my-history-prefix-search-backward-widget
zle -N my-history-prefix-search-forward-widget

11
.zshrc
View file

@ -19,6 +19,8 @@ autoload -Uz _zinit
zi ice wait lucid
zi load zsh-users/zsh-completions
# zi ice wait lucid
# zi load zsh-users/zsh-autosuggestions
zi ice wait lucid
zi load zdharma-continuum/fast-syntax-highlighting
zi ice wait lucid
@ -100,9 +102,14 @@ _cwd_gitroot() {
zle -N _cwd_gitroot
## Keybindings
source $HOME/.zsh/history.zsh
bindkey -e
bindkey '^P' atuin-up-search
bindkey '^g' _jump
# bindkey '^P' atuin-up-search
bindkey '^p' my-history-prefix-search-backward-widget
bindkey '^n' my-history-prefix-search-forward-widget
bindkey "^[[A" my-history-prefix-search-backward-widget
bindkey "^[[B" my-history-prefix-search-forward-widget
## Pager
@ -273,7 +280,7 @@ function _grc() {
compdef _grc grc
# Atuin history
eval "$(atuin init zsh)"
eval "$(atuin init zsh --disable-up-arrow)"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh