Build your dotfiles (shell, Vim config) from multiple sources with fresh.
Both of our dotfiles are built using fresh. We source Vim and other config from each other:
An example freshrc
entry for sourcing vim config from another repo:
fresh jasoncodes/dotfiles vim/mappings/pasteboard.vim --file=~/.vimrc
CtrlP is great for opening files in a project using fuzzy searching.
:CtrlP
lists all files in the project:CtrlPBuffer
lists all open buffers:CtrlPCurFile
lists files in the same directory as the current buffer
CtrlP Modified by Jason gives you a few extra handy modes:
:CtrlPModified
lists all modified files in your git working tree:CtrlPBranch
lists all files which have changed in the current branch
fresh jasoncodes/dotfiles vim/plugins/ctrlp.vim --file=~/.vimrc
map <Leader>r :checktime<CR>:wall<CR>:redraw!<CR>
fresh jasoncodes/dotfiles vim/config/auto_mkdir.vim --file=~/.vimrc
Pipe selection or buffer through external tools. :!sort
, :!cat -n
.
Read output of external command into current buffer. :read !ls
Copy range to current line: :42,50t.
Move a line below current line: :42m.
w
: move to beginning of next word
b
: move to previous start of word
e
: move to next end of word
These respect inter-word punctuation such as -, /, etc. Hold shift when using these to ignore these and move based on whitespace tokenisation
%
moves between ()
, []
, and {}
pairs.
With runtime macros/matchit.vim
, you can also jump between things like do
/end
in Ruby.
When jumping to another position (that is, not using j/k) by searching, tags, etc.,
a marker is inserted into the jump list. You can go back to the previous jump marker
by pressing Ctrl-O
. Ctrl-I
will navigate forward in the jump list.
With a plugin you can move the current line or selection up and down in a buffer.
This is really handy when rearranging commits in a git rebase --interactive
.
fresh jasoncodes/dotfiles vim/config/bubbling.vim --file=~/.vimrc
When editing a patch in git add --patch
, this plugin makes it easy to discard a range of lines.
https://github.com/twe4ked/vim-diff-toggle
:reg
will show the value in all registers. Use :help registers
to get a definition of each.
To insert the content of a register in either insert mode or command mode, you can press Ctrl-R
followed by the register's character.
Command-line Vim (the only way to fly :)) plus tmux makes for an awesome pairing tool.
A set of helper scripts exist to assist in setup. On the host machine:
# install wemux
brew install wemux
# install helper scripts using fresh
fresh jasoncodes/dotfiles bin/adduser --bin
fresh jasoncodes/dotfiles bin/wemux/\* --bin
# setup pairing environment
_wemux_setup
# give permission to pairing users
wemux-add-user $OTHER_USER_GITHUB_USERNAME
# start a pairing session
wemux
On the client machine:
ssh wemux@$HOST_MACHINE
:g/foo/d
deletes every line matching /foo/
:v/bar/d
deletes every line NOT matching /bar/
Open a vertical split with two files and run :diffthis
on both sides.
You can diff ranges in a file (rather than whole files) with Linediff
fresh jasoncodes/dotfiles/ vim/config/cursor.vim --file=~/.vimrc
Vim can remember undo history across sessions.
fresh jasoncodes/dotfiles vim/config/undo.vim --file=~/.vimrc
Can be really handy when combined with Gundo.
Ack is great for searching files by content.
The following file has a bunch of handy mappings for searching within a buffer:
fresh jasoncodes/dotfiles vim/config/search.vim --file=~/.vimrc
Tags are great for navigating between files. Use Ctrl-]
to jump to a tag match.
Install ctags with Homebrew:
brew install ctags
Enable automatic tag generation in Vim:
fresh jasoncodes/dotfiles vim/config/tags.vim --file=~/.vimrc
CtrlP can disambiguate tags with the ctrlp-tjump plugin.