Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A meta char for folding #49

Open
juanpabloaj opened this issue Sep 25, 2011 · 7 comments
Open

A meta char for folding #49

juanpabloaj opened this issue Sep 25, 2011 · 7 comments
Assignees

Comments

@juanpabloaj
Copy link

why don't add a meta char for folding? example

if I have this snippet

snippet f
function ${1:funName}(${2:args}){
    ${3:#code}
}

when I press f<tab> the snippet is inserted

function funName(args){
    #code
}

if a meta char is _ when I press f_<tab> the folding is added to existent snippet and insert snippet with folding

function funName(args){ "{{{
    #code
} "}}}

The same idea for a meta char for add commented documentation a snippet

f@<tab> 
...
function funName(args){
" @funName : description 
    #code
}
@MarcWeber
Copy link
Collaborator

enjoy your great suggestion:
b9efaa5

If you come up with a nice default implementation for AddFolding we can
move the code into the autoload directory and distribute it as official
implementation.

Probably the char should be configurable?
What about prefixing instead?

Marc Weber

@juanpabloaj
Copy link
Author

yes, the char should be configurable.
yes, prefixing is a good idea, the _ char case was a example.

maybe similar to python decorators

@juanpabloaj
Copy link
Author

my question is, how change the comment in any filetype?

a big if conditional ?

@MarcWeber
Copy link
Collaborator

Have a look at this implementation:
https://github.com/MarcWeber/vim-addon-commenting

and the referenced projects. They all either use the existing Vim
options or introduce their own settings / dictionaries to look up the
commenting chars.

The function found in that tries to always return a line based
commenting char if available.

Marc Weber

@MarcWeber
Copy link
Collaborator

In the code you can use &filetype setting to make the func dynamically
use different commenting char.

@juanpabloaj
Copy link
Author

to simplify I use this

    let g:commentChar = { 
        \ 'vim': '"',
        \ 'c': '//',
        \ 'cpp': '//',
        \ 'sh': '#',
        \ 'python': '#' 
        \}
    " url https://github.com/garbas/vim-snipmate/issues/49
    fun! AddFolding(text)                                                                                                               
        return g:commentChar[&ft]." {{{\n".a:text."\n".g:commentChar[&ft]." }}}"
    endf

@stardiviner
Copy link

focus on this issue

felixhummel pushed a commit to felixhummel/snipmate.vim that referenced this issue Feb 9, 2014
knowlep8 pushed a commit to knowlep8/dotfiles that referenced this issue Mar 17, 2014
3a23fdf improve README, vundle taught us this is very important
2f3b2ad Remove unused s:ReadFile function
eb30d83 Fix handling of single snippet files
40f0efd Fix available snips completion popup
35cecbb Updates for snippet with normal for syntax
3883b17 Fix formatting of readme
4376a66 Remove expansion guards
55ee329 Use CursorMoved events entirely
667086e define left_from_cursor
d3cda27 Fix bug with mirrors in placeholders
0631587 Implement simple caching
43e8b9a Change quoting when filtering snippets
d7918d0 put VAM first because its most convenient because it supports dependencies
062d303 Fix README link to issue
149365c Count indents in bytes rather than columns
e453b43 Fix bug with mirrors in the first column
49cf485 Fix header levels
c7fe3e8 Release version 0.87
97a895d Add snipMate#CanBeTriggered() function
ec98fb5 Add plug mapping <Plug>snipMateTrigger
064f1ce Fix a typo in README
efc849d Update contributors list
a6457a5 Redundant line in syntax file
3cf2ebb Include instructions for installing vim-snippets
f354636 Add g:snipMate_no_default_aliases option
bc6a6f3 Use 'sw' if 'sts' is non-positive
75776f4 Fix typos in mapping documentation
6eb7adf Merge pull request #133 from bsutic/fix-typo
54736c3 Fix variable typo in source code
dafb6f3 Add support for $0 tabstop
cca4ec0 Edit documentation
3ab862a Updated references to README file.
4561694 Fix visual placeholder support
cc708d7 Revert "Deprecate scope_aliases"
3b4c08d Deprecate scope_aliases
db68369 Add extends keyword support in .snippets files
fd6ad42 Remove unused ProcessFile function
54acd6a Stop indenting empty lines when expanding snippets
dcac994 Release version 0.86
a6c5d6a Fix glob() for use with older Vim versions
6dabca0 Fix SnipMateOpenSnippetFiles
0f833de Restore performance benefits of old s:Glob
4e975c9 Fix snippet name collision bug
d42783a Refactor ReadSnippetFiles() and s:Glob()
00aab28 Overhaul README
f9bd680 Move contributors to separate file
6bed4c3 Add hpesoj to list of contributors
395ffaa Merge pull request #120 from hpesoj/master
7fe31d3 Avoid updating variables after calling self.remove().
7378cff Reposition the cursor after updating vars
3dc52c5 Use <Plug> mappings
9233940 Remove most select mode compatibility (?) mappings
0986a1f Add radicalbit to list of contributors
2f2a101 snipmate-snippets is vim-snippets because it will contain snipmate and UltiSnip snippets
ab678e2 adding Adnan Zafar to lists of maintainers - he is doing most work now
83bf573 moving the repository list to snipmate-snippets - having one central place is eassier to maintain
2c6ae0b Remove redundant undo point creation
d4d1060 Use filter() in ShowAvailableSnips
fc22673 Release version 0.85
50fc7d2 Update ChangeLog
ce80ad1 Merge pull request #118 from bonsaiben/bootstrap_snippets_readme
516c7af add link to Twitter Bootstrap snippets repo
35a7c9b Reset 'cpo' before creating maps
bbae0a6 Merge pull request #117 from ajzafar/garbas
6af9294 Rewrite tab stop jumping and updating code
d209d22 document that Marc Weber stop contributing to this project, because UltiSnips does a better job now
472affc status update
3260747 add reference to new issue
b5b459c allow using \${1} in snippets or $1. $x is used in bash and ruby quite often
fe3b739 document a new idea
341c7f6 add me as maintainer along with Garbas too, cause its me fixing bugs along with him and others bcd592ce5e fixed the ~bug introducing a new one, ctrl-r<tab> broke. The real fix is to escape ~ rather than disallowing regular expression matching
cd408da correct statement, add neosnippets to list of related work. I haven't tried it yet
ace4f02 fix pull/78
dce2394 guard must start at first column
b455022 Merge pull request #112 from mihaifm/master
c390c94 Merge pull request #113 from jean/master
4149635 Some editing.
d0aee28 Bring in line with what the README says
3bc084d Fixed unexpected errors related to glob method
e77388c Merge pull request #101 from linduxed/custom-backwards-fix
560f3e9 Merge pull request #91 from Tblue/master
ca9f00d Merge pull request #99 from apuignav/master
b2b6c27 Merge pull request #93 from sudar/arduino
4edab6b Merge pull request #106 from codeinthehole/patch-1
220347a Fix a few grammatical errors in README
62594d2 fix help doc style
43b5dc9 Fix a few grammatical errors in README
a56f054 Merge branch 'master' of https://github.com/apuignav/vim-snipmate
62af7d9 Fixed custom backwards trigger key.
b42f80f Merge pull request #100 from JamesMcMahon/patch-1
9f9dc4c Update README to use proper snippets bundle
bcd592c Added protection against regular expressions in trigger.
41152a2 Merge pull request #97 from cmaureir/patch-2
23539b6 Adding C snippets to CUDA files.
34ab1a7 Merge pull request #95 from kucaahbe/master
fc75101 allow overwriding individual keys in scope_aliases
106d4db turned spelling off for "snippet(s)" filetype
15b75e4 Added link to Arduino snippets project in README
e587a62 Work around glob() returning non-existing files.
3f52de4 implement guards - this implementation may change
f1e8510 disable file caching, rename s:snipMate to s:c, itroduce cache_parsed_snippets_on_disk, read_snippets_cached options
39ee6f8 also make snipmate distinct m and M when having 'ignorecase' set. Thanks to radicalbit (github)
4cef3fc 1) provide real fix to \t not being added by changing default setting
db244df Merge pull request #77 from jasonsydes/doc_scope_aliases
3aae363 Misunderstood <c-r><tab>, reverted docs on that one point.
28e042d Added better docs on setting scope_aliases.
7dee28b fix issue 75
42e921a Merge remote-tracking branch 'garbas/master'
41e7931 fix: longest match poicy: prefer try div. before .
b9e2804 Merge pull request #64 from juanpabloaj/addFold
1302bb1 Merge pull request #61 from buethling/patch-1
3a04669 Merge pull request #67 from davejamesmiller/master
dc8ff04 Merge pull request #72 from mutewinter/patch-1
4549bf7 Merge pull request #73 from gmunkhbaatarmn/master
b446bfb little typo fix
a1190f5 tell user what's going wrong if tlib or vim-addon-mw-utils are missing
93fd4fc Updated Vundle instructions to typical syntax
95e66f0 fix typo, snippet_dirs was always overridden
7d11d00 stop the tab discussion: issue 42 - partially based on code sent by orutherfurd
7ff53bd Syntax highlight the snippet trigger names in the .snippets files to make them stand out from the replacement text
05084a3 Merge pull request #66 from davejamesmiller/master
68f668e Remove duplicated code from ftplugin/snippets.vim
7c6deea Add separate filetype for .snippet files, since they aren't indented like .snippets files are
e361252 doc: modificated second example
ec51a3d Merge pull request #63 from grota/master
7542b05 Call snipMate#ShowAvailableSnips() instead of ShowAvailableSnips()
09333a0 Merge pull request #62 from bogdan/patch-1
1401969 Describe bug #59 in readme
afc866f Adding support for html/eruby-rails snippets in eruby (*.html.erb) files. I don't know if this is worthy of a pull but thought I'd suggest it as I'm sure a lot of textmate converts would enjoy it. Thanks to gmaccarone for his help on this.
8b9a02a Merge pull request #58 from DXist/master
1b43745 Add call fixed
2a240d6 unused variable
e02c61a comment out echo
f605f20 Merge pull request #56 from mlen/master
113d047 Fixing bug caused by using deprecated function
d7ece78 cleanup and refactoring finishing the work lucapette has started
07175cc Merge remote-tracking branch 'garbas/lookups_refactor'
5803dbd lookup function refactored
66aa9c4 shorter escape function
d75cb5f escaping glob search
bf563cc use line variable
51ce83f escaping glob function
b9efaa5 add second example illustrating how to implement suggestion by JuanPablo -> garbas/vim-snipmate#49
132029e some typo fixed
0fb3214 Merge pull request #48 from lucapette/master
8529852 fixed issue #42
f456016 Merge pull request #46 from lucapette/master
eef8409 some typo fixed
4535952 Merge pull request #45 from lucapette/master
23c52d4 sort matches
fd78bd6 fix previous commit, implementation should be fine now
e713269 implement &syntax support #40
ac3b77b support ft=A.B in command
bfe6d4e fixes issue #38
fb77f9a making addon-info.json valid json file
1e5d510 Eustaquio Rangel is taq on github
67f4f8e Merge branch 'master' of github.com:garbas/vim-snipmate
f38b624 Don't depend on snippets. install the snippets to get snipmate instead
5d28bf4 adding g:snips_trigger_key_backwards option
13e1136 recommending VAM over all the other solutions, rename snippets to snipmate-snippets
28248de Split off snippets into a new repo.
307880b added link to jgosmann github profile
ad9594e Merge pull request #25 from jgosmann/master
af5191a Forgot to add date and name to the note in the changelog from the last commit.
c6fe706 Updated changelog with note about the bugfix of commit 65e27e7b7863509d331565e916c0b4db29b1b974
07f1a09 Merge branch 'master' of github.com:jgosmann/vim-snipmate
65e27e7 Fixes a bug that jumping to the next placeholder clears the current one if it is unchanged.
714d05c rename addon-info
b89a21a fix of "longest match wins"
750a32c Merge remote-tracking branch 'pielgrzym/master'
ab92aba Updated the changelog
5c1a64c fix htmlldjango,javascript,html scope handling. previously only htmldjango's for loop was found
4498269 Merge pull request #19 from pielgrzym/master
890f84b My favorite snippets for django/css are back :)
25a0e28 longest match wins now. eg d:b -> display:block wins over b -> bottom (css snippets)
02bb111 add reference to snippets for bibtex files
33d5107 Merge pull request #13 from bascht/master
f0405ac Merge branch 'master', remote-tracking branch 'MarcWeber/master'
5179a40 make paths containing snippet files configurable
dc893ba Merge commit 'd46588cad4f48f1fe6f0e80c06b87f9b78792422'
0233388 rewrite huge parts of the documentation cause it was outdated
aa43f9a adding php snippet redirect
d46588c made "context"'s variable a little more appropriate
314efd0 inline php snippet. Useful for php templates :)
137e20b removing lefovers of conflict resolution in jsp.snippets
d505bb3 Merge pull request #9 from smt/official
497be12 Merge pull request #10 from ironcamel/fix-readme
4f2b15f Fixing pathogen section of README
08ac6e5 Add JSP snippets
8253cfa adding css.snippets
2d1eabc updating changelog to refloct which changes were merged
6c48e60 Merge remote-tracking branch 'MarcWeber/master'
2099976 wrong url in "Manual" section
34df7bd Merge branch 'master', remote-tracking branch 'origin/master'
2a35445 Merge pull request #6 from ironcamel/master
35ff1e4 Updating pathogen section of README to include directions for adding deps.
22548b8 Escape '~' for triggerR in GetSnippets.
824f902 Break undo only if a snippet gets expanded.
23f1cb7 js: Add snippet `cl` for console.log.
9260697 Merge branch 'MarcWeber-master'
48f6b66 add configuration for custom trigger-key
4d95aca handle single-line or multiline snippets
45bdc32 fix error with multiline snippet
4adc111 fixed a paragraph of the README
e29ab22 added rst snippets
00aace7 fixed some paragraphs of the README
cddc863 Improved README.rst -- added Vundle installation and me as an author
1a68a57 added dowh python snippet - do...while in python
89720d4 added gpl C snippet
b6f8a22 added double quotes for rspec context
458c0d8 Fix typos/style in README.rst.
3d650a8 document dependencies better
c6efa21 vladimir-vg told me that I should ignore this file because Pathogen lists those plugins as "modified". Maybe it should be Pathogen ignoring this common case
4e1d137 speed up searching for trigger by { many times
3412e34 Minor doc review/fixes.
b7e68f3 Improve snippet trigger lookup.
bf8e871 Do not look for snippets in `bufnr` scope.
5efc6aa php: add snippet "G" for simple GLOBALS expansion.
f8a6e19 - add ! to fun - cleanup: Use same function to find all snippet files - for .php files add php scope - add both: last path component of runtimepath and scope to snippet name   This way many snippet files can provide the same "trigger" and you'll   get all snippets in the list.   Previously the last one was kept only and shown only.   Example for trigger "for" in a .php file:   1* 1. snipmate javascript default   2: 2. snipmate php default
3e6f4eb Merge remote branch 'gh/master'
53b9ce4 Merge remote branch 'johnbintz/master'
c5e1858 fixed 'do' to not prompt anything since we have 'dov' when there's a variable
1c13fd6 handle single-line or multiline snippets
ddf7e81 Add a var_dump snippet for PHP.
3b89c13 PHP docblocks snippets end with "*/", not "**/".
4bd999f fix error with multiline snippet
bdc96ce Merge remote-tracking branch 'darkwise/master'
7dea62f add #{2} into eaid in ruby.snippets
a802c63 comment about superSnipMate
6d51515 Add php snippets 'pd' and 'pdd' for 'pre-dump'.
fd5e917 Fix typos/doc.
6763aab If there is only one snippet choose it directly.
13fa8b2 document that there should be a comparison
814b22a add scroolooses repo
f94352a drop pathogen, tell about how to use vim-addon-manager to install the plugin
8a4e70d Merge branches 'latex' and 'master' into latex
df30746 fixing my merge
9998465 pull from garbas fork
6628393 Adding math
051c92e Merge branch 'latex', remote branch 'darkwise/me' into latex
892956a Adding math formula
99b5fae Adding some mathematic formula. Adding figure.
5dafc81 Merge branch 'master' into MarcWeber
4073f71 update backwards snippet as well for latest supertab
583b740 Merge remote branch 'ervandew/master'
fe2093f Merge branch 'master' of git://github.com/MarcWeber/snipmate.vim
03b001b Fix expansion of "foo.bar(" using the "." snippet.
b1e7778 Add bang to function definitons, allowing for reload.
dbc1826 Add snippets file for "diff" filetype.
12bc924 added the context snippet as well
65ceac4 fix mapping reported by t2wd (github)
3dfbff2 added ruby-debug snippet
ff9729d comment
777356e update snipmate to handle latest supertab version
885d0ad striping out some text
e1665f7 wrong markup for README
da052e5 Updated README: added contributors, instructions how to install snipMate, some spellchecking of my wonderfull english, added this Changelog
fcb11b4 adding pdbbb snippet
4a7e1f9 Merge remote branch 'garbas/master'
04b989c some README.rst formatting
111e299 updated README
9466f01 added python debugger snippets
29707ac Using expr foldmethod to get better folds
2a83172 New way to eval `...`, and escape \
08945cc Add "lorem" snippet.
73a7255 Create undo point before expanding snippet in insert mode.
dbd8dd5 Add common liceses to falcon
be90fd5 Add falcon pl snippets
447ef99 added info about building the tag file
e95244b Fixed tag for snipMate-syntax
8b1a270 Enhanced Ruby 'do' block support
30a95fb Oops, removing extraneous ${3}
8b418c5 A more idiomatic way to slurp files in perl.
aef6379 Add GPLv3 file header to Python snippets.
2af46e3 Fixed small find bug
7398762 Small props fix
b44655c Fixed the style a bit
10b8efd Added target properties
d747fe8 Initial cmake snippets
7a203fb Improved cpp snippets
44ed36e Added snippets for Django
77bafff added with statement to python.snippets
f94be27 A couple snippets for markdown URLs/images.
d6e9809 Removed trailing whitespace from an else.
6804234 Removed trailing whitespace from ends.
eadf218 add footnote to tex.snippets
05c68b2 adding other formating snippets to tex.snippets
3b38ac3 Adding some snippets to tex.snippets : it for italic (\textit{}) bf for bold (\textbf{}) others follow.
d818718 Added Progress/OpenEdge ABL snippets
91b229e Adding sniippets for Play framework
82b1adc Formatted if else.
bcecd26 Formatted anonymous function.
82dc2d1 Alterted increment and decrement operators to conform to JSLint's plusplus rule.
d244908 Formatted if statement.
f7749f8 Added immediate function snippet.
9d7be5d Add missing closing parenthesis for js timeout snippet
5b6c443 Added 'try' to js snippets.
458f62c removed an unnecessary empty line
10d2283 removed the beginning 'should' from spec snippet
b954b05 document that Id like to have a upstream merge and how I think about the future of snipmate
55ddcfb added before & after to ruby snippets
100f870 added rename column snippet
63cfadc add footnote to tex.snippets
902d3fd adding other formating snippets to tex.snippets
5ff223a Adding some snippets to tex.snippets : it for italic (\textit{}) bf for bold   (\textbf{}) others follow.
e56f31d adding .gitignore file
e3810af Merge branch 'master' of git://github.com/srushti/snipmate.vim
1c9effc Haml: html and rails snippets
181d4ae added eruby snippets
d27b3bf added a do without a variable
f5e094c added content_for & fixed desc
b5868f8 add !
948082a adding support for visual selection
4132328 js, html support for .ur files
41a9bc8 adding hooks allowing you to add more snippets
d8bbe83 allow filetype/*.snippets files
0055d73 if Snippet* command is called on a file without filetype show appropriate message. Actually its hidden. But you can get it by :messages rather than an "empty key" error
c74d647 added a couple of rspec & migrations snippets
a466687 Merge upstream. Add comments in which way this fork differs from the original
974cd54 Merge remote branch 'origin/master' into master-get-snips-func
1c255a6 alias mxml -> actionscript
9bf3901 adding new command SnipMateOpenSnippetFiles It lists many possible files which can contain .snippets. Existing files are listed first. So you should be even faster managing your snippets now
d24a08c Vim snippets:  - add autoload prefix. Add new placeholder for s:  - always use fun! for developing. It seldomly hurts
7cab68f remove duplicate line. Don't use local var
9c98f59 ruby snippets: add else ensure to begin snippet
020a417 make AddScopeAliases recursive so that aliases of aliases are added make xhtml an alias for html add javascript to both: html and php
47ccae0 PHP: add lambda snippet JS: Add try catch
540ccf0 ruby: add begin rescue snippet
01b769a fix ScopeAliases
66ffd85 fix flash snippets
7621baf fix: numbersmuststart at 1
4ae365b adding some action script snippets (unfinished but more useful than no snippets)
649eba5 ruby add missing block snippet
55ff5a0 fix PHP snippet (it's the value not the key var) add try snippet add foreachk snippet
f7d2c13 add ! to command set tabstop and expandtab settings explicitely so that indentation commands work as expected
ff95f28 add a RetabSnip command which fixes indentation automatically
d9f239c big change: Add a function collecting snippets on demand. .snippets files are parsed only once and cached for performance reasons. However if the timestamp changes they are reread automatically. I tried to preserve behaviour. However I may have failed. The main reason for this is that it is possible now to define new script sources easily. Eg there could be a plugin which reads Eclipse plugins, translating them to snipMate snippets on the fly etc.
30fae8e 'put s:snippets into s:multi_snip using key "default" So if you have both: a snippet without description and one with desciption they both show up Also if a snippet is added twice the second overrides the first one. Thus you can just reload snippets without empying the dicts
cfc8431 tab: start completion if there is no match, only do so if some characters have been typed

git-subtree-dir: .vim/bundle/snipmate
git-subtree-split: 3a23fdf65b6bf8ac2cf0de79f5894dc02f1d28dd
@ajzafar ajzafar self-assigned this Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants