Code Monkey home page Code Monkey logo

dotfiles's Introduction

Denys Dovhan’s dotfiles

Spaceship with Hyper and One Dark

There are tons of useful things in here:

  • The usefulness of β€œOh My ZSH!” is already built–in.
  • πŸš€β­οΈ Spaceships as a prompt.
  • 🐟 Fish-like autosuggestions.
  • Syntax highlighting of commands while they are typed.
  • Automatically closing and deleting of quotes and brackets when you type them.
  • Browser-like substring search for history.
  • zgen for dependency management.
  • Useful aliases.
  • Git config, global .gitignore file and aliases.
  • Dotfiles synchronization (sync.py) with backup.
  • Restoring old dotfiles (restore.py) from backup.
  • A lot of useful bins.
  • update script for updating dotfiles, npm, brew, gems, etc.

Missing feature? 🍴 Fork this repo and make it better!

Installation

Dotfiles are installed by running one of the following commands in your terminal, just copy one of the following commands and execute in the terminal:

Tell Git who you are using these commands:

git config -f ~/.gitlocal user.email "[email protected]"
git config -f ~/.gitlocal user.name "Name Lastname"

Clone dotfiles repo:

# Clone dotfiles repo
git clone https://github.com/denysdovhan/dotfiles.git $HOME/.dotfiles

# Go to the dotfiles directory
cd $HOME/.dotfiles

# Install dotfiles
./install

Updating

Use single command to get latest updates:

update

This command will update dotfiles, their dependencies, brew or apt-get packages, global npm dependencies, gems, apm plugins.

Under the hood

Note: You may put your custom settings into ~/.zshlocal.

Projects tree

I suggest you to organize project folder as follows:

~/Projects
β”œβ”€β”€ Forks       # for GitHub fork
β”œβ”€β”€ Job         # for job projects
β”œβ”€β”€ Playground  # for short-term experiments
└── Repos       # for long-term projects

Aliases

Aliases are gonna make your work fast and enjoyable. See code in $DOTFILES/lib/aliases.zsh. Here is what's included:

  • Aliases from Oh-My-Zsh. See Oh-My-Zsh Cheatsheet for more.
  • Easier navigation
    • .. β†’ cd ..
    • ... β†’ cd ../..
    • .... β†’ cd ../../..
    • ..... β†’ cd ../../../..
    • ~ β†’ cd ~
    • - β†’ cd -
  • Folders shortcuts
    • dl β†’ cd ~/Downloads
    • dt β†’ cd ~/Desktop
    • pj β†’ cd ~/Projects
    • pjr β†’ cd ~/Projects/_Repos
    • pjf β†’ cd ~/Projects/_Forks
    • pl β†’ cd ~/Projects/_Playground/
  • Commands Shortcuts
    • e β†’ $EDITOR
    • +x β†’ chmod +x
    • x+ β†’ chmod +x
    • ll β†’ ls -alF
    • la β†’ ls -A
    • l β†’ ls -CF
  • Open
    • open <FILE> β€” open file from terminal.
    • o <FILE> β€” open file from terminal.
    • oo β€” open current folder.
  • Misc
    • update β€” get updates (Runs $DOTFILES/scripts/update.zsh).
    • dotfiles β€” jump quickly into dotfiles folder.
    • myip β€” my local IP address.
    • password β€” generate random password, copies it into clipboard and outputs it to terminal.
    • path β€” print $PATH in readable view.
    • getpage β€” download web page with all assets.
    • get β€” download file with original filename.

Oh-My-Zsh plugins

These OMZ plugins are included:

  • git β€” git aliases and functions.
  • npm β€” provides completion as well as adding many useful aliases.
  • yarn β€” the same as for npm, but for yarn
  • nvm β€” auto-sourcing nvm.
  • sudo β€” [Esc] [Esc] to re-run previous command with sudo.
  • ssh-agent β€” automatically starts ssh-agent to set up and load whichever credentials you want for ssh connections.
  • gpg-agent β€” enables gpg-agent if it is not running.
  • More are listed in .zshrc (it's hard to keep the list updated).

Bin

Dotfiles also include some functions that will make your life easier. See code in bin/.

  • emptytrash β€” empty the Trash on all mounted volumes and the main HDD.
  • git-cleanup β€” removes old Git branches and does other cleanup.
  • git-fork β€” add remote upsteam.
  • git-upstream β€” sync branch with upstream.
  • gz β€” get gzipped file size
  • n β€” runs given command using binary in node_modules/.bin of the current project.
  • nyan β€” print nyan cat.
  • server β€” start an HTTP server from a directory.

Git

Note: Add your git user data and custom settings to ~/.gitlocal.

Configuration

  • UI color is auto.
  • Diff colors are:
    • white bold for meta information;
    • cyan bold for frag;
    • red bold for old lines;
    • green bold for new lines.
  • Default editor is Vim instead of Vi.
  • push.default set as current.
  • Automatic replacement git://github.com/, gh:, github: addresses as [email protected]: for GitHub.
  • Automatic replacement git://gist.github.com/, gst:, gist: addresses as [email protected]: for Gists.
  • User custom settings gets from a ~/.gitlocal file.

Git Aliases

  • git a β†’ git add β€” patch mode for specified files.
  • git ua β†’ git reset HEAD β€” unstage files.
  • git b β†’ git branch β€” list, create, or delete branches.
  • git c β†’ git commit β€” record changes to the repository.
  • git co β†’ git checkout β€” checkout a branch or paths to the working tree.
  • git ap β†’ git add -p β€” add file contents to the index.
  • git ca β†’ git commit -a β€” commit with automatically stage files that have been modified and deleted.
  • git cm β†’ git commit -m β€” commit with commit message.
  • git cam β†’ git commit -am β€” add all files and commit with message.
  • git s β†’ git status -sb β€” short status with current branch.
  • git master β€” go to master branch and pull from remote.
  • git develop β€” go to develop branch and pull from remote.
  • git git β€” do not complain about git git.
  • git l β€” commits log with pretty single line format.
  • git ll β€” log with list of changed files for each commit.
  • git ignore β€” ignore files: append file to .gitignore.
  • git this β€” initialize, add all files and commit.
  • git amend β€” amend last commit.
  • git redo β€” amend last commit with its original message.
  • git undo β†’ reset --mixed HEAD^ β€” reset index changes, but not the working tree.
  • git discard β†’ checkout -- β€” discard changes.
  • git contrib β€” list of contributors and how many commits each person has.
  • git today β€” see how many lines of code you have written today.
  • git stat β€” how many lines of code in repo.
  • git sync β€” pull and push changes from/to remote.
  • git-root β€” go to repo root.
  • git-cleanup [--force] β€” removes old Git branches.
  • git-fork <original-author> β€” add remote upstream.
  • git-upstream [branch] β€” sync branch with upstream (as default master).

Resources

Resources that I used to make these dotfiles better:

License

MIT Β© Denys Dovhan

dotfiles's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dotfiles's Issues

Custom settings into ~/.zshlocal. doesn't work

I would like to extend my plugins with docker-compose for example but when I tried to do that it didn't work.

# ~/.zshlocal.

plugins = (docker-compose)

Am I doing something wrong? Could you help me with this by providing an example?

Installation glitch

I am not sure what any of this is...

error: failed to install source https://github.com/spaceship-prompt/[email protected]
due to: failed to find branch 4.x
due to: cannot locate remote-tracking branch 'origin/4.x'; class=Reference (4); code=NotFound (-3)
(eval):alias:170: bad option: +x
(eval):alias:178: bad option: -=

But this repo is turning into a can of worms! Not for me, thanks.

Sheldon - changed config dir, defer

Looks like Sheldon is complaining about some stuff in its latest update and completely breaks the setup (right after updating Sheldon):

  1. It changed the config dir from ~/.sheldon to ~/.config/sheldon
  2. Defer now has different syntax:

Old:

defer = { value = 'zsh-defer source "{{ file }}"', each = true }

New:

defer = "{% for file in files %}zsh-defer source \"{{ file }}\"\n{% endfor %}"

Solution:

  • add new symlink to dotbot
  • change defer

I could submit a PR with the proposed fixes πŸ˜„

Typo

Hi,
I didn't want to open a PR for a tiny typo.
In your README under 'Notes' I think it should be

Fork this repo and make it better!

Anyway thanks for the dotfiles :)

brew bundle fails during bootstrap

Happy to report that installation on recent setup went off without a hitch! πŸš€

But I ran into an issue with brew bundle during bootstrapping here because brew is not available in PATH for the current shell session. I worked around it by adding source ~/.zshrc here. However, according to instructions for Homebrew after installation we should add brew to PATH by (a) echo eval "$(/opt/homebrew/bin/brew shellenv)" >> /~.zprofile and (b) eval "$(/opt/homebrew/bin/brew shellenv)". Option b here should fix this issue irrespective of whether /~.zprofile exists.
Happy to submit PR as soon as I am setup.

How to uninstall/remove

Is there a way or a command to completely remove the dotfiles and all the configurations made by the dotfiles?
Is just deleting ./dotfiles folder enough?

.gitconfig cannot be customized via `custom`

Default .gitconfig does not include anything from custom. I put a pice of my configuration to .gitlocal but for the sake of consistency I think custom/.gitconfig should work as well.

Re-defining spaceship theme

I'm using these spaceship variables to redefine terminal prompt.

export SPACESHIP_DIR_TRUNC=0
SPACESHIP_DIR_TRUNC_REPO=false

If I put them to custom/.zshrc, it does not work. At the moment, I had to change home/.zshrc to make it working. But I guess it has to be changeable in some nicer way?

FYI

chmod aliases
throw stdout errors

(eval):alias:170: bad option: +x
(eval):alias:178: bad option: -=

Custom settings into ~/.zshlocal. doesn't work (pluguins)

Sorry for the bad example that made you close the issue #27 . I'll try to explain better. The following example works when it's in .zshrc but when I add it the same example in .zshlocal doesn't work.

# Plugins
plugins=(
   history-substring-search
   git
   npm
   yarn
   nvm
   sudo
   extract
   ssh-agent
   gpg-agent
   macos
   gh
   vscode
   common-aliases
   command-not-found
   docker
   docker-compose
)

Other settings such as adding commands to the PATH, as in the example below, work.

# Pyenv settings
 export PYENV_ROOT="$HOME/.pyenv"
 command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
 eval "$(pyenv init -)"

git branch and git tag commands output is empty

The problem is possible around here

 42 # Default pager
 43 export PAGER='less'
 44
 45 # less options
 46 less_opts=(
 47   # Quit if entire file fits on first screen.
 48   --quit-if-one-screen
 49   # Ignore case in searches that do not contain uppercase.
 50   --ignore-case
 51   # Allow ANSI colour escapes, but no other escapes.
 52   --RAW-CONTROL-CHARS
 53   # Quiet the terminal bell. (when trying to scroll past the end of the buffer)
 54   --quiet
 55   # Do not complain when we are on a dumb terminal.
 56   --dumb
 57 )
 58 export LESS="${less_opts[*]}"

Starts working if I remove these lines.

Fix homebrew instalation

When I've tried to install that on my Mac it caused the problem.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Nvm

I'm getting nvm error :(

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.