Skip to content

saksham/dotfiles

Repository files navigation

Dotfiles

Inspired by Thoughtbot dotfiles and the one from MrPickles

screenshot

Requirements

  • Mac OSX
  • ZSH
  • Vim 8.0+ (or Neovim 0.3.1+)

Setting up your Local Machine

MacOS

Solarized on iTerm

The Solarized colors for iTerm can be found in its [official repository][solarized-repo]. Import [Solarized Dark.itermcolors][itermcolors] as a colorscheme for iTerm. In the Colors section of your iTerm profile, use the Solarized Dark preset.

Enable Mouse Wheel Scrolling in Vim on iTerm

If using iTerm, setting Scroll wheel sends arrow keys when in alternate screen mode. to Yes will allow trackpad scrolling while in Vim. The setting can be found in the advanced preferences.

Enabling the Meta Key on iTerm

If using iTerm, you may want to set the option key mode to Esc+ to make it be a meta key. It's used for a few shortcuts, such as resizing tmux panes.

Installation

  • Install rcm:
      brew install rcm
    
  • Create a folder called settings in your $HOME directory.
  • Clone onto your laptop using the following command.(Or, fork and keep your fork updated).
     git clone https://github.com/saksham/dotfiles ~/settings/dotfiles
    
  • Install the dotfiles:
      env RCRC=$HOME/settings/dotfiles/rcrc rcup
    

After the initial installation, you can run rcup without the one-time variable RCRC being set (rcup will symlink the repo's rcrc to ~/.rcrc for future runs of rcup). See example.

This command will create symlinks for config files in your home directory. Setting the RCRC environment variable tells rcup to use standard configuration options:

Update

From time to time you should pull down any updates to these dotfiles, and run rcup to link any new files and install new vim plugins.

Customization

Create a directory for your personal customizations:

mkdir ~/dotfiles-local

Put your customizations in ~/dotfiles-local appended with .local:

  • ~/dotfiles-local/aliases.local
  • ~/dotfiles-local/git_template.local/*
  • ~/dotfiles-local/gitconfig.local
  • ~/dotfiles-local/psqlrc.local (we supply a blank .psqlrc.local to prevent psql from throwing an error, but you should overwrite the file with your own copy)
  • ~/dotfiles-local/tmux.conf.local
  • ~/dotfiles-local/vimrc.local
  • ~/dotfiles-local/vimrc.bundles.local
  • ~/dotfiles-local/zshrc.local
  • ~/dotfiles-local/zsh/configs/*

For example, your ~/dotfiles-local/aliases.local might look like this:

# Productivity
alias todo='$EDITOR ~/.todo'

Your ~/dotfiles-local/gitconfig.local might look like this:

[alias]
  l = log --pretty=colored
[pretty]
  colored = format:%Cred%h%Creset %s %Cgreen(%cr) %C(bold blue)%an%Creset
[user]
  name = Dan Croak
  email = dan@thoughtbot.com

Your ~/dotfiles-local/vimrc.local might look like this:

" Color scheme
colorscheme github
highlight NonText guibg=#060606
highlight Folded  guibg=#0A0A0A guifg=#9090D0

If you don't wish to install a vim plugin from the default set of vim plugins in .vimrc.bundles, you can ignore the plugin by calling it out with UnPlug in your ~/.vimrc.bundles.local.

" Don't install vim-scripts/tComment
UnPlug 'tComment'

UnPlug can be used to install your own fork of a plugin or to install a shared plugin with different custom options.

" Only load vim-coffee-script if a Coffeescript buffer is created
UnPlug 'vim-coffee-script'
Plug 'kchmck/vim-coffee-script', { 'for': 'coffee' }

" Use a personal fork of vim-run-interactive
UnPlug 'vim-run-interactive'
Plug '$HOME/plugins/vim-run-interactive'

To extend your git hooks, create executable scripts in ~/dotfiles-local/git_template.local/hooks/* files.

Your ~/dotfiles-local/zshrc.local might look like this:

# load pyenv if available
if which pyenv &>/dev/null ; then
  eval "$(pyenv init -)"
fi

Your ~/dotfiles-local/vimrc.bundles.local might look like this:

Plug 'Lokaltog/vim-powerline'
Plug 'stephenmckinney/vim-solarized-powerline'

zsh Configurations

Additional zsh configuration can go under the ~/dotfiles-local/zsh/configs directory. This has two special subdirectories: pre for files that must be loaded first, and post for files that must be loaded last.

For example, ~/dotfiles-local/zsh/configs/pre/virtualenv makes use of various shell features which may be affected by your settings, so load it first:

# Load the virtualenv wrapper
. /usr/local/bin/virtualenvwrapper.sh

Setting a key binding can happen in ~/dotfiles-local/zsh/configs/keys:

# Grep anywhere with ^G
bindkey -s '^G' ' | grep '

Some changes, like chpwd, must happen in ~/dotfiles-local/zsh/configs/post/chpwd:

# Show the entries in a directory whenever you cd in
function chpwd {
  ls
}

This directory is handy for combining dotfiles from multiple teams; one team can add the virtualenv file, another keys, and a third chpwd.

The ~/dotfiles-local/zshrc.local is loaded after ~/dotfiles-local/zsh/configs.

vim Configurations

Similarly to the zsh configuration directory as described above, vim automatically loads all files in the ~/dotfiles-local/vim/plugin directory. This does not have the same pre or post subdirectory support that our zshrc has.

This is an example ~/dotfiles-local/vim/plugin/c.vim. It is loaded every time vim starts, regardless of the file name:

# Indent C programs according to BSD style(9)
set cinoptions=:0,t0,+4,(4
autocmd BufNewFile,BufRead *.[ch] setlocal sw=0 ts=8 noet

Other optional tools

There are a few recommended (but optional) tools you can install to improve your shell experience in general.

  • [diff-so-fancy][diff-so-fancy]: Diff-so-fancy is a diffing tool that gives a nicer diff than the git default.
  • [rg][rg]: Ripgrep is a faster alternative over ag, ack, and grep. It has the exact same usage as ag and is likely more preferable in all use cases.
  • [fzf][fzf]: Fzf is a general purpose fuzzy funder.
  • [fd][fd]: fd is a faster alternative to the find command. It works very well when paired with fzf.
  • tree: This will display the directory structure as a tree. We use it to improve the output of ALT-C from fzf.
  • [bat][bat]: An improved version of cat. We use it for the file previews when running CTRL-T from fzf.
  • httpie with pip install httpie to use instead of curl.
  • httpie with pip install httpie to use instead of curl.

You should install all of these independently of this dotfile repo. (This also includes figuring out how to install them.) Most of these are Homebrew packages on MacOS (or a target in most Linux package managers).

Thanks

About

No description, website, or topics provided.

Resources

License

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors