From 20f82b2e02d009315dde2430a0417137d4ab312a Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Mon, 7 Jan 2013 10:37:02 +0900 Subject: [PATCH 1/3] - Changed neosnippet#expandable() behavior. --- autoload/neosnippet.vim | 19 +++---------------- doc/neosnippet.txt | 18 ++++++++---------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/autoload/neosnippet.vim b/autoload/neosnippet.vim index cf28a06..5fc6873 100644 --- a/autoload/neosnippet.vim +++ b/autoload/neosnippet.vim @@ -1,7 +1,7 @@ "============================================================================= " FILE: neosnippet.vim " AUTHOR: Shougo Matsushita -" Last Modified: 02 Jan 2013. +" Last Modified: 07 Jan 2013. " License: MIT license {{{ " Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the @@ -80,22 +80,9 @@ endfunction"}}} "}}} function! neosnippet#expandable() "{{{ - let ret = 0 - - let snippets = neosnippet#get_snippets() - let cur_text = neosnippet#util#get_cur_text() - " Check snippet trigger. - if s:get_cursor_snippet(snippets, cur_text) != '' - let ret += 1 - endif - - " Check jumpable. - if neosnippet#jumpable() - let ret += 2 - endif - - return ret + return s:get_cursor_snippet( + \ neosnippet#get_snippets(), neosnippet#util#get_cur_text()) != '' endfunction"}}} function! neosnippet#jumpable() "{{{ " Found snippet placeholder. diff --git a/doc/neosnippet.txt b/doc/neosnippet.txt index 2f5b420..c772dd6 100755 --- a/doc/neosnippet.txt +++ b/doc/neosnippet.txt @@ -285,15 +285,10 @@ neosnippet#expandable() *neosnippet#expandable()* You can use this function with imap . It checks whether the cursor text is a snippet trigger or a placeholder. This is - is useful to save key mappings. The return values of the - function are: - - 0: not found - 1: the cursor text is a snippet trigger - 2: a placeholder exists in the current buffer - 3: both found + is useful to save key mappings. > - imap neosnippet#expandable() ? + imap + \ neosnippet#expandable() || neosnippet#jumpable() ? \ "\(neosnippet_expand_or_jump)" : "\" < *neocomplcache#sources#snippets_complete#expandable()* @@ -338,10 +333,10 @@ EXAMPLES *neosnippet-examples* xmap (neosnippet_start_unite_snippet_target) " SuperTab like snippets behavior. - "imap neosnippet#expandable() ? + "imap neosnippet#expandable() || neosnippet#jumpable() ? " \ "\(neosnippet_expand_or_jump)" " \: pumvisible() ? "\" : "\" - "smap neosnippet#expandable() ? + "smap neosnippet#expandable() || neosnippet#jumpable() ? " \ "\(neosnippet_expand_or_jump)" " \: "\" @@ -711,6 +706,9 @@ A: Please try below settings. It defines snipMate function. ============================================================================== CHANGELOG *neosnippet-changelog* +2013-01-07 +- Changed neosnippet#expandable() behavior. + 2013-01-02 - Improved initialization timing. From d59bf09b9b2d06f14c3ff6551d608bbb80057a2b Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Mon, 7 Jan 2013 10:39:44 +0900 Subject: [PATCH 2/3] - Improved documentation. --- doc/neosnippet.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/neosnippet.txt b/doc/neosnippet.txt index c772dd6..b90a7b3 100755 --- a/doc/neosnippet.txt +++ b/doc/neosnippet.txt @@ -286,6 +286,10 @@ neosnippet#expandable() You can use this function with imap . It checks whether the cursor text is a snippet trigger or a placeholder. This is is useful to save key mappings. + Note: If you used to + |neocomplcache#sources#snippets_complete#expandable()|, you + must use both |neosnippet#expandable()| and + |neosnippet#jumpable()|. > imap \ neosnippet#expandable() || neosnippet#jumpable() ? From d828d4d0046d4004592fc00f48ca8d0ac06fdf4a Mon Sep 17 00:00:00 2001 From: TAKAHASHI Kazunari Date: Thu, 10 Jan 2013 15:04:16 +0900 Subject: [PATCH 3/3] fix document --- README.md | 4 ++-- doc/neosnippet.txt | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2673dfe..46bbb3b 100644 --- a/README.md +++ b/README.md @@ -65,8 +65,8 @@ imap (neosnippet_expand_or_jump) smap (neosnippet_expand_or_jump) " SuperTab like snippets behavior. -imap neosnippet#expandable() ? "\(neosnippet_expand_or_jump)" : pumvisible() ? "\" : "\" -smap neosnippet#expandable() ? "\(neosnippet_expand_or_jump)" : "\" +imap neosnippet#expandable() neosnippet#jumpable() ? "\(neosnippet_expand_or_jump)" : pumvisible() ? "\" : "\" +smap neosnippet#expandable() neosnippet#jumpable() ? "\(neosnippet_expand_or_jump)" : "\" " For snippet_complete marker. if has('conceal') diff --git a/doc/neosnippet.txt b/doc/neosnippet.txt index b90a7b3..4bb9975 100755 --- a/doc/neosnippet.txt +++ b/doc/neosnippet.txt @@ -292,7 +292,7 @@ neosnippet#expandable() |neosnippet#jumpable()|. > imap - \ neosnippet#expandable() || neosnippet#jumpable() ? + \ neosnippet#expandable() neosnippet#jumpable() ? \ "\(neosnippet_expand_or_jump)" : "\" < *neocomplcache#sources#snippets_complete#expandable()* @@ -337,10 +337,10 @@ EXAMPLES *neosnippet-examples* xmap (neosnippet_start_unite_snippet_target) " SuperTab like snippets behavior. - "imap neosnippet#expandable() || neosnippet#jumpable() ? + "imap neosnippet#expandable() neosnippet#jumpable() ? " \ "\(neosnippet_expand_or_jump)" " \: pumvisible() ? "\" : "\" - "smap neosnippet#expandable() || neosnippet#jumpable() ? + "smap neosnippet#expandable() neosnippet#jumpable() ? " \ "\(neosnippet_expand_or_jump)" " \: "\"