Skip to content

Instantly share code, notes, and snippets.

@ViniciusFXavier
Created June 3, 2020 15:52
Show Gist options
  • Save ViniciusFXavier/fb195859628bfe6b358cb12b1f19b20f to your computer and use it in GitHub Desktop.
Save ViniciusFXavier/fb195859628bfe6b358cb12b1f19b20f to your computer and use it in GitHub Desktop.
Tips

Adding npm Command Autocompletion to Your Shell

If you want to get a quick improvement to your npm productivity, you can add autocompletion for npm to your shell with just one command.

For bash, you can add npm autocompletion with: npm completion >> ~/.bashrc

For zsh, you can add npm autocompletion with: npm completion >> ~/.zshrc

And now you’ll have tab autocomplete for npm commands.

Show Git Branch In Terminal

When you are working inside a Git repository it is important to realize what is the currently checked out Git branch.

You can make it easier to track where you are, by showing the name of the current Git branch in the terminal (command prompt).

Edit bash: gedit ~/.bashrc

Add this to end of file:

# Show git branch name
force_color_prompt=yes
color_prompt=yes
parse_git_branch() {
 git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then
 PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ '
else
 PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ '
fi
unset color_prompt force_color_prompt

Force bash to update: source ~/.bashrc

Ubuntu config

Esse programa permite configurar algumas coisas que não tem nas configurações do Ubuntu sudo apt install gnome-tweaks

Melhores fontes para Visual Code

Como instalar

  • Baixe e instale a fonte escolhida no seu computador (basta abrir e clicar em instalar)
  • Abra o Visual Studio Code
  • Ctrl + Shift + P > Open Settings (JSON)
  • Add "editor.fontFamily": "JetBrains Mono", ou "editor.fontFamily": "Fira Code",
  • Add "editor.fontLigatures": true,
  • Reinicie o VS Code

npm config set save=true Adiciona automaticamente --save em todo npm install

npm config set save-exact=true A cada npm install ele trava a versão instalada

Desfazer git commit --amend

git reset --soft HEAD@{1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment