Skip to content

Instantly share code, notes, and snippets.

@laiso
Created September 1, 2009 09:04
Show Gist options
  • Save laiso/178995 to your computer and use it in GitHub Desktop.
Save laiso/178995 to your computer and use it in GitHub Desktop.
if filereadable( $HOME . "/.vimrc.before" )
source ~/.vimrc.before
endif
"" 256colors
"set t_Co=256
if &t_Co == 256
colorscheme xoria256
endif
" Basic setup
set viminfo+=!
let mapleader = ","
set ffs=unix,dos,mac
set nocompatible
set enc=utf-8
set fencs=utf-8,iso-2022-jp,euc-jp,cp932
set ambiwidth=double
set number
set hidden
set ignorecase
set smartcase
set wrapscan
set incsearch
set hlsearch
" indent
set autoindent
set cindent
set smartindent
set softtabstop=4
set tabstop=4
set shiftwidth=4
set expandtab
set noruler
set showmatch
set list
set listchars=tab:>-,trail:-,nbsp:%
set wrap
set title
set showcmd
set cmdheight=2
"" Status line
set laststatus=2
set statusline=%<%f\ %m%r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}
"" Complete
set wildmenu
set wildchar=<tab>
set wildmode=list:full
set complete+=k
set backspace=eol,indent,start
set scrolloff=5
set formatoptions+=mM
let format_join_spaces = 4
let format_allow_over_tw = 1
set autoread
"" swqpfile
set swapfile
set directory=$HOME/tmp/vim-swap
"" backup
"set nobackup
set backupcopy=yes
set backupdir=$HOME/tmp/vim-backup
set history=1000
set mouse=a
"set migemo
set iminsert=0
set imdisable
set iminsert=1
set imsearch=1
"" tab
set tabpagemax=1
set showtabline=1
let g:netrw_alto=1
let loaded_matchparen=1
syntax on
"" tags
nnoremap [Tag] <Nop>
nmap t [Tag]
nnoremap <silent>[Tag]t <C-]>
nnoremap <silent>[Tag]p :pop<CR>
"nnoremap [Tag]b <C-t>
nnoremap <silent>[Tag]l :tags<CR>
set tags=/.tags
set tags+=.tags;
set tags+=./**/.tags
" vimgrep
set grepprg=ack\ -a
if has("autocmd")
autocmd QuickfixCmdPost grep cw
endif
hi Search term=reverse ctermbg=DarkBlue ctermfg=NONE
"""""""""""""""""" Filetype """""""""""""""""""""""""""""""""""""""
filetype on
filetype indent on
filetype plugin on
"" bash
let is_bash=1
"" zip archive
au BufReadCmd *.jar,*.xpi call zip#Browse(expand("<amatch>"))
"" syntaxcomplete
if has("autocmd") && exists("+omnifunc")
autocmd Filetype *
\ if &omnifunc == "" |
\ setlocal omnifunc=syntaxcomplete#Complete |
\ endif
endif
"""""""""""" Mapping """"""""""""""""""""""""""""""""""""""""
noremap ; :
noremap : ;
noremap ,s :<C-u>source $MYVIMRC<CR>
noremap ,. :<C-u>edit $MYVIMRC<CR>
"inoremap <C-g> <Esc>
inoremap <C-m> <CR>
inoremap <expr><C-h> pumvisible() ? "\<C-y>\<C-h>" : "\<C-h>"
" Buffer
map <silent> <C-p> :bnext<CR>
map <silent> <C-n> :bprevious<CR>
noremap j gjzz
noremap k gkzz
" search
nmap n nzz
"nmap i izz
nmap # #zz
nmap g* g*zz
nmap g# g#zz
""""""""""""""""""""""""
" Plugin
""""""""""""""""""""""""
"" srcexpl.vim
let g:SrcExpl_GoBackMapKey = "<C-b>"
let g:SrcExpl_UpdateTags = 1
"" NERD_tree
noremap ,e :NERDTreeToggle<CR>
"" BufferList
noremap <silent> ,b :call BufferList()<CR>
let g:BufferListWidth = 50
let g:BufferListMaxWidth = 100
"" closetag
"" let g:closetag_html_style=1
"" au Filetype html,xml,xsl,ant source $HOME/.vim/macros/closetag.vim
" fuzzyfinder.vim
if !exists('g:FuzzyFinderOptions')
let g:FuzzyFinderOptions = { 'Base':{}, 'Buffer':{}, 'File':{}, 'Dir':{}, 'MruFile':{}, 'MruCmd':{}, 'Bookmark':{}, 'Tag':{}, 'TaggedFile':{}}
let g:FuzzyFinderOptions.Base.ignore_case = 1
let g:FuzzyFinderOptions.Base.key_open_vsplit = '<C-v>'
let g:FuzzyFinderOptions.File.excluded_path = '\v\.svn|\~$|\.o$|\.exe$|\.bak$|\.swp$|((^|[/\\])\.[/\\]$)'
let g:FuzzyFinderOptions.Dir.excluded_path = '\v\.svn|((^|[/\\])\.{1,2}[/\\]$)'
end
nnoremap <silent> .b :FuzzyFinderBuffer<CR>
nnoremap <silent> .f :FuzzyFinderFile<CR>
nnoremap <silent> .r :FuzzyFinderMruFile<CR>
nnoremap <silent> .c :FuzzyFinderMruCmd<CR>
nnoremap <silent> .d :FuzzyFinderDir<CR>
nnoremap <silent> .A :FuzzyFinderAddBookmark<CR>
"" neocompcache
let g:NeoComplCache_EnableAtStartup = 1
let g:NeoComplCache_MinKeywordLength = 3
let g:NeoComplCache_MinSyntaxLength = 3
let g:NeoComplCache_PartialMatch=0
let g:NeoComplCache_AlphabeticalOrder = 0
let g:NeoComplCache_SmartCase = 1
let g:NeoComplCache_TagsAutoUpdate = 1
let g:NeoComplCache_TryFilenameCompletion =1
inoremap <expr><C-y> pumvisible() ? neocomplcache#close_popup() : "\<C-y>"
inoremap <expr><C-e> pumvisible() ? neocomplcache#cancel_popup() : "\<C-e>"
let g:NeoComplCache_DictionaryFileTypeLists = {
\ 'default' : '',
\ 'javascript' : $HOME.'/.vim/dict/js.dict',
\ 'objc' : $HOME.'/.vim/dict/objc.dict',
\ 'php' : $HOME.'/.vim/dict/php.dict',
\ 'perl' : $HOME.'/.vim/dict/perl.dict',
\ }
" \ 'type' : $HOME.'/.vim/dict/type.dict',
"" SyntaxChecker
"noremap ,l :CheckSyntax<cr>
"" vimwiki
"let g:vimwiki_list = [{'path':'~/.vim/vimwiki/', 'path_html':'~/Sites/vimwiki/'}]
"" qfixhowm
set runtimepath+=$HOME/.vim/qfixapp
let QFixHowm_Key = 'g'
let howm_dir = '$HOME/Documents/howm'
let howm_filename = '%Y/%m/%Y-%m-%d-%H%M%S.howm'
let howm_fileencoding = 'utf-8'
let howm_fileformat = 'unix'
let mygrepprg = 'grep'
let MyGrep_ShellEncoding = 'utf-8'
" vimshell
let g:VimShell_EnableInteractive=1
" smartword.vim
map w <Plug>(smartword-w)
map b <Plug>(smartword-b)
map e <Plug>(smartword-e)
map ge <Plug>(smartword-ge)
noremap W w
noremap B b
noremap E e
noremap gE ge
" gist.vim
let g:gist_open_browser_after_post = 1
let g:gist_browser_command = 'w3m %URL%'
" blogger.vim
if filereadable( $HOME . "/dotfiles/.bloggerrc" )
source ~/dotfiles/.bloggerrc
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Misc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" vimで最強のgreasemonkey開発環境を作ってみた - かせいさんとこ
"" http://d.hatena.ne.jp/kasei_san/20090531/p1
" push current_dir
cmap <c-x> <c-r>=expand('%:p:h')<cr>/
" push realpath
cmap <c-z> <c-r>=expand('%:p:r')<cr>
" Vim-users.jp - Hack #62: カーソル下のキーワードをバッファ内全体で置換する
" http://vim-users.jp/2009/08/hack62/
nnoremap <expr> s* ':%substitute/\<' . expand('<cword>') . '\>/'
" tag closing
inoremap </ </<C-x><C-o>
" Vimで強制的にIMをオフにする @Ubuntu - 備忘録 beta
" http://d.hatena.ne.jp/yuta84q/20090205/1233843890
function! ForceImeOff()
let imeoff = system('xvkbd -text "\[Alt]\[space]" > /dev/null 2>&1')
endfunction
inoremap <silent> <esc> <esc>:call ForceImeOff()<cr>
inoremap <silent> <C-g> <esc>:call ForceImeOff()<cr>
inoremap <silent> <C-[> <esc>:call ForceImeOff()<cr>
"" Vim-users.jp - Hack #22: XMLの閉じタグを補完する
"" http://vim-users.jp/2009/06/hack22/
augroup MyXML
autocmd!
autocmd Filetype xml inoremap <buffer> </ </<C-x><C-o>
autocmd Filetype html inoremap <buffer> </ </<C-x><C-o>
augroup END
"" Local settings
if filereadable( $HOME . "/.vimrc.local" )
source ~/.vimrc.local
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment