Did I Improve ThisBlogAbout

Terminal Aliases

14 July, 2020 - 1 min

Here are a couple of aliases I created to improve other aspects of my terminal workflow.


# When I want to see the contents of a folder when changing directories, instead of using the zsh shortcuts I use cd
function cd () {
    new_directory="$*";
    if [ $# -eq 0 ]; then
        new_directory=${HOME};
    fi;
    builtin cd "$@" &&  ls -la
}

# easier copy paste
alias c="pbcopy" 
alias v="pbpaste" 
alias cat=bat  # replaces the cat command with the bat, a nicer cat command - https://github.com/sharkdp/bat


# fast file edit
alias vim='nvim'
alias vim.karabiner='nvim ~/.config/karabiner/assets/complex_modifications/1579091281.json'
alias vim.zsh='nvim ~/.zshrc'
alias vim.note='nvim ~/journal.txt'
# using sk, a super fast file searcher, in combination with vim to edit a file super fast from anywhere.
# the print part is so that it prints the command to the history with the actual file name
alias vims='f=$(sk -m); print -rs nvim $f; nvim $f'


# Jrnl
alias note='jrnl'
alias today='jrnl -from yesterday and @work | grep --color -E ".*\[\].*|$"'
alias today.todo='jrnl -from yesterday and @work | grep --color -E ".*\[\].*|$" | grep "\[\]"'
alias todos='jrnl @work | grep "\[\]"'


Thanks for reading!

Vicente




A list of articles in the series Terminal Workflow:

  1. Terminal Base Setup
  2. Tmux - terminal multiplexer
  3. NeoVim - text editor
  4. Jrnl - note app
  5. Pass - password manager
  6. Ranger - file manager
  7. Simple Terminal Apps

8. Terminal Aliases