diff options
Diffstat (limited to '')
-rw-r--r-- | home/shell/aliases.nix | 2 | ||||
-rw-r--r-- | home/shell/zsh/completion-style.zsh | 18 | ||||
-rw-r--r-- | home/shell/zsh/default.nix | 1 | ||||
-rw-r--r-- | home/shell/zsh/new-go-project.zsh | 19 | ||||
-rw-r--r-- | home/shell/zsh/prompt.zsh | 9 | ||||
-rw-r--r-- | home/shell/zsh/ssh-agent.zsh | 3 |
6 files changed, 46 insertions, 6 deletions
diff --git a/home/shell/aliases.nix b/home/shell/aliases.nix index b3190dc..1759b3c 100644 --- a/home/shell/aliases.nix +++ b/home/shell/aliases.nix @@ -2,4 +2,6 @@ ll = "ls -l --color=auto"; lt = "ls -ltrh --color=auto"; pkgsearch = "nix search nixpkgs"; + hms = "home-manager switch --flake ."; + nr = "sudo nixos-rebuild switch --flake ."; } diff --git a/home/shell/zsh/completion-style.zsh b/home/shell/zsh/completion-style.zsh index 32bd6f4..79a4e68 100644 --- a/home/shell/zsh/completion-style.zsh +++ b/home/shell/zsh/completion-style.zsh @@ -1,5 +1,16 @@ -# Style the completion a bit -zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} +# 'ctrl-x r' will complete the 12 last modified (mtime) files/directories +zle -C newest-files menu-complete _generic +# Use "*newest-files" so that it matches both "newest-files" and +# "load-completion-and-newest-files". +zstyle ':completion:*newest-files:*' completer _files +zstyle ':completion:*newest-files:*' file-patterns '*(omN[1,12])' +zstyle ':completion:*newest-files:*' menu select yes +zstyle ':completion:*newest-files:*' sort false +zstyle ':completion:*newest-files:*' matcher-list 'b:=*' # important + +# colors for zsh file name completion +zmodload zsh/complist +zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} # Show a prompt on selection zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s' @@ -13,9 +24,6 @@ zstyle ':completion:*' group-name '' # Keep directories and files separated zstyle ':completion:*' list-dirs-first true -# Add colors to processes for kill completion -zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' - # match uppercase from lowercase zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' diff --git a/home/shell/zsh/default.nix b/home/shell/zsh/default.nix index ffc6c41..67cc370 100644 --- a/home/shell/zsh/default.nix +++ b/home/shell/zsh/default.nix @@ -46,6 +46,7 @@ in ./options.zsh ./prompt.zsh ./tmux.zsh + ./ssh-agent.zsh ]; }; }; diff --git a/home/shell/zsh/new-go-project.zsh b/home/shell/zsh/new-go-project.zsh new file mode 100644 index 0000000..0b96a34 --- /dev/null +++ b/home/shell/zsh/new-go-project.zsh @@ -0,0 +1,19 @@ +new-go-project() { + local project_name=$1 + + echo "> creating ${project_name}" + cd ~/workspace/ + mkdir $project_name + cd $project_name + + echo "> initializing the git repository" + git init . + + echo "> setting the default template for go projects" + nix flake init -t ~/workspace/world/templates#go + direnv allow + + echo "> creating initial commit, touch your yubikey" + git add . + git commit -m 'initial commit' +} diff --git a/home/shell/zsh/prompt.zsh b/home/shell/zsh/prompt.zsh index 291f436..8473f72 100644 --- a/home/shell/zsh/prompt.zsh +++ b/home/shell/zsh/prompt.zsh @@ -1,6 +1,13 @@ setopt prompt_subst -PROMPT='%K{cyan}%F{black}%m%k%f %~ %% ' +autoload -Uz vcs_info + +# display the name of the branch +zstyle ':vcs_info:git*' formats "[%b]" +zstyle ':vcs_info:*' enable git + +precmd () { vcs_info } +PROMPT="%K{cyan}%F{black}%n@%m%k%F{yellow}%~%f %F{green}${vcs_info_msg_0_}%f%% " # For tramp (emacs). if [ "$TERM" = "dumb" ]; then diff --git a/home/shell/zsh/ssh-agent.zsh b/home/shell/zsh/ssh-agent.zsh new file mode 100644 index 0000000..1e5d81c --- /dev/null +++ b/home/shell/zsh/ssh-agent.zsh @@ -0,0 +1,3 @@ +if [ $(ps ax | grep "[s]sh-agent" | wc -l) -eq 0 ] ; then + eval $(ssh-agent -s -a ${XDG_RUNTIME_DIR}/ssh-agent.sock) > /dev/null +fi |