Skip to content

Commit b51e0d8

Browse files
committed
init
0 parents  commit b51e0d8

File tree

4 files changed

+62
-0
lines changed

4 files changed

+62
-0
lines changed

.gitignore

Whitespace-only changes.

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## vim es6 snippets
2+
3+
> Write ES6 easy
4+
5+
## Install
6+
7+
[Download zip file](http://www.vim.org/scripts/script.php?script_id=0):
8+
9+
cd ~/.vim
10+
unzip vim-es6-snippets.zip
11+
12+
To install using pathogen.vim:
13+
14+
cd ~/.vim/bundle
15+
git clone https://github.com/isRuslan/vim-es6-snippets.git
16+
17+
To install using [Vundle](https://github.com/gmarik/vundle):
18+
19+
" add this line to your .vimrc file
20+
Plugin 'isRuslan/vim-es6-snippets'
21+
22+
To checkout the source from repository:
23+
24+
cd ~/.vim/bundle
25+
git clone https://github.com/isRuslan/vim-es6-snippets.git
26+
27+
```vim
28+
Bundle 'MarcWeber/vim-addon-mw-utils'
29+
Bundle 'tomtom/tlib_vim'
30+
Bundle 'garbas/vim-snipmate'
31+
Bundle 'isRuslan/vim-es6-snippets'
32+
```
33+
34+
## List

autoload/vim_snippets.vim

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
" this is well known Filename found in snipmate (and the other engines), but
2+
" rewritten and documented :)
3+
"
4+
" optional arg1: string in which to replace '$1' by filename with extension
5+
" and path dropped. Defaults to $1
6+
" optional arg2: return this value if buffer has no filename
7+
" But why not use the template in this case, too?
8+
" Doesn't make sense to me
9+
fun! vim_snippets#Filename(...)
10+
let template = get(a:000, 0, "$1")
11+
let arg2 = get(a:000, 1, "")
12+
13+
let basename = expand('%:t:r')
14+
15+
if basename == ''
16+
return arg2
17+
else
18+
return substitute(template, '$1', basename, 'g')
19+
endif
20+
endf
21+
22+
" original code:
23+
" fun! Filename(...)
24+
" let filename = expand('%:t:r')
25+
" if filename == '' | return a:0 == 2 ? a:2 : '' | endif
26+
" return !a:0 || a:1 == '' ? filename : substitute(a:1, '$1', filename, 'g')
27+
" endf

snippets/es6.snippets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Welcome to the Javascript ES6 snippets!

0 commit comments

Comments
 (0)