Skip to content

Instantly share code, notes, and snippets.

@takeshy takeshy/vimrc
Last active Sep 12, 2018

Embed
What would you like to do?
execute pathogen#infect()
syntax on
ab conlog <script>console.log("<%= %>")</script>
ab vimed sp ~/.vimrc<CR>
nmap ! :execute ":lcd " . expand("%:p:h")<CR>
map <C-f> :let @* = expand("%:p")<CR>
let g:skk_auto_save_jisyo=1
let g:skk_large_jisyo='~/.vim/SKK-JISYO.L'
set ts=2
set sw=2
set expandtab
set backupdir=~/tmp
set undodir=~/tmp
set suffixesadd+=.js
set textwidth=1500
source $VIMRUNTIME/macros/matchit.vim
autocmd Filetype ejs setlocal ft=html
au BufNewFile,BufRead *.ejs set filetype=html
let g:syntastic_javascript_checkers=['eslint']
let g:syntastic_typescript_checkers=['tslint']
function! ReadFile() abort
let s:currentPos = col('.')
let s:colNum = s:currentPos - 1
let s:lastPos = len(getline('.'))
let s:fileName = ''
let s:ext = '.' . expand("%:e")
while s:colNum > -1
if getline('.')[s:colNum] =~ "\['\"\]"
break
end
let s:fileName = getline('.')[s:colNum] . s:fileName
let s:colNum = s:colNum - 1
endwhile
while s:currentPos < s:lastPos
if getline('.')[s:currentPos] =~ "\['\"\]"
break
end
let s:fileName = s:fileName . getline('.')[s:currentPos]
let s:currentPos = s:currentPos + 1
endwhile
let s:prevPath = ""
let s:dirs = split(expand("%:p:h"), '/')
if s:fileName =~ "^\\."
let s:fullName = simplify(expand("%:p:h") . '/' . s:fileName)
else
for name in s:dirs
let s:prevPath = s:prevPath . '/' . name
if (name == "ts" && (s:ext == ".ts" || s:ext == ".tsx")) || (name == "es6")
break
endif
endfor
let s:fullName = simplify(s:prevPath . '/' . s:fileName)
endif
if !filereadable(s:fullName)
if isdirectory(s:fullName)
let s:fullName = s:fullName . '/index' . s:ext
else
if filereadable(s:fullName. '.ts')
let s:fullName = s:fullName . '.ts'
else
if filereadable(s:fullName. '.tsx')
let s:fullName = s:fullName . '.tsx'
else
if filereadable(s:fullName. '.d.ts')
let s:fullName = s:fullName . '.d.ts'
else
let s:fullName = s:fullName . s:ext
endif
endif
endif
endif
endif
execute ':e ' . s:fullName
endfunction
nmap <C-g> :call ReadFile()<CR>
nmap <C-c> :tabnew <C-r>%<CR>
" ここから下は Syntastic のおすすめの設定
" ref. https://github.com/scrooloose/syntastic#settings
" エラー行に sign を表示
let g:syntastic_enable_signs = 1
" location list を常に更新
let g:syntastic_always_populate_loc_list = 0
" location list を常に表示
let g:syntastic_auto_loc_list = 0
" ファイルを開いた時にチェックを実行する
let g:syntastic_check_on_open = 1
" :wq で終了する時もチェックする
let g:syntastic_check_on_wq = 0
let $remote="scp://develop/"
au FileType go setlocal sw=4 ts=4 sts=4 noet
au FileType go setlocal makeprg=go\ build\ ./... errorformat=%f:%l:\ %m
au BufWritePre *.go Fmt
autocmd FileType typescript nmap <buffer> <Leader>t : <C-u>echo tsuquyomi#hint()<CR>
let g:mkdp_path_to_chrome = "open -a Google\\ Chrome"
cnoremap <C-A> <Home>
cnoremap <C-F> <Right>
cnoremap <C-B> <Left>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.