nix #11
|
@ -11,13 +11,8 @@
|
|||
enableSyntaxHighlighting = true;
|
||||
# syntaxHighlighting.enable = true; # 23.11 syntax
|
||||
historySubstringSearch.enable = true;
|
||||
initExtra = ''
|
||||
# powerline-go duration support
|
||||
zmodload zsh/datetime
|
||||
function preexec() {
|
||||
__TIMER=$EPOCHREALTIME
|
||||
}
|
||||
'';
|
||||
initExtra = builtins.readFile ./zshrc.sh;
|
||||
defaultKeymap = "viins";
|
||||
};
|
||||
powerline-go = {
|
||||
enable = true;
|
||||
|
@ -73,6 +68,10 @@
|
|||
};
|
||||
fzf.enable = true;
|
||||
# TODO highlight or bat
|
||||
nix-index = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
};
|
||||
home = {
|
||||
stateVersion = "23.05";
|
||||
|
|
42
config/nix/hm/zshrc.sh
Normal file
42
config/nix/hm/zshrc.sh
Normal file
|
@ -0,0 +1,42 @@
|
|||
# powerline-go duration support
|
||||
zmodload zsh/datetime
|
||||
function preexec() {
|
||||
__TIMER=$EPOCHREALTIME
|
||||
}
|
||||
|
||||
# Cursor based on mode
|
||||
if [ $TERM = "linux" ]; then
|
||||
_LINE_CURSOR="\e[?0c"
|
||||
_BLOCK_CURSOR="\e[?8c"
|
||||
else
|
||||
_LINE_CURSOR="\e[6 q"
|
||||
_BLOCK_CURSOR="\e[2 q"
|
||||
fi
|
||||
function zle-keymap-select zle-line-init
|
||||
{
|
||||
case $KEYMAP in
|
||||
vicmd) print -n -- "$_BLOCK_CURSOR";;
|
||||
viins|main) print -n -- "$_LINE_CURSOR";;
|
||||
esac
|
||||
}
|
||||
function zle-line-finish
|
||||
{
|
||||
print -n -- "$_BLOCK_CURSOR"
|
||||
}
|
||||
zle -N zle-line-init
|
||||
zle -N zle-line-finish
|
||||
zle -N zle-keymap-select
|
||||
|
||||
# Also return to normal mode from jk shortcut
|
||||
bindkey 'jk' vi-cmd-mode
|
||||
|
||||
# Edit command line
|
||||
autoload edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey -M vicmd v edit-command-line
|
||||
|
||||
# Additional history-substring-search bindings for vi cmd mode
|
||||
# TODO Doesn't work, as home-manager loads history-substring at the very end of the file
|
||||
# bindkey -M vicmd 'k' history-substring-search-up
|
||||
# bindkey -M vicmd 'j' history-substring-search-down
|
||||
|
|
@ -7,61 +7,6 @@
|
|||
# TODO Learn `setopt extendedglob`
|
||||
|
||||
|
||||
# Cursor based on mode
|
||||
if [ $TERM = "linux" ]; then
|
||||
_LINE_CURSOR="\e[?0c"
|
||||
_BLOCK_CURSOR="\e[?8c"
|
||||
else
|
||||
_LINE_CURSOR="\e[6 q"
|
||||
_BLOCK_CURSOR="\e[2 q"
|
||||
fi
|
||||
function zle-keymap-select zle-line-init
|
||||
{
|
||||
case $KEYMAP in
|
||||
vicmd) print -n -- "$_BLOCK_CURSOR";;
|
||||
viins|main) print -n -- "$_LINE_CURSOR";;
|
||||
esac
|
||||
|
||||
# zle reset-prompt
|
||||
# zle -R
|
||||
}
|
||||
|
||||
function zle-line-finish
|
||||
{
|
||||
print -n -- "$_BLOCK_CURSOR"
|
||||
}
|
||||
|
||||
zle -N zle-line-init
|
||||
zle -N zle-line-finish
|
||||
zle -N zle-keymap-select
|
||||
|
||||
# Should I really put a comment to explain what this does?
|
||||
bindkey 'jk' vi-cmd-mode
|
||||
|
||||
# Edit command line
|
||||
autoload edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey -M vicmd v edit-command-line
|
||||
|
||||
# History search
|
||||
# bind UP and DOWN arrow keys
|
||||
zmodload zsh/terminfo
|
||||
bindkey "$terminfo[kcuu1]" history-substring-search-up
|
||||
bindkey "$terminfo[kcud1]" history-substring-search-down
|
||||
|
||||
# bind UP and DOWN arrow keys (compatibility fallback
|
||||
# for Ubuntu 12.04, Fedora 21, and MacOSX 10.9 users)
|
||||
bindkey '^[[A' history-substring-search-up
|
||||
bindkey '^[[B' history-substring-search-down
|
||||
|
||||
# bind P and N for EMACS mode
|
||||
bindkey -M emacs '^P' history-substring-search-up
|
||||
bindkey -M emacs '^N' history-substring-search-down
|
||||
|
||||
# bind k and j for VI mode
|
||||
bindkey -M vicmd 'k' history-substring-search-up
|
||||
bindkey -M vicmd 'j' history-substring-search-down
|
||||
|
||||
# Autocompletion
|
||||
autoload -Uz promptinit
|
||||
promptinit
|
||||
|
|
Loading…
Reference in a new issue