diff options
Diffstat (limited to '')
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | autoload/fzf_gitignore.vim | 41 | ||||
| -rw-r--r-- | doc/fzf_gitignore.txt | 85 | ||||
| -rw-r--r-- | ftplugin/gitignore.vim | 20 | ||||
| -rw-r--r-- | packages.yaml | 2 | ||||
| -rw-r--r-- | syntax/gitignore.vim | 30 | ||||
| -rw-r--r-- | tests/extensions.vim | 2 | 
7 files changed, 169 insertions, 13 deletions
| @@ -115,7 +115,7 @@ If you need full functionality of any plugin, please use it directly with your p  - [fsharp](https://github.com/ionide/Ionide-vim)  - [gdscript](https://github.com/calviken/vim-gdscript3)  - [git](https://github.com/tpope/vim-git) -- [gitignore](https://github.com/rdolgushin/gitignore.vim) +- [gitignore](https://github.com/fszymanski/fzf-gitignore)  - [glsl](https://github.com/tikhomirov/vim-glsl)  - [gmpl](https://github.com/maelvalais/gmpl.vim)  - [gnuplot](https://github.com/vim-scripts/gnuplot-syntax-highlighting) diff --git a/autoload/fzf_gitignore.vim b/autoload/fzf_gitignore.vim new file mode 100644 index 00000000..7548130c --- /dev/null +++ b/autoload/fzf_gitignore.vim @@ -0,0 +1,41 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gitignore') == -1 + +scriptencoding utf-8 + +" Copyright (c) 2017-2020 Filip Szymański. All rights reserved. +" Use of this source code is governed by an MIT license that can be +" found in the LICENSE file. + +function! s:template_sink(templates) abort +  try +    let l:lines = _fzf_gitignore_create(a:templates) +  catch /^Vim(\(let\|return\)):/ +    return +  endtry + +  new +  setlocal filetype=gitignore + +  call setline(1, l:lines) + +  $-2,$delete _ +  normal! gg +endfunction + +function! fzf_gitignore#run() abort +  try +    let l:opts = { +          \ 'source': _fzf_gitignore_get_all_templates(), +          \ 'sink*': function('s:template_sink'), +          \ 'options': '-m --prompt="Template> " --header="gitignore.io"' +          \ } +  catch /^Vim(\(let\|return\)):/ +    return +  endtry + +  call fzf#run(fzf#wrap(l:opts)) +endfunction + +" vim: ts=2 et sw=2 + +endif diff --git a/doc/fzf_gitignore.txt b/doc/fzf_gitignore.txt new file mode 100644 index 00000000..4d94748c --- /dev/null +++ b/doc/fzf_gitignore.txt @@ -0,0 +1,85 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gitignore') == -1 + +*fzf_gitignore.txt* Create useful .gitignore files for your project + +Author: Filip Szymański <fszymanski.pl@gmail.com> + +============================================================================== +CONTENTS                                              *fzf-gitignore-contents* + +  1. Introduction                                |fzf-gitignore-introduction| +  2. Configuration                               |fzf-gitignore-configuration| +  3. Commands                                    |fzf-gitignore-commands| +  4. Mappings                                    |fzf-gitignore-mappings| +  5. License                                     |fzf-gitignore-license| +  6. Bugs                                        |fzf-gitignore-bugs| +  7. Contributing                                |fzf-gitignore-contributing| + +============================================================================== +INTRODUCTION                                      *fzf-gitignore-introduction* + +fzf[1] interface for creating .gitignore files using the gitignore.io[2] API. + +Note: This plugin was inspired by helm-gitignore[3]. + +============================================================================== +CONFIGURATION                                    *fzf-gitignore-configuration* + +                                                     *g:fzf_gitignore_no_maps* +Set this option to disable all key mappings. +> +  let g:fzf_gitignore_no_maps = 1 +< +Default: Not defined (number) + +                                                         *g:fzf_gitignore_map* +Set this option to change the |<Plug>(fzf-gitignore)| key mapping. +> +  let g:fzf_gitignore_map = '<Leader>i' +< +Default: '<Leader>gi' (string) + +============================================================================== +COMMANDS                                              *fzf-gitignore-commands* + +                                                               *:FzfGitignore* +Create .gitignore file. + +============================================================================== +MAPPINGS                                              *fzf-gitignore-mappings* + + -----------------------------------+---------------------------------------- +  Mapping                           | Description                            ~ + -----------------------------------+---------------------------------------- +  <Plug>(fzf-gitignore)             | Create .gitignore file + -----------------------------------+---------------------------------------- + +============================================================================== +LICENSE                                                *fzf-gitignore-license* + +MIT + +============================================================================== +BUGS                                                      *fzf-gitignore-bugs* + +If you find a bug please create an issue on GitHub. + +https://github.com/fszymanski/fzf-gitignore/issues + +============================================================================== +CONTRIBUTING                                      *fzf-gitignore-contributing* + +Think you can make this plugin better? Awesome. Fork it on GitHub and create +a pull request. + +https://github.com/fszymanski/fzf-gitignore + +============================================================================== + +[1] https://github.com/junegunn/fzf +[2] https://www.gitignore.io/ +[3] https://github.com/jupl/helm-gitignore + + vim: tw=78 ts=8 ft=help norl + +endif diff --git a/ftplugin/gitignore.vim b/ftplugin/gitignore.vim new file mode 100644 index 00000000..d8cbadc5 --- /dev/null +++ b/ftplugin/gitignore.vim @@ -0,0 +1,20 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gitignore') == -1 + +scriptencoding utf-8 + +" Copyright (c) 2017-2020 Filip Szymański. All rights reserved. +" Use of this source code is governed by an MIT license that can be +" found in the LICENSE file. + +if exists('b:did_ftplugin') +  finish +endif +let b:did_ftplugin = 1 + +setlocal commentstring=#\ %s + +let b:undo_ftplugin = 'setlocal commentstring<' + +" vim: ts=2 et sw=2 + +endif diff --git a/packages.yaml b/packages.yaml index 4d9a7952..4c008303 100644 --- a/packages.yaml +++ b/packages.yaml @@ -1884,7 +1884,7 @@ filetypes:    - t  ---  name: gitignore -remote: rdolgushin/gitignore.vim +remote: fszymanski/fzf-gitignore  filetypes:  - name: gitignore    filenames: diff --git a/syntax/gitignore.vim b/syntax/gitignore.vim index f83c098b..7a1a8e9c 100644 --- a/syntax/gitignore.vim +++ b/syntax/gitignore.vim @@ -1,23 +1,33 @@  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gitignore') == -1 -" Vim syntax file -" Language:	.gitignore -" Maintainer:	Roman Dolgushin <rd@roman-dolgushin.ru> -" URL:		http://github.com/rdolgushin/gitignore.vim +scriptencoding utf-8 + +" Copyright (c) 2017-2020 Filip Szymański. All rights reserved. +" Use of this source code is governed by an MIT license that can be +" found in the LICENSE file.  if exists('b:current_syntax')    finish  endif -if !exists('main_syntax') -  let main_syntax = 'conf' -endif +" https://git-scm.com/docs/gitignore#_pattern_format +syntax keyword gitignoreTodo TODO FIXME XXX NOTE SEE contained +syntax match gitignoreComment '^#.*' contains=gitignoreTodo +syntax match gitignoreComment '\s#.*'ms=s+1 contains=gitignoreTodo +syntax match gitignoreNegation '^!' +syntax match gitignoreSeparator '/' +syntax match gitignoreWildcard '\(\\\)\@<![*?]' +syntax region gitignoreSet start='\[' skip='\\\]' end='\]' -runtime! syntax/conf.vim -unlet b:current_syntax +highlight default link gitignoreTodo Todo +highlight default link gitignoreComment Comment +highlight default link gitignoreNegation Exception +highlight default link gitignoreSeparator Constant +highlight default link gitignoreWildcard Special +highlight default link gitignoreSet Character  let b:current_syntax = 'gitignore' -setlocal commentstring=#%s +" vim: ts=2 et sw=2  endif diff --git a/tests/extensions.vim b/tests/extensions.vim index 4db1c073..3ed9306d 100644 --- a/tests/extensions.vim +++ b/tests/extensions.vim @@ -370,4 +370,4 @@ call TestExtension("htmldjango", "jinja4.html", "{# some comment #}")  call TestExtension("xhtml", "xhtml.html", "<DTD   XHTML ")  " .gitignore -call TestExtension(".gitignore", ".gitignore", "") +call TestExtension("gitignore", ".gitignore", "") | 
