Skip to content

Instantly share code, notes, and snippets.

@ysawa
Created July 2, 2012 00:32
Show Gist options
  • Select an option

  • Save ysawa/3030191 to your computer and use it in GitHub Desktop.

Select an option

Save ysawa/3030191 to your computer and use it in GitHub Desktop.
my .vimrc 2012/07/02
syntax on
set number
set nocompatible
set nosmartcase
set expandtab
set ts=2 st=2 sts=2
set shiftwidth=2
set cursorline
" カーソル行をハイライト
set cursorline
" カレントウィンドウにのみ罫線を引く
augroup cch
autocmd! cch
autocmd WinLeave * set nocursorline
autocmd WinEnter,BufRead * set cursorline
augroup END
:hi clear CursorLine
:hi CursorLine gui=underline
highlight CursorLine ctermbg=black guibg=black
nmap <ESC><ESC> :nohlsearch<CR><ESC>
" 保存時に行末の空白を除去する
autocmd BufWritePre * :%s/\s\+$//ge
" 保存時にtabをスペースに変換する
autocmd BufWritePre * :%s/\t/ /ge
" CTRL-hjklでウィンドウ移動
nnoremap <C-j> ;<C-w>j
nnoremap <C-k> ;<C-k>j
nnoremap <C-l> ;<C-l>j
nnoremap <C-h> ;<C-h>j
nnoremap j gj
nnoremap k gk
nnoremap <Down> gj
nnoremap <Up> gk
" バックアップファイルとスワップファイル
set swapfile
set directory=/Users/ysawa/tmp/vim/swap
set backup
set backupdir=/Users/ysawa/tmp/vim/backup
" MacVim
"set noimdisableactivate
call pathogen#infect()
" Opsplore
let s:single_click_to_edit=1
let s:file_match_pattern=''
let s:show_hidden_files=1
let s:split_vertical=1
let s:split_width=24
let s:split_minwidth=1
let s:use_colors=1
let s:close_explorer_after_open=0
au BufNewFile,BufRead * set ai
au BufNewFile,BufRead php set si smarttab
au BufRead,BufNewFile *.prawn set filetype=ruby
let g:vimfiler_safe_mode_by_default = 0
set ambiwidth=double
set encoding=utf8
set fileencodings=utf8,iso-2022-jp,sjis
if getcwd() != $HOME
if filereadable(getcwd() . '/.vimprojects')
Project .vimprojects
endif
endif
" For Ruby
function! MagicComment()
return "# -*- coding: utf-8 -*-\<CR>"
endfunction
inoreabbrev <buffer> ## <C-R>=MagicComment()<CR>
autocmd BufNewFile *.rb 0r ~/.vim/templates/rb.tpl
function! RubyNewHashSyntax()
:%s/:\(\w\+\) =>/\1:/ge
endfunction
command! RubyNewHashSyntax :call RubyNewHashSyntax()
function! RailsNewRenderPartial()
:%s/render partial\: ["''"]\(.\{-}\)["''"], locals\: {\s*\(.*\)\s*}/render '\1', \2/ge
:%s/render partial\: ["''"]\(.\{-}\)["''"]/render '\1'/ge
endfunction
command! RailsNewRenderPartial :call RailsNewRenderPartial()
au BufNewFile,BufRead *.less setf less
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment