Merge branch 'master' of github.com:hunner/hunners-homedir-configs

This commit is contained in:
Hunter Haugen 2010-05-06 13:39:34 -07:00
commit 11c55d7693
3 changed files with 277 additions and 83 deletions

View file

@ -56,7 +56,7 @@ if has("gui_running")
hi CursorLine guibg=#2e2e37 hi CursorLine guibg=#2e2e37
hi IncSearch gui=BOLD guifg=#303030 guibg=#cd8b60 hi IncSearch gui=BOLD guifg=#303030 guibg=#cd8b60
hi Search gui=NONE guifg=#303030 guibg=#cd8b60 hi Search gui=NONE guifg=#303030 guibg=#ad7b57
hi ErrorMsg gui=BOLD guifg=#ffffff guibg=#ce4e4e hi ErrorMsg gui=BOLD guifg=#ffffff guibg=#ce4e4e
hi WarningMsg gui=BOLD guifg=#ffffff guibg=#ce8e4e hi WarningMsg gui=BOLD guifg=#ffffff guibg=#ce8e4e
hi ModeMsg gui=BOLD guifg=#7e7eae guibg=NONE hi ModeMsg gui=BOLD guifg=#7e7eae guibg=NONE
@ -148,7 +148,7 @@ else
endif endif
exec "hi IncSearch cterm=BOLD ctermfg=" . <SID>X(80) . " ctermbg=" . <SID>X(73) exec "hi IncSearch cterm=BOLD ctermfg=" . <SID>X(80) . " ctermbg=" . <SID>X(73)
exec "hi Search cterm=NONE ctermfg=" . <SID>X(80) . " ctermbg=" . <SID>X(73) exec "hi Search cterm=NONE ctermfg=" . <SID>X(80) . " ctermbg=" . <SID>X(52)
exec "hi ErrorMsg cterm=BOLD ctermfg=" . <SID>X(16) . " ctermbg=" . <SID>X(48) exec "hi ErrorMsg cterm=BOLD ctermfg=" . <SID>X(16) . " ctermbg=" . <SID>X(48)
exec "hi WarningMsg cterm=BOLD ctermfg=" . <SID>X(16) . " ctermbg=" . <SID>X(68) exec "hi WarningMsg cterm=BOLD ctermfg=" . <SID>X(16) . " ctermbg=" . <SID>X(68)
exec "hi ModeMsg cterm=BOLD ctermfg=" . <SID>X(38) . " ctermbg=" . "NONE" exec "hi ModeMsg cterm=BOLD ctermfg=" . <SID>X(38) . " ctermbg=" . "NONE"

330
.vimrc
View file

@ -1,17 +1,19 @@
scriptencoding utf-8
"----------------------------------------------------------------------- "-----------------------------------------------------------------------
"BaSS vimrc based con ciaran "Hunner's vimrc based on BaSS & ciaran
"----------------------------------------------------------------------- "-----------------------------------------------------------------------
"----------------------------------------------------------------------- "-----------------------------------------------------------------------
" terminal setup " terminal setup
"----------------------------------------------------------------------- "-----------------------------------------------------------------------
" Extra terminal things " Want utf8 at all times
set termencoding=utf-8 set termencoding=utf-8
set encoding=utf-8 set encoding=utf-8
set fenc=utf-8 set fenc=utf-8
" change cursor colour depending upon mode
if exists('&t_SI') if exists('&t_SI')
let &t_SI = "\<Esc>]12;lightgoldenrod\x7" let &t_SI = "\<Esc>]12;lightgoldenrod\x7"
let &t_EI = "\<Esc>]12;green\x7" let &t_EI = "\<Esc>]12;green\x7"
@ -40,8 +42,7 @@ set shortmess=a
" Make backspace delete lots of things " Make backspace delete lots of things
set backspace=indent,eol,start set backspace=indent,eol,start
" Create backups " Don't create backups
"set backup
set nobackup set nobackup
" Show us the command we're typing " Show us the command we're typing
@ -54,7 +55,7 @@ set showmatch
set hlsearch set hlsearch
set incsearch set incsearch
" Selective case insensitivity " Case insensitivity
set ignorecase set ignorecase
set infercase set infercase
@ -81,8 +82,8 @@ set whichwrap+=<,>,[,]
" Use the cool tab complete menu " Use the cool tab complete menu
set wildmenu set wildmenu
set wildignore+=*.o,*~ set wildignore+=*.o,*~,.lo
set suffixes+=.in,.a set suffixes+=.in,.a,.1
" Allow edit buffers to be hidden " Allow edit buffers to be hidden
set hidden set hidden
@ -95,6 +96,9 @@ if has("syntax")
syntax on syntax on
endif endif
" enable virtual edit in vblock mode, and one past the end
set virtualedit=block,onemore
" Set our fonts " Set our fonts
if has("gui_kde") if has("gui_kde")
set guifont=Terminus/12/-1/5/50/0/0/0/0/0 set guifont=Terminus/12/-1/5/50/0/0/0/0/0
@ -128,7 +132,7 @@ set background=dark
" set guioptions-=R " set guioptions-=R
"end "end
" By default, go for an indent of 4 tab stuff " By default, go for an indent of 4 and use spaces
set expandtab set expandtab
set shiftwidth=4 set shiftwidth=4
set tabstop=4 set tabstop=4
@ -142,6 +146,7 @@ inoremap # X<BS>#
if has("folding") if has("folding")
set foldenable set foldenable
set foldmethod=marker set foldmethod=marker
"set foldlevelstart=99
endif endif
" Syntax when printing " Syntax when printing
@ -166,6 +171,22 @@ set laststatus=2
set statusline= set statusline=
set statusline+=%2*%-3.3n%0*\ " buffer number set statusline+=%2*%-3.3n%0*\ " buffer number
set statusline+=%f\ " file name set statusline+=%f\ " file name
if has("eval")
let g:scm_cache = {}
fun! ScmInfo()
let l:key = getcwd()
if ! has_key(g:scm_cache, l:key)
if (isdirectory(getcwd() . "/.git"))
let g:scm_cache[l:key] = "[" . substitute(readfile(getcwd() . "/.git/HEAD", "", 1)[0],
\ "^.*/", "", "") . "] "
else
let g:scm_cache[l:key] = ""
endif
endif
return g:scm_cache[l:key]
endfun
set statusline+=%{ScmInfo()} " scm info
endif
set statusline+=%h%1*%m%r%w%0* " flags set statusline+=%h%1*%m%r%w%0* " flags
set statusline+=\[%{strlen(&ft)?&ft:'none'}, " filetype set statusline+=\[%{strlen(&ft)?&ft:'none'}, " filetype
set statusline+=%{&encoding}, " encoding set statusline+=%{&encoding}, " encoding
@ -206,6 +227,7 @@ if has('title') && (has('gui_running') || &title)
set titlestring+=%f\ " file name set titlestring+=%f\ " file name
set titlestring+=%h%m%r%w " flags set titlestring+=%h%m%r%w " flags
set titlestring+=\ -\ %{v:progname} " program name set titlestring+=\ -\ %{v:progname} " program name
set titlestring+=\ -\ %{substitute(getcwd(),\ $HOME,\ '~',\ '')} " working directory
endif endif
" If possible, try to use a narrow number column. " If possible, try to use a narrow number column.
@ -223,6 +245,7 @@ endif
" Better include path " Better include path
set path+=src/ set path+=src/
let &inc.=' ["<]'
" Show tabs and trailing whitespace visually " Show tabs and trailing whitespace visually
if (&termencoding == "utf-8") || has("gui_running") if (&termencoding == "utf-8") || has("gui_running")
@ -238,7 +261,7 @@ else
set list listchars=tab:>-,trail:.,extends:> set list listchars=tab:>-,trail:.,extends:>
endif endif
endif endif
map <F9> :set nolist listchars<CR> map <silent> <F9> :set nolist listchars<CR>:set noet<CR>:set sw=8<CR>:set ts=8<CR>
" Show lines longer than 80 characters " Show lines longer than 80 characters
"au BufWinEnter * let w:m1=matchadd('Search', '\%<81v.\%>77v', -1) "au BufWinEnter * let w:m1=matchadd('Search', '\%<81v.\%>77v', -1)
@ -270,7 +293,7 @@ if has("eval")
" If we're in a wide window, enable line numbers. " If we're in a wide window, enable line numbers.
fun! <SID>WindowWidth() fun! <SID>WindowWidth()
if winwidth(0) > 90 if winwidth(0) > 90
setlocal foldcolumn=1 setlocal foldcolumn=2
setlocal number setlocal number
else else
setlocal nonumber setlocal nonumber
@ -285,9 +308,13 @@ if has("autocmd")
autocmd BufRead,BufNewFile *.txt autocmd BufRead,BufNewFile *.txt
\ set nonumber tw=80 \ set nonumber tw=80
augroup END augroup END
augroup content augroup helphelp
autocmd! " For help files, move them to the top window and make <Return>
" behave like <C-]> (jump to tag)
autocmd FileType help :call <SID>WindowToTop()
autocmd FileType help nmap <buffer> <Return> <C-]>
augroup END
augroup interplangs
autocmd BufNewFile *.rb 0put ='# vim: set sw=2 sts=2 et tw=80 :' | autocmd BufNewFile *.rb 0put ='# vim: set sw=2 sts=2 et tw=80 :' |
\ 0put ='#!/usr/bin/env ruby' | set sw=2 sts=2 et tw=80 | \ 0put ='#!/usr/bin/env ruby' | set sw=2 sts=2 et tw=80 |
\ norm G \ norm G
@ -298,7 +325,8 @@ if has("autocmd")
autocmd BufNewFile,BufRead *.php autocmd BufNewFile,BufRead *.php
\ set ai \ set ai
augroup END
augroup html
autocmd BufNewFile *.htm,*.html autocmd BufNewFile *.htm,*.html
\ 0put ='<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">' | \ 0put ='<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">' |
\ $put ='<html xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">' | \ $put ='<html xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">' |
@ -314,12 +342,18 @@ if has("autocmd")
\ $put ='</html>' | \ $put ='</html>' |
\ $put ='<!-- vim: set sw=2 sts=2 et tw=80 : -->' | \ $put ='<!-- vim: set sw=2 sts=2 et tw=80 : -->' |
\ set sw=2 sts=2 et tw=80 | norm G \ set sw=2 sts=2 et tw=80 | norm G
augroup END
augroup autotools
autocmd BufNewFile *.hh 0put ='/* vim: set sw=4 sts=4 et foldmethod=syntax : */' | autocmd BufNewFile *.hh 0put ='/* vim: set sw=4 sts=4 et foldmethod=syntax : */' |
\ 1put ='' | call MakeIncludeGuards() | \ 1put ='' | call MakeIncludeGuards() |
\ 5put ='#include \"config.h\"' | \ 5put ='#include \"config.h\"' |
\ set sw=4 sts=4 et tw=80 | norm G \ set sw=4 sts=4 et tw=80 | norm G
autocmd BufNewFile *.c 0put ='/* vim: set sw=4 sts=4 et foldmethod=syntax : */' |
\ 1put ='' | 2put ='' | call setline(3, '#include "' .
\ substitute(expand("%:t"), ".c$", ".h", "") . '"') |
\ set sw=4 sts=4 et tw=80 | norm G
autocmd BufNewFile *.cc 0put ='/* vim: set sw=4 sts=4 et foldmethod=syntax : */' | autocmd BufNewFile *.cc 0put ='/* vim: set sw=4 sts=4 et foldmethod=syntax : */' |
\ 1put ='' | 2put ='' | call setline(3, '#include "' . \ 1put ='' | 2put ='' | call setline(3, '#include "' .
\ substitute(expand("%:t"), ".cc$", ".hh", "") . '"') | \ substitute(expand("%:t"), ".cc$", ".hh", "") . '"') |
@ -329,25 +363,26 @@ if has("autocmd")
\ 0put ='dnl vim: set sw=8 sts=8 noet :' | \ 0put ='dnl vim: set sw=8 sts=8 noet :' |
\ $put ='' | \ $put ='' |
\ call setline(line('$'), 'AC_INIT([' . substitute(expand('%:p:h'), \ call setline(line('$'), 'AC_INIT([' . substitute(expand('%:p:h'),
\ '^.\{-}/\([^/]\+\)\(/trunk\)\?$', '\1', '') . '], [0.0])') | \ '^.\{-}/\([^/]\+\)\(/trunk\)\?$', '\1', '') . '], [0.1], [h.haugen@gmail.com])') |
\ $put ='AC_PREREQ(2.5)' | \ $put ='AC_PREREQ(2.63)' |
\ $put ='AC_CONFIG_SRCDIR([])' | \ $put ='AC_CONFIG_SRCDIR([])' |
\ $put ='AC_CONFIG_AUX_DIR(config)' | \ $put ='AC_CONFIG_AUX_DIR(config)' |
\ $put ='AM_INIT_AUTOMAKE(1.9)' | \ $put ='AM_INIT_AUTOMAKE([foreign -Wall -Werror 1.10])' |
\ $put ='' | \ $put ='' |
\ $put ='dnl check for required programs' | \ $put ='dnl check for required programs' |
\ $put ='AC_PROG_CXX' | \ $put ='AC_PROG_CC dnl CXX' |
\ $put ='AC_PROG_INSTALL' | \ $put ='AC_PROG_INSTALL' |
\ $put ='AC_PROG_LN_S' | \ $put ='AC_PROG_LN_S' |
\ $put ='AC_PROG_RANLIB' | \ $put ='AC_PROG_RANLIB' |
\ $put ='AC_PROG_MAKE_SET' | \ $put ='AC_PROG_MAKE_SET' |
\ $put ='' | \ $put ='' |
\ $put ='dnl output' | \ $put ='dnl output' |
\ $put ='AM_CONFIG_HEADER(config.h)' | \ $put ='AC_CONFIG_HEADERS([config.h])' |
\ $put ='AC_OUTPUT(' | \ $put ='AC_CONFIG_FILES([' |
\ $put =' Makefile' | \ $put =' Makefile' |
\ $put =' src/Makefile' | \ $put =' src/Makefile' |
\ $put =' )' | \ $put ='])' |
\ $put ='AC_OUTPUT' |
\ set sw=8 sts=8 noet | \ set sw=8 sts=8 noet |
\ norm ggjjjjf] \ norm ggjjjjf]
@ -371,14 +406,15 @@ if has("autocmd")
\ $put ='}' | \ $put ='}' |
\ $put ='' | \ $put ='' |
\ $put ='run mkdir -p config' | \ $put ='run mkdir -p config' |
\ $put ='run $(get libtoolize 1.5 ) --copy --force --automake' | \ $put ='run $(get libtoolize 2.2 ) --copy --force --automake' |
\ $put ='rm -f config.cache' | \ $put ='rm -f config.cache' |
\ $put ='run $(get aclocal 1.9 )' | \ $put ='run $(get aclocal 1.10 )' |
\ $put ='run $(get autoheader 2.59 )' | \ $put ='run $(get autoheader 2.63 )' |
\ $put ='run $(get autoconf 2.59 )' | \ $put ='run $(get autoconf 2.63 )' |
\ $put ='run $(get automake 1.9 ) -a --copy' | \ $put ='run $(get automake 1.10 ) -a --copy' |
\ set sw=4 sts=4 et tw=80 | \ set sw=4 sts=4 et tw=80 |
\ norm gg=Ggg \ norm gg=Ggg
autocmd BufWritePost autogen.bash !chmod 744 %
autocmd BufNewFile Makefile.am autocmd BufNewFile Makefile.am
\ 0put ='CLEANFILES = *~' | \ 0put ='CLEANFILES = *~' |
@ -386,20 +422,94 @@ if has("autocmd")
\ $put ='MAINTAINERCLEANFILES = Makefile.in configure config/* aclocal.m4 \' | \ $put ='MAINTAINERCLEANFILES = Makefile.in configure config/* aclocal.m4 \' |
\ $put ='' | \ $put ='' |
\ call setline(line('$'), "\t\t\tconfig.h config.h.in") | \ call setline(line('$'), "\t\t\tconfig.h config.h.in") |
\ $put ='SUBDIRS = src' |
\ $put ='AUTOMAKE_OPTIONS = foreign dist-bzip2' | \ $put ='AUTOMAKE_OPTIONS = foreign dist-bzip2' |
\ $put ='EXTRA_DIST = autogen.bash' | \ $put ='EXTRA_DIST = autogen.bash' |
\ $put ='' |
\ $put ='maintainer-clean-local:' |
\ $put =' -rmdir config' |
\ else | \ else |
\ $put ='MAINTAINERCLEANFILES = Makefile.in' | \ $put ='MAINTAINERCLEANFILES = Makefile.in' |
\ $put ='bin_PROGRAMS = ' . substitute(expand('%:p:h'),'^.\{-}/\([^/]\+\)\(/src\)\?$', '\1', '') |
\ $put = substitute(expand('%:p:h'), '^.\{-}/\([^/]\+\)\(/src\)\?$','\1', '') . '_SOURCES = main.c' |
\ endif \ endif
augroup END augroup END
augroup making
try
" if we have a vim which supports QuickFixCmdPost (vim7),
" give us an error window after running make, grep etc, but
" only if results are available.
autocmd QuickFixCmdPost * botright cwindow 5
autocmd QuickFixCmdPre make
\ let g:make_start_time=localtime()
let g:paludis_configure_command = "! ./configure --prefix=/usr --sysconfdir=/etc" .
\ " --localstatedir=/var/lib --enable-qa " .
\ " --enable-ruby --enable-python --enable-vim --enable-bash-completion" .
\ " --enable-zsh-completion --with-repositories=all --with-clients=all --with-environments=all" .
\ " --enable-visibility --enable-gnu-ldconfig --enable-htmltidy" .
\ " --enable-ruby-doc --enable-python-doc --enable-xml"
" Similarly, try to automatically run ./configure and / or
" autogen if necessary.
autocmd QuickFixCmdPre make
\ if ! filereadable('Makefile') |
\ if ! filereadable("configure") |
\ if filereadable("autogen.bash") |
\ exec "! ./autogen.bash" |
\ elseif filereadable("quagify.sh") |
\ exec "! ./quagify.sh" |
\ endif |
\ endif |
\ if filereadable("configure") |
\ if (isdirectory(getcwd() . "/paludis/util")) |
\ exec g:paludis_configure_command |
\ elseif (match(getcwd(), "libwrapiter") >= 0) |
\ exec "! ./configure --prefix=/usr --sysconfdir=/etc" |
\ else |
\ exec "! ./configure" |
\ endif |
\ endif |
\ endif
autocmd QuickFixCmdPost make
\ let g:make_total_time=localtime() - g:make_start_time |
\ echo printf("Time taken: %dm%2.2ds", g:make_total_time / 60,
\ g:make_total_time % 60)
autocmd QuickFixCmdPre *
\ let g:old_titlestring=&titlestring |
\ let &titlestring="[ " . expand("<amatch>") . " ] " . &titlestring |
\ redraw
autocmd QuickFixCmdPost *
\ let &titlestring=g:old_titlestring
if hostname() == "snowmobile"
autocmd QuickFixCmdPre make
\ let g:active_line=getpid() . " vim:" . substitute(getcwd(), "^.*/", "", "") |
\ exec "silent !echo '" . g:active_line . "' >> ~/.config/awesome/active"
autocmd QuickFixCmdPost make
\ exec "silent !sed -i -e '/^" . getpid() . " /d' ~/.config/awesome/active"
endif
catch
endtry
augroup END
endif endif
"----------------------------------------------------------------------- "-----------------------------------------------------------------------
" mappings " mappings
"----------------------------------------------------------------------- "-----------------------------------------------------------------------
" Go to buffers
nmap <silent> <S-Left> :bprev<CR>
nmap <silent> <S-Right> :bnext<CR> nmap <silent> <S-Right> :bnext<CR>
nmap <C-w>, :bp<CR>
nmap <C-w>. :bn<CR>
" v_K is really really annoying " v_K is really really annoying
vmap K k vmap K k
@ -414,6 +524,8 @@ endif
nmap <Leader>cwc :cclose<CR> nmap <Leader>cwc :cclose<CR>
nmap <Leader>cwo :botright copen 5<CR><C-w>p nmap <Leader>cwo :botright copen 5<CR><C-w>p
nmap <Leader>cn :cnext<CR> nmap <Leader>cn :cnext<CR>
nmap - :cnext<CR>
nmap <Leader>cp :cprevious<CR>
" Annoying default mappings " Annoying default mappings
inoremap <S-Up> <C-o>gk inoremap <S-Up> <C-o>gk
@ -421,11 +533,21 @@ inoremap <S-Down> <C-o>gj
noremap <S-Up> gk noremap <S-Up> gk
noremap <S-Down> gj noremap <S-Down> gj
" Better Bépo movement
noremap © h
noremap þ j
noremap ß k
noremap ® l
" Make <space> in normal mode go down a page rather than left a " Make <space> in normal mode go down a page rather than left a
" character " character, and backspace the opposite
noremap <space> <C-f> noremap <space> <C-f>
noremap <backspace> <C-b> noremap <backspace> <C-b>
" Scrolling with arrows controls the window
noremap <Up> <C-y>
noremap <Down> <C-e>
" Useful things from inside imode " Useful things from inside imode
inoremap <C-z>w <C-o>:w<CR> inoremap <C-z>w <C-o>:w<CR>
inoremap <C-z>q <C-o>gq}<C-o>k<C-o>$ inoremap <C-z>q <C-o>gq}<C-o>k<C-o>$
@ -435,10 +557,14 @@ inoremap <C-z>q <C-o>gq}<C-o>k<C-o>$
"imap <silent> <F3> <C-o>:silent nohlsearch<CR> "imap <silent> <F3> <C-o>:silent nohlsearch<CR>
"nmap <F4> :Kwbd<CR> "nmap <F4> :Kwbd<CR>
"nmap <F5> <C-w>c "nmap <F5> <C-w>c
"nmap <F7> :make check<CR> "nmap <F6> :exec "make check TESTS_ENVIRONMENT=true LOG_COMPILER=true XFAIL_TESTS="<CR>
"nmap <F8> :make<CR> "nmap <Leader><F6> :exec "make -C " . expand("%:p:h") . " check TESTS_ENVIRONMENT=true LOG_COMPILER=true XFAIL_TESTS="<CR>
"nmap <F10> :!svn update<CR> nmap <F7> :make all-then-check<CR>
"nmap <F11> :!svn status \| grep -v '^?' \| sort -k2<CR> nmap <Leader><F7> :exec "make -C " . expand("%:p:h") . " check"<CR>
nmap <F8> :make<CR>
nmap <Leader><F8> :exec "make -C " . expand("%:p:h")<CR>
"nmap <F9> :exec "make -C " . expand("%:p:h") . " check SUBDIRS= check_PROGRAMS=" . GetCurrentTest()
" \ . " TESTS=" . GetCurrentTest() <CR>
" Insert a single char " Insert a single char
noremap <Leader>i i<Space><Esc>r noremap <Leader>i i<Space><Esc>r
@ -474,6 +600,9 @@ noremap <Leader>dbl :g/^$/d<CR>:nohls<CR>
noremap <Leader>enc :<C-w>execute noremap <Leader>enc :<C-w>execute
\ substitute(":'<,'>s/^.*/#&#/ \| :nohls", "#", input(">"), "g")<CR> \ substitute(":'<,'>s/^.*/#&#/ \| :nohls", "#", input(">"), "g")<CR>
" Edit something in the current directory
noremap <Leader>ed :e <C-r>=expand("%:p:h")<CR>/<C-d>
" Enable fancy % matching " Enable fancy % matching
if has("eval") if has("eval")
runtime! macros/matchit.vim runtime! macros/matchit.vim
@ -488,28 +617,98 @@ if has("digraphs")
endif endif
if has("eval") if has("eval")
" GNU format changelog entry " Work out include guard text
fun! MakeChangeLogEntry() fun! IncludeGuardText()
norm gg let l:p = substitute(substitute(getcwd(), "/trunk", "", ""), '^.*/', "", "")
/^\d let l:t = substitute(expand("%"), "[./]", "_", "g")
norm 2O return substitute(toupper(l:p . "_GUARD_" . l:t), "-", "_", "g")
norm k
call setline(line("."), strftime("%Y-%m-%d") .
\ " J. Alberto Suárez López <bass@gentoo.org>")
norm 2o
call setline(line("."), "\t* ")
norm $
endfun endfun
noremap <Leader>cl :call MakeChangeLogEntry()<CR>
" command aliases, can't call these until after cmdalias.vim is loaded " Make include guards
au VimEnter * if exists("loaded_cmdalias") | fun! MakeIncludeGuards()
\ call CmdAlias("mkdir", "!mkdir") | norm gg
\ call CmdAlias("cvs", "!cvs") | /^$/
\ call CmdAlias("svn", "!svn") | norm 2O
\ call CmdAlias("commit", "!svn commit -m \"") | call setline(line("."), "#ifndef " . IncludeGuardText())
\ call CmdAlias("upload", "make upload") | norm o
\ endif call setline(line("."), "#define " . IncludeGuardText() . " 1")
norm G
norm o
call setline(line("."), "#endif")
endfun
noremap <Leader>ig :call MakeIncludeGuards()<CR>
endif
" fast buffer switching
if v:version >= 700 && has("eval")
let g:switch_header_map = {
\ 'cc': 'hh',
\ 'hh': 'cc',
\ 'c': 'h',
\ 'h': 'c',
\ 'cpp': 'hpp',
\ 'hpp': 'cpp' }
fun! SwitchTo(f, split) abort
if ! filereadable(a:f)
echoerr "File '" . a:f . "' does not exist"
else
if a:split
new
endif
if 0 != bufexists(a:f)
exec ':buffer ' . bufnr(a:f)
else
exec ':edit ' . a:f
endif
endif
endfun
fun! SwitchHeader(split) abort
let filename = expand("%:p:r")
let suffix = expand("%:p:e")
if suffix == ''
echoerr "Cannot determine header file (no suffix)"
return
endif
let new_suffix = g:switch_header_map[suffix]
if new_suffix == ''
echoerr "Don't know how to find the header (suffix is " . suffix . ")"
return
end
call SwitchTo(filename . '.' . new_suffix, a:split)
endfun
fun! SwitchTest(split) abort
let filename = expand("%:p:r")
let suffix = expand("%:p:e")
if -1 != match(filename, '_TEST$')
let new_filename = substitute(filename, '_TEST$', '.' . suffix, '')
else
let new_filename = filename . '_TEST.' . suffix
end
call SwitchTo(new_filename, a:split)
endfun
fun! SwitchMakefile(split) abort
let dirname = expand("%:p:h")
if filereadable(dirname . "/Makefile.am.m4")
call SwitchTo(dirname . "/Makefile.am.m4", a:split)
elseif filereadable(dirname . "/Makefile.am")
call SwitchTo(dirname . "/Makefile.am", a:split)
else
call SwitchTo(dirname . "/Makefile", a:split)
endif
endfun
noremap <Leader>sh :call SwitchHeader(0)<CR>
noremap <Leader>st :call SwitchTest(0)<CR>
noremap <Leader>sk :call SwitchMakefile(0)<CR>
noremap <Leader>ssh :call SwitchHeader(1)<CR>
noremap <Leader>sst :call SwitchTest(1)<CR>
noremap <Leader>ssk :call SwitchMakefile(1)<CR>
endif endif
" super i_c-y / i_c-e " super i_c-y / i_c-e
@ -615,6 +814,7 @@ if has("eval") && has("autocmd")
autocmd FileType cpp :call <SID>abbrev_cpp() autocmd FileType cpp :call <SID>abbrev_cpp()
augroup END augroup END
endif endif
" NB: Need more of these for more than cpp
"----------------------------------------------------------------------- "-----------------------------------------------------------------------
" special less.sh and man modes " special less.sh and man modes
@ -659,12 +859,6 @@ if has("eval")
let ruby_operators=1 let ruby_operators=1
let ruby_space_errors=1 let ruby_space_errors=1
" clojure options
let g:clj_want_gorilla = 1
let g:clj_highlight_builtins = 1
let g:clj_highlight_contrib = 1
let g:clj_paren_rainbow = 1
" php specific options " php specific options
let php_sql_query=1 let php_sql_query=1
let php_htmlInStrings=1 let php_htmlInStrings=1
@ -677,6 +871,7 @@ if has("eval")
let Tlist_WinWidth=28 let Tlist_WinWidth=28
let Tlist_Exit_OnlyWindow=1 let Tlist_Exit_OnlyWindow=1
let Tlist_File_Fold_Auto_Close=1 let Tlist_File_Fold_Auto_Close=1
let Tlist_Inc_Winwidth=0
"nnoremap <silent> <F9> :Tlist<CR> "nnoremap <silent> <F9> :Tlist<CR>
" Settings minibufexpl.vim " Settings minibufexpl.vim
@ -750,7 +945,7 @@ endif
" final commands " final commands
"----------------------------------------------------------------------- "-----------------------------------------------------------------------
" mio " mio
let Tlist_Ctags_Cmd="/usr/bin/exuberant-ctags" "let Tlist_Ctags_Cmd="/usr/bin/exuberant-ctags"
" plegado ident para python " plegado ident para python
au FileType python set foldmethod=indent au FileType python set foldmethod=indent
" plegado syntax para sgml,htmls,xml y xsl " plegado syntax para sgml,htmls,xml y xsl
@ -781,11 +976,11 @@ map <S-F4> :set nu!<CR>
map <F5> ggVGg? map <F5> ggVGg?
map <F6> :set encoding=utf-8<CR> | :set fenc=utf-8<CR> map <F6> :set encoding=utf-8<CR> | :set fenc=utf-8<CR>
map <S-F6> :set encoding=iso8859-15<CR> | :set fenc=iso8859-15<CR> map <S-F6> :set encoding=iso8859-15<CR> | :set fenc=iso8859-15<CR>
map <F7> :SpellProposeAlternatives<CR> "map <F7> :SpellProposeAlternatives<CR>
map <S-F7> :SpellCheck<CR> "map <S-F7> :SpellCheck<CR>
map <C-F7> :let spell_language_list = "english,spanish" "map <C-F7> :let spell_language_list = "english,spanish"
nnoremap <silent> <F8> :Tlist<CR> "nnoremap <silent> <F8> :Tlist<CR>
nnoremap <silent> <S-F8> :TlistSync<CR> "nnoremap <silent> <S-F8> :TlistSync<CR>
nnoremap <esc> :noh<return><esc> nnoremap <esc> :noh<return><esc>
map <F11> !!date<CR> map <F11> !!date<CR>
map <F12> :TC<CR> map <F12> :TC<CR>
@ -799,9 +994,8 @@ inoremap <F12> <C-o>:syntax sync fromstart<CR>
syntax sync minlines=200 syntax sync minlines=200
" Javac " Javac
set makeprg=javac\ % "set makeprg=javac\ %
set errorformat=%A%f:%l:\ %m,%-Z%p^,%-C%.%# "set errorformat=%A%f:%l:\ %m,%-Z%p^,%-C%.%#
map <F8> :make<CR>
" CVS " CVS
nmap <leader>cadd <Plug>CVSAdd nmap <leader>cadd <Plug>CVSAdd

View file

@ -68,14 +68,14 @@ mKeys = [ ("M-S-n", sendMessage MirrorShrink ) -- Expand current window
, ("M-S-g", warpToCentre >> goToSelected gsConfig ) , ("M-S-g", warpToCentre >> goToSelected gsConfig )
-- Multimedia -- Multimedia
, ("<XF86AudioPlay>" , spawn "mpc toggle" ) -- play/pause mpd , ("<XF86AudioPlay>" , spawn "cmus-remote --pause" ) -- play/pause mpd
, ("<XF86AudioStop>" , spawn "mpc stop" ) -- stop mpd , ("<XF86AudioStop>" , spawn "cmus-remote --stop" ) -- stop mpd
, ("<XF86AudioPrev>" , spawn "mpc prev" ) -- prev song , ("<XF86AudioPrev>" , spawn "cmus-remote --prev" ) -- prev song
, ("<XF86AudioNext>" , spawn "mpc next" ) -- next song , ("<XF86AudioNext>" , spawn "cmus-remote --next" ) -- next song
, ("<XF86AudioLowerVolume>", spawn "mpc volume -3" ) -- volume down , ("<XF86AudioLowerVolume>", spawn "amixer -q set PCM 1-") -- volume down
, ("<XF86AudioRaiseVolume>", spawn "mpc volume +3" ) -- volume up , ("<XF86AudioRaiseVolume>", spawn "amixer -q set PCM 1+") -- volume up
, ("<XF86AudioMute>" , spawn "amixer -q -- sset Headphone togglemute") -- toggle mute , ("<XF86AudioMute>" , spawn "amixer -q set Headphone toggle") -- toggle mute
, ("M-<XF86AudioMute>" , spawn "amixer -q -- sset Speaker togglemute") , ("M-<XF86AudioMute>" , spawn "amixer -q set Speaker toggle")
-- Dynamic workspace commands -- Dynamic workspace commands
, ("M-S-<Backspace>" , removeWorkspace) , ("M-S-<Backspace>" , removeWorkspace)