_ _ _
| | | | | |
| |___| |_____ __| | ____
|_____ (____ |/ _ |/ ___)
_____| / ___ ( (_| | |
(_______\_____|\____|_|
# Yet Another Dotfile Repo v2.0
# Now with Chezmoi, Prezto and Vim-Plug!
This is a GNU/Linux focused fork of @skwp/dotfiles.
Select Language: English, Portuguese
{: .no_toc }
Managed with chezmoi.
This repo has been built for my own benefit, however feel free to sneak in and steal anything that would improve your own productivity.
YADR is an opinionated dotfile repo that will make your heart sing
MacOS is not supported! If it works, great. If it doesn't, please don't complain. You may need to install zsh if you don't already have it. That being said, check the Docker section below
Got questions, concerns, want to hear announcements? Join the Google Group
Please use GitHub Issues for pull requests or bug reports only.
To get started please run:
sh -c "`curl -fsSL https://github.com/nandalopes/dotfiles/raw/main/root/bin/yadr/install.sh`"
Note: YADR will automatically install all of its subcomponents.
In case of not having chezmoi
installed - Just firing the
root/bin/yadr/install.sh
after a simple download of it.
git
You will have to clone the repo and from its root directory, execute the
install.sh
SH script
chezmoi
Leveraging Chezmoi capabilities
chezmoi init --apply --verbose --source ~/.yadr --https nandalopes/dotfiles
If you want to integrate this repo with yours, do this:
chezmoi cd
git remote add yadr https://github.com/nandalopes/dotfiles.git
git fetch yadr
# Merge repos:
git merge --allow-unrelated-histories yadr/main
# Verify if there is duplicated source files
chezmoi verify
# Then apply updates
chezmoi apply --verbose
Change your terminal colors to Solarized. Most terminals on Linux have a solarized colorscheme installed by default.
The escape key is the single most used key in vim. Old keyboards used to have Escape where Tab is today. Apple keyboards are the worst with their tiny Esc keys. But all this is fixed by remapping Caps to Escape. If you're hitting a small target in the corner, you are slowing yourself down considerably, and probably damaging your hands with repetitive strain injuries.
Recommended Cmd-Escape, which is really Cmd-Capslock.
This will give you fast full screen windows that are switchable without switching to spaces.
Same as iTerm. The native spaces navigation slows everything down for no reason.
let g:yadr_using_unsolarized_terminal = 1
" in ~/.vimrc.before
let g:yadr_disable_solarized_enhancements = 1
colorscheme base16-twilight
" in ~/.vimrc.after
Upgrading is easy.
chezmoi update --verbose --dry-run # check updates before apply
chezmoi apply --verbose
Read on to learn what YADR provides!
TODO: port homebrew install script to a run_once_homebrew_install
.
Think of Zsh as a more awesome Bash without having to learn anything new. Automatic spell correction for your commands, syntax highlighting, and more. We've also provided lots of enhancements:
Ctrl-R
for reverse history finderCtrl-x,Ctrl-l
to insert output of last commandz
and partial match for recently used directory. Tab completion enabled.Lots of things we do every day are done with two or three charactera mnemonic aliases. Please feel free to edit them:
ae # alias edit
ar # alias reload
Dotfiles management aliases
czI
- chezmoi (I)init - re-generate the config fileczh
- chezmoi (h)ome - cd into dotfiles dircza [ file(s) | folder(s) ]
- chezmoi (a)pply - apply source state to destination.
Add --dry-run
to preview only.czA [ file(s) | -r folder(s) ]
- chezmoi (A)dd - add files to source stateczc file(s)
- chezmoi (c)at - show target state, acording to source statecze file(s)
- chezmoi (e)dit - edit a file in source state then apply changes.
Add --dry-run
to preview only.czE
- chezmoi (E)dit-config - edit chezmoi.yaml
configuration fileczf [ file(s) | -r folder(s) ]
- chezmoi (f)orget - remove a file from source stateczg
- chezmoi (g)it - run a git command on dotfiles dirczu
- chezmoi (u)pdate - fetch and apply changes.
Add --dry-run
to preview only.czd [ file(s) | -r folder(s) ]
- chezmoi (d)iff - compare destination and target stateczD
- chezmoi (D)ata - list chezmoi variables, useful for templatingczm file(s)
- chezmoi (m)erge - three-way merge between destination, source state and target stateYADR will take over your ~/.gitconfig
, so if you want to store your usernames, please put them into ~/.gitconfig.user
It is recommended to use this file to set your user info. Alternately, you can set the appropriate environment variables in your ~/.secrets
.
git l
or gl
- a much more usable git loggit b
or gb
- a list of branches with summary of last commitgit r
- a list of remotes with infogit t
or gt
- a list of tags with infogit nb
or gnb
- a (n)ew (b)ranch - like checkout -bgit cp
or gcp
- cherry-pick -x (showing what was cherrypicked)git simple
- a clean format for creating changelogsgit recent-branches
- if you forgot what you've been working ongit unstage
/ guns
(remove from index) and git uncommit
/ gunc
(revert to the time prior to the last commit - dangerous if already pushed) aliasesgdmb
(g)it (d)elete (m)erged (b)ranches - Deletes all branches already merged on current branchMyrepos is a tool to manage all your version control repositories.
YADR provides a config framework to manage not only git repositories, but any version control system supported by this tool. It was adapted from @aspiers/mr-config.
You'll have under a .config/mr
folder:
.mrconfig
- uses library_loaders
to load all the components below:
groups.d/
- groups of mr
repo definitionslib.d/
which contains
mr
's lib
parametermr
actions and other mr
parameterssh.d/
- various shell helper functions used by the files in lib.d/
. Parts of these could be reused by other people, e.g.:
sh.d/git
- various generic git
-related helper functionssh.d/git-remotes
- various helper functions relating to management of git remotesA .gemrc
is included. Never again type gem install whatever --no-ri --no-rdoc
. --no-ri --no-rdoc
is done by default.
tmux.conf
provides some sane defaults for tmux like a powerful status bar and vim keybindings.
You can customize the configuration in ~/.tmux.conf.user
.
The provided inputrc and editrc will turn your various command line tools like mysql and irb into vim prompts. There's also an included Ctrl-R reverse history search feature in editrc, very useful in irb, postgres command line, and etc.
We include the spaceman-diff
command. Now you can diff images from the command line.
A list of some of the most useful commands that YADR provides in vim are included below. This is not a comprehensive list. To get deeper knowledge, practice a few of these every day, and then start looking into the lists of plugins above to learn more.
,z
- go to previous buffer (:bp),x
- go to next buffer (:bn)Cmd-j
and Cmd-k
to move up and down roughly by functions (\j
and \k
in Linux)Ctrl-o
- Old cursor position - this is a standard mapping but very useful, so included hereCtrl-i
- opposite of Ctrl-O (again, this is standard),f
- instantly Find definition of class (must have exuberant ctags installed),F
- same as ,f
but in a vertical split,gf
or Ctrl-f
- same as vim normal gf (go to file), but in a vertical split (works with file.rb:123 line numbers also)gF
- standard vim mapping, here for completeness (go to file at line number),k
- Search the current word under the cursor and show results in quickfix window,K
- Grep the current word up to next exclamation point (useful for ruby foo! methods)Cmd-*
- highlight all occurrences of current word (similar to regular *
except doesn't move)
(Alt
in Linux),hl
- toggle search highlight on and off,gg
or ,ag
- Grep command line, type between quotes. Uses Ag Silver Searcher.,gg
you can navigate the results with Ctrl-x
and Ctrl-z
(or standard vim :cn
and :cp
),gd
- Grep def (greps for 'def [function name]') when cursor is over the function name,gcf
- Grep Current File to find references to the current file//
- clear the search,,w
(alias ,<esc>
) or ,,b
(alias ,<shift-esc>
) - EasyMotion, a vimperator style tool that highlights jump-points on the screen and lets you type to get there.,mc
- mark this word for MultiCursor (like sublime). Use Ctrl-n
(next), Ctrl-p
(prev), Ctrl-x
(skip) to add more cursors, then do normal vim things like edit the word.gK
- Opens the documentation for the word under the cursor.f
but more accurate.:Gsearch foo
- global search, then do your normal %s/search/replace/g
and follow up with :Greplace
to replace across all files. When done use :wall
to write all the files.,t
- fuzzy file selector,b
- buffer selector - great for jumping to a file you already have openCmd-Shift-M
- jump to method - CtrlP tag search within current buffer
(,M
in Linux),jm
jump to models. Other ,j
mappings: ,jc
for controllers, ,jh
for helpers, etc. If you think of a concept and a letter, we've got you covered.Cmd-Shift-N
- NERDTree toggle (,N
in Linux)Ctrl-\
- Show current file in NERDTreeCmd-Shift-P
- Clear CtrlP cache
(,P
in Linux),#
,"
,'
,]
,)
,}
to surround a word in these common wrappers. the # does #{ruby interpolation}. works in visual mode (thanks @cj). Normally these are done with something like ysw#
Cmd-'
, Cmd-"
, Cmd-]
, Cmd-)
, etc to change content inside those surrounding marks. You don't have to be inside them (\"
in Linux),.
to go to last edit location (same as '.
) because the apostrophe is hard on the pinky,ci
to change inside any set of quotes/brackets/etcCmd-1
thru Cmd-9
to switch to a specific tab number (like iTerm and Chrome) - and tabs have been set up to show numbers (,t1
or Alt-1
in Linux)Ctrl-h,l,j,k
- to move left, right, down, up between splits. This also works between vim and tmux splits thanks to vim-tmux-navigator
.Q
- Intelligent Window Killer. Close window wincmd c
if there are multiple windows to same buffer, or kill the buffer bwipeout
if this is the last window into it.vv
- vertical split (Ctrl-w,v
)ss
- horizontal split (Ctrl-w,s
),qo
- open quickfix window (this is where output from Grep goes),qc
- close quickfixCtrl-p
after pasting - Use p
to paste and Ctrl-p
to cycle through previous pastes. Provided by YankRing.,yr
- view the yankring - a list of your previous copy commands. also you can paste and hit ctrl-p
for cycling through previous copy commandscrs
, crc
, cru
via abolish.vim, coerce to snake_case, camelCase, and UPPERCASE. There are more :help abolish
:NR
- NarrowRgn - use this on a bit of selected text to create a new split with just that text. Do some work on it, then :wq it to get the results back.,ig
- toggle visual indentation guides,cf
- Copy Filename of current file (full path) into system (not vi) paste buffer,cn
- Copy Filename of current file (name only, no path),yw
- yank a word from anywhere within the word (so you don't have to go to the beginning of it),ow
- overwrite a word with whatever is in your yank buffer - you can be anywhere on the word. saves having to visually select it,ocf
- open changed files (stolen from @garybernhardt). open all files with git changes in splits,w
- strip trailing whitespacessj
- split a line such as a hash {:foo => {:bar => :baz}} into a multiline hash (j = down)sk
- unsplit a link (k = up),he
- Html Escape,hu
- Html Unescape,hp
- Html Preview (open in Safari)Cmd-Shift-A
- align things (type a character/expression to align by, works in visual mode or by itself) (,A
in Linux):ColorToggle
- turn on #abc123 color highlighting (useful for css):GV
- Git log browser,hi
- show current Highlight group. if you don't like the color of something, use this, then use hi! link [groupname] [anothergroupname]
in your vimrc.after to remap the color. You can see available colors using :hi
,gt
- Go Tidy - tidy up your html code (works on a visual selection):Wrap
- wrap long lines (e.g. when editing markdown files)Cmd-/
- toggle comments (usually gcc from tComment) (,/
in Linux)gcp
(comment a paragraph),vv
and ,cc
to switch between view and controller - these are maps to :Rcontroller and :Rview. Explore the :R,rs
and ,rl
to run rspec or a spec line in iTerm (check iTerm window for results),ss
and ,sl
for the same using spring rspec
which makes your Rails specs faster by caching the Rails env (must have spring gem installed),rem
, ,rel
to extract methods or let statementsCtrl-s
- Open related spec in a split. Similar to :A and :AV from rails.vim but is also aware of the fast_spec dir and faster to type:Bopen [gem name]
to navigate to a gem (@tpope/vim-bundler),gcp
- Grep Current Partial to find references to the current view partial,orb
- outer ruby block. takes you one level up from nested blocks (great for rspec),vc
- (Vim Command) copies the command under your cursor and executes it in vim. Great for testing single line changes to vimrc.,vr
- (Vim Reload) source current file as a vim fileWe can use Docker to test some changes in a Linux Container.
Assuming your host system has Docker & Docker Compose properly installed, run:
docker compose run dotfiles
This will build the container image if it never built it before (which may take a while -- future times will be faster) and then run a zsh
session inside that container for you.
There you can play around, test commands, aliases, etc.
Warning: this repo is primarily Linux oriented. So any support for macOS can only be done with the help of the community.
The macOS file is a bash script that sets up sensible defaults for devs and power users under macOS. Read through it before running it. To use:
bin/macos
These hacks are Lion-centric. May not work for other OS'es. My favorite mods include:
brew uninstall macvim
brew remove macvim
brew cleanup
brew install macvim --custom-icons --with-override-system-vim --with-lua --with-luajit
Installing terminal vim (with lua) with an RVM managed Ruby can cause the neocomplete plugin to segfault. Try uninstalling vim, then installing with system ruby:
brew uninstall vim
rvm system do brew install vim --with-lua
Pry offers a much better out of the box IRB experience with colors, tab completion, and lots of other tricks. You can also use it as an actual debugger by installing pry-nav.
Learn more about YADR's pry customizations and how to install
MIT