mirror of
https://github.com/raimon49/requirements.txt.vim.git
synced 2025-12-06 10:04:23 +08:00
✏️ Fix a typo about shebang
This commit is contained in:
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "requirements",
|
|
||||||
"description": "the Requirements File Format syntax support for Vim",
|
|
||||||
"version": "1.8.0",
|
|
||||||
"author": "raimon",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/raimon49/requirements.txt.vim"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
""
|
""
|
||||||
" Refer $VIMRUNTIME/autoload/dist/script.vim in vim
|
" Refer https://github.com/vim/vim/blob/75e27d78f5370e7d2e0898326d9b080937e7b090/runtime/scripts.vim#L33-L71
|
||||||
" or $VIMRUNTIME/scripts.vim in neovim. When a file's shebang is like
|
"
|
||||||
" "pip install -r" or "pip-compile", set its filetype to |requirements|.
|
" When a file's shebang is "pip install -r" or "pip-compile",
|
||||||
function! requirements#scripts#shabang() abort
|
" set its filetype to |requirements|.
|
||||||
|
function! requirements#shebang() abort
|
||||||
let s:line1 = getline(1)
|
let s:line1 = getline(1)
|
||||||
|
|
||||||
if s:line1 =~# "^#!"
|
if s:line1 =~# "^#!"
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
""
|
|
||||||
" @section Configuration, config
|
|
||||||
|
|
||||||
function! s:Flag(name, default) abort
|
|
||||||
let l:scope = get(split(a:name, ':'), 0, 'g:')
|
|
||||||
let l:name = get(split(a:name, ':'), -1)
|
|
||||||
let {l:scope}:{l:name} = get({l:scope}:, l:name, a:default)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
let g:requirements#utils#plugin = {'Flag': funcref('s:Flag')}
|
|
||||||
" vim: et sw=4 ts=4 sts=4:
|
|
||||||
@@ -59,7 +59,7 @@ augroup requirements
|
|||||||
autocmd!
|
autocmd!
|
||||||
au BufNewFile,BufRead *.{txt,in} if s:isRequirementsFile() | set ft=requirements | endif
|
au BufNewFile,BufRead *.{txt,in} if s:isRequirementsFile() | set ft=requirements | endif
|
||||||
au BufNewFile,BufRead *.pip set ft=requirements
|
au BufNewFile,BufRead *.pip set ft=requirements
|
||||||
au BufNewFile,BufRead * if !did_filetype() | call requirements#scripts#shabang() | endif
|
au BufNewFile,BufRead * if !did_filetype() | call requirements#shebang() | endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" vim: et sw=4 ts=4 sts=4:
|
" vim: et sw=4 ts=4 sts=4:
|
||||||
|
|||||||
Reference in New Issue
Block a user