Created
March 27, 2020 09:28
-
-
Save xsephiroth/0c97763da02b1b31e81098b2b36564ea to your computer and use it in GitHub Desktop.
.vimrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" jsx [insert]<Tab>: auto complete html tag | |
" div | |
" <div></div> | |
autocmd BufNewFile,BufRead *.js,*.jsx inoremap <Tab> <Esc>^i<<Esc>$a><Esc>^v$y$pbi/<Esc>h | |
" jsx [normal]/!: to self close tag | |
" <div>abc</div> | |
" <div />abc | |
autocmd BufNewFile,BufRead *.js,*.jsx nnoremap /! ^f>i /<Esc>f<vf>xF | |
" jsx [insert]rfc<Tab>: react function component snippet | |
" import React from 'react'; | |
" | |
" const _ = () => { | |
" }; | |
" | |
" export default _; | |
" | |
autocmd BufNewFile,BufRead *.js,*.jsx inoremap rfc<Tab> <Esc>ggdGiimport React from 'react';<CR><CR>const _ = () => {<CR>};<CR><CR>export default _;<CR><Esc>gg/_<CR> | |
" go [insert]err<Tab> | |
" if err != nil { | |
" } | |
autocmd BufNewFile,BufRead *.go inoremap err<Tab> <Esc>^iif err != nil {<CR>}<Esc>k | |
" go [insert]pkgm<Tab> init main package codes | |
" package main | |
" | |
" func main() { | |
" } | |
autocmd BufNewFile,BufRead *.go inoremap pkgm<Tab> package main<CR><CR>func main() {<CR>}<Esc>k |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment