mirror of
1
0
Fork 0

Updated plugins

This commit is contained in:
Amir 2023-04-01 22:48:04 +02:00
parent 2b653aa950
commit b318c1d0e5
96 changed files with 2382 additions and 625 deletions

View File

@ -1,4 +1,4 @@
Copyright (c) 2016-2020, w0rp <devw0rp@gmail.com>
Copyright (c) 2016-2023, Dense Analysis
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -25,7 +25,7 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
if '>=6.0.0' is# l:version_group
let l:error_codes = { 'blocker': 'E', 'critical': 'E', 'major': 'W', 'minor': 'W', 'info': 'I' }
let l:linter_issues = json_decode(join(a:lines, ''))
let l:linter_issues = ale#util#FuzzyJSONDecode(a:lines, [])
for l:issue in l:linter_issues
if ale#path#IsBufferPath(a:buffer, l:issue.location.path)

View File

@ -0,0 +1,37 @@
" Author: uidops <uidops@protonmail.com>
" Description: llvm-mc linter for asm files
call ale#Set('asm_llvm_mc_executable', 'llvm-mc')
call ale#Set('asm_llvm_mc_options', '')
function! ale_linters#asm#llvm_mc#GetCommand(buffer) abort
return '%e --assemble'
\ . ' --filetype=asm'
\ . ' -o ' . g:ale#util#nul_file
\ . ' ' . ale#Var(a:buffer, 'asm_llvm_mc_options')
endfunction
function! ale_linters#asm#llvm_mc#Handle(buffer, lines) abort
let l:pattern = '^.\+:\(\d\+\):\(\d\+\): \([^:]\+\): \(.\+\)$'
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,
\ 'type': l:match[3] =~? 'error' ? 'E' : 'W',
\ 'text': l:match[4],
\})
endfor
return l:output
endfunction
call ale#linter#Define('asm', {
\ 'name': 'llvm_mc',
\ 'output_stream': 'stderr',
\ 'executable': {b -> ale#Var(b, 'asm_llvm_mc_executable')},
\ 'command': function('ale_linters#asm#llvm_mc#GetCommand'),
\ 'callback': 'ale_linters#asm#llvm_mc#Handle',
\})

View File

@ -0,0 +1,12 @@
" Author: Victor Ananyev <vindex10@gmail.com>
" Description: eslint for js snippets in HTML files
call ale#linter#Define('html', {
\ '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,15 @@
" Author: w0rp <dev@w0rp.com>
" Description: lua-language-server integration (https://github.com/LuaLS/lua-language-server)
call ale#Set('lua_language_server_executable', 'lua-language-server')
call ale#Set('lua_language_server_config', {})
call ale#linter#Define('lua', {
\ 'name': 'lua_language_server',
\ 'aliases': ['lua-language-server'],
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'lua_language_server_executable')},
\ 'command': '%e',
\ 'project_root': function('ale#lua#FindProjectRoot'),
\ 'lsp_config': {b -> ale#Var(b, 'lua_language_server_config')},
\})

View File

@ -0,0 +1,13 @@
call ale#Set('nix_deadnix_executable', 'deadnix')
call ale#Set('nix_deadnix_options', '')
function! ale_linters#nix#deadnix#GetCommand(buffer) abort
return '%e -o json' . ale#Pad(ale#Var(a:buffer, 'nix_deadnix_options')) . ' -- %t'
endfunction
call ale#linter#Define('nix', {
\ 'name': 'deadnix',
\ 'executable': {b -> ale#Var(b, 'nix_deadnix_executable')},
\ 'command': function('ale_linters#nix#deadnix#GetCommand'),
\ 'callback': 'ale#handlers#deadnix#Handle',
\})

View File

@ -5,10 +5,10 @@
function! ale_linters#nix#nix#Command(buffer, output, meta) abort
let l:version = a:output[0][22:]
if l:version =~# '^\(2.[4-9]\|3\).*'
return 'nix-instantiate --log-format internal-json --parse -'
else
if l:version =~# '^\(1\|2.[0-3]\.\).*'
return 'nix-instantiate --parse -'
else
return 'nix-instantiate --log-format internal-json --parse -'
endif
endfunction

View File

@ -26,10 +26,8 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
\ : ''
let l:level = ale#Var(a:buffer, 'php_phpstan_level')
let l:config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon')
let l:dist_config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist')
if empty(l:level) && empty(l:config_file_exists) && empty(l:dist_config_file_exists)
if empty(l:level) && empty(ale_linters#php#phpstan#FindConfigFile(a:buffer))
" if no configuration file is found, then use 4 as a default level
let l:level = '4'
endif
@ -70,6 +68,22 @@ function! ale_linters#php#phpstan#Handle(buffer, lines) abort
return l:output
endfunction
function! ale_linters#php#phpstan#GetCwd(buffer) abort
let l:result = ale#path#Dirname(ale_linters#php#phpstan#FindConfigFile(a:buffer))
return empty(l:result) ? v:null : l:result
endfunction
function! ale_linters#php#phpstan#FindConfigFile(buffer) abort
let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.neon')
if empty(l:result)
let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist')
endif
return l:result
endfunction
call ale#linter#Define('php', {
\ 'name': 'phpstan',
\ 'executable': {buffer -> ale#path#FindExecutable(buffer, 'php_phpstan', [
@ -86,4 +100,5 @@ call ale#linter#Define('php', {
\ function('ale_linters#php#phpstan#GetCommand'),
\ )},
\ 'callback': 'ale_linters#php#phpstan#Handle',
\ 'cwd': function('ale_linters#php#phpstan#GetCwd'),
\})

View File

@ -16,12 +16,16 @@ endfunction
function! ale_linters#python#jedils#GetCommand(buffer) abort
let l:executable = ale_linters#python#jedils#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv$'
\ ? ' run jedi-language-server'
\ : ''
let l:env_string = ''
return ale#Escape(l:executable) . l:exec_args
if ale#Var(a:buffer, 'python_auto_virtualenv')
let l:env_string = ale#python#AutoVirtualenvEnvString(a:buffer)
endif
return l:env_string . ale#Escape(l:executable) . l:exec_args
endfunction
call ale#linter#Define('python', {

View File

@ -0,0 +1,86 @@
" Author: Yining <zhang.yining@gmail.com>
" Description: pycln as linter for python files
call ale#Set('python_pycln_executable', 'pycln')
call ale#Set('python_pycln_options', '')
call ale#Set('python_pycln_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pycln_change_directory', 1)
call ale#Set('python_pycln_auto_pipenv', 0)
call ale#Set('python_pycln_auto_poetry', 0)
call ale#Set('python_pycln_config_file', '')
function! ale_linters#python#pycln#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pycln_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pycln_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
return ale#python#FindExecutable(a:buffer, 'python_pycln', ['pycln'])
endfunction
function! ale_linters#python#pycln#GetCwd(buffer) abort
if ale#Var(a:buffer, 'python_pycln_change_directory')
" Run from project root if found, else from buffer dir.
let l:project_root = ale#python#FindProjectRoot(a:buffer)
return !empty(l:project_root) ? l:project_root : '%s:h'
endif
return ''
endfunction
function! ale_linters#python#pycln#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#pycln#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
\ ? ' run pycln'
\ : ''
let l:options = ale#Var(a:buffer, 'python_pycln_options')
let l:config_file = ale#Var(a:buffer, 'python_pycln_config_file')
let l:config_file = l:options !~# '\v(^| )--config ' && !empty(l:config_file)
\ ? ale#Escape(ale#path#Simplify(l:config_file))
\ : ''
" NOTE: pycln version `1.3.0` supports liniting input from stdin
return ale#Escape(l:executable) . l:exec_args
\ . ale#Pad(ale#Var(a:buffer, 'python_pycln_options'))
\ . (empty(l:config_file) ? '' : ' --config ' . l:config_file)
\ . ' --check'
\ . (ale#semver#GTE(a:version, [1, 3, 0]) ? ' -' : ' %s')
endfunction
function! ale_linters#python#pycln#Handle(buffer, lines) abort
" Example: tmp/test.py:3:0 'import os' would be removed!
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):? (.+)$'
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],
\})
endfor
return l:output
endfunction
call ale#linter#Define('python', {
\ 'name': 'pycln',
\ 'executable': function('ale_linters#python#pycln#GetExecutable'),
\ 'cwd': function('ale_linters#python#pycln#GetCwd'),
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale_linters#python#pycln#GetExecutable(buffer),
\ '%e --version',
\ function('ale_linters#python#pycln#GetCommand'),
\ )},
\ 'callback': 'ale_linters#python#pycln#Handle',
\ 'output_stream': 'both',
\ 'read_buffer': 1,
\})

View File

@ -22,20 +22,38 @@ function! ale_linters#python#pylsp#GetExecutable(buffer) abort
return ale#python#FindExecutable(a:buffer, 'python_pylsp', ['pylsp'])
endfunction
" Force the cwd of the server to be the same as the project root to
" fix issues with treating local files matching first or third party library
" names being imported incorrectly.
function! ale_linters#python#pylsp#GetCwd(buffer) abort
let l:fake_linter = {
\ 'name': 'pylsp',
\ 'project_root': function('ale#python#FindProjectRoot'),
\}
let l:root = ale#lsp_linter#FindProjectRoot(a:buffer, l:fake_linter)
return !empty(l:root) ? l:root : v:null
endfunction
function! ale_linters#python#pylsp#GetCommand(buffer) abort
let l:executable = ale_linters#python#pylsp#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
\ ? ' run pylsp'
\ : ''
let l:env_string = ''
return ale#Escape(l:executable) . l:exec_args . ale#Pad(ale#Var(a:buffer, 'python_pylsp_options'))
if ale#Var(a:buffer, 'python_auto_virtualenv')
let l:env_string = ale#python#AutoVirtualenvEnvString(a:buffer)
endif
return l:env_string . ale#Escape(l:executable) . l:exec_args . ale#Pad(ale#Var(a:buffer, 'python_pylsp_options'))
endfunction
call ale#linter#Define('python', {
\ 'name': 'pylsp',
\ 'lsp': 'stdio',
\ 'executable': function('ale_linters#python#pylsp#GetExecutable'),
\ 'cwd': function('ale_linters#python#pylsp#GetCwd'),
\ 'command': function('ale_linters#python#pylsp#GetCommand'),
\ 'project_root': function('ale#python#FindProjectRoot'),
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',

View File

@ -1,5 +1,21 @@
call ale#Set('python_pyright_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pyright_executable', 'pyright-langserver')
call ale#Set('python_pyright_config', {})
call ale#Set('python_pyright_auto_pipenv', 0)
call ale#Set('python_pyright_auto_poetry', 0)
" Force the cwd of the server to be the same as the project root to
" fix issues with treating local files matching first or third party library
" names being imported incorrectly.
function! ale_linters#python#pyright#GetCwd(buffer) abort
let l:fake_linter = {
\ 'name': 'pyright',
\ 'project_root': function('ale#python#FindProjectRoot'),
\}
let l:root = ale#lsp_linter#FindProjectRoot(a:buffer, l:fake_linter)
return !empty(l:root) ? l:root : v:null
endfunction
function! ale_linters#python#pyright#GetConfig(buffer) abort
let l:config = deepcopy(ale#Var(a:buffer, 'python_pyright_config'))
@ -32,11 +48,40 @@ function! ale_linters#python#pyright#GetConfig(buffer) abort
return l:config
endfunction
function! ale_linters#python#pyright#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyright_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pyright_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
return ale#python#FindExecutable(a:buffer, 'python_pyright', ['pyright-langserver'])
endfunction
function! ale_linters#python#pyright#GetCommand(buffer) abort
let l:executable = ale_linters#python#pyright#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
\ ? ' run pyright'
\ : ''
let l:env_string = ''
if ale#Var(a:buffer, 'python_auto_virtualenv')
let l:env_string = ale#python#AutoVirtualenvEnvString(a:buffer)
endif
return l:env_string . ale#Escape(l:executable) . l:exec_args . ' --stdio'
endfunction
call ale#linter#Define('python', {
\ 'name': 'pyright',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'python_pyright_executable')},
\ 'command': '%e --stdio',
\ 'cwd': function('ale_linters#python#pyright#GetCwd'),
\ 'executable': function('ale_linters#python#pyright#GetExecutable'),
\ 'command': function('ale_linters#python#pyright#GetCommand'),
\ 'project_root': function('ale#python#FindProjectRoot'),
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
\ 'lsp_config': function('ale_linters#python#pyright#GetConfig'),

View File

@ -0,0 +1,73 @@
" Author: Yining <zhang.yining@gmail.com>
" Description: refurb as linter for python files
call ale#Set('python_refurb_executable', 'refurb')
call ale#Set('python_refurb_options', '')
call ale#Set('python_refurb_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_refurb_change_directory', 1)
call ale#Set('python_refurb_auto_pipenv', 0)
call ale#Set('python_refurb_auto_poetry', 0)
function! ale_linters#python#refurb#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_refurb_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_refurb_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
return ale#python#FindExecutable(a:buffer, 'python_refurb', ['refurb'])
endfunction
function! ale_linters#python#refurb#GetCwd(buffer) abort
if ale#Var(a:buffer, 'python_refurb_change_directory')
" Run from project root if found, else from buffer dir.
let l:project_root = ale#python#FindProjectRoot(a:buffer)
return !empty(l:project_root) ? l:project_root : '%s:h'
endif
return ''
endfunction
function! ale_linters#python#refurb#GetCommand(buffer) abort
let l:executable = ale_linters#python#refurb#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
\ ? ' run refurb'
\ : ''
return ale#Escape(l:executable) . l:exec_args
\ . ale#Pad(ale#Var(a:buffer, 'python_refurb_options'))
\ . ' %s'
endfunction
function! ale_linters#python#refurb#Handle(buffer, lines) abort
"Example: path/to/file.py:3:17 [FURB109]: Replace `in [x, y, z]` with `in (x, y, z)`
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+)?:?\s*\[FURB(\d+)\]:\s*(.+)$'
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,
\ 'code': l:match[3] + 0,
\ 'text': l:match[4],
\ 'type': 'W',
\})
endfor
return l:output
endfunction
call ale#linter#Define('python', {
\ 'name': 'refurb',
\ 'executable': function('ale_linters#python#refurb#GetExecutable'),
\ 'cwd': function('ale_linters#python#refurb#GetCwd'),
\ 'command': function('ale_linters#python#refurb#GetCommand'),
\ 'callback': 'ale_linters#python#refurb#Handle',
\ 'output_stream': 'both',
\ 'read_buffer': 0,
\})

View File

@ -49,7 +49,7 @@ function! ale_linters#python#ruff#GetCommand(buffer, version) abort
return ale#Escape(l:executable) . l:exec_args
\ . ale#Pad(ale#Var(a:buffer, 'python_ruff_options'))
\ . ' --format text'
\ . (ale#semver#GTE(a:version, [0, 0, 69]) ? ' -' : ' %s')
\ . (ale#semver#GTE(a:version, [0, 0, 69]) ? ' --stdin-filename %s -' : ' %s')
endfunction
function! ale_linters#python#ruff#Handle(buffer, lines) abort

View File

@ -157,7 +157,7 @@ function! ale#Queue(delay, ...) abort
endif
endfunction
let s:current_ale_version = [3, 2, 0]
let s:current_ale_version = [3, 3, 0]
" A function used to check for ALE features in files outside of the project.
function! ale#Has(feature) abort
@ -254,6 +254,7 @@ function! ale#GetLocItemMessage(item, format_string) abort
" \=l:variable is used to avoid escaping issues.
let l:msg = substitute(l:msg, '\v\%([^\%]*)code([^\%]*)\%', l:code_repl, 'g')
let l:msg = substitute(l:msg, '\V%severity%', '\=l:severity', 'g')
let l:msg = substitute(l:msg, '\V%type%', '\=l:type', 'g')
let l:msg = substitute(l:msg, '\V%linter%', '\=l:linter_name', 'g')
" Replace %s with the text.
let l:msg = substitute(l:msg, '\V%s', '\=a:item.text', 'g')

View File

@ -55,6 +55,7 @@ let s:global_variable_list = [
\ 'ale_sign_highlight_linenrs',
\ 'ale_statusline_format',
\ 'ale_type_map',
\ 'ale_use_neovim_diagnostics_api',
\ 'ale_use_global_executables',
\ 'ale_virtualtext_cursor',
\ 'ale_warn_about_trailing_blank_lines',

View File

@ -184,9 +184,13 @@ endfunction
function! ale#engine#SetResults(buffer, loclist) abort
let l:linting_is_done = !ale#engine#IsCheckingBuffer(a:buffer)
if g:ale_use_neovim_diagnostics_api
call ale#engine#SendResultsToNeovimDiagnostics(a:buffer, a:loclist)
endif
" Set signs first. This could potentially fix some line numbers.
" The List could be sorted again here by SetSigns.
if g:ale_set_signs
if !g:ale_use_neovim_diagnostics_api && g:ale_set_signs
call ale#sign#SetSigns(a:buffer, a:loclist)
endif
@ -199,11 +203,12 @@ function! ale#engine#SetResults(buffer, loclist) abort
call ale#statusline#Update(a:buffer, a:loclist)
endif
if g:ale_set_highlights
if !g:ale_use_neovim_diagnostics_api && g:ale_set_highlights
call ale#highlight#SetHighlights(a:buffer, a:loclist)
endif
if g:ale_virtualtext_cursor == 2
if !g:ale_use_neovim_diagnostics_api
\&& (g:ale_virtualtext_cursor is# 'all' || g:ale_virtualtext_cursor == 2)
call ale#virtualtext#SetTexts(a:buffer, a:loclist)
endif
@ -214,7 +219,8 @@ function! ale#engine#SetResults(buffer, loclist) abort
call ale#cursor#EchoCursorWarning()
endif
if g:ale_virtualtext_cursor == 1
if !g:ale_use_neovim_diagnostics_api
\&& (g:ale_virtualtext_cursor is# 'current' || g:ale_virtualtext_cursor == 1)
" Try and show the warning now.
" This will only do something meaningful if we're in normal mode.
call ale#virtualtext#ShowCursorWarning()
@ -238,6 +244,19 @@ function! ale#engine#SetResults(buffer, loclist) abort
endif
endfunction
function! ale#engine#SendResultsToNeovimDiagnostics(buffer, loclist) abort
if !has('nvim-0.6')
" We will warn the user on startup as well if they try to set
" g:ale_use_neovim_diagnostics_api outside of a Neovim context.
return
endif
" Keep the Lua surface area really small in the VimL part of ALE,
" and just require the diagnostics.lua module on demand.
let l:SendDiagnostics = luaeval('require("diagnostics").sendAleResultsToDiagnostics')
call l:SendDiagnostics(a:buffer, a:loclist)
endfunction
function! s:RemapItemTypes(type_map, loclist) abort
for l:item in a:loclist
let l:key = l:item.type

View File

@ -139,7 +139,7 @@ function! ale#events#Init() abort
autocmd InsertLeave * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarning() | endif
endif
if g:ale_virtualtext_cursor == 1
if g:ale_virtualtext_cursor is# 'current' || g:ale_virtualtext_cursor is# 1 || g:ale_virtualtext_cursor is# '1'
autocmd CursorMoved,CursorHold * if exists('*ale#engine#Cleanup') | call ale#virtualtext#ShowCursorWarningWithDelay() | endif
" Look for a warning to echo as soon as we leave Insert mode.
" The script's position variable used when moving the cursor will

View File

@ -7,6 +7,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['python'],
\ 'description': 'Add blank lines before control statements.',
\ },
\ 'alejandra': {
\ 'function': 'ale#fixers#alejandra#Fix',
\ 'suggested_filetypes': ['nix'],
\ 'description': 'The Uncompromising Nix Code Formatter',
\ },
\ 'align_help_tags': {
\ 'function': 'ale#fixers#help#AlignTags',
\ 'suggested_filetypes': ['help'],
@ -301,6 +306,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['gomod'],
\ 'description': 'Fix Go module files with go mod edit -fmt.',
\ },
\ 'gopls': {
\ 'function': 'ale#fixers#gopls#Fix',
\ 'suggested_filetypes': ['go'],
\ 'description': 'Fix Go files with gopls.',
\ },
\ 'tslint': {
\ 'function': 'ale#fixers#tslint#Fix',
\ 'suggested_filetypes': ['typescript'],
@ -580,6 +590,21 @@ let s:default_registry = {
\ 'function': 'ale#fixers#raco_fmt#Fix',
\ 'suggested_filetypes': ['racket'],
\ 'description': 'Fix Racket files with raco fmt.',
\ },
\ 'ruff': {
\ 'function': 'ale#fixers#ruff#Fix',
\ 'suggested_filetypes': ['python'],
\ 'description': 'Fix python files with ruff.',
\ },
\ 'pycln': {
\ 'function': 'ale#fixers#pycln#Fix',
\ 'suggested_filetypes': ['python'],
\ 'description': 'remove unused python import statements',
\ },
\ 'rustywind': {
\ 'function': 'ale#fixers#rustywind#Fix',
\ 'suggested_filetypes': ['html'],
\ 'description': 'Sort Tailwind CSS classes',
\ }
\}

View File

@ -0,0 +1,13 @@
call ale#Set('nix_alejandra_executable', 'alejandra')
call ale#Set('nix_alejandra_options', '')
function! ale#fixers#alejandra#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'nix_alejandra_executable')
let l:options = ale#Var(a:buffer, 'nix_alejandra_options')
return {
\ 'command': ale#Escape(l:executable)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' -- -'
\}
endfunction

View File

@ -0,0 +1,23 @@
" Author: Sean Enck <enckse@voidedtech.com>
" Description: Integration of gopls format with ALE.
call ale#Set('go_gopls_fix_executable', 'gopls')
call ale#Set('go_gopls_fix_options', '')
function! ale#fixers#gopls#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'go_gopls_fix_executable')
let l:options = ale#Var(a:buffer, 'go_gopls_fix_options')
let l:env = ale#go#EnvString(a:buffer)
if !executable(l:executable)
return 0
endif
return {
\ 'command': l:env . ale#Escape(l:executable)
\ . ' format'
\ . ale#Pad(l:options)
\ . ' -l -w %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@ -0,0 +1,90 @@
" Author: Yining <zhang.yining@gmail.com>
" Description: pycln as ALE fixer for python files
call ale#Set('python_pycln_executable', 'pycln')
call ale#Set('python_pycln_options', '')
call ale#Set('python_pycln_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pycln_change_directory', 1)
call ale#Set('python_pycln_auto_pipenv', 0)
call ale#Set('python_pycln_auto_poetry', 0)
call ale#Set('python_pycln_config_file', '')
function! ale#fixers#pycln#GetCwd(buffer) abort
if ale#Var(a:buffer, 'python_pycln_change_directory')
" Run from project root if found, else from buffer dir.
let l:project_root = ale#python#FindProjectRoot(a:buffer)
return !empty(l:project_root) ? l:project_root : '%s:h'
endif
return '%s:h'
endfunction
function! ale#fixers#pycln#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pycln_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pycln_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
return ale#python#FindExecutable(a:buffer, 'python_pycln', ['pycln'])
endfunction
function! ale#fixers#pycln#GetCommand(buffer) abort
let l:executable = ale#fixers#pycln#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
\ ? ' run pycln'
\ : ''
return ale#Escape(l:executable) . l:exec_args
endfunction
function! ale#fixers#pycln#FixForVersion(buffer, version) abort
let l:executable = ale#fixers#pycln#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$'
call extend(l:cmd, ['run', 'pycln'])
endif
let l:options = ale#Var(a:buffer, 'python_pycln_options')
if !empty(l:options)
call add(l:cmd, l:options)
endif
let l:config_file = ale#Var(a:buffer, 'python_pycln_config_file')
let l:config_file = l:options !~# '\v(^| )--config ' && !empty(l:config_file)
\ ? ale#Escape(ale#path#Simplify(l:config_file))
\ : ''
if !empty(l:config_file)
call add(l:cmd, '--config ' . l:config_file)
endif
call add(l:cmd, '--silence')
" NOTE: pycln version `1.3.0` support reading from stdin
call add(l:cmd, ale#semver#GTE(a:version, [1, 3, 0]) ? '-' : '%s')
return {
\ 'cwd': ale#fixers#pycln#GetCwd(a:buffer),
\ 'command': join(l:cmd, ' '),
\}
endfunction
function! ale#fixers#pycln#Fix(buffer) abort
let l:executable = ale#fixers#pycln#GetExecutable(a:buffer)
let l:command = ale#fixers#pycln#GetCommand(a:buffer) . ale#Pad('--version')
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ l:executable,
\ l:command,
\ function('ale#fixers#pycln#FixForVersion'),
\)
endfunction

View File

@ -1,6 +1,13 @@
" Author: Yining <zhang.yining@gmail.com>
" Description: ruff as ALE fixer for python files
call ale#Set('python_ruff_executable', 'ruff')
call ale#Set('python_ruff_options', '')
call ale#Set('python_ruff_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_ruff_change_directory', 1)
call ale#Set('python_ruff_auto_pipenv', 0)
call ale#Set('python_ruff_auto_poetry', 0)
function! ale#fixers#ruff#GetCwd(buffer) abort
if ale#Var(a:buffer, 'python_ruff_change_directory')
" Run from project root if found, else from buffer dir.
@ -9,7 +16,7 @@ function! ale#fixers#ruff#GetCwd(buffer) abort
return !empty(l:project_root) ? l:project_root : '%s:h'
endif
return ''
return '%s:h'
endfunction
function! ale#fixers#ruff#GetExecutable(buffer) abort
@ -26,29 +33,57 @@ function! ale#fixers#ruff#GetExecutable(buffer) abort
return ale#python#FindExecutable(a:buffer, 'python_ruff', ['ruff'])
endfunction
function! ale#fixers#ruff#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#ruff#GetExecutable(a:buffer)
function! ale#fixers#ruff#GetCommand(buffer) abort
let l:executable = ale#fixers#ruff#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
\ ? ' run ruff'
\ : ''
" NOTE: ruff version `0.0.72` implement `--fix` with stdin
return ale#Escape(l:executable) . l:exec_args
\ . ale#Pad(ale#Var(a:buffer, 'python_ruff_options'))
\ . ' --fix'
\ . (ale#semver#GTE(a:version, [0, 0, 72]) ? ' -' : ' %s')
endfunction
function! ale#fixers#ruff#FixForVersion(buffer, version) abort
let l:executable = ale#fixers#ruff#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$'
call extend(l:cmd, ['run', 'ruff'])
endif
let l:options = ale#Var(a:buffer, 'python_ruff_options')
if !empty(l:options)
call add(l:cmd, l:options)
endif
" when --stdin-filename present, ruff will use it for proj root resolution
" https://github.com/charliermarsh/ruff/pull/1281
let l:fname = expand('#' . a:buffer . '...')
call add(l:cmd, '--stdin-filename '.ale#Escape(ale#path#Simplify(l:fname)))
call add(l:cmd, '--fix')
" NOTE: ruff version `0.0.72` implements `--fix` with stdin
if ale#semver#GTE(a:version, [0, 0, 72])
call add(l:cmd, '-')
else
call add(l:cmd, '%s')
endif
return {
\ 'cwd': ale#fixers#ruff#GetCwd(a:buffer),
\ 'command': join(l:cmd, ' '),
\}
endfunction
function! ale#fixers#ruff#Fix(buffer) abort
let l:fix_cmd = {buffer -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale#fixers#ruff#GetExecutable(buffer),
\ '%e --version',
\ function('ale#fixers#ruff#GetCommand'),
\ )}(a:buffer)
let l:executable = ale#fixers#ruff#GetExecutable(a:buffer)
let l:command = ale#fixers#ruff#GetCommand(a:buffer) . ale#Pad('--version')
return {
\ 'cwd': ale#fixers#ruff#GetCwd(a:buffer),
\ 'command': l:fix_cmd,
\}
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ l:executable,
\ l:command,
\ function('ale#fixers#ruff#FixForVersion'),
\)
endfunction

View File

@ -0,0 +1,17 @@
scriptencoding utf-8
" Author: Guillermo Roig <groig@protonmail.com>
" Description: Sort TailwindCSS classes with rustywind
call ale#Set('html_rustywind_executable', 'rustywind')
call ale#Set('html_rustywind_options', '')
function! ale#fixers#rustywind#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'html_rustywind_executable')
let l:options = ale#Var(a:buffer, 'html_rustywind_options')
return {
\ 'command': ale#Escape(l:executable)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' --stdin'
\}
endfunction

View File

@ -52,9 +52,9 @@ function! s:NvimShow(lines, options) abort
autocmd!
if g:ale_close_preview_on_insert
autocmd CursorMoved,TabLeave,WinLeave,InsertEnter <buffer> ++once call s:NvimClose()
autocmd CursorMoved,TabLeave,WinLeave,BufWinLeave,WinScrolled,InsertEnter <buffer> ++once call s:NvimClose()
else
autocmd CursorMoved,TabLeave,WinLeave <buffer> ++once call s:NvimClose()
autocmd CursorMoved,TabLeave,WinLeave,BufWinLeave,WinScrolled <buffer> ++once call s:NvimClose()
endif
augroup END
@ -99,48 +99,30 @@ function! s:NvimPrepareWindowContent(lines) abort
let l:width = max(map(copy(a:lines), 'strdisplaywidth(v:val)'))
let l:height = min([len(a:lines), l:max_height])
if empty(g:ale_floating_window_border)
return [a:lines, l:width, l:height]
endif
" Add the size of borders
let l:width += 2
let l:height += 2
let l:left = get(g:ale_floating_window_border, 0, '|')
let l:top = get(g:ale_floating_window_border, 1, '-')
let l:top_left = get(g:ale_floating_window_border, 2, '+')
let l:top_right = get(g:ale_floating_window_border, 3, '+')
let l:bottom_right = get(g:ale_floating_window_border, 4, '+')
let l:bottom_left = get(g:ale_floating_window_border, 5, '+')
let l:right = get(g:ale_floating_window_border, 6, l:left)
let l:bottom = get(g:ale_floating_window_border, 7, l:top)
let l:lines = [l:top_left . repeat(l:top, l:width - 2) . l:top_right]
for l:line in a:lines
let l:line_width = strchars(l:line)
let l:lines = add(l:lines, l:left . l:line . repeat(' ', l:width - l:line_width - 2). l:right)
endfor
" Truncate the lines
if len(l:lines) > l:max_height + 1
let l:lines = l:lines[0:l:max_height]
endif
let l:lines = add(l:lines, l:bottom_left . repeat(l:bottom, l:width - 2) . l:bottom_right)
return [l:lines, l:width, l:height]
return [a:lines[0:l:height-1], l:width, l:height]
endfunction
function! s:NvimCreate(options) abort
let l:left = get(g:ale_floating_window_border, 0, '|')
let l:top = get(g:ale_floating_window_border, 1, '-')
let l:popup_opts = extend({
\ 'relative': 'cursor',
\ 'row': 1,
\ 'col': 0,
\ 'width': 42,
\ 'height': 4,
\ 'style': 'minimal'
\ 'style': 'minimal',
\ 'border': empty(g:ale_floating_window_border) ? 'none' : [
\ get(g:ale_floating_window_border, 2, '+'),
\ l:top,
\ get(g:ale_floating_window_border, 3, '+'),
\ get(g:ale_floating_window_border, 6, l:left),
\ get(g:ale_floating_window_border, 4, '+'),
\ get(g:ale_floating_window_border, 7, l:top),
\ get(g:ale_floating_window_border, 5, '+'),
\ l:left,
\ ],
\ }, s:GetPopupOpts())
let l:buffer = nvim_create_buf(v:false, v:false)

View File

@ -0,0 +1,33 @@
function! ale#handlers#deadnix#Handle(buffer, lines) abort
let l:output = []
for l:line in a:lines
try
let l:file = ale#util#FuzzyJSONDecode(l:line, v:null)
catch
continue
endtry
if type(l:file) isnot v:t_dict
continue
endif
for l:error in l:file['results']
try
let l:ale_error = {
\ 'lnum': l:error['line'],
\ 'col': l:error['column'],
\ 'end_col': l:error['endColumn'],
\ 'text': l:error['message'],
\ 'type': 'W',
\}
catch
continue
endtry
call add(l:output, l:ale_error)
endfor
endfor
return l:output
endfunction

View File

@ -22,26 +22,6 @@ if !hlexists('ALEInfo')
highlight link ALEInfo ALEWarning
endif
if !hlexists('ALEVirtualTextError')
highlight link ALEVirtualTextError ALEError
endif
if !hlexists('ALEVirtualTextStyleError')
highlight link ALEVirtualTextStyleError ALEVirtualTextError
endif
if !hlexists('ALEVirtualTextWarning')
highlight link ALEVirtualTextWarning ALEWarning
endif
if !hlexists('ALEVirtualTextStyleWarning')
highlight link ALEVirtualTextStyleWarning ALEVirtualTextWarning
endif
if !hlexists('ALEVirtualTextInfo')
highlight link ALEVirtualTextInfo ALEVirtualTextWarning
endif
" The maximum number of items for the second argument of matchaddpos()
let s:MAX_POS_VALUES = 8
let s:MAX_COL_SIZE = 1073741824 " pow(2, 30)

View File

@ -51,7 +51,7 @@ let s:default_ale_linters = {
\ 'jsonc': [],
\ 'perl': ['perlcritic'],
\ 'perl6': [],
\ 'python': ['flake8', 'mypy', 'pylint', 'pyright'],
\ 'python': ['flake8', 'mypy', 'pylint', 'pyright', 'ruff'],
\ 'rust': ['cargo', 'rls'],
\ 'spec': [],
\ 'text': [],

View File

@ -52,28 +52,24 @@ function! ale#lsp#message#Exit() abort
endfunction
function! ale#lsp#message#DidOpen(buffer, language_id) abort
let l:lines = getbufline(a:buffer, 1, '$')
return [1, 'textDocument/didOpen', {
\ 'textDocument': {
\ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')),
\ 'languageId': a:language_id,
\ 'version': ale#lsp#message#GetNextVersionID(),
\ 'text': join(l:lines, "\n") . "\n",
\ 'text': ale#util#GetBufferContents(a:buffer),
\ },
\}]
endfunction
function! ale#lsp#message#DidChange(buffer) abort
let l:lines = getbufline(a:buffer, 1, '$')
" For changes, we simply send the full text of the document to the server.
return [1, 'textDocument/didChange', {
\ 'textDocument': {
\ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')),
\ 'version': ale#lsp#message#GetNextVersionID(),
\ },
\ 'contentChanges': [{'text': join(l:lines, "\n") . "\n"}]
\ 'contentChanges': [{'text': ale#util#GetBufferContents(a:buffer)}]
\}]
endfunction

View File

@ -0,0 +1,28 @@
" Author: w0rp <dev@w0rp.com>
" Description: Functions for integrating with Lua linters.
" Find project root for a Lua language server.
function! ale#lua#FindProjectRoot(buffer) abort
let l:possible_project_roots = [
\ '.git',
\ bufname(a:buffer),
\]
for l:possible_root in l:possible_project_roots
let l:project_root = ale#path#FindNearestFile(a:buffer, l:possible_root)
if empty(l:project_root)
let l:project_root = ale#path#FindNearestDirectory(a:buffer, l:possible_root)
endif
if !empty(l:project_root)
" dir:p expands to /full/path/to/dir/ whereas
" file:p expands to /full/path/to/file (no trailing slash)
" Appending '/' ensures that :h:h removes the path's last segment
" regardless of whether it is a directory or not.
return fnamemodify(l:project_root . '/', ':p:h:h')
endif
endfor
return ''
endfunction

View File

@ -1,4 +1,4 @@
" Author: w0rp <devw0rp@gmail.com>
" Author: w0rp <dev@w0rp.com>
" Description: Functions for integrating with Python linters.
call ale#Set('python_auto_pipenv', '0')
@ -96,6 +96,27 @@ function! ale#python#FindVirtualenv(buffer) abort
return $VIRTUAL_ENV
endfunction
" Automatically determine virtualenv environment variables and build
" a string of them to prefix linter commands with.
function! ale#python#AutoVirtualenvEnvString(buffer) abort
let l:venv_dir = ale#python#FindVirtualenv(a:buffer)
if !empty(l:venv_dir)
let l:strs = [ ]
" expand PATH correctly inside of the appropriate shell.
if has('win32')
call add(l:strs, 'set PATH=' . ale#Escape(l:venv_dir) . ';%PATH% && ')
else
call add(l:strs, 'PATH=' . ale#Escape(l:venv_dir) . '":$PATH" ')
endif
return join(l:strs, '')
endif
return ''
endfunction
" Given a buffer number and a command name, find the path to the executable.
" First search on a virtualenv for Python, if nothing is found, try the global
" command. Returns an empty string if cannot find the executable

View File

@ -14,7 +14,7 @@ function! s:DisablePostamble() abort
call ale#highlight#UpdateHighlights()
endif
if g:ale_virtualtext_cursor == 1
if g:ale_virtualtext_cursor isnot# 'disabled' && g:ale_virtualtext_cursor != 0
call ale#virtualtext#Clear(bufnr(''))
endif
endfunction

View File

@ -542,7 +542,7 @@ function! ale#util#SetBufferContents(buffer, lines) abort
endfunction
function! ale#util#GetBufferContents(buffer) abort
return join(getbufline(a:buffer, 1, '$'), '\n') . '\n'
return join(getbufline(a:buffer, 1, '$'), "\n") . "\n"
endfunction
function! ale#util#ToURI(resource) abort

View File

@ -3,88 +3,58 @@ scriptencoding utf-8
" Author: Luan Santos <cfcluan@gmail.com>
" Description: Shows lint message for the current line as virtualtext, if any
" Controls the milliseconds delay before showing a message.
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
let s:emulate_virt = 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')
let s:has_virt_text = 1
let s:emulate_virt = !has('patch-9.0.0297')
let s:hl_list = []
if s:emulate_virt
call prop_type_add('ale', {})
let s:last_virt = -1
endif
if !hlexists('ALEVirtualTextError')
highlight link ALEVirtualTextError Comment
endif
function! ale#virtualtext#Clear(buf) abort
if !s:has_virt_text
return
endif
if !hlexists('ALEVirtualTextStyleError')
highlight link ALEVirtualTextStyleError ALEVirtualTextError
endif
if has('nvim')
call nvim_buf_clear_namespace(a:buf, s:ns_id, 0, -1)
else
if s:emulate_virt && s:last_virt != -1
call prop_remove({'type': 'ale'})
call popup_close(s:last_virt)
let s:last_virt = -1
elseif !empty(s:hl_list)
call prop_remove({
\ 'types': s:hl_list,
\ 'all': 1,
\ 'bufnr': a:buf})
if !hlexists('ALEVirtualTextWarning')
highlight link ALEVirtualTextWarning Comment
endif
if !hlexists('ALEVirtualTextStyleWarning')
highlight link ALEVirtualTextStyleWarning ALEVirtualTextWarning
endif
if !hlexists('ALEVirtualTextInfo')
highlight link ALEVirtualTextInfo ALEVirtualTextWarning
endif
let g:ale_virtualtext_prefix =
\ get(g:, 'ale_virtualtext_prefix', '%comment% %type%: ')
" Controls the milliseconds delay before showing a message.
let g:ale_virtualtext_delay = get(g:, 'ale_virtualtext_delay', 10)
" Controls the positioning of virtualtext
let g:ale_virtualtext_column = get(g:, 'ale_virtualtext_column', 0)
let g:ale_virtualtext_maxcolumn = get(g:, 'ale_virtualtext_maxcolumn', 0)
let g:ale_virtualtext_single = get(g:,'ale_virtualtext_single',0)
let s:cursor_timer = get(s:, 'cursor_timer', -1)
let s:last_pos = get(s:, 'last_pos', [0, 0, 0])
let s:hl_list = get(s:, 'hl_list', [])
let s:last_message = ''
if !has_key(s:, 'has_virt_text')
let s:has_virt_text = 0
let s:emulate_virt = 0
let s:last_virt = -1
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')
let s:has_virt_text = 1
let s:emulate_virt = !has('patch-9.0.0297')
if s:emulate_virt
call prop_type_add('ale', {})
endif
endif
endfunction
function! ale#virtualtext#ShowMessage(message, hl_group, buf, line) abort
if !s:has_virt_text || !bufexists(str2nr(a:buf))
return
endif
let l:prefix = get(g:, 'ale_virtualtext_prefix', '> ')
let l:msg = l:prefix.trim(substitute(a:message, '\n', ' ', 'g'))
if has('nvim')
call nvim_buf_set_virtual_text(a:buf, s:ns_id, a:line-1, [[l:msg, a:hl_group]], {})
elseif s:emulate_virt
let l:left_pad = col('$')
call prop_add(a:line, l:left_pad, {
\ 'type': 'ale',
\})
let s:last_virt = popup_create(l:msg, {
\ 'line': -1,
\ 'padding': [0, 0, 0, 1],
\ 'mask': [[1, 1, 1, 1]],
\ 'textprop': 'ale',
\ 'highlight': a:hl_group,
\ 'fixed': 1,
\ 'wrap': 0,
\ 'zindex': 2
\})
else
let type = prop_type_get(a:hl_group)
if type == {}
call add(s:hl_list, a:hl_group)
call prop_type_add(a:hl_group, {'highlight': a:hl_group})
endif
call prop_add(a:line, 0, {
\ 'type': a:hl_group,
\ 'text': ' ' . l:msg,
\ 'bufnr': a:buf
\})
endif
endfunction
endif
function! s:StopCursorTimer() abort
if s:cursor_timer != -1
@ -93,65 +63,199 @@ function! s:StopCursorTimer() abort
endif
endfunction
function! ale#virtualtext#GetHlGroup(type, style) abort
if a:type is# 'E'
if a:style is# 'style'
return 'ALEVirtualTextStyleError'
else
return 'ALEVirtualTextError'
endif
elseif a:type is# 'W'
if a:style is# 'style'
return 'ALEVirtualTextStyleWarning'
else
return 'ALEVirtualTextWarning'
endif
function! ale#virtualtext#ResetDataForTests() abort
let s:last_pos = [0, 0, 0]
let s:last_message = ''
endfunction
function! ale#virtualtext#GetLastMessageForTests() abort
return s:last_message
endfunction
function! ale#virtualtext#GetComment(buffer) abort
let l:filetype = getbufvar(a:buffer, '&filetype')
let l:split = split(getbufvar(a:buffer, '&commentstring'), '%s')
return !empty(l:split) ? trim(l:split[0]) : '#'
endfunction
function! ale#virtualtext#Clear(buffer) abort
if !s:has_virt_text || !bufexists(str2nr(a:buffer))
return
endif
if has('nvim')
call nvim_buf_clear_namespace(a:buffer, s:ns_id, 0, -1)
else
return 'ALEVirtualTextInfo'
if s:emulate_virt && s:last_virt != -1
call prop_remove({'type': 'ale'})
call popup_close(s:last_virt)
let s:last_virt = -1
elseif !empty(s:hl_list)
call prop_remove({
\ 'types': s:hl_list,
\ 'all': 1,
\ 'bufnr': a:buffer,
\})
endif
endif
endfunction
function! ale#virtualtext#GetGroup(item) abort
let l:type = get(a:item, 'type', 'E')
let l:sub_type = get(a:item, 'sub_type', '')
if l:type is# 'E'
if l:sub_type is# 'style'
return 'ALEVirtualTextStyleError'
endif
return 'ALEVirtualTextError'
endif
if l:type is# 'W'
if l:sub_type is# 'style'
return 'ALEVirtualTextStyleWarning'
endif
return 'ALEVirtualTextWarning'
endif
return 'ALEVirtualTextInfo'
endfunction
function! ale#virtualtext#GetColumnPadding(buffer, line) abort
let l:mincol = ale#Var(a:buffer, 'virtualtext_column')
let l:maxcol = ale#Var(a:buffer, 'virtualtext_maxcolumn')
let l:win = bufwinnr(a:buffer)
if l:mincol[len(l:mincol)-1] is# '%'
let l:mincol = (winwidth(l:win) * l:mincol) / 100
endif
if l:maxcol[len(l:maxcol)-1] is# '%'
let l:maxcol = (winwidth(l:win) * l:maxcol) / 100
endif
" Calculate padding for virtualtext alignment
if l:mincol > 0 || l:maxcol > 0
let l:line_width = strdisplaywidth(getline(a:line))
if l:line_width < l:mincol
return l:mincol - l:line_width
elseif l:maxcol > 0 && l:line_width >= l:maxcol
" Stop processing if virtualtext would start beyond maxcol
return -1
endif
endif
" no padding.
return 0
endfunction
function! ale#virtualtext#ShowMessage(buffer, item) abort
if !s:has_virt_text || !bufexists(str2nr(a:buffer))
return
endif
let l:line = max([1, a:item.lnum])
let l:hl_group = ale#virtualtext#GetGroup(a:item)
" Get a language-appropriate comment character, or default to '#'.
let l:comment = ale#virtualtext#GetComment(a:buffer)
let l:prefix = ale#Var(a:buffer, 'virtualtext_prefix')
let l:prefix = ale#GetLocItemMessage(a:item, l:prefix)
let l:prefix = substitute(l:prefix, '\V%comment%', '\=l:comment', 'g')
let l:msg = l:prefix . substitute(a:item.text, '\n', ' ', 'g')
let l:col_pad = ale#virtualtext#GetColumnPadding(a:buffer, l:line)
" Store the last message we're going to set so we can read it in tests.
let s:last_message = l:msg
" Discard virtualtext if padding is negative.
if l:col_pad < 0
return
endif
if has('nvim')
call nvim_buf_set_virtual_text(
\ a:buffer,
\ s:ns_id, l:line - 1,
\ [[l:msg, l:hl_group]],
\ {}
\)
elseif s:emulate_virt
let l:left_pad = col('$')
call prop_add(l:line, l:left_pad, {'type': 'ale'})
let s:last_virt = popup_create(l:msg, {
\ 'line': -1,
\ 'padding': [0, 0, 0, 1],
\ 'mask': [[1, 1, 1, 1]],
\ 'textprop': 'ale',
\ 'highlight': l:hl_group,
\ 'fixed': 1,
\ 'wrap': 0,
\ 'zindex': 2
\})
else
let l:type = prop_type_get(l:hl_group)
if l:type == {}
call prop_type_add(l:hl_group, {'highlight': l:hl_group})
endif
" Add highlight groups to the list so we can clear them later.
if index(s:hl_list, l:hl_group) == -1
call add(s:hl_list, l:hl_group)
endif
" We ignore all errors from prop_add.
silent! call prop_add(l:line, 0, {
\ 'type': l:hl_group,
\ 'text': ' ' . l:msg,
\ 'bufnr': a:buffer,
\ 'text_padding_left': l:col_pad,
\})
endif
endfunction
function! ale#virtualtext#ShowCursorWarning(...) abort
if g:ale_virtualtext_cursor != 1
if g:ale_virtualtext_cursor isnot# 'current'
\&& g:ale_virtualtext_cursor != 1
return
endif
let l:buffer = bufnr('')
if mode(1) isnot# 'n'
\|| g:ale_use_neovim_diagnostics_api
\|| ale#ShouldDoNothing(l:buffer)
return
endif
if ale#ShouldDoNothing(l:buffer)
return
endif
let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer)
let [l:info, l:item] = ale#util#FindItemAtCursor(l:buffer)
call ale#virtualtext#Clear(l:buffer)
if !empty(l:loc)
let l:msg = l:loc.text
let l:type = get(l:loc, 'type', 'E')
let l:style = get(l:loc, 'sub_type', '')
let l:hl_group = ale#virtualtext#GetHlGroup(l:type, l:style)
call ale#virtualtext#ShowMessage(l:msg, l:hl_group, l:buffer, line('.'))
if !empty(l:item)
call ale#virtualtext#ShowMessage(l:buffer, l:item)
endif
endfunction
function! ale#virtualtext#ShowCursorWarningWithDelay() abort
let l:buffer = bufnr('')
if g:ale_virtualtext_cursor != 1
return
endif
if mode(1) isnot# 'n'
if g:ale_virtualtext_cursor isnot# 'current'
\&& g:ale_virtualtext_cursor != 1
return
endif
call s:StopCursorTimer()
if mode(1) isnot# 'n'
\|| g:ale_use_neovim_diagnostics_api
return
endif
let l:pos = getpos('.')[0:2]
" Check the current buffer, line, and column number against the last
@ -169,19 +273,24 @@ function! ale#virtualtext#ShowCursorWarningWithDelay() abort
endif
endfunction
function! ale#virtualtext#SetTexts(buf, loclist) abort
function! ale#virtualtext#SetTexts(buffer, loclist) abort
if !has('nvim') && s:emulate_virt
return
endif
call ale#virtualtext#Clear(a:buf)
call ale#virtualtext#Clear(a:buffer)
for l in a:loclist
if l['bufnr'] != a:buf
continue
let l:filter = ale#Var(a:buffer,'virtualtext_single')
let l:seen = {}
for l:item in a:loclist
if l:item.bufnr == a:buffer
let l:line = max([1, l:item.lnum])
if !has_key(l:seen,l:line) || l:filter == 0
call ale#virtualtext#ShowMessage(a:buffer, l:item)
let l:seen[l:line] = 1
endif
endif
let hl = ale#virtualtext#GetHlGroup(l['type'], get(l, 'sub_type', ''))
call ale#virtualtext#ShowMessage(l['text'], hl, a:buf, l['lnum'])
endfor
endfunction

View File

@ -21,5 +21,24 @@ g:ale_asm_gcc_options *g:ale_asm_gcc_options*
This variable can be set to pass additional options to gcc.
===============================================================================
llvm_mc *ale-asm-llvm_mc*
g:ale_asm_clang_executable *g:ale_asm_llvm_mc_executable*
*b:ale_asm_llvm_mc_executable*
Type: |String|
Default: `'llvm-mc'`
This variable can be changed to use a different executable for llvm-mc.
g:ale_asm_clang_options *g:ale_asm_llvm_mc_options*
*b:ale_asm_llvm_mc_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to llvm-mc.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -168,7 +168,7 @@ g:ale_c_cc_header_exts *g:ale_c_cc_header_exts*
considered as header files.
This variable is only used when `'-x c-header'` is used instead of `'-x c'`,
see |ale_c_cc_use_header_lang_flag|.
see |g:ale_c_cc_use_header_lang_flag|.
===============================================================================

View File

@ -97,7 +97,7 @@ g:ale_cpp_cc_header_exts *g:ale_cpp_cc_header_exts*
considered as header files.
This variable is only used when `'-x c++-header'` is used instead of `'-x c++'`,
see |ale_cpp_cc_use_header_lang_flag|.
see |g:ale_cpp_cc_use_header_lang_flag|.
===============================================================================

View File

@ -15,6 +15,7 @@ CONTENTS *ale-development-contents*
4.2. Writing Fixer Tests..............|ale-development-fixer-tests|
4.3. Running Tests in a Windows VM....|ale-development-windows-tests|
5. Contributing.........................|ale-development-contributing|
5.1. Preparing a Release..............|ale-development-release|
===============================================================================
1. Introduction *ale-development-introduction*
@ -154,7 +155,7 @@ ALE runs tests with the following versions of Vim in the following
environments.
1. Vim 8.0.0027 on Linux via GitHub Actions.
2. Vim 9.0.0133 on Linux via GitHub Actions.
2. Vim 9.0.0297 on Linux via GitHub Actions.
3. NeoVim 0.2.0 on Linux via GitHub Actions.
4. NeoVim 0.8.0 on Linux via GitHub Actions.
6. Vim 8 (stable builds) on Windows via AppVeyor.
@ -325,7 +326,6 @@ given the above setup are as follows.
`AssertLSPProject project_root` - Check the root given to an LSP server.
`AssertLSPAddress address` - Check the address to an LSP server.
===============================================================================
4.2 Writing Fixer Tests *ale-development-fixer-tests*
@ -367,7 +367,6 @@ given the above setup are as follows.
`AssertFixer results` - Check the fixer results
`AssertFixerNotExecuted` - Check that fixers will not be executed.
===============================================================================
4.3 Running Tests in a Windows VM *ale-development-windows-tests*
@ -462,5 +461,76 @@ and profile settings. See: https://docs.github.com/en/account-and-profile/
Unless configuring GitHub to expose contact details, commits will be rewritten
to appear by `USERNAME <RANDOM_NUMBER+USERNAME@users.noreply.github.com>` .
===============================================================================
5.1 Preparing a Release *ale-development-release*
ALE offers release packages through GitHub, for two reasons:
1. Some users like to target specific release versions rather than simply
installing the plugin from `master`. This includes users who create Linux
distribution specific packages from GitHub releases.
2. The releases provide a nice way to get an overview of what has changed in
ALE over time.
ALE has no fixed release schedule. Release versions are created whenever the
ALE developers feel the need to create one. ALE release versions follow the
typical Semantic Versioning scheme. See: https://semver.org/
Minor version releases for ALE should be the most common, followed by patch
releases. Every minor version release should be followed by a `vA.B.x` branch
such as `v2.0.x` for version `2.0.0` and every following patch version before
`2.1.0`. The `git` branch strategy for patches is to first merge a bug fix to
`master`, and then `git cherry-pick` a patch to a branch for a specific
version. ALE developers do not generally support anything but `master` or the
last minor version.
Generally ALE releases hit a major version only when there are breaking
changes to a public ALE setting or function. A "public" setting or function is
defined as any setting or function documented in the `:help` |ale| text file.
Major ALE versions ought to be so rare that they only come once a year at
most. ALE should not typically introduce any breaking changes.
If there are ever to be any breaking changes made for ALE, there should first
come a minor version release for ALE documenting all of the coming breaking
changes to ALE. It should be described how users can prepare for a breaking
change that is coming before it is done.
To create a release for ALE, you will need sufficient permissions in GitHub.
Once you do, follow these steps.
1. Create a new release draft, or edit an existing one. It helps to craft
drafts ahead of time and write the last commit ID checked for release notes
on the last update to a draft.
See the releases page: https://github.com/dense-analysis/ale/releases
2. Examine `git log` and read changes made between the last ID checked, or the
git tag of the previous release, and the current commit in `master`.
3. Write updates in separate sections (except where empty) for:
3.a. Breaking Changes
3.b. Deprecated Features
3.c. New Features
3.d. New Linters
3.e. New Fixers
3.f. Linter Enhancements
3.g. Fixer Enhancements
3.h. Bugs Fixed
4. Once you've finished writing the draft for the release, bump
`s:current_ale_version` in `autoload/ale.vim` to the current version, and
add a line to `test/test_ale_has.vader` to test for the version. See
|ale#Has()| documentation for more information.
5. Commit the changes after `./run-tests --fast -q` passes.
6. Tag the release with `git tag vA.B.C`, replacing `A`, `B`, and `C` with the
version numbers. See `git tag --list` for examples.
7. Run `git push` and `git push --tags` to push the commit and the tag.
8. Edit the release draft in GitHub, select the tag you just pushed, and
publish the draft.
9. If you're creating a new major or minor version: `git checkout -b vA.B.x`,
replacing `A` and `B` with the major and minor versions. `git push` the new
branch, and the GitHub branch protection settings should automatically
apply to the new release branch.
10. You have already completed the last step.
Have fun creating ALE releases. Drink responsibly, or not at all, which is the
preference of w0rp.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -269,6 +269,21 @@ g:ale_go_gopls_options *g:ale_go_gopls_options*
Command-line options passed to the gopls executable. See `gopls -h`.
g:ale_go_gopls_fix_executable *g:ale_go_gopls_fix_executable*
*b:ale_go_gopls_fix_executable*
Type: |String|
Default: `'gopls'`
Executable to run to use as the gopls fixer.
g:ale_go_gopls_fix_options *g:ale_go_gopls_fix_options*
*b:ale_go_gopls_fix_options*
Type: |String|
Default: `''`
Options to pass to the gopls fixer.
g:ale_go_gopls_init_options *g:ale_go_gopls_init_options*
*b:ale_go_gopls_init_options*
Type: |Dictionary|

View File

@ -102,6 +102,25 @@ prettier *ale-html-prettier*
See |ale-javascript-prettier| for information about the available options.
===============================================================================
rustywind *ale-html-rustywind*
g:ale_html_rustywind_executable *g:ale_html_rustywind_executable*
*b:ale_html_rustywind_executable*
Type: |String|
Default: `'rustywind'`
See |ale-integrations-local-executables|
g:ale_html_rustywind_options *g:ale_html_rustywind_options*
*b:ale_html_rustywind_options*
Type: |String|
Default: `''`
This variable can be changed to modify flags given to rustywind.
===============================================================================
stylelint *ale-html-stylelint*

View File

@ -27,6 +27,30 @@ g:ale_lua_lua_format_options *g:ale_lua_lua_format_options*
This variable can be set to pass additional options to lua-format.
===============================================================================
lua-language-server *ale-lua-lua-language-server*
*ale-lua-language-server*
g:ale_lua_language_server_executable *g:ale_lua_language_server_executable*
*b:ale_lua_language_server_executable*
Type: |String|
Default: `'lua-language-server'`
This variable can be changed to set the path to lua-language-server.
If you have compiled the language server yourself in `/some/path`, the path
will be `'/some/path/bin/lua-language-server'`.
g:ale_lua_lua_language_server_config *g:ale_lua_lua_language_server_config*
*b:ale_lua_lua_language_server_config*
Type: |Dictionary|
Default: `{}`
Dictionary containing configuration settings that will be passed to the
language server.
===============================================================================
luac *ale-lua-luac*

View File

@ -17,13 +17,13 @@ See |ale-dprint-options| and https://dprint.dev/plugins/markdown
===============================================================================
markdownlint *ale-markdown-markdownlint*
g:ale_markdown_markdown_executable *g:ale_markdown_markdownlint_executable*
g:ale_markdown_markdownlint_executable *g:ale_markdown_markdownlint_executable*
*b:ale_markdown_markdownlint_executable*
Type: |String|
Default: `'markdownlint'`
Override the invoked markdownlint binary. You can use other binaries such as
markdownlint-cli2.
Override the invoked `markdownlint` binary. You can use other binaries such as
`markdownlint-cli2`.
g:ale_markdown_markdownlint_options *g:ale_markdown_markdownlint_options*

View File

@ -2,6 +2,24 @@
ALE Nix Integration *ale-nix-options*
===============================================================================
alejandra *ale-nix-alejandra*
g:ale_nix_alejandra_executable *g:ale_nix_alejandra_executable*
*b:ale_nix_alejandra_executable*
Type: |String|
Default: `'alejandra'`
This variable sets the executable used for alejandra.
g:ale_nix_alejandra_options *g:ale_nix_alejandra_options*
*b:ale_nix_alejandra_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to the alejandra fixer.
===============================================================================
nixfmt *ale-nix-nixfmt*
@ -75,5 +93,23 @@ g:ale_nix_statix_fix_options *g:ale_nix_statix_fix_options*
it as a fixer.
===============================================================================
deadnix *ale-nix-deadnix*
g:ale_nix_deadnix_executable *g:ale_nix_deadnix_executable*
*b:ale_nix_deadnix_executable*
Type: |String|
Default: `'deadnix'`
This variable sets the executable used for deadnix.
g:ale_nix_deadnix_options *g:ale_nix_deadnix_options*
*b:ale_nix_deadnix_options*
Type: |String|
Default: `''`
This variable can be used to pass additional options to deadnix.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -20,6 +20,17 @@ g:ale_python_auto_poetry *g:ale_python_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_auto_virtualenv *g:ale_python_auto_virtualenv*
*b:ale_python_auto_virtualenv*
Type: |Number|
Default: `0`
If set to `1`, ALE will automatically set environment variables for commands
such as `PATH` to attempt to make the experience of running Python linters
via virtualenv easier, without the need for another plugin or some
specialised setup.
===============================================================================
ALE Python Project Root Behavior *ale-python-root*
@ -88,24 +99,24 @@ g:ale_python_autoflake_use_global *g:ale_python_autoflake_use_global*
===============================================================================
autoimport *ale-python-autoimport*
g:ale_python_autoimport_executable *g:ale_python_autoimport_executable*
*b:ale_python_autoimport_executable*
g:ale_python_autoimport_executable *g:ale_python_autoimport_executable*
*b:ale_python_autoimport_executable*
Type: |String|
Default: `'autoimport'`
See |ale-integrations-local-executables|
g:ale_python_autoimport_options *g:ale_python_autoimport_options*
*b:ale_python_autoimport_options*
g:ale_python_autoimport_options *g:ale_python_autoimport_options*
*b:ale_python_autoimport_options*
Type: |String|
Default: `''`
This variable can be set to pass extra options to autoimport.
g:ale_python_autoimport_use_global *g:ale_python_autoimport_use_global*
*b:ale_python_autoimport_use_global*
g:ale_python_autoimport_use_global *g:ale_python_autoimport_use_global*
*b:ale_python_autoimport_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
@ -338,7 +349,7 @@ g:ale_python_flake8_auto_poetry *g:ale_python_flake8_auto_poetry*
flakehell *ale-python-flakehell*
g:ale_python_flakehell_change_directory*g:ale_python_flakehell_change_directory*
*b:ale_python_flakehell_change_directory*
*b:ale_python_flakehell_change_directory*
Type: |String|
Default: `project`
@ -349,8 +360,8 @@ g:ale_python_flakehell_change_directory*g:ale_python_flakehell_change_directory*
Python is executed from yourself.
g:ale_python_flakehell_executable *g:ale_python_flakehell_executable*
*b:ale_python_flakehell_executable*
g:ale_python_flakehell_executable *g:ale_python_flakehell_executable*
*b:ale_python_flakehell_executable*
Type: |String|
Default: `'flakehell'`
@ -360,8 +371,8 @@ g:ale_python_flakehell_executable *g:ale_python_flakehell_executable*
invoke `'python` `-m` `flakehell'`.
g:ale_python_flakehell_options *g:ale_python_flakehell_options*
*b:ale_python_flakehell_options*
g:ale_python_flakehell_options *g:ale_python_flakehell_options*
*b:ale_python_flakehell_options*
Type: |String|
Default: `''`
@ -369,8 +380,8 @@ g:ale_python_flakehell_options *g:ale_python_flakehell_options*
lint invocation.
g:ale_python_flakehell_use_global *g:ale_python_flakehell_use_global*
*b:ale_python_flakehell_use_global*
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)`
@ -381,8 +392,8 @@ g:ale_python_flakehell_use_global *g:ale_python_flakehell_use_global*
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*
g:ale_python_flakehell_auto_pipenv *g:ale_python_flakehell_auto_pipenv*
*b:ale_python_flakehell_auto_pipenv*
Type: |Number|
Default: `0`
@ -580,6 +591,78 @@ g:ale_python_prospector_auto_poetry *g:ale_python_prospector_auto_poetry*
if true. This is overridden by a manually-set executable.
===============================================================================
pycln *ale-python-pycln*
g:ale_python_pycln_change_directory *g:ale_python_pycln_change_directory*
*b:ale_python_pycln_change_directory*
Type: |Number|
Default: `1`
If set to `1`, `pycln` will be run from a detected project root, per
|ale-python-root|. if set to `0` or no project root detected,
`pycln` will be run from the buffer's directory.
g:ale_python_pycln_executable *g:ale_python_pycln_executable*
*b:ale_python_pycln_executable*
Type: |String|
Default: `'pycln'`
See |ale-integrations-local-executables|
Set this to `'pipenv'` to invoke `'pipenv` `run` `pycln'`.
Set this to `'poetry'` to invoke `'poetry` `run` `pycln'`.
g:ale_python_pycln_options *g:ale_python_pycln_options*
*b:ale_python_pycln_options*
Type: |String|
Default: `''`
This variable can be changed to add command-line arguments to the pycln
invocation.
For example, to select/enable and/or disable some error codes,
you may want to set >
let g:ale_python_pycln_options = '--expand-stars'
g:ale_python_pycln_config_file *g:ale_python_pycln_config_file*
*b:ale_python_pycln_config_file*
Type: |String|
Default: `''`
Use this variable to set the configuration file.
If `'--config' ` is found in the |g:ale_python_pycln_options|, then that
option value will override the value in this variable.
g:ale_python_pycln_use_global *g:ale_python_pycln_use_global*
*b:ale_python_pycln_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
g:ale_python_pycln_auto_pipenv *g:ale_python_pycln_auto_pipenv*
*b:ale_python_pycln_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_pycln_auto_poetry *g:ale_python_pycln_auto_poetry*
*b:ale_python_pycln_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.
===============================================================================
pycodestyle *ale-python-pycodestyle*
@ -903,13 +986,13 @@ g:ale_python_pylint_use_msg_id *g:ale_python_pylint_use_msg_id*
===============================================================================
pylsp *ale-python-pylsp*
pylsp *ale-python-pylsp*
`pylsp` will be run from a detected project root, per |ale-python-root|.
g:ale_python_pylsp_executable *g:ale_python_pylsp_executable*
*b:ale_python_pylsp_executable*
g:ale_python_pylsp_executable *g:ale_python_pylsp_executable*
*b:ale_python_pylsp_executable*
Type: |String|
Default: `'pylsp'`
@ -919,16 +1002,16 @@ g:ale_python_pylsp_executable *g:ale_python_pylsp_executable
Set this to `'poetry'` to invoke `'poetry` `run` `pyls'`.
g:ale_python_pylsp_use_global *g:ale_python_pylsp_use_global*
*b:ale_python_pylsp_use_global*
g:ale_python_pylsp_use_global *g:ale_python_pylsp_use_global*
*b:ale_python_pylsp_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
g:ale_python_pylsp_auto_pipenv *g:ale_python_pylsp_auto_pipenv*
*b:ale_python_pylsp_auto_pipenv*
g:ale_python_pylsp_auto_pipenv *g:ale_python_pylsp_auto_pipenv*
*b:ale_python_pylsp_auto_pipenv*
Type: |Number|
Default: `0`
@ -936,8 +1019,8 @@ g:ale_python_pylsp_auto_pipenv *g:ale_python_pylsp_auto_pipenv
if true. This is overridden by a manually-set executable.
g:ale_python_pylsp_auto_poetry *g:ale_python_pylsp_auto_poetry*
*b:ale_python_pylsp_auto_poetry*
g:ale_python_pylsp_auto_poetry *g:ale_python_pylsp_auto_poetry*
*b:ale_python_pylsp_auto_poetry*
Type: |Number|
Default: `0`
@ -945,8 +1028,8 @@ g:ale_python_pylsp_auto_poetry *g:ale_python_pylsp_auto_poetry
if true. This is overridden by a manually-set executable.
g:ale_python_pylsp_config *g:ale_python_pylsp_config*
*b:ale_python_pylsp_config*
g:ale_python_pylsp_config *g:ale_python_pylsp_config*
*b:ale_python_pylsp_config*
Type: |Dictionary|
Default: `{}`
@ -963,8 +1046,8 @@ g:ale_python_pylsp_config *g:ale_python_pylsp_config
\ }
<
g:ale_python_pylsp_options *g:ale_python_pylsp_options*
*b:ale_python_pylsp_options*
g:ale_python_pylsp_options *g:ale_python_pylsp_options*
*b:ale_python_pylsp_options*
Type: |String|
Default: `''`
@ -1085,6 +1168,67 @@ g:ale_python_pyright_config *g:ale_python_pyright_config*
\}
<
===============================================================================
refurb *ale-python-refurb*
g:ale_python_refurb_change_directory *g:ale_python_refurb_change_directory*
*b:ale_python_refurb_change_directory*
Type: |Number|
Default: `1`
If set to `1`, `refurb` will be run from a detected project root, per
|ale-python-root|. if set to `0` or no project root detected,
`refurb` will be run from the buffer's directory.
g:ale_python_refurb_executable *g:ale_python_refurb_executable*
*b:ale_python_refurb_executable*
Type: |String|
Default: `'refurb'`
See |ale-integrations-local-executables|
Set this to `'pipenv'` to invoke `'pipenv` `run` `refurb'`.
Set this to `'poetry'` to invoke `'poetry` `run` `refurb'`.
g:ale_python_refurb_options *g:ale_python_refurb_options*
*b:ale_python_refurb_options*
Type: |String|
Default: `''`
This variable can be changed to add command-line arguments to the refurb
invocation.
For example, to select/enable and/or disable some error codes,
you may want to set >
let g:ale_python_refurb_options = '--ignore 100'
g:ale_python_refurb_use_global *g:ale_python_refurb_use_global*
*b:ale_python_refurb_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
g:ale_python_refurb_auto_pipenv *g:ale_python_refurb_auto_pipenv*
*b:ale_python_refurb_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_refurb_auto_poetry *g:ale_python_refurb_auto_poetry*
*b:ale_python_refurb_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.
===============================================================================
reorder-python-imports *ale-python-reorder_python_imports*
@ -1202,8 +1346,8 @@ g:ale_python_unimport_auto_poetry *g:ale_python_unimport_auto_poetry*
if true. This is overridden by a manually-set executable.
g:ale_python_unimport_executable *g:ale_python_unimport_executable*
*b:ale_python_unimport_executable*
g:ale_python_unimport_executable *g:ale_python_unimport_executable*
*b:ale_python_unimport_executable*
Type: |String|
Default: `'unimport'`
@ -1213,8 +1357,8 @@ g:ale_python_unimport_executable *g:ale_python_unimport_executable*
Set this to `'poetry'` to invoke `'poetry` `run` `unimport'`.
g:ale_python_unimport_options *g:ale_python_unimport_options*
*b:ale_python_unimport_options*
g:ale_python_unimport_options *g:ale_python_unimport_options*
*b:ale_python_unimport_options*
Type: |String|
Default: `''`
@ -1222,8 +1366,8 @@ g:ale_python_unimport_options *g:ale_python_unimport_options*
invocation.
g:ale_python_unimport_use_global *g:ale_python_unimport_use_global*
*b:ale_python_unimport_use_global*
g:ale_python_unimport_use_global *g:ale_python_unimport_use_global*
*b:ale_python_unimport_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`

View File

@ -0,0 +1,41 @@
===============================================================================
ALE Racket Integration *ale-racket-options*
===============================================================================
racket_langserver *ale-racket-langserver*
1. Install racket-langserver as described here:
https://github.com/jeapostrophe/racket-langserver
2. Have `racket` available in the `$PATH` environment variable, currently there
is no way to specify path to custom location of `racket`.
3. set `racket_langserver` as a linter for `racket` like: >
let g:ale_linters['racket'] += ['racket_langserver']
You should be able to see linter results and use LSP features of `ALE` like
`ALEGoToDefinition` with `racket-langserver`.
===============================================================================
raco_fmt *ale-racket-raco-fmt*
g:ale_racket_raco_fmt_executable *g:ale_racket_raco_fmt_executable*
*b:ale_racket_raco_fmt_executable*
Type: |String|
Default: `'raco'`
If the `raco` excutable is not in the `$PATH` environment variable, or you
prefer to use one installed in a custom location, set this option to the
path to the specific `raco` executable.
g:ale_racket_raco_fmt_options *g:ale_racket_raco_fmt_options*
*b:ale_racket_raco_fmt_options*
Type: |String|
Default: `''`
Use this variable to pass command-line flags/parameters to `raco_fmt`
For example, set the page width limit to 40 >
let g:ale_racket_raco_fmt_options = '--width 40'
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -36,6 +36,7 @@ Notes:
* `write-good`
* ASM
* `gcc`
* `llvm-mc`
* AVRA
* `avra`
* Awk
@ -255,11 +256,13 @@ Notes:
* `alex`
* `angular`
* `cspell`
* `eslint`
* `fecs`
* `html-beautify`
* `htmlhint`
* `prettier`
* `proselint`
* `rustywind`
* `tidy`
* `write-good`
* Idris
@ -340,6 +343,7 @@ Notes:
* Lua
* `cspell`
* `lua-format`
* `lua-language-server`
* `luac`
* `luacheck`
* `luafmt`
@ -377,6 +381,7 @@ Notes:
* `nimlsp`
* `nimpretty`
* nix
* `alejandra`
* `nix-instantiate`
* `nixfmt`
* `nixpkgs-fmt`
@ -481,6 +486,7 @@ Notes:
* `isort`
* `mypy`
* `prospector`!!
* `pycln`
* `pycodestyle`
* `pydocstyle`
* `pyflakes`
@ -490,6 +496,7 @@ Notes:
* `pylsp`
* `pyre`
* `pyright`
* `refurb`
* `reorder-python-imports`
* ruff
* `unimport`

View File

@ -17,7 +17,7 @@ CONTENTS *ale-contents*
5.1 Completion........................|ale-completion|
5.2 Go To Definition..................|ale-go-to-definition|
5.3 Go To Type Definition.............|ale-go-to-type-definition|
5.4 Go To Implementation..............|ale-go-to-type-implementation|
5.4 Go To Implementation..............|ale-go-to-implementation|
5.5 Find References...................|ale-find-references|
5.6 Hovering..........................|ale-hover|
5.7 Symbol Search.....................|ale-symbol-search|
@ -121,6 +121,7 @@ circumstances.
ALE will report problems with your code in the following ways, listed with
their relevant options.
* Via the Neovim diagnostics API (Off by default) - |g:ale_use_neovim_diagnostics_api|
* By updating loclist. (On by default) - |g:ale_set_loclist|
* By updating quickfix. (Off by default) - |g:ale_set_quickfix|
* By setting error highlights. - |g:ale_set_highlights|
@ -1063,7 +1064,8 @@ g:ale_echo_msg_format *g:ale_echo_msg_format*
`%s` - replaced with the text for the problem
`%...code...% `- replaced with the error code
`%linter%` - replaced with the name of the linter
`%severity%` - replaced with the severity of the problem
`%severity%` - replaced with the severity of the problem (e.g. `Error`)
`%type%` - replaced with the type of the problem (e.g. `E`)
The strings for `%severity%` can be configured with the following options.
@ -1234,7 +1236,7 @@ g:ale_floating_preview *g:ale_floating_preview*
|g:ale_detail_to_floating_preview| to `1`.
g:ale_floating_preview_popup_opts *g:ale_floating_preview_popup_opts*
g:ale_floating_preview_popup_opts *g:ale_floating_preview_popup_opts*
Type: |String| or |Dictionary|
Default: `''`
@ -1250,14 +1252,16 @@ g:ale_floating_preview_popup_opts *g:ale_floating_preview_popup_opts
For example, to enhance popups with a title: >
function! CustomOpts() abort {
function! CustomOpts() abort
let [l:info, l:loc] = ale#util#FindItemAtCursor(bufnr(''))
return {'title': ' ALE: ' . (l:loc.linter_name) . ' '}
endfunction
let g:ale_floating_preview_popup_opts = 'g:CustomOpts'
<
g:ale_floating_window_border *g:ale_floating_window_border*
g:ale_floating_window_border *g:ale_floating_window_border*
Type: |List|
Default: `['|', '-', '+', '+', '+', '+', '|', '-']`
@ -1647,7 +1651,7 @@ g:ale_linters *g:ale_linters*
\ 'jsonc': [],
\ 'perl': ['perlcritic'],
\ 'perl6': [],
\ 'python': ['flake8', 'mypy', 'pylint', 'pyright'],
\ 'python': ['flake8', 'mypy', 'pylint', 'pyright', 'ruff'],
\ 'rust': ['cargo', 'rls'],
\ 'spec': [],
\ 'text': [],
@ -2287,23 +2291,41 @@ g:ale_use_global_executables *g:ale_use_global_executables*
options.
g:ale_virtualtext_cursor *g:ale_virtualtext_cursor*
g:ale_use_neovim_diagnostics_api *g:ale_use_neovim_diagnostics_api*
Type: |Number|
Default: `0`
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
contains a warning or error. This option can be set to `0` to disable this
behavior.
When this option is set to `2`, then all warnings will be shown for the
whole buffer, regardless of if the cursor is currently positioned in that
line.
If enabled, this option will disable ALE's standard UI, and instead send
all linter output to Neovim's diagnostics API. This allows you to collect
errors from nvim-lsp, ALE, and anything else that uses diagnostics all in
one place. The following options are ignored when using the diagnostics API:
- |g:ale_set_highlights|
- |g:ale_set_signs|
- |g:ale_virtualtext_cursor|
To enable this option, set the value to `1`.
This option requires Neovim 0.6+, as that version introduces the diagnostics
API.
g:ale_virtualtext_cursor *g:ale_virtualtext_cursor*
Type: |Number|
Default: `'all'` (if supported, otherwise `'disabled'`)
This option controls how ALE will display problems using |virtual-text|.
The following values can be used.
`'all'`, `'2'`, or `2` - Show problems for all lines.
`'current'`, `'1'`, or `1` - Show problems for the current line.
`'disabled'`, `'0'`, or `0` - Do not show problems with virtual-text.
Messages are only displayed after a short delay. See |g:ale_virtualtext_delay|.
Messages can be prefixed prefixed with a string. See |g:ale_virtualtext_prefix|.
Messages can be prefixed with a string. See |g:ale_virtualtext_prefix|.
ALE will use the following highlight groups for problems:
@ -2316,7 +2338,6 @@ g:ale_virtualtext_cursor *g:ale_virtualtext_cursor*
g:ale_virtualtext_delay *g:ale_virtualtext_delay*
*b:ale_virtualtext_delay*
Type: |Number|
Default: `10`
@ -2328,12 +2349,58 @@ g:ale_virtualtext_delay *g:ale_virtualtext_delay*
g:ale_virtualtext_prefix *g:ale_virtualtext_prefix*
*b:ale_virtualtext_prefix*
Type: |String|
Default: `'> '`
Default: `'%comment% %type%: '`
Prefix to be used with |g:ale_virtualtext_cursor|.
This setting can be changed in each buffer with `b:ale_virtualtext_prefix`.
All of the same format markers used for |g:ale_echo_msg_format| can be used
for defining the prefix, including some additional sequences of characters.
`%comment%` - replaced with comment characters in the current language
ALE will read the comment characters from |&commentstring|, reading only the
part before `%s`, with whitespace trimmed. If comment syntax cannot be
pulled from |&commentstring|, ALE will default to `'#'`.
g:ale_virtualtext_column *g:ale_virtualtext_column*
*b:ale_virtualtext_column*
g:ale_virtualtext_maxcolumn *g:ale_virtualtext_maxcolumn*
*b:ale_virtualtext_maxcolumn*
Type: |String| or |Number|
Default: `0`
Virtualtext column range, from `column` to `maxcolumn`. If a line is
`column` or less characters long, the virtualtext message is shifted right
to `column`.
Where the line is greater than `column` characters long, but less than
`maxcolumn`, the virtualtext message is placed at the end of the line.
Where the line is greater than `maxcolumn` the virtualtext message is
omitted.
A |Number| greater than `0` is used as the fixed column position, however
a |String| ending in `%` represents a percentage of the window width.
When `column` is set to zero, column positioning is disabled, when `maxcolumn`
is set to zero, no maximum line length is enforced.
g:ale_virtualtext_single *g:ale_virtualtext_single*
*b:ale_virtualtext_single*
Type: |Number|
Default: `0`
Enable or disable concatenation of multiple virtualtext messages on a single
line. By default, if a line has multiple errors or warnings, each will be
appended in turn.
With `single` set to a non-zero value, only the first message appears.
(No attempt is made to prefer message types such as errors over warnings)
g:ale_virtualenv_dir_names *g:ale_virtualenv_dir_names*
*b:ale_virtualenv_dir_names*
@ -2510,7 +2577,7 @@ ALEStyleWarningSignLineNr *ALEStyleWarningSignLineNr*
ALEVirtualTextError *ALEVirtualTextError*
Default: `highlight link ALEVirtualTextError ALEError`
Default: `highlight link ALEVirtualTextError Comment`
The highlight for virtualtext errors. See |g:ale_virtualtext_cursor|.
@ -2538,7 +2605,7 @@ ALEVirtualTextStyleWarning *ALEVirtualTextStyleWarning*
ALEVirtualTextWarning *ALEVirtualTextWarning*
Default: `highlight link ALEVirtualTextWarning ALEWarning`
Default: `highlight link ALEVirtualTextWarning Comment`
The highlight for virtualtext errors. See |g:ale_virtualtext_cursor|.
@ -2778,6 +2845,7 @@ documented in additional help files.
textlint..............................|ale-asciidoc-textlint|
asm.....................................|ale-asm-options|
gcc...................................|ale-asm-gcc|
llvm_mc...............................|ale-asm-llvm_mc|
avra....................................|ale-avra-options|
avra..................................|ale-avra-avra|
awk.....................................|ale-awk-options|
@ -2962,6 +3030,7 @@ documented in additional help files.
html-beautify.........................|ale-html-beautify|
htmlhint..............................|ale-html-htmlhint|
prettier..............................|ale-html-prettier|
rustywind.............................|ale-html-rustywind|
stylelint.............................|ale-html-stylelint|
tidy..................................|ale-html-tidy|
vscodehtml............................|ale-html-vscode|
@ -3037,6 +3106,7 @@ documented in additional help files.
lua.....................................|ale-lua-options|
cspell................................|ale-lua-cspell|
lua-format............................|ale-lua-lua-format|
lua-language-server...................|ale-lua-lua-language-server|
luac..................................|ale-lua-luac|
luacheck..............................|ale-lua-luacheck|
luafmt................................|ale-lua-luafmt|
@ -3063,9 +3133,11 @@ documented in additional help files.
nimlsp................................|ale-nim-nimlsp|
nimpretty.............................|ale-nim-nimpretty|
nix.....................................|ale-nix-options|
alejandra.............................|ale-nix-alejandra|
nixfmt................................|ale-nix-nixfmt|
nixpkgs-fmt...........................|ale-nix-nixpkgs-fmt|
statix................................|ale-nix-statix|
deadnix...............................|ale-nix-deadnix|
nroff...................................|ale-nroff-options|
write-good............................|ale-nroff-write-good|
objc....................................|ale-objc-options|
@ -3159,6 +3231,7 @@ documented in additional help files.
isort.................................|ale-python-isort|
mypy..................................|ale-python-mypy|
prospector............................|ale-python-prospector|
pycln.................................|ale-python-pycln|
pycodestyle...........................|ale-python-pycodestyle|
pydocstyle............................|ale-python-pydocstyle|
pyflakes..............................|ale-python-pyflakes|
@ -3168,6 +3241,7 @@ documented in additional help files.
pylsp.................................|ale-python-pylsp|
pyre..................................|ale-python-pyre|
pyright...............................|ale-python-pyright|
refurb................................|ale-python-refurb|
reorder-python-imports................|ale-python-reorder_python_imports|
ruff..................................|ale-python-ruff|
unimport..............................|ale-python-unimport|
@ -3179,6 +3253,9 @@ documented in additional help files.
languageserver........................|ale-r-languageserver|
lintr.................................|ale-r-lintr|
styler................................|ale-r-styler|
racket..................................|ale-racket-options|
racket_langserver.....................|ale-racket-langserver|
raco_fmt..............................|ale-racket-raco-fmt|
reasonml................................|ale-reasonml-options|
merlin................................|ale-reasonml-merlin|
ols...................................|ale-reasonml-ols|

View File

@ -0,0 +1,49 @@
local module = {}
local ale_type_to_diagnostic_severity = {
E = vim.diagnostic.severity.ERROR,
W = vim.diagnostic.severity.WARN,
I = vim.diagnostic.severity.INFO
}
module.sendAleResultsToDiagnostics = function(buffer, loclist)
local diagnostics = {}
-- Convert all the ALE loclist items to the shape that Neovim's diagnostic
-- API is expecting.
for _, location in ipairs(loclist) do
table.insert(
diagnostics,
-- All line numbers from ALE are 1-indexed, but all line numbers
-- in the diagnostics API are 0-indexed, so we have to subtract 1
-- to make this work.
{
lnum = location.lnum - 1,
-- Ending line number, or if we don't have one, just make it the same
-- as the starting line number
end_lnum = (location.end_lnum or location.lnum) - 1,
-- Which column does the error start on?
col = math.max((location.col or 1) - 1, 0),
-- end_col does *not* appear to need 1 subtracted, so we don't.
end_col = location.end_col,
-- Which severity: error, warning, or info?
severity = ale_type_to_diagnostic_severity[location.type] or "E",
-- The error message
message = location.text,
-- e.g. "rubocop"
source = location.linter_name,
}
)
end
local virtualtext_enabled_set = {['all'] = true, ['2'] = true, [2] = true, ['current'] = true, ['1'] = true, [1] = true}
vim.diagnostic.set(
vim.api.nvim_create_namespace('ale'),
buffer,
diagnostics,
{ virtual_text = virtualtext_enabled_set[vim.g.ale_virtualtext_cursor] ~= nil}
)
end
return module

View File

@ -127,8 +127,8 @@ let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1)
" This flag can be set to 1 to automatically show errors in the preview window.
let g:ale_cursor_detail = get(g:, 'ale_cursor_detail', 0)
" This flag can be set to 1 to enable virtual text when the cursor moves.
let g:ale_virtualtext_cursor = get(g:, 'ale_virtualtext_cursor', 0)
" This flag can be changed to disable/enable virtual text.
let g:ale_virtualtext_cursor = get(g:, 'ale_virtualtext_cursor', (has('nvim-0.3.2') || has('patch-9.0.0297') && has('textprop') && has('popupwin')) ? 'all' : 'disabled')
" This flag can be set to 1 to enable LSP hover messages at the cursor.
let g:ale_hover_cursor = get(g:, 'ale_hover_cursor', 1)
@ -178,6 +178,10 @@ let g:ale_python_auto_pipenv = get(g:, 'ale_python_auto_pipenv', 0)
" Enable automatic detection of poetry for Python linters.
let g:ale_python_auto_poetry = get(g:, 'ale_python_auto_poetry', 0)
" Enable automatic adjustment of environment variables for Python linters.
" The variables are set based on ALE's virtualenv detection.
let g:ale_python_auto_virtualenv = get(g:, 'ale_python_auto_virtualenv', 0)
" This variable can be overridden to set the GO111MODULE environment variable.
let g:ale_go_go111module = get(g:, 'ale_go_go111module', '')
@ -187,6 +191,15 @@ let g:ale_deno_executable = get(g:, 'ale_deno_executable', 'deno')
" If 1, enable a popup menu for commands.
let g:ale_popup_menu_enabled = get(g:, 'ale_popup_menu_enabled', has('gui_running'))
" If 1, disables ALE's built in error display. Instead, all errors are piped
" to the diagnostics API.
let g:ale_use_neovim_diagnostics_api = get(g:, 'ale_use_neovim_diagnostics_api', 0)
if g:ale_use_neovim_diagnostics_api && !has('nvim-0.6')
" no-custom-checks
echoerr('Setting g:ale_use_neovim_diagnostics_api to 1 requires Neovim 0.6+.')
endif
if g:ale_set_balloons is 1 || g:ale_set_balloons is# 'hover'
call ale#balloon#Enable()
endif

View File

@ -45,6 +45,7 @@ formatting.
* [write-good](https://github.com/btford/write-good)
* ASM
* [gcc](https://gcc.gnu.org)
* [llvm-mc](https://llvm.org)
* AVRA
* [avra](https://github.com/Ro5bert/avra)
* Awk
@ -264,11 +265,13 @@ formatting.
* [alex](https://github.com/get-alex/alex)
* [angular](https://www.npmjs.com/package/@angular/language-server)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
* [eslint](https://github.com/BenoitZugmeyer/eslint-plugin-html)
* [fecs](http://fecs.baidu.com/)
* [html-beautify](https://beautifier.io/)
* [htmlhint](http://htmlhint.com/)
* [prettier](https://github.com/prettier/prettier)
* [proselint](http://proselint.com/)
* [rustywind](https://github.com/avencera/rustywind)
* [tidy](http://www.html-tidy.org/)
* [write-good](https://github.com/btford/write-good)
* Idris
@ -349,6 +352,7 @@ formatting.
* Lua
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
* [lua-format](https://github.com/Koihik/LuaFormatter)
* [lua-language-server](https://github.com/LuaLS/lua-language-server)
* [luac](https://www.lua.org/manual/5.1/luac.html)
* [luacheck](https://github.com/mpeterv/luacheck)
* [luafmt](https://github.com/trixnz/lua-fmt)
@ -386,6 +390,7 @@ formatting.
* [nimlsp](https://github.com/PMunch/nimlsp)
* nimpretty
* nix
* [alejandra](https://github.com/kamadorueda/alejandra)
* [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate)
* [nixfmt](https://github.com/serokell/nixfmt)
* [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt)
@ -490,6 +495,7 @@ formatting.
* [isort](https://github.com/timothycrosley/isort)
* [mypy](http://mypy-lang.org/)
* [prospector](https://github.com/PyCQA/prospector) :warning: :floppy_disk:
* [pycln](https://github.com/hadialqattan/pycln)
* [pycodestyle](https://github.com/PyCQA/pycodestyle) :warning:
* [pydocstyle](https://www.pydocstyle.org/) :warning:
* [pyflakes](https://github.com/PyCQA/pyflakes)
@ -499,6 +505,7 @@ formatting.
* [pylsp](https://github.com/python-lsp/python-lsp-server) :warning:
* [pyre](https://github.com/facebook/pyre-check) :warning:
* [pyright](https://github.com/microsoft/pyright)
* [refurb](https://github.com/dosisod/refurb) :floppy_disk:
* [reorder-python-imports](https://github.com/asottile/reorder_python_imports)
* [ruff](https://github.com/charliermarsh/ruff)
* [unimport](https://github.com/hakancelik96/unimport)

View File

@ -69,7 +69,7 @@ This plugin can also be found at http://www.vim.org/scripts/script.php?script_id
git clone https://github.com/jlanzarotta/bufexplorer.git ~/.vim/bundle/bufexplorer.vim
## License
Copyright (c) 2001-2022, Jeff Lanzarotta
Copyright (c) 2001-2023, Jeff Lanzarotta
All rights reserved.

View File

@ -103,7 +103,7 @@ if exists('g:loaded_nvim_treesitter')
if has('nvim-0.8.1')
" # Misc
hi! link @punctuation.delimiter Delimiter
hi! link @punctuation.bracket Normal
hi! link @punctuation.bracket DraculaFg
hi! link @punctuation.special Special
" # Constants
hi! link @constant Constant
@ -121,7 +121,7 @@ if exists('g:loaded_nvim_treesitter')
hi! link @parameter DraculaOrangeItalic
hi! link @parameter.reference DraculaOrange
hi! link @field DraculaOrange
hi! link @property Normal
hi! link @property DraculaFg
hi! link @constructor DraculaCyan
" # Keywords
hi! link @label DraculaPurpleItalic
@ -129,10 +129,10 @@ if exists('g:loaded_nvim_treesitter')
hi! link @keyword.operator Operator
hi! link @exception DraculaPurple
" # Variable
hi! link @variable Normal
hi! link @variable DraculaFg
hi! link @variable.builtin DraculaPurpleItalic
" # Text
hi! link @text Normal
hi! link @text DraculaFg
hi! link @text.strong DraculaFgBold
hi! link @text.emphasis DraculaFg
hi! link @text.underline Underlined
@ -143,7 +143,7 @@ if exists('g:loaded_nvim_treesitter')
hi! link @text.diff.delete DiffDelete
" # Tags
hi! link @tag DraculaCyan
hi! link @tag.delimiter Normal
hi! link @tag.delimiter DraculaFg
" HTML and JSX tag attributes. By default, this group is linked to TSProperty,
" which in turn links to Identifer (white).
hi! link @tag.attribute DraculaGreenItalic

View File

@ -203,12 +203,13 @@ call s:h('DraculaLink', s:cyan, s:none, [s:attrs.underline])
if g:dracula_high_contrast_diff
call s:h('DraculaDiffChange', s:yellow, s:purple)
call s:h('DraculaDiffDelete', s:bgdark, s:red)
else
call s:h('DraculaDiffChange', s:orange, s:none)
call s:h('DraculaDiffDelete', s:red, s:bgdark)
endif
call s:h('DraculaDiffText', s:bg, s:orange)
call s:h('DraculaDiffDelete', s:red, s:bgdark)
" }}}2

View File

@ -96,12 +96,10 @@ test_script:
# Run the core tests
- ctest . --output-on-failure -C Debug
# CTestCustom specifies skipping UTF-8 tests on Windows.
- cmd: echo "Reminder - did not try UTF-8"
- sh: echo "Reminder - tried UTF-8"
# CTestCustom specifies skipping some tests on Windows.
- cmd: echo "Reminder - skipped some tests"
on_failure:
- echo "failed"
- cmd: type tests\core\build\Testing\Temporary\LastTest.log
- sh: cat tests/core/build/Testing/Temporary/LastTest.log

View File

@ -14,8 +14,8 @@ To install this plugin, you can use one of the following ways:
Download the [archive][] and extract it into your Vim runtime directory
(`~/.vim` on UNIX/Linux and `$VIM_INSTALLATION_FOLDER\vimfiles` on windows).
You should have 3 sub-directories in this runtime directory now: "autoload",
"doc" and "plugin".
You should have 4 sub-directories in this runtime directory now: "autoload",
"doc", "ftdetect" and "plugin".
### Install as Vim8 plugin

View File

@ -45,22 +45,24 @@ if !exists('g:editorconfig_core_vimscript_debug')
endif
" }}}1
" === Regexes =========================================================== {{{1
let s:LEFT_BRACE = '\v%(^|[^\\])\{'
let s:LEFT_BRACE = '\v[\\]@8<!\{'
" 8 is an arbitrary byte-count limit to the lookbehind (micro-optimization)
"LEFT_BRACE = re.compile(
" r"""
"
" (?: ^ | [^\\] ) # Beginning of string or a character besides "\"
" (?<! \\ ) # Not preceded by "\"
"
" \{ # "{"
"
" """, re.VERBOSE
")
let s:RIGHT_BRACE = '\v%(^|[^\\])\}'
let s:RIGHT_BRACE = '\v[\\]@8<!\}'
" 8 is an arbitrary byte-count limit to the lookbehind (micro-optimization)
"RIGHT_BRACE = re.compile(
" r"""
"
" (?: ^ | [^\\] ) # Beginning of string or a character besides "\"
" (?<! \\ ) # Not preceded by "\"
"
" \} # "}"
"

View File

@ -49,8 +49,8 @@ let s:SECTCRE = '\v^\s*\[(%([^\\#;]|\\.)+)\]'
let s:OPTCRE = '\v\s*([^:=[:space:]][^:=]*)\s*([:=])\s*(.*)$'
let s:MAX_SECTION_NAME = 4096
let s:MAX_PROPERTY_NAME = 50
let s:MAX_PROPERTY_VALUE = 255
let s:MAX_PROPERTY_NAME = 1024
let s:MAX_PROPERTY_VALUE = 4096
lockvar s:SECTCRE s:OPTCRE s:MAX_SECTION_NAME s:MAX_PROPERTY_NAME s:MAX_PROPERTY_VALUE
@ -155,18 +155,6 @@ function! s:parse(config_filename, target_filename, lines)
echom printf('Saw raw opt <%s>=<%s>', l:optname, l:optval)
endif
if l:optval =~# '\v[;#]'
" ';' and '#' are comment delimiters only if
" preceded by a spacing character
let l:m = matchlist(l:optval, '\v(.{-})\s[;#]')
if len(l:m)
let l:optval = l:m[1]
endif
" ; and # can be escaped with backslash.
let l:optval = substitute(l:optval, '\v\\([;#])', '\1', 'g')
endif
let l:optval = editorconfig_core#util#strip(l:optval)
" allow empty values
if l:optval ==? '""'

View File

@ -124,35 +124,48 @@ is restarted.
*g:EditorConfig_max_line_indicator*
The way to show the line where the maximal length is reached. Accepted values
are "line", "fill" and "exceeding", otherwise there will be no max line
indicator.
are "line", "fill", "exceeding" and "fillexceeding", otherwise there will be
no max line indicator.
"line": the right column of the max line length column will be
highlighted, made possible by adding "+1" to 'colorcolumn'.
"line": the right column of the max line length column will be
highlighted on all lines, by adding +1 to 'colorcolumn'.
"fill": all the columns to the right of the max line length column
will be highlighted, made possible by setting 'colorcolumn'
to a list of numbers starting from "max_line_length + 1" to
the number of columns on the screen.
"fill": all the columns to the right of the max line length
column will be highlighted on all lines, by setting
'colorcolumn' to a list starting from "max_line_length +
1" to the number of columns on the screen.
"exceeding": the right column of the max line length column will be
highlighted on lines that exceed the max line length, made
possible by adding a match for the ColorColumn group.
"exceeding": the right column of the max line length column will be
highlighted on lines that exceed the max line length, by
adding a match for the ColorColumn group.
"none": no max line length indicator will be shown. This is the
recommended value when you do not want any indicator to be
shown, but values other than "line" or "fill" would also work
as "none".
"fillexceeding": all the columns to the right of the max line length
column will be highlighted on lines that exceed the max
line length, by adding a match for the ColorColumn group.
"none": no max line length indicator will be shown. Recommended
when you do not want any indicator to be shown, but any
value other than those listed above also work as "none".
To set this option, add any of the following lines to your |vimrc| file:
>
let g:EditorConfig_max_line_indicator = "line"
let g:EditorConfig_max_line_indicator = "fill"
let g:EditorConfig_max_line_indicator = "exceeding"
let g:EditorConfig_max_line_indicator = "fillexceeding"
let g:EditorConfig_max_line_indicator = "none"
<
The default value is "line".
*g:EditorConfig_enable_for_new_buf*
Set this to 1 if you want EditorConfig plugin to set options
for new empty buffers too.
Path to .editorconfig will be determined based on CWD (see |getcwd()|)
>
let g:EditorConfig_enable_for_new_buf = 1
<
This option defaults to 0.
*g:EditorConfig_preserve_formatoptions*
Set this to 1 if you don't want your formatoptions modified when
max_line_length is set:

View File

@ -0,0 +1 @@
autocmd BufNewFile,BufRead .editorconfig setfiletype dosini

View File

@ -1,3 +1,3 @@
#!/bin/sh
zip -r editorconfig-vim-$*.zip plugin/* autoload/* doc/*
zip -r editorconfig-vim-$*.zip autoload/* doc/* ftdetect/* plugin/*

View File

@ -60,6 +60,10 @@ if !exists('g:EditorConfig_disable_rules')
let g:EditorConfig_disable_rules = []
endif
if !exists('g:EditorConfig_enable_for_new_buf')
let g:EditorConfig_enable_for_new_buf = 0
endif
if !exists('g:EditorConfig_softtabstop_space')
let g:EditorConfig_softtabstop_space = 1
endif
@ -203,11 +207,22 @@ endfunction " }}}1
function! s:UseConfigFiles() abort " Apply config to the current buffer {{{1
let b:editorconfig_tried = 1
let l:buffer_name = expand('%:p')
" ignore buffers without a name
if empty(l:buffer_name)
" Only process normal buffers (do not treat help files as '.txt' files)
" When starting Vim with a directory, the buftype might not yet be set:
" Therefore, also check if buffer_name is a directory.
if index(['', 'acwrite'], &buftype) == -1 || isdirectory(l:buffer_name)
return
endif
if empty(l:buffer_name)
if g:EditorConfig_enable_for_new_buf
let l:buffer_name = getcwd() . "/."
else
return
endif
endif
if exists("b:EditorConfig_disable") && b:EditorConfig_disable
if g:EditorConfig_verbose
echo 'Skipping EditorConfig for buffer "' . l:buffer_name . '"'
@ -247,11 +262,11 @@ function! s:UseConfigFiles() abort " Apply config to the current buffer {{{1
endfor
if s:editorconfig_core_mode ==? 'vim_core'
if s:UseConfigFiles_VimCore() == 0
if s:UseConfigFiles_VimCore(l:buffer_name) == 0
let b:editorconfig_applied = 1
endif
elseif s:editorconfig_core_mode ==? 'external_command'
call s:UseConfigFiles_ExternalCommand()
call s:UseConfigFiles_ExternalCommand(l:buffer_name)
let b:editorconfig_applied = 1
else
echohl Error |
@ -269,6 +284,7 @@ function! s:EditorConfigEnable(should_enable)
autocmd!
if a:should_enable
autocmd BufNewFile,BufReadPost,BufFilePost * call s:UseConfigFiles()
autocmd VimEnter,BufNew * call s:UseConfigFiles()
endif
augroup END
endfunction
@ -285,21 +301,15 @@ command! EditorConfigReload call s:UseConfigFiles() " Reload EditorConfig files
" On startup, enable the autocommands
call s:EditorConfigEnable(1)
" Always set the filetype for .editorconfig files
augroup editorconfig_dosini
autocmd!
autocmd BufNewFile,BufRead .editorconfig set filetype=dosini
augroup END
" }}}1
" UseConfigFiles function for different modes {{{1
function! s:UseConfigFiles_VimCore()
function! s:UseConfigFiles_VimCore(target)
" Use the vimscript EditorConfig core
try
let l:config = editorconfig_core#handler#get_configurations(
\ { 'target': expand('%:p') } )
\ { 'target': a:target } )
call s:ApplyConfig(l:config)
return 0 " success
catch
@ -307,17 +317,17 @@ function! s:UseConfigFiles_VimCore()
endtry
endfunction
function! s:UseConfigFiles_ExternalCommand()
function! s:UseConfigFiles_ExternalCommand(target)
" Use external EditorConfig core (e.g., the C core)
call s:DisableShellSlash()
let l:exec_path = shellescape(s:editorconfig_exec_path)
call s:ResetShellSlash()
call s:SpawnExternalParser(l:exec_path)
call s:SpawnExternalParser(l:exec_path, a:target)
endfunction
function! s:SpawnExternalParser(cmd) " {{{2
function! s:SpawnExternalParser(cmd, target) " {{{2
" Spawn external EditorConfig. Used by s:UseConfigFiles_ExternalCommand()
let l:cmd = a:cmd
@ -329,7 +339,7 @@ function! s:SpawnExternalParser(cmd) " {{{2
let l:config = {}
call s:DisableShellSlash()
let l:cmd = l:cmd . ' ' . shellescape(expand('%:p'))
let l:cmd = l:cmd . ' ' . shellescape(a:target)
call s:ResetShellSlash()
let l:parsing_result = split(system(l:cmd), '\v[\r\n]+')
@ -375,11 +385,6 @@ endfunction " }}}2
" }}}1
function! s:ApplyConfig(config) abort " Set the buffer options {{{1
" Only process normal buffers (do not treat help files as '.txt' files)
if index(['', 'acwrite'], &buftype) == -1
return
endif
if g:EditorConfig_verbose
echo 'Options: ' . string(a:config)
endif
@ -502,6 +507,15 @@ function! s:ApplyConfig(config) abort " Set the buffer options {{{1
endfor
call matchadd('ColorColumn',
\ '\%' . (l:max_line_length + 1) . 'v.', 100)
elseif g:EditorConfig_max_line_indicator == 'fillexceeding'
let &l:colorcolumn = ''
for l:match in getmatches()
if get(l:match, 'group', '') == 'ColorColumn'
call matchdelete(get(l:match, 'id'))
endif
endfor
call matchadd('ColorColumn',
\ '\%'. (l:max_line_length + 1) . 'v.\+', -1)
endif
endif
endif

View File

@ -32,3 +32,10 @@ if(WIN32 AND (NOT "$ENV{RUN_UTF8}"))
set(CTEST_CUSTOM_TESTS_IGNORE ${CTEST_CUSTOM_TESTS_IGNORE} g_utf_8_char)
set(CTEST_CUSTOM_TESTS_IGNORE ${CTEST_CUSTOM_TESTS_IGNORE} utf_8_char)
endif()
# Skip min_supported_value_length on Windows since that test seems to
# cause Appveyor to hang.
if(WIN32)
message(WARNING "Skipping min_supported_value_length test on this platform")
set(CTEST_CUSTOM_TESTS_IGNORE ${CTEST_CUSTOM_TESTS_IGNORE} min_supported_value_length)
endif()

View File

@ -37,12 +37,14 @@ function! s:set_color(group, attr, color)
execute printf('hi %s %s%s=%s', a:group, gui ? 'gui' : 'cterm', a:attr, a:color)
endfunction
nnoremap <silent> <Plug>(goyo-off) :call <sid>goyo_off()<cr>
function! s:blank(repel)
if bufwinnr(t:goyo_pads.r) <= bufwinnr(t:goyo_pads.l) + 1
\ || bufwinnr(t:goyo_pads.b) <= bufwinnr(t:goyo_pads.t) + 3
call s:goyo_off()
call feedkeys("\<Plug>(goyo-off)")
endif
execute 'wincmd' a:repel
execute 'noautocmd wincmd' a:repel
endfunction
function! s:init_pad(command)

View File

@ -15,7 +15,7 @@ if exists('*GetNginxIndent')
finish
endif
function! GetNginxIndent() abort
function GetNginxIndent() abort
let plnum = s:PrevNotAsBlank(v:lnum - 1)
" Hit the start of the file, use zero indent.
@ -52,7 +52,7 @@ function! GetNginxIndent() abort
endfunction
" Find the first line at or above {lnum} that is non-blank and not a comment.
function! s:PrevNotAsBlank(lnum) abort
function s:PrevNotAsBlank(lnum) abort
let lnum = prevnonblank(a:lnum)
while lnum > 0
if getline(lnum) !~ '^\s*#'
@ -64,10 +64,10 @@ function! s:PrevNotAsBlank(lnum) abort
endfunction
" Check whether {line} ends with {pat}, ignoring trailing comments.
function! s:AsEndWith(line, pat) abort
function s:AsEndWith(line, pat) abort
return a:line =~ a:pat . '\m\s*\%(#.*\)\?$'
endfunction
function! s:IsLineContinuation(lnum) abort
function s:IsLineContinuation(lnum) abort
return a:lnum > 0 && !s:AsEndWith(getline(a:lnum), '[;{}]')
endfunction

View File

@ -1,7 +1,7 @@
" Vim syntax file
" Language: nginx.conf
" Maintainer: Chris Aumann <me@chr4.org>
" Last Change: Apr 15, 2017
" Last Change: Jan 25, 2023
if exists("b:current_syntax")
finish
@ -84,6 +84,8 @@ syn keyword ngxListenOptions default_server contained
syn keyword ngxListenOptions ssl contained
syn keyword ngxListenOptions http2 contained
syn keyword ngxListenOptions spdy contained
syn keyword ngxListenOptions http3 contained
syn keyword ngxListenOptions quic contained
syn keyword ngxListenOptions proxy_protocol contained
syn keyword ngxListenOptions setfib contained
syn keyword ngxListenOptions fastopen contained
@ -265,8 +267,16 @@ syn keyword ngxDirective http2_max_concurrent_streams
syn keyword ngxDirective http2_max_field_size
syn keyword ngxDirective http2_max_header_size
syn keyword ngxDirective http2_max_requests
syn keyword ngxDirective http2_push
syn keyword ngxDirective http2_push_preload
syn keyword ngxDirective http2_recv_buffer_size
syn keyword ngxDirective http2_recv_timeout
syn keyword ngxDirective http3_hq
syn keyword ngxDirective http3_max_concurrent_pushes
syn keyword ngxDirective http3_max_concurrent_streams
syn keyword ngxDirective http3_push
syn keyword ngxDirective http3_push_preload
syn keyword ngxDirective http3_stream_buffer_size
syn keyword ngxDirective if_modified_since
syn keyword ngxDirective ignore_invalid_headers
syn keyword ngxDirective image_filter
@ -444,6 +454,10 @@ syn keyword ngxDirective proxy_temp_path
syn keyword ngxDirective proxy_timeout
syn keyword ngxDirective proxy_upload_rate
syn keyword ngxDirective queue
syn keyword ngxDirective quic_gso
syn keyword ngxDirective quic_host_key
syn keyword ngxDirective quic_mtu
syn keyword ngxDirective quic_retry
syn keyword ngxDirective random_index
syn keyword ngxDirective read_ahead
syn keyword ngxDirective real_ip_header
@ -545,8 +559,10 @@ syn keyword ngxDirective ssl_certificate
syn keyword ngxDirective ssl_certificate_key
syn keyword ngxDirective ssl_ciphers
syn keyword ngxDirective ssl_client_certificate
syn keyword ngxDirective ssl_conf_command
syn keyword ngxDirective ssl_crl
syn keyword ngxDirective ssl_dhparam
syn keyword ngxDirective ssl_early_data
syn keyword ngxDirective ssl_ecdh_curve
syn keyword ngxDirective ssl_engine
syn keyword ngxDirective ssl_handshake_timeout
@ -556,6 +572,7 @@ syn keyword ngxSSLPreferServerCiphersOn on contained
syn keyword ngxSSLPreferServerCiphersOff off contained
syn keyword ngxDirective ssl_preread
syn keyword ngxDirective ssl_protocols nextgroup=ngxSSLProtocol,ngxSSLProtocolDeprecated skipwhite
syn keyword ngxDirective ssl_reject_handshake
syn match ngxSSLProtocol 'TLSv1' contained nextgroup=ngxSSLProtocol,ngxSSLProtocolDeprecated skipwhite
syn match ngxSSLProtocol 'TLSv1\.1' contained nextgroup=ngxSSLProtocol,ngxSSLProtocolDeprecated skipwhite
syn match ngxSSLProtocol 'TLSv1\.2' contained nextgroup=ngxSSLProtocol,ngxSSLProtocolDeprecated skipwhite
@ -622,6 +639,7 @@ syn keyword ngxDirective uwsgi_buffering
syn keyword ngxDirective uwsgi_buffers
syn keyword ngxDirective uwsgi_busy_buffers_size
syn keyword ngxDirective uwsgi_cache
syn keyword ngxDirective uwsgi_cache_background_update
syn keyword ngxDirective uwsgi_cache_bypass
syn keyword ngxDirective uwsgi_cache_key
syn keyword ngxDirective uwsgi_cache_lock
@ -2225,6 +2243,19 @@ syn keyword ngxDirectiveThirdParty xss_override_status
syn keyword ngxDirectiveThirdParty xss_check_status
syn keyword ngxDirectiveThirdParty xss_input_types
" CT Module <https://github.com/grahamedgecombe/nginx-ct>
" Certificate Transparency module for nginx
syn keyword ngxDirectiveThirdParty ssl_ct
syn keyword ngxDirectiveThirdParty ssl_ct_static_scts
" Dynamic TLS records patch <https://github.com/cloudflare/sslconfig/blob/master/patches/nginx__dynamic_tls_records.patch>
" TLS Dynamic Record Resizing
syn keyword ngxDirectiveThirdParty ssl_dyn_rec_enable
syn keyword ngxDirectiveThirdParty ssl_dyn_rec_size_hi
syn keyword ngxDirectiveThirdParty ssl_dyn_rec_size_lo
syn keyword ngxDirectiveThirdParty ssl_dyn_rec_threshold
syn keyword ngxDirectiveThirdParty ssl_dyn_rec_timeout
" ZIP Module <https://www.nginx.com/resources/wiki/modules/zip/>
" ZIP archiver for nginx

View File

@ -117,22 +117,19 @@ There's also a variant for searching and a variant for grepping.
## Coercion
Want to turn `fooBar` into `foo_bar`? Press `crs` (coerce to
snake\_case). MixedCase (`crm`), camelCase (`crc`), snake\_case
(`crs`), UPPER\_CASE (`cru`), dash-case (`cr-`), dot.case (`cr.`),
space case (`cr<space>`), and Title Case (`crt`) are all just 3
keystrokes away.
snake\_case). MixedCase (`crm`), camelCase (`crc`), UPPER\_CASE (`cru`),
dash-case (`cr-`), dot.case (`cr.`), space case (`cr<space>`), and
Title Case (`crt`) are all just 3 keystrokes away.
## Installation
If you don't have a preferred installation method, I recommend
installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
then simply copy and paste:
Install using your favorite package manager, or use Vim's built-in package
support:
cd ~/.vim/bundle
git clone git://github.com/tpope/vim-abolish.git
Once help tags have been generated, you can view the manual with
`:help abolish`.
mkdir -p ~/.vim/pack/tpope/start
cd ~/.vim/pack/tpope/start
git clone https://tpope.io/vim/abolish.git
vim -u NONE -c "helptags abolish/doc" -c q
## Self-Promotion

View File

@ -150,16 +150,15 @@ using the cr mapping (mnemonic: CoeRce) followed by one of the following
characters:
c: camelCase
m: MixedCase
p: PascalCase
m: MixedCase (aka PascalCase)
_: snake_case
s: snake_case
u: SNAKE_UPPERCASE
U: SNAKE_UPPERCASE
-: dash-case (not usually reversible; see |abolish-coercion-reversible|)
k: kebab-case (not usually reversible; see |abolish-coercion-reversible|)
-: dash-case (aka kebab-case)
.: dot.case (not usually reversible; see |abolish-coercion-reversible|)
<space>: space case (not usually reversible; see |abolish-coercion-reversible|)
t: Title Case (not usually reversible; see |abolish-coercion-reversible|)
For example, cru on a lowercase word is a slightly easier to type equivalent
to gUiw.

View File

@ -1,6 +1,6 @@
" abolish.vim - Language friendly searches, substitutions, and abbreviations
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 1.1
" Version: 1.2
" GetLatestVimScripts: 1545 1 :AutoInstall: abolish.vim
" Initialization {{{1
@ -23,8 +23,8 @@ endif
" }}}1
" Utility functions {{{1
function! s:function(name)
return function(substitute(a:name,'^s:',matchstr(expand('<sfile>'), '<SNR>\d\+_'),''))
function! s:function(name) abort
return function(substitute(a:name,'^s:',matchstr(expand('<sfile>'), '.*\zs<SNR>\d\+_'),''))
endfunction
function! s:send(self,func,...)
@ -565,6 +565,7 @@ endfunction
call extend(Abolish.Coercions, {
\ 'c': Abolish.camelcase,
\ 'm': Abolish.mixedcase,
\ 'p': Abolish.mixedcase,
\ 's': Abolish.snakecase,
\ '_': Abolish.snakecase,
\ 'u': Abolish.uppercase,
@ -619,7 +620,7 @@ endfunction
nnoremap <expr> <Plug>(abolish-coerce) <SID>coerce(nr2char(getchar()))
vnoremap <expr> <Plug>(abolish-coerce) <SID>coerce(nr2char(getchar()))
nnoremap <expr> <plug>(abolish-coerce-word) <SID>coerce(nr2char(getchar())).'iw'
nnoremap <expr> <Plug>(abolish-coerce-word) <SID>coerce(nr2char(getchar())).'iw'
" }}}1

View File

@ -49,6 +49,12 @@ the `<F7>` key if so. For example, to remap it to `<F3>` instead, use:
autocmd FileType python map <buffer> <F3> :call flake8#Flake8()<CR>
Since the `autocmd` order is not specified in Vim, the previous
recommendation is sometimes not sufficient to "unmap" `<F7>`. In such a
case, being more explicit about it should help (see `:h no_mail_maps`):
let g:no_flake8_maps = 1
For flake8 configuration options please consult the following page:
http://flake8.pycqa.org/en/latest/user/configuration.html

View File

@ -142,14 +142,22 @@ function! s:Mods(mods, ...) abort
let mods = substitute(a:mods, '\C<mods>', '', '')
let mods = mods =~# '\S$' ? mods . ' ' : mods
if a:0 && mods !~# '\<\%(aboveleft\|belowright\|leftabove\|rightbelow\|topleft\|botright\|tab\)\>'
if a:1 ==# 'Edge'
let default = a:1
if default ==# 'SpanOrigin'
if s:OriginBufnr() > 0 && (mods =~# '\<vertical\>' ? &winfixheight : &winfixwidth)
let default = 'Edge'
else
let default = ''
endif
endif
if default ==# 'Edge'
if mods =~# '\<vertical\>' ? &splitright : &splitbelow
let mods = 'botright ' . mods
else
let mods = 'topleft ' . mods
endif
else
let mods = a:1 . ' ' . mods
let mods = default . ' ' . mods
endif
endif
return substitute(mods, '\s\+', ' ', 'g')
@ -157,7 +165,7 @@ endfunction
if exists('+shellslash')
let s:dir_commit_file = '\c^fugitive://\%(/[^/]\@=\)\=\(.\{-1,\}\)//\%(\(\x\{40,\}\|[0-3]\)\(/.*\)\=\)\=$'
let s:dir_commit_file = '\c^fugitive://\%(/[^/]\@=\)\=\([^?#]\{-1,\}\)//\%(\(\x\{40,\}\|[0-3]\)\(/[^?#]*\)\=\)\=$'
function! s:Slash(path) abort
return tr(a:path, '\', '/')
@ -169,7 +177,7 @@ if exists('+shellslash')
else
let s:dir_commit_file = '\c^fugitive://\(.\{-\}\)//\%(\(\x\{40,\}\|[0-3]\)\(/.*\)\=\)\=$'
let s:dir_commit_file = '\c^fugitive://\([^?#]\{-\}\)//\%(\(\x\{40,\}\|[0-3]\)\(/[^?#]*\)\=\)\=$'
function! s:Slash(path) abort
return a:path
@ -275,8 +283,9 @@ endfunction
function! s:Map(mode, lhs, rhs, ...) abort
let maps = []
let defer = a:0 && a:1 =~# '<unique>' || get(g:, 'fugitive_defer_to_existing_maps')
let flags = substitute(a:0 ? a:1 : '', '<unique>', '', '') . (a:rhs =~# '<Plug>' ? '' : '<script>') . '<nowait>'
let flags = a:0 && type(a:1) == type('') ? a:1 : ''
let defer = flags =~# '<unique>'
let flags = substitute(flags, '<unique>', '', '') . (a:rhs =~# '<Plug>' ? '' : '<script>') . '<nowait>'
for mode in split(a:mode, '\zs')
if a:0 <= 1
call add(maps, mode.'map <buffer>' . substitute(flags, '<unique>', '', '') . ' <Plug>fugitive:' . a:lhs . ' ' . a:rhs)
@ -1018,7 +1027,7 @@ function! fugitive#Head(...) abort
if empty(dir)
return ''
endif
let file = FugitiveActualDir() . '/HEAD'
let file = FugitiveActualDir(dir) . '/HEAD'
let ftime = getftime(file)
if ftime == -1
return ''
@ -2573,13 +2582,6 @@ function! s:ReplaceCmd(cmd) abort
endif
endfunction
function! s:QueryLog(refspec, limit) abort
let lines = s:LinesError(['log', '-n', '' . a:limit, '--pretty=format:%h%x09%s'] + a:refspec + ['--'])[0]
call map(lines, 'split(v:val, "\t", 1)')
call map(lines, '{"type": "Log", "commit": v:val[0], "subject": join(v:val[1 : -1], "\t")}')
return lines
endfunction
function! s:FormatLog(dict) abort
return a:dict.commit . ' ' . a:dict.subject
endfunction
@ -2624,18 +2626,31 @@ function! s:AddSection(label, lines, ...) abort
call append(line('$'), ['', a:label . (len(note) ? ': ' . note : ' (' . len(a:lines) . ')')] + s:Format(a:lines))
endfunction
function! s:AddLogSection(label, refspec) abort
let limit = 256
let log = s:QueryLog(a:refspec, limit)
if empty(log)
return
elseif len(log) == limit
function! s:QueryLog(refspec, limit) abort
let [log, exec_error] = s:LinesError(['log', '-n', '' . a:limit, '--pretty=format:%h%x09%s'] + a:refspec + ['--'])
call map(log, 'split(v:val, "\t", 1)')
call map(log, '{"type": "Log", "commit": v:val[0], "subject": join(v:val[1 : -1], "\t")}')
let result = {'error': exec_error ? 1 : 0, 'overflow': 0, 'entries': log}
if len(log) == a:limit
call remove(log, -1)
let label = a:label . ' (' . (limit - 1). '+)'
else
let label = a:label . ' (' . len(log) . ')'
let result.overflow = 1
endif
call append(line('$'), ['', label] + s:Format(log))
return result
endfunction
function! s:QueryLogRange(old, new) abort
if empty(a:old) || empty(a:new)
return {'error': 2, 'overflow': 0, 'entries': []}
endif
return s:QueryLog([a:old . '..' . a:new], 256)
endfunction
function! s:AddLogSection(label, log) abort
if empty(a:log.entries)
return
endif
let label = a:label . ' (' . len(a:log.entries) . (a:log.overflow ? '+' : '') . ')'
call append(line('$'), ['', label] + s:Format(a:log.entries))
endfunction
let s:rebase_abbrevs = {
@ -2673,7 +2688,6 @@ function! fugitive#BufReadStatus(...) abort
let [staged, unstaged, untracked] = [[], [], []]
let props = {}
let pull = ''
if empty(s:Tree())
let branch = FugitiveHead(0)
let head = FugitiveHead(11)
@ -2725,7 +2739,6 @@ function! fugitive#BufReadStatus(...) abort
else
let head = FugitiveHead(11)
endif
let pull = get(props, 'branch.upstream', '')
else " git < 2.11
let cmd += ['status', '--porcelain', '-bz']
let [output, message, exec_error] = s:NullError(cmd)
@ -2738,7 +2751,7 @@ function! fugitive#BufReadStatus(...) abort
endwhile
let head = matchstr(output[0], '^## \zs\S\+\ze\%($\| \[\)')
if head =~# '\.\.\.'
let [head, pull] = split(head, '\.\.\.')
let head = split(head, '\.\.\.')[0]
let branch = head
elseif head ==# 'HEAD' || empty(head)
let head = FugitiveHead(11)
@ -2790,8 +2803,25 @@ function! fugitive#BufReadStatus(...) abort
let b:fugitive_files['Unstaged'][dict.filename] = dict
endfor
let fetch_remote = config.Get('branch.' . branch . '.remote', 'origin')
let push_remote = config.Get('branch.' . branch . '.pushRemote',
\ config.Get('remote.pushDefault', fetch_remote))
if fetch_remote !=# '.' && empty(config.Get('remote.' . fetch_remote . '.fetch'))
let fetch_remote = ''
endif
if push_remote !=# '.' && empty(config.Get('remote.' . push_remote . '.push', config.Get('remote.' . push_remote . '.fetch')))
let push_remote = ''
endif
let pull_type = 'Pull'
if len(pull)
if empty(fetch_remote) || empty(branch)
let pull_ref = ''
elseif fetch_remote ==# '.'
let pull_ref = config.Get('branch.' . branch . '.merge', 'refs/heads/' . branch)
else
let pull_ref = substitute(config.Get('branch.' . branch . '.merge', 'refs/heads/' . branch), '^refs/heads/', 'refs/remotes/' . fetch_remote . '/', '')
endif
if len(pull_ref)
let rebase = FugitiveConfigGet('branch.' . branch . '.rebase', config)
if empty(rebase)
let rebase = FugitiveConfigGet('pull.rebase', config)
@ -2803,28 +2833,23 @@ function! fugitive#BufReadStatus(...) abort
endif
endif
let push_remote = FugitiveConfigGet('branch.' . branch . '.pushRemote', config)
if empty(push_remote)
let push_remote = FugitiveConfigGet('remote.pushDefault', config)
endif
let fetch_remote = FugitiveConfigGet('branch.' . branch . '.remote', config)
if empty(fetch_remote)
let fetch_remote = 'origin'
endif
if empty(push_remote)
let push_remote = fetch_remote
endif
let push_default = FugitiveConfigGet('push.default', config)
if empty(push_default)
let push_default = fugitive#GitVersion(2) ? 'simple' : 'matching'
endif
if push_default ==# 'upstream'
let push = pull
let push_ref = pull_ref
elseif empty(push_remote) || empty(branch)
let push_ref = ''
elseif push_remote ==# '.'
let push_ref = 'refs/heads/' . branch
else
let push = len(branch) ? (push_remote ==# '.' ? '' : push_remote . '/') . branch : ''
let push_ref = 'refs/remotes/' . push_remote . '/' . branch
endif
let push_short = substitute(push_ref, '^refs/\w\+/', '', '')
let pull_short = substitute(pull_ref, '^refs/\w\+/', '', '')
if isdirectory(fugitive#Find('.git/rebase-merge/'))
let rebasing_dir = fugitive#Find('.git/rebase-merge/')
elseif isdirectory(fugitive#Find('.git/rebase-apply/'))
@ -2869,9 +2894,9 @@ function! fugitive#BufReadStatus(...) abort
silent keepjumps %delete_
call s:AddHeader('Head', head)
call s:AddHeader(pull_type, pull)
if push !=# pull
call s:AddHeader('Push', push)
call s:AddHeader(pull_type, pull_short)
if push_ref !=# pull_ref
call s:AddHeader('Push', push_short)
endif
if empty(s:Tree())
if get(fugitive#ConfigGetAll('core.bare', config), 0, '') !~# '^\%(false\|no|off\|0\|\)$'
@ -2891,20 +2916,27 @@ function! fugitive#BufReadStatus(...) abort
call s:AddSection('Staged', staged)
let staged_end = len(staged) ? line('$') : 0
if len(push) && !(push ==# pull && get(props, 'branch.ab') =~# '^+0 ')
call s:AddLogSection('Unpushed to ' . push, [push . '..' . head])
let unique_push_ref = push_ref ==# pull_ref ? '' : push_ref
let unpushed_push = s:QueryLogRange(unique_push_ref, head)
if get(props, 'branch.ab') =~# '^+0 '
let unpushed_pull = {'error': 0, 'overflow': 0, 'entries': []}
else
let unpushed_pull = s:QueryLogRange(pull_ref, head)
endif
if len(pull) && push !=# pull
call s:AddLogSection('Unpushed to ' . pull, [pull . '..' . head])
" If the push ref is defined but nowhere to be found at the remote,
" pretend it's the same as the pull ref
if unpushed_push.error == 1
let unpushed_push = unpushed_pull
endif
if empty(pull) && empty(push) && empty(rebasing)
call s:AddLogSection('Unpushed to *', [head, '--not', '--remotes'])
call s:AddLogSection('Unpushed to ' . push_short, unpushed_push)
call s:AddLogSection('Unpushed to ' . pull_short, unpushed_pull)
if unpushed_push.error && unpushed_pull.error && empty(rebasing) &&
\ !empty(push_remote . fetch_remote)
call s:AddLogSection('Unpushed to *', s:QueryLog([head, '--not', '--remotes'], 256))
endif
if len(push) && push !=# pull
call s:AddLogSection('Unpulled from ' . push, [head . '..' . push])
endif
if len(pull) && get(props, 'branch.ab') !~# ' -0$'
call s:AddLogSection('Unpulled from ' . pull, [head . '..' . pull])
call s:AddLogSection('Unpulled from ' . push_short, s:QueryLogRange(head, unique_push_ref))
if len(pull_ref) && get(props, 'branch.ab') !~# ' -0$'
call s:AddLogSection('Unpulled from ' . pull_short, s:QueryLogRange(head, pull_ref))
endif
setlocal nomodified readonly noswapfile
@ -3293,6 +3325,11 @@ function! s:TempDelete(file) abort
return ''
endfunction
function! s:OriginBufnr(...) abort
let state = s:TempState(a:0 ? a:1 : bufnr(''))
return get(state, 'origin_bufnr', -1)
endfunction
augroup fugitive_temp
autocmd!
autocmd BufReadPre * exe s:TempReadPre( +expand('<abuf>'))
@ -3345,7 +3382,8 @@ function! s:RunEdit(state, tmp, job) abort
let noequalalways = 1
setglobal equalalways
endif
exe substitute(a:state.mods, '\<tab\>', '-tab', 'g') 'keepalt split' s:fnameescape(file)
let mods = s:Mods(a:state.mods, 'SpanOrigin')
exe substitute(mods, '\<tab\>', '-tab', 'g') 'keepalt split' s:fnameescape(file)
finally
if exists('l:noequalalways')
setglobal noequalalways
@ -3802,13 +3840,13 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg, ...) abort
let stream = exists('*setbufline')
let do_edit = substitute(s:Mods(a:mods, 'Edge'), '\<tab\>', '-tab', 'g') . 'pedit!'
elseif pager
let allow_pty = 0
let allow_pty = get(args, 0, '') is# 'shortlog'
if pager is# 2 && a:bang && a:line2 >= 0
let [do_edit, after_edit] = s:ReadPrepare(a:line1, a:line2, a:range, a:mods)
elseif pager is# 2 && a:bang
let do_edit = s:Mods(a:mods) . 'pedit'
let do_edit = s:Mods(a:mods, 'SpanOrigin') . 'pedit'
elseif !curwin
let do_edit = s:Mods(a:mods) . 'split'
let do_edit = s:Mods(a:mods, 'SpanOrigin') . 'split'
else
let do_edit = s:Mods(a:mods) . 'edit'
call s:BlurStatus()
@ -4214,7 +4252,9 @@ function! s:DoAutocmdChanged(dir) abort
finally
unlet! g:fugitive_event g:fugitive_result
" Force statusline reload with the buffer's Git dir
let &l:ro = &l:ro
if dir isnot# FugitiveGitDir()
let &l:ro = &l:ro
endif
endtry
return ''
endfunction
@ -6131,15 +6171,15 @@ function! fugitive#Open(cmd, bang, mods, arg, ...) abort
return 'echoerr ' . string(':G' . a:cmd . '! for temp buffer output has been replaced by :' . get(s:bang_edits, a:cmd, 'Git') . ' --paginate')
endif
let mods = s:Mods(a:mods)
if a:cmd ==# 'edit'
call s:BlurStatus()
endif
try
let [file, pre] = s:OpenParse(a:arg, 1, 0)
catch /^fugitive:/
return 'echoerr ' . string(v:exception)
endtry
let mods = s:Mods(a:mods)
if a:cmd ==# 'edit'
call s:BlurStatus()
endif
return mods . a:cmd . pre . ' ' . s:fnameescape(file)
endfunction
@ -6765,8 +6805,12 @@ function! s:BlameCommitFileLnum(...) abort
endfunction
function! s:BlameLeave() abort
let bufwinnr = bufwinnr(s:BlameBufnr())
if bufwinnr > 0
let state = s:TempState()
let bufwinnr = exists('*win_id2win') ? win_id2win(get(state, 'origin_winid')) : 0
if bufwinnr == 0
let bufwinnr = bufwinnr(get(state, 'origin_bufnr', -1))
endif
if get(state, 'filetype', '') ==# 'fugitiveblame' && bufwinnr > 0
let bufnr = bufnr('')
exe bufwinnr . 'wincmd w'
return bufnr . 'bdelete'
@ -6959,8 +7003,10 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, options) abort
if a:mods =~# '\<tab\>'
silent tabedit %
endif
let bufnr = bufnr('')
let temp_state.origin_bufnr = bufnr
let temp_state.origin_bufnr = bufnr('')
if exists('*win_getid')
let temp_state.origin_winid = win_getid()
endif
let restore = []
let mods = substitute(a:mods, '\<tab\>', '', 'g')
for winnr in range(winnr('$'),1,-1)
@ -6973,11 +7019,11 @@ function! s:BlameSubcommand(line1, count, range, bang, mods, options) abort
endif
endif
let win_blame_bufnr = s:BlameBufnr(winbufnr(winnr))
if getwinvar(winnr, '&scrollbind') ? win_blame_bufnr == bufnr : win_blame_bufnr > 0
if getwinvar(winnr, '&scrollbind') ? win_blame_bufnr == temp_state.origin_bufnr : win_blame_bufnr > 0
execute winbufnr(winnr).'bdelete'
endif
endfor
let restore_winnr = exists('*win_getid') ? win_getid() : 'bufwinnr(' . bufnr . ')'
let restore_winnr = get(temp_state, 'origin_winid', 'bufwinnr(' . temp_state.origin_bufnr . ')')
if !&l:scrollbind
call add(restore, 'call setwinvar(' . restore_winnr . ',"&scrollbind",0)')
endif
@ -7156,6 +7202,9 @@ function! fugitive#BlameSyntax() abort
return
endif
let seen = {}
for x in split('01234567890abcdef', '\zs')
exe 'syn match FugitiveblameHashGroup'.x '"\%(^\^\=[*?]*\)\@<='.x.'\x\{5,\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameOriginalLineNumber,fugitiveblameOriginalFile skipwhite'
endfor
for lnum in range(1, line('$'))
let orig_hash = matchstr(getline(lnum), '^\^\=[*?]*\zs\x\{6\}')
let hash = orig_hash
@ -7177,8 +7226,8 @@ function! fugitive#BlameSyntax() abort
else
let s:hash_colors[hash] = ''
endif
let pattern = substitute(orig_hash, '^\(\x\)\x\(\x\)\x\(\x\)\x$', '\1\\x\2\\x\3\\x', '') . '*\>'
exe 'syn match FugitiveblameHash'.hash.' "\%(^\^\=[*?]*\)\@<='.pattern.'" nextgroup=FugitiveblameAnnotation,FugitiveblameOriginalLineNumber,fugitiveblameOriginalFile skipwhite'
let pattern = substitute(orig_hash, '^\(\x\)\x\(\x\)\x\(\x\)\x$', '\1\\x\2\\x\3\\x', '') . '*'
exe 'syn match FugitiveblameHash'.hash.' "\%(^\^\=[*?]*\)\@<='.pattern.'" contained containedin=FugitiveblameHashGroup' . orig_hash[0]
endfor
syn match FugitiveblameUncommitted "\%(^\^\=[?*]*\)\@<=\<0\{7,\}\>" nextgroup=FugitiveblameAnnotation,FugitiveblameScoreDebug,FugitiveblameOriginalLineNumber,FugitiveblameOriginalFile skipwhite
call s:BlameRehighlight()
@ -7196,6 +7245,7 @@ endfunction
function! s:BlameMaps(is_ftplugin) abort
let ft = a:is_ftplugin
call s:MapGitOps(ft)
call s:Map('n', '<F1>', ':help :Git_blame<CR>', '<silent>', ft)
call s:Map('n', 'g?', ':help :Git_blame<CR>', '<silent>', ft)
call s:Map('n', 'gq', ':exe <SID>BlameQuit()<CR>', '<silent>', ft)
@ -7329,11 +7379,12 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, ...) abor
endfor
return 'echoerr ' . string('fugitive: no URL found in output of :Git')
endif
exe s:DirCheck(dir)
let config = fugitive#Config(dir)
if empty(remote) && expanded =~# '^[^-./:^~][^:^~]*$' && !empty(FugitiveConfigGet('remote.' . expanded . '.url', config))
let remote = expanded
let expanded = ''
if empty(remote) && expanded =~# '^[^-./:^~][^:^~]*$' && !empty(dir)
let config = fugitive#Config(dir)
if !empty(FugitiveConfigGet('remote.' . expanded . '.url', config))
let remote = expanded
let expanded = ''
endif
endif
if empty(expanded)
let bufname = &buftype =~# '^\%(nofile\|terminal\)$' ? '' : s:BufName('%')
@ -7369,17 +7420,22 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, ...) abor
endif
endif
let path = path[1:-1]
elseif empty(s:Tree(dir))
let path = '.git/' . full[strlen(dir)+1:-1]
let type = ''
else
let path = fugitive#Path(full, '/')[1:-1]
elseif !empty(s:Tree(dir))
let relevant_dir = FugitiveExtractGitDir(full)
if !empty(relevant_dir)
let dir = relevant_dir
endif
let path = fugitive#Path(full, '/', dir)[1:-1]
if empty(path) || isdirectory(full)
let type = 'tree'
else
let type = 'blob'
endif
else
let path = '.git/' . full[strlen(dir)+1:-1]
let type = ''
endif
exe s:DirCheck(dir)
if path =~# '^\.git/'
let ref = matchstr(path, '^.git/\zs\%(refs/[^/]\+/[^/].*\|\w*HEAD\)$')
let type = empty(ref) ? 'root': 'ref'
@ -7397,6 +7453,9 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, ...) abor
endif
endif
if !exists('l:config') || s:Dir(config) !=# dir
let config = fugitive#Config(dir)
endif
let merge = ''
if !empty(remote) && ref =~# '^refs/remotes/[^/]\+/[^/]\|^refs/heads/[^/]'
let merge = matchstr(ref, '^refs/\%(heads/\|remotes/[^/]\+/\)\zs.\+')
@ -7521,13 +7580,17 @@ function! fugitive#BrowseCommand(line1, count, range, bang, mods, arg, ...) abor
endif
endfor
throw "fugitive: no GBrowse handler installed for '".raw."'"
if !empty(remote_url)
return 'echoerr ' . string("fugitive: no GBrowse handler installed for '".remote_url."'")
else
return 'echoerr ' . string("fugitive: could not find remote named '".remote."'")
endif
catch /^fugitive:/
return 'echoerr ' . string(v:exception)
endtry
endfunction
" Section: Go to file
" Section: Maps
let s:ref_header = '\%(Merge\|Rebase\|Upstream\|Pull\|Push\)'
@ -7585,7 +7648,10 @@ function! s:NavigateUp(count) abort
endfunction
function! s:ParseDiffHeader(str) abort
let list = matchlist(a:str, '\Cdiff --git \("\=[^/].*\|/dev/null\) \("\=[^/].*\|/dev/null\)$')
let list = matchlist(a:str, '\Cdiff --git \("\=\w/.*\|/dev/null\) \("\=\w/.*\|/dev/null\)$')
if empty(list)
let list = matchlist(a:str, '\Cdiff --git \("\=[^/].*\|/dev/null\) \("\=[^/].*\|/dev/null\)$')
endif
return [fugitive#Unquote(get(list, 1, '')), fugitive#Unquote(get(list, 2, ''))]
endfunction
@ -7617,6 +7683,81 @@ function! s:MapMotion(lhs, rhs) abort
return join(maps, '|')
endfunction
function! s:MapGitOps(is_ftplugin) abort
let ft = a:is_ftplugin
if &modifiable
return ''
endif
exe s:Map('n', 'c<Space>', ':Git commit<Space>', '', ft)
exe s:Map('n', 'c<CR>', ':Git commit<CR>', '', ft)
exe s:Map('n', 'cv<Space>', ':tab Git commit -v<Space>', '', ft)
exe s:Map('n', 'cv<CR>', ':tab Git commit -v<CR>', '', ft)
exe s:Map('n', 'ca', ':<C-U>Git commit --amend<CR>', '<silent>', ft)
exe s:Map('n', 'cc', ':<C-U>Git commit<CR>', '<silent>', ft)
exe s:Map('n', 'ce', ':<C-U>Git commit --amend --no-edit<CR>', '<silent>', ft)
exe s:Map('n', 'cw', ':<C-U>Git commit --amend --only<CR>', '<silent>', ft)
exe s:Map('n', 'cva', ':<C-U>tab Git commit -v --amend<CR>', '<silent>', ft)
exe s:Map('n', 'cvc', ':<C-U>tab Git commit -v<CR>', '<silent>', ft)
exe s:Map('n', 'cRa', ':<C-U>Git commit --reset-author --amend<CR>', '<silent>', ft)
exe s:Map('n', 'cRe', ':<C-U>Git commit --reset-author --amend --no-edit<CR>', '<silent>', ft)
exe s:Map('n', 'cRw', ':<C-U>Git commit --reset-author --amend --only<CR>', '<silent>', ft)
exe s:Map('n', 'cf', ':<C-U>Git commit --fixup=<C-R>=<SID>SquashArgument()<CR>', '', ft)
exe s:Map('n', 'cF', ':<C-U><Bar>Git -c sequence.editor=true rebase --interactive --autosquash<C-R>=<SID>RebaseArgument()<CR><Home>Git commit --fixup=<C-R>=<SID>SquashArgument()<CR>', '', ft)
exe s:Map('n', 'cs', ':<C-U>Git commit --no-edit --squash=<C-R>=<SID>SquashArgument()<CR>', '', ft)
exe s:Map('n', 'cS', ':<C-U><Bar>Git -c sequence.editor=true rebase --interactive --autosquash<C-R>=<SID>RebaseArgument()<CR><Home>Git commit --no-edit --squash=<C-R>=<SID>SquashArgument()<CR>', '', ft)
exe s:Map('n', 'cA', ':<C-U>Git commit --edit --squash=<C-R>=<SID>SquashArgument()<CR>', '', ft)
exe s:Map('n', 'c?', ':<C-U>help fugitive_c<CR>', '<silent>', ft)
exe s:Map('n', 'cr<Space>', ':Git revert<Space>', '', ft)
exe s:Map('n', 'cr<CR>', ':Git revert<CR>', '', ft)
exe s:Map('n', 'crc', ':<C-U>Git revert <C-R>=<SID>SquashArgument()<CR><CR>', '<silent>', ft)
exe s:Map('n', 'crn', ':<C-U>Git revert --no-commit <C-R>=<SID>SquashArgument()<CR><CR>', '<silent>', ft)
exe s:Map('n', 'cr?', ':<C-U>help fugitive_cr<CR>', '<silent>', ft)
exe s:Map('n', 'cm<Space>', ':Git merge<Space>', '', ft)
exe s:Map('n', 'cm<CR>', ':Git merge<CR>', '', ft)
exe s:Map('n', 'cmt', ':Git mergetool', '', ft)
exe s:Map('n', 'cm?', ':<C-U>help fugitive_cm<CR>', '<silent>', ft)
exe s:Map('n', 'cz<Space>', ':Git stash<Space>', '', ft)
exe s:Map('n', 'cz<CR>', ':Git stash<CR>', '', ft)
exe s:Map('n', 'cza', ':<C-U>Git stash apply --quiet --index stash@{<C-R>=v:count<CR>}<CR>', '', ft)
exe s:Map('n', 'czA', ':<C-U>Git stash apply --quiet stash@{<C-R>=v:count<CR>}<CR>', '', ft)
exe s:Map('n', 'czp', ':<C-U>Git stash pop --quiet --index stash@{<C-R>=v:count<CR>}<CR>', '', ft)
exe s:Map('n', 'czP', ':<C-U>Git stash pop --quiet stash@{<C-R>=v:count<CR>}<CR>', '', ft)
exe s:Map('n', 'czs', ':<C-U>Git stash push --staged<CR>', '', ft)
exe s:Map('n', 'czv', ':<C-U>exe "Gedit" fugitive#RevParse("stash@{" . v:count . "}")<CR>', '<silent>', ft)
exe s:Map('n', 'czw', ':<C-U>Git stash push --keep-index<C-R>=v:count > 1 ? " --all" : v:count ? " --include-untracked" : ""<CR><CR>', '', ft)
exe s:Map('n', 'czz', ':<C-U>Git stash push <C-R>=v:count > 1 ? " --all" : v:count ? " --include-untracked" : ""<CR><CR>', '', ft)
exe s:Map('n', 'cz?', ':<C-U>help fugitive_cz<CR>', '<silent>', ft)
exe s:Map('n', 'co<Space>', ':Git checkout<Space>', '', ft)
exe s:Map('n', 'co<CR>', ':Git checkout<CR>', '', ft)
exe s:Map('n', 'coo', ':<C-U>Git checkout <C-R>=substitute(<SID>SquashArgument(),"^$",get(<SID>TempState(),"filetype","") ==# "git" ? expand("<cfile>") : "","")<CR> --<CR>', '', ft)
exe s:Map('n', 'co?', ':<C-U>help fugitive_co<CR>', '<silent>', ft)
exe s:Map('n', 'cb<Space>', ':Git branch<Space>', '', ft)
exe s:Map('n', 'cb<CR>', ':Git branch<CR>', '', ft)
exe s:Map('n', 'cb?', ':<C-U>help fugitive_cb<CR>', '<silent>', ft)
exe s:Map('n', 'r<Space>', ':Git rebase<Space>', '', ft)
exe s:Map('n', 'r<CR>', ':Git rebase<CR>', '', ft)
exe s:Map('n', 'ri', ':<C-U>Git rebase --interactive<C-R>=<SID>RebaseArgument()<CR><CR>', '<silent>', ft)
exe s:Map('n', 'rf', ':<C-U>Git -c sequence.editor=true rebase --interactive --autosquash<C-R>=<SID>RebaseArgument()<CR><CR>', '<silent>', ft)
exe s:Map('n', 'ru', ':<C-U>Git rebase --interactive @{upstream}<CR>', '<silent>', ft)
exe s:Map('n', 'rp', ':<C-U>Git rebase --interactive @{push}<CR>', '<silent>', ft)
exe s:Map('n', 'rw', ':<C-U>Git rebase --interactive<C-R>=<SID>RebaseArgument()<CR><Bar>s/^pick/reword/e<CR>', '<silent>', ft)
exe s:Map('n', 'rm', ':<C-U>Git rebase --interactive<C-R>=<SID>RebaseArgument()<CR><Bar>s/^pick/edit/e<CR>', '<silent>', ft)
exe s:Map('n', 'rd', ':<C-U>Git rebase --interactive<C-R>=<SID>RebaseArgument()<CR><Bar>s/^pick/drop/e<CR>', '<silent>', ft)
exe s:Map('n', 'rk', ':<C-U>Git rebase --interactive<C-R>=<SID>RebaseArgument()<CR><Bar>s/^pick/drop/e<CR>', '<silent>', ft)
exe s:Map('n', 'rx', ':<C-U>Git rebase --interactive<C-R>=<SID>RebaseArgument()<CR><Bar>s/^pick/drop/e<CR>', '<silent>', ft)
exe s:Map('n', 'rr', ':<C-U>Git rebase --continue<CR>', '<silent>', ft)
exe s:Map('n', 'rs', ':<C-U>Git rebase --skip<CR>', '<silent>', ft)
exe s:Map('n', 're', ':<C-U>Git rebase --edit-todo<CR>', '<silent>', ft)
exe s:Map('n', 'ra', ':<C-U>Git rebase --abort<CR>', '<silent>', ft)
exe s:Map('n', 'r?', ':<C-U>help fugitive_r<CR>', '<silent>', ft)
endfunction
function! fugitive#MapJumps(...) abort
if !&modifiable
if get(b:, 'fugitive_type', '') ==# 'blob'
@ -7681,75 +7822,6 @@ function! fugitive#MapJumps(...) abort
call s:Map('n', 'gi', ":<C-U>exe 'Gsplit' (v:count ? '.gitignore' : '.git/info/exclude')<CR>", '<silent>')
call s:Map('x', 'gi', ":<C-U>exe 'Gsplit' (v:count ? '.gitignore' : '.git/info/exclude')<CR>", '<silent>')
call s:Map('n', 'c<Space>', ':Git commit<Space>')
call s:Map('n', 'c<CR>', ':Git commit<CR>')
call s:Map('n', 'cv<Space>', ':tab Git commit -v<Space>')
call s:Map('n', 'cv<CR>', ':tab Git commit -v<CR>')
call s:Map('n', 'ca', ':<C-U>Git commit --amend<CR>', '<silent>')
call s:Map('n', 'cc', ':<C-U>Git commit<CR>', '<silent>')
call s:Map('n', 'ce', ':<C-U>Git commit --amend --no-edit<CR>', '<silent>')
call s:Map('n', 'cw', ':<C-U>Git commit --amend --only<CR>', '<silent>')
call s:Map('n', 'cva', ':<C-U>tab Git commit -v --amend<CR>', '<silent>')
call s:Map('n', 'cvc', ':<C-U>tab Git commit -v<CR>', '<silent>')
call s:Map('n', 'cRa', ':<C-U>Git commit --reset-author --amend<CR>', '<silent>')
call s:Map('n', 'cRe', ':<C-U>Git commit --reset-author --amend --no-edit<CR>', '<silent>')
call s:Map('n', 'cRw', ':<C-U>Git commit --reset-author --amend --only<CR>', '<silent>')
call s:Map('n', 'cf', ':<C-U>Git commit --fixup=<C-R>=<SID>SquashArgument()<CR>')
call s:Map('n', 'cF', ':<C-U><Bar>Git -c sequence.editor=true rebase --interactive --autosquash<C-R>=<SID>RebaseArgument()<CR><Home>Git commit --fixup=<C-R>=<SID>SquashArgument()<CR>')
call s:Map('n', 'cs', ':<C-U>Git commit --no-edit --squash=<C-R>=<SID>SquashArgument()<CR>')
call s:Map('n', 'cS', ':<C-U><Bar>Git -c sequence.editor=true rebase --interactive --autosquash<C-R>=<SID>RebaseArgument()<CR><Home>Git commit --no-edit --squash=<C-R>=<SID>SquashArgument()<CR>')
call s:Map('n', 'cA', ':<C-U>Git commit --edit --squash=<C-R>=<SID>SquashArgument()<CR>')
call s:Map('n', 'c?', ':<C-U>help fugitive_c<CR>', '<silent>')
call s:Map('n', 'cr<Space>', ':Git revert<Space>')
call s:Map('n', 'cr<CR>', ':Git revert<CR>')
call s:Map('n', 'crc', ':<C-U>Git revert <C-R>=<SID>SquashArgument()<CR><CR>', '<silent>')
call s:Map('n', 'crn', ':<C-U>Git revert --no-commit <C-R>=<SID>SquashArgument()<CR><CR>', '<silent>')
call s:Map('n', 'cr?', ':<C-U>help fugitive_cr<CR>', '<silent>')
call s:Map('n', 'cm<Space>', ':Git merge<Space>')
call s:Map('n', 'cm<CR>', ':Git merge<CR>')
call s:Map('n', 'cmt', ':Git mergetool')
call s:Map('n', 'cm?', ':<C-U>help fugitive_cm<CR>', '<silent>')
call s:Map('n', 'cz<Space>', ':Git stash<Space>')
call s:Map('n', 'cz<CR>', ':Git stash<CR>')
call s:Map('n', 'cza', ':<C-U>Git stash apply --quiet --index stash@{<C-R>=v:count<CR>}<CR>')
call s:Map('n', 'czA', ':<C-U>Git stash apply --quiet stash@{<C-R>=v:count<CR>}<CR>')
call s:Map('n', 'czp', ':<C-U>Git stash pop --quiet --index stash@{<C-R>=v:count<CR>}<CR>')
call s:Map('n', 'czP', ':<C-U>Git stash pop --quiet stash@{<C-R>=v:count<CR>}<CR>')
call s:Map('n', 'czs', ':<C-U>Git stash push --staged<CR>')
call s:Map('n', 'czv', ':<C-U>exe "Gedit" fugitive#RevParse("stash@{" . v:count . "}")<CR>', '<silent>')
call s:Map('n', 'czw', ':<C-U>Git stash push --keep-index<C-R>=v:count > 1 ? " --all" : v:count ? " --include-untracked" : ""<CR><CR>')
call s:Map('n', 'czz', ':<C-U>Git stash push <C-R>=v:count > 1 ? " --all" : v:count ? " --include-untracked" : ""<CR><CR>')
call s:Map('n', 'cz?', ':<C-U>help fugitive_cz<CR>', '<silent>')
call s:Map('n', 'co<Space>', ':Git checkout<Space>')
call s:Map('n', 'co<CR>', ':Git checkout<CR>')
call s:Map('n', 'coo', ':<C-U>Git checkout <C-R>=substitute(<SID>SquashArgument(),"^$",get(<SID>TempState(),"filetype","") ==# "git" ? expand("<cfile>") : "","")<CR> --<CR>')
call s:Map('n', 'co?', ':<C-U>help fugitive_co<CR>', '<silent>')
call s:Map('n', 'cb<Space>', ':Git branch<Space>')
call s:Map('n', 'cb<CR>', ':Git branch<CR>')
call s:Map('n', 'cb?', ':<C-U>help fugitive_cb<CR>', '<silent>')
call s:Map('n', 'r<Space>', ':Git rebase<Space>')
call s:Map('n', 'r<CR>', ':Git rebase<CR>')
call s:Map('n', 'ri', ':<C-U>Git rebase --interactive<C-R>=<SID>RebaseArgument()<CR><CR>', '<silent>')
call s:Map('n', 'rf', ':<C-U>Git -c sequence.editor=true rebase --interactive --autosquash<C-R>=<SID>RebaseArgument()<CR><CR>', '<silent>')
call s:Map('n', 'ru', ':<C-U>Git rebase --interactive @{upstream}<CR>', '<silent>')
call s:Map('n', 'rp', ':<C-U>Git rebase --interactive @{push}<CR>', '<silent>')
call s:Map('n', 'rw', ':<C-U>Git rebase --interactive<C-R>=<SID>RebaseArgument()<CR><Bar>s/^pick/reword/e<CR>', '<silent>')
call s:Map('n', 'rm', ':<C-U>Git rebase --interactive<C-R>=<SID>RebaseArgument()<CR><Bar>s/^pick/edit/e<CR>', '<silent>')
call s:Map('n', 'rd', ':<C-U>Git rebase --interactive<C-R>=<SID>RebaseArgument()<CR><Bar>s/^pick/drop/e<CR>', '<silent>')
call s:Map('n', 'rk', ':<C-U>Git rebase --interactive<C-R>=<SID>RebaseArgument()<CR><Bar>s/^pick/drop/e<CR>', '<silent>')
call s:Map('n', 'rx', ':<C-U>Git rebase --interactive<C-R>=<SID>RebaseArgument()<CR><Bar>s/^pick/drop/e<CR>', '<silent>')
call s:Map('n', 'rr', ':<C-U>Git rebase --continue<CR>', '<silent>')
call s:Map('n', 'rs', ':<C-U>Git rebase --skip<CR>', '<silent>')
call s:Map('n', 're', ':<C-U>Git rebase --edit-todo<CR>', '<silent>')
call s:Map('n', 'ra', ':<C-U>Git rebase --abort<CR>', '<silent>')
call s:Map('n', 'r?', ':<C-U>help fugitive_r<CR>', '<silent>')
call s:Map('n', '.', ":<C-U> <C-R>=<SID>fnameescape(fugitive#Real(@%))<CR><Home>")
call s:Map('x', '.', ":<C-U> <C-R>=<SID>fnameescape(fugitive#Real(@%))<CR><Home>")
call s:Map('n', 'g?', ":<C-U>help fugitive-map<CR>", '<silent>')
@ -7762,6 +7834,7 @@ function! fugitive#MapJumps(...) abort
if new_browsex !=# old_browsex
exe 'nnoremap <silent> <buffer> <Plug>NetrwBrowseX' new_browsex
endif
call s:MapGitOps(0)
endfunction
function! fugitive#GX() abort
@ -8115,6 +8188,9 @@ function! fugitive#Foldtext() abort
endif
elseif line_foldstart =~# '^@@\+ .* @@'
return '+-' . v:folddashes . ' ' . line_foldstart
elseif &filetype ==# 'fugitive' && line_foldstart =~# '^[A-Z][a-z].* (\d\+)$'
let c = +matchstr(line_foldstart, '(\zs\d\+\ze)$')
return '+-' . v:folddashes . printf('%3d item', c) . (c == 1 ? ': ' : 's: ') . matchstr(line_foldstart, '.*\ze (\d\+)$')
elseif &filetype ==# 'gitcommit' && line_foldstart =~# '^# .*:$'
let lines = getline(v:foldstart, v:foldend)
call filter(lines, 'v:val =~# "^#\t"')

View File

@ -510,9 +510,11 @@ Stash maps ~
czz Push stash. Pass a [count] of 1 to add
`--include-untracked` or 2 to add `--all`.
czw Push stash of worktree. Like `czz` with
czw Push stash of the work-tree. Like `czz` with
`--keep-index`.
czs Push stash of the stage. Does not accept a count.
czA Apply topmost stash, or stash@{count}.
cza Apply topmost stash, or stash@{count}, preserving the

View File

@ -607,7 +607,7 @@ if exists(':Gdelete') != 2 && get(g:, 'fugitive_legacy_commands', 0)
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'
elseif exists(':Gdelete') != 2 && !exists('g:fugitive_legacy_commands')
exe 'command! -bar -bang -nargs=0 Gdelete echoerr ":Gremove has been removed in favor of :GRemove"'
exe 'command! -bar -bang -nargs=0 Gdelete echoerr ":Gdelete has been removed in favor of :GDelete"'
endif
if exists(':Gmove') != 2 && get(g:, 'fugitive_legacy_commands', 0)
exe 'command! -bar -bang -nargs=1 -complete=customlist,fugitive#CompleteObject Gmove exe fugitive#MoveCommand( <line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'

View File

@ -13,7 +13,7 @@ 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=/^$/ fold
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
@ -30,7 +30,7 @@ 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=/^$/ fold'
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'

View File

@ -528,7 +528,14 @@ Add `let g:gitgutter_preview_win_floating = 1` to your `~/.vimrc`. Note that on
#### The appearance of a floating/popup window for hunk previews
Set `g:gitgutter_floating_window_options` to a dictionary of the options you want. This dictionary is passed directly to `popup_create()` (Vim) / `nvim_open_win()` (Neovim).
Either set `g:gitgutter_floating_window_options` to a dictionary of the options you want. This dictionary is passed directly to `popup_create()` (Vim) / `nvim_open_win()` (Neovim).
Or if you just want to override one or two of the defaults, you can do that with a file in an `after/` directory. For example:
```viml
" ~/.vim/after/vim-gitgutter/overrides.vim
let g:gitgutter_floating_window_options['border'] = 'single'
```
#### To load all hunks into the current window's location list instead of the quickfix list

View File

@ -328,6 +328,9 @@ function! s:undo(hunk_diff)
call append(lnum-1, lines[0:hunk[1]])
execute (lnum+hunk[1]) .','. (lnum+hunk[1]+hunk[3]) .'d _'
endif
" Refresh gitgutter's view of buffer.
call gitgutter#process_buffer(bufnr(''), 1)
endfunction
@ -433,7 +436,7 @@ function! s:open_hunk_preview_window()
call nvim_buf_set_name(buf, 'gitgutter://hunk-preview')
" Assumes cursor is in original window.
autocmd CursorMoved <buffer> ++once call gitgutter#hunk#close_hunk_preview_window()
autocmd CursorMoved,TabLeave <buffer> ++once call gitgutter#hunk#close_hunk_preview_window()
if g:gitgutter_close_preview_on_escape
" Map <Esc> to close the floating preview.
@ -565,7 +568,7 @@ endfunction
function! s:screen_lines(lines)
let [_virtualedit, &virtualedit]=[&virtualedit, 'all']
let cursor = getcurpos()
normal! g$
normal! 0g$
let available_width = virtcol('.')
call setpos('.', cursor)
let &virtualedit=_virtualedit

View File

@ -547,6 +547,13 @@ Default:
This dictionary is passed directly to |popup_create()| (Vim) or
|nvim_open_win()| (Neovim).
If you simply want to override one or two of the default values, create a file
in an after/ directory. For example:
>
" ~/.vim/after/vim-gitgutter/overrides.vim
let g:gitgutter_floating_window_options['border'] = 'single'
<
*g:gitgutter_close_preview_on_escape*
Default: 0

View File

@ -0,0 +1,15 @@
name: Vint
on: [push]
jobs:
vint:
name: vint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- name: Setup dependencies
run: pip install vim-vint
- name: Lint Vimscript
run: vint .

View File

@ -1,4 +1,7 @@
# Indent Guides (unmaintained)
# Indent Guides
[![Vint](https://github.com/preservim/vim-indent-guides/workflows/Vint/badge.svg)](https://github.com/preservim/vim-indent-guides/actions?workflow=Vint)
Indent Guides is a plugin for visually displaying indent levels in Vim.
<img src="http://i.imgur.com/ONgoj.png" width="448" height="448" alt="" />
@ -24,7 +27,7 @@ If you have [Pathogen](http://www.vim.org/scripts/script.php?script_id=2332) ins
```bash
cd ~/.vim/bundle
git clone git://github.com/nathanaelkane/vim-indent-guides.git
git clone git://github.com/preservim/vim-indent-guides.git
```
### Vundle

View File

@ -1,5 +1,5 @@
" Author: Nate Kane <nathanaelkane AT gmail DOT com>
" Homepage: http://github.com/nathanaelkane/vim-indent-guides
" Homepage: http://github.com/preservim/vim-indent-guides
"
" Return hex string equivalent to given decimal string or number.
@ -10,7 +10,7 @@
" Example: color_helper#dec_to_hex(255, 5)
" Returns: '000FF'
"
function! color_helper#dec_to_hex(arg, padding)
function! color_helper#dec_to_hex(arg, padding) abort
return toupper(printf('%0' . a:padding . 'x', a:arg + 0))
endfunction
@ -26,7 +26,7 @@ endfunction
" Example: color_helper#hex_to_dec('00')
" Returns: 0
"
function! color_helper#hex_to_dec(arg)
function! color_helper#hex_to_dec(arg) abort
return (a:arg =~? '^0x') ? a:arg + 0 : ('0x'.a:arg) + 0
endfunction
@ -36,7 +36,7 @@ endfunction
" Example: color_helper#hex_color_to_rgb('#0088FF')
" Returns: [0, 136, 255]
"
function! color_helper#hex_color_to_rgb(hex_color)
function! color_helper#hex_color_to_rgb(hex_color) abort
let l:rgb = []
if a:hex_color =~ g:indent_guides_color_hex_pattern
@ -55,7 +55,7 @@ endfunction
" Example: color_helper#rgb_color_to_hex([0, 136, 255])
" Returns: '#0088FF'
"
function! color_helper#rgb_color_to_hex(rgb_color)
function! color_helper#rgb_color_to_hex(rgb_color) abort
let l:hex_color = '#'
let l:hex_color .= color_helper#dec_to_hex(a:rgb_color[0], 2) " red
let l:hex_color .= color_helper#dec_to_hex(a:rgb_color[1], 2) " green
@ -71,7 +71,7 @@ endfunction
" Example: color_helper#hex_color_lighten('#000000', 0.10)
" Returns: '#191919'
"
function! color_helper#hex_color_lighten(color, percent)
function! color_helper#hex_color_lighten(color, percent) abort
let l:rgb = color_helper#hex_color_to_rgb(a:color)
let l:rgb_lightened = []
@ -89,7 +89,7 @@ endfunction
" Example: color_helper#hex_color_darken('#FFFFFF', 0.10)
" Returns: '#E5E5E5'
"
function! color_helper#hex_color_darken(color, percent)
function! color_helper#hex_color_darken(color, percent) abort
let l:rgb = color_helper#hex_color_to_rgb(a:color)
let l:rgb_darkened = []
@ -106,7 +106,7 @@ endfunction
" Example: color_helper#color_name_to_hex('darkslategray')
" Returns: '#2F4F4F'
"
function! color_helper#color_name_to_hex(color_name)
function! color_helper#color_name_to_hex(color_name) abort
let l:hex_code = ''
let l:color_name = tolower(a:color_name)

View File

@ -1,10 +1,10 @@
" Author: Nate Kane <nathanaelkane AT gmail DOT com>
" Homepage: http://github.com/nathanaelkane/vim-indent-guides
" Homepage: http://github.com/preservim/vim-indent-guides
"
" Toggles the indent guides on and off.
"
function! indent_guides#toggle()
function! indent_guides#toggle() abort
call indent_guides#init_matches()
if empty(w:indent_guides_matches)
@ -18,7 +18,7 @@ endfunction
" Called from autocmds, keeps indent guides enabled or disabled when entering
" other buffers and windows.
"
function! indent_guides#process_autocmds()
function! indent_guides#process_autocmds() abort
if g:indent_guides_autocmds_enabled
call indent_guides#enable()
else
@ -30,7 +30,7 @@ endfunction
" Enables the indent guides for the current buffer and any other buffer upon
" entering it.
"
function! indent_guides#enable()
function! indent_guides#enable() abort
let g:indent_guides_autocmds_enabled = 1
if &diff || indent_guides#exclude_filetype()
@ -64,7 +64,7 @@ endfunction
" Disables the indent guides for the current buffer and any other buffer upon
" entering it.
"
function! indent_guides#disable()
function! indent_guides#disable() abort
let g:indent_guides_autocmds_enabled = 0
call indent_guides#clear_matches()
endfunction
@ -72,7 +72,7 @@ endfunction
"
" Clear all highlight matches for the current window.
"
function! indent_guides#clear_matches()
function! indent_guides#clear_matches() abort
call indent_guides#init_matches()
if !empty(w:indent_guides_matches)
let l:index = 0
@ -86,14 +86,21 @@ function! indent_guides#clear_matches()
let l:index += l:index
endfor
endif
" Make sure to clear indent guide if remembered match id has gone somehow.
for l:match in getmatches()
if l:match.group =~# '^IndentGuides\v(Even|Odd)$'
call matchdelete(l:match.id)
endif
endfor
endfunction
"
" Automagically calculates and defines the indent highlight colors.
"
function! indent_guides#highlight_colors()
function! indent_guides#highlight_colors() abort
if s:auto_colors
if has('gui_running') || has('nvim')
if has('gui_running') || has('nvim') || (has('termguicolors') && &termguicolors)
call indent_guides#gui_highlight_colors()
else
call indent_guides#basic_highlight_colors()
@ -105,9 +112,9 @@ endfunction
" Defines some basic indent highlight colors that work for Terminal Vim and
" gVim when colors can't be automatically calculated.
"
function! indent_guides#basic_highlight_colors()
let l:cterm_colors = (&g:background == 'dark') ? ['darkgrey', 'black'] : ['lightgrey', 'white']
let l:gui_colors = (&g:background == 'dark') ? ['grey15', 'grey30'] : ['grey70', 'grey85']
function! indent_guides#basic_highlight_colors() abort
let l:cterm_colors = (&g:background ==# 'dark') ? ['darkgrey', 'black'] : ['lightgrey', 'white']
let l:gui_colors = (&g:background ==# 'dark') ? ['grey15', 'grey30'] : ['grey70', 'grey85']
exe 'hi IndentGuidesEven guibg=' . l:gui_colors[0] . ' guifg=' . l:gui_colors[1] . ' ctermbg=' . l:cterm_colors[0] . ' ctermfg=' . l:cterm_colors[1]
exe 'hi IndentGuidesOdd guibg=' . l:gui_colors[1] . ' guifg=' . l:gui_colors[0] . ' ctermbg=' . l:cterm_colors[1] . ' ctermfg=' . l:cterm_colors[0]
@ -117,7 +124,7 @@ endfunction
" Automagically calculates and defines the indent highlight colors for gui
" vim.
"
function! indent_guides#gui_highlight_colors()
function! indent_guides#gui_highlight_colors() abort
let l:hi_normal_guibg = ''
" capture the backgroud color from the normal highlight
@ -150,10 +157,10 @@ endfunction
" Takes a color and darkens or lightens it depending on whether a dark or light
" colorscheme is being used.
"
function! indent_guides#lighten_or_darken_color(color)
function! indent_guides#lighten_or_darken_color(color) abort
let l:new_color = ''
if (&g:background == 'dark')
if (&g:background ==# 'dark')
let l:new_color = color_helper#hex_color_lighten(a:color, s:change_percent)
else
let l:new_color = color_helper#hex_color_darken (a:color, s:change_percent)
@ -165,7 +172,7 @@ endfunction
"
" Define default highlights.
"
function! indent_guides#define_default_highlights()
function! indent_guides#define_default_highlights() abort
hi default clear IndentGuidesOdd
hi default clear IndentGuidesEven
endfunction
@ -173,7 +180,7 @@ endfunction
"
" Init the w:indent_guides_matches variable.
"
function! indent_guides#init_matches()
function! indent_guides#init_matches() abort
let w:indent_guides_matches = exists('w:indent_guides_matches') ? w:indent_guides_matches : []
endfunction
@ -181,7 +188,7 @@ endfunction
" We need to initialize these vars every time a buffer is entered while the
" plugin is enabled.
"
function! indent_guides#init_script_vars()
function! indent_guides#init_script_vars() abort
if &l:shiftwidth > 0 && &l:expandtab
let s:indent_size = &l:shiftwidth
else
@ -191,7 +198,7 @@ function! indent_guides#init_script_vars()
let s:hi_normal = indent_guides#capture_highlight('Normal')
" remove 'font=<value>' from the s:hi_normal string (only seems to happen on Vim startup in Windows)
let s:hi_normal = substitute(s:hi_normal, ' font=[A-Za-z0-9:]\+', "", "")
let s:hi_normal = substitute(s:hi_normal, ' font=[A-Za-z0-9:]\+', '', '')
" shortcuts to the global variables - this makes the code easier to read
let s:debug = g:indent_guides_debug
@ -229,7 +236,7 @@ endfunction
"
" NOTE: Currently, this only works when soft-tabs are being used.
"
function! indent_guides#calculate_guide_size()
function! indent_guides#calculate_guide_size() abort
let l:guide_size = g:indent_guides_guide_size
if l:guide_size == 0 || l:guide_size > s:indent_size
@ -245,12 +252,9 @@ endfunction
" Example: indent_guides#capture_highlight('normal')
" Returns: 'Normal xxx guifg=#323232 guibg=#ffffff'
"
function! indent_guides#capture_highlight(group_name)
redir => l:output
exe "silent hi " . a:group_name
redir END
let l:output = substitute(l:output, "\n", "", "")
function! indent_guides#capture_highlight(group_name) abort
let l:output = execute('hi ' . a:group_name, 'silent')
let l:output = substitute(l:output, '\n', '', '')
return l:output
endfunction
@ -266,7 +270,7 @@ endfunction
" Example: indent_guides#indent_highlight_pattern('\t', 9, 2)
" Returns: /^\t*\%9v\zs\t*\%11v\ze/
"
function! indent_guides#indent_highlight_pattern(indent_pattern, column_start, indent_size)
function! indent_guides#indent_highlight_pattern(indent_pattern, column_start, indent_size) abort
let l:pattern = '^' . a:indent_pattern . '*\%' . a:column_start . 'v\zs'
let l:pattern .= a:indent_pattern . '*\%' . (a:column_start + a:indent_size) . 'v'
let l:pattern .= '\ze'
@ -276,8 +280,13 @@ endfunction
"
" Detect if any of the buffer filetypes should be excluded.
"
function! indent_guides#exclude_filetype()
for ft in split(&ft, '\.')
function! indent_guides#exclude_filetype() abort
if exists('g:indent_guides_exclude_buftype')
if g:indent_guides_exclude_buftype && &buftype !=# ''
return 1
endif
endif
for ft in split(&ft, '\.', 1)
if index(g:indent_guides_exclude_filetypes, ft) > -1
return 1
end

View File

@ -170,9 +170,18 @@ Default: 0. Values: 0 or 1.
let g:indent_guides_enable_on_vim_startup = 0
<
------------------------------------------------------------------------------
*'indent_guides_exclude_buftype'*
Use this option to try and disable the plugin on non-file buffers
Default: 0. Values: 0 or 1
>
let g:indent_guides_exclude_buftype = 0
<
------------------------------------------------------------------------------
*'indent_guides_exclude_filetypes'*
Use this option to specify a list of filetypes to disable the plugin for.
Use this option to specify a list of filetypes to disable the plugin for. Use
'' for files with no filetypes set.
Default: ['help']. Values: list of strings.
>
@ -248,8 +257,8 @@ Why did I build this plugin?~
* I wanted to learn me some VimL.
Links:~
* Github: https://github.com/nathanaelkane/vim-indent-guides
* Bugs & Issues: https://github.com/nathanaelkane/vim-indent-guides/issues
* Github: https://github.com/preservim/vim-indent-guides
* Bugs & Issues: https://github.com/preservim/vim-indent-guides/issues
Credits:~
* Matt Wozniski (godlygeek) for letting me use the list of color names and
@ -265,8 +274,9 @@ Bug reports, feedback, suggestions etc are welcomed.
7. CHANGELOG *indent-guides-changelog*
1.8 (pending release)~
* Allow exclude files with no 'filetype' set (thanks @noscript).
* Added option g:|indent_guides_soft_pattern| to control the pattern for
soft indentation (thanks @sergey-vlasov).
soft indentation (thanks @noscript).
* Added option g:|indent_guides_default_mapping| to control whether the
default mapping (<Leader>ig) gets set (thanks @suy).
* Set size of indent guide to `tabstop` value when `shiftwidth=0` or

View File

@ -1,5 +1,5 @@
" Author: Nate Kane <nathanaelkane AT gmail DOT com>
" Homepage: http://github.com/nathanaelkane/vim-indent-guides
" Homepage: http://github.com/preservim/vim-indent-guides
" Do not load if vim is too old
if (v:version == 701 && !exists('*matchadd')) || (v:version < 701)
@ -35,7 +35,7 @@ command! -bar IndentGuidesDisable call s:IndentGuidesDisable()
"
function s:InitVariable(var, value)
if !exists(a:var)
if type(a:value) == type("")
if type(a:value) == type('')
exec 'let ' . a:var . ' = ' . "'" . a:value . "'"
else
exec 'let ' . a:var . ' = ' . a:value
@ -67,7 +67,7 @@ if !exists('g:indent_guides_exclude_filetypes')
endif
" Default mapping
if !hasmapto('<Plug>IndentGuidesToggle', 'n') && maparg('<Leader>ig', 'n') == ''
if !hasmapto('<Plug>IndentGuidesToggle', 'n') && maparg('<Leader>ig', 'n') ==# ''
\ && g:indent_guides_default_mapping != 0
nmap <silent><unique> <Leader>ig <Plug>IndentGuidesToggle
endif
@ -86,6 +86,9 @@ augroup indent_guides
endif
autocmd BufEnter,WinEnter,FileType * call indent_guides#process_autocmds()
if (v:version == 704 && has('patch786')) || (v:version > 704)
autocmd OptionSet tabstop,shiftwidth,expandtab call indent_guides#process_autocmds()
endif
" Trigger BufEnter and process modelines.
autocmd ColorScheme * doautocmd indent_guides BufEnter

View File

@ -47,6 +47,8 @@ sudo make install
vim-addon-manager install markdown
```
If you are using a package manager with semver support (like [lazy.nvim](https://github.com/folke/lazy.nvim)) make sure you are following the master branch (see https://github.com/preservim/vim-markdown/issues/616).
If you are not using any package manager, download the [tarball](https://github.com/preservim/vim-markdown/archive/master.tar.gz) and do this:
```sh

View File

@ -296,6 +296,8 @@ endfunction
" Section: Fugitive :GBrowse support
" https://github.com/github/markup
let s:markup_exts = ['markdown', 'mdown', 'mkdn', 'md', 'textile', 'rdoc', 'org', 'creole', 'mediawiki', 'wiki', 'rst', 'asciidoc', 'adoc', 'asc', 'pod']
function! rhubarb#FugitiveUrl(...) abort
if a:0 == 1 || type(a:1) == type({})
let opts = a:1
@ -323,6 +325,9 @@ function! rhubarb#FugitiveUrl(...) abort
elseif get(opts, 'type', '') ==# 'blob' || opts.path =~# '[^/]$'
let escaped_commit = substitute(commit, '#', '%23', 'g')
let url = root . '/blob/' . escaped_commit . '/' . path
if get(opts, 'line1') > 0 && index(s:markup_exts, fnamemodify(path, ':e')) >= 0
let url .= '?plain=1'
endif
if get(opts, 'line2') > 0 && get(opts, 'line1') == opts.line2
let url .= '#L' . opts.line1
elseif get(opts, 'line1') > 0 && get(opts, 'line2') > 0

View File

@ -40,6 +40,18 @@ describe "Syntax highlighting" do
EOF
end
specify "magic comments with -" do
assert_correct_highlighting <<~'EOF', 'frozen-string-literal', 'rubyMagicComment'
# frozen-string-literal: true
EOF
end
specify "magic comments with - and _" do
assert_correct_highlighting <<~'EOF', 'frozen-string_literal', 'rubyMagicComment'
# frozen-string_literal: true
EOF
end
specify "magic comments - shareable_constant_value" do
assert_correct_highlighting <<~'EOF', 'shareable_constant_value', 'rubyMagicComment'
# shareable_constant_value: literal

View File

@ -434,8 +434,8 @@ syn match rubySharpBang "\%^#!.*" display
syn keyword rubyTodo FIXME NOTE TODO OPTIMIZE HACK REVIEW XXX todo contained
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 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

@ -109,7 +109,9 @@ function! s:state_update_changes() dict abort
let self.end_col += change_len
let col = col('.')
if line('.') != self.cur_stop.line || col < self.start_col || col > self.end_col
" Increase the endpoint by 1 for &sel = exclusive
if line('.') != self.cur_stop.line || col < self.start_col
\ || col > (self.end_col + (&sel == 'exclusive'))
return self.remove()
endif

View File

@ -245,7 +245,6 @@ This list is kept up-to-date on a best effort basis.
* Python - [honza](http://github.com/honza)
* Ruby - [taq](http://github.com/taq)
* Scala - [gorodinskiy](https://github.com/gorodinskiy)
* Supercollider - [lpil](https://github.com/lpil)
License
-------

View File

@ -44,13 +44,13 @@ snippet fi "<%= Fixtures.identify(:symbol) %>"
endsnippet
snippet ft "form_tag" w
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_tag(${1::action => '${2:update}'}${3:, ${4:${5:class} => '${6:form}'\}}}) do`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_tag(${1:action: '${2:update}'}${3:, ${4:${5:class}: '${6:form}'\}}}) do`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
$0
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
endsnippet
snippet ffs "form_for submit 2" w
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`${1:f}.submit '${2:Submit}'${3:, :disable_with => '${4:$2ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`${1:f}.submit '${2:Submit}'${3:, disable_with: '${4:$2ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet
snippet f. "f_fields_for (nff)" w
@ -84,7 +84,7 @@ snippet f. "f.radio_button" w
endsnippet
snippet f. "f.submit" w
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.submit "${1:Submit}"${2:, :disable_with => '${3:$1ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.submit "${1:Submit}"${2:, disable_with: '${3:$1ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet
snippet f. "f.text_area" w
@ -110,19 +110,19 @@ snippet ff "form_for" w
endsnippet
snippet ist "image_submit_tag" w
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_submit_tag("${1:agree.png}"${2:${3:, :id => "${4:${1/^(\w+)(\.\w*)?$/$1/}}"}${5:, :name => "${6:${1/^(\w+)(\.\w*)?$/$1/}}"}${7:, :class => "${8:${1/^(\w+)(\.\w*)?$/$1/}-button}"}${9:, :disabled => ${10:false}}})`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_submit_tag("${1:agree.png}"${2:${3:, id: "${4:${1/^(\w+)(\.\w*)?$/$1/}}"}${5:, name: "${6:${1/^(\w+)(\.\w*)?$/$1/}}"}${7:, class: "${8:${1/^(\w+)(\.\w*)?$/$1/}-button}"}${9:, disabled: ${10:false}}})`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet
snippet it "image_tag" w
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_tag "$1${2:.png}"${3:${4:, :title => "${5:title}"}${6:, :class => "${7:class}"}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_tag "$1${2:.png}"${3:${4:, title: "${5:title}"}${6:, class: "${7:class}"}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet
snippet layout "layout"
layout "${1:template_name}"${2:${3:, :only => ${4:[:${5:action}, :${6:action}]}}${7:, :except => ${8:[:${9:action}, :${10:action}]}}}
layout "${1:template_name}"${2:${3:, only: ${4:[:${5:action}, :${6:action}]}}${7:, except: ${8:[:${9:action}, :${10:action}]}}}
endsnippet
snippet jit "javascript_include_tag" w
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`javascript_include_tag ${1::all}${2:, :cache => ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`javascript_include_tag ${1::all}${2:, cache: ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet
snippet lt "link_to (name, dest)" w
@ -130,23 +130,23 @@ snippet lt "link_to (name, dest)" w
endsnippet
snippet lia "link_to (action)" w
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :action => "${2:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", action: "${2:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet
snippet liai "link_to (action, id)" w
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :action => "${2:edit}", :id => ${3:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", action: "${2:edit}", id: ${3:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet
snippet lic "link_to (controller)" w
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :controller => "${2:items}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", controller: "${2:items}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet
snippet lica "link_to (controller, action)" w
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :controller => "${2:items}", :action => "${3:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", controller: "${2:items}", action: "${3:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet
snippet licai "link_to (controller, action, id)" w
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", :controller => "${2:items}", :action => "${3:edit}", :id => ${4:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", controller: "${2:items}", action: "${3:edit}", id: ${4:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet
snippet linpp "link_to (nested path plural)" w
@ -174,15 +174,15 @@ page.hide ${1:"${2:id(s)}"}
endsnippet
snippet ins "page.insert_html (position, id, partial)"
page.insert_html :${1:top}, ${2:"${3:id}"}, :${4:partial => "${5:template}"}
page.insert_html :${1:top}, ${2:"${3:id}"}, ${4:partial: "${5:template}"}
endsnippet
snippet rep "page.replace (id, partial)"
page.replace ${1:"${2:id}"}, :${3:partial => "${4:template}"}
page.replace ${1:"${2:id}"}, ${3:partial: "${4:template}"}
endsnippet
snippet reph "page.replace_html (id, partial)"
page.replace_html ${1:"${2:id}"}, :${3:partial => "${4:template}"}
page.replace_html ${1:"${2:id}"}, ${3:partial: "${4:template}"}
endsnippet
snippet show "page.show (*ids)"
@ -198,31 +198,31 @@ page.visual_effect :${1:toggle_slide}, ${2:"${3:DOM ID}"}
endsnippet
snippet rp "render (partial) (rp)"
render :partial => "${1:item}"
render partial: "${1:item}"
endsnippet
snippet rpc "render (partial,collection) (rpc)"
render :partial => "${1:item}", :collection => ${2:@$1s}
render partial: "${1:item}", collection: ${2:@$1s}
endsnippet
snippet rpl "render (partial,locals) (rpl)"
render :partial => "${1:item}", :locals => { :${2:$1} => ${3:@$1}$0 }
render partial: "${1:item}", locals: { ${2:$1}: ${3:@$1}$0 }
endsnippet
snippet rpo "render (partial,object) (rpo)"
render :partial => "${1:item}", :object => ${2:@$1}
render partial: "${1:item}", object: ${2:@$1}
endsnippet
snippet rps "render (partial,status) (rps)"
render :partial => "${1:item}", :status => ${2:500}
render partial: "${1:item}", status: ${2:500}
endsnippet
snippet slt "stylesheet_link_tag" w
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`stylesheet_link_tag ${1::all}${2:, :cache => ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`stylesheet_link_tag ${1::all}${2:, cache: ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet
snippet st "submit_tag" w
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`submit_tag "${1:Save changes}"${2:, :id => "${3:submit}"}${4:, :name => "${5:$3}"}${6:, :class => "${7:form_$3}"}${8:, :disabled => ${9:false}}${10:, :disable_with => "${11:Please wait...}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`submit_tag "${1:Save changes}"${2:, id: "${3:submit}"}${4:, name: "${5:$3}"}${6:, class: "${7:form_$3}"}${8:, disabled: ${9:false}}${10:, disable_with: "${11:Please wait...}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
endsnippet
snippet else "else (ERB)"

View File

@ -127,14 +127,18 @@ def triple_quotes_handle_trailing(snip, quoting_style):
if not snip.c:
# Do this only once, otherwise the following error would happen:
# RuntimeError: The snippets content did not converge: …
_, col = vim.current.window.cursor
line = vim.current.line
row, col = vim.current.window.cursor
# before ultisnip expansion, chars ahead cursor is at row - 1, col
# after ultisnip expansion, they are pushed to row + 1, col - 1
# when this function is run, it's already after ultisni expansion
line = snip.buffer[row + 1]
# Handle already existing quote chars after the trigger.
_ret = quoting_style * 3
while True:
try:
nextc = line[col]
nextc = line[col - 1]
except IndexError:
break
if nextc == quoting_style and len(_ret):

View File

@ -160,9 +160,9 @@ snippet abs "abstract environment" b
endsnippet
snippet tab "tabular / array environment" b
\begin{${1:t}${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${2:c}}
$0${2/(?<=.)(c|l|r)|./(?1: & )/g}
\end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}
\begin{${1:t}${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${2:c}}
$0${2/(?<=.)(c|l|r)|./(?1: & )/g}
\end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}
endsnippet
snippet table "Table environment" b
@ -384,7 +384,7 @@ snippet nn "Tikz node" w
$0
endsnippet
snippet lll "l" Aw
snippet lll "l" w
\ell
endsnippet
@ -400,7 +400,7 @@ snippet <! "normal" Aw
\triangleleft
endsnippet
snippet "(\d|\w)+invs" "inverse" Awr
snippet "((\d|\w)+)invs" "inverse" Awr
`!p snip.rv = match.group(1)`^{-1}
endsnippet
@ -520,4 +520,59 @@ snippet subpar* "Sub Paragraph*" wi
\subparagraph*{$1${VISUAL}}
endsnippet
snippet chapl "Chapter with label" wi
\chapter{$1${VISUAL}}
\label{cha:${2:${1/\W+/-/g}}}
endsnippet
snippet secl "Section with label" wi
\section{$1${VISUAL}}
\label{sec:${2:${1/\W+/-/g}}}
endsnippet
snippet sec*l "Section* with label" wi
\section*{$1${VISUAL}}
\label{sec:${2:${1/\W+/-/g}}}
endsnippet
snippet subl "Subsection with label" wi
\subsection{$1${VISUAL}}
\label{sub:${2:${1/\W+/-/g}}}
endsnippet
snippet sub*l "Subsection* with label" wi
\subsection*{$1${VISUAL}}
\label{sub:${2:${1/\W+/-/g}}}
endsnippet
snippet subsubl "Subsection with label" wi
\subsubsection{$1${VISUAL}}
\label{ssub:${2:${1/\W+/-/g}}}
endsnippet
snippet subsub*l "Subsubsection with label" wi
\subsubsection*{$1${VISUAL}}
\label{ssub:${2:${1/\W+/-/g}}}
endsnippet
snippet parl "Paragraph with label" wi
\paragraph{$1${VISUAL}}
\label{par:${2:${1/\W+/-/g}}}
endsnippet
snippet par*l "Paragraph* with label" wi
\paragraph*{$1${VISUAL}}
\label{par:${2:${1/\W+/-/g}}}
endsnippet
snippet subparl "Sub Paragraph with label" wi
\subparagraph{$1${VISUAL}}
\label{subp:${2:${1/\W+/-/g}}}
endsnippet
snippet subpar*l "Sub Paragraph* with label" wi
\subparagraph*{$1${VISUAL}}
\label{subp:${2:${1/\W+/-/g}}}
endsnippet
# vim:ft=snippets:

View File

@ -3,6 +3,8 @@
# Flutter stateless widget
snippet stless
class $1 extends StatelessWidget {
const $1({super.key});
@override
Widget build(BuildContext context) {
return Container(
@ -14,8 +16,10 @@ snippet stless
# Flutter stateful widget
snippet stful
class $1 extends StatefulWidget {
const $1({super.key});
@override
_$1State createState() => _$1State();
State<$1> createState() => _$1State();
}
class _$1State extends State<$1> {
@ -30,8 +34,10 @@ snippet stful
# Flutter widget with AnimationController
snippet stanim
class $1 extends StatefulWidget {
const $1({super.key});
@override
_$1State createState() => _$1State();
State<$1> createState() => _$1State();
}
class _$1State extends State<$1>
@ -85,5 +91,3 @@ snippet fsa
);
}
}

View File

@ -0,0 +1,125 @@
snippet class
class $1 extends ${2:Reference}
\t$3
snippet pr
print($1)
snippet ready
func _ready():
\t${1:pass}
snippet init
func _init():
\t${1:pass}
snippet process
func _process(delta):
\t${1:pass}
snippet input
func _input(event):
\t${1:pass}
snippet inpute
func _input_event(event):
\t${1:pass}
snippet draw
func _draw():
\t${1:pass}
snippet guii
func _gui_input(event):
\t${1:pass}
snippet for
for $1 in $2:
\t${3:pass}
snippet for
for $1 in range(${2:start}{$3:,end}):
\t${4:pass}
snippet if
if ${1:condition}:
\t${3:pass}
elif ${2:condition}:
\t${4:pass}
else:
\t${5:pass}
snippet if
if ${1:condition}:
\t${2:pass}
else:
\t${3:pass}
snippet if
if ${1:condition}:
\t${2:pass}
snippet while
while ${1:condition}:
\t${2:pass}
snippet func
func ${1:method}(${2:args}):
\t${3:pass}
snippet signal
signal ${1:signalname}(${2:args})
snippet export
export(${1:type}${2:,other_configs}) var ${3:name}${4: = default}${5: setget }
snippet var
var ${1:name}${2: = default}${3: setget }
snippet onready
onready var ${1:name} = get_node($2)
snippet is
${1:instance} is ${2:class}
snippet in
${1:element} in ${$2:array}
snippet gdscript
extends ${1:BaseClass}
# class member variables go here, for example:
# var a = 2
# var b = \textvar\
func _ready():
\t# Called every time the node is added to the scene.
\t# Initialization here
\tpass
# snippet pass ##### do we really need this?
# pass

View File

@ -0,0 +1 @@
extends eelixir

View File

@ -0,0 +1,135 @@
# Org Mode Snippets Imported from (https://github.com/doomemacs/snippets/)
# Imported by ybenel (github.com/m1ndo)
# Begin
snippet begin
#+begin_${1:type} ${2:options}
$0
#+end_$1
# Begin Center
snippet <C
#+begin_center
$0
#+end_center
# Begin Comment
snippet <c
#+begin_comment
$0
#+end_comment
# Begin Example
snippet <e
#+begin_example
$0
#+end_example
# Begin Export Ascii
snippet <a
#+begin_export ascii
$0
#+end_export
# Begin export html
snippet <h
#+begin_export html
$0
#+end_export
# Begin export Latex
snippet <l
#+begin_export latex
$0
#+end_export
# Begin export python
snippet <p
#+begin_export python
$0
#+end_export
# Begin export shell
snippet <s
#+begin_export shell
$0
#+end_export
# dot
snippet dot
#+begin_src dot :file ${1:file}.${2:svg} :results file graphics
$0
#+end_src
# elisp
snippet elisp
#+begin_src emacs-lisp :tangle yes
$0
#+end_src
# Entry
snippet entry
#+begin_html
---
layout: ${1:default}
title: ${2:title}
---
#+end_html
$0
# Begin example
snippet ex
#+begin_example
$0
#+end_example
# Begin export
snippet export
#+begin_export ${1:type}
$0
#+end_export
# Figure
snippet fig
#+caption: ${1:caption}
#+attr_latex: ${2:scale=0.75}
#+name: fig-${3:label}
# Org Header
snippet head
#+title: ${1:untitled document}
#+author: ${2:user-full-name}
#+email: ${3:user-mail-address}
# Image
snippet img
#+attr_html: :alt $2 :align ${3:left} :class img
[[${1:src}]${4:[${5:title}]}]
$0
# Inline
snippet inl
src_${1:language}${2:[${3::exports code}]}{${4:code}}
# Inline source
snippet srci
src_${1:language}[${2:header}]{${0:body}}
# Jupyter
snippet jupyter
#+begin_src jupyter-${1:$$(yas-choose-value '("python" "julia" "R"))}${2: :session $3}${4: :async yes}
$0
#+end_src
# Matrix (latex)
snippet matrix
\left \(
\begin{array}{${1:ccc}}
${2:v1 & v2} \\
$0
\end{array}
\right \)
# Name
snippet name
#+name: $0
# Quote
snippet quote
#+begin_quote
$0
#+end_quote
# Source
snippet src
#+begin_src $1
$0
#+end_src
# Todo
snippet todo
TODO ${1:task description}
# Verse
snippet verse
#+begin_verse
$0
#+end_verse
# Atrribute Width
snippet #+attr_html:width
#+attr_html: :width ${1:500px}

View File

@ -44,6 +44,10 @@ snippet def
def ${1:method_name}
${0}
end
snippet defm
def ${1:method}
@$1 ||= ${0}
end
snippet deft
def test_${1:case_name}
${0}
@ -372,6 +376,8 @@ snippet finad
end
snippet gre
grep(${1:/pattern/}) { |${2:match}| ${0} }
snippet grepv
select { |${1:line}| $1 !~ ${2:/pattern/} }${0}
snippet sub
${1:g}sub(${2:/pattern/}) { |${3:match}| ${0} }
snippet sca