diff options
author | Shubham Saini <ssaini@fispan.com> | 2023-09-30 03:22:05 +0000 |
---|---|---|
committer | Shubham Saini <ssaini@fispan.com> | 2023-09-30 03:22:05 +0000 |
commit | 88a10686f7cd9e15feb8d3464c20749dbd51f7c4 (patch) | |
tree | 95bf4dc5b411986b33b4c8038a87eab13209dc11 /darwin | |
parent | 1a1e7a13b015932119770e4a0e550de0dc83268b (diff) |
zsh: vim mode
Diffstat (limited to 'darwin')
-rw-r--r-- | darwin/home.nix | 53 |
1 files changed, 44 insertions, 9 deletions
diff --git a/darwin/home.nix b/darwin/home.nix index ffed46f..e0b1bb0 100644 --- a/darwin/home.nix +++ b/darwin/home.nix | |||
@@ -27,6 +27,7 @@ | |||
27 | kubectl | 27 | kubectl |
28 | kubelogin-oidc | 28 | kubelogin-oidc |
29 | terraform | 29 | terraform |
30 | kops | ||
30 | k9s | 31 | k9s |
31 | kubernetes-helm | 32 | kubernetes-helm |
32 | python38 | 33 | python38 |
@@ -45,7 +46,7 @@ | |||
45 | 46 | ||
46 | home.sessionVariables = { | 47 | home.sessionVariables = { |
47 | PATH = "$PATH:$HOME/.bin"; | 48 | PATH = "$PATH:$HOME/.bin"; |
48 | VISUAL = "nvim"; | 49 | EDITOR = "nvim"; |
49 | MANPAGER = "nvim +Man!"; | 50 | MANPAGER = "nvim +Man!"; |
50 | }; | 51 | }; |
51 | 52 | ||
@@ -53,22 +54,56 @@ | |||
53 | programs.zsh = { | 54 | programs.zsh = { |
54 | enable = true; | 55 | enable = true; |
55 | enableCompletion = true; | 56 | enableCompletion = true; |
57 | enableAutosuggestions = true; | ||
58 | dotDir = ".zsh"; | ||
59 | history = { | ||
60 | ignoreAllDups = true; | ||
61 | path = "$HOME/.zsh/history"; | ||
62 | }; | ||
63 | initExtra = '' | ||
64 | zstyle ':completion:*' menu select | ||
65 | zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' | ||
66 | zmodload zsh/complist | ||
67 | bindkey -M menuselect 'h' vi-backward-char | ||
68 | bindkey -M menuselect 'k' vi-up-line-or-history | ||
69 | bindkey -M menuselect 'l' vi-forward-char | ||
70 | bindkey -M menuselect 'j' vi-down-line-or-history | ||
71 | bindkey '^f' autosuggest-accept | ||
72 | source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh | ||
73 | zvm_after_init_commands+=('source ${pkgs.fzf}/share/fzf/completion.zsh && source ${pkgs.fzf}/share/fzf/key-bindings.zsh') | ||
74 | ''; | ||
56 | shellAliases = { | 75 | shellAliases = { |
57 | ll = "ls -l"; | 76 | ".." = "cd .."; |
77 | l = "ls --color -al"; | ||
78 | ls = "ls --color"; | ||
58 | v = "nvim"; | 79 | v = "nvim"; |
59 | o = "xdg-open"; | 80 | o = "xdg-open"; |
60 | t = "tmux"; | 81 | t = "tmux"; |
61 | f = "lf"; | 82 | f = "lf"; |
83 | tf = "terraform"; | ||
84 | k = "kubectl"; | ||
85 | gst = "git status --short"; | ||
86 | ga = "git add"; | ||
87 | gp = "git push"; | ||
88 | gl = "git log --oneline --decorate --graph"; | ||
89 | gc = "git commit -v -S"; | ||
90 | gd = "git diff --minimal"; | ||
62 | }; | 91 | }; |
63 | oh-my-zsh = { | 92 | plugins = [ |
64 | enable = true; | 93 | { |
65 | plugins = [ "git" "kubectl" "sudo" "terraform" "kops" ]; | 94 | name = "pure"; |
66 | theme = "robbyrussell"; | 95 | src = pkgs.fetchFromGitHub { |
67 | }; | 96 | owner = "sindresorhus"; |
97 | repo = "pure"; | ||
98 | rev = "v1.22.0"; | ||
99 | sha256 = "177vabhvgrxdcwvc29rmfmfr96wl75hrkhymnd8qcaky2v4047jd"; | ||
100 | }; | ||
101 | } | ||
102 | ]; | ||
68 | }; | 103 | }; |
69 | programs.fzf = { | 104 | programs.fzf = { |
70 | enable = true; | 105 | enable = true; |
71 | enableZshIntegration = true; | 106 | enableZshIntegration = false; |
72 | defaultOptions = [ "--height 40%" "--layout=reverse" "--border" ]; | 107 | defaultOptions = [ "--height 40%" "--layout=reverse" "--border" ]; |
73 | }; | 108 | }; |
74 | programs.git = { | 109 | programs.git = { |
@@ -106,7 +141,7 @@ | |||
106 | open = '' | 141 | open = '' |
107 | %{{ | 142 | %{{ |
108 | case $(file --mime-type -Lb $f) in | 143 | case $(file --mime-type -Lb $f) in |
109 | text/*) lf -remote "send $id \$$VISUAL \$fx";; | 144 | text/*) lf -remote "send $id \$$EDITOR \$fx";; |
110 | *) for f in $fx; do $OPENER $f > /dev/null 2> /dev/null & done;; | 145 | *) for f in $fx; do $OPENER $f > /dev/null 2> /dev/null & done;; |
111 | esac | 146 | esac |
112 | }} | 147 | }} |