mirror of
1
0
Fork 0

Updated plugins

This commit is contained in:
Amir 2021-10-11 11:30:43 +02:00
parent 83980d8f24
commit 92c794cc2b
100 changed files with 3555 additions and 1631 deletions

View File

@ -0,0 +1,51 @@
" Author: Roeland Moors - https://github.com/roelandmoors
" based on the ale ruumba and robocop linters
" Description: ERB Lint, support for https://github.com/Shopify/erb-lint
call ale#Set('eruby_erblint_executable', 'erblint')
call ale#Set('eruby_erblint_options', '')
function! ale_linters#eruby#erblint#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'eruby_erblint_executable')
return ale#ruby#EscapeExecutable(l:executable, 'erblint')
\ . ' --format json '
\ . ale#Var(a:buffer, 'eruby_erblint_options')
\ . ' --stdin %s'
endfunction
function! ale_linters#eruby#erblint#Handle(buffer, lines) abort
if empty(a:lines)
return []
endif
let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], [])
if !has_key(l:errors, 'summary')
\|| l:errors['summary']['offenses'] == 0
\|| empty(l:errors['files'])
return []
endif
let l:output = []
for l:error in l:errors['files'][0]['offenses']
call add(l:output, {
\ 'lnum': l:error['location']['start_line'] + 0,
\ 'col': l:error['location']['start_column'] + 0,
\ 'end_col': l:error['location']['last_column'] + 0,
\ 'code': l:error['linter'],
\ 'text': l:error['message'],
\ 'type': 'W',
\})
endfor
return l:output
endfunction
call ale#linter#Define('eruby', {
\ 'name': 'erblint',
\ 'executable': {b -> ale#Var(b, 'eruby_erblint_executable')},
\ 'command': function('ale_linters#eruby#erblint#GetCommand'),
\ 'callback': 'ale_linters#eruby#erblint#Handle',
\})

View File

@ -0,0 +1,11 @@
" Author: Arnold Chand <creativenull@outlook.com>
" Description: Deno lsp linter for JavaScript files.
call ale#linter#Define('javascript', {
\ 'name': 'deno',
\ 'lsp': 'stdio',
\ 'executable': function('ale#handlers#deno#GetExecutable'),
\ 'command': '%e lsp',
\ 'project_root': function('ale#handlers#deno#GetProjectRoot'),
\ 'initialization_options': function('ale#handlers#deno#GetInitializationOptions'),
\})

View File

@ -0,0 +1,16 @@
" Author: João Pesce <joao@pesce.cc>
" Description: eslint for JSON files.
"
" Requires eslint-plugin-jsonc or a similar plugin to work
"
" Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp
" <devw0rp@gmail.com>
call ale#linter#Define('json', {
\ 'name': 'eslint',
\ 'output_stream': 'both',
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
\ 'cwd': function('ale#handlers#eslint#GetCwd'),
\ 'command': function('ale#handlers#eslint#GetCommand'),
\ 'callback': 'ale#handlers#eslint#HandleJSON',
\})

View File

@ -0,0 +1,16 @@
" Author: João Pesce <joao@pesce.cc>
" Description: eslint for JSON5 files.
"
" Requires eslint-plugin-jsonc or a similar plugin to work
"
" Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp
" <devw0rp@gmail.com>
call ale#linter#Define('json5', {
\ 'name': 'eslint',
\ 'output_stream': 'both',
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
\ 'cwd': function('ale#handlers#eslint#GetCwd'),
\ 'command': function('ale#handlers#eslint#GetCommand'),
\ 'callback': 'ale#handlers#eslint#HandleJSON',
\})

View File

@ -0,0 +1,16 @@
" Author: João Pesce <joao@pesce.cc>
" Description: eslint for JSONC files.
"
" Requires eslint-plugin-jsonc or a similar plugin to work
"
" Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp
" <devw0rp@gmail.com>
call ale#linter#Define('jsonc', {
\ 'name': 'eslint',
\ 'output_stream': 'both',
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
\ 'cwd': function('ale#handlers#eslint#GetCwd'),
\ 'command': function('ale#handlers#eslint#GetCommand'),
\ 'callback': 'ale#handlers#eslint#HandleJSON',
\})

View File

@ -0,0 +1,59 @@
" Author: Trevor Whitney <trevorjwhitney@gmail.com>
" Description: jsonnet-lint for jsonnet files
call ale#Set('jsonnet_jsonnet_lint_executable', 'jsonnet-lint')
call ale#Set('jsonnet_jsonnet_lint_options', '')
function! ale_linters#jsonnet#jsonnet_lint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'jsonnet_jsonnet_lint_options')
return '%e'
\ . ale#Pad(l:options)
\ . ' %t'
endfunction
function! ale_linters#jsonnet#jsonnet_lint#Handle(buffer, lines) abort
" Matches patterns line the following:
"
" ERROR: foo.jsonnet:22:3-12 expected token OPERATOR but got (IDENTIFIER, "bar")
" ERROR: hoge.jsonnet:20:3 unexpected: "}" while parsing terminal
" ERROR: main.jsonnet:212:1-14 Expected , or ; but got (IDENTIFIER, "older_cluster")
let l:pattern = '^ERROR: [^:]*:\(\d\+\):\(\d\+\)\(-\d\+\)* \(.*\)'
let l:output = []
for l:line in a:lines
let l:match = matchlist(l:line, l:pattern)
if len(l:match) == 0
continue
endif
let line_number = l:match[1] + 0
let column = l:match[2] + 0
" l:match[3] has optional -14, when linter is showing a range
let text = l:match[4]
" vcol is Needed to indicate that the column is a character.
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': line_number,
\ 'vcol': 0,
\ 'col': column,
\ 'text': text,
\ 'type': 'E',
\ 'nr': -1,
\})
endfor
return l:output
endfunction
call ale#linter#Define('jsonnet', {
\ 'name': 'jsonnet_lint',
\ 'output_stream': 'stderr',
\ 'executable': {b -> ale#Var(b, 'jsonnet_jsonnet_lint_executable')},
\ 'command': function('ale_linters#jsonnet#jsonnet_lint#GetCommand'),
\ 'callback': 'ale_linters#jsonnet#jsonnet_lint#Handle',
\})

View File

@ -0,0 +1,52 @@
" Authors: Trevor Whitney <trevorjwhitney@gmail.com> and Takuya Kosugiyama <re@itkq.jp>
" Description: jsonnetfmt for jsonnet files
call ale#Set('jsonnet_jsonnetfmt_executable', 'jsonnetfmt')
call ale#Set('jsonnet_jsonnetfmt_options', '')
function! ale_linters#jsonnet#jsonnetfmt#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_options')
return '%e'
\ . ale#Pad(l:options)
\ . ' %t'
endfunction
function! ale_linters#jsonnet#jsonnetfmt#Handle(buffer, lines) abort
" Matches patterns line the following:
"
" STATIC ERROR: foo.jsonnet:22:3-12: expected token OPERATOR but got (IDENTIFIER, "bar")
" STATIC ERROR: hoge.jsonnet:20:3: unexpected: "}" while parsing terminal
let l:pattern = '^STATIC ERROR:[^:]*:\(\d\+\):\(\d\+\):*\(-\d\+\)* \(.*\)'
let l:output = []
for l:line in a:lines
let l:match = matchlist(l:line, l:pattern)
if len(l:match) == 0
continue
endif
" vcol is Needed to indicate that the column is a character.
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
\ 'vcol': 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[4],
\ 'type': 'E',
\ 'nr': -1,
\})
endfor
return l:output
endfunction
call ale#linter#Define('jsonnet', {
\ 'name': 'jsonnetfmt',
\ 'output_stream': 'stderr',
\ 'executable': {b -> ale#Var(b, 'jsonnet_jsonnetfmt_executable')},
\ 'command': function('ale_linters#jsonnet#jsonnetfmt#GetCommand'),
\ 'callback': 'ale_linters#jsonnet#jsonnetfmt#Handle',
\})

View File

@ -1,4 +1,4 @@
" Author: Vincent (wahrwolf [ät] wolfpit.net)
" Author: Vincent (wahrwolf [at] wolfpit.net)
" Description: languagetool for mails

View File

@ -1,4 +1,4 @@
" Author: Vincent (wahrwolf [ät] wolfpit.net)
" Author: Vincent (wahrwolf [at] wolfpit.net)
" Description: languagetool for markdown files

View File

@ -0,0 +1,175 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: flakehell for python files
call ale#Set('python_flakehell_executable', 'flakehell')
call ale#Set('python_flakehell_options', '')
call ale#Set('python_flakehell_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_flakehell_change_directory', 'project')
call ale#Set('python_flakehell_auto_pipenv', 0)
call ale#Set('python_flakehell_auto_poetry', 0)
function! s:UsingModule(buffer) abort
return ale#Var(a:buffer, 'python_flakehell_executable') is? 'python'
endfunction
function! ale_linters#python#flakehell#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_flakehell_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_flakehell_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if !s:UsingModule(a:buffer)
return ale#python#FindExecutable(a:buffer, 'python_flakehell', ['flakehell'])
endif
return ale#Var(a:buffer, 'python_flakehell_executable')
endfunction
function! ale_linters#python#flakehell#RunWithVersionCheck(buffer) abort
let l:executable = ale_linters#python#flakehell#GetExecutable(a:buffer)
let l:module_string = s:UsingModule(a:buffer) ? ' -m flakehell' : ''
let l:command = ale#Escape(l:executable) . l:module_string . ' --version'
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ l:executable,
\ l:command,
\ function('ale_linters#python#flakehell#GetCommand'),
\)
endfunction
function! ale_linters#python#flakehell#GetCwd(buffer) abort
let l:change_directory = ale#Var(a:buffer, 'python_flakehell_change_directory')
let l:cwd = ''
if l:change_directory is# 'project'
let l:project_root = ale#python#FindProjectRootIni(a:buffer)
if !empty(l:project_root)
let l:cwd = l:project_root
endif
endif
if (l:change_directory is# 'project' && empty(l:cwd))
\|| l:change_directory is# 1
\|| l:change_directory is# 'file'
let l:cwd = '%s:h'
endif
return l:cwd
endfunction
function! ale_linters#python#flakehell#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#flakehell#GetExecutable(a:buffer)
if (l:executable =~? 'pipenv\|poetry$')
let l:exec_args = ' run flakehell'
elseif (l:executable is? 'python')
let l:exec_args = ' -m flakehell'
else
let l:exec_args = ''
endif
" Only include the --stdin-display-name argument if we can parse the
" flakehell version, and it is recent enough to support it.
let l:display_name_args = ale#semver#GTE(a:version, [0, 8, 0])
\ ? ' --stdin-display-name %s'
\ : ''
let l:options = ale#Var(a:buffer, 'python_flakehell_options')
return ale#Escape(l:executable)
\ . l:exec_args
\ . (!empty(l:options) ? ' lint ' . l:options : ' lint')
\ . ' --format=default'
\ . l:display_name_args . ' -'
endfunction
let s:end_col_pattern_map = {
\ 'F405': '\(.\+\) may be undefined',
\ 'F821': 'undefined name ''\([^'']\+\)''',
\ 'F999': '^''\([^'']\+\)''',
\ 'F841': 'local variable ''\([^'']\+\)''',
\}
function! ale_linters#python#flakehell#Handle(buffer, lines) abort
let l:output = ale#python#HandleTraceback(a:lines, 10)
if !empty(l:output)
return l:output
endif
" Matches patterns line the following:
"
" Matches patterns line the following:
"
" stdin:6:6: E111 indentation is not a multiple of four
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):?(\d+)?: ([[:alnum:]]+):? (.*)$'
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:code = l:match[3]
if (l:code is# 'W291' || l:code is# 'W293')
\ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
" Skip warnings for trailing whitespace if the option is off.
continue
endif
if l:code is# 'W391'
\&& !ale#Var(a:buffer, 'warn_about_trailing_blank_lines')
" Skip warnings for trailing blank lines if the option is off
continue
endif
let l:item = {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'vcol': 1,
\ 'text': l:match[4],
\ 'code': l:code,
\ 'type': 'W',
\}
if l:code[:0] is# 'F'
if l:code isnot# 'F401'
let l:item.type = 'E'
endif
elseif l:code[:0] is# 'E'
let l:item.type = 'E'
if l:code isnot# 'E999' && l:code isnot# 'E112'
let l:item.sub_type = 'style'
endif
elseif l:code[:0] is# 'W'
let l:item.sub_type = 'style'
endif
let l:end_col_pattern = get(s:end_col_pattern_map, l:code, '')
if !empty(l:end_col_pattern)
let l:end_col_match = matchlist(l:match[4], l:end_col_pattern)
if !empty(l:end_col_match)
let l:item.end_col = l:item.col + len(l:end_col_match[1]) - 1
endif
endif
call add(l:output, l:item)
endfor
return l:output
endfunction
call ale#linter#Define('python', {
\ 'name': 'flakehell',
\ 'executable': function('ale_linters#python#flakehell#GetExecutable'),
\ 'cwd': function('ale_linters#python#flakehell#GetCwd'),
\ 'command': function('ale_linters#python#flakehell#RunWithVersionCheck'),
\ 'callback': 'ale_linters#python#flakehell#Handle',
\})

View File

@ -22,14 +22,17 @@ endfunction
function! ale_linters#python#pyre#GetCommand(buffer) abort
let l:executable = ale_linters#python#pyre#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
\ ? ' run pyre persistent'
\ : ' persistent'
let l:exec_args = (l:executable =~? 'pipenv\|poetry$' ? ' run pyre' : '') . ' persistent'
return ale#Escape(l:executable) . l:exec_args
endfunction
function! ale_linters#python#pyre#GetCwd(buffer) abort
let l:local_config = ale#path#FindNearestFile(a:buffer, '.pyre_configuration.local')
return fnamemodify(l:local_config, ':h')
endfunction
call ale#linter#Define('python', {
\ 'name': 'pyre',
\ 'lsp': 'stdio',
@ -37,4 +40,5 @@ call ale#linter#Define('python', {
\ 'command': function('ale_linters#python#pyre#GetCommand'),
\ 'project_root': function('ale#python#FindProjectRoot'),
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
\ 'cwd': function('ale_linters#python#pyre#GetCwd'),
\})

View File

@ -0,0 +1,46 @@
" Author: Samuel Branisa <branisa.samuel@icloud.com>
" Description: rflint linting for robot framework files
call ale#Set('robot_rflint_executable', 'rflint')
function! ale_linters#robot#rflint#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'robot_rflint_executable')
endfunction
function! ale_linters#robot#rflint#GetCommand(buffer) abort
let l:executable = ale_linters#robot#rflint#GetExecutable(a:buffer)
let l:flags = '--format'
\ . ' "{filename}:{severity}:{linenumber}:{char}:{rulename}:{message}"'
return l:executable
\ . ' '
\ . l:flags
\ . ' %s'
endfunction
function! ale_linters#robot#rflint#Handle(buffer, lines) abort
let l:pattern = '\v^([[:alnum:][:punct:]]+):(W|E):([[:digit:]]+):([[:digit:]]+):([[:alnum:]]+):(.*)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'filename': l:match[1],
\ 'type': l:match[2],
\ 'lnum': str2nr(l:match[3]),
\ 'col': str2nr(l:match[4]),
\ 'text': l:match[5],
\ 'detail': l:match[6],
\})
endfor
return l:output
endfunction
call ale#linter#Define('robot', {
\ 'name': 'rflint',
\ 'executable': function('ale_linters#robot#rflint#GetExecutable'),
\ 'command': function('ale_linters#robot#rflint#GetCommand'),
\ 'callback': 'ale_linters#robot#rflint#Handle',
\})

View File

@ -13,9 +13,9 @@ endfunction
function! ale_linters#thrift#thriftcheck#Handle(buffer, lines) abort
" Matches lines like the following:
"
" file.thrift:1:1:error: "py" namespace must match "^idl\\." (namespace.pattern)
" file.thrift:3:5:warning: 64-bit integer constant -2147483649 may not work in all languages (int.64bit)
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):(\l+): (.*) \((.*)\)$'
" file.thrift:1:1: error: "py" namespace must match "^idl\\." (namespace.pattern)
" file.thrift:3:5: warning: 64-bit integer constant -2147483649 may not work in all languages (int.64bit)
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+): ?([^:]+): (.+) \(([^\)]+)\)$'
let l:output = []

View File

@ -28,7 +28,7 @@ endfunction
call ale#linter#Define('yaml', {
\ 'name': 'circleci',
\ 'executable': {b -> expand('#' . b . ':p') =~? '\.circleci' ? 'circleci' : ''},
\ 'command': 'circleci config validate - < %s',
\ 'command': 'circleci --skip-update-check config validate - < %s',
\ 'callback': 'ale_linters#yaml#circleci#Handle',
\ 'output_stream': 'stderr',
\ 'lint_file': 1,

View File

@ -201,6 +201,14 @@ function! ale#codefix#ApplyLSPCodeAction(data, item) abort
\ l:command.arguments,
\)
let l:request_id = ale#lsp#Send(a:data.connection_id, l:message)
elseif has_key(a:item, 'command') && has_key(a:item, 'arguments')
\&& type(a:item.command) == v:t_string
let l:message = ale#lsp#message#ExecuteCommand(
\ a:item.command,
\ a:item.arguments,
\)
let l:request_id = ale#lsp#Send(a:data.connection_id, l:message)
elseif has_key(a:item, 'edit') || has_key(a:item, 'arguments')
if has_key(a:item, 'edit')
@ -299,7 +307,7 @@ function! ale#codefix#HandleLSPResponse(conn_id, response) abort
endif
endfunction
function! s:FindError(buffer, line, column, end_line, end_column) abort
function! s:FindError(buffer, line, column, end_line, end_column, linter_name) abort
let l:nearest_error = v:null
if a:line == a:end_line
@ -308,7 +316,9 @@ function! s:FindError(buffer, line, column, end_line, end_column) abort
let l:nearest_error_diff = -1
for l:error in get(g:ale_buffer_info[a:buffer], 'loclist', [])
if has_key(l:error, 'code') && l:error.lnum == a:line
if has_key(l:error, 'code')
\ && (a:linter_name is v:null || l:error.linter_name is# a:linter_name)
\ && l:error.lnum == a:line
let l:diff = abs(l:error.col - a:column)
if l:nearest_error_diff == -1 || l:diff < l:nearest_error_diff
@ -341,7 +351,7 @@ function! s:OnReady(
if a:linter.lsp is# 'tsserver'
let l:nearest_error =
\ s:FindError(l:buffer, a:line, a:column, a:end_line, a:end_column)
\ s:FindError(l:buffer, a:line, a:column, a:end_line, a:end_column, a:linter.lsp)
if l:nearest_error isnot v:null
let l:message = ale#lsp#tsserver_message#GetCodeFixes(
@ -368,7 +378,7 @@ function! s:OnReady(
let l:diagnostics = []
let l:nearest_error =
\ s:FindError(l:buffer, a:line, a:column, a:end_line, a:end_column)
\ s:FindError(l:buffer, a:line, a:column, a:end_line, a:end_column, v:null)
if l:nearest_error isnot v:null
let l:diagnostics = [

View File

@ -1001,12 +1001,11 @@ endfunction
function! ale#completion#HandleUserData(completed_item) abort
let l:user_data_json = get(a:completed_item, 'user_data', '')
let l:user_data = !empty(l:user_data_json)
\ ? ale#util#FuzzyJSONDecode(l:user_data_json, v:null)
\ : v:null
let l:user_data = type(l:user_data_json) is v:t_dict
\ ? l:user_data_json
\ : ale#util#FuzzyJSONDecode(l:user_data_json, {})
if type(l:user_data) isnot v:t_dict
\|| get(l:user_data, '_ale_completion_item', 0) isnot 1
if !has_key(l:user_data, '_ale_completion_item')
return
endif

View File

@ -246,6 +246,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['go'],
\ 'description': 'Fix Go files imports with goimports.',
\ },
\ 'golines': {
\ 'function': 'ale#fixers#golines#Fix',
\ 'suggested_filetypes': ['go'],
\ 'description': 'Fix Go file long lines with golines',
\ },
\ 'gomod': {
\ 'function': 'ale#fixers#gomod#Fix',
\ 'suggested_filetypes': ['gomod'],
@ -301,6 +306,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['haskell'],
\ 'description': 'Refactor Haskell files with stylish-haskell.',
\ },
\ 'purs-tidy': {
\ 'function': 'ale#fixers#purs_tidy#Fix',
\ 'suggested_filetypes': ['purescript'],
\ 'description': 'Format PureScript files with purs-tidy.',
\ },
\ 'purty': {
\ 'function': 'ale#fixers#purty#Fix',
\ 'suggested_filetypes': ['purescript'],
@ -386,6 +396,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['dart'],
\ 'description': 'Fix Dart files with dart format.',
\ },
\ 'dotnet-format': {
\ 'function': 'ale#fixers#dotnet_format#Fix',
\ 'suggested_filetypes': ['cs'],
\ 'description': 'Fix C# files with dotnet format.',
\ },
\ 'xmllint': {
\ 'function': 'ale#fixers#xmllint#Fix',
\ 'suggested_filetypes': ['xml'],
@ -471,6 +486,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['haskell'],
\ 'description': 'A formatter for Haskell source code.',
\ },
\ 'jsonnetfmt': {
\ 'function': 'ale#fixers#jsonnetfmt#Fix',
\ 'suggested_filetypes': ['jsonnet'],
\ 'description': 'Fix jsonnet files with jsonnetfmt',
\ },
\ 'ptop': {
\ 'function': 'ale#fixers#ptop#Fix',
\ 'suggested_filetypes': ['pascal'],

View File

@ -1,14 +1,11 @@
" Author: toastal <toastal@protonmail.com>
" Author: toastal <toastal@posteo.net>
" Description: Dhalls built-in formatter
"
function! ale#fixers#dhall_format#Fix(buffer) abort
let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer)
let l:command = l:executable
\ . ' format'
\ . ' --inplace %t'
return {
\ 'command': l:command,
\ 'read_temporary_file': 1,
\ 'command': l:executable
\ . ' format'
\}
endfunction

View File

@ -1,18 +1,14 @@
" Author: toastal <toastal@protonmail.com>
" Author: toastal <toastal@posteo.net>
" Description: Dhalls package freezing
call ale#Set('dhall_freeze_options', '')
function! ale#fixers#dhall_freeze#Freeze(buffer) abort
let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer)
let l:command = l:executable
\ . ' freeze'
\ . ale#Pad(ale#Var(a:buffer, 'dhall_freeze_options'))
\ . ' --inplace %t'
return {
\ 'command': l:command,
\ 'read_temporary_file': 1,
\ 'command': l:executable
\ . ' freeze'
\ . ale#Pad(ale#Var(a:buffer, 'dhall_freeze_options'))
\}
endfunction

View File

@ -1,14 +1,11 @@
" Author: toastal <toastal@protonmail.com>
" Author: toastal <toastal@posteo.net>
" Description: Dhalls built-in linter/formatter
function! ale#fixers#dhall_lint#Fix(buffer) abort
let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer)
let l:command = l:executable
\ . ' lint'
\ . ' --inplace %t'
return {
\ 'command': l:command,
\ 'read_temporary_file': 1,
\ 'command': l:executable
\ . ' lint'
\}
endfunction

View File

@ -0,0 +1,18 @@
" Author: ghsang <gwonhyuksang@gmail.com>
" Description: Integration of dotnet format with ALE.
call ale#Set('cs_dotnet_format_executable', 'dotnet')
call ale#Set('cs_dotnet_format_options', '')
function! ale#fixers#dotnet_format#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'cs_dotnet_format_executable')
let l:options = ale#Var(a:buffer, 'cs_dotnet_format_options')
return {
\ 'command': ale#Escape(l:executable)
\ . ' format'
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' --folder --include %t "$(dirname %t)"',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@ -0,0 +1,21 @@
" Author Pig Frown <pigfrown@protonmail.com>
" Description: Fix Go files long lines with golines"
call ale#Set('go_golines_executable', 'golines')
call ale#Set('go_golines_options', '')
function! ale#fixers#golines#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'go_golines_executable')
let l:options = ale#Var(a:buffer, 'go_golines_options')
let l:env = ale#go#EnvString(a:buffer)
if !executable(l:executable)
return 0
endif
return {
\ 'command': l:env . ale#Escape(l:executable)
\ . (empty(l:options) ? '' : ' ' . l:options)
\}
endfunction

View File

@ -5,6 +5,7 @@ call ale#Set('python_isort_executable', 'isort')
call ale#Set('python_isort_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_isort_options', '')
call ale#Set('python_isort_auto_pipenv', 0)
call ale#Set('python_isort_auto_poetry', 0)
function! ale#fixers#isort#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_isort_auto_pipenv'))
@ -12,24 +13,34 @@ function! ale#fixers#isort#GetExecutable(buffer) abort
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_isort_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
return ale#python#FindExecutable(a:buffer, 'python_isort', ['isort'])
endfunction
function! ale#fixers#isort#Fix(buffer) abort
let l:options = ale#Var(a:buffer, 'python_isort_options')
let l:executable = ale#fixers#isort#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv$'
\ ? ' run isort'
\ : ''
let l:cmd = [ale#Escape(l:executable)]
if !executable(l:executable) && l:executable isnot# 'pipenv'
return 0
if l:executable =~? 'pipenv\|poetry$'
call extend(l:cmd, ['run', 'isort'])
endif
call add(l:cmd, '--filename %s')
let l:options = ale#Var(a:buffer, 'python_isort_options')
if !empty(l:options)
call add(l:cmd, l:options)
endif
call add(l:cmd, '-')
return {
\ 'cwd': '%s:h',
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . ale#Pad('--filename %s')
\ . (!empty(l:options) ? ' ' . l:options : '') . ' -',
\ 'command': join(l:cmd, ' ')
\}
endfunction

View File

@ -0,0 +1,18 @@
" Authors: Trevor Whitney <trevorjwhitney@gmail.com> and Takuya Kosugiyama <re@itkq.jp>
" Description: Integration of jsonnetfmt with ALE.
call ale#Set('jsonnet_jsonnetfmt_executable', 'jsonnetfmt')
call ale#Set('jsonnet_jsonnetfmt_options', '')
function! ale#fixers#jsonnetfmt#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_executable')
let l:options = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_options')
return {
\ 'command': ale#Escape(l:executable)
\ . ' -i'
\ . ale#Pad(l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@ -0,0 +1,24 @@
" Author: toastal <toastal@posteo.net>
" Description: Integration of purs-tidy with ALE.
call ale#Set('purescript_tidy_executable', 'purs-tidy')
call ale#Set('purescript_tidy_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('purescript_tidy_options', '')
function! ale#fixers#purs_tidy#GetExecutable(buffer) abort
return ale#path#FindExecutable(a:buffer, 'purescript_tidy', [
\ 'node_modules/purescript-tidy/bin/index.js',
\ 'node_modules/.bin/purs-tidy',
\])
endfunction
function! ale#fixers#purs_tidy#Fix(buffer) abort
let l:executable = ale#fixers#purs_tidy#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'purescript_tidy_options')
return {
\ 'command': ale#Escape(l:executable)
\ . ' format'
\ . ale#Pad(l:options)
\}
endfunction

View File

@ -21,12 +21,10 @@ endfunction
function! ale#fixers#rubocop#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable')
let l:config = ale#path#FindNearestFile(a:buffer, '.rubocop.yml')
let l:options = ale#Var(a:buffer, 'ruby_rubocop_options')
let l:auto_correct_all = ale#Var(a:buffer, 'ruby_rubocop_auto_correct_all')
return ale#ruby#EscapeExecutable(l:executable, 'rubocop')
\ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '')
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . (l:auto_correct_all ? ' --auto-correct-all' : ' --auto-correct')
\ . ' --force-exclusion --stdin %s'

View File

@ -43,21 +43,25 @@ endfunction
function! ale#handlers#cppcheck#HandleCppCheckFormat(buffer, lines) abort
" Look for lines like the following.
"
"test.cpp:974:6: error: Array 'n[3]' accessed at index 3, which is out of bounds. [arrayIndexOutOfBounds]\
"test.cpp:974:6: error:inconclusive Array 'n[3]' accessed at index 3, which is out of bounds. [arrayIndexOutOfBounds]\
" n[3]=3;
" ^
let l:pattern = '\v^(\f+):(\d+):(\d+): (\w+): (.*) \[(\w+)\]\'
"" OR if cppcheck doesn't support {column} or {inconclusive:text}:
"test.cpp:974:{column}: error:{inconclusive:inconclusive} Array 'n[3]' accessed at index 3, which is out of bounds. [arrayIndexOutOfBounds]\
" n[3]=3;
" ^
let l:pattern = '\v(\f+):(\d+):(\d+|\{column\}): (\w+):(\{inconclusive:inconclusive\})? ?(.*) \[(\w+)\]\'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
if ale#path#IsBufferPath(a:buffer, l:match[1])
call add(l:output, {
\ 'lnum': str2nr(l:match[2]),
\ 'col': str2nr(l:match[3]),
\ 'col': match(l:match[3],'{column}') >= 0 ? 1 : str2nr(l:match[3]),
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
\ 'sub_type': l:match[4] is# 'style' ? 'style' : '',
\ 'text': l:match[5],
\ 'code': l:match[6]
\ 'text': l:match[6],
\ 'code': l:match[7]
\})
endif
endfor

View File

@ -56,19 +56,19 @@ function! ale#handlers#sml#Handle(buffer, lines) abort
" Try to match basic sml errors
" TODO(jez) We can get better errorfmt strings from Syntastic
let l:out = []
let l:pattern = '^.*\:\([0-9\.]\+\)\ \(\w\+\)\:\ \(.*\)'
let l:pattern2 = '^.*\:\([0-9]\+\)\.\?\([0-9]\+\).* \(\(Warning\|Error\): .*\)'
let l:pattern = '^\(.*\)\:\([0-9\.]\+\)\ \(\w\+\)\:\ \(.*\)'
let l:pattern2 = '^\(.*\)\:\([0-9]\+\)\.\?\([0-9]\+\).* \(\(Warning\|Error\): .*\)'
for l:line in a:lines
let l:match2 = matchlist(l:line, l:pattern2)
if len(l:match2) != 0
call add(l:out, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match2[1] + 0,
\ 'col' : l:match2[2] - 1,
\ 'text': l:match2[3],
\ 'type': l:match2[3] =~# '^Warning' ? 'W' : 'E',
\ 'filename': l:match2[1],
\ 'lnum': l:match2[2] + 0,
\ 'col' : l:match2[3] - 1,
\ 'text': l:match2[4],
\ 'type': l:match2[4] =~# '^Warning' ? 'W' : 'E',
\})
continue
@ -78,10 +78,10 @@ function! ale#handlers#sml#Handle(buffer, lines) abort
if len(l:match) != 0
call add(l:out, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[1] + 0,
\ 'text': l:match[2] . ': ' . l:match[3],
\ 'type': l:match[2] is# 'error' ? 'E' : 'W',
\ 'filename': l:match[1],
\ 'lnum': l:match[2] + 0,
\ 'text': l:match[3] . ': ' . l:match[4],
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
\})
continue
endif

View File

@ -45,7 +45,9 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort
\&& (l:set_balloons is 1 || l:set_balloons is# 'hover')
call balloon_show(a:response.body.displayString)
elseif get(l:options, 'truncated_echo', 0)
call ale#cursor#TruncatedEcho(split(a:response.body.displayString, "\n")[0])
if !empty(a:response.body.displayString)
call ale#cursor#TruncatedEcho(split(a:response.body.displayString, "\n")[0])
endif
elseif g:ale_hover_to_floating_preview || g:ale_floating_preview
call ale#floating_preview#Show(split(a:response.body.displayString, "\n"), {
\ 'filetype': 'ale-preview.message',

View File

@ -45,6 +45,7 @@ function! ale#lsp#Register(executable_or_address, project, init_options) abort
\ 'typeDefinition': 0,
\ 'symbol_search': 0,
\ 'code_actions': 0,
\ 'includeText': 0,
\ },
\}
endif
@ -263,6 +264,20 @@ function! s:UpdateCapabilities(conn, capabilities) abort
if type(get(a:capabilities, 'workspaceSymbolProvider')) is v:t_dict
let a:conn.capabilities.symbol_search = 1
endif
if has_key(a:capabilities, 'textDocumentSync')
if type(a:capabilities.textDocumentSync) is v:t_dict
let l:save = get(a:capabilities.textDocumentSync, 'save', v:false)
if type(l:save) is v:true
let a:conn.capabilities.includeText = 1
endif
if type(l:save) is v:t_dict && get(a:capabilities.textDocumentSync.save, 'includeText', v:false) is v:true
let a:conn.capabilities.includeText = 1
endif
endif
endif
endfunction
" Update a connection's configuration dictionary and notify LSP servers

View File

@ -77,12 +77,19 @@ function! ale#lsp#message#DidChange(buffer) abort
\}]
endfunction
function! ale#lsp#message#DidSave(buffer) abort
return [1, 'textDocument/didSave', {
function! ale#lsp#message#DidSave(buffer, includeText) abort
let l:response = [1, 'textDocument/didSave', {
\ 'textDocument': {
\ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')),
\ },
\}]
if a:includeText
let l:response[2].textDocument.version = ale#lsp#message#GetNextVersionID()
let l:response[2].text = ale#util#GetBufferContents(a:buffer)
endif
return l:response
endfunction
function! ale#lsp#message#DidClose(buffer) abort

View File

@ -271,6 +271,30 @@ function! ale#lsp_linter#OnInit(linter, details, Callback) abort
call ale#lsp#NotifyForChanges(l:conn_id, l:buffer)
endif
" Tell the relevant buffer that the LSP has started via an autocmd.
if l:buffer > 0
if l:buffer == bufnr('')
silent doautocmd <nomodeline> User ALELSPStarted
else
execute 'augroup ALELSPStartedGroup' . l:buffer
autocmd!
execute printf(
\ 'autocmd BufEnter <buffer=%d>'
\ . ' doautocmd <nomodeline> User ALELSPStarted',
\ l:buffer
\)
" Replicate ++once behavior for backwards compatibility.
execute printf(
\ 'autocmd BufEnter <buffer=%d>'
\ . ' autocmd! ALELSPStartedGroup%d',
\ l:buffer, l:buffer
\)
augroup END
endif
endif
call a:Callback(a:linter, a:details)
endfunction
@ -442,7 +466,8 @@ function! s:CheckWithLSP(linter, details) abort
" If this was a file save event, also notify the server of that.
if a:linter.lsp isnot# 'tsserver'
\&& getbufvar(l:buffer, 'ale_save_event_fired', 0)
let l:save_message = ale#lsp#message#DidSave(l:buffer)
let l:include_text = ale#lsp#HasCapability(l:buffer, 'includeText')
let l:save_message = ale#lsp#message#DidSave(l:buffer, l:include_text)
let l:notified = ale#lsp#Send(l:id, l:save_message) != 0
endif
endfunction

View File

@ -24,6 +24,7 @@ function! ale#python#FindProjectRootIni(buffer) abort
\|| filereadable(l:path . '/setup.cfg')
\|| filereadable(l:path . '/pytest.ini')
\|| filereadable(l:path . '/tox.ini')
\|| filereadable(l:path . '/.pyre_configuration.local')
\|| filereadable(l:path . '/mypy.ini')
\|| filereadable(l:path . '/pycodestyle.cfg')
\|| filereadable(l:path . '/.flake8')

View File

@ -535,3 +535,7 @@ function! ale#util#SetBufferContents(buffer, lines) abort
return l:new_lines
endfunction
function! ale#util#GetBufferContents(buffer) abort
return join(getbufline(a:buffer, 1, '$'), '\n') . '\n'
endfunction

View File

@ -7,9 +7,15 @@ scriptencoding utf-8
let g:ale_virtualtext_delay = get(g:, 'ale_virtualtext_delay', 10)
let s:cursor_timer = -1
let s:last_pos = [0, 0, 0]
let s:has_virt_text = 0
if has('nvim-0.3.2')
let s:ns_id = nvim_create_namespace('ale')
let s:has_virt_text = 1
elseif has('textprop') && has('popupwin')
call prop_type_add('ale', {})
let s:last_popup = -1
let s:has_virt_text = 1
endif
if !hlexists('ALEVirtualTextError')
@ -33,17 +39,25 @@ if !hlexists('ALEVirtualTextInfo')
endif
function! ale#virtualtext#Clear() abort
if !has('nvim-0.3.2')
if !s:has_virt_text
return
endif
let l:buffer = bufnr('')
call nvim_buf_clear_highlight(l:buffer, s:ns_id, 0, -1)
if has('nvim')
call nvim_buf_clear_highlight(l:buffer, s:ns_id, 0, -1)
else
if s:last_popup != -1
call prop_remove({'type': 'ale'})
call popup_close(s:last_popup)
let s:last_popup = -1
endif
endif
endfunction
function! ale#virtualtext#ShowMessage(message, hl_group) abort
if !has('nvim-0.3.2')
if !s:has_virt_text
return
endif
@ -51,7 +65,24 @@ function! ale#virtualtext#ShowMessage(message, hl_group) abort
let l:buffer = bufnr('')
let l:prefix = get(g:, 'ale_virtualtext_prefix', '> ')
call nvim_buf_set_virtual_text(l:buffer, s:ns_id, l:line-1, [[l:prefix.a:message, a:hl_group]], {})
if has('nvim')
call nvim_buf_set_virtual_text(l:buffer, s:ns_id, l:line-1, [[l:prefix.a:message, a:hl_group]], {})
else
let l:left_pad = col('$')
call prop_add(l:line, l:left_pad, {
\ 'type': 'ale',
\})
let s:last_popup = popup_create(l:prefix.a:message, {
\ 'line': -1,
\ 'padding': [0, 0, 0, 1],
\ 'mask': [[1, 1, 1, 1]],
\ 'textprop': 'ale',
\ 'highlight': a:hl_group,
\ 'fixed': 1,
\ 'wrap': 0,
\ 'zindex': 2
\})
endif
endfunction
function! s:StopCursorTimer() abort

View File

@ -90,6 +90,39 @@ g:ale_cs_csc_assemblies *g:ale_cs_csc_assemblies*
\]
<
===============================================================================
dotnet-format *ale-cs-dotnet-format*
Installation
-------------------------------------------------------------------------------
Installing .NET SDK should probably ensure that `dotnet` is in your `$PATH`.
For .NET 6 the `dotnet format` tool is already included in the .NET SDK. For
.NET 5 or below you will have to manually install it using the instructions
from listed in this repository: https://github.com/dotnet/format
Options
-------------------------------------------------------------------------------
g:ale_cs_dotnet_format_executable *g:ale_cs_dotnet_format_executable*
*b:ale_cs_dotnet_format_executable*
Type: |String|
Default: `'dotnet'`
This variable can be set to specify an absolute path to the
`dotnet` executable (or to specify an alternate executable).
g:ale_cs_dotnet_format_options *g:ale_cs_dotnet_format_options*
*b:ale_cs_dotnet_format_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to the `dotnet format`
fixer.
===============================================================================
mcs *ale-cs-mcs*

View File

@ -156,7 +156,8 @@ environments.
2. Vim 8.2.2401 on Linux via GitHub Actions.
3. NeoVim 0.2.0 on Linux via GitHub Actions.
4. NeoVim 0.4.4 on Linux via GitHub Actions.
5. Vim 8 (stable builds) on Windows via AppVeyor.
5. NeoVim 0.5.0 on Linux via GitHub Actions.
6. Vim 8 (stable builds) on Windows via AppVeyor.
If you are developing ALE code on Linux, Mac OSX, or BSD, you can run ALEs
tests by installing Docker and running the `run-tests` script. Follow the

View File

@ -6,15 +6,15 @@ g:ale_dhall_executable *g:ale_dhall_executable*
Type: |String|
Default: `'dhall'`
g:ale_dhall_options g:ale_dhall_options
b:ale_dhall_options
g:ale_dhall_options *g:ale_dhall_options*
*b:ale_dhall_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to the 'dhall` executable.
This is shared with `dhall-freeze` and `dhall-lint`.
>
let g:dhall_options = '--ascii'
let g:ale_dhall_options = '--ascii'
<
===============================================================================
@ -30,15 +30,15 @@ dhall-freeze *ale-dhall-freeze*
Dhall
(https://dhall-lang.org/)
g:ale_dhall_freeze_options g:ale_dhall_freeze_options
b:ale_dhall_freeze_options
g:ale_dhall_freeze_options *g:ale_dhall_freeze_options*
*b:ale_dhall_freeze_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to the 'dhall freeze`
executable.
>
let g:dhall_freeze_options = '--all'
let g:ale_dhall_freeze_options = '--all'
<
===============================================================================

View File

@ -4,6 +4,7 @@ ALE Eruby Integration *ale-eruby-options*
There are four linters for `eruby` files:
- `erb`
- `erblint`
- `erubis`
- `erubi`
- `ruumba`
@ -13,6 +14,26 @@ default parser in Rails between 3.0 and 5.1. `erubi` is the default in Rails
5.1 and later. `ruumba` can extract Ruby from eruby files and run rubocop on
the result. To selectively enable a subset, see |g:ale_linters|.
===============================================================================
erblint *ale-eruby-erblint*
g:ale_eruby_erblint_executable *g:ale_eruby_erblint_executable*
*b:ale_eruby_erblint_executable*
Type: |String|
Default: `'erblint'`
Override the invoked erblint binary. This is useful for running erblint
from binstubs or a bundle.
g:ale_eruby_erblint_options *g:ale_ruby_erblint_options*
*b:ale_ruby_erblint_options*
Type: |String|
Default: `''`
This variable can be change to modify flags given to erblint.
===============================================================================
ruumba *ale-eruby-ruumba*

View File

@ -133,6 +133,23 @@ g:ale_go_langserver_options *g:ale_go_langserver_options*
`-gocodecompletion` option is ignored because it is handled automatically
by the |g:ale_completion_enabled| variable.
===============================================================================
golines *ale-go-golines*
g:ale_go_golines_executable *g:ale_go_lines_executable*
*b:ale_go_lines_executable*
Type: |String|
Default: `'golines'`
Location of the golines binary file
g:ale_go_golines_options *g:ale_go_golines_options*
*b:ale_go_golines_options*
Type: |String|
Default: ''
Additional options passed to the golines command. By default golines has
--max-length=100 (lines above 100 characters will be wrapped)
===============================================================================
golint *ale-go-golint*

View File

@ -23,6 +23,11 @@ To this: >
/path/foo/bar/.eslintrc.js # extends: ["/path/foo/.base-eslintrc.js"]
<
===============================================================================
deno *ale-javascript-deno*
Check the docs over at |ale-typescript-deno|.
===============================================================================
eslint *ale-javascript-eslint*

View File

@ -2,6 +2,15 @@
ALE JSON Integration *ale-json-options*
===============================================================================
eslint *ale-json-eslint*
The `eslint` linter for JSON uses the JavaScript options for `eslint`; see:
|ale-javascript-eslint|.
You will need a JSON ESLint plugin installed for this to work.
===============================================================================
fixjson *ale-json-fixjson*

View File

@ -0,0 +1,15 @@
===============================================================================
ALE JSON5 Integration *ale-json5-options*
===============================================================================
eslint *ale-json5-eslint*
The `eslint` linter for JSON uses the JavaScript options for `eslint`; see:
|ale-javascript-eslint|.
You will need a JSON5 ESLint plugin installed for this to work.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -0,0 +1,15 @@
===============================================================================
ALE JSONC Integration *ale-jsonc-options*
===============================================================================
eslint *ale-jsonc-eslint*
The `eslint` linter for JSON uses the JavaScript options for `eslint`; see:
|ale-javascript-eslint|.
You will need a JSONC ESLint plugin installed for this to work.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -0,0 +1,43 @@
===============================================================================
ALE Jsonnet Integration *ale-jsonnet-options*
===============================================================================
jsonnetfmt *ale-jsonnet-jsonnetfmt*
g:ale_jsonnet_jsonnetfmt_executable *g:ale_jsonnet_jsonnetfmt_executable*
*b:ale_jsonnet_jsonnetfmt_executable*
Type: |String|
Default: `'jsonnetfmt'`
This option can be changed to change the path for `jsonnetfmt`.
g:ale_jsonnet_jsonnetfmt_options *g:ale_jsonnet_jsonnetfmt_options*
*b:ale_jsonnet_jsonnetfmt_options*
Type: |String|
Default: `''`
This option can be changed to pass extra options to `jsonnetfmt`.
===============================================================================
jsonnet-lint *ale-jsonnet-jsonnet-lint*
g:ale_jsonnet_jsonnet_lint_executable *g:ale_jsonnet_jsonnet_lint_executable*
*b:ale_jsonnet_jsonnet_lint_executable*
Type: |String|
Default: `'jsonnet-lint'`
This option can be changed to change the path for `jsonnet-lint`.
g:ale_jsonnet_jsonnet_lint_options *g:ale_jsonnet_jsonnet_lint_options*
*b:ale_jsonnet_jsonnet_lint_options*
Type: |String|
Default: `''`
This option can be changed to pass extra options to `jsonnet-lint`.
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -30,6 +30,33 @@ g:ale_purescript_ls_config g:ale_purescript_ls_config
\ }
\}
===============================================================================
purs-tidy *ale-purescript-tidy*
g:ale_purescript_tidy_executable *g:ale_purescript_tidy_executable*
*b:ale_purescript_tidy_executable*
Type: |String|
Default: `'purs-tidy'`
This variable can be changed to use a different executable for purs-tidy.
g:ale_purescript_tidy_use_global *g:ale_purescript_tidy_use_global*
*b:ale_purescript_tidy_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
g:ale_purescript_tidy_options *g:ale_purescript_tidy_options*
*b:ale_purescript_tidy_options*
Type: String
Default: `''`
This variable can be set to pass in additional option to the 'purs-tidy'
executable.
>
let g:ale_purescript_options = '--indent 3'
<
===============================================================================
purty *ale-purescript-purty*
g:ale_purescript_purty_executable *g:ale_purescript_purty_executable*

View File

@ -35,6 +35,7 @@ ALE will look for configuration files with the following filenames. >
setup.cfg
pytest.ini
tox.ini
.pyre_configuration.local
mypy.ini
pycodestyle.cfg
.flake8
@ -319,6 +320,69 @@ g:ale_python_flake8_auto_poetry *g:ale_python_flake8_auto_poetry*
Detect whether the file is inside a poetry, and set the executable to `poetry`
if true. This is overridden by a manually-set executable.
===============================================================================
flakehell *ale-python-flakehell*
g:ale_python_flakehell_change_directory*g:ale_python_flakehell_change_directory*
*b:ale_python_flakehell_change_directory*
Type: |String|
Default: `project`
If set to `project`, ALE will switch to the project root before checking file.
If set to `file`, ALE will switch to directory the Python file being
checked with `flakehell` is in before checking it.
You can turn it off with `off` option if you want to control the directory
Python is executed from yourself.
g:ale_python_flakehell_executable *g:ale_python_flakehell_executable*
*b:ale_python_flakehell_executable*
Type: |String|
Default: `'flakehell'`
This variable can be changed to modify the executable used for flakehell. Set
this to `'pipenv'` to invoke `'pipenv` `run` `flakehell'`. Set this to
`'poetry'` to invoke `'poetry` `run` `flakehell'`. Set this to `'python'` to
invoke `'python` `-m` `flakehell'`.
g:ale_python_flakehell_options *g:ale_python_flakehell_options*
*b:ale_python_flakehell_options*
Type: |String|
Default: `''`
This variable can be changed to add command-line arguments to the flakehell
lint invocation.
g:ale_python_flakehell_use_global *g:ale_python_flakehell_use_global*
*b:ale_python_flakehell_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
This variable controls whether or not ALE will search for flakehell in a
virtualenv directory first. If this variable is set to `1`, then ALE will
always use |g:ale_python_flakehell_executable| for the executable path.
Both variables can be set with `b:` buffer variables instead.
g:ale_python_flakehell_auto_pipenv *g:ale_python_flakehell_auto_pipenv*
*b:ale_python_flakehell_auto_pipenv*
Type: |Number|
Default: `0`
Detect whether the file is inside a pipenv, and set the executable to `pipenv`
if true. This is overridden by a manually-set executable.
g:ale_python_flakehell_auto_poetry *g:ale_python_flakehell_auto_poetry*
*b:ale_python_flakehell_auto_poetry*
Type: |Number|
Default: `0`
Detect whether the file is inside a poetry, and set the executable to `poetry`
if true. This is overridden by a manually-set executable.
===============================================================================
isort *ale-python-isort*
@ -356,6 +420,15 @@ g:ale_python_isort_auto_pipenv *g:ale_python_isort_auto_pipenv*
if true. This is overridden by a manually-set executable.
g:ale_python_isort_auto_poetry *g:ale_python_isort_auto_poetry*
*b:ale_python_isort_auto_poetry*
Type: |Number|
Default: `0`
Detect whether the file is inside a poetry, and set the executable to `poetry`
if true. This is overridden by a manually-set executable.
===============================================================================
mypy *ale-python-mypy*

View File

@ -0,0 +1,16 @@
===============================================================================
ALE Robot Integration *ale-robot-options*
===============================================================================
rflint *ale-robot-rflint*
g:ale_robot_rflint_executable *g:ale_robot_rflint_executable*
*b:ale_robot_rflint_executable*
Type: |String|
Default: `'rflint'`
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -17,7 +17,7 @@ Notes:
* `gcc`
* `gnatpp`
* Ansible
* `ansible-lint`
* `ansible-lint`!!
* API Blueprint
* `drafter`
* APKBUILD
@ -66,6 +66,7 @@ Notes:
* `uncrustify`
* C#
* `csc`!!
* `dotnet-format`
* `mcs`
* `mcsc`!!
* `uncrustify`
@ -86,7 +87,7 @@ Notes:
* `uncrustify`
* Chef
* `cookstyle`
* `foodcritic`
* `foodcritic`!!
* Clojure
* `clj-kondo`
* `joker`
@ -141,7 +142,7 @@ Notes:
* Elixir
* `credo`
* `dialyxir`
* `dogma`
* `dogma`!!
* `elixir-ls`
* `mix`!!
* Elm
@ -150,12 +151,13 @@ Notes:
* `elm-make`
* Erb
* `erb`
* `erblint`
* `erubi`
* `erubis`
* `ruumba`
* Erlang
* `SyntaxErl`
* `dialyzer`
* `dialyzer`!!
* `elvis`!!
* `erlc`
* `erlfmt`
@ -183,6 +185,7 @@ Notes:
* `goimports`
* `golangci-lint`!!
* `golangserver`
* `golines`
* `golint`
* `gometalinter`!!
* `gopls`
@ -240,13 +243,14 @@ Notes:
* `ispc`!!
* Java
* `PMD`
* `checkstyle`
* `checkstyle`!!
* `eclipselsp`
* `google-java-format`
* `javac`
* `javalsp`
* `uncrustify`
* JavaScript
* `deno`
* `eslint`
* `fecs`
* `flow`
@ -259,16 +263,24 @@ Notes:
* `tsserver`
* `xo`
* JSON
* `eslint`
* `fixjson`
* `jq`
* `jsonlint`
* `prettier`
* `spectral`
* JSON5
* `eslint`
* JSONC
* `eslint`
* Jsonnet
* `jsonnet-lint`
* `jsonnetfmt`
* Julia
* `languageserver`
* Kotlin
* `kotlinc`!!
* `ktlint`!!
* `ktlint`
* `languageserver`
* LaTeX (tex)
* `alex`!!
@ -389,8 +401,8 @@ Notes:
* Prolog
* `swipl`
* proto
* `protoc-gen-lint`
* `protolint`
* `protoc-gen-lint`!!
* `protolint`!!
* Pug
* `pug-lint`
* Puppet
@ -399,6 +411,7 @@ Notes:
* `puppet-lint`
* PureScript
* `purescript-language-server`
* `purs-tidy`
* `purty`
* Python
* `autoflake`!!
@ -407,9 +420,10 @@ Notes:
* `bandit`
* `black`
* `flake8`
* `flakehell`
* `isort`
* `mypy`
* `prospector`
* `prospector`!!
* `pycodestyle`
* `pydocstyle`
* `pyflakes`
@ -446,10 +460,12 @@ Notes:
* `textlint`
* `vale`
* `write-good`
* Robot
* `rflint`
* RPM spec
* `rpmlint`
* Ruby
* `brakeman`
* `brakeman`!!
* `debride`
* `prettier`
* `rails_best_practices`!!
@ -544,7 +560,7 @@ Notes:
* `tsserver`
* `typecheck`
* V
* `v`
* `v`!!
* `vfmt`
* VALA
* `uncrustify`
@ -555,7 +571,7 @@ Notes:
* `verilator`
* `vlog`
* `xvlog`
* `yosys`
* `yosys`!!
* VHDL
* `ghdl`
* `vcom`

View File

@ -23,7 +23,7 @@ g:ale_deno_lsp_project_root *g:ale_deno_lsp_project_root*
executing the following steps in the given order:
1. Find an ancestor directory containing a tsconfig.json.
2. Find an ancestory irectory containing a .git folder.
2. Find an ancestory directory containing a .git folder.
3. Use the directory of the current buffer (if the buffer was opened from
a file).

View File

@ -1,4 +1,4 @@
*ale.txt* Plugin to lint and fix files asynchronously
*ale.txt* Plugin to lint and fix files asynchronously
*ale*
ALE - Asynchronous Lint Engine
@ -2226,8 +2226,6 @@ g:ale_virtualtext_cursor *g:ale_virtualtext_cursor*
Type: |Number|
Default: `0`
This option only has any effect in NeoVim.
When this option is set to `1`, a message will be shown when a cursor is
near a warning or error. ALE will attempt to find the warning or error at a
column nearest to the cursor when the cursor is resting on a line which
@ -2681,6 +2679,7 @@ documented in additional help files.
uncrustify............................|ale-cpp-uncrustify|
c#......................................|ale-cs-options|
csc...................................|ale-cs-csc|
dotnet-format.........................|ale-cs-dotnet-format|
mcs...................................|ale-cs-mcs|
mcsc..................................|ale-cs-mcsc|
uncrustify............................|ale-cs-uncrustify|
@ -2730,6 +2729,7 @@ documented in additional help files.
erlfmt................................|ale-erlang-erlfmt|
syntaxerl.............................|ale-erlang-syntaxerl|
eruby...................................|ale-eruby-options|
erblint...............................|ale-eruby-erblint|
ruumba................................|ale-eruby-ruumba|
fish....................................|ale-fish-options|
fish_indent...........................|ale-fish-fish_indent|
@ -2750,6 +2750,7 @@ documented in additional help files.
gofmt.................................|ale-go-gofmt|
golangci-lint.........................|ale-go-golangci-lint|
golangserver..........................|ale-go-golangserver|
golines...............................|ale-go-golines|
golint................................|ale-go-golint|
gometalinter..........................|ale-go-gometalinter|
gopls.................................|ale-go-gopls|
@ -2811,6 +2812,7 @@ documented in additional help files.
eclipselsp............................|ale-java-eclipselsp|
uncrustify............................|ale-java-uncrustify|
javascript..............................|ale-javascript-options|
deno..................................|ale-javascript-deno|
eslint................................|ale-javascript-eslint|
fecs..................................|ale-javascript-fecs|
flow..................................|ale-javascript-flow|
@ -2823,11 +2825,19 @@ documented in additional help files.
standard..............................|ale-javascript-standard|
xo....................................|ale-javascript-xo|
json....................................|ale-json-options|
eslint................................|ale-json-eslint|
fixjson...............................|ale-json-fixjson|
jsonlint..............................|ale-json-jsonlint|
jq....................................|ale-json-jq|
prettier..............................|ale-json-prettier|
spectral..............................|ale-json-spectral|
jsonc...................................|ale-jsonc-options|
eslint................................|ale-jsonc-eslint|
jsonnet.................................|ale-jsonnet-options|
jsonnetfmt............................|ale-jsonnet-jsonnetfmt|
jsonnet-lint..........................|ale-jsonnet-jsonnet-lint|
json5...................................|ale-json5-options|
eslint................................|ale-json5-eslint|
julia...................................|ale-julia-options|
languageserver........................|ale-julia-languageserver|
kotlin..................................|ale-kotlin-options|
@ -2933,6 +2943,7 @@ documented in additional help files.
puppet-languageserver.................|ale-puppet-languageserver|
purescript..............................|ale-purescript-options|
purescript-language-server............|ale-purescript-language-server|
purs-tidy.............................|ale-purescript-tidy|
purty.................................|ale-purescript-purty|
pyrex (cython)..........................|ale-pyrex-options|
cython................................|ale-pyrex-cython|
@ -2943,6 +2954,7 @@ documented in additional help files.
bandit................................|ale-python-bandit|
black.................................|ale-python-black|
flake8................................|ale-python-flake8|
flakehell.............................|ale-python-flakehell|
isort.................................|ale-python-isort|
mypy..................................|ale-python-mypy|
prospector............................|ale-python-prospector|
@ -2971,6 +2983,8 @@ documented in additional help files.
restructuredtext........................|ale-restructuredtext-options|
textlint..............................|ale-restructuredtext-textlint|
write-good............................|ale-restructuredtext-write-good|
robot...................................|ale-robot-options|
rflint................................|ale-robot-rflint|
ruby....................................|ale-ruby-options|
brakeman..............................|ale-ruby-brakeman|
debride...............................|ale-ruby-debride|
@ -4300,6 +4314,13 @@ ALEJobStarted *ALEJobStarted-autocmd*
|ale#engine#IsCheckingBuffer()| over |ALELintPre-autocmd|, which is actually
triggered before any linters are executed.
ALELSPStarted *ALELSPStarted-autocmd*
*ALELSPStarted*
This |User| autocommand is trigged immediately after an LSP connection is
successfully initialized. This provides a way to perform any additional
initialization work, such as setting up buffer-level mappings.
ALEWantResults *ALEWantResults-autocmd*
*ALEWantResults*

View File

@ -14,10 +14,10 @@ formatting.
**Legend**
| Key | Definition |
| ------------- | -------------------------------- |
| :floppy_disk: | May only run on files on disk |
| :warning: | Disabled by default |
| Key | Definition |
| ------------- | ----------------------------------------------------------------- |
| :floppy_disk: | May only run on files on disk (see: `help ale-lint-file-linters` |
| :warning: | Disabled by default |
---
@ -26,7 +26,7 @@ formatting.
* [gcc](https://gcc.gnu.org)
* [gnatpp](https://docs.adacore.com/gnat_ugn-docs/html/gnat_ugn/gnat_ugn/gnat_utility_programs.html#the-gnat-pretty-printer-gnatpp) :floppy_disk:
* Ansible
* [ansible-lint](https://github.com/willthames/ansible-lint)
* [ansible-lint](https://github.com/willthames/ansible-lint) :floppy_disk:
* API Blueprint
* [drafter](https://github.com/apiaryio/drafter)
* APKBUILD
@ -75,6 +75,7 @@ formatting.
* [uncrustify](https://github.com/uncrustify/uncrustify)
* C#
* [csc](http://www.mono-project.com/docs/about-mono/languages/csharp/) :floppy_disk: see:`help ale-cs-csc` for details and configuration
* [dotnet-format](https://github.com/dotnet/format)
* [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details
* [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) :floppy_disk: see:`help ale-cs-mcsc` for details and configuration
* [uncrustify](https://github.com/uncrustify/uncrustify)
@ -95,7 +96,7 @@ formatting.
* [uncrustify](https://github.com/uncrustify/uncrustify)
* Chef
* [cookstyle](https://docs.chef.io/cookstyle.html)
* [foodcritic](http://www.foodcritic.io/)
* [foodcritic](http://www.foodcritic.io/) :floppy_disk:
* Clojure
* [clj-kondo](https://github.com/borkdude/clj-kondo)
* [joker](https://github.com/candid82/joker)
@ -119,7 +120,7 @@ formatting.
* [cucumber](https://cucumber.io/)
* CUDA
* [clangd](https://clang.llvm.org/extra/clangd.html)
* [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html)
* [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) :floppy_disk:
* Cypher
* [cypher-lint](https://github.com/cleishm/libcypher-parser)
* Cython (pyrex filetype)
@ -134,9 +135,9 @@ formatting.
* Dart
* [analysis_server](https://github.com/dart-lang/sdk/tree/master/pkg/analysis_server)
* [dart-analyze](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) :floppy_disk:
* [dart-format](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt)
* [dart-format](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) :floppy_disk:
* [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) :floppy_disk:
* [dartfmt](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt)
* [dartfmt](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) :floppy_disk:
* [language_server](https://github.com/natebosch/dart_language_server)
* desktop
* [desktop-file-validate](https://www.freedesktop.org/wiki/Software/desktop-file-utils/)
@ -149,7 +150,7 @@ formatting.
* [hadolint](https://github.com/hadolint/hadolint)
* Elixir
* [credo](https://github.com/rrrene/credo)
* [dialyxir](https://github.com/jeremyjh/dialyxir) :floppy_disk:
* [dialyxir](https://github.com/jeremyjh/dialyxir)
* [dogma](https://github.com/lpil/dogma) :floppy_disk:
* [elixir-ls](https://github.com/elixir-lsp/elixir-ls) :warning:
* [mix](https://hexdocs.pm/mix/Mix.html) :warning: :floppy_disk:
@ -159,12 +160,13 @@ formatting.
* [elm-make](https://github.com/elm/compiler)
* Erb
* [erb](https://apidock.com/ruby/ERB)
* [erblint](https://github.com/Shopify/erb-lint)
* [erubi](https://github.com/jeremyevans/erubi)
* [erubis](https://github.com/kwatch/erubis)
* [ruumba](https://github.com/ericqweinstein/ruumba)
* Erlang
* [SyntaxErl](https://github.com/ten0s/syntaxerl)
* [dialyzer](http://erlang.org/doc/man/dialyzer.html)
* [dialyzer](http://erlang.org/doc/man/dialyzer.html) :floppy_disk:
* [elvis](https://github.com/inaka/elvis) :floppy_disk:
* [erlc](http://erlang.org/doc/man/erlc.html)
* [erlfmt](https://github.com/WhatsApp/erlfmt)
@ -192,6 +194,7 @@ formatting.
* [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports) :warning:
* [golangci-lint](https://github.com/golangci/golangci-lint) :warning: :floppy_disk:
* [golangserver](https://github.com/sourcegraph/go-langserver) :warning:
* [golines](https://github.com/segmentio/golines)
* [golint](https://godoc.org/github.com/golang/lint)
* [gometalinter](https://github.com/alecthomas/gometalinter) :warning: :floppy_disk:
* [gopls](https://github.com/golang/go/wiki/gopls)
@ -249,13 +252,14 @@ formatting.
* [ispc](https://ispc.github.io/) :floppy_disk:
* Java
* [PMD](https://pmd.github.io/)
* [checkstyle](http://checkstyle.sourceforge.net)
* [checkstyle](http://checkstyle.sourceforge.net) :floppy_disk:
* [eclipselsp](https://github.com/eclipse/eclipse.jdt.ls)
* [google-java-format](https://github.com/google/google-java-format)
* [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
* [javalsp](https://github.com/georgewfraser/vscode-javac)
* [uncrustify](https://github.com/uncrustify/uncrustify)
* JavaScript
* [deno](https://deno.land/)
* [eslint](http://eslint.org/)
* [fecs](http://fecs.baidu.com/)
* [flow](https://flowtype.org/)
@ -268,16 +272,24 @@ formatting.
* [tsserver](https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29)
* [xo](https://github.com/sindresorhus/xo)
* JSON
* [eslint](http://eslint.org/)
* [fixjson](https://github.com/rhysd/fixjson)
* [jq](https://stedolan.github.io/jq/)
* [jsonlint](https://github.com/zaach/jsonlint)
* [prettier](https://github.com/prettier/prettier)
* [spectral](https://github.com/stoplightio/spectral)
* JSON5
* [eslint](http://eslint.org/)
* JSONC
* [eslint](http://eslint.org/)
* Jsonnet
* [jsonnet-lint](https://jsonnet.org/learning/tools.html)
* [jsonnetfmt](https://jsonnet.org/learning/tools.html)
* Julia
* [languageserver](https://github.com/JuliaEditorSupport/LanguageServer.jl)
* Kotlin
* [kotlinc](https://kotlinlang.org) :floppy_disk:
* [ktlint](https://ktlint.github.io) :floppy_disk:
* [ktlint](https://ktlint.github.io)
* [languageserver](https://github.com/fwcd/KotlinLanguageServer) see `:help ale-integration-kotlin` for configuration instructions
* LaTeX
* [alex](https://github.com/wooorm/alex) :floppy_disk:
@ -393,13 +405,13 @@ formatting.
* Pony
* [ponyc](https://github.com/ponylang/ponyc)
* PowerShell
* [powershell](https://github.com/PowerShell/PowerShell) :floppy_disk:
* [psscriptanalyzer](https://github.com/PowerShell/PSScriptAnalyzer) :floppy_disk:
* [powershell](https://github.com/PowerShell/PowerShell)
* [psscriptanalyzer](https://github.com/PowerShell/PSScriptAnalyzer)
* Prolog
* [swipl](https://github.com/SWI-Prolog/swipl-devel)
* proto
* [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint)
* [protolint](https://github.com/yoheimuta/protolint)
* [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) :floppy_disk:
* [protolint](https://github.com/yoheimuta/protolint) :floppy_disk:
* Pug
* [pug-lint](https://github.com/pugjs/pug-lint)
* Puppet
@ -408,17 +420,19 @@ formatting.
* [puppet-lint](https://puppet-lint.com)
* PureScript
* [purescript-language-server](https://github.com/nwolverson/purescript-language-server)
* [purs-tidy](https://github.com/natefaubion/purescript-tidy)
* [purty](https://gitlab.com/joneshf/purty)
* Python
* [autoflake](https://github.com/myint/autoflake)
* [autoflake](https://github.com/myint/autoflake) :floppy_disk:
* [autoimport](https://lyz-code.github.io/autoimport/)
* [autopep8](https://github.com/hhatto/autopep8)
* [bandit](https://github.com/PyCQA/bandit) :warning:
* [black](https://github.com/ambv/black)
* [flake8](http://flake8.pycqa.org/en/latest/)
* [flakehell](https://github.com/flakehell/flakehell)
* [isort](https://github.com/timothycrosley/isort)
* [mypy](http://mypy-lang.org/)
* [prospector](https://github.com/PyCQA/prospector) :warning:
* [prospector](https://github.com/PyCQA/prospector) :warning: :floppy_disk:
* [pycodestyle](https://github.com/PyCQA/pycodestyle) :warning:
* [pydocstyle](https://www.pydocstyle.org/) :warning:
* [pyflakes](https://github.com/PyCQA/pyflakes)
@ -455,11 +469,13 @@ formatting.
* [textlint](https://textlint.github.io/)
* [vale](https://github.com/ValeLint/vale)
* [write-good](https://github.com/btford/write-good)
* Robot
* [rflint](https://github.com/boakley/robotframework-lint)
* RPM spec
* [rpmlint](https://github.com/rpm-software-management/rpmlint) :warning: (see `:help ale-integration-spec`)
* Ruby
* [brakeman](http://brakemanscanner.org/) :floppy_disk:
* [debride](https://github.com/seattlerb/debride) :floppy_disk:
* [debride](https://github.com/seattlerb/debride)
* [prettier](https://github.com/prettier/plugin-ruby)
* [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) :floppy_disk:
* [reek](https://github.com/troessner/reek)
@ -553,7 +569,7 @@ formatting.
* [tsserver](https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29)
* typecheck
* V
* [v](https://github.com/vlang/v/)
* [v](https://github.com/vlang/v/) :floppy_disk:
* [vfmt](https://github.com/vlang/v/)
* VALA
* [uncrustify](https://github.com/uncrustify/uncrustify)
@ -564,7 +580,7 @@ formatting.
* [verilator](http://www.veripool.org/projects/verilator/wiki/Intro)
* [vlog](https://www.mentor.com/products/fv/questa/)
* [xvlog](https://www.xilinx.com/products/design-tools/vivado.html)
* [yosys](http://www.clifford.at/yosys/)
* [yosys](http://www.clifford.at/yosys/) :floppy_disk:
* VHDL
* [ghdl](https://github.com/ghdl/ghdl)
* [vcom](https://www.mentor.com/products/fv/questa/)

View File

@ -59,16 +59,20 @@ Place `colorscheme dracula` after `execute pathogen#infect()`.
- If you [use vim + vundle](https://github.com/VundleVim/Vundle):
Plugin 'dracula/vim', { 'name': 'dracula' }
:PluginInstall
```vim
Plugin 'dracula/vim', { 'name': 'dracula' }
:PluginInstall
```
Place `colorscheme dracula` after `call vundle#end()`.
- If you [use vim-plug](https://github.com/junegunn/vim-plug) (\`as\` will install
the plugin in a directory called 'dracula' instead of just 'vim'):
Plug 'dracula/vim', { 'as': 'dracula' }
:PlugInstall
```vim
Plug 'dracula/vim', { 'as': 'dracula' }
:PlugInstall
```
Place `colorscheme dracula` after `call plug#end()`.

View File

@ -62,6 +62,11 @@ if has('nvim-0.5') && luaeval("pcall(require, 'gitsigns')")
endif
" }}}
" Tree-sitter: {{{
" The nvim-treesitter library defines many global highlight groups that are
" linked to the regular vim syntax highlight groups. We only need to redefine
" those highlight groups when the defaults do not match the dracula
" specification.
" https://github.com/nvim-treesitter/nvim-treesitter/blob/master/plugin/nvim-treesitter.vim
if exists('g:loaded_nvim_treesitter')
" # Misc
hi! link TSPunctSpecial Special
@ -89,6 +94,9 @@ if exists('g:loaded_nvim_treesitter')
hi! link TSTitle DraculaYellow
hi! link TSLiteral DraculaYellow
hi! link TSURI DraculaYellow
" HTML and JSX tag attributes. By default, this group is linked to TSProperty,
" which in turn links to Identifer (white).
hi! link TSTagAttribute DraculaGreenItalic
endif
" }}}

View File

@ -232,7 +232,7 @@ hi! link Question DraculaFgBold
hi! link Search DraculaSearch
call s:h('SignColumn', s:comment)
hi! link TabLine DraculaBoundary
hi! link TabLineFill DraculaBgDarker
hi! link TabLineFill DraculaBgDark
hi! link TabLineSel Normal
hi! link Title DraculaGreenBold
hi! link VertSplit DraculaBoundary

Binary file not shown.

Before

Width:  |  Height:  |  Size: 526 KiB

After

Width:  |  Height:  |  Size: 328 KiB

View File

@ -5,6 +5,12 @@
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
-->
#### 6.10
- **.16**: Fix documentation errors. (lifecrisis) [#1269](https://github.com/preservim/nerdtree/pull/1269)
- **.15**: Ensure backward compatible testing of types. (lifecrisis) [#1266](https://github.com/preservim/nerdtree/pull/1266)
- **.14**: Replace trim() with a version-compatible alternative. (PhilRunninger) [#1265](https://github.com/preservim/nerdtree/pull/1265)
- **.13**: Change highlighting of bookmarks in the tree. (PhilRunninger) [#1261](https://github.com/preservim/nerdtree/pull/1261)
- **.12**: Answer the question about accessing files over scp or ftp. (PhilRunninger) [#1259](https://github.com/preservim/nerdtree/pull/1259)
- **.11**: Trim filenames created via the fs_menu (elanorigby) [#1243](https://github.com/preservim/nerdtree/pull/1243)
- **.10**: Improve F.A.Q. Answers and Issue Templates (PhilRunninger) [#1249](https://github.com/preservim/nerdtree/pull/1249)
- **.9**: `go` on a bookmark directory will NERDTreeFind it. (PhilRunninger) [#1236](https://github.com/preservim/nerdtree/pull/1236)
- **.8**: Put `Callback` function variables in local scope. (PhilRunninger) [#1230](https://github.com/preservim/nerdtree/pull/1230)

View File

@ -187,3 +187,35 @@ let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
```
The preceding values are the non-Windows default arrow symbols. Setting these variables to empty strings will remove the arrows completely and shift the entire tree two character positions to the left. See `:h NERDTreeDirArrowExpandable` for more details.
### Can NERDTree access remote files via scp or ftp?
Short answer: No, and there are no plans to add that functionality. However, Vim ships with a plugin that does just that. It's called netrw, and by adding the following lines to your `.vimrc`, you can use it to open files over the `scp:`, `ftp:`, or other protocols, while still using NERDTree for all local files. The function seamlessly makes the decision to open NERDTree or netrw, and other supported protocols can be added to the regular expression.
```vim
" Function to open the file or NERDTree or netrw.
" Returns: 1 if either file explorer was opened; otherwise, 0.
function! s:OpenFileOrExplorer(...)
if a:0 == 0 || a:1 == ''
NERDTree
elseif filereadable(a:1)
execute 'edit '.a:1
return 0
elseif a:1 =~? '^\(scp\|ftp\)://' " Add other protocols as needed.
execute 'Vexplore '.a:1
elseif isdirectory(a:1)
execute 'NERDTree '.a:1
endif
return 1
endfunction
" Auto commands to handle OS commandline arguments
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc()==1 && !exists('s:std_in') | if <SID>OpenFileOrExplorer(argv()[0]) | wincmd p | enew | wincmd p | endif | endif
" Command to call the OpenFileOrExplorer function.
command! -n=? -complete=file -bar Edit :call <SID>OpenFileOrExplorer('<args>')
" Command-mode abbreviation to replace the :edit Vim command.
cnoreabbrev e Edit
```

View File

@ -112,18 +112,18 @@ function! nerdtree#compareNodePaths(p1, p2) abort
" Compare chunks upto common length.
" If chunks have different type, the one which has
" integer type is the lesser.
if type(sortKey1[i]) ==# type(sortKey2[i])
if type(sortKey1[i]) == type(sortKey2[i])
if sortKey1[i] <# sortKey2[i]
return - 1
elseif sortKey1[i] ># sortKey2[i]
return 1
endif
elseif type(sortKey1[i]) ==# v:t_number
elseif type(sortKey1[i]) == type(0)
return -1
elseif type(sortKey2[i]) ==# v:t_number
elseif type(sortKey2[i]) == type(0)
return 1
endif
let i = i + 1
let i += 1
endwhile
" Keys are identical upto common length.

View File

@ -1256,10 +1256,10 @@ responsible pull request: https://github.com/preservim/nerdtree/pull/868.
The default value of this variable depends on the features compiled into your
vim and the values of |NERDTreeDirArrowCollapsible| and
|NERDTreeDirArrowExpandable|.
* If your vim is compiled with the +conceal feature, it is the "\x07" (BELL)
character, and it is hidden by setting 'conceallevel' to 3. If you use
autocommands, make sure none of them change that setting in the NERDTree_*
buffers.
* If your vim is compiled with the +conceal feature, it is the "\x07"
(BEL) character, and it is hidden by setting 'conceallevel' to 2. If you
use autocommands, make sure none of them change that setting in the
NERD_Tree_* buffers.
* If your vim does NOT have the +conceal feature and you're using "\u00a0"
(non-breaking space) to hide the directory arrows, "\u00b7" (middle dot)
is used as the default delimiter.

View File

@ -169,7 +169,7 @@ endfunction
function! NERDTreeAddNode()
let curDirNode = g:NERDTreeDirNode.GetSelected()
let prompt = s:inputPrompt('add')
let newNodeName = input(prompt, curDirNode.path.str() . nerdtree#slash(), 'file')
let newNodeName = substitute(input(prompt, curDirNode.path.str() . nerdtree#slash(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
if newNodeName ==# ''
call nerdtree#echo('Node Creation Aborted.')
@ -206,7 +206,7 @@ function! NERDTreeMoveNode()
let newNodePath = input(prompt, curNode.path.str(), 'file')
while filereadable(newNodePath)
call nerdtree#echoWarning('This destination already exists. Try again.')
let newNodePath = input(prompt, curNode.path.str(), 'file')
let newNodePath = substitute(input(prompt, curNode.path.str(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
endwhile
@ -337,7 +337,7 @@ endfunction
function! NERDTreeCopyNode()
let currentNode = g:NERDTreeFileNode.GetSelected()
let prompt = s:inputPrompt('copy')
let newNodePath = input(prompt, currentNode.path.str(), 'file')
let newNodePath = substitute(input(prompt, currentNode.path.str(), 'file'), '\(^\s*\|\s*$\)', '', 'g')
if newNodePath !=# ''
"strip trailing slash

View File

@ -36,23 +36,23 @@ if g:NERDTreeDirArrowExpandable !=# ''
exec 'syn match NERDTreeOpenable #' . escape(g:NERDTreeDirArrowExpandable, '~') . '\ze .*/# containedin=NERDTreeDir,NERDTreeFile'
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
exec 'syn match NERDTreeExecFile #^.*'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark'
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
exec 'syn match NERDTreeExecFile #^.*'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmarkName'
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmarkName,NERDTreeExecFile'
else
exec 'syn match NERDTreeDir #[^'.g:NERDTreeNodeDelimiter.']\{-}/\ze\($\|'.g:NERDTreeNodeDelimiter.'\)#'
exec 'syn match NERDTreeExecFile #[^'.g:NERDTreeNodeDelimiter.']\{-}'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark'
exec 'syn match NERDTreeFile #^.*'.g:NERDTreeNodeDelimiter.'.*[^\/]\($\|'.g:NERDTreeNodeDelimiter.'.*\)# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
exec 'syn match NERDTreeExecFile #[^'.g:NERDTreeNodeDelimiter.']\{-}'.g:NERDTreeNodeDelimiter.'\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmarkName'
exec 'syn match NERDTreeFile #^.*'.g:NERDTreeNodeDelimiter.'.*[^\/]\($\|'.g:NERDTreeNodeDelimiter.'.*\)# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmarkName,NERDTreeExecFile'
endif
"highlighting for readonly files
exec 'syn match NERDTreeRO #.*'.g:NERDTreeNodeDelimiter.'\zs.*\ze'.g:NERDTreeNodeDelimiter.'.*\['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmark,NERDTreeFile'
exec 'syn match NERDTreeRO #.*'.g:NERDTreeNodeDelimiter.'\zs.*\ze'.g:NERDTreeNodeDelimiter.'.*\['.g:NERDTreeGlyphReadOnly.'\]# contains=NERDTreeIgnore,NERDTreeBookmarkName,NERDTreeFile'
exec 'syn match NERDTreeFlags #\[[^\]]*\]\ze'.g:NERDTreeNodeDelimiter.'# containedin=NERDTreeFile,NERDTreeExecFile,NERDTreeLinkFile,NERDTreeRO,NERDTreeDir'
syn match NERDTreeCWD #^[</].*$#
"highlighting for bookmarks
syn match NERDTreeBookmark # {.*}#hs=s+1
syn match NERDTreeBookmarkName # {.*}#hs=s+2,he=e-1
"highlighting for the bookmarks table
syn match NERDTreeBookmarksLeader #^>#

View File

@ -1,675 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Vim plugin that highlights insecure SSL/TLS cipher suites and protocols.
Copyright (C) 2017 Chris Aumann
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
nginx.vim Copyright (C) 2017 Chris Aumann
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -84,3 +84,9 @@ git clone https://github.com/chr4/nginx.vim ~/.vim/bundle/nginx.vim
```
Optionally, if you like [Jinja](http://jinja.pocoo.org/) template syntax highlighting, install `lepture/vim-jinja`, too.
## License
Copyright (c) Chris Aumann. Distributed under the same terms as Vim itself.
See `:help license`.

View File

@ -1 +1,5 @@
setlocal comments=:#
setlocal commentstring=#\ %s
setlocal formatoptions+=croql formatoptions-=t
let b:undo_ftplugin = "setl fo< cms< com<"

View File

@ -9,3 +9,5 @@ setlocal indentexpr=
setlocal cindent
" Just make sure that the comments are not reset as defs would be.
setlocal cinkeys-=0#
let b:undo_indent = "setl cin< cink< inde<"

View File

@ -0,0 +1,9 @@
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run tests
run: cd test && ./run-tests
shell: bash

View File

@ -1,7 +0,0 @@
---
sudo: required
services:
- docker
language: generic
script: |
cd test && ./run-tests

View File

@ -23,5 +23,6 @@ _?_
Paste debugging info from the Rust Vim plugin via _one_ of the following
commands: `:RustInfo`, `:RustInfoToClipboard`, or `:RustInfoToFile <filename>`.
<!-- To ensure these commands are available, open a Rust source file first. -->
_?_

View File

@ -157,14 +157,7 @@ function! s:RunRustfmt(command, tmpname, from_writepre)
endif
call s:DeleteLines(len(l:content), line('$'))
if has('nvim') && exists('*nvim_buf_set_lines')
" setline() gets called for every item on the array,
" this results on the neovim buffer callbacks being called n times,
" using nvim_buf_set_lines() makes the change in one call.
call nvim_buf_set_lines(0, 0, -1, v:true, l:content)
else
call setline(1, l:content)
endif
call setline(1, l:content)
" only clear location list if it was previously filled to prevent
" clobbering other additions

View File

@ -24,6 +24,8 @@ setlocal indentkeys=0{,0},!^F,o,O,0[,0],0(,0)
setlocal indentexpr=GetRustIndent(v:lnum)
let b:undo_indent = "setlocal cindent< cinoptions< cinkeys< cinwords< lisp< autoindent< indentkeys< indentexpr<"
" Only define the function once.
if exists("*GetRustIndent")
finish

View File

@ -67,9 +67,9 @@ def image_exists():
def tests_on_docker():
res = docker_run("bash -lc 'python /home/vimtest/run-tests inside-docker'", ok_fail=True)
if res == 0:
print "Tests OK"
print("Tests OK")
else:
print "Tests Failed"
print("Tests Failed")
sys.exit(1)
def inside_docker():
@ -92,7 +92,7 @@ def main():
return
if not image_exists():
print "Need to take image from remote"
print("Need to take image from remote")
system("docker pull %s" % (IMAGE, ))
if "-i" in sys.argv[1:]:

View File

@ -36,6 +36,7 @@ function! s:go(...) abort
let [l, r] = s:surroundings()
let uncomment = 2
let force_uncomment = a:0 > 2 && a:3
for lnum in range(lnum1,lnum2)
let line = matchstr(getline(lnum),'\S.*\s\@<!')
let [l, r] = s:strip_white_space(l,r,line)
@ -58,7 +59,11 @@ function! s:go(...) abort
\'\M' . substitute(l, '\ze\S\s*$', '\\zs\\d\\*\\ze', '') . '\|' . substitute(r, '\S\zs', '\\zs\\d\\*\\ze', ''),
\'\=substitute(submatch(0)+1-uncomment,"^0$\\|^-\\d*$","","")','g')
endif
if uncomment
if force_uncomment
if line =~ '^\s*' . l
let line = substitute(line,'\S.*\s\@<!','\=submatch(0)[strlen(l):-strlen(r)-1]','')
endif
elseif uncomment
let line = substitute(line,'\S.*\s\@<!','\=submatch(0)[strlen(l):-strlen(r)-1]','')
else
let line = substitute(line,'^\%('.matchstr(getline(lnum1),indent).'\|\s*\)\zs.*\S\@<=','\=l.submatch(0).r','')
@ -97,7 +102,7 @@ function! s:textobject(inner) abort
endif
endfunction
command! -range -bar Commentary call s:go(<line1>,<line2>)
command! -range -bar -bang Commentary call s:go(<line1>,<line2>,<bang>0)
xnoremap <expr> <Plug>Commentary <SID>go()
nnoremap <expr> <Plug>Commentary <SID>go()
nnoremap <expr> <Plug>CommentaryLine <SID>go() . '_'

File diff suppressed because it is too large Load Diff

View File

@ -15,9 +15,12 @@ COMMANDS *fugitive-commands*
These commands are local to the buffers in which they work (generally, buffers
that are part of Git repositories).
*:Git* *fugitive-:G*
*fugitive-:G*
:G [args] Same as :Git, but two characters shorter.
*:Git*
:Git {args} Run an arbitrary git command and display any output.
:G {args} On UNIX this uses a pty and on other platforms it uses
On UNIX this uses a pty and on other platforms it uses
a pipe, which will cause some behavior differences
such as the absence of progress bars. Any file the
command edits (for example, a commit message) will be
@ -25,17 +28,28 @@ that are part of Git repositories).
resume running the command. A few Git subcommands
have different behavior; these are documented below.
*:Git!*
:Git! {args} Run an arbitrary git command in the background and
stream the output to the preview window. Requires a
Vim with |setbufline()|. Press CTRL-D during an
interactive :Git invocation to switch to this mode
retroactively.
*:Git_--paginate* *:Git_-p*
:Git --paginate {args} Run an arbitrary git command, capture output to a temp
:Git -p {args} file, and |:split| that temp file. Use :0Git to
:G --paginate {args} |:edit| the temp file instead. A temp file is always
:G -p {args} used for commands like diff and log that typically
user a pager, and for any command that has the
pager.<cmd> Git configuration option set.
:Git -p {args} file, and |:split| that temp file. Pass ++curwin as
the first argument to |:edit| the temp file instead.
A temp file is always used for commands like diff and
log that typically uses a pager, and for any command
that has the pager.<cmd> Git configuration option set.
:{range}Git! --paginate {args}
:{range}Git! -p {args} Run an arbitrary git command, and insert the output
after {range} in the current buffer.
*fugitive-summary*
:Git With no arguments, bring up a summary window vaguely
:G akin to git-status. Press g? or see |fugitive-maps|
akin to git-status. Press g? or see |fugitive-maps|
for usage.
*:Git_blame*
@ -84,13 +98,17 @@ that are part of Git repositories).
*:Git_mergetool*
:Git mergetool [args] Like |:Git_difftool|, but target merge conflicts.
*:Ggrep* *:Gcgrep* *:Git_grep*
:Ggrep[!] [args] |:grep|[!] with git-grep as 'grepprg'.
:Git[!] grep [args]
*:Ggrep* *:Git_grep*
:Ggrep[!] [args] An approximation of |:grep|[!] with git-grep as
:Git[!] grep -O [args] 'grepprg'.
:Ggrep[!] --quiet [args]
:Ggrep[!] -q [args] Like |:Ggrep|, but instead of displaying output, open
the quickfix list.
*:Glgrep*
:Glgrep[!] [args] |:lgrep|[!] with git-grep as 'grepprg'.
:0Git[!] grep [args]
:Glgrep[!] [args] :Ggrep but for |:lgrep|.
:0Git[!] grep -O [args]
*:Gclog*
:Gclog[!] [args] Use git-log [args] to load the commit history into the
@ -170,10 +188,10 @@ that are part of Git repositories).
:Gdiffsplit [object] Perform a |vimdiff| against the given file, or if a
commit is given, the current file in that commit.
With no argument, the version in the index or work
tree is used. The newer of the two files is placed to
the right or bottom, depending on 'diffopt' and the
width of the window relative to 'textwidth'. Use
Vim's |do| and |dp| to stage and unstage changes.
tree is used, and the work tree version is always
placed to the right or bottom, depending on available
width. Use Vim's |do| and |dp| to stage and unstage
changes.
*:Gdiffsplit!*
:Gdiffsplit! Diff against any and all direct ancestors, retaining
@ -190,7 +208,10 @@ that are part of Git repositories).
:Gvdiffsplit [object] Like |:Gdiffsplit|, but always split vertically.
*:Ghdiffsplit*
:Ghdiffsplit [object] Like |:Gdiffsplit|, but always split horizontally.
:Gdiffsplit ++novertical [object]
:Ghdiffsplit [object] Like |:Gdiffsplit|, but with "vertical" removed from
'diffopt'. The split will still be vertical if
combined with |:vertical|.
*:GMove*
:GMove {destination} Wrapper around git-mv that renames the buffer
@ -606,11 +627,8 @@ AUTOCOMMANDS *fugitive-autocommands*
A handful of |User| |autocommands| are provided to allow extending and
overriding Fugitive behaviors. Example usage:
>
autocmd User FugitiveBlob call s:BlobOverrides()
autocmd User FugitiveBlob,FugitiveStageBlob call s:BlobOverrides()
<
*User_FugitiveIndex*
FugitiveIndex After loading the |fugitive-summary| buffer.
*User_FugitiveTag*
FugitiveTag After loading a tag object.
@ -621,10 +639,26 @@ FugitiveCommit After loading a commit object.
FugitiveTree After loading a tree (directory) object.
*User_FugitiveBlob*
FugitiveBlob After loading a blob (file) object. This includes
both committed blobs which are read only, and staged
blobs which can be edited and written. Check
&modifiable to distinguish between the two.
FugitiveBlob After loading a committed blob (file) object.
*User_FugitiveObject*
FugitiveObject After loading any of the 4 above buffer types.
*User_FugitiveStageBlob*
FugitiveStageBlob After loading a staged blob (file) object. These
buffers are 'modifiable' and oftentimes don't want the
same behavior as the other buffer types.
*User_FugitiveIndex*
FugitiveIndex After loading the |fugitive-summary| buffer.
*User_FugitivePager*
FugitivePager After loading a temp file created by a command like
:Git --paginate or :Git blame.
*User_FugitiveEditor*
FugitiveEditor After a :Git command (e.g., :Git commit) edits a file
(e.g., the commit message).
*User_FugitiveChanged*
FugitiveChanged After any event which can potentially change the
@ -661,7 +695,6 @@ version.
*:Gfetch* Superseded by |:Git| fetch.
*:Glog* Superseded by |:Gclog|.
*:Gstatus* Superseded by |:Git| (with no arguments).
*:Git!* Superseded by |:Git_--paginate|.
*:Gsplit!* Superseded by |:Git_--paginate|.
*:Gvsplit!* Superseded by :vert Git --paginate.
*:Gtabsplit!* Superseded by :tab Git --paginate.

View File

@ -1,6 +1,6 @@
" fugitive.vim - A Git wrapper so awesome, it should be illegal
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 3.3
" Version: 3.4
" GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim
if exists('g:loaded_fugitive')
@ -16,9 +16,9 @@ let s:bad_git_dir = '/$\|^fugitive:'
" Fugitive is active in the current buffer. Do not rely on this for direct
" filesystem access; use FugitiveFind('.git/whatever') instead.
function! FugitiveGitDir(...) abort
if v:version < 704
if v:version < 703
return ''
elseif !a:0 || type(a:1) == type(0) && a:1 < 0
elseif !a:0 || type(a:1) == type(0) && a:1 < 0 || a:1 is# get(v:, 'true', -1)
if exists('g:fugitive_event')
return g:fugitive_event
endif
@ -30,7 +30,7 @@ function! FugitiveGitDir(...) abort
return b:git_dir
endif
return dir =~# s:bad_git_dir ? '' : dir
elseif type(a:1) == type(0)
elseif type(a:1) == type(0) && a:1 isnot# 0
if a:1 == bufnr('') && (!exists('b:git_dir') || b:git_dir =~# s:bad_git_dir) && empty(&buftype)
let b:git_dir = FugitiveExtractGitDir(expand('%:p'))
endif
@ -55,7 +55,11 @@ endfunction
" exists, call FooReal("foo://bar").
function! FugitiveReal(...) abort
let file = a:0 ? a:1 : @%
if file =~# '^\a\a\+:' || a:0 > 1
if type(file) ==# type({})
let dir = FugitiveGitDir(file)
let tree = s:Tree(dir)
return FugitiveVimPath(empty(tree) ? dir : tree)
elseif file =~# '^\a\a\+:' || a:0 > 1
return call('fugitive#Real', [file] + a:000[1:-1])
elseif file =~# '^/\|^\a:\|^$'
return file
@ -72,14 +76,10 @@ endfunction
" An optional second argument provides the Git dir, or the buffer number of a
" buffer with a Git dir. The default is the current buffer.
function! FugitiveFind(...) abort
return fugitive#Find(a:0 ? a:1 : bufnr(''), FugitiveGitDir(a:0 > 1 ? a:2 : -1))
endfunction
function! FugitivePath(...) abort
if a:0 > 1
return fugitive#Path(a:1, a:2, FugitiveGitDir(a:0 > 2 ? a:3 : -1))
if a:0 && (type(a:1) ==# type({}) || type(a:1) ==# type(0))
return call('fugitive#Find', a:000[1:-1] + [FugitiveGitDir(a:1)])
else
return FugitiveReal(a:0 ? a:1 : @%)
return fugitive#Find(a:0 ? a:1 : bufnr(''), FugitiveGitDir(a:0 > 1 ? a:2 : -1))
endif
endfunction
@ -99,6 +99,14 @@ function! FugitiveParse(...) abort
throw v:errmsg
endfunction
" FugitiveGitVersion() queries the version of Git in use. Pass up to 3
" arguments to return a Boolean of whether a certain minimum version is
" available (FugitiveGitVersion(2,3,4) checks for 2.3.4 or higher) or no
" arguments to get a raw string.
function! FugitiveGitVersion(...) abort
return call('fugitive#GitVersion', a:000)
endfunction
" FugitiveResult() returns an object encapsulating the result of the most
" recent :Git command. Will be empty if no result is available. During a
" User FugitiveChanged event, this is guaranteed to correspond to the :Git
@ -108,7 +116,7 @@ endfunction
"
" * "args": List of command arguments, starting with the subcommand. Will be
" empty for usages like :Git --help.
" * "dir": Git dir of the relevant repository.
" * "git_dir": Git dir of the relevant repository.
" * "exit_status": The integer exit code of the process.
" * "flags": Flags passed directly to Git, like -c and --help.
" * "file": Path to file containing command output. Not guaranteed to exist,
@ -117,16 +125,44 @@ function! FugitiveResult(...) abort
return call('fugitive#Result', a:000)
endfunction
" FugitivePrepare() constructs a Git command string which can be executed with
" functions like system() and commands like :!. Integer arguments will be
" treated as buffer numbers, and the appropriate relative path inserted in
" their place.
" FugitiveExecute() runs Git with a list of arguments and returns a dictionary
" with the following keys:
"
" If the first argument is a string that looks like a path or an empty string,
" it will be used as the Git dir. If it's a buffer number, the Git dir for
" that buffer will be used. The default is the current buffer.
" * "exit_status": The integer exit code of the process.
" * "stdout": The stdout produced by the process, as a list of lines.
" * "stderr": The stdout produced by the process, as a list of lines.
"
" An optional second argument provides the Git dir, or the buffer number of a
" buffer with a Git dir. The default is the current buffer.
"
" An optional final argument is a callback Funcref, for asynchronous
" execution.
function! FugitiveExecute(args, ...) abort
return call('fugitive#Execute', [a:args] + a:000)
endfunction
" FugitiveShellCommand() turns an array of arugments into a Git command string
" which can be executed with functions like system() and commands like :!.
" Integer arguments will be treated as buffer numbers, and the appropriate
" relative path inserted in their place.
"
" An optional second argument provides the Git dir, or the buffer number of a
" buffer with a Git dir. The default is the current buffer.
function! FugitiveShellCommand(...) abort
return call('fugitive#ShellCommand', a:000)
endfunction
" FugitivePrepare() is a deprecated alias for FugitiveShellCommand(). If you
" are using this in conjunction with system(), consider using
" FugitiveExecute() instead.
function! FugitivePrepare(...) abort
return call('fugitive#Prepare', a:000)
if !exists('s:did_prepare_warning')
let s:did_prepare_warning = 1
echohl WarningMsg
unsilent echomsg 'FugitivePrepare() has been superseded by FugitiveShellCommand()'
echohl NONE
endif
return call('fugitive#ShellCommand', a:000)
endfunction
" FugitiveConfig() get returns an opaque structure that can be passed to other
@ -171,7 +207,19 @@ endfunction
" An optional second argument provides the Git dir, or the buffer number of a
" buffer with a Git dir. The default is the current buffer.
function! FugitiveRemoteUrl(...) abort
return fugitive#RemoteUrl(a:0 ? a:1 : '', a:0 > 1 ? a:2 : -1, a:0 > 2 ? a:3 : 0)
return call('fugitive#RemoteUrl', a:000)
endfunction
" FugitiveDidChange() triggers a FugitiveChanged event and reloads the summary
" buffer for the current or given buffer number's repository. You can also
" give the result of a FugitiveExecute() and that context will be made
" available inside the FugitiveChanged() event.
"
" Passing the special argument 0 (the number zero) softly expires summary
" buffers for all repositories. This can be used after a call to system()
" with unclear implications.
function! FugitiveDidChange(...) abort
return call('fugitive#DidChange', a:000)
endfunction
" FugitiveHead() retrieves the name of the current branch. If the current HEAD
@ -182,15 +230,36 @@ endfunction
" An optional second argument provides the Git dir, or the buffer number of a
" buffer with a Git dir. The default is the current buffer.
function! FugitiveHead(...) abort
let dir = FugitiveGitDir(a:0 > 1 ? a:2 : -1)
if a:0 && (type(a:1) ==# type({}) || type(a:1) ==# type('') && a:1 !~# '^\d\+$')
let dir = FugitiveGitDir(a:1)
let arg = get(a:, 2, 0)
elseif a:0 > 1
let dir = FugitiveGitDir(a:2)
let arg = a:1
else
let dir = FugitiveGitDir()
let arg = get(a:, 1, 0)
endif
if empty(dir)
return ''
endif
return fugitive#Head(a:0 ? a:1 : 0, dir)
return fugitive#Head(arg, dir)
endfunction
function! FugitivePath(...) abort
if a:0 > 2 && type(a:1) ==# type({})
return fugitive#Path(a:2, a:3, FugitiveGitDir(a:1))
elseif a:0 && type(a:1) ==# type({})
return FugitiveReal(a:0 > 1 ? a:2 : @%)
elseif a:0 > 1
return fugitive#Path(a:1, a:2, FugitiveGitDir(a:0 > 2 ? a:3 : -1))
else
return FugitiveReal(a:0 ? a:1 : @%)
endif
endfunction
function! FugitiveStatusline(...) abort
if empty(get(b:, 'git_dir', ''))
if empty(FugitiveGitDir(bufnr('')))
return ''
endif
return fugitive#Statusline()
@ -213,9 +282,12 @@ function! FugitiveWorkTree(...) abort
endif
endfunction
function! FugitiveIsGitDir(path) abort
let path = substitute(a:path, '[\/]$', '', '') . '/'
return len(a:path) && getfsize(path.'HEAD') > 10 && (
function! FugitiveIsGitDir(...) abort
if !a:0 || type(a:1) !=# type('')
return !empty(call('FugitiveGitDir', a:000))
endif
let path = substitute(a:1, '[\/]$', '', '') . '/'
return len(path) && getfsize(path.'HEAD') > 10 && (
\ isdirectory(path.'objects') && isdirectory(path.'refs') ||
\ getftype(path.'commondir') ==# 'file')
endfunction
@ -279,7 +351,13 @@ function! s:CeilingDirectories() abort
endfunction
function! FugitiveExtractGitDir(path) abort
let path = s:Slash(a:path)
if type(a:path) ==# type({})
return get(a:path, 'git_dir', '')
elseif type(a:path) == type(0)
let path = s:Slash(a:path >= 0 ? bufname(a:path) : bufname(''))
else
let path = s:Slash(a:path)
endif
if path =~# '^fugitive:'
return matchstr(path, '\C^fugitive:\%(//\)\=\zs.\{-\}\ze\%(//\|::\|$\)')
elseif empty(path)
@ -335,15 +413,18 @@ function! FugitiveExtractGitDir(path) abort
return ''
endfunction
function! FugitiveDetect(path) abort
if v:version < 704
function! FugitiveDetect(...) abort
if v:version < 703
return ''
endif
if exists('b:git_dir') && b:git_dir =~# '^$\|' . s:bad_git_dir
unlet b:git_dir
endif
if a:0 > 1 && a:2 is# 0 && !exists('#User#Fugitive')
return ''
endif
if !exists('b:git_dir')
let b:git_dir = FugitiveExtractGitDir(a:path)
let b:git_dir = FugitiveExtractGitDir(a:0 ? a:1 : bufnr(''))
endif
if empty(b:git_dir) || !exists('#User#Fugitive')
return ''
@ -397,14 +478,14 @@ function! s:ProjectionistDetect() abort
if exists('+shellslash') && !&shellslash
let base = tr(base, '/', '\')
endif
let file = FugitiveCommonDir(dir) . '/info/projections.json'
let file = FugitiveFind('.git/info/projections.json', dir)
if filereadable(file)
call projectionist#append(base, file)
endif
endif
endfunction
let s:addr_other = has('patch-8.1.560') ? '-addr=other' : ''
let s:addr_other = has('patch-8.1.560') || has('nvim-0.5.0') ? '-addr=other' : ''
let s:addr_tabs = has('patch-7.4.542') ? '-addr=tabs' : ''
let s:addr_wins = has('patch-7.4.542') ? '-addr=windows' : ''
@ -413,16 +494,22 @@ if exists(':G') != 2
endif
command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete Git exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)
if exists(':Gstatus') != 2 && get(g:, 'fugitive_legacy_commands', 1)
if exists(':Gstatus') != 2 && get(g:, 'fugitive_legacy_commands', 0)
exe 'command! -bang -bar -range=-1' s:addr_other 'Gstatus exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
\ '|echohl WarningMSG|echomsg ":Gstatus is deprecated in favor of :Git (with no arguments)"|echohl NONE'
elseif exists(':Gstatus') != 2 && !exists('g:fugitive_legacy_commands')
exe 'command! -bang -bar -range=-1' s:addr_other 'Gstatus'
\ ' echoerr ":Gstatus has been removed in favor of :Git (with no arguments)"'
endif
for s:cmd in ['Commit', 'Revert', 'Merge', 'Rebase', 'Pull', 'Push', 'Fetch', 'Blame']
if exists(':G' . tolower(s:cmd)) != 2 && get(g:, 'fugitive_legacy_commands', 1)
if exists(':G' . tolower(s:cmd)) != 2 && get(g:, 'fugitive_legacy_commands', 0)
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#' . s:cmd . 'Complete G' . tolower(s:cmd)
\ 'echohl WarningMSG|echomsg ":G' . tolower(s:cmd) . ' is deprecated in favor of :Git ' . tolower(s:cmd) . '"|echohl NONE|'
\ 'exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", "' . tolower(s:cmd) . ' " . <q-args>)'
elseif exists(':G' . tolower(s:cmd)) != 2 && !exists('g:fugitive_legacy_commands')
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#' . s:cmd . 'Complete G' . tolower(s:cmd)
\ 'echoerr ":G' . tolower(s:cmd) . ' has been removed in favor of :Git ' . tolower(s:cmd) . '"'
endif
endfor
unlet s:cmd
@ -431,66 +518,68 @@ exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Gcd
exe "command! -bar -bang -nargs=? -complete=customlist,fugitive#CdComplete Glcd exe fugitive#Cd(<q-args>, 1)"
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Ggrep exe fugitive#GrepCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Gcgrep exe fugitive#GrepCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugitive#GrepComplete Glgrep exe fugitive#GrepCommand(0, <count> > 0 ? <count> : 0, +"<range>", <bang>0, "<mods>", <q-args>)'
if exists(':Glog') != 2 && get(g:, 'fugitive_legacy_commands', 1)
if exists(':Glog') != 2 && get(g:, 'fugitive_legacy_commands', 0)
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Glog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "")'
\ '|echohl WarningMSG|echomsg ":Glog is deprecated in favor of :Gclog"|echohl NONE'
elseif exists(':Glog') != 2 && !exists('g:fugitive_legacy_commands')
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Glog'
\ ' echoerr ":Glog has been removed in favor of :Gclog"'
endif
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gclog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "c")'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete GcLog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "c")'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gllog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "l")'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete GlLog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "l")'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ge exe fugitive#Open("edit<bang>", 0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gedit exe fugitive#Open("edit<bang>", 0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#ReadComplete Gpedit exe fugitive#Open("pedit", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -range=-1' s:addr_other '-complete=customlist,fugitive#ReadComplete Gsplit exe fugitive#Open((<count> > 0 ? <count> : "").(<count> ? "split" : "edit"), <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -range=-1' s:addr_other '-complete=customlist,fugitive#ReadComplete Gvsplit exe fugitive#Open((<count> > 0 ? <count> : "").(<count> ? "vsplit" : "edit!"), <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -range=-1' s:addr_tabs '-complete=customlist,fugitive#ReadComplete Gtabedit exe fugitive#Open((<count> >= 0 ? <count> : "")."tabedit", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ge exe fugitive#Open("edit<bang>", 0, "<mods>", <q-args>)'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gedit exe fugitive#Open("edit<bang>", 0, "<mods>", <q-args>)'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#ReadComplete Gpedit exe fugitive#Open("pedit", <bang>0, "<mods>", <q-args>)'
exe 'command! -bar -bang -nargs=* -range=-1' s:addr_other '-complete=customlist,fugitive#ReadComplete Gsplit exe fugitive#Open((<count> > 0 ? <count> : "").(<count> ? "split" : "edit"), <bang>0, "<mods>", <q-args>)'
exe 'command! -bar -bang -nargs=* -range=-1' s:addr_other '-complete=customlist,fugitive#ReadComplete Gvsplit exe fugitive#Open((<count> > 0 ? <count> : "").(<count> ? "vsplit" : "edit!"), <bang>0, "<mods>", <q-args>)'
exe 'command! -bar -bang -nargs=* -range=-1' s:addr_tabs '-complete=customlist,fugitive#ReadComplete Gtabedit exe fugitive#Open((<count> >= 0 ? <count> : "")."tabedit", <bang>0, "<mods>", <q-args>)'
if exists(':Gr') != 2
exe 'command! -bar -bang -nargs=* -range=-1 -complete=customlist,fugitive#ReadComplete Gr exe fugitive#ReadCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -range=-1 -complete=customlist,fugitive#ReadComplete Gr exe fugitive#ReadCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
endif
exe 'command! -bar -bang -nargs=* -range=-1 -complete=customlist,fugitive#ReadComplete Gread exe fugitive#ReadCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -range=-1 -complete=customlist,fugitive#ReadComplete Gread exe fugitive#ReadCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gdiffsplit exe fugitive#Diffsplit(1, <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ghdiffsplit exe fugitive#Diffsplit(0, <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gvdiffsplit exe fugitive#Diffsplit(0, <bang>0, "vertical <mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gdiffsplit exe fugitive#Diffsplit(1, <bang>0, "<mods>", <q-args>)'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Ghdiffsplit exe fugitive#Diffsplit(0, <bang>0, "<mods>", <q-args>)'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gvdiffsplit exe fugitive#Diffsplit(0, <bang>0, "vertical <mods>", <q-args>)'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gw exe fugitive#WriteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwrite exe fugitive#WriteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwq exe fugitive#WqCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gw exe fugitive#WriteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwrite exe fugitive#WriteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bar -bang -nargs=* -complete=customlist,fugitive#EditComplete Gwq exe fugitive#WqCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bar -bang -nargs=0 GRemove exe fugitive#RemoveCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=0 GDelete exe fugitive#DeleteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject GMove exe fugitive#MoveCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete GRename exe fugitive#RenameCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=0 GRemove exe fugitive#RemoveCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bar -bang -nargs=0 GDelete exe fugitive#DeleteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject GMove exe fugitive#MoveCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete GRename exe fugitive#RenameCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
if exists(':Gremove') != 2 && get(g:, 'fugitive_legacy_commands', 1)
exe 'command! -bar -bang -nargs=0 Gremove exe fugitive#RemoveCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=0 Gremove exe fugitive#RemoveCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
\ '|echohl WarningMSG|echomsg ":Gremove is deprecated in favor of :GRemove"|echohl NONE'
endif
if exists(':Gdelete') != 2 && get(g:, 'fugitive_legacy_commands', 1)
exe 'command! -bar -bang -nargs=0 Gdelete exe fugitive#DeleteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=0 Gdelete exe fugitive#DeleteCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
\ '|echohl WarningMSG|echomsg ":Gdelete is deprecated in favor of :GDelete"|echohl NONE'
endif
if exists(':Gmove') != 2 && get(g:, 'fugitive_legacy_commands', 1)
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject Gmove exe fugitive#MoveCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject Gmove exe fugitive#MoveCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
\ '|echohl WarningMSG|echomsg ":Gmove is deprecated in favor of :GMove"|echohl NONE'
endif
if exists(':Grename') != 2 && get(g:, 'fugitive_legacy_commands', 1)
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete Grename exe fugitive#RenameCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#RenameComplete Grename exe fugitive#RenameCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
\ '|echohl WarningMSG|echomsg ":Grename is deprecated in favor of :GRename"|echohl NONE'
endif
exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject GBrowse exe fugitive#BrowseCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject GBrowse exe fugitive#BrowseCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
if exists(':Gbrowse') != 2 && get(g:, 'fugitive_legacy_commands', 1)
exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject Gbrowse exe fugitive#BrowseCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>, [<f-args>])'
exe 'command! -bar -bang -range=-1 -nargs=* -complete=customlist,fugitive#CompleteObject Gbrowse exe fugitive#BrowseCommand(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
\ '|if <bang>1|redraw!|endif|echohl WarningMSG|echomsg ":Gbrowse is deprecated in favor of :GBrowse"|echohl NONE'
endif
if v:version < 704
if v:version < 703
finish
endif
@ -514,8 +603,9 @@ let g:io_fugitive = {
augroup fugitive
autocmd!
autocmd BufNewFile,BufReadPost * call FugitiveDetect(expand('<amatch>:p'))
autocmd FileType netrw call FugitiveDetect(fnamemodify(get(b:, 'netrw_curdir', expand('<amatch>')), ':p'))
autocmd BufNewFile,BufReadPost *
\ call FugitiveDetect(expand('<amatch>:p'), 0)
autocmd FileType netrw call FugitiveDetect(fnamemodify(get(b:, 'netrw_curdir', expand('<afile>:p')), ':p'), 1)
autocmd FileType git
\ call fugitive#MapCfile()
@ -526,7 +616,7 @@ augroup fugitive
\ setlocal foldtext=fugitive#Foldtext() |
\ endif
autocmd FileType fugitive
\ call fugitive#MapCfile('fugitive#StatusCfile()')
\ call fugitive#MapCfile('fugitive#PorcelainCfile()')
autocmd FileType gitrebase
\ let &l:include = '^\%(pick\|squash\|edit\|reword\|fixup\|drop\|[pserfd]\)\>' |
\ if &l:includeexpr !~# 'Fugitive' |
@ -570,15 +660,12 @@ endif
let s:nowait = v:version >= 704 ? '<nowait>' : ''
function! s:Map(mode, lhs, rhs, ...) abort
for mode in split(a:mode, '\zs')
let flags = (a:0 ? a:1 : '') . (a:rhs =~# '<Plug>' ? '' : '<script>')
let head = a:lhs
let tail = ''
let keys = get(g:, mode.'remap', {})
if type(keys) == type([])
return
endif
function! s:Map(mode, lhs, rhs, flags) abort
let flags = a:flags . (a:rhs =~# '<Plug>' ? '' : '<script>')
let head = a:lhs
let tail = ''
let keys = get(g:, a:mode.'remap', {})
if len(keys) && type(keys) == type({})
while !empty(head)
if has_key(keys, head)
let head = keys[head]
@ -590,10 +677,10 @@ function! s:Map(mode, lhs, rhs, ...) abort
let tail = matchstr(head, '<[^<>]*>$\|.$') . tail
let head = substitute(head, '<[^<>]*>$\|.$', '', '')
endwhile
if flags !~# '<unique>' || empty(mapcheck(head.tail, mode))
exe mode.'map' s:nowait flags head.tail a:rhs
endif
endfor
endif
if flags !~# '<unique>' || empty(mapcheck(head.tail, a:mode))
exe a:mode.'map' s:nowait flags head.tail a:rhs
endif
endfunction
call s:Map('c', '<C-R><C-G>', 'fnameescape(fugitive#Object(@%))', '<expr>')

View File

@ -13,10 +13,10 @@ syn match fugitiveHeader /^Pull:\|^Rebase:\|^Merge:\|^Push:/ nextgroup=fugitiveS
syn match fugitiveHelpHeader /^Help:/ nextgroup=fugitiveHelpTag skipwhite
syn match fugitiveHelpTag /\S\+/ contained
syn region fugitiveSection start=/^\%(.*(\d\+)$\)\@=/ contains=fugitiveHeading end=/^$/
syn region fugitiveSection start=/^\%(.*(\d\++\=)$\)\@=/ contains=fugitiveHeading end=/^$/
syn cluster fugitiveSection contains=fugitiveSection
syn match fugitiveHeading /^[A-Z][a-z][^:]*\ze (\d\+)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite
syn match fugitiveCount /(\d\+)/hs=s+1,he=e-1 contained
syn match fugitiveHeading /^[A-Z][a-z][^:]*\ze (\d\++\=)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite
syn match fugitiveCount /(\d\++\=)/hs=s+1,he=e-1 contained
syn match fugitivePreposition /\<\%([io]nto\|from\|to\|Rebasing\%( detached\)\=\)\>/ transparent contained nextgroup=fugitiveHash,fugitiveSymbolicRef skipwhite
syn match fugitiveInstruction /^\l\l\+\>/ contained containedin=@fugitiveSection nextgroup=fugitiveHash skipwhite
@ -30,10 +30,10 @@ syn match fugitiveHash /\S\@<!\x\{4,\}\S\@!/ contained
syn region fugitiveHunk start=/^\%(@@\+ -\)\@=/ end=/^\%([A-Za-z?@]\|$\)\@=/ contains=diffLine,diffRemoved,diffAdded,diffNoEOL containedin=@fugitiveSection fold
for s:section in ['Untracked', 'Unstaged', 'Staged']
exe 'syn region fugitive' . s:section . 'Section start=/^\%(' . s:section . ' .*(\d\+)$\)\@=/ contains=fugitive' . s:section . 'Heading end=/^$/'
exe 'syn region fugitive' . s:section . 'Section start=/^\%(' . s:section . ' .*(\d\++\=)$\)\@=/ contains=fugitive' . s:section . 'Heading end=/^$/'
exe 'syn match fugitive' . s:section . 'Modifier /^[MADRCU?] / contained containedin=fugitive' . s:section . 'Section'
exe 'syn cluster fugitiveSection add=fugitive' . s:section . 'Section'
exe 'syn match fugitive' . s:section . 'Heading /^[A-Z][a-z][^:]*\ze (\d\+)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite'
exe 'syn match fugitive' . s:section . 'Heading /^[A-Z][a-z][^:]*\ze (\d\++\=)$/ contains=fugitivePreposition contained nextgroup=fugitiveCount skipwhite'
endfor
unlet s:section

View File

@ -283,6 +283,9 @@ You can customise:
* How to handle non-gitgutter signs
* The signs' colours and symbols
* Line highlights
* Line number highlights (only in Neovim 0.3.2 or higher)
* The diff syntax colours used in the preview window
* The intra-line diff highlights used in the preview window
* Whether the diff is relative to the index (default) or working tree.
* The base of the diff
* Extra arguments for `git` when running `git diff`
@ -395,6 +398,35 @@ highlight link GitGutterChangeLineNr Underlined
```
#### The diff syntax colours used in the preview window
To change the diff syntax colours used in the preview window, set up the `diff*` highlight groups in your colorscheme or `~/.vimrc`:
```viml
diffAdded " if not set: use GitGutterAdd's foreground colour
diffChanged " if not set: use GitGutterChange's foreground colour
diffRemoved " if not set: use GitGutterDelete's foreground colour
```
Note the `diff*` highlight groups are used in any buffer whose `'syntax'` is `diff`.
#### The intra-line diff highlights used in the preview window
To change the intra-line diff highlights used in the preview window, set up the following highlight groups in your colorscheme or `~/.vimrc`:
```viml
GitGutterAddIntraLine " default: gui=reverse cterm=reverse
GitGutterDeleteIntraLine " default: gui=reverse cterm=reverse
```
For example, to use `DiffAdd` for intra-line added regions:
```viml
highlight link GitGutterAddIntraLine DiffAdd
```
#### Whether the diff is relative to the index or working tree
By default diffs are relative to the index. How you can make them relative to the working tree:

View File

@ -205,6 +205,10 @@ function! gitgutter#quickfix(current_file)
elseif line =~ '^diff --git "'
let [_, fnamel, _, fnamer] = split(line, '"')
let fname = fnamel ==# fnamer ? fnamel : fnamel[2:]
elseif line =~ '^diff --cc [^"]'
let fname = line[10:]
elseif line =~ '^diff --cc "'
let [_, fname] = split(line, '"')
elseif line =~ '^@@'
let lnum = matchlist(line, '+\(\d\+\)')[1]
elseif lnum > 0

View File

@ -109,8 +109,8 @@ function! gitgutter#highlight#define_highlights() abort
highlight default link GitGutterChangeDeleteLineNr CursorLineNr
" Highlights used intra line.
highlight GitGutterAddIntraLine gui=reverse cterm=reverse
highlight GitGutterDeleteIntraLine gui=reverse cterm=reverse
highlight default GitGutterAddIntraLine gui=reverse cterm=reverse
highlight default GitGutterDeleteIntraLine gui=reverse cterm=reverse
" Set diff syntax colours (used in the preview window) - diffAdded,diffChanged,diffRemoved -
" to match the signs, if not set aleady.
for [dtype,type] in [['Added','Add'], ['Changed','Change'], ['Removed','Delete']]

View File

@ -608,6 +608,26 @@ For example, to use |hl-Underlined| instead of |hl-CursorLineNr|:
>
highlight link GitGutterChangeLineNr Underlined
<
To change the diff syntax colours used in the preview window, set up the diff*
highlight groups in your colorscheme or |vimrc|:
>
diffAdded " if not set: use GitGutterAdd's foreground colour
diffChanged " if not set: use GitGutterChange's foreground colour
diffRemoved " if not set: use GitGutterDelete's foreground colour
<
Note the diff* highlight groups are used in any buffer whose 'syntax' is
"diff".
To change the intra-line diff highlights used in the preview window, set up
the following highlight groups in your colorscheme or |vimrc|:
>
GitGutterAddIntraLine " default: gui=reverse cterm=reverse
GitGutterDeleteIntraLine " default: gui=reverse cterm=reverse
<
For example, to use |hl-DiffAdd| for intra-line added regions:
>
highlight link GitGutterAddIntraLine DiffAdd
<
===============================================================================

View File

@ -296,8 +296,8 @@ augroup gitgutter
autocmd ColorScheme * call gitgutter#highlight#define_highlights()
" Disable during :vimgrep
autocmd QuickFixCmdPre *vimgrep* let g:gitgutter_enabled = 0
autocmd QuickFixCmdPost *vimgrep* let g:gitgutter_enabled = 1
autocmd QuickFixCmdPre *vimgrep* let [g:gitgutter_was_enabled, g:gitgutter_enabled] = [g:gitgutter_enabled, 0]
autocmd QuickFixCmdPost *vimgrep* let g:gitgutter_enabled = g:gitgutter_was_enabled | unlet g:gitgutter_was_enabled
augroup END
" }}}

View File

@ -19,7 +19,7 @@ setlocal indentkeys+=0],0)
" "+norm! gg=G" '+%print' '+:q!' testfile.js \
" | diff -uBZ testfile.js -
let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys<'
let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys< lisp<'
" Only define the function once.
if exists('*GetJavascriptIndent')

View File

@ -2,7 +2,7 @@ GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.2.5)
rake (12.3.3)
rake (10.4.2)
rspec (3.4.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)

View File

@ -0,0 +1,20 @@
Copyright (c) Tim Pope
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,330 @@
" Location: autoload/rhubarb.vim
" Author: Tim Pope <http://tpo.pe/>
if exists('g:autoloaded_rhubarb')
finish
endif
let g:autoloaded_rhubarb = 1
" Section: Utility
function! s:throw(string) abort
let v:errmsg = 'rhubarb: '.a:string
throw v:errmsg
endfunction
function! s:shellesc(arg) abort
if a:arg =~# '^[A-Za-z0-9_/.-]\+$'
return a:arg
elseif &shell =~# 'cmd' && a:arg !~# '"'
return '"'.a:arg.'"'
else
return shellescape(a:arg)
endif
endfunction
function! rhubarb#HomepageForUrl(url) abort
let dict_or_list = get(g:, 'github_enterprise_urls', get(g:, 'fugitive_github_domains', {}))
if type(dict_or_list) ==# type({})
let domains = dict_or_list
elseif type(dict_or_list) == type([])
let domains = {}
for domain in dict_or_list
let domains[substitute(domain, '^.\{-\}://', '', '')] = domain
endfor
else
let domains = {}
endif
" [full_url, scheme, host_with_port, host, path]
if a:url =~# '://'
let match = matchlist(a:url, '^\(https\=://\|git://\|ssh://\)\%([^@/]\+@\)\=\(\([^/:]\+\)\%(:\d\+\)\=\)/\(.\{-\}\)\%(\.git\)\=/\=$')
else
let match = matchlist(a:url, '^\([^@/]\+@\)\=\(\([^:/]\+\)\):\(.\{-\}\)\%(\.git\)\=/\=$')
if !empty(match)
let match[1] = 'ssh://'
endif
endif
if empty(match)
return ''
elseif match[3] ==# 'github.com' || match[3] ==# 'ssh.github.com'
return 'https://github.com/' . match[4]
elseif has_key(domains, match[1] . match[2])
let key = match[1] . match[2]
elseif has_key(domains, match[2])
let key = match[2]
elseif has_key(domains, match[3])
let key = match[3]
else
return ''
endif
let root = domains[key]
if type(root) !=# type('') && root
let root = key
endif
if empty(root)
return ''
elseif root !~# '://'
let root = (match[1] =~# '^http://' ? 'http://' : 'https://') . root
endif
return substitute(root, '/$', '', '') . '/' . match[4]
endfunction
function! rhubarb#homepage_for_url(url) abort
return rhubarb#HomepageForUrl(a:url)
endfunction
function! s:repo_homepage() abort
if exists('b:rhubarb_homepage')
return b:rhubarb_homepage
endif
let remote = FugitiveRemoteUrl()
let homepage = rhubarb#HomepageForUrl(remote)
if !empty(homepage)
let b:rhubarb_homepage = homepage
return b:rhubarb_homepage
endif
call s:throw((len(remote) ? remote : 'origin') . ' is not a GitHub repository')
endfunction
" Section: HTTP
function! s:credentials() abort
if !exists('g:github_user')
let g:github_user = $GITHUB_USER
if g:github_user ==# '' && exists('*FugitiveConfigGet')
let g:github_user = FugitiveConfigGet('github.user', '')
endif
if g:github_user ==# ''
let g:github_user = $LOGNAME
endif
endif
if !exists('g:github_password')
let g:github_password = $GITHUB_PASSWORD
if g:github_password ==# '' && exists('*FugitiveConfigGet')
let g:github_password = FugitiveConfigGet('github.password', '')
endif
endif
return g:github_user.':'.g:github_password
endfunction
function! rhubarb#JsonDecode(string) abort
if exists('*json_decode')
return json_decode(a:string)
endif
let [null, false, true] = ['', 0, 1]
let stripped = substitute(a:string,'\C"\(\\.\|[^"\\]\)*"','','g')
if stripped !~# "[^,:{}\\[\\]0-9.\\-+Eaeflnr-u \n\r\t]"
try
return eval(substitute(a:string,"[\r\n]"," ",'g'))
catch
endtry
endif
call s:throw("invalid JSON: ".a:string)
endfunction
function! rhubarb#JsonEncode(object) abort
if exists('*json_encode')
return json_encode(a:object)
endif
if type(a:object) == type('')
return '"' . substitute(a:object, "[\001-\031\"\\\\]", '\=printf("\\u%04x", char2nr(submatch(0)))', 'g') . '"'
elseif type(a:object) == type([])
return '['.join(map(copy(a:object), 'rhubarb#JsonEncode(v:val)'),', ').']'
elseif type(a:object) == type({})
let pairs = []
for key in keys(a:object)
call add(pairs, rhubarb#JsonEncode(key) . ': ' . rhubarb#JsonEncode(a:object[key]))
endfor
return '{' . join(pairs, ', ') . '}'
else
return string(a:object)
endif
endfunction
function! s:curl_arguments(path, ...) abort
let options = a:0 ? a:1 : {}
let args = ['curl', '-q', '--silent']
call extend(args, ['-H', 'Accept: application/json'])
call extend(args, ['-H', 'Content-Type: application/json'])
call extend(args, ['-A', 'rhubarb.vim'])
if get(options, 'auth', '') =~# ':'
call extend(args, ['-u', options.auth])
elseif has_key(options, 'auth')
call extend(args, ['-H', 'Authorization: bearer ' . options.auth])
elseif exists('g:RHUBARB_TOKEN')
call extend(args, ['-H', 'Authorization: bearer ' . g:RHUBARB_TOKEN])
elseif s:credentials() !~# '^[^:]*:$'
call extend(args, ['-u', s:credentials()])
elseif has('win32') && filereadable(expand('~/.netrc'))
call extend(args, ['--netrc-file', expand('~/.netrc')])
else
call extend(args, ['--netrc'])
endif
if has_key(options, 'method')
call extend(args, ['-X', toupper(options.method)])
endif
for header in get(options, 'headers', [])
call extend(args, ['-H', header])
endfor
if type(get(options, 'data', '')) != type('')
call extend(args, ['-d', rhubarb#JsonEncode(options.data)])
elseif has_key(options, 'data')
call extend(args, ['-d', options.data])
endif
call add(args, a:path)
return args
endfunction
function! rhubarb#Request(path, ...) abort
if !executable('curl')
call s:throw('cURL is required')
endif
if a:path =~# '://'
let path = a:path
elseif a:path =~# '^/'
let path = 'https://api.github.com' . a:path
else
let base = s:repo_homepage()
let path = substitute(a:path, '%s', matchstr(base, '[^/]\+/[^/]\+$'), '')
if base =~# '//github\.com/'
let path = 'https://api.github.com/' . path
else
let path = substitute(base, '[^/]\+/[^/]\+$', 'api/v3/', '') . path
endif
endif
let options = a:0 ? a:1 : {}
let args = s:curl_arguments(path, options)
if exists('*FugitiveExecute') && v:version >= 800
try
if has_key(options, 'callback')
return FugitiveExecute({'argv': args}, { r -> r.exit_status || r.stdout ==# [''] ? '' : options.callback(json_decode(join(r.stdout, ' '))) })
endif
let raw = join(FugitiveExecute({'argv': args}).stdout, ' ')
return empty(raw) ? raw : json_decode(raw)
catch /^fugitive:/
endtry
endif
let raw = system(join(map(copy(args), 's:shellesc(v:val)'), ' '))
if has_key(options, 'callback')
if !v:shell_error && !empty(raw)
call options.callback(rhubarb#JsonDecode(raw))
endif
return {}
endif
if raw ==# ''
return raw
else
return rhubarb#JsonDecode(raw)
endif
endfunction
function! rhubarb#request(...) abort
return call('rhubarb#Request', a:000)
endfunction
function! rhubarb#RepoRequest(...) abort
return rhubarb#Request('repos/%s' . (a:0 && a:1 !=# '' ? '/' . a:1 : ''), a:0 > 1 ? a:2 : {})
endfunction
function! rhubarb#repo_request(...) abort
return call('rhubarb#RepoRequest', a:000)
endfunction
function! s:url_encode(str) abort
return substitute(a:str, '[?@=&<>%#/:+[:space:]]', '\=submatch(0)==" "?"+":printf("%%%02X", char2nr(submatch(0)))', 'g')
endfunction
function! rhubarb#RepoSearch(type, q, ...) abort
return call('rhubarb#Request', ['search/'.a:type.'?per_page=100&q=repo:%s'.s:url_encode(' '.a:q)] + a:000)
endfunction
function! rhubarb#repo_search(...) abort
return call('rhubarb#RepoSearch', a:000)
endfunction
" Section: Issues
let s:reference = '\<\%(\c\%(clos\|resolv\|referenc\)e[sd]\=\|\cfix\%(e[sd]\)\=\)\>'
function! rhubarb#Complete(findstart, base) abort
if a:findstart
let existing = matchstr(getline('.')[0:col('.')-1],s:reference.'\s\+\zs[^#/,.;]*$\|[#@[:alnum:]-]*$')
return col('.')-1-strlen(existing)
endif
try
if a:base =~# '^@'
return map(rhubarb#RepoRequest('collaborators'), '"@".v:val.login')
else
if a:base =~# '^#'
let prefix = '#'
let query = ''
else
let prefix = s:repo_homepage().'/issues/'
let query = a:base
endif
let response = rhubarb#RepoSearch('issues', 'state:open '.query)
if type(response) != type({})
call s:throw('unknown error')
elseif has_key(response, 'message')
call s:throw(response.message)
else
let issues = get(response, 'items', [])
endif
return map(issues, '{"word": prefix.v:val.number, "abbr": "#".v:val.number, "menu": v:val.title, "info": substitute(empty(v:val.body) ? "\n" : v:val.body,"\\r","","g")}')
endif
catch /^rhubarb:.*is not a GitHub repository/
return []
catch /^\%(fugitive\|rhubarb\):/
echoerr v:errmsg
endtry
endfunction
function! rhubarb#omnifunc(findstart, base) abort
return rhubarb#Complete(a:findstart, a:base)
endfunction
" Section: Fugitive :GBrowse support
function! rhubarb#FugitiveUrl(...) abort
if a:0 == 1 || type(a:1) == type({})
let opts = a:1
let root = rhubarb#HomepageForUrl(get(opts, 'remote', ''))
else
return ''
endif
if empty(root)
return ''
endif
let path = substitute(opts.path, '^/', '', '')
if path =~# '^\.git/refs/heads/'
return root . '/commits/' . path[16:-1]
elseif path =~# '^\.git/refs/tags/'
return root . '/releases/tag/' . path[15:-1]
elseif path =~# '^\.git/refs/remotes/[^/]\+/.'
return root . '/commits/' . matchstr(path,'remotes/[^/]\+/\zs.*')
elseif path =~# '^\.git/\%(config$\|hooks\>\)'
return root . '/admin'
elseif path =~# '^\.git\>'
return root
endif
let commit = opts.commit
if get(opts, 'type', '') ==# 'tree' || opts.path =~# '/$'
let url = substitute(root . '/tree/' . commit . '/' . path, '/$', '', 'g')
elseif get(opts, 'type', '') ==# 'blob' || opts.path =~# '[^/]$'
let escaped_commit = substitute(commit, '#', '%23', 'g')
let url = root . '/blob/' . escaped_commit . '/' . path
if get(opts, 'line2') > 0 && get(opts, 'line1') == opts.line2
let url .= '#L' . opts.line1
elseif get(opts, 'line1') > 0 && get(opts, 'line2') > 0
let url .= '#L' . opts.line1 . '-L' . opts.line2
endif
else
let url = root . '/commit/' . commit
endif
return url
endfunction
function! rhubarb#fugitive_url(...) abort
return call('rhubarb#FugitiveUrl', a:000)
endfunction
" Section: End

View File

@ -0,0 +1,17 @@
*rhubarb.txt* fugitive.vim extension for GitHub
Author: Tim Pope <http://tpo.pe/>
License: MIT
Use |i_CTRL-X_CTRL-O| to omni-complete GitHub issues or project collaborator
usernames when editing a commit message.
Use Fugitive's |:GBrowse| to browse to the GitHub URL for the current buffer.
ABOUT *rhubarb-about*
Grab the latest version or report a bug on GitHub:
http://github.com/tpope/vim-rhubarb
vim:tw=78:et:ft=help:norl:

View File

@ -0,0 +1,53 @@
" rhubarb.vim - fugitive.vim extension for GitHub
" Maintainer: Tim Pope <http://tpo.pe/>
if exists("g:loaded_rhubarb") || v:version < 700 || &cp
finish
endif
let g:loaded_rhubarb = 1
if !exists('g:dispatch_compilers')
let g:dispatch_compilers = {}
endif
let g:dispatch_compilers['hub'] = 'git'
function! s:SetUpMessage(filename) abort
if &omnifunc !~# '^\%(syntaxcomplete#Complete\)\=$' ||
\ a:filename !~# '\.git[\/].*MSG$' ||
\ !exists('*FugitiveFind')
return
endif
let dir = exists('*FugitiveConfigGetRegexp') ? FugitiveGitDir() : FugitiveExtractGitDir(a:filename)
if empty(dir)
return
endif
let config_file = FugitiveFind('.git/config', dir)
let config = filereadable(config_file) ? readfile(config_file) : []
if !empty(filter(config,
\ '!empty(rhubarb#HomepageForUrl(matchstr(v:val, ''^\s*url\s*=\s*"\=\zs[^[:space:]"]*'')))'))
setlocal omnifunc=rhubarb#Complete
endif
endfunction
augroup rhubarb
autocmd!
if exists('+omnifunc')
autocmd FileType gitcommit call s:SetUpMessage(expand('<afile>:p'))
endif
autocmd BufEnter *
\ if expand('%') ==# '' && &previewwindow && pumvisible() && getbufvar('#', '&omnifunc') ==# 'rhubarb#omnifunc' |
\ setlocal nolist linebreak filetype=markdown |
\ endif
autocmd BufNewFile,BufRead *.git/{PULLREQ_EDIT,ISSUE_EDIT,RELEASE_EDIT}MSG
\ if &ft ==# '' || &ft ==# 'conf' |
\ set ft=gitcommit |
\ endif
augroup END
if !exists('g:fugitive_browse_handlers')
let g:fugitive_browse_handlers = []
endif
if index(g:fugitive_browse_handlers, function('rhubarb#FugitiveUrl')) < 0
call insert(g:fugitive_browse_handlers, function('rhubarb#FugitiveUrl'))
endif

View File

@ -33,6 +33,9 @@ au BufNewFile,BufRead Podfile,*.podspec call s:setf('ruby')
" Guard
au BufNewFile,BufRead Guardfile,.Guardfile call s:setf('ruby')
" Jb
au BufNewFile,BufRead *.jb call s:setf('ruby')
" Jbuilder
au BufNewFile,BufRead *.jbuilder call s:setf('ruby')

View File

@ -283,7 +283,7 @@ function! GetRubyIndent(...) abort
\ ]
" Most Significant line based on the previous one -- in case it's a
" contination of something above
" continuation of something above
let indent_info.plnum_msl = s:GetMSL(indent_info.plnum)
for callback_name in indent_callback_names

View File

@ -40,6 +40,12 @@ describe "Syntax highlighting" do
EOF
end
specify "magic comments - shareable_constant_value" do
assert_correct_highlighting <<~'EOF', 'shareable_constant_value', 'rubyMagicComment'
# shareable_constant_value: literal
EOF
end
specify "TODO comments" do
assert_correct_highlighting <<~'EOF', 'TODO', 'rubyTodo'
# TODO: turn off the oven

View File

@ -429,9 +429,10 @@ endif
" Comments and Documentation {{{1
syn match rubySharpBang "\%^#!.*" display
syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE HACK REVIEW XXX todo contained
syn match rubyEncoding "[[:alnum:]-]\+" contained display
syn match rubyEncoding "[[:alnum:]-_]\+" contained display
syn match rubyMagicComment "\c\%<3l#\s*\zs\%(coding\|encoding\):" contained nextgroup=rubyEncoding skipwhite
syn match rubyMagicComment "\c\%<10l#\s*\zs\%(frozen_string_literal\|warn_indent\|warn_past_scope\):" contained nextgroup=rubyBoolean skipwhite
syn match rubyMagicComment "\c\%<10l#\s*\zs\%(shareable_constant_value\):" contained nextgroup=rubyEncoding skipwhite
syn match rubyComment "#.*" contains=@rubyCommentSpecial,rubySpaceError,@Spell
syn cluster rubyCommentSpecial contains=rubySharpBang,rubyTodo,rubyMagicComment

View File

@ -157,4 +157,69 @@ endsnippet
snippet imp "import"
import ${2} from ${1}
endsnippet
# Debugging
snippet de
debugger`!p snip.rv = semi(snip)`
endsnippet
snippet cl "console.log"
console.log(${0})`!p snip.rv = semi(snip)`
endsnippet
snippet cd "console.debug"
console.debug(${0})`!p snip.rv = semi(snip)`
endsnippet
snippet ce "console.error"
console.error(${0})`!p snip.rv = semi(snip)`
endsnippet
snippet cw "console.warn"
console.warn(${0})`!p snip.rv = semi(snip)`
endsnippet
snippet ci "console.info"
console.info(${0})`!p snip.rv = semi(snip)`
endsnippet
snippet ct "console.trace"
console.trace(${0:label})`!p snip.rv = semi(snip)`
endsnippet
snippet ctime "console.time ... console.timeEnd"
console.time("${1:label}")`!p snip.rv = semi(snip)`
${0:${VISUAL}}
console.timeEnd("$1")`!p snip.rv = semi(snip)`
endsnippet
snippet ctimestamp "console.timeStamp"
console.timeStamp("${1:label}")`!p snip.rv = semi(snip)`
endsnippet
snippet ca "console.assert"
console.assert(${1:expression}, ${0:obj})`!p snip.rv = semi(snip)`
endsnippet
snippet cclear "console.clear"
console.clear()`!p snip.rv = semi(snip)`
endsnippet
snippet cdir "console.dir"
console.dir(${0:obj})`!p snip.rv = semi(snip)`
endsnippet
snippet cdirx "console.dirxml"
console.dirxml(${1:object})`!p snip.rv = semi(snip)`
endsnippet
snippet cgroup "console.group"
console.group("${1:label}")`!p snip.rv = semi(snip)`
${0:${VISUAL}}
console.groupEnd()`!p snip.rv = semi(snip)`
endsnippet
snippet cgroupc "console.groupCollapsed"
console.groupCollapsed("${1:label}")`!p snip.rv = semi(snip)`
${0:${VISUAL}}
console.groupEnd()`!p snip.rv = semi(snip)`
endsnippet
snippet cprof "console.profile"
console.profile("${1:label}")`!p snip.rv = semi(snip)`
${0:${VISUAL}}
console.profileEnd()`!p snip.rv = semi(snip)`
endsnippet
snippet ctable "console.table"
console.table(${1:"${2:value}"})`!p snip.rv = semi(snip)`
endsnippet
snippet clstr "console.log stringified"
console.log(JSON.stringify(${0}, null, 2))`!p snip.rv = semi(snip)`
endsnippet
# vim:ft=snippets:

View File

@ -112,12 +112,12 @@ snippet img "Image"
endsnippet
snippet ilc "Inline Code" i
\`$1\`$0
\`${1:${VISUAL}}\`$0
endsnippet
snippet cbl "Codeblock" b
\`\`\`
$1
\`\`\`$1
${2:${VISUAL}}
\`\`\`
$0
endsnippet

View File

@ -10,6 +10,17 @@ snippet #! "#!/usr/bin/env python" b
$0
endsnippet
snippet #!2 "#!/usr/bin/env python2" b
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
$0
endsnippet
snippet #!3 "#!/usr/bin/env python3" b
#!/usr/bin/env python3
$0
endsnippet
snippet "^# ?[uU][tT][fF]-?8" "# encoding: UTF-8" r
# -*- coding: utf-8 -*-
$0
@ -73,7 +84,23 @@ class Arg(object):
def get_args(arglist):
args = [Arg(arg) for arg in arglist.split(',') if arg]
args = []
n = len(arglist)
i = 0
while i < n:
l_bracket = 0
start = i
while i < n and (l_bracket > 0 or arglist[i] != ','):
if arglist[i] == '[':
l_bracket += 1
elif arglist[i] == ']' and l_bracket > 0:
l_bracket -= 1
i += 1
arg = arglist[start:i]
if arg:
args.append(Arg(arg))
i += 1
args = [arg for arg in args if arg.name != 'self']
return args

View File

@ -334,6 +334,33 @@ snippet getopt
${0}
}
}
## Assertions
snippet asr
assert(${1:condition});
snippet anl
assert(${1:ptr} != NULL);
## Dynamic Allocation
snippet mlc
${1:ptr} = (${2:type}*) malloc(sizeof($2));
snippet clc
${1:ptr} = (${2:type}*) calloc(${3:size}, sizeof($2));
snippet rlc
${1:ptr} = realloc($1, ${2:size} * sizeof(${3:type}));
snippet mlcd
${1:type} ${2:ptr} = ($1*) malloc(sizeof($1));
snippet clcd
${1:type} ${2:ptr} = ($1*) calloc(${3:size}, sizeof($1));
snippet fre
free(${1:ptr});
##
# TODO section
snippet todo

View File

@ -274,7 +274,7 @@ snippet ja "Marshalable json alias"
}
snippet errwr "Error handling with errors.Wrap"
snippet errwr "Error handling with fmt.Errorf"
if ${1}err != nil {
return errors.Wrap(err, "${2}")
return fmt.Errorf("${2} %w", err)
}

View File

@ -5,7 +5,7 @@ snippet ex
module.exports = ${1};
# require
snippet re
${1:const} ${2} = require('${3:module_name}');
const ${1} = require('${2:module_name}');
# EventEmitter
snippet on
on('${1:event_name}', function(${2:stream}) {

View File

@ -85,16 +85,15 @@ snippet adefm
# New Property
snippet property
def ${1:foo}():
doc = "${2:The $1 property.}"
def fget(self):
${3:return self._$1}
def fset(self, value):
${4:self._$1 = value}
def fdel(self):
${0:del self._$1}
return locals()
$1 = property(**$1())
@property
def ${1:foo}(self) -> ${2:type}:
"""${3:doc}"""
return self._${1:foo}
@${1:foo}.setter
def ${1:foo}(self, value: ${2:type}):
self._${1:foo} = value
# Ifs
snippet if
if ${1:condition}:

View File

@ -380,11 +380,11 @@ snippet lim limit
# Partial derivative
snippet pdv partial derivation
\\frac{\\partial {$1}}{\partial {$2}} {$0}
\\frac{\\partial {$1}}{\\partial {$2}} {$0}
# Second order partial derivative
snippet ppdv second partial derivation
\\frac{\partial^2 {$1}}{\partial {$2} \partial {$3}} {$0}
\\frac{\\partial^2 {$1}}{\\partial {$2} \\partial {$3}} {$0}
# Ordinary derivative
snippet dv derivative
@ -416,7 +416,7 @@ snippet . dot product
# Integral
snippet int integral
\\int_{{$1}}^{{$2}} {$3} \: d{$4} {$5}
\\int_{{$1}}^{{$2}} {$3} \\: d{$4} {$0}
# Right arrow
snippet ra rightarrow