merge from old

This commit is contained in:
Jie Feng 2017-03-10 17:14:30 +08:00
parent e0bbcf6330
commit 7cb42b2281
18 changed files with 211 additions and 10 deletions

View File

@ -0,0 +1,63 @@
snippet react "React template" b
import React, {Component, PropTypes} from 'react'
import {connect} from 'react-redux'
class ${1:C} extends Component {
render () {
}
}
$1.propTypes = {
self: PropTypes.object,
location: PropTypes.object
}
export default connect((state, ownProps) => {
return {
}
})($1)
endsnippet
snippet TODO "Javascript Todo" b
// TODO: ${1:desc} `echo $USER` `!v strftime("%c")` ${2}
endsnippet
snippet connect "react redux connect" b
export default connect((state, ownProps) => {
return {
}
})($1)
endsnippet
snippet Card "Default Expandable Card" b
<Card initiallyExpanded={false} className="MT-5">
<CardTitle showExpandableButton title="$1" />
<CardText expandable>
</CardText>
<CardActions expandable>
<RaisedButton primary label="保存" onTouchTap={$2} />
</CardActions>
</Card>
endsnippet
snippet redux "redux" b
export const SET_${1/\w/\u$0/g} = 'SET_${1/\w/\u$0/g}'
import {store} from 'redux/store'
import {Map} from 'immutable'
export default function (${1} = Map({}), action) {
// let {$1Id} = action
switch (action.type) {
case SET_${1/\w/\u$0/g}:
return action.$1
default:
return $1
}
}
export function set${1/\w+\s*/\u$0/} ($1) {
store.dispatch({
type: SET_${1/\w/\u$0/g},
$1
})
}
endsnippet

42
vim/UltiSnips/sh.snippets Normal file
View File

@ -0,0 +1,42 @@
snippet options "bash command options" b
while true; do
case "\$1" in
-a | --asset )
ASSET=true; shift ;;
-e | --environment )
case "\$2" in
"production" | "development")
RAILS_ENV=$\2
ACCOUNT_ROOT=http://account.rallets.com/
SERVER_ROOT=http://rallets.com/
shift 2
;;
*)
RAILS_ENV=development
ACCOUNT_ROOT=http://account.rallets.com/
SERVER_ROOT=http://apitest.rallets.com/
shift 2
;;
esac
;;
-d | --delayed-job )
DELAYED_JOB=true; shift ;;
-- ) shift; break ;;
-h | --help )
echo "usage:
[-a | --asset] precompile assets
[-d | --delayed-job] run delayed job for queuing sending emails
[-e | --environment] provides environment which rails will run in
[-h | --help] view manual
"
exit;;
* ) break ;;
esac
done
endsnippet
snippet OS "Determine whether it's Mac/Linux/Windows" b
if [ "$(uname)" == "Darwin" ]; then
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
fi
endsnippet

View File

@ -0,0 +1,6 @@
snippet Host "Description" b
Host ${1}
Hostname ${2}
IdentityFile ~/.ssh/rallets
User root
endsnippet

View File

@ -2,3 +2,4 @@
let g:nerdtree_tabs_open_on_gui_startup = 0
" Focus in the main content window
let g:nerdtree_tabs_focus_on_files = 1
map <F6> :NERDTreeTabsToggle<CR>

View File

@ -2,3 +2,4 @@
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
let g:NERDTreeWinSize = 30
map <F5> :NERDTreeToggle<CR>

View File

@ -0,0 +1,8 @@
let g:ycm_key_list_select_completion=[]
let g:ycm_key_list_previous_completion=[]
let g:ycm_add_preview_to_completeopt=0
"let g:ycm_confirm_extra_conf=0
"let g:ycm_server_use_vim_stdout = 1
"let g:ycm_server_log_level = 'debug'
let g:ycm_path_to_python_interpreter = '/usr/bin/python'
set completeopt-=preview

View File

@ -1,7 +1,7 @@
nmap ,u :GundoToggle<CR>
" open on the right so as not to compete with the nerdtree
let g:gundo_right = 1
let g:gundo_right = 1
" a little wider for wider screens
let g:gundo_width = 60

View File

@ -0,0 +1,8 @@
let g:instant_markdown_slow = 0
augroup filetype_markdown
autocmd!
autocmd FileType mkd setlocal spell
autocmd FileType mkd setlocal sw=2 ts=2
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
let g:vim_markdown_initial_foldlevel=1
augroup END

View File

@ -0,0 +1,28 @@
" Override go-to.definition key shortcut to Ctrl-]
let g:pymode_rope_goto_definition_bind = "<C-]>"
" Override run current python file key shortcut to Ctrl-Shift-e
let g:pymode_run_bind = "<C-S-e>"
" Override view python doc key shortcut to Ctrl-Shift-d
let g:pymode_doc_bind = "<C-S-d>"
let g:pymode_lint_ignore = "W0611"
"}}}
let g:syntastic_python_pylint_post_args="--max-line-length=120"
augroup filetype_python
autocmd!
"autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType python setlocal foldmethod=indent
autocmd FileType python nnoremap <F12> :execute "!./" . expand("%") <CR>
autocmd FileType python setlocal foldlevel=99
autocmd FileType python setlocal statusline=%f-%y-[%l]/[%L]
autocmd FileType python nnoremap <buffer> <localleader>c I#cesc>
autocmd FileType python :iabbrev <buffer> iff if:<left>
autocmd FileType python highlight Excess ctermbg=DarkGrey guibg=Black
autocmd FileType python match Excess /\%80v.*/
autocmd FileType python set nowrap
autocmd FileType python map <buffer> <F3> :call Flake8()<CR>
augroup END
" autocmd BufWritePost *.py call Flake8()
"let g:flake8_cmd="/opt/strangebin/flake8000"

1
vim/settings/tagbar.vim Normal file
View File

@ -0,0 +1 @@
nmap <F4> :TagbarToggle<CR>

View File

@ -0,0 +1,8 @@
let g:tern_show_argument_hints = 'on_hold'
let g:tern_map_keys = 1
noremap <leader>tr :TernRename<CR>
noremap <leader>tf :TernRefs<CR>
noremap <leader>tdd :TernDef<CR>
noremap <leader>tdp :TernDefPreview<CR>
noremap <leader>tds :TernDefSplit<CR>
noremap <leader>tdt :TernDefTab<CR>

View File

@ -0,0 +1,6 @@
let g:UltiSnipsExpandTrigger="<C-e>"
let g:UltiSnipsJumpForwardTrigger="<C-e>"
let g:UltiSnipsJumpBackwardTrigger="<C-S-e>"
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
nmap <localleader>ue :UltiSnipsEdit<cr>

View File

@ -166,7 +166,22 @@ map ,hi :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
" ,hp = html preview
map <silent> ,hp :!open -a Safari %<CR><CR>
" Map Ctrl-x and Ctrl-z to navigate the quickfix error list (normally :cn and
" :cp)
nnoremap <silent> <C-x> :cn<CR>
nnoremap <silent> <C-z> :cp<CR>
"paste text in insertion mode
inoremap <C-X><C-V> <esc>"+pa
"paste text in normal mode
nnoremap <C-X><C-V> "+p"
" copy all out of vim
nnoremap <C-X><C-A> <esc>gg"+yG
" copy text in visual mode
vnoremap <C-C> "+yy
" copy all inside vim
nnoremap <C-A> <esc>ggyG
" edit file
nmap <leader>ev :tabedit $MYVIMRC<cr>'tzo
nmap <leader>em :tabedit makefile
nmap <leader>ej :tabedit ~/.jshintrc<cr>'tzo
" move around compile errors
nnoremap <leader>n :cnext<cr>
nnoremap <leader>p :cprevious<cr>

View File

@ -7,4 +7,5 @@ Bundle "xsunsmile/showmarks.git"
Bundle "chriskempson/base16-vim"
" Required for Gblame in terminal vim
Bundle "godlygeek/csapprox.git"
Bundle "godlygeek/csapprox.git"
Bundle 'gorodinskiy/vim-coloresque'

View File

@ -1,9 +1,16 @@
Bundle 'sheerun/vim-polyglot'
Bundle 'garbas/vim-snipmate.git'
Bundle 'honza/vim-snippets'
Bundle 'jtratner/vim-flavored-markdown.git'
Bundle 'scrooloose/syntastic.git'
Bundle 'nelstrom/vim-markdown-preview'
Bundle 'skwp/vim-html-escape'
Bundle 'mxw/vim-jsx'
Bundle 'ternjs/tern_for_vim'
Bundle 'jparise/vim-graphql'
Bundle 'plasticboy/vim-markdown'
Bundle 'suan/vim-instant-markdown'
Bundle 'evanmiller/nginx-vim-syntax'
Bundle 'derekwyatt/vim-scala'
Bundle 'ktvoelker/sbt-vim'
Bundle 'scrooloose/nerdcommenter'
Bundle 'klen/python-mode'
Bundle 'nvie/vim-flake8'

View File

@ -5,3 +5,4 @@ Bundle 'JazzCore/ctrlp-cmatcher'
Bundle 'junegunn/fzf'
Bundle "xolox/vim-misc"
Bundle "xolox/vim-session"
Bundle 'Valloric/YouCompleteMe'

View File

@ -1,7 +1,6 @@
Bundle "AndrewRadev/splitjoin.vim"
Bundle "Raimondi/delimitMate"
Bundle "Shougo/neocomplete.git"
Bundle "briandoll/change-inside-surroundings.vim.git"
Bundle "godlygeek/tabular"
Bundle "tomtom/tcomment_vim.git"
Bundle "vim-scripts/camelcasemotion.git"
@ -28,4 +27,5 @@ Bundle "vim-scripts/lastpos.vim"
Bundle "vim-scripts/sudo.vim"
Bundle "goldfeld/ctrlr.vim"
Bundle "editorconfig/editorconfig-vim"
Bundle 'majutsushi/tagbar'
Bundle 'sirver/ultisnips'

5
vimrc
View File

@ -75,6 +75,7 @@ filetype indent on
" Display tabs and trailing spaces visually
set list listchars=tab:\ \ ,trail
" set listchars=tab:>-
set nowrap "Don't wrap lines
set linebreak "Wrap lines at convenient points
@ -114,5 +115,9 @@ set hlsearch " Highlight searches by default
set ignorecase " Ignore case when searching...
set smartcase " ...unless we type a capital
" ================ Python ===========================
autocmd FileType python set colorcolumn=120
" ================ Custom Settings ========================
so ~/.yadr/vim/settings.vim