diff options
Diffstat (limited to 'base')
-rw-r--r-- | base/bash_aliases | 1 | ||||
-rw-r--r-- | base/bash_logout | 6 | ||||
-rw-r--r-- | base/bashrc | 109 | ||||
-rw-r--r-- | base/gnupg/.nolink | 0 | ||||
-rw-r--r-- | base/gnupg/gpg.conf | 8 | ||||
-rw-r--r-- | base/muttrc | 42 | ||||
-rw-r--r-- | base/vim/after/syntax/html.vim | 23 | ||||
-rw-r--r-- | base/vim/doc/.gitignore | 1 | ||||
-rw-r--r-- | base/vim/doc/git-vim.txt | 95 | ||||
-rw-r--r-- | base/vim/plugin/git.vim | 372 | ||||
-rw-r--r-- | base/vim/syntax/git-diff.vim | 8 | ||||
-rw-r--r-- | base/vim/syntax/git-log.vim | 3 | ||||
-rw-r--r-- | base/vim/syntax/git-status.vim | 18 | ||||
-rw-r--r-- | base/vimrc | 114 |
14 files changed, 800 insertions, 0 deletions
diff --git a/base/bash_aliases b/base/bash_aliases new file mode 100644 index 0000000..ccf7cb7 --- /dev/null +++ b/base/bash_aliases @@ -0,0 +1 @@ +alias open=gnome-open diff --git a/base/bash_logout b/base/bash_logout new file mode 100644 index 0000000..09df5b1 --- /dev/null +++ b/base/bash_logout @@ -0,0 +1,6 @@ +# ~/.bash_logout: executed by bash(1) when login shell exits. + +# when leaving the console clear the screen to increase privacy +if [ "$SHLVL" = 1 ]; then + [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q +fi diff --git a/base/bashrc b/base/bashrc new file mode 100644 index 0000000..683e47e --- /dev/null +++ b/base/bashrc @@ -0,0 +1,109 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# If not running interactively, don't do anything +[ -z "$PS1" ] && return + +# don't put duplicate lines in the history. See bash(1) for more options +# ... or force ignoredups and ignorespace +HISTCONTROL=ignoredups:ignorespace + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# make less more friendly for non-text input files, see lesspipe(1) +[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color) color_prompt=yes;; +esac + +# uncomment for a colored prompt, if the terminal has the capability; turned +# off by default to not distract the user: the focus in a terminal window +# should be on the output of commands, not on the prompt +#force_color_prompt=yes + +if [ -n "$force_color_prompt" ]; then + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi +fi + +if [ "$color_prompt" = yes ]; then + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' +else + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' +fi +unset color_prompt force_color_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; +*) + ;; +esac + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# some more ls aliases +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' + +# Add an "alert" alias for long running commands. Use like so: +# sleep 10; alert +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if [ -f /etc/bash_completion ] && ! shopt -oq posix; then + . /etc/bash_completion +fi + +# Personal Settings +export EDITOR=vim + +# Host Specific Settings +source ~/.host-specific/bashrc diff --git a/base/gnupg/.nolink b/base/gnupg/.nolink new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/base/gnupg/.nolink diff --git a/base/gnupg/gpg.conf b/base/gnupg/gpg.conf new file mode 100644 index 0000000..757c9c3 --- /dev/null +++ b/base/gnupg/gpg.conf @@ -0,0 +1,8 @@ +keyserver hkp://subkeys.pgp.net +keyserver hkp://pgp.mit.edu +keyserver-options auto-key-retrieve + +personal-digest-preferences SHA256 +cert-digest-algo SHA256 +default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed + diff --git a/base/muttrc b/base/muttrc new file mode 100644 index 0000000..caebefa --- /dev/null +++ b/base/muttrc @@ -0,0 +1,42 @@ +# +# Mutt settings common everywhere +# + +# Mailbox Settings +set mbox_type="Maildir" +set folder="~/.maildir" + +# Mutt settings +set header_cache=~/.maildir/mutt_cache/ +set delete=yes +unset confirmappend +set sort=threads +set pager_stop=yes + +# Headers +ignore * +unignore date from: to: cc subject X-Spam-Status +set forward_format="Fwd: %s" + +# Macros +macro pager <Up> "<previous-line>" "Previous line" +macro pager <Down> "<next-line>" "Next line" + +macro index c "<change-folder>?<toggle-mailboxes>" "open a different folder" +macro pager c "<change-folder>?<toggle-mailboxes>" "open a different folder" +macro index C "<copy-message>?<toggle-mailboxes>" "copy a message to a mailbox" +macro index M "<save-message>?<toggle-mailboxes>" "move a message to a mailbox" +macro index e "<save-message>+archived<enter>" "Archive a message." +macro pager e "<save-message>+archived<enter>" "Archive a message." +macro index S "<save-message>+spam<enter>" "Report message as spam." +macro index d "<save-message>+trash<enter>" "Move to trash" +macro pager d "<save-message>+trash<enter>" "Move to trash" + +macro index \es <change-folder>'=search'<enter><shell-escape>'mairix ' 'Enter Mairix search term' + +# Colors +color index brightwhite default ~N +color index brightwhite default ~O + +# Grab any host-specific settings +source ~/.host-specific/muttrc diff --git a/base/vim/after/syntax/html.vim b/base/vim/after/syntax/html.vim new file mode 100644 index 0000000..20740b2 --- /dev/null +++ b/base/vim/after/syntax/html.vim @@ -0,0 +1,23 @@ +" Vim syntax file +" Language: HTML (version 5) +" Maintainer: Rodrigo Machado <rcmachado@gmail.com> +" URL: http://rm.blog.br/vim/syntax/html.vim +" Last Change: 2009 Aug 19 +" License: Public domain +" (but let me know if you liked it :) ) +" +" Note: This file just adds the new tags from HTML 5 +" and don't replace default html.vim syntax file + +" HTML 5 tags +syn keyword htmlTagName contained article aside audio bb canvas command datagrid +syn keyword htmlTagName contained datalist details dialog embed figure footer +syn keyword htmlTagName contained header hgroup keygen mark meter nav output +syn keyword htmlTagName contained progress time ruby rt rp section time video + +" HTML 5 arguments +syn keyword htmlArg contained autofocus placeholder min max step +syn keyword htmlArg contained contenteditable contextmenu draggable hidden item +syn keyword htmlArg contained itemprop list subject spellcheck +" this doesn't work because default syntax file alredy define a 'data' attribute +syn match htmlArg "\<\(data-[\-a-zA-Z0-9_]\+\)=" contained diff --git a/base/vim/doc/.gitignore b/base/vim/doc/.gitignore new file mode 100644 index 0000000..6e92f57 --- /dev/null +++ b/base/vim/doc/.gitignore @@ -0,0 +1 @@ +tags diff --git a/base/vim/doc/git-vim.txt b/base/vim/doc/git-vim.txt new file mode 100644 index 0000000..5fba807 --- /dev/null +++ b/base/vim/doc/git-vim.txt @@ -0,0 +1,95 @@ +*git-vim.txt* Git Bindings for Vim + +============================================================================== +CONTENTS *git-vim-contents* + + 1. Introduction.............................|git-vim| + 2. Commands.................................|git-vim-commands| + 3. Keymaps..................................|git-vim-keymaps| + 4. License..................................|git-vim-license| + +============================================================================== +1. Introduction *git-vim* + +Git-vim provides: + +* Plugin files for calling git functions from inside Vim +* Syntax files for git displays + +============================================================================== +2. Commands *git-vim-commands* + +:GitAdd <file> + git-add <file> or current file if not specified. + +:GitCommit <args> + git-commit. + +:GitStatus + Show git-status of current file or repository. + +:GitLog + Show git-log of current file or repository. + +:GitCheckout <args> + git-checkout. Completes git commits. + +:GitDiff <args> + git-diff. Completes git commits. + +:GitPull <args> + git-pull. + +:GitPullRebase + git-pull —rebase. + +:GitPush <args> + git-push. Defaults to +git push origin <current-branch>+. + +:GitCatFile <args> + git-cat-file. + +:Git <args> + Does any git command. + +:GitVimDiffMerge + Experimental. Call this command on unmerged file to enter vimdiff mode. + +:GitVimDiffMergeDone + Call this command after merging. + +============================================================================== +3. Keymaps *git-vim-keymaps* + +<Leader>gd + :GitDiff + +<Leader>gD + :GitDiff —cached + +<Leader>gs + :GitStatus + +<Leader>gl + :GitLog + +<Leader>ga + :GitAdd + +<Leader>gA + :GitAdd <cfile> + +<Leader>gc + :GitCommit + +In the git-status buffer: + +<Enter> + :GitAdd <cfile> + +============================================================================== +4. License *git-vim-license* + +The MIT License + + vim:tw=78:ts=8:ft=help diff --git a/base/vim/plugin/git.vim b/base/vim/plugin/git.vim new file mode 100644 index 0000000..a88329b --- /dev/null +++ b/base/vim/plugin/git.vim @@ -0,0 +1,372 @@ +" Author: motemen <motemen@gmail.com> +" License: The MIT License +" URL: http://github.com/motemen/git-vim/ + +if !exists('g:git_command_edit') + let g:git_command_edit = 'new' +endif + +if !exists('g:git_bufhidden') + let g:git_bufhidden = '' +endif + +if !exists('g:git_bin') + let g:git_bin = 'git' +endif + +if !exists('g:git_author_highlight') + let g:git_author_highlight = { } +endif + +if !exists('g:git_highlight_blame') + let g:git_highlight_blame = 0 +endif + +if !exists('g:git_no_map_default') || !g:git_no_map_default + nnoremap <Leader>gd :GitDiff<Enter> + nnoremap <Leader>gD :GitDiff --cached<Enter> + nnoremap <Leader>gs :GitStatus<Enter> + nnoremap <Leader>gl :GitLog<Enter> + nnoremap <Leader>ga :GitAdd<Enter> + nnoremap <Leader>gA :GitAdd <cfile><Enter> + nnoremap <Leader>gc :GitCommit<Enter> + nnoremap <Leader>gp :GitPullRebase<Enter> + nnoremap <Leader>gb :GitBlame<Enter> +endif + +" Ensure b:git_dir exists. +function! s:GetGitDir() + if !exists('b:git_dir') + let b:git_dir = s:SystemGit('rev-parse --git-dir') + if !v:shell_error + let b:git_dir = fnamemodify(split(b:git_dir, "\n")[0], ':p') . '/' + endif + endif + return b:git_dir +endfunction + +" Returns current git branch. +" Call inside 'statusline' or 'titlestring'. +function! GitBranch() + let git_dir = <SID>GetGitDir() + + if strlen(git_dir) && filereadable(git_dir . '/HEAD') + let lines = readfile(git_dir . '/HEAD') + if !len(lines) + return '' + else + return matchstr(lines[0], 'refs/heads/\zs.\+$') + endif + else + return '' + endif +endfunction + +" List all git local branches. +function! ListGitBranches(arg_lead, cmd_line, cursor_pos) + let branches = split(s:SystemGit('branch'), '\n') + if v:shell_error + return [] + endif + + return map(branches, 'matchstr(v:val, ''^[* ] \zs.*'')') +endfunction + +" List all git commits. +function! ListGitCommits(arg_lead, cmd_line, cursor_pos) + let commits = split(s:SystemGit('log --pretty=format:%h')) + if v:shell_error + return [] + endif + + let commits = ['HEAD'] + ListGitBranches(a:arg_lead, a:cmd_line, a:cursor_pos) + commits + + if a:cmd_line =~ '^GitDiff' + " GitDiff accepts <commit>..<commit> + if a:arg_lead =~ '\.\.' + let pre = matchstr(a:arg_lead, '.*\.\.\ze') + let commits = map(commits, 'pre . v:val') + endif + endif + + return filter(commits, 'match(v:val, ''\v'' . a:arg_lead) == 0') +endfunction + +" Show diff. +function! GitDiff(args) + let git_output = s:SystemGit('diff ' . a:args . ' -- ' . s:Expand('%')) + if !strlen(git_output) + echo "No output from git command" + return + endif + + call <SID>OpenGitBuffer(git_output) + setlocal filetype=git-diff +endfunction + +" Show Status. +function! GitStatus() + let git_output = s:SystemGit('status') + call <SID>OpenGitBuffer(git_output) + setlocal filetype=git-status + nnoremap <buffer> <Enter> :GitAdd <cfile><Enter>:call <SID>RefreshGitStatus()<Enter> + nnoremap <buffer> - :silent !git reset HEAD -- =expand('<cfile>')<Enter><Enter>:call <SID>RefreshGitStatus()<Enter> +endfunction + +function! s:RefreshGitStatus() + let pos_save = getpos('.') + GitStatus + call setpos('.', pos_save) +endfunction + +" Show Log. +function! GitLog(args) + let git_output = s:SystemGit('log ' . a:args . ' -- ' . s:Expand('%')) + call <SID>OpenGitBuffer(git_output) + setlocal filetype=git-log +endfunction + +" Add file to index. +function! GitAdd(expr) + let file = s:Expand(strlen(a:expr) ? a:expr : '%') + + call GitDoCommand('add ' . file) +endfunction + +" Commit. +function! GitCommit(args) + let git_dir = <SID>GetGitDir() + + let args = a:args + + if args !~ '\v\k@<!(-a|--all)>' && s:SystemGit('diff --cached --stat') =~ '^\(\s\|\n\)*$' + let args .= ' -a' + endif + + " Create COMMIT_EDITMSG file + let editor_save = $EDITOR + let $EDITOR = '' + let git_output = s:SystemGit('commit ' . args) + let $EDITOR = editor_save + + let cur_dir = getcwd() + execute printf('%s %sCOMMIT_EDITMSG', g:git_command_edit, git_dir) + execute printf("lcd %s", cur_dir) + + setlocal filetype=git-status bufhidden=wipe + augroup GitCommit + autocmd BufWritePre <buffer> g/^#\|^\s*$/d | setlocal fileencoding=utf-8 + execute printf("autocmd BufEnter <buffer> lcd %s", cur_dir) + execute printf("autocmd BufWritePost <buffer> call GitDoCommand('commit %s -F ' . expand('%%')) | autocmd! GitCommit * <buffer>", args) + augroup END +endfunction + +" Checkout. +function! GitCheckout(args) + call GitDoCommand('checkout ' . a:args) +endfunction + +" Push. +function! GitPush(args) +" call GitDoCommand('push ' . a:args) + " Wanna see progress... + let args = a:args + if args =~ '^\s*$' + let args = 'origin ' . GitBranch() + endif + execute '!' g:git_bin 'push' args +endfunction + +" Pull. +function! GitPull(args) +" call GitDoCommand('pull ' . a:args) + " Wanna see progress... + execute '!' g:git_bin 'pull' a:args +endfunction + +" Show commit, tree, blobs. +function! GitCatFile(file) + let file = s:Expand(a:file) + let git_output = s:SystemGit('cat-file -p ' . file) + if !strlen(git_output) + echo "No output from git command" + return + endif + + call <SID>OpenGitBuffer(git_output) +endfunction + +" Show revision and author for each line. +function! GitBlame(...) + let git_output = s:SystemGit('blame -- ' . expand('%')) + if !strlen(git_output) + echo "No output from git command" + return + endif + + let l:git_blame_width = 20 + if strlen(a:1) + let l:git_blame_width = a:1 + elseif exists('g:git_blame_width') && g:git_blame_width + let l:git_blame_width = g:git_blame_width + endif + + setlocal noscrollbind + + " :/ + let git_command_edit_save = g:git_command_edit + let g:git_command_edit = 'leftabove vnew' + call <SID>OpenGitBuffer(git_output) + let g:git_command_edit = git_command_edit_save + + setlocal modifiable + silent %s/\d\d\d\d\zs \+\d\+).*// + exe 'vertical resize ' . git_blame_width + setlocal nomodifiable + setlocal nowrap scrollbind + + if g:git_highlight_blame + call s:DoHighlightGitBlame() + endif + + wincmd p + setlocal nowrap scrollbind + + syncbind +endfunction + +" Experimental +function! s:DoHighlightGitBlame() + for l in range(1, line('$')) + let line = getline(l) + let [commit, author] = matchlist(line, '\(\x\+\) (\(.\{-}\)\s* \d\d\d\d-\d\d-\d\d')[1:2] + call s:LoadSyntaxRuleFor({ 'author': author }) + endfor +endfunction + +function! s:LoadSyntaxRuleFor(params) + let author = a:params.author + let name = 'gitBlameAuthor_' . substitute(author, '\s', '_', 'g') + if (!hlID(name)) + if has_key(g:git_author_highlight, author) + execute 'highlight' name g:git_author_highlight[author] + else + let [n1, n2] = [0, 1] + for c in split(author, '\zs') + let n1 = (n1 + char2nr(c)) % 8 + let n2 = (n2 + char2nr(c) * 3) % 8 + endfor + if n1 == n2 + let n1 = (n2 + 1) % 8 + endif + execute 'highlight' name printf('ctermfg=%d ctermbg=%d', n1, n2) + endif + execute 'syntax match' name '"\V\^\x\+ (' . escape(author, '\') . '\.\*"' + endif +endfunction + +function! GitDoCommand(args) + let git_output = s:SystemGit(a:args) + let git_output = substitute(git_output, '\n*$', '', '') + if v:shell_error + echohl Error + echo git_output + echohl None + else + echo git_output + endif +endfunction + +function! s:SystemGit(args) + " workardound for MacVim, on which shell does not inherit environment + " variables + if has('mac') && &shell =~ 'sh$' + return system('EDITOR="" '. g:git_bin . ' ' . a:args) + else + return system(g:git_bin . ' ' . a:args) + endif +endfunction + +" Show vimdiff for merge. (experimental) +function! GitVimDiffMerge() + let file = s:Expand('%') + let filetype = &filetype + let t:git_vimdiff_original_bufnr = bufnr('%') + let t:git_vimdiff_buffers = [] + + topleft new + setlocal buftype=nofile + file `=':2:' . file` + call add(t:git_vimdiff_buffers, bufnr('%')) + execute 'silent read!git show :2:' . file + 0d + diffthis + let &filetype = filetype + + rightbelow vnew + setlocal buftype=nofile + file `=':3:' . file` + call add(t:git_vimdiff_buffers, bufnr('%')) + execute 'silent read!git show :3:' . file + 0d + diffthis + let &filetype = filetype +endfunction + +function! GitVimDiffMergeDone() + if exists('t:git_vimdiff_original_bufnr') && exists('t:git_vimdiff_buffers') + if getbufline(t:git_vimdiff_buffers[0], 1, '$') == getbufline(t:git_vimdiff_buffers[1], 1, '$') + execute 'sbuffer ' . t:git_vimdiff_original_bufnr + 0put=getbufline(t:git_vimdiff_buffers[0], 1, '$') + normal! jdG + update + execute 'bdelete ' . t:git_vimdiff_buffers[0] + execute 'bdelete ' . t:git_vimdiff_buffers[1] + close + else + echohl Error + echo 'There still remains conflict' + echohl None + endif + endif +endfunction + +function! s:OpenGitBuffer(content) + if exists('b:is_git_msg_buffer') && b:is_git_msg_buffer + enew! + else + execute g:git_command_edit + endif + + setlocal buftype=nofile readonly modifiable + execute 'setlocal bufhidden=' . g:git_bufhidden + + silent put=a:content + keepjumps 0d + setlocal nomodifiable + + let b:is_git_msg_buffer = 1 +endfunction + +function! s:Expand(expr) + if has('win32') + return substitute(expand(a:expr), '\', '/', 'g') + else + return expand(a:expr) + endif +endfunction + +command! -nargs=1 -complete=customlist,ListGitCommits GitCheckout call GitCheckout(<q-args>) +command! -nargs=* -complete=customlist,ListGitCommits GitDiff call GitDiff(<q-args>) +command! GitStatus call GitStatus() +command! -nargs=? GitAdd call GitAdd(<q-args>) +command! -nargs=* GitLog call GitLog(<q-args>) +command! -nargs=* GitCommit call GitCommit(<q-args>) +command! -nargs=1 GitCatFile call GitCatFile(<q-args>) +command! -nargs=? GitBlame call GitBlame(<q-args>) +command! -nargs=+ Git call GitDoCommand(<q-args>) +command! GitVimDiffMerge call GitVimDiffMerge() +command! GitVimDiffMergeDone call GitVimDiffMergeDone() +command! -nargs=* GitPull call GitPull(<q-args>) +command! GitPullRebase call GitPull('--rebase') +command! -nargs=* GitPush call GitPush(<q-args>) diff --git a/base/vim/syntax/git-diff.vim b/base/vim/syntax/git-diff.vim new file mode 100644 index 0000000..54a97ec --- /dev/null +++ b/base/vim/syntax/git-diff.vim @@ -0,0 +1,8 @@ +runtime syntax/diff.vim + +syntax match gitDiffStatLine /^ .\{-}\zs[+-]\+$/ contains=gitDiffStatAdd,gitDiffStatDelete +syntax match gitDiffStatAdd /+/ contained +syntax match gitDiffStatDelete /-/ contained + +highlight gitDiffStatAdd ctermfg=2 +highlight gitDiffStatDelete ctermfg=5 diff --git a/base/vim/syntax/git-log.vim b/base/vim/syntax/git-log.vim new file mode 100644 index 0000000..571b28a --- /dev/null +++ b/base/vim/syntax/git-log.vim @@ -0,0 +1,3 @@ +syntax match gitLogCommit +^commit \x\{40}+ + +highlight link gitLogCommit Statement diff --git a/base/vim/syntax/git-status.vim b/base/vim/syntax/git-status.vim new file mode 100644 index 0000000..4cf05e5 --- /dev/null +++ b/base/vim/syntax/git-status.vim @@ -0,0 +1,18 @@ +runtime syntax/diff.vim +setlocal filetype= + +syntax match gitStatusComment +^#.*+ contains=ALL + +syntax match gitStatusBranch +On branch .\++ + +syntax match gitStatusUndracked +\t\zs.\++ +syntax match gitStatusNewFile +\t\zsnew file: .\++ +syntax match gitStatusModified +\t\zsmodified: .\++ + +highlight link gitStatusComment Comment + +highlight link gitStatusBranch Title + +highlight link gitStatusUndracked diffOnly +highlight link gitStatusNewFile diffAdded +highlight link gitStatusModified diffChanged diff --git a/base/vimrc b/base/vimrc new file mode 100644 index 0000000..2c0e0f0 --- /dev/null +++ b/base/vimrc @@ -0,0 +1,114 @@ +" Setting editor defaults +set nu +syntax on +set bg=dark +set diffopt=filler,iwhite " keep files synced and ignore whitespace +set expandtab " Get rid of tabs altogether and replace with spaces +"set guioptions-=m " Remove menu from the gui +"set guioptions-=T " Remove toolbar +set hidden " hide buffers instead of closing +set history=50 " keep 50 lines of command line history +set ignorecase " Do case insensitive matching +set smartcase " Ignore case only when doing a lowercase search +set incsearch " Incremental search +set laststatus=2 " always have status bar +set linebreak " This displays long lines as wrapped at word boundries +set matchtime=10 " Time to flash the brack with showmatch +set nobackup " Don't keep a backup file +set nocompatible " Use Vim defaults (much better!) +set hlsearch " Use highlighted search (I am blind) +set t_Co=256 " Set terminal to use 256 colors +set backspace=indent,eol,start +set clipboard=unnamed " Use system clipboard for all cut/copy operations +set ruler +set foldmethod=indent +set nofen +set mouse=a +set spell spelllang=en + +" filetypes +filetype plugin on +filetype indent on +filetype on + +"Set colorscheme. This is a black background colorscheme + colorscheme default + +" Turn off highlighting after search +map ,, :nohl<CR> + +" Remove all trailing whitespaces +map <Leader>s :%s/\s\+$//g <cr> + +" toggle line number with F11 or Ctrl-L +map <F11> : set number! <cr> +map <C-L> : set number! <cr> + +" Move between split windows +map O5B <C-W>j +map O5A <C-W>k +map O5D <C-W>h +map O5C <C-W>l + +"Set tab to 4 spaces +set shiftwidth=4 +set softtabstop=4 +set tabstop=4 +set smarttab + +" Paste from GUI into vim and not lose indendation +" F7 to toggle paste mode +map <F7> :set invpaste<CR> +set pastetoggle=<F7> + +"normal mode maps + +"Map \e to edit a file from the directory of the current buffer +if has("unix") + nmap <Leader>e :e <C-R>=expand("%:p:h") . "/"<CR> +else + nmap <Leader>,e :e <C-R>=expand("%:p:h") . "\\"<CR> +endif + +cabbr <expr> %% expand('%:p:h') + +"When editing a file, make screen display the name of the file you are editing +function! SetTitle() + if $TERM =~ "^screen" + let l:title = 'vi: ' . expand('%:t') + + if (l:title != 'vi: __Tag_List__') + let l:truncTitle = strpart(l:title, 0, 15) + silent exe '!echo -e -n "\033k' . l:truncTitle . '\033\\"' + endif + endif +endfunction + +" Run it every time we change buffers +autocmd BufEnter,BufFilePost * call SetTitle() + +perl <<EOT + # Get the user name, should probably get the home dir... + my $home_dir = (getpwuid($<))[7]; + + if ( -e $home_dir ) { + my $temp_location = "$home_dir/.vim-tmp"; + my $tmp_dir = $temp_location . '/vXXX'; + my $swp_dir = $temp_location . '/swps'; + + # If the location doesn't exist, create it + mkdir $temp_location unless ( -e $temp_location ); + + mkdir $tmp_dir unless ( -e $tmp_dir ); + mkdir $swp_dir unless ( -e $swp_dir ); + + # Set TMPDIR and directory to the new location + VIM::DoCommand("let \$TMPDIR = '" . $tmp_dir . "'") if ( -w $tmp_dir ); + VIM::DoCommand("set directory=" . $swp_dir) if ( -w $swp_dir ); + } +EOT + +" Load host-specific settings +set runtimepath^=~/.host-specific/vim, +set runtimepath+=~/.host-specific/vim/after +source ~/.host-specific/vimrc |