Skip to content

KholdStare/dotfiles

Repository files navigation

Configurations included

  • vim
  • vim plugins
  • tmux
  • git
  • bash
  • ghci
  • cabal-install
  • bin folder with useful tmux/git scripts

Usage

Automate the process of cloning and symlinking scripts:

curl https://raw.githubusercontent.com/KholdStare/dotfiles/master/clone-and-install.bash | bash

If you have already cloned the repository, link.bash and force.bash are available.

  • link.bash - creates symlinks to configuration files and scripts if those filenames don't already exist. Otherwise leaves things alone.
  • force.bash - backs up existing files/links, and creates appropriate symlinks. If the correct links are already there, does nothing.
  • Both scripts are idempotent

Vim

A list of shortcuts that I don't want to forget. Anything marked with custom is either added or changed from default.

  • [I - lists all occurances of keyword in current and included files.

Commands:

  • /<pattern> - search
    • \v - "very magic" patterns accept regular expressions
  • :s - substitute
    • \%V - restrict substitution to visual selection (as opposed to whole lines)

Surround - add/modify/delete surrounding parentheses/quotes

  • ds<delim> - Delete surrounding delimeters.
  • cs<delim-from><delim-to> - Change surrounding delimeters.
  • visual selection S<delim> - Surround selection with delimiters.

Delimiters:

  • Open brackets {[( - surround with padding
  • Closed brackets )]} - surround without padding
  • < - XML/HTML tag. Prompts for attributes
  • Any punctuation mark
  • a - Angle brackets (since < is used for HTML)

NerdTree - File Browser

  • <F6> - toggle NerdTree (custom)
  • :NERDTreeFind - Find current file in filesystem. (Type :N<Tab>F<Tab><CR>)

TagBar - file outline

  • <F7> - open tagbar (custom)

Command-T - fast fuzzy file search

Caches all files in current directory on first use (give it a few seconds), allowing very fast subsequent file searches

  • <space><space> / <C-p> - fuzzy search filenames in current directory
  • <space>f - fuzzy search recently used filenames
  • <space>b - fuzzy search open buffers

NerdCommenter - Comments

  • <Leader>c<space> - toggle comments on line(s).
  • <Leader>cA - Append comment to end of line.
  • <Leader>c$ - Comments the current line from the cursor to the end of line.

Tabular.vim - Text Alignment

See vimcast for demo: http://vimcasts.org/episodes/aligning-text-with-tabular-vim/

  • :Tabularize /= - align on equals sign

Fugitive - Git integration

  • Gstatus - git status. Subcommands:
    • o - open file
    • D - diff file
    • - - stage/unstage file
    • C - start commit
  • Gcommit
  • Gwrite - stage current file
  • Gread - revert file to last checkin
  • Gblame - annotate lines with users/commit shas
  • Gedit - flip between working and committed versions of file.
  • Gedit <sha> - look at commit/tree/blob in history
  • Git <command> - do a regular git command

See fugitive vimcasts:

UltiSnips - snippet plugin

GIF Demo

  • Shorthand text can be expanded into a full snippet by pressing <Tab>
    • Try typing main<Tab> in a c file. This will expand into the main function.
  • Snippets can have several "holes" to fill in the skeleton.
    • Move between holes using <C-j> and <C-k>
    • Try typing if<Tab> in a c file. Type the condition, and move to the body with <C-j>

See the official github for UltiSnips for more information.