zsh+vim+fzf+nixpkgs-fmt + katexprs update

This commit is contained in:
kat witch 2021-08-23 04:09:04 +01:00
parent 8a7022d918
commit 7d3a2c3ca2
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
7 changed files with 30 additions and 165 deletions

View file

@ -17,6 +17,8 @@
coc-yank
coc-python
coc-json
coc-fzf
fzf-vim
coc-yaml
coc-git
coc-css

View file

@ -29,6 +29,7 @@ in
home.packages = with pkgs; [ fzf fd zsh-completions akiflags ];
programs.zsh = {
enable = true;
enableSyntaxHighlighting = true;
enableAutosuggestions = true;
initExtra =
let
@ -85,35 +86,27 @@ in
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=3,bold";
ZSH_AUTOSUGGEST_USE_ASYNC = 1;
};
plugins = with pkgs.zsh-plugins; [
(with pkgs.zsh-syntax-highlighting; {
name = "zsh-syntax-highlighting";
plugins = with pkgs.zsh-plugins; (map (plugin: plugin.zshPlugin) [
tab-title
vim-mode
evil-registers
]) ++ (map
(plugin: (with pkgs.${plugin}; {
name = pname;
inherit src;
})) [
"zsh-z"
]) ++ [
(with pkgs.zsh-fzf-tab; {
name = "fzf-tab";
inherit src;
})
tab-title.zshPlugin
vim-mode.zshPlugin
evil-registers.zshPlugin
{
name = "z";
file = "z.sh";
src = pkgs.fetchFromGitHub {
owner = "rupa";
repo = "z";
rev = "9d5a3fe0407101e2443499e4b95bca33f7a9a9ca";
sha256 = "0aghw6zmd3851xpzgy0jkh25wzs9a255gxlbdr3zw81948qd9wb1";
};
}
{
name = "fzf-z";
src = pkgs.fetchFromGitHub {
owner = "andrewferrier";
repo = "fzf-z";
rev = "089ba6cacd3876c349cfb6b65dc2c3e68b478fd0";
sha256 = "1lvvkz0v4xibq6z3y8lgfkl9ibcx0spr4qzni0n925ar38s20q81";
};
}
];
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
programs.starship = {
enable = true;
enableZshIntegration = true;

View file

@ -1,114 +0,0 @@
zle-keymap-select() {
zle reset-prompt
zle -R
}
TRAPWINCH() {
zle && { zle reset-prompt; zle -R }
}
zle -N zle-keymap-select
zle -N edit-command-line
bindkey -v
autoload -Uz edit-command-line
bindkey "^?" backward-delete-char
bindkey -M vicmd 'V' edit-command-line
# tab completion menu
bindkey -M menuselect "k" up-line-or-history
bindkey -M menuselect "j" down-line-or-history
bindkey -M menuselect "l" forward-char
bindkey -M menuselect "h" backward-char
bindkey -M menuselect "^[" undo
# silence bell when pressing escape too much
bindkey -M vicmd -s "\e" ''
# make W/B/E/dW/dB/dE move over entire shell arguments, customize w/b/e with wordchars
autoload -U forward-word-match # TODO: acts weirdly when moving between words, like "a/b", 'w' command should move cursor to the "/", not the "b"
autoload -U backward-word-match
autoload -U match-words-by-style
forward-blank-word-end-match() {
local curcontext=":zle:$WIDGET" start=$CURSOR offset=1
local -A matched_words
integer count=${NUMERIC:-1}
if (( count < 0 )); then
(( NUMERIC = -count ))
zle ${WIDGET/forward/backward}
return
fi
if zstyle -t "$curcontext" virangeflag; then
offset=0
fi
while (( count-- )); do
# weird behaviour if not called from the beginning of a word, so go backwards first
match-words-by-style
if (( ${#matched_words[word-before-cursor]} > 0 && ${#matched_words[ws-before-cursor]} == 0 )); then
(( CURSOR -= ${#matched_words[word-before-cursor]} ))
fi
match-words-by-style
if (( ${#matched_words[ws-after-cursor]} > 0 )); then
(( CURSOR += ${#matched_words[ws-after-cursor]} ))
fi
if (( ${#matched_words[word-after-cursor]} > 0 )); then
(( CURSOR += ${#matched_words[word-after-cursor]} - offset ))
fi
if (( CURSOR <= start )); then
if (( ${#matched_words[ws-after-word]} > 0 )); then
(( CURSOR += ${#matched_words[ws-after-word]} + 1 ))
fi
match-words-by-style
if (( ${#matched_words[word-after-cursor]} > 0 )); then
(( CURSOR += ${#matched_words[word-after-cursor]} - offset ))
else
return 1
fi
fi
done
return 0
}
zle -N forward-end-word-parameter forward-blank-word-end-match
zle -N forward-end-word-normal forward-blank-word-end-match
zle -N forward-end-viopp-word-parameter forward-blank-word-end-match
zle -N forward-end-viopp-word-normal forward-blank-word-end-match
zle -N forward-word-parameter forward-word-match
zle -N forward-word-normal forward-word-match
zle -N backward-word-parameter backward-word-match
zle -N backward-word-normal backward-word-match
zle -N forward-word-normal forward-word-match
zle -N backward-word-normal backward-word-match
bindkey -M vicmd "W" forward-word-parameter
bindkey -M vicmd "B" backward-word-parameter
bindkey -M vicmd "E" forward-end-word-parameter
bindkey -M vicmd "e" forward-end-word-normal
bindkey -M vicmd "w" forward-word-normal
bindkey -M vicmd "b" backward-word-normal
bindkey -M viopp "e" forward-end-viopp-word-normal
bindkey -M viopp "E" forward-end-viopp-word-parameter
zstyle ':zle:*-viopp-*' virangeflag 1
zstyle ':zle:*-word-parameter' word-style shell
zstyle ':zle:*-word-normal' word-style normal
zstyle ':zle:*-word-normal' word-chars "$WORDCHARS"
# zstyle ':zle:*' skip-whitespace-first false