summaryrefslogtreecommitdiffstats
path: root/autoload
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2020-09-25 00:07:37 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2020-09-25 00:07:37 +0200
commitd6479bbf0baeeedaa183c1f3e11679246ca20138 (patch)
tree0f9db8bc0d5e6e44db0cb78b3a879eb1a7eac08c /autoload
parentd53d2189b92ab8150753201e2e2f8cba14b8edc9 (diff)
downloadvim-polyglot-d6479bbf0baeeedaa183c1f3e11679246ca20138.tar.gz
vim-polyglot-d6479bbf0baeeedaa183c1f3e11679246ca20138.zip
Change gitignore provider
Diffstat (limited to 'autoload')
-rw-r--r--autoload/fzf_gitignore.vim41
1 files changed, 41 insertions, 0 deletions
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