Updated plugins

This commit is contained in:
Amir 2023-07-15 12:43:27 +02:00
parent 68cf3c02e2
commit 747d4093f4
52 changed files with 767 additions and 165 deletions

View file

@ -29,10 +29,20 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
for l:issue in l:linter_issues for l:issue in l:linter_issues
if ale#path#IsBufferPath(a:buffer, l:issue.location.path) if ale#path#IsBufferPath(a:buffer, l:issue.location.path)
if exists('l:issue.location.positions')
let l:coord_keyname = 'positions'
else
let l:coord_keyname = 'lines'
endif
let l:column_member = printf(
\ 'l:issue.location.%s.begin.column', l:coord_keyname
\)
call add(l:output, { call add(l:output, {
\ 'lnum': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.line : \ 'lnum': exists(l:column_member) ? l:issue.location[l:coord_keyname].begin.line :
\ l:issue.location.lines.begin, \ l:issue.location[l:coord_keyname].begin,
\ 'col': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.column : 0, \ 'col': exists(l:column_member) ? l:issue.location[l:coord_keyname].begin.column : 0,
\ 'text': l:issue.check_name, \ 'text': l:issue.check_name,
\ 'detail': l:issue.description, \ 'detail': l:issue.description,
\ 'code': l:issue.severity, \ 'code': l:issue.severity,

View file

@ -0,0 +1,69 @@
" Author: Carl Smedstad <carl.smedstad at protonmail dot com>
" Description: az_bicep for bicep files
let g:ale_bicep_az_bicep_executable =
\ get(g:, 'ale_bicep_az_bicep_executable', 'az')
let g:ale_bicep_az_bicep_options =
\ get(g:, 'ale_bicep_az_bicep_options', '')
function! ale_linters#bicep#az_bicep#Executable(buffer) abort
return ale#Var(a:buffer, 'bicep_az_bicep_executable')
endfunction
function! ale_linters#bicep#az_bicep#Command(buffer) abort
let l:executable = ale_linters#bicep#az_bicep#Executable(a:buffer)
let l:options = ale#Var(a:buffer, 'bicep_az_bicep_options')
if has('win32')
let l:nullfile = 'NUL'
else
let l:nullfile = '/dev/null'
endif
return ale#Escape(l:executable)
\ . ' bicep build --outfile '
\ . l:nullfile
\ . ' --file '
\ . '%s '
\ . l:options
endfunction
function! ale_linters#bicep#az_bicep#Handle(buffer, lines) abort
let l:pattern = '\v^([A-Z]+)?(:\s)?(.*)\((\d+),(\d+)\)\s:\s([a-zA-Z]*)\s([-a-zA-Z0-9]*):\s(.*)'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
if l:match[1] is# 'ERROR'
let l:type = 'E'
elseif l:match[1] is# 'WARNING'
let l:type = 'W'
elseif l:match[6] is# 'Error'
let l:type = 'E'
elseif l:match[6] is# 'Warning'
let l:type = 'W'
else
let l:type = 'I'
endif
call add(l:output, {
\ 'filename': l:match[3],
\ 'lnum': l:match[4] + 0,
\ 'col': l:match[5] + 0,
\ 'type': l:type,
\ 'code': l:match[7],
\ 'text': l:match[8],
\})
endfor
return l:output
endfunction
call ale#linter#Define('bicep', {
\ 'name': 'az_bicep',
\ 'executable': function('ale_linters#bicep#az_bicep#Executable'),
\ 'command': function('ale_linters#bicep#az_bicep#Command'),
\ 'callback': 'ale_linters#bicep#az_bicep#Handle',
\ 'output_stream': 'stderr',
\ 'lint_file': 1,
\})

View file

@ -30,24 +30,25 @@ function! ale_linters#bicep#bicep#Command(buffer) abort
endfunction endfunction
function! ale_linters#bicep#bicep#Handle(buffer, lines) abort function! ale_linters#bicep#bicep#Handle(buffer, lines) abort
let l:pattern = '\v^.*\((\d+),(\d+)\)\s:\s([a-zA-Z]*)\s([-a-zA-Z0-9]*):\s(.*)' let l:pattern = '\v^(.*)\((\d+),(\d+)\)\s:\s([a-zA-Z]*)\s([-a-zA-Z0-9]*):\s(.*)'
let l:output = [] let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)
if l:match[3] is# 'Error' if l:match[4] is# 'Error'
let l:type = 'E' let l:type = 'E'
elseif l:match[3] is# 'Warning' elseif l:match[4] is# 'Warning'
let l:type = 'W' let l:type = 'W'
else else
let l:type = 'I' let l:type = 'I'
endif endif
call add(l:output, { call add(l:output, {
\ 'lnum': l:match[1] + 0, \ 'filename': l:match[1],
\ 'col': l:match[2] + 0, \ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0,
\ 'type': l:type, \ 'type': l:type,
\ 'code': l:match[4], \ 'code': l:match[5],
\ 'text': l:match[5], \ 'text': l:match[6],
\}) \})
endfor endfor

View file

@ -0,0 +1,40 @@
" Author: Chuck Grindel <chuck.grindel@gmail.com>
" Description: Bazel Starlark lint support using buildifier.
function! ale_linters#bzl#buildifier#GetCommand(buffer) abort
let l:executable = ale#Escape(ale#fixers#buildifier#GetExecutable(a:buffer))
let l:options = ale#Var(a:buffer, 'bazel_buildifier_options')
let l:filename = ale#Escape(bufname(a:buffer))
let l:command = l:executable . ' -mode check -lint warn -path %s'
if l:options isnot# ''
let l:command .= ' ' . l:options
endif
return l:command
endfunction
function! ale_linters#bzl#buildifier#Handle(buffer, lines) abort
let l:pattern = '\v^[^:]+:(\d+):(\d+)?:?\s+(syntax error near)?(.+)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[3] . l:match[4],
\ 'type': l:match[3] is# 'syntax error near' ? 'E' : 'W',
\})
endfor
return l:output
endfunction
call ale#linter#Define('bzl', {
\ 'name': 'buildifier',
\ 'output_stream': 'both',
\ 'executable': function('ale#fixers#buildifier#GetExecutable'),
\ 'command': function('ale_linters#bzl#buildifier#GetCommand'),
\ 'callback': function('ale_linters#bzl#buildifier#Handle'),
\})

View file

@ -0,0 +1,54 @@
" Author: 0xHyoga <0xHyoga@gmx.com>
" Description: Report Starknet compile to sierra errors in cairo 1.0 code
call ale#Set('cairo_sierra_executable', 'starknet-compile')
call ale#Set('cairo_sierra_options', '')
function! ale_linters#cairo#sierra#Handle(buffer, lines) abort
" Matches patterns like the following:
" Error: Expected ';' but got '('
" --> /path/to/file/file.cairo:1:10:)
let l:pattern = '\v(error|warning): (.*)$'
let l:line_and_column_pattern = '\v\.cairo:(\d+):(\d+)'
let l:output = []
for l:line in a:lines
let l:match = matchlist(l:line, l:pattern)
if len(l:match) == 0
let l:match = matchlist(l:line, l:line_and_column_pattern)
if len(l:match) > 0
let l:index = len(l:output) - 1
let l:output[l:index]['lnum'] = l:match[1] + 0
let l:output[l:index]['col'] = l:match[2] + 0
endif
else
let l:isError = l:match[1] is? 'Error'
call add(l:output, {
\ 'lnum': 0,
\ 'col': 0,
\ 'text': l:match[2],
\ 'type': l:isError ? 'E' : 'W',
\})
endif
endfor
return l:output
endfunction
function! ale_linters#cairo#sierra#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'cairo_sierra_executable')
return l:executable . ale#Pad(ale#Var(a:buffer, 'cairo_sierra_options')) . ' %s'
endfunction
call ale#linter#Define('cairo', {
\ 'name': 'sierra',
\ 'executable': {b -> ale#Var(b, 'cairo_sierra_executable')},
\ 'command': function('ale_linters#cairo#sierra#GetCommand'),
\ 'callback': 'ale_linters#cairo#sierra#Handle',
\ 'output_stream': 'stderr',
\})

View file

@ -1,5 +1,6 @@
" Author: 0xHyoga <0xHyoga@gmx.com> " Author: 0xHyoga <0xHyoga@gmx.com>
" Description: Report starknet-compile errors in cairo code " Description: Report starknet-compile errors in cairo code (pre-starknet
" 1.0). This is deprecated but kept for backwards compatability.
call ale#Set('cairo_starknet_executable', 'starknet-compile') call ale#Set('cairo_starknet_executable', 'starknet-compile')
call ale#Set('cairo_starknet_options', '') call ale#Set('cairo_starknet_options', '')
@ -35,3 +36,4 @@ call ale#linter#Define('cairo', {
\ 'callback': 'ale_linters#cairo#starknet#Handle', \ 'callback': 'ale_linters#cairo#starknet#Handle',
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\}) \})

View file

@ -0,0 +1,69 @@
" Author: Shad
" Description: dockerlinter linter for dockerfile
call ale#Set('dockerfile_dockerlinter_executable', 'dockerlinter')
call ale#Set('dockerfile_dockerlinter_options', '')
function! ale_linters#dockerfile#dockerlinter#GetType(type) abort
if a:type is? 'error'
return 'E'
elseif a:type is? 'warning'
return 'W'
endif
return 'I'
endfunction
function! ale_linters#dockerfile#dockerlinter#Handle(buffer, lines) abort
try
let l:data = json_decode(join(a:lines, ''))
catch
return []
endtry
if empty(l:data)
" Should never happen, but it's better to be on the safe side
return []
endif
let l:messages = []
for l:object in l:data
let l:line = get(l:object, 'lineNumber', -1)
let l:message = l:object['message']
let l:type = l:object['level']
let l:detail = l:message
let l:code = l:object['code']
if l:code =~# '^SC'
let l:link = 'https://www.shellcheck.net/wiki/' . l:code
else
let l:link = 'https://github.com/buddy-works/dockerfile-linter/blob/master/Rules.md#' . l:code
endif
let l:detail = l:message . "\n\n" . l:link
call add(l:messages, {
\ 'lnum': l:line,
\ 'code': l:code,
\ 'text': l:message,
\ 'type': ale_linters#dockerfile#dockerlinter#GetType(l:type),
\ 'detail': l:detail,
\})
endfor
return l:messages
endfunction
function! ale_linters#dockerfile#dockerlinter#GetCommand(buffer) abort
return '%e' . ale#Pad(ale#Var(a:buffer, 'dockerfile_dockerlinter_options'))
\ . ' -j -f'
\ . ' %t'
endfunction
call ale#linter#Define('dockerfile', {
\ 'name': 'dockerlinter',
\ 'executable': {b -> ale#Var(b, 'dockerfile_dockerlinter_executable')},
\ 'command': function('ale_linters#dockerfile#dockerlinter#GetCommand'),
\ 'callback': 'ale_linters#dockerfile#dockerlinter#Handle',
\})

View file

@ -11,7 +11,7 @@ function! ale_linters#eruby#erb#GetCommand(buffer) abort
" Rails-flavored eRuby does not comply with the standard as understood by " Rails-flavored eRuby does not comply with the standard as understood by
" ERB, so we'll have to do some substitution. This does not reduce the " ERB, so we'll have to do some substitution. This does not reduce the
" effectiveness of the linter—the translated code is still evaluated. " effectiveness of the linter—the translated code is still evaluated.
return 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c' return 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), trim_mode: %{-}).src') . '< %t | ruby -c'
endfunction endfunction
call ale#linter#Define('eruby', { call ale#linter#Define('eruby', {

View file

@ -1,7 +1,7 @@
" Author: Sascha Grunert <mail@saschagrunert.de> " Author: Sascha Grunert <mail@saschagrunert.de>
" Description: Adds support of golangci-lint " Description: Adds support of golangci-lint
call ale#Set('go_golangci_lint_options', '--enable-all') call ale#Set('go_golangci_lint_options', '')
call ale#Set('go_golangci_lint_executable', 'golangci-lint') call ale#Set('go_golangci_lint_executable', 'golangci-lint')
call ale#Set('go_golangci_lint_package', 0) call ale#Set('go_golangci_lint_package', 0)

View file

@ -1,21 +0,0 @@
" Author: neersighted <bjorn@neersighted.com>
" Description: golint for Go files
call ale#Set('go_golint_executable', 'golint')
call ale#Set('go_golint_options', '')
function! ale_linters#go#golint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'go_golint_options')
return ale#go#EnvString(a:buffer) . '%e'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %t'
endfunction
call ale#linter#Define('go', {
\ 'name': 'golint',
\ 'output_stream': 'both',
\ 'executable': {b -> ale#Var(b, 'go_golint_executable')},
\ 'command': function('ale_linters#go#golint#GetCommand'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View file

@ -0,0 +1,46 @@
" Author: lucas-str <lucas.sturelle@ik.me>
" Description: Integration of npm-groovy-lint for Groovy files.
call ale#Set('groovy_npmgroovylint_executable', 'npm-groovy-lint')
call ale#Set('groovy_npmgroovylint_options', '--loglevel warning')
function! ale_linters#groovy#npmgroovylint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'groovy_npmgroovylint_options')
return '%e --failon none --output json'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %t'
endfunction
function! ale_linters#groovy#npmgroovylint#Handle(buffer, lines) abort
let l:output = []
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
for [l:filename, l:file] in items(get(l:json, 'files', {}))
for l:error in get(l:file, 'errors', [])
let l:output_line = {
\ 'filename': l:filename,
\ 'lnum': l:error.line,
\ 'text': l:error.msg,
\ 'type': toupper(l:error.severity[0]),
\}
if has_key(l:error, 'range')
let l:output_line.col = l:error.range.start.character
let l:output_line.end_col = l:error.range.end.character
let l:output_line.end_lnum = l:error.range.end.line
endif
call add(l:output, l:output_line)
endfor
endfor
return l:output
endfunction
call ale#linter#Define('groovy', {
\ 'name': 'npm-groovy-lint',
\ 'executable': {b -> ale#Var(b, 'groovy_npmgroovylint_executable')},
\ 'command': function('ale_linters#groovy#npmgroovylint#GetCommand'),
\ 'callback': 'ale_linters#groovy#npmgroovylint#Handle',
\})

View file

@ -65,7 +65,7 @@ endfunction
function! ale_linters#python#pyright#GetCommand(buffer) abort function! ale_linters#python#pyright#GetCommand(buffer) abort
let l:executable = ale_linters#python#pyright#GetExecutable(a:buffer) let l:executable = ale_linters#python#pyright#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$' let l:exec_args = l:executable =~? 'pipenv\|poetry$'
\ ? ' run pyright' \ ? ' run pyright-langserver'
\ : '' \ : ''
let l:env_string = '' let l:env_string = ''

View file

@ -561,6 +561,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['haskell'], \ 'suggested_filetypes': ['haskell'],
\ 'description': 'A formatter for Haskell source code.', \ 'description': 'A formatter for Haskell source code.',
\ }, \ },
\ 'fourmolu': {
\ 'function': 'ale#fixers#fourmolu#Fix',
\ 'suggested_filetypes': ['haskell'],
\ 'description': 'A formatter for Haskell source code.',
\ },
\ 'jsonnetfmt': { \ 'jsonnetfmt': {
\ 'function': 'ale#fixers#jsonnetfmt#Fix', \ 'function': 'ale#fixers#jsonnetfmt#Fix',
\ 'suggested_filetypes': ['jsonnet'], \ 'suggested_filetypes': ['jsonnet'],
@ -605,6 +610,11 @@ let s:default_registry = {
\ 'function': 'ale#fixers#rustywind#Fix', \ 'function': 'ale#fixers#rustywind#Fix',
\ 'suggested_filetypes': ['html'], \ 'suggested_filetypes': ['html'],
\ 'description': 'Sort Tailwind CSS classes', \ 'description': 'Sort Tailwind CSS classes',
\ },
\ 'npm-groovy-lint': {
\ 'function': 'ale#fixers#npmgroovylint#Fix',
\ 'suggested_filetypes': ['groovy'],
\ 'description': 'Fix Groovy files with npm-groovy-fix.',
\ } \ }
\} \}

View file

@ -0,0 +1,20 @@
call ale#Set('haskell_fourmolu_executable', 'fourmolu')
call ale#Set('haskell_fourmolu_options', '')
function! ale#fixers#fourmolu#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_fourmolu_executable')
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'fourmolu')
endfunction
function! ale#fixers#fourmolu#Fix(buffer) abort
let l:executable = ale#fixers#fourmolu#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'haskell_fourmolu_options')
return {
\ 'command': l:executable
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' --stdin-input-file '
\ . ale#Escape(@%),
\}
endfunction

View file

@ -0,0 +1,16 @@
" Author: lucas-str <lucas.sturelle@ik.me>
" Description: Integration of npm-groovy-lint for Groovy files.
call ale#Set('groovy_npmgroovylint_fix_options', '--fix')
function! ale#fixers#npmgroovylint#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'groovy_npmgroovylint_executable')
let l:options = ale#Var(a:buffer, 'groovy_npmgroovylint_fix_options')
return {
\ 'command': ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View file

@ -42,7 +42,8 @@ let s:default_ale_linters = {
\ 'apkbuild': ['apkbuild_lint', 'secfixes_check'], \ 'apkbuild': ['apkbuild_lint', 'secfixes_check'],
\ 'csh': ['shell'], \ 'csh': ['shell'],
\ 'elixir': ['credo', 'dialyxir', 'dogma'], \ 'elixir': ['credo', 'dialyxir', 'dogma'],
\ 'go': ['gofmt', 'golint', 'gopls', 'govet'], \ 'go': ['gofmt', 'gopls', 'govet'],
\ 'groovy': ['npm-groovy-lint'],
\ 'hack': ['hack'], \ 'hack': ['hack'],
\ 'help': [], \ 'help': [],
\ 'inko': ['inko'], \ 'inko': ['inko'],

View file

@ -16,9 +16,28 @@ g:ale_bicep_bicep_executable *g:ale_bicep_bicep_executable*
g:ale_bicep_bicep_options *g:ale_bicep_bicep_options* g:ale_bicep_bicep_options *g:ale_bicep_bicep_options*
*b:ale_bicep_bicep_options* *b:ale_bicep_bicep_options*
Type: |String| Type: |String|
Default: `'build --outfile /dev/null'` Default: `''`
This variable can be set to pass additional options to bicep. This variable can be set to pass additional options to bicep.
===============================================================================
az_bicep *ale-bicep-az_bicep*
g:ale_bicep_az_bicep_executable *g:ale_bicep_az_bicep_executable*
*b:ale_bicep_az_bicep_executable*
Type: |String|
Default: `'az'`
This variable can be set to change the path to az_bicep.
g:ale_bicep_az_bicep_options *g:ale_bicep_az_bicep_options*
*b:ale_bicep_az_bicep_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to az_bicep.
=============================================================================== ===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View file

@ -198,8 +198,8 @@ g:ale_c_ccls_init_options *g:ale_c_ccls_init_options*
\ }, \ },
\ } \ }
< <
Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all For all available options and explanations, visit
available options and explanations. https://github.com/MaskRay/ccls/wiki/Customization#initialization-options.
=============================================================================== ===============================================================================

View file

@ -25,6 +25,31 @@ g:ale_dockerfile_dockerfile_lint_options
the dockerfile lint invocation - like custom rule file definitions. the dockerfile lint invocation - like custom rule file definitions.
===============================================================================
dockerlinter *ale-dockerfile-dockerlinter*
g:ale_dockerfile_dockerlinter_executable
*g:ale_dockerfile_dockerlinter_executable*
*b:ale_dockerfile_dockerlinter_executable*
Type: |String|
Default: `'dockerlinter'`
This variable can be changed to specify the executable used to run
dockerlinter.
g:ale_dockerfile_dockerlinter_options
*g:ale_dockerfile_dockerlinter_options*
*b:ale_dockerfile_dockerlinter_options*
Type: |String|
Default: `''`
This variable can be changed to add additional command-line arguments to
the dockerfile lint invocation - like custom rule file definitions.
dockerlinter
=============================================================================== ===============================================================================
dprint *ale-dockerfile-dprint* dprint *ale-dockerfile-dprint*

View file

@ -6,8 +6,8 @@ ALE Go Integration *ale-go-options*
Integration Information Integration Information
The `gometalinter` linter is disabled by default. ALE enables `gofmt`, The `gometalinter` linter is disabled by default. ALE enables `gofmt`,
`golint` and `go vet` by default. It also supports `staticcheck`, `go `gopls`, and `go vet` by default. It also supports `staticcheck, `go
build`, `gosimple`, `golangserver`. build`, `gosimple`, `golangserver`, and `golangci-lint`.
To enable `gometalinter`, update |g:ale_linters| as appropriate: To enable `gometalinter`, update |g:ale_linters| as appropriate:
> >
@ -120,7 +120,7 @@ g:ale_go_golangci_lint_executable *g:ale_go_golangci_lint_executable*
g:ale_go_golangci_lint_options *g:ale_go_golangci_lint_options* g:ale_go_golangci_lint_options *g:ale_go_golangci_lint_options*
*b:ale_go_golangci_lint_options* *b:ale_go_golangci_lint_options*
Type: |String| Type: |String|
Default: `'--enable-all'` Default: `''`
This variable can be changed to alter the command-line arguments to the This variable can be changed to alter the command-line arguments to the
golangci-lint invocation. golangci-lint invocation.
@ -175,25 +175,6 @@ g:ale_go_golines_options *g:ale_go_golines_options*
--max-length=100 (lines above 100 characters will be wrapped) --max-length=100 (lines above 100 characters will be wrapped)
===============================================================================
golint *ale-go-golint*
g:ale_go_golint_executable *g:ale_go_golint_executable*
*b:ale_go_golint_executable*
Type: |String|
Default: `'golint'`
This variable can be set to change the golint executable path.
g:ale_go_golint_options *g:ale_go_golint_options*
*b:ale_go_golint_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to the golint linter.
=============================================================================== ===============================================================================
gometalinter *ale-go-gometalinter* gometalinter *ale-go-gometalinter*

View file

@ -0,0 +1,42 @@
===============================================================================
ALE Groovy Integration *ale-groovy-options*
===============================================================================
Integration Information
Linting and fixing of Groovy files is enabled with the integration of
`npm-groovy-lint`.
===============================================================================
npm-groovy-lint *ale-groovy-npm-groovy-lint*
g:ale_groovy_npmgroovylint_executable *g:ale_groovy_npmgroovylint_executable*
*b:ale_groovy_npmgroovylint_executable*
Type: |String|
Default: `'npm-groovy-lint'`
Location of the npm-groovy-lint binary file.
g:ale_groovy_npmgroovylint_options *g:ale_groovy_npmgroovylint_options*
*b:ale_groovy_npmgroovylint_options*
Type: |String|
Default: `'--loglevel warning'`
Additional npm-groovy-lint linter options.
g:ale_groovy_npmgroovylint_fix_options *g:ale_groovy_npmgroovylint_fix_options*
*b:ale_groovy_npmgroovylint_fix_options*
Type: |String|
Default: `'--fix'`
This variable can be used to configure fixing with npm-groovy-lint. It must
contain either `--fix` or `--format` for the fixer to work. See
`npm-groovy-lint --help` for more information on possible fix rules.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View file

@ -224,5 +224,25 @@ g:ale_haskell_ormolu_options *g:ale_haskell_ormolu_options*
executable. executable.
===============================================================================
fourmolu *ale-haskell-fourmolu*
g:ale_haskell_fourmolu_executable *g:ale_haskell_fourmolu_executable*
*b:ale_haskell_fourmolu_executable*
Type: |String|
Default: `'fourmolu'`
This variable can be changed to use a different executable for fourmolu.
g:ale_haskell_fourmolu_options *g:ale_haskell_fourmolu_options*
*b:ale_haskell_fourmolu_options*
Type: |String|
Default: `''`
This variable can be used to pass extra options to the underlying fourmolu
executable.
=============================================================================== ===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View file

@ -159,6 +159,7 @@ Notes:
* `dhall-lint` * `dhall-lint`
* Dockerfile * Dockerfile
* `dockerfile_lint` * `dockerfile_lint`
* `dockerlinter`
* `dprint` * `dprint`
* `hadolint` * `hadolint`
* Elixir * Elixir
@ -212,7 +213,6 @@ Notes:
* `golangci-lint`!! * `golangci-lint`!!
* `golangserver` * `golangserver`
* `golines` * `golines`
* `golint`
* `gometalinter`!! * `gometalinter`!!
* `gopls` * `gopls`
* `gosimple`!! * `gosimple`!!
@ -223,6 +223,8 @@ Notes:
* `eslint` * `eslint`
* `gqlint` * `gqlint`
* `prettier` * `prettier`
* Groovy
* `npm-groovy-lint`
* Hack * Hack
* `hack` * `hack`
* `hackfmt` * `hackfmt`
@ -236,6 +238,7 @@ Notes:
* `cabal-ghc` * `cabal-ghc`
* `cspell` * `cspell`
* `floskell` * `floskell`
* `fourmolu`
* `ghc` * `ghc`
* `ghc-mod` * `ghc-mod`
* `hdevtools` * `hdevtools`
@ -382,6 +385,7 @@ Notes:
* `nimpretty` * `nimpretty`
* nix * nix
* `alejandra` * `alejandra`
* `deadnix`
* `nix-instantiate` * `nix-instantiate`
* `nixfmt` * `nixfmt`
* `nixpkgs-fmt` * `nixpkgs-fmt`

View file

@ -1641,7 +1641,8 @@ g:ale_linters *g:ale_linters*
\ 'apkbuild': ['apkbuild_lint', 'secfixes_check'], \ 'apkbuild': ['apkbuild_lint', 'secfixes_check'],
\ 'csh': ['shell'], \ 'csh': ['shell'],
\ 'elixir': ['credo', 'dialyxir', 'dogma'], \ 'elixir': ['credo', 'dialyxir', 'dogma'],
\ 'go': ['gofmt', 'golint', 'gopls', 'govet'], \ 'go': ['gofmt', 'gopls', 'govet'],
\ 'groovy': ['npm-groovy-lint'],
\ 'hack': ['hack'], \ 'hack': ['hack'],
\ 'help': [], \ 'help': [],
\ 'inko': ['inko'], \ 'inko': ['inko'],
@ -2858,6 +2859,7 @@ documented in additional help files.
bibclean..............................|ale-bib-bibclean| bibclean..............................|ale-bib-bibclean|
bicep...................................|ale-bicep-options| bicep...................................|ale-bicep-options|
bicep.................................|ale-bicep-bicep| bicep.................................|ale-bicep-bicep|
az_bicep..............................|ale-bicep-az_bicep|
bitbake.................................|ale-bitbake-options| bitbake.................................|ale-bitbake-options|
oelint-adv............................|ale-bitbake-oelint_adv| oelint-adv............................|ale-bitbake-oelint_adv|
c.......................................|ale-c-options| c.......................................|ale-c-options|
@ -2939,6 +2941,7 @@ documented in additional help files.
dhall-lint............................|ale-dhall-lint| dhall-lint............................|ale-dhall-lint|
dockerfile..............................|ale-dockerfile-options| dockerfile..............................|ale-dockerfile-options|
dockerfile_lint.......................|ale-dockerfile-dockerfile_lint| dockerfile_lint.......................|ale-dockerfile-dockerfile_lint|
dockerlinter..........................|ale-dockerfile-dockerlinter|
dprint................................|ale-dockerfile-dprint| dprint................................|ale-dockerfile-dprint|
hadolint..............................|ale-dockerfile-hadolint| hadolint..............................|ale-dockerfile-hadolint|
elixir..................................|ale-elixir-options| elixir..................................|ale-elixir-options|
@ -2984,7 +2987,6 @@ documented in additional help files.
golangci-lint.........................|ale-go-golangci-lint| golangci-lint.........................|ale-go-golangci-lint|
golangserver..........................|ale-go-golangserver| golangserver..........................|ale-go-golangserver|
golines...............................|ale-go-golines| golines...............................|ale-go-golines|
golint................................|ale-go-golint|
gometalinter..........................|ale-go-gometalinter| gometalinter..........................|ale-go-gometalinter|
gopls.................................|ale-go-gopls| gopls.................................|ale-go-gopls|
govet.................................|ale-go-govet| govet.................................|ale-go-govet|
@ -2994,6 +2996,8 @@ documented in additional help files.
eslint................................|ale-graphql-eslint| eslint................................|ale-graphql-eslint|
gqlint................................|ale-graphql-gqlint| gqlint................................|ale-graphql-gqlint|
prettier..............................|ale-graphql-prettier| prettier..............................|ale-graphql-prettier|
groovy..................................|ale-groovy-options|
npm-groovy-lint.......................|ale-groovy-npm-groovy-lint|
hack....................................|ale-hack-options| hack....................................|ale-hack-options|
hack..................................|ale-hack-hack| hack..................................|ale-hack-hack|
hackfmt...............................|ale-hack-hackfmt| hackfmt...............................|ale-hack-hackfmt|
@ -3018,6 +3022,7 @@ documented in additional help files.
stylish-haskell.......................|ale-haskell-stylish-haskell| stylish-haskell.......................|ale-haskell-stylish-haskell|
hie...................................|ale-haskell-hie| hie...................................|ale-haskell-hie|
ormolu................................|ale-haskell-ormolu| ormolu................................|ale-haskell-ormolu|
fourmolu..............................|ale-haskell-fourmolu|
hcl.....................................|ale-hcl-options| hcl.....................................|ale-hcl-options|
packer-fmt............................|ale-hcl-packer-fmt| packer-fmt............................|ale-hcl-packer-fmt|
terraform-fmt.........................|ale-hcl-terraform-fmt| terraform-fmt.........................|ale-hcl-terraform-fmt|

View file

@ -168,6 +168,7 @@ formatting.
* [dhall-lint](https://github.com/dhall-lang/dhall-lang) * [dhall-lint](https://github.com/dhall-lang/dhall-lang)
* Dockerfile * Dockerfile
* [dockerfile_lint](https://github.com/projectatomic/dockerfile_lint) * [dockerfile_lint](https://github.com/projectatomic/dockerfile_lint)
* [dockerlinter](https://github.com/buddy-works/dockerfile-linter)
* [dprint](https://dprint.dev) * [dprint](https://dprint.dev)
* [hadolint](https://github.com/hadolint/hadolint) * [hadolint](https://github.com/hadolint/hadolint)
* Elixir * Elixir
@ -221,7 +222,6 @@ formatting.
* [golangci-lint](https://github.com/golangci/golangci-lint) :warning: :floppy_disk: * [golangci-lint](https://github.com/golangci/golangci-lint) :warning: :floppy_disk:
* [golangserver](https://github.com/sourcegraph/go-langserver) :warning: * [golangserver](https://github.com/sourcegraph/go-langserver) :warning:
* [golines](https://github.com/segmentio/golines) * [golines](https://github.com/segmentio/golines)
* [golint](https://godoc.org/github.com/golang/lint)
* [gometalinter](https://github.com/alecthomas/gometalinter) :warning: :floppy_disk: * [gometalinter](https://github.com/alecthomas/gometalinter) :warning: :floppy_disk:
* [gopls](https://github.com/golang/go/wiki/gopls) * [gopls](https://github.com/golang/go/wiki/gopls)
* [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) :warning: :floppy_disk: * [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) :warning: :floppy_disk:
@ -232,6 +232,8 @@ formatting.
* [eslint](http://eslint.org/) * [eslint](http://eslint.org/)
* [gqlint](https://github.com/happylinks/gqlint) * [gqlint](https://github.com/happylinks/gqlint)
* [prettier](https://github.com/prettier/prettier) * [prettier](https://github.com/prettier/prettier)
* Groovy
* [npm-groovy-lint](https://github.com/nvuillam/npm-groovy-lint)
* Hack * Hack
* [hack](http://hacklang.org/) * [hack](http://hacklang.org/)
* [hackfmt](https://github.com/facebook/hhvm/tree/master/hphp/hack/hackfmt) * [hackfmt](https://github.com/facebook/hhvm/tree/master/hphp/hack/hackfmt)
@ -245,6 +247,7 @@ formatting.
* [cabal-ghc](https://www.haskell.org/cabal/) * [cabal-ghc](https://www.haskell.org/cabal/)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
* [floskell](https://github.com/ennocramer/floskell) * [floskell](https://github.com/ennocramer/floskell)
* [fourmolu](https://github.com/fourmolu/fourmolu)
* [ghc](https://www.haskell.org/ghc/) * [ghc](https://www.haskell.org/ghc/)
* [ghc-mod](https://github.com/DanielG/ghc-mod) * [ghc-mod](https://github.com/DanielG/ghc-mod)
* [hdevtools](https://hackage.haskell.org/package/hdevtools) * [hdevtools](https://hackage.haskell.org/package/hdevtools)
@ -391,6 +394,7 @@ formatting.
* nimpretty * nimpretty
* nix * nix
* [alejandra](https://github.com/kamadorueda/alejandra) * [alejandra](https://github.com/kamadorueda/alejandra)
* [deadnix](https://github.com/astro/deadnix)
* [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) * [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate)
* [nixfmt](https://github.com/serokell/nixfmt) * [nixfmt](https://github.com/serokell/nixfmt)
* [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt) * [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt)

View file

@ -1,7 +1,7 @@
*bufexplorer.txt* Buffer Explorer Last Change: 20 Sept 2022 *bufexplorer.txt* Buffer Explorer Last Change: 01 May 2023
Buffer Explorer *buffer-explorer* *bufexplorer* Buffer Explorer *buffer-explorer* *bufexplorer*
Version 7.4.25 Version 7.4.26
Plugin for easily exploring (or browsing) Vim|:buffers|. Plugin for easily exploring (or browsing) Vim|:buffers|.
@ -263,6 +263,15 @@ The default is 1.
=============================================================================== ===============================================================================
CHANGE LOG *bufexplorer-changelog* CHANGE LOG *bufexplorer-changelog*
7.4.26 May 01, 2023
What's Changed
- wipe explorer buffer on hide by @basharh in
https://github.com/jlanzarotta/bufexplorer/pull/111
New Contributors
- @basharh made their first contribution in
https://github.com/jlanzarotta/bufexplorer/pull/111
Full Changelog
https://github.com/jlanzarotta/bufexplorer/compare/v.7.4.25...v7.4.26
7.4.25 September 20, 2022 7.4.25 September 20, 2022
What's Changed What's Changed
- Fix MRU sort order after loading vim session by @mmrwoods in - Fix MRU sort order after loading vim session by @mmrwoods in

View file

@ -1,5 +1,5 @@
"============================================================================ "============================================================================
" Copyright: Copyright (c) 2001-2022, Jeff Lanzarotta " Copyright: Copyright (c) 2001-2023, Jeff Lanzarotta
" All rights reserved. " All rights reserved.
" "
" Redistribution and use in source and binary forms, with or " Redistribution and use in source and binary forms, with or
@ -36,7 +36,7 @@
" Name Of File: bufexplorer.vim " Name Of File: bufexplorer.vim
" Description: Buffer Explorer Vim Plugin " Description: Buffer Explorer Vim Plugin
" Maintainer: Jeff Lanzarotta (my name at gmail dot com) " Maintainer: Jeff Lanzarotta (my name at gmail dot com)
" Last Changed: Tuesday, 20 Sept 2022 " Last Changed: Monday, 01 May 2023
" Version: See g:bufexplorer_version for version number. " Version: See g:bufexplorer_version for version number.
" Usage: This file should reside in the plugin directory and be " Usage: This file should reside in the plugin directory and be
" automatically sourced. " automatically sourced.
@ -74,7 +74,7 @@ endif
"1}}} "1}}}
" Version number " Version number
let g:bufexplorer_version = "7.4.25" let g:bufexplorer_version = "7.4.26"
" Plugin Code {{{1 " Plugin Code {{{1
" Check for Vim version {{{2 " Check for Vim version {{{2
@ -480,13 +480,12 @@ endfunction
" DisplayBufferList {{{2 " DisplayBufferList {{{2
function! s:DisplayBufferList() function! s:DisplayBufferList()
" Do not set bufhidden since it wipes out the data if we switch away from
" the buffer using CTRL-^.
setlocal buftype=nofile setlocal buftype=nofile
setlocal modifiable setlocal modifiable
setlocal noreadonly setlocal noreadonly
setlocal noswapfile setlocal noswapfile
setlocal nowrap setlocal nowrap
setlocal bufhidden=wipe
call s:SetupSyntax() call s:SetupSyntax()
call s:MapKeys() call s:MapKeys()

@ -1 +0,0 @@
Subproject commit b6e5624351ba735e25eb8864d7d22819aad00606

View file

@ -5,28 +5,32 @@
These are the default instructions using Vim 8's `|packages|` feature. See These are the default instructions using Vim 8's `|packages|` feature. See
sections below, if you use other plugin managers. sections below, if you use other plugin managers.
1. Create theme folder (in case you don't have yet): 1. Create theme folder (in case you don't have it yet):
- \*nix: - \*nix:
``` ```
# vim 8.2+
mkdir -p ~/.vim/pack/themes/start mkdir -p ~/.vim/pack/themes/start
# vim 8.0
mkdir -p ~/.vim/pack/themes/opt
``` ```
- Windows: create directory `$HOME\vimfiles\pack\themes\start` - Windows: create directory `$HOME\vimfiles\pack\themes\start` or
`$HOME\vimfiles\pack\themes\opt`, according to your version.
If you use vim 8.0 (and not 8.2), you may need to use `~/.vim/pack/themes/opt`
or `$HOME\vimfiles\pack\themes\opt` instead.
2. Navigate to the folder above: 2. Navigate to the folder above:
- \*nix: - \*nix:
``` ```
# vim 8.2+
cd ~/.vim/pack/themes/start cd ~/.vim/pack/themes/start
# vim 8.0
cd ~/.vim/pack/themes/opt
``` ```
- Windows: navigate to `$HOME\vimfiles\pack\themes\start` - Windows: navigate to the directory you created earlier
3. Clone the repository using the "dracula" name: 3. Clone the repository using the "dracula" name:
@ -38,7 +42,9 @@ git clone https://github.com/dracula/vim.git dracula
4. Edit your `vimrc` file with the following content: 4. Edit your `vimrc` file with the following content:
``` ```
packadd! dracula if v:version < 802
packadd! dracula
endif
syntax enable syntax enable
colorscheme dracula colorscheme dracula
``` ```
@ -94,4 +100,6 @@ following in `~/.SpaceVim.d/init.toml`:
Note that dracula must be in your `'runtimepath'` to load properly: Version 2.0 Note that dracula must be in your `'runtimepath'` to load properly: Version 2.0
introduced autoload functionality for part of the plugin, which doesn't work introduced autoload functionality for part of the plugin, which doesn't work
without `'runtimepath'` properly set. Consult your plugin-managers documentation without `'runtimepath'` properly set. Consult your plugin-managers documentation
to make sure you put dracula on the `'runtimepath'` before loading it. to make sure you put dracula on the `'runtimepath'` before loading it. For
`|packages|`, versions 8.2 and later will autoload `start` packages
correctly even in your vimrc.

View file

@ -56,9 +56,10 @@ if has('nvim-0.5') && luaeval("pcall(require, 'gitsigns')")
hi! link GitSignsChange DiffChange hi! link GitSignsChange DiffChange
hi! link GitSignsChangeLn DiffChange hi! link GitSignsChangeLn DiffChange
hi! link GitSignsChangeNr DiffChange hi! link GitSignsChangeNr DiffChange
hi! link GitSignsDelete DiffDelete
hi! link GitSignsDeleteLn DiffDelete hi! link GitSignsDelete DraculaRed
hi! link GitSignsDeleteNr DiffDelete hi! link GitSignsDeleteLn DraculaRed
hi! link GitSignsDeleteNr DraculaRed
endif endif
" }}} " }}}
" Tree-sitter: {{{ " Tree-sitter: {{{

View file

@ -15,7 +15,7 @@ setlocal formatoptions-=t formatoptions+=croql
setlocal suffixesadd+=.ts,.tsx setlocal suffixesadd+=.ts,.tsx
let b:undo_ftplugin = "setl fo< ofu< com< cms<" let b:undo_ftplugin = "setl cms< fo< sua<"
let &cpo = s:cpo_save let &cpo = s:cpo_save
unlet s:cpo_save unlet s:cpo_save

View file

@ -117,9 +117,9 @@ There's also a variant for searching and a variant for grepping.
## Coercion ## Coercion
Want to turn `fooBar` into `foo_bar`? Press `crs` (coerce to Want to turn `fooBar` into `foo_bar`? Press `crs` (coerce to
snake\_case). MixedCase (`crm`), camelCase (`crc`), UPPER\_CASE (`cru`), snake\_case). MixedCase (`crm`), camelCase (`crc`), UPPER\_CASE
dash-case (`cr-`), dot.case (`cr.`), space case (`cr<space>`), and (`cru`), dash-case (`cr-`), and dot.case (`cr.`) are all just 3
Title Case (`crt`) are all just 3 keystrokes away. keystrokes away.
## Installation ## Installation

View file

@ -142,10 +142,6 @@ function! s:dotcase(word)
return substitute(s:snakecase(a:word),'_','.','g') return substitute(s:snakecase(a:word),'_','.','g')
endfunction endfunction
function! s:titlecase(word)
return substitute(s:spacecase(a:word), '\(\<\w\)','\=toupper(submatch(1))','g')
endfunction
call extend(Abolish, { call extend(Abolish, {
\ 'camelcase': s:function('s:camelcase'), \ 'camelcase': s:function('s:camelcase'),
\ 'mixedcase': s:function('s:mixedcase'), \ 'mixedcase': s:function('s:mixedcase'),
@ -154,7 +150,6 @@ call extend(Abolish, {
\ 'dashcase': s:function('s:dashcase'), \ 'dashcase': s:function('s:dashcase'),
\ 'dotcase': s:function('s:dotcase'), \ 'dotcase': s:function('s:dotcase'),
\ 'spacecase': s:function('s:spacecase'), \ 'spacecase': s:function('s:spacecase'),
\ 'titlecase': s:function('s:titlecase')
\ }, 'keep') \ }, 'keep')
function! s:create_dictionary(lhs,rhs,opts) function! s:create_dictionary(lhs,rhs,opts)
@ -574,7 +569,6 @@ call extend(Abolish.Coercions, {
\ 'k': Abolish.dashcase, \ 'k': Abolish.dashcase,
\ '.': Abolish.dotcase, \ '.': Abolish.dotcase,
\ ' ': Abolish.spacecase, \ ' ': Abolish.spacecase,
\ 't': Abolish.titlecase,
\ "function missing": s:function("s:unknown_coercion") \ "function missing": s:function("s:unknown_coercion")
\}, "keep") \}, "keep")

View file

@ -3188,12 +3188,12 @@ function! fugitive#BufReadCmd(...) abort
setlocal bufhidden=delete setlocal bufhidden=delete
endif endif
let &l:modifiable = modifiable let &l:modifiable = modifiable
call fugitive#MapJumps()
if b:fugitive_type !=# 'blob' if b:fugitive_type !=# 'blob'
setlocal filetype=git
call s:Map('n', 'a', ":<C-U>let b:fugitive_display_format += v:count1<Bar>exe fugitive#BufReadCmd(@%)<CR>", '<silent>') call s:Map('n', 'a', ":<C-U>let b:fugitive_display_format += v:count1<Bar>exe fugitive#BufReadCmd(@%)<CR>", '<silent>')
call s:Map('n', 'i', ":<C-U>let b:fugitive_display_format -= v:count1<Bar>exe fugitive#BufReadCmd(@%)<CR>", '<silent>') call s:Map('n', 'i', ":<C-U>let b:fugitive_display_format -= v:count1<Bar>exe fugitive#BufReadCmd(@%)<CR>", '<silent>')
setlocal filetype=git
endif endif
call fugitive#MapJumps()
endtry endtry
setlocal modifiable setlocal modifiable
@ -4265,7 +4265,7 @@ function! s:ReloadStatusBuffer(...) abort
endif endif
let original_lnum = a:0 ? a:1 : line('.') let original_lnum = a:0 ? a:1 : line('.')
let info = s:StageInfo(original_lnum) let info = s:StageInfo(original_lnum)
call fugitive#BufReadStatus(0) exe fugitive#BufReadStatus(0)
call setpos('.', [0, s:StageSeek(info, original_lnum), 1, 0]) call setpos('.', [0, s:StageSeek(info, original_lnum), 1, 0])
return '' return ''
endfunction endfunction

View file

@ -23,7 +23,7 @@ function! FugitiveGitDir(...) abort
return g:fugitive_event return g:fugitive_event
endif endif
let dir = get(b:, 'git_dir', '') let dir = get(b:, 'git_dir', '')
if empty(dir) && (empty(bufname('')) || &buftype =~# '^\%(nofile\|acwrite\|quickfix\|terminal\|prompt\)$') if empty(dir) && (empty(bufname('')) && &filetype !=# 'netrw' || &buftype =~# '^\%(nofile\|acwrite\|quickfix\|terminal\|prompt\)$')
return FugitiveExtractGitDir(getcwd()) return FugitiveExtractGitDir(getcwd())
elseif (!exists('b:git_dir') || b:git_dir =~# s:bad_git_dir) && &buftype =~# '^\%(nowrite\)\=$' elseif (!exists('b:git_dir') || b:git_dir =~# s:bad_git_dir) && &buftype =~# '^\%(nowrite\)\=$'
let b:git_dir = FugitiveExtractGitDir(bufnr('')) let b:git_dir = FugitiveExtractGitDir(bufnr(''))
@ -425,6 +425,9 @@ function! FugitiveExtractGitDir(path) abort
return get(a:path, 'fugitive_dir', get(a:path, 'git_dir', '')) return get(a:path, 'fugitive_dir', get(a:path, 'git_dir', ''))
elseif type(a:path) == type(0) elseif type(a:path) == type(0)
let path = s:Slash(a:path > 0 ? bufname(a:path) : bufname('')) let path = s:Slash(a:path > 0 ? bufname(a:path) : bufname(''))
if getbufvar(a:path, '&filetype') ==# 'netrw'
let path = s:Slash(getbufvar(a:path, 'netrw_curdir', path))
endif
else else
let path = s:Slash(a:path) let path = s:Slash(a:path)
endif endif

View file

@ -23,6 +23,7 @@ Features:
* Provides fold text showing whether folded lines have been changed. * Provides fold text showing whether folded lines have been changed.
* Can load all hunk locations into quickfix list or the current window's location list. * Can load all hunk locations into quickfix list or the current window's location list.
* Handles line endings correctly, even with repos that do CRLF conversion. * Handles line endings correctly, even with repos that do CRLF conversion.
* Handles clean/smudge filters.
* Optional line highlighting. * Optional line highlighting.
* Optional line number highlighting. (Only available in Neovim 0.3.2 or higher) * Optional line number highlighting. (Only available in Neovim 0.3.2 or higher)
* Fully customisable (signs, sign column, line (number) highlights, mappings, extra git-diff arguments, etc). * Fully customisable (signs, sign column, line (number) highlights, mappings, extra git-diff arguments, etc).
@ -54,7 +55,7 @@ In the screenshot above you can see:
### Installation ### Installation
Install using your favourite package manager, or use Vim's built-in package support. First, install using your favourite package manager, or use Vim's built-in package support.
Vim: Vim:
@ -67,7 +68,6 @@ vim -u NONE -c "helptags vim-gitgutter/doc" -c q
Neovim: Neovim:
``` ```
mkdir -p ~/.config/nvim/pack/airblade/start mkdir -p ~/.config/nvim/pack/airblade/start
cd ~/.config/nvim/pack/airblade/start cd ~/.config/nvim/pack/airblade/start
@ -75,6 +75,12 @@ git clone https://github.com/airblade/vim-gitgutter.git
nvim -u NONE -c "helptags vim-gitgutter/doc" -c q nvim -u NONE -c "helptags vim-gitgutter/doc" -c q
``` ```
Second, ensure your `updatetime` and `signcolumn` options are set appropriately.
When you make a change to a file tracked by git, the diff markers should appear automatically after a short delay. The delay is governed by vim's `updatetime` option; the default value is `4000`, i.e. 4 seconds, but I suggest reducing it to around 100ms (add `set updatetime=100` to your vimrc). Note `updatetime` also controls the delay before vim writes its swap file (see `:help updatetime`).
The `signcolumn` option can have any value except `'off'`.
### Windows ### Windows
@ -92,7 +98,7 @@ Unfortunately I don't know the correct escaping for the path - if you do, please
### Getting started ### Getting started
When you make a change to a file tracked by git, the diff markers should appear automatically. The delay is governed by vim's `updatetime` option; the default value is `4000`, i.e. 4 seconds, but I suggest reducing it to around 100ms (add `set updatetime=100` to your vimrc). Note `updatetime` also controls the delay before vim writes its swap file (see `:help updatetime`). When you make a change to a file tracked by git, the diff markers should appear automatically after a short delay.
You can jump between hunks with `[c` and `]c`. You can preview, stage, and undo hunks with `<leader>hp`, `<leader>hs`, and `<leader>hu` respectively. You can jump between hunks with `[c` and `]c`. You can preview, stage, and undo hunks with `<leader>hp`, `<leader>hs`, and `<leader>hu` respectively.
@ -375,7 +381,7 @@ Similarly to the signs' colours, set up the following highlight groups in your c
GitGutterAddLine " default: links to DiffAdd GitGutterAddLine " default: links to DiffAdd
GitGutterChangeLine " default: links to DiffChange GitGutterChangeLine " default: links to DiffChange
GitGutterDeleteLine " default: links to DiffDelete GitGutterDeleteLine " default: links to DiffDelete
GitGutterChangeDeleteLine " default: links to GitGutterChangeLineDefault, i.e. DiffChange GitGutterChangeDeleteLine " default: links to GitGutterChangeLine, i.e. DiffChange
``` ```
For example, in some colorschemes the `DiffText` highlight group is easier to read than `DiffChange`. You could use it like this: For example, in some colorschemes the `DiffText` highlight group is easier to read than `DiffChange`. You could use it like this:
@ -395,7 +401,7 @@ Similarly to the signs' colours, set up the following highlight groups in your c
GitGutterAddLineNr " default: links to CursorLineNr GitGutterAddLineNr " default: links to CursorLineNr
GitGutterChangeLineNr " default: links to CursorLineNr GitGutterChangeLineNr " default: links to CursorLineNr
GitGutterDeleteLineNr " default: links to CursorLineNr GitGutterDeleteLineNr " default: links to CursorLineNr
GitGutterChangeDeleteLineNr " default: links to CursorLineNr GitGutterChangeDeleteLineNr " default: links to GitGutterChangeLineNr
``` ```
Maybe you think `CursorLineNr` is a bit annoying. For example, you could use `Underlined` for this: Maybe you think `CursorLineNr` is a bit annoying. For example, you could use `Underlined` for this:
@ -747,5 +753,4 @@ Copyright Andrew Stewart, AirBlade Software Ltd. Released under the MIT licence
[pathogen]: https://github.com/tpope/vim-pathogen [pathogen]: https://github.com/tpope/vim-pathogen
[siv]: http://pluralsight.com/training/Courses/TableOfContents/smash-into-vim [siv]: http://pluralsight.com/training/Courses/TableOfContents/smash-into-vim
[airblade]: http://airbladesoftware.com/peepcode-vim
[terminus]: https://github.com/wincent/terminus [terminus]: https://github.com/wincent/terminus

View file

@ -46,6 +46,8 @@ function! gitgutter#process_buffer(bufnr, force) abort
call gitgutter#debug#log('Not tracked: '.gitgutter#utility#file(a:bufnr)) call gitgutter#debug#log('Not tracked: '.gitgutter#utility#file(a:bufnr))
catch /gitgutter assume unchanged/ catch /gitgutter assume unchanged/
call gitgutter#debug#log('Assume unchanged: '.gitgutter#utility#file(a:bufnr)) call gitgutter#debug#log('Assume unchanged: '.gitgutter#utility#file(a:bufnr))
catch /gitgutter file unknown in base/
let diff = gitgutter#diff#hunk_header_showing_every_line_added(a:bufnr)
catch /gitgutter diff failed/ catch /gitgutter diff failed/
call gitgutter#debug#log('Diff failed: '.gitgutter#utility#file(a:bufnr)) call gitgutter#debug#log('Diff failed: '.gitgutter#utility#file(a:bufnr))
call gitgutter#hunk#reset(a:bufnr) call gitgutter#hunk#reset(a:bufnr)
@ -117,6 +119,16 @@ endfunction
" }}} " }}}
function! gitgutter#git()
if empty(g:gitgutter_git_args)
return g:gitgutter_git_executable
else
return g:gitgutter_git_executable.' '.g:gitgutter_git_args
endif
endfunction
function! gitgutter#setup_maps() function! gitgutter#setup_maps()
if !g:gitgutter_map_keys if !g:gitgutter_map_keys
return return
@ -193,14 +205,14 @@ endfunction
" - it ignores unsaved changes in buffers " - it ignores unsaved changes in buffers
" - it does not change to the repo root " - it does not change to the repo root
function! gitgutter#quickfix(current_file) function! gitgutter#quickfix(current_file)
let cmd = g:gitgutter_git_executable.' '.g:gitgutter_git_args.' rev-parse --show-cdup' let cmd = gitgutter#git().' rev-parse --show-cdup'
let path_to_repo = get(systemlist(cmd), 0, '') let path_to_repo = get(systemlist(cmd), 0, '')
if !empty(path_to_repo) && path_to_repo[-1:] != '/' if !empty(path_to_repo) && path_to_repo[-1:] != '/'
let path_to_repo .= '/' let path_to_repo .= '/'
endif endif
let locations = [] let locations = []
let cmd = g:gitgutter_git_executable.' '.g:gitgutter_git_args.' --no-pager'. let cmd = gitgutter#git().' --no-pager'.
\ ' diff --no-ext-diff --no-color -U0'. \ ' diff --no-ext-diff --no-color -U0'.
\ ' --src-prefix=a/'.path_to_repo.' --dst-prefix=b/'.path_to_repo.' '. \ ' --src-prefix=a/'.path_to_repo.' --dst-prefix=b/'.path_to_repo.' '.
\ g:gitgutter_diff_args. ' '. g:gitgutter_diff_base \ g:gitgutter_diff_args. ' '. g:gitgutter_diff_base
@ -249,7 +261,7 @@ function! gitgutter#difforig()
if g:gitgutter_diff_relative_to ==# 'index' if g:gitgutter_diff_relative_to ==# 'index'
let index_name = gitgutter#utility#get_diff_base(bufnr).':'.path let index_name = gitgutter#utility#get_diff_base(bufnr).':'.path
let cmd = gitgutter#utility#cd_cmd(bufnr, let cmd = gitgutter#utility#cd_cmd(bufnr,
\ g:gitgutter_git_executable.' '.g:gitgutter_git_args.' --no-pager show '.index_name \ gitgutter#git().' --no-pager show '.index_name
\ ) \ )
" NOTE: this uses &shell to execute cmd. Perhaps we should use instead " NOTE: this uses &shell to execute cmd. Perhaps we should use instead
" gitgutter#utility's use_known_shell() / restore_shell() functions. " gitgutter#utility's use_known_shell() / restore_shell() functions.

View file

@ -75,23 +75,21 @@ function! gitgutter#debug#log(message, ...) abort
endif endif
endif endif
execute 'redir >> '.s:log_file if s:new_log_session
if s:new_log_session let s:start = reltime()
let s:start = reltime() call writefile(['', '========== start log session '.strftime('%d.%m.%Y %H:%M:%S').' =========='], s:log_file, 'a')
silent echo "\n==== start log session ====" endif
endif
let elapsed = reltimestr(reltime(s:start)).' ' let elapsed = reltimestr(reltime(s:start)).' '
silent echo '' call writefile([''], s:log_file, 'a')
" callers excluding this function " callers excluding this function
silent echo elapsed.expand('<sfile>')[:-22].':' call writefile([elapsed.expand('<sfile>')[:-22].':'], s:log_file, 'a')
silent echo elapsed.s:format_for_log(a:message) call writefile([elapsed.s:format_for_log(a:message)], s:log_file, 'a')
if a:0 && !empty(a:1) if a:0 && !empty(a:1)
for msg in a:000 for msg in a:000
silent echo elapsed.s:format_for_log(msg) call writefile([elapsed.s:format_for_log(msg)], s:log_file, 'a')
endfor endfor
endif endif
redir END
let s:new_log_session = 0 let s:new_log_session = 0
endif endif

View file

@ -6,7 +6,7 @@ let s:hunk_re = '^@@ -\(\d\+\),\?\(\d*\) +\(\d\+\),\?\(\d*\) @@'
" True for git v1.7.2+. " True for git v1.7.2+.
function! s:git_supports_command_line_config_override() abort function! s:git_supports_command_line_config_override() abort
call gitgutter#utility#system(g:gitgutter_git_executable.' '.g:gitgutter_git_args.' -c foo.bar=baz --version') call gitgutter#utility#system(gitgutter#git().' -c foo.bar=baz --version')
return !v:shell_error return !v:shell_error
endfunction endfunction
@ -81,6 +81,20 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort
throw 'gitgutter assume unchanged' throw 'gitgutter assume unchanged'
endif endif
" If we are diffing against a specific branch/commit, handle the case
" where a file exists on the current branch but not in/at the diff base.
" We have to handle it here because the approach below (using git-show)
" doesn't work for this case.
if !empty(g:gitgutter_diff_base)
let index_name = gitgutter#utility#get_diff_base(a:bufnr).':'.gitgutter#utility#repo_path(a:bufnr, 1)
let cmd = gitgutter#git().' --no-pager show '.index_name
let cmd = gitgutter#utility#cd_cmd(a:bufnr, cmd)
call gitgutter#utility#system(cmd)
if v:shell_error
throw 'gitgutter file unknown in base'
endif
endif
" Wrap compound commands in parentheses to make Windows happy. " Wrap compound commands in parentheses to make Windows happy.
" bash doesn't mind the parentheses. " bash doesn't mind the parentheses.
let cmd = '(' let cmd = '('
@ -124,14 +138,14 @@ function! gitgutter#diff#run_diff(bufnr, from, preserve_full_diff) abort
" Write file from index to temporary file. " Write file from index to temporary file.
let index_name = gitgutter#utility#get_diff_base(a:bufnr).':'.gitgutter#utility#repo_path(a:bufnr, 1) let index_name = gitgutter#utility#get_diff_base(a:bufnr).':'.gitgutter#utility#repo_path(a:bufnr, 1)
let cmd .= g:gitgutter_git_executable.' '.g:gitgutter_git_args.' --no-pager show '.index_name.' > '.from_file.' && ' let cmd .= gitgutter#git().' --no-pager show --textconv '.index_name.' > '.from_file.' && '
elseif a:from ==# 'working_tree' elseif a:from ==# 'working_tree'
let from_file = gitgutter#utility#repo_path(a:bufnr, 1) let from_file = gitgutter#utility#repo_path(a:bufnr, 1)
endif endif
" Call git-diff. " Call git-diff.
let cmd .= g:gitgutter_git_executable.' '.g:gitgutter_git_args.' --no-pager' let cmd .= gitgutter#git().' --no-pager'
if s:c_flag if s:c_flag
let cmd .= ' -c "diff.autorefreshindex=0"' let cmd .= ' -c "diff.autorefreshindex=0"'
let cmd .= ' -c "diff.noprefix=false"' let cmd .= ' -c "diff.noprefix=false"'
@ -376,6 +390,12 @@ function! gitgutter#diff#hunk_diff(bufnr, full_diff, ...)
endfunction endfunction
function! gitgutter#diff#hunk_header_showing_every_line_added(bufnr)
let buf_line_count = getbufinfo(a:bufnr)[0].linecount
return '@@ -0,0 +1,'.buf_line_count.' @@'
endfunction
function! s:write_buffer(bufnr, file) function! s:write_buffer(bufnr, file)
let bufcontents = getbufline(a:bufnr, 1, '$') let bufcontents = getbufline(a:bufnr, 1, '$')
@ -387,7 +407,13 @@ function! s:write_buffer(bufnr, file)
endif endif
if getbufvar(a:bufnr, '&fileformat') ==# 'dos' if getbufvar(a:bufnr, '&fileformat') ==# 'dos'
call map(bufcontents, 'v:val."\r"') if getbufvar(a:bufnr, '&endofline')
call map(bufcontents, 'v:val."\r"')
else
for i in range(len(bufcontents) - 1)
let bufcontents[i] = bufcontents[i] . "\r"
endfor
endif
endif endif
if getbufvar(a:bufnr, '&endofline') if getbufvar(a:bufnr, '&endofline')

View file

@ -106,7 +106,7 @@ function! gitgutter#highlight#define_highlights() abort
highlight default link GitGutterAddLineNr CursorLineNr highlight default link GitGutterAddLineNr CursorLineNr
highlight default link GitGutterChangeLineNr CursorLineNr highlight default link GitGutterChangeLineNr CursorLineNr
highlight default link GitGutterDeleteLineNr CursorLineNr highlight default link GitGutterDeleteLineNr CursorLineNr
highlight default link GitGutterChangeDeleteLineNr CursorLineNr highlight default link GitGutterChangeDeleteLineNr GitGutterChangeLineNr
" Highlights used intra line. " Highlights used intra line.
highlight default GitGutterAddIntraLine gui=reverse cterm=reverse highlight default GitGutterAddIntraLine gui=reverse cterm=reverse

View file

@ -294,11 +294,32 @@ endfunction
function! s:stage(hunk_diff) function! s:stage(hunk_diff)
let bufnr = bufnr('') let bufnr = bufnr('')
let diff = s:adjust_header(bufnr, a:hunk_diff)
" Apply patch to index. if gitgutter#utility#clean_smudge_filter_applies(bufnr)
call gitgutter#utility#system( let choice = input('File uses clean/smudge filter. Stage entire file (y/n)? ')
\ gitgutter#utility#cd_cmd(bufnr, g:gitgutter_git_executable.' '.g:gitgutter_git_args.' apply --cached --unidiff-zero - '), normal! :<ESC>
\ diff) if choice =~ 'y'
" We are about to add the file to the index so write the buffer to
" ensure the file on disk matches it (the buffer).
write
let path = gitgutter#utility#repo_path(bufnr, 1)
" Add file to index.
let cmd = gitgutter#utility#cd_cmd(bufnr,
\ gitgutter#git().' add '.
\ gitgutter#utility#shellescape(gitgutter#utility#filename(bufnr)))
call gitgutter#utility#system(cmd)
else
return
endif
else
let diff = s:adjust_header(bufnr, a:hunk_diff)
" Apply patch to index.
call gitgutter#utility#system(
\ gitgutter#utility#cd_cmd(bufnr, gitgutter#git().' apply --cached --unidiff-zero - '),
\ diff)
endif
if v:shell_error if v:shell_error
call gitgutter#utility#warn('Patch does not apply') call gitgutter#utility#warn('Patch does not apply')
else else
@ -422,6 +443,9 @@ endfunction
" Floating window: does not move cursor to floating window. " Floating window: does not move cursor to floating window.
" Preview window: moves cursor to preview window. " Preview window: moves cursor to preview window.
function! s:open_hunk_preview_window() function! s:open_hunk_preview_window()
let source_wrap = &wrap
let source_window = winnr()
if g:gitgutter_preview_win_floating if g:gitgutter_preview_win_floating
if exists('*nvim_open_win') if exists('*nvim_open_win')
call gitgutter#hunk#close_hunk_preview_window() call gitgutter#hunk#close_hunk_preview_window()
@ -429,6 +453,7 @@ function! s:open_hunk_preview_window()
let buf = nvim_create_buf(v:false, v:false) let buf = nvim_create_buf(v:false, v:false)
" Set default width and height for now. " Set default width and height for now.
let s:winid = nvim_open_win(buf, v:false, g:gitgutter_floating_window_options) let s:winid = nvim_open_win(buf, v:false, g:gitgutter_floating_window_options)
call nvim_win_set_option(s:winid, 'wrap', source_wrap ? v:true : v:false)
call nvim_buf_set_option(buf, 'filetype', 'diff') call nvim_buf_set_option(buf, 'filetype', 'diff')
call nvim_buf_set_option(buf, 'buftype', 'acwrite') call nvim_buf_set_option(buf, 'buftype', 'acwrite')
call nvim_buf_set_option(buf, 'bufhidden', 'delete') call nvim_buf_set_option(buf, 'bufhidden', 'delete')
@ -458,6 +483,7 @@ function! s:open_hunk_preview_window()
let s:winid = popup_create('', g:gitgutter_floating_window_options) let s:winid = popup_create('', g:gitgutter_floating_window_options)
call setbufvar(winbufnr(s:winid), '&filetype', 'diff') call setbufvar(winbufnr(s:winid), '&filetype', 'diff')
call setwinvar(s:winid, '&wrap', source_wrap)
return return
endif endif
@ -479,11 +505,13 @@ function! s:open_hunk_preview_window()
let s:preview_bufnr = bufnr('') let s:preview_bufnr = bufnr('')
endif endif
setlocal filetype=diff buftype=acwrite bufhidden=delete setlocal filetype=diff buftype=acwrite bufhidden=delete
let &l:wrap = source_wrap
let b:source_window = source_window
" Reset some defaults in case someone else has changed them. " Reset some defaults in case someone else has changed them.
setlocal noreadonly modifiable noswapfile setlocal noreadonly modifiable noswapfile
if g:gitgutter_close_preview_on_escape if g:gitgutter_close_preview_on_escape
" Ensure cursor goes to the expected window. " Ensure cursor goes to the expected window.
nnoremap <buffer> <silent> <Esc> :<C-U>wincmd p<Bar>pclose<CR> nnoremap <buffer> <silent> <Esc> :<C-U>execute b:source_window . "wincmd w"<Bar>pclose<CR>
endif endif
if exists('&previewpopup') if exists('&previewpopup')
@ -594,7 +622,7 @@ endfunction
function! s:goto_original_window() function! s:goto_original_window()
noautocmd wincmd p noautocmd execute b:source_window . "wincmd w"
doautocmd WinEnter doautocmd WinEnter
endfunction endfunction

View file

@ -150,9 +150,8 @@ function! gitgutter#utility#set_repo_path(bufnr, continuation) abort
call gitgutter#utility#setbufvar(a:bufnr, 'path', -1) call gitgutter#utility#setbufvar(a:bufnr, 'path', -1)
let cmd = gitgutter#utility#cd_cmd(a:bufnr, let cmd = gitgutter#utility#cd_cmd(a:bufnr,
\ g:gitgutter_git_executable.' '.g:gitgutter_git_args. \ gitgutter#git().' ls-files -v --error-unmatch --full-name -z -- '.
\ ' ls-files -v --error-unmatch --full-name -z -- '. \ gitgutter#utility#shellescape(gitgutter#utility#filename(a:bufnr)))
\ gitgutter#utility#shellescape(s:filename(a:bufnr)))
if g:gitgutter_async && gitgutter#async#available() && !has('vim_starting') if g:gitgutter_async && gitgutter#async#available() && !has('vim_starting')
let handler = copy(s:set_path_handler) let handler = copy(s:set_path_handler)
@ -178,6 +177,20 @@ function! gitgutter#utility#set_repo_path(bufnr, continuation) abort
endfunction endfunction
function! gitgutter#utility#clean_smudge_filter_applies(bufnr)
let filtered = gitgutter#utility#getbufvar(a:bufnr, 'filter', -1)
if filtered == -1
let cmd = gitgutter#utility#cd_cmd(a:bufnr,
\ gitgutter#git().' check-attr filter -- '.
\ gitgutter#utility#shellescape(gitgutter#utility#filename(a:bufnr)))
let out = gitgutter#utility#system(cmd)
let filtered = out !~ 'unspecified'
call gitgutter#utility#setbufvar(a:bufnr, 'filter', filtered)
endif
return filtered
endfunction
function! gitgutter#utility#cd_cmd(bufnr, cmd) abort function! gitgutter#utility#cd_cmd(bufnr, cmd) abort
let cd = s:unc_path(a:bufnr) ? 'pushd' : (gitgutter#utility#windows() && s:dos_shell() ? 'cd /d' : 'cd') let cd = s:unc_path(a:bufnr) ? 'pushd' : (gitgutter#utility#windows() && s:dos_shell() ? 'cd /d' : 'cd')
return cd.' '.s:dir(a:bufnr).' && '.a:cmd return cd.' '.s:dir(a:bufnr).' && '.a:cmd
@ -233,7 +246,7 @@ function! s:dir(bufnr) abort
endfunction endfunction
" Not shellescaped. " Not shellescaped.
function! s:filename(bufnr) abort function! gitgutter#utility#filename(bufnr) abort
return fnamemodify(s:abs_path(a:bufnr, 0), ':t') return fnamemodify(s:abs_path(a:bufnr, 0), ':t')
endfunction endfunction

View file

@ -41,7 +41,8 @@ one in 2013.
=============================================================================== ===============================================================================
INSTALLATION *gitgutter-installation* INSTALLATION *gitgutter-installation*
Use your favourite package manager, or use Vim's built-in package support. First, use your favourite package manager, or use Vim's built-in package
support.
Vim:~ Vim:~
> >
@ -59,6 +60,16 @@ Neovim:~
nvim -u NONE -c "helptags vim-gitgutter/doc" -c q nvim -u NONE -c "helptags vim-gitgutter/doc" -c q
< <
Second, ensure your 'updatetime' and 'signcolumn' options are set appropriately.
When you make a change to a file tracked by git, the diff markers should
appear automatically after a short delay. The delay is governed by vim's
'updatetime' option; the default value is `4000`, i.e. 4 seconds, but I
suggest reducing it to around 100ms (add `set updatetime=100` to your vimrc).
Note 'updatetime' also controls the delay before vim writes its swap file.
The 'signcolumn' option can have any value except "off".
=============================================================================== ===============================================================================
WINDOWS *gitgutter-windows* WINDOWS *gitgutter-windows*
@ -635,7 +646,7 @@ colorscheme or |vimrc|:
GitGutterAddLine " default: links to DiffAdd GitGutterAddLine " default: links to DiffAdd
GitGutterChangeLine " default: links to DiffChange GitGutterChangeLine " default: links to DiffChange
GitGutterDeleteLine " default: links to DiffDelete GitGutterDeleteLine " default: links to DiffDelete
GitGutterChangeDeleteLine " default: links to GitGutterChangeLineDefault GitGutterChangeDeleteLine " default: links to GitGutterChangeLine
< <
For example, to use |hl-DiffText| instead of |hl-DiffChange|: For example, to use |hl-DiffText| instead of |hl-DiffChange|:
@ -648,7 +659,7 @@ your colorscheme or |vimrc|:
GitGutterAddLineNr " default: links to CursorLineNr GitGutterAddLineNr " default: links to CursorLineNr
GitGutterChangeLineNr " default: links to CursorLineNr GitGutterChangeLineNr " default: links to CursorLineNr
GitGutterDeleteLineNr " default: links to CursorLineNr GitGutterDeleteLineNr " default: links to CursorLineNr
GitGutterChangeDeleteLineNr " default: links to CursorLineNr GitGutterChangeDeleteLineNr " default: links to GitGutterChangeLineNr
< <
For example, to use |hl-Underlined| instead of |hl-CursorLineNr|: For example, to use |hl-Underlined| instead of |hl-CursorLineNr|:
> >

View file

@ -296,9 +296,6 @@ augroup gitgutter
autocmd User FugitiveChanged call gitgutter#all(1) autocmd User FugitiveChanged call gitgutter#all(1)
autocmd BufFilePre * GitGutterBufferDisable
autocmd BufFilePost * GitGutterBufferEnable
" Handle all buffers when focus is gained, but only after it was lost. " Handle all buffers when focus is gained, but only after it was lost.
" FocusGained gets triggered on startup with Neovim at least already. " FocusGained gets triggered on startup with Neovim at least already.
" Therefore this tracks also if it was lost before. " Therefore this tracks also if it was lost before.
@ -312,9 +309,11 @@ augroup gitgutter
autocmd ColorScheme * call gitgutter#highlight#define_highlights() autocmd ColorScheme * call gitgutter#highlight#define_highlights()
" Disable during :vimgrep autocmd BufFilePre * let b:gitgutter_was_enabled = gitgutter#utility#getbufvar(expand('<abuf>'), 'enabled') | GitGutterBufferDisable
autocmd QuickFixCmdPre *vimgrep* let [g:gitgutter_was_enabled, g:gitgutter_enabled] = [g:gitgutter_enabled, 0] autocmd BufFilePost * if b:gitgutter_was_enabled | GitGutterBufferEnable | endif | unlet b:gitgutter_was_enabled
autocmd QuickFixCmdPost *vimgrep* let g:gitgutter_enabled = g:gitgutter_was_enabled | unlet g:gitgutter_was_enabled
autocmd QuickFixCmdPre *vimgrep* let b:gitgutter_was_enabled = gitgutter#utility#getbufvar(expand('<abuf>'), 'enabled') | GitGutterBufferDisable
autocmd QuickFixCmdPost *vimgrep* if b:gitgutter_was_enabled | GitGutterBufferEnable | endif | unlet b:gitgutter_was_enabled
augroup END augroup END
" }}} " }}}

View file

@ -0,0 +1 @@
*.foo filter=reverse diff=reverse

View file

@ -0,0 +1,6 @@
[filter "reverse"]
clean = "rev"
smudge = "rev"
[diff "reverse"]
textconv = "cat"

View file

@ -0,0 +1,4 @@
one
two
three
four

View file

@ -0,0 +1,7 @@
a
b
c
d
e
f
g

View file

@ -54,8 +54,12 @@ endfunction
function SetUp() function SetUp()
call system("git init ".s:test_repo. call system("git init ".s:test_repo.
\ " && cd ".s:test_repo. \ " && cd ".s:test_repo.
\ " && cp ../.gitconfig .".
\ " && cp ../.gitattributes .".
\ " && cp ../fixture.foo .".
\ " && cp ../fixture.txt .". \ " && cp ../fixture.txt .".
\ " && cp ../fixture_dos.txt .". \ " && cp ../fixture_dos.txt .".
\ " && cp ../fixture_dos_noeol.txt .".
\ " && git add . && git commit -m 'initial'". \ " && git add . && git commit -m 'initial'".
\ " && git config diff.mnemonicPrefix false") \ " && git config diff.mnemonicPrefix false")
execute ':cd' s:test_repo execute ':cd' s:test_repo
@ -348,6 +352,21 @@ function Test_untracked_file_square_brackets_within_repo()
endfunction endfunction
function Test_file_unknown_in_base()
let starting_branch = system('git branch --show-current')
let starting_branch = 'main'
call system('git checkout -b some-feature')
let tmp = 'file-on-this-branch-only.tmp'
call system('echo "hi" > '.tmp.' && git add '.tmp)
execute 'edit '.tmp
let g:gitgutter_diff_base = starting_branch
GitGutter
let expected = [{'lnum': 1, 'name': 'GitGutterLineAdded', 'group': 'gitgutter', 'priority': 10}]
call s:assert_signs(expected, tmp)
let g:gitgutter_diff_base = ''
endfunction
function Test_hunk_outside_noop() function Test_hunk_outside_noop()
5 5
GitGutterStageHunk GitGutterStageHunk
@ -390,6 +409,12 @@ function Test_preview_dos()
endfunction endfunction
function Test_dos_noeol()
edit! fixture_dos_noeol.txt
GitGutter
call s:assert_signs([], 'fixture_dos_noeol.txt')
endfunction
function Test_hunk_stage() function Test_hunk_stage()
@ -752,7 +777,7 @@ endfunction
function Test_overlapping_hunk_op() function Test_overlapping_hunk_op()
func Answer(char) func! Answer(char)
call feedkeys(a:char."\<CR>") call feedkeys(a:char."\<CR>")
endfunc endfunc
@ -1164,3 +1189,29 @@ function Test_assume_unchanged()
call s:trigger_gitgutter() call s:trigger_gitgutter()
call s:assert_signs([], 'fixture.txt') call s:assert_signs([], 'fixture.txt')
endfunction endfunction
function Test_clean_smudge_filter()
call system("git config --local include.path ../.gitconfig")
call system("rm fixture.foo && git checkout fixture.foo")
func! Answer(char)
call feedkeys(a:char."\<CR>")
endfunc
edit fixture.foo
call setline(2, ['A'])
call setline(4, ['B'])
call s:trigger_gitgutter()
normal! 2G
call timer_start(100, {-> Answer('y')} )
GitGutterStageHunk
call s:trigger_gitgutter()
let expected = [
\ {'lnum': 2, 'id': 23, 'name': 'GitGutterLineModified', 'priority': 10, 'group': 'gitgutter'},
\ {'lnum': 4, 'id': 24, 'name': 'GitGutterLineModified', 'priority': 10, 'group': 'gitgutter'}
\ ]
" call s:assert_signs(expected, 'fixture.foo')
call s:assert_signs([], 'fixture.foo')
endfunction

View file

@ -656,7 +656,12 @@ endfunction
function! s:OpenUrlUnderCursor() function! s:OpenUrlUnderCursor()
let l:url = s:Markdown_GetUrlForPosition(line('.'), col('.')) let l:url = s:Markdown_GetUrlForPosition(line('.'), col('.'))
if l:url !=# '' if l:url !=# ''
call s:VersionAwareNetrwBrowseX(l:url) if l:url =~? 'http[s]\?:\/\/[[:alnum:]%\/_#.-]*'
"Do nothing
else
let l:url = expand(expand('%:h').'/'.l:url)
endif
call s:VersionAwareNetrwBrowseX(l:url)
else else
echomsg 'The cursor is not on a link.' echomsg 'The cursor is not on a link.'
endif endif

View file

@ -230,3 +230,24 @@ snippet af auto function
{ {
${0} ${0}
}; };
# Range-v3 transform
snippet transform "ranges::views::transform"
${1:${2:std::}${3:ranges::}views::}transform($4)
# Range-v3 transform
snippet filter "ranges::views::filter"
${1:${2:std::}${3:ranges::}views::}filter($4)
# Range-v3 ranges::
snippet r "ranges::"
ranges::
# Range-v3 ranges::views::
snippet rv "ranges::views::"
ranges::views::
# Range-v3 ranges::actions::
snippet ra "ranges::actions::"
ranges::actions::
# STL std::ranges::
snippet sr "std::ranges::"
std::ranges::
# STL std::views::
snippet sv "std::views::"
std::views::

View file

@ -390,63 +390,48 @@ snippet hrefc
# enquote from package csquotes # enquote from package csquotes
snippet enq enquote snippet enq enquote
\\enquote{${1:${VISUAL:text}}} ${0} \\enquote{${1:${VISUAL:text}}} ${0}
# Time derivative # Time derivative
snippet ddt time derivative snippet ddt time derivative
\\frac{d}{dt} {$1} {$0} \\frac{d}{dt} {$1} {$0}
# Limit # Limit
snippet lim limit snippet lim limit
\\lim_{{$1}} {{$2}} {$0} \\lim_{{$1}} {{$2}} {$0}
# Partial derivative # Partial derivative
snippet pdv partial derivation snippet pdv partial derivation
\\frac{\\partial {$1}}{\\partial {$2}} {$0} \\frac{\\partial {$1}}{\\partial {$2}} {$0}
# Second order partial derivative # Second order partial derivative
snippet ppdv second partial derivation 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 # Ordinary derivative
snippet dv derivative snippet dv derivative
\\frac{d {$1}}{d {$2}} {$0} \\frac{d {$1}}{d {$2}} {$0}
# Summation # Summation
snippet summ summation snippet summ summation
\\sum_{{$1}} {$0} \\sum_{{$1}} {$0}
# Shorthand for time derivative # Shorthand for time derivative
snippet dot dot snippet dot dot
\\dot{{$1}} {$0} \\dot{{$1}} {$0}
# Shorthand for second order time derivative # Shorthand for second order time derivative
snippet ddot ddot snippet ddot ddot
\\ddot{{$1}} {$0} \\ddot{{$1}} {$0}
# Vector # Vector
snippet vec vector snippet vec vector
\\vec{{$1}} {$0} \\vec{{$1}} {$0}
# Bar # Bar
snippet bar bar snippet bar bar
\\bar{{$1}} {$0} \\bar{{$1}} {$0}
# Cross product # Cross product
snippet \x cross product snippet \x cross product
\\times {$0} \\times {$0}
# Dot product # Dot product
snippet . dot product snippet . dot product
\\cdot {$0} \\cdot {$0}
# Integral # Integral
snippet int integral snippet int integral
\\int_{{$1}}^{{$2}} {$3} \\: d{$4} {$0} \\int_{{$1}}^{{$2}} {$3} \\: d{$4} {$0}
# Right arrow # Right arrow
snippet ra rightarrow snippet ra rightarrow
\\rightarrow {$0} \\rightarrow {$0}
# Long right arrow # Long right arrow
snippet lra longrightarrow snippet lra longrightarrow
\\longrightarrow {$0} \\longrightarrow {$0}