mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-09 03:53:52 -05:00
Change gitignore provider
This commit is contained in:
@@ -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)
|
- [fsharp](https://github.com/ionide/Ionide-vim)
|
||||||
- [gdscript](https://github.com/calviken/vim-gdscript3)
|
- [gdscript](https://github.com/calviken/vim-gdscript3)
|
||||||
- [git](https://github.com/tpope/vim-git)
|
- [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)
|
- [glsl](https://github.com/tikhomirov/vim-glsl)
|
||||||
- [gmpl](https://github.com/maelvalais/gmpl.vim)
|
- [gmpl](https://github.com/maelvalais/gmpl.vim)
|
||||||
- [gnuplot](https://github.com/vim-scripts/gnuplot-syntax-highlighting)
|
- [gnuplot](https://github.com/vim-scripts/gnuplot-syntax-highlighting)
|
||||||
|
|||||||
41
autoload/fzf_gitignore.vim
Normal file
41
autoload/fzf_gitignore.vim
Normal file
@@ -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
|
||||||
85
doc/fzf_gitignore.txt
Normal file
85
doc/fzf_gitignore.txt
Normal file
@@ -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
|
||||||
20
ftplugin/gitignore.vim
Normal file
20
ftplugin/gitignore.vim
Normal file
@@ -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
|
||||||
@@ -1884,7 +1884,7 @@ filetypes:
|
|||||||
- t
|
- t
|
||||||
---
|
---
|
||||||
name: gitignore
|
name: gitignore
|
||||||
remote: rdolgushin/gitignore.vim
|
remote: fszymanski/fzf-gitignore
|
||||||
filetypes:
|
filetypes:
|
||||||
- name: gitignore
|
- name: gitignore
|
||||||
filenames:
|
filenames:
|
||||||
|
|||||||
@@ -1,23 +1,33 @@
|
|||||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gitignore') == -1
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'gitignore') == -1
|
||||||
|
|
||||||
" Vim syntax file
|
scriptencoding utf-8
|
||||||
" Language: .gitignore
|
|
||||||
" Maintainer: Roman Dolgushin <rd@roman-dolgushin.ru>
|
" Copyright (c) 2017-2020 Filip Szymański. All rights reserved.
|
||||||
" URL: http://github.com/rdolgushin/gitignore.vim
|
" Use of this source code is governed by an MIT license that can be
|
||||||
|
" found in the LICENSE file.
|
||||||
|
|
||||||
if exists('b:current_syntax')
|
if exists('b:current_syntax')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists('main_syntax')
|
" https://git-scm.com/docs/gitignore#_pattern_format
|
||||||
let main_syntax = 'conf'
|
syntax keyword gitignoreTodo TODO FIXME XXX NOTE SEE contained
|
||||||
endif
|
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
|
highlight default link gitignoreTodo Todo
|
||||||
unlet b:current_syntax
|
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'
|
let b:current_syntax = 'gitignore'
|
||||||
|
|
||||||
setlocal commentstring=#%s
|
" vim: ts=2 et sw=2
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -370,4 +370,4 @@ call TestExtension("htmldjango", "jinja4.html", "{# some comment #}")
|
|||||||
call TestExtension("xhtml", "xhtml.html", "<DTD XHTML ")
|
call TestExtension("xhtml", "xhtml.html", "<DTD XHTML ")
|
||||||
|
|
||||||
" .gitignore
|
" .gitignore
|
||||||
call TestExtension(".gitignore", ".gitignore", "")
|
call TestExtension("gitignore", ".gitignore", "")
|
||||||
|
|||||||
Reference in New Issue
Block a user