diff --git a/README.md b/README.md index 484f0c56..4b0c8c12 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Naturally, `/opt/vim_runtime` can be any directory, as long as all the users spe ## Fonts -I recommend using [IBM Plex Mono font](https://github.com/IBM/plex) (it's an open-source and awesome font that can make your code beautiful). The Awesome vimrc is already setup to try to use it. +I recommend using [IBM Plex Mono font](https://github.com/IBM/plex) (it's an open-source and awesome font that can make your code look beautiful). The Awesome vimrc is already setup to try to use it. Some other fonts that Awesome will try to use: @@ -63,8 +63,14 @@ If you have vim aliased as `vi` instead of `vim`, make sure to either alias it: Just do a git rebase! cd ~/.vim_runtime + git reset --hard + git clean -d --force git pull --rebase + python update_plugins.py # use python3 if python is unavailable +NOTE: If you get `ModuleNotFoundError: No module named 'requests'`, you must first install the `requests` python module using `pip`, `pip3`, or `easy_install`. + + pip install requests ## Some screenshots @@ -72,11 +78,7 @@ Colors when editing a Python file: ![Screenshot 1](https://dnp4pehkvoo6n.cloudfront.net/07583008e4da885801657e8781777844/as/Python%20editing.png) -Opening recently opened files with the [mru.vim](https://github.com/vim-scripts/mru.vim) plugin: - -![Screenshot 2](https://dnp4pehkvoo6n.cloudfront.net/1d49a88f9bd5d013c025bb1e1272a7d8/as/MRU%20plugin.png) - -[NERD Tree](https://github.com/scrooloose/nerdtree) plugin in a terminal window: +[NERD Tree](https://github.com/preservim/nerdtree) plugin in a terminal window: ![Screenshot 3](https://dnp4pehkvoo6n.cloudfront.net/ae719203166585d64728f28398f4b1b7/as/Terminal%20usage.png) Distraction free mode using [goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2): @@ -90,12 +92,11 @@ I recommend reading the docs of these plugins to understand them better. Each pl * [fzf.vim](https://github.com/junegunn/fzf.vim) * [goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2): * [lightline.vim](https://github.com/itchyny/lightline.vim): A light and configurable statusline/tabline for Vim -* [NERD Tree](https://github.com/scrooloose/nerdtree): A tree explorer plugin for vim -* [mru.vim](https://github.com/vim-scripts/mru.vim): Plugin to manage Most Recently Used (MRU) files. This plugin can be opened with `` +* [NERD Tree](https://github.com/preservim/nerdtree): A tree explorer plugin for vim * [open_file_under_cursor.vim](https://github.com/amix/open_file_under_cursor.vim): Open file under cursor when pressing `gf` * [pathogen.vim](https://github.com/tpope/vim-pathogen): Manage your vim runtimepath * [snipmate.vim](https://github.com/garbas/vim-snipmate): snipmate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim -* [ale](https://github.com/w0rp/ale): Syntax and lint checking for vim (async) +* [ale](https://github.com/dense-analysis/ale): Syntax and lint checking for vim (ALE requires NeoVim >= 0.2.0 or Vim 8 with +timers +job +channel) * [vim-commentary](https://github.com/tpope/vim-commentary): Comment stuff out. Use `gcc` to comment out a line (takes a count), `gc` to comment out the target of a motion. `gcu` uncomments a set of adjacent commented lines. * [vim-expand-region](https://github.com/terryma/vim-expand-region): Allows you to visually select increasingly larger regions of text using the same key combination * [vim-fugitive](https://github.com/tpope/vim-fugitive): A Git wrapper so awesome, it should be illegal @@ -103,6 +104,9 @@ I recommend reading the docs of these plugins to understand them better. Each pl * [vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors): Sublime Text style multiple selections for Vim, CTRL+N is remapped to CTRL+S (due to YankRing) * [vim-yankstack](https://github.com/maxbrunsfeld/vim-yankstack): Maintains a history of previous yanks, changes and deletes * [vim-zenroom2](https://github.com/amix/vim-zenroom2) Remove all clutter and focus only on the essential. Similar to iA Writer or Write Room +* [gist-vim](https://github.com/mattn/gist-vim) Easily create gists from Vim using the `:Gist` command +* [vim-indent-guides](https://github.com/nathanaelkane/vim-indent-guides) Is a plugin for visually displaying indent levels in Vim +* [editorconfig-vim](https://github.com/editorconfig/editorconfig-vim) EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. ### Invcluded after fork @@ -117,6 +121,7 @@ I recommend reading the docs of these plugins to understand them better. Each pl ## Included color schemes * [peaksea](https://github.com/vim-scripts/peaksea): The default +* [dracula](https://github.com/dracula/vim) * [vim-colors-solarized](https://github.com/altercation/vim-colors-solarized) * [vim-irblack](https://github.com/wgibbs/vim-irblack) * [mayansmoke](https://github.com/vim-scripts/mayansmoke) @@ -128,9 +133,13 @@ I recommend reading the docs of these plugins to understand them better. Each pl * [vim-coffee-script](https://github.com/kchmck/vim-coffee-script) * [vim-less](https://github.com/groenewege/vim-less) * [vim-bundle-mako](https://github.com/sophacles/vim-bundle-mako) -* [vim-markdown](https://github.com/tpope/vim-markdown) +* [vim-markdown](https://github.com/plasticboy/vim-markdown) * [nginx.vim](https://github.com/vim-scripts/nginx.vim): Highlights configuration files for nginx -* [vim-go](https://github.com/fatih/vim-go) +* [rust.vim](https://github.com/rust-lang/rust.vim) +* [vim-ruby](https://github.com/vim-ruby/vim-ruby) +* [typescript-vim](https://github.com/leafgarland/typescript-vim) +* [vim-javascript](https://github.com/pangloss/vim-javascript) +* [vim-python-pep8-indent](https://github.com/Vimjas/vim-python-pep8-indent) ## How to include your own stuff? @@ -146,6 +155,13 @@ You can also install your plugins, for instance, via pathogen you can install [v cd ~/.vim_runtime git clone git://github.com/tpope/vim-rails.git my_plugins/vim-rails +You can also install plugins without any plugin manager (vim 8+ required): + Add `packloadall` to your .vimrc file + Create pack plugin directory: + `mkdir -p ~/.vim/pack/plugins/start` + Clone the plugin that you want in that directory, for example: + `git clone --depth=1 git://github.com/maxmellon/vim-jsx-pretty ~/.vim/pack/plugins/vim-jsx-pretty` + ## Key Mappings @@ -176,7 +192,6 @@ Open [fzf.vim](https://github.com/junegunn/fzf.vim) `:Files` plugin to quickly f map z :Goyo - ### Normal mode mappings Fast saving of a buffer (`w`): @@ -186,7 +201,7 @@ Fast saving of a buffer (`w`): Map `` to `/` (search) and `+` to `?` (backwards search): map / - map ? + map ? map :noh Disable highlights when you press ``: @@ -217,7 +232,7 @@ Useful mappings for managing tabs: " Opens a new tab with the current buffer's path " Super useful when editing files in the same directory - map te :tabedit =expand("%:p:h")/ + map te :tabedit =expand("%:p:h")/ Switch [CWD](http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file) to the directory of the open buffer: @@ -258,7 +273,7 @@ Surround the visual selection in parenthesis/brackets/etc.: vnoremap $3 `>a}` vnoremap $$ `>a"` vnoremap $q `>a'` - vnoremap $e `>a"` + vnoremap $e `>a`` ### Insert mode mappings @@ -275,7 +290,7 @@ Quickly insert parenthesis/brackets/etc.: Insert the current date and time (useful for timestamps): - iab xdate =strftime("%d/%m/%y %H:%M:%S") + iab xdate =strftime("%d/%m/%y %H:%M:%S") ### Command line mappings @@ -298,6 +313,82 @@ Write the file as sudo (works only on Unix). Super useful when you open a file a :W +### Plugin related mappings + +Open [bufexplorer](https://github.com/vim-scripts/bufexplorer.zip) to see and manage the current buffers (`o`): + + map o :BufExplorer + +Open [ctrlp.vim](https://github.com/kien/ctrlp.vim) plugin to quickly find a file or a buffer (`j` or `f`): + + " Quickly find and open a file in the CWD + let g:ctrlp_map = '' + + " Quickly find and open a recently opened file + map f :MRU + + " Quickly find and open a buffer + map b :CtrlPBuffer + +[NERD Tree](https://github.com/preservim/nerdtree) mappings: + + map nn :NERDTreeToggle + map nb :NERDTreeFromBookmark + map nf :NERDTreeFind + +[goyo.vim](https://github.com/junegunn/goyo.vim) and [vim-zenroom2](https://github.com/amix/vim-zenroom2) lets you only focus on one thing at a time. It removes all the distractions and centers the content. It has a special look when editing Markdown, reStructuredText and textfiles. It only has one mapping. (`z`) + + map z :Goyo + +[vim-multiple-cursors](https://github.com/terryma/vim-multiple-cursors) mappings to manage multiple cursors at once: + + let g:multi_cursor_start_word_key = '' + let g:multi_cursor_select_all_word_key = '' + let g:multi_cursor_start_key = 'g' + let g:multi_cursor_select_all_key = 'g' + let g:multi_cursor_next_key = '' + let g:multi_cursor_prev_key = '' + let g:multi_cursor_skip_key = '' + let g:multi_cursor_quit_key = '' + +[vim-yankstack](https://github.com/maxbrunsfeld/vim-yankstack) mappings to manage the kill-ring (clipboard): + + nmap yankstack_substitute_older_paste + nmap yankstack_substitute_newer_paste + +[ctrl-p](https://github.com/ctrlpvim/ctrlp.vim) mappings to easily find and open a file, buffer, etc.: + + let g:ctrlp_map = '' + map j :CtrlP + map :CtrlPBuffer + +[vim-snipmate](https://github.com/garbas/vim-snipmate) mappings to autocomplete via snippets: + + ino =snipMate#TriggerSnippet() + snor i=snipMate#TriggerSnippet() + +[vim-surround](https://github.com/tpope/vim-surround) mappings to easily surround a string with `_()` gettext annotation: + + vmap Si S(i_f) + au FileType mako vmap Si S"i${ _(2f"a) } + +[ale](https://github.com/dense-analysis/ale) to easily go to the next Ale syntax/lint error: + + nmap a (ale_next_wrap) + +[vim-indent-guides](https://github.com/nathanaelkane/vim-indent-guides) the default mapping to toggle the plugin is (`ig`) + + You can also use the following commands inside Vim: + :IndentGuidesEnable + :IndentGuidesDisable + :IndentGuidesToggle + +[vim-fugitive](https://github.com/tpope/vim-fugitive) to copy the link to the line of a Git repository to the clipboard: + + nnoremap v :.GBrowse! + xnoremap v :'<'>GBrowse! + + ### Spell checking Pressing `ss` will toggle spell checking: @@ -310,6 +401,13 @@ Shortcuts using `` instead of special characters: map sa zg map s? z= +### Running Code +To run code directly from vim, press `F5`. The currently open code will execute without you having to type anything. + +Can be used to execute code written in C, C++, Java, Python, Go, Octave, Bash scripts and HTML. To edit how you want your code to be executed, make changes in the file +``` +~/.vim_runtime/vimrcs/extended.vim +``` ### Cope Query `:help cope` if you are unsure what cope is. It's super useful! @@ -335,3 +433,11 @@ Cope mappings: Just do following: * Remove `~/.vim_runtime` * Remove any lines that reference `.vim_runtime` in your `~/.vimrc` + + +## Looking for a remote-first job? + +Maintaining this Vim configuration isn't my day job. Daily I am the founder/CEO of [Doist](https://doist.com/). You could come and help us build the workplace of the future while living a balanced life (anywhere in the world ๐ŸŒ๐ŸŒŽ๐ŸŒ). + +PS: Using Vim isn't a requirement ๐Ÿ˜„ + diff --git a/install_awesome_parameterized.sh b/install_awesome_parameterized.sh index d83f6dc6..1ca2ba5f 100755 --- a/install_awesome_parameterized.sh +++ b/install_awesome_parameterized.sh @@ -4,7 +4,10 @@ set -e echo 'Installing Awesome Vim from '$1 cd $1 -VIMRC="set runtimepath+=$1 +VIMRC="\" DO NOT EDIT THIS FILE +\" Add your own customizations in $1/my_configs.vim + +set runtimepath+=$1 source $1/vimrcs/basic.vim source $1/vimrcs/filetypes.vim @@ -12,13 +15,13 @@ source $1/vimrcs/plugins_config.vim source $1/vimrcs/extended.vim try -source $1/my_configs.vim + source $1/my_configs.vim catch endtry" -if [ $2 == "--all" ]; then - USERS=($(ls -l /home | awk '{if(NR>1)print $9}')) - for user in ${USERS[*]}; do +if [ "$2" = "--all" ]; then + USERS=$(ls -l /home | awk '{if(NR>1)print $9}') + for user in $USERS; do homepath=$(eval echo "~$user") IFS='' echo $VIMRC > ${homepath}/.vimrc @@ -28,9 +31,9 @@ if [ $2 == "--all" ]; then echo "Installed the Ultimate Vim configuration successfully! Enjoy :-)" exit 0 else - SELECTED_USERS=(${@:2}) - echo "Selected users: ${SELECTED_USERS[@]}" - for user in ${SELECTED_USERS[@]}; do + SELECTED_USERS=${@:2} + echo "Selected users: $SELECTED_USERS" + for user in $SELECTED_USERS; do homepath=$(eval echo "~$user") IFS='' echo $VIMRC > ${homepath}/.vimrc diff --git a/install_awesome_vimrc.sh b/install_awesome_vimrc.sh old mode 100644 new mode 100755 index 70130419..eb59a3ce --- a/install_awesome_vimrc.sh +++ b/install_awesome_vimrc.sh @@ -3,15 +3,17 @@ set -e cd ~/.vim_runtime -echo 'set runtimepath+=~/.vim_runtime +echo '" DO NOT EDIT THIS FILE +" Add your own customizations in ~/.vim_runtime/my_configs.vim + +set runtimepath+=~/.vim_runtime source ~/.vim_runtime/vimrcs/basic.vim source ~/.vim_runtime/vimrcs/filetypes.vim source ~/.vim_runtime/vimrcs/plugins_config.vim source ~/.vim_runtime/vimrcs/extended.vim - try -source ~/.vim_runtime/my_configs.vim + source ~/.vim_runtime/my_configs.vim catch endtry' > ~/.vimrc diff --git a/install_basic_vimrc.sh b/install_basic_vimrc.sh old mode 100644 new mode 100755 diff --git a/sources_forked/peaksea/colors/peaksea.vim b/sources_forked/peaksea/colors/peaksea.vim index 06924bc1..da2fdef7 100644 --- a/sources_forked/peaksea/colors/peaksea.vim +++ b/sources_forked/peaksea/colors/peaksea.vim @@ -281,7 +281,7 @@ elseif &background=='dark' hi ModeMsg guifg=fg guibg=#000080 gui=NONE hi VisualNOS guifg=fg guibg=#000080 gui=NONE hi SpecialKey guifg=#b0d0f0 guibg=NONE gui=NONE - hi NonText guifg=#202020 guibg=#202020 gui=NONE + hi NonText guifg=#6080f0 guibg=#101010 gui=NONE hi Directory guifg=#80c0e0 guibg=NONE gui=NONE hi ErrorMsg guifg=#d0d090 guibg=#800000 gui=NONE hi MoreMsg guifg=#c0e080 guibg=NONE gui=NONE diff --git a/sources_non_forked/ale/LICENSE b/sources_non_forked/ale/LICENSE index 739ccae0..471776e4 100644 --- a/sources_non_forked/ale/LICENSE +++ b/sources_non_forked/ale/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016-2018, w0rp +Copyright (c) 2016-2020, w0rp All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sources_non_forked/ale/ale_linters/ada/adals.vim b/sources_non_forked/ale/ale_linters/ada/adals.vim new file mode 100644 index 00000000..9a41e1df --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ada/adals.vim @@ -0,0 +1,26 @@ +" Author: Bartek Jasicki http://github.com/thindil +" Description: Support for Ada Language Server + +call ale#Set('ada_adals_executable', 'ada_language_server') +call ale#Set('ada_adals_project', 'default.gpr') +call ale#Set('ada_adals_encoding', 'utf-8') + +function! ale_linters#ada#adals#GetAdaLSConfig(buffer) abort + return { + \ 'ada.projectFile': ale#Var(a:buffer, 'ada_adals_project'), + \ 'ada.defaultCharset': ale#Var(a:buffer, 'ada_adals_encoding') + \} +endfunction + +function! ale_linters#ada#adals#GetRootDirectory(buffer) abort + return fnamemodify(bufname(a:buffer), ':p:h') +endfunction + +call ale#linter#Define('ada', { +\ 'name': 'adals', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'ada_adals_executable')}, +\ 'command': '%e', +\ 'project_root': function('ale_linters#ada#adals#GetRootDirectory'), +\ 'lsp_config': function('ale_linters#ada#adals#GetAdaLSConfig') +\}) diff --git a/sources_non_forked/ale/ale_linters/ada/gcc.vim b/sources_non_forked/ale/ale_linters/ada/gcc.vim index 87496b81..5afc9ae3 100644 --- a/sources_non_forked/ale/ale_linters/ada/gcc.vim +++ b/sources_non_forked/ale/ale_linters/ada/gcc.vim @@ -18,7 +18,7 @@ function! ale_linters#ada#gcc#GetCommand(buffer) abort " -gnatc: Check syntax and semantics only (no code generation attempted) return '%e -x ada -c -gnatc' \ . ' -o ' . ale#Escape(l:out_file) - \ . ' -I ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) + \ . ' -I %s:h' \ . ale#Pad(ale#Var(a:buffer, 'ada_gcc_options')) \ . ' %t' endfunction diff --git a/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim b/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim index c4affa31..3b443369 100644 --- a/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim +++ b/sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim @@ -1,4 +1,4 @@ -" Author: Bjorn Neergaard +" Authors: Bjorn Neergaard , Vytautas Macionis " Description: ansible-lint for ansible-yaml files call ale#Set('ansible_ansible_lint_executable', 'ansible-lint') @@ -7,7 +7,7 @@ function! ale_linters#ansible#ansible_lint#GetExecutable(buffer) abort return ale#Var(a:buffer, 'ansible_ansible_lint_executable') endfunction -function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort +function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort for l:line in a:lines[:10] if match(l:line, '^Traceback') >= 0 return [{ @@ -18,39 +18,87 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort endif endfor - " Matches patterns line the following: - " - " test.yml:35: [EANSIBLE0002] Trailing whitespace - let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: \[?([[:alnum:]]+)\]? (.*)$' + let l:version_group = ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' : '<5.0.0' let l:output = [] - for l:match in ale#util#GetMatches(a:lines, l:pattern) - let l:code = l:match[4] + if '>=5.0.0' is# l:version_group + " Matches patterns line the following: + " test.yml:3:148: syntax-check 'var' is not a valid attribute for a Play + " roles/test/tasks/test.yml:8: [package-latest] [VERY_LOW] Package installs should not use latest + " D:\test\tasks\test.yml:8: [package-latest] [VERY_LOW] package installs should not use latest + let l:pattern = '\v^(%([a-zA-Z]:)?[^:]+):(\d+):%((\d+):)? %(\[([-[:alnum:]]+)\]) %(\[([_[:alnum:]]+)\]) (.*)$' + let l:error_codes = { 'VERY_HIGH': 'E', 'HIGH': 'E', 'MEDIUM': 'W', 'LOW': 'W', 'VERY_LOW': 'W', 'INFO': 'I' } - if l:code is# 'EANSIBLE0002' - \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') - " Skip warnings for trailing whitespace if the option is off. - continue - endif + for l:match in ale#util#GetMatches(a:lines, l:pattern) + if ale#path#IsBufferPath(a:buffer, l:match[1]) + call add(l:output, { + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'text': l:match[6], + \ 'code': l:match[4], + \ 'type': l:error_codes[l:match[5]], + \}) + endif + endfor + endif - if ale#path#IsBufferPath(a:buffer, l:match[1]) - call add(l:output, { - \ 'lnum': l:match[2] + 0, - \ 'col': l:match[3] + 0, - \ 'text': l:match[5], - \ 'code': l:code, - \ 'type': l:code[:0] is# 'E' ? 'E' : 'W', - \}) - endif - endfor + if '<5.0.0' is# l:version_group + " Matches patterns line the following: + " test.yml:35: [EANSIBLE0002] Trailing whitespace + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: \[?([[:alnum:]]+)\]? (.*)$' + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:code = l:match[4] + + if l:code is# 'EANSIBLE0002' + \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + " Skip warnings for trailing whitespace if the option is off. + continue + endif + + if ale#path#IsBufferPath(a:buffer, l:match[1]) + call add(l:output, { + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'text': l:match[5], + \ 'code': l:code, + \ 'type': l:code[:0] is# 'E' ? 'E' : 'W', + \}) + endif + endfor + endif return l:output endfunction +function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort + let l:commands = { + \ '>=5.0.0': '%e --nocolor --parseable-severity -x yaml %s', + \ '<5.0.0': '%e --nocolor -p %t' + \} + let l:command = ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] : l:commands['<5.0.0'] + + return l:command +endfunction + call ale#linter#Define('ansible', { \ 'name': 'ansible_lint', \ 'aliases': ['ansible', 'ansible-lint'], \ 'executable': function('ale_linters#ansible#ansible_lint#GetExecutable'), -\ 'command': '%e -p %t', -\ 'callback': 'ale_linters#ansible#ansible_lint#Handle', +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale_linters#ansible#ansible_lint#GetExecutable(buffer), +\ '%e --version', +\ function('ale_linters#ansible#ansible_lint#GetCommand'), +\ )}, +\ 'lint_file': 1, +\ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale_linters#ansible#ansible_lint#GetExecutable(buffer), +\ '%e --version', +\ {buffer, version -> ale_linters#ansible#ansible_lint#Handle( +\ buffer, +\ l:version, +\ lines)}, +\ )}, \}) diff --git a/sources_non_forked/ale/ale_linters/apkbuild/apkbuild_lint.vim b/sources_non_forked/ale/ale_linters/apkbuild/apkbuild_lint.vim new file mode 100644 index 00000000..285f5534 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/apkbuild/apkbuild_lint.vim @@ -0,0 +1,12 @@ +" Author: Leo +" Description: apkbuild-lint from atools linter for APKBUILDs + +call ale#Set('apkbuild_apkbuild_lint_executable', 'apkbuild-lint') + +call ale#linter#Define('apkbuild', { +\ 'name': 'apkbuild_lint', +\ 'output_stream': 'stdout', +\ 'executable': {b -> ale#Var(b, 'apkbuild_apkbuild_lint_executable')}, +\ 'command': '%e %t', +\ 'callback': 'ale#handlers#atools#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/apkbuild/secfixes_check.vim b/sources_non_forked/ale/ale_linters/apkbuild/secfixes_check.vim new file mode 100644 index 00000000..c65267fd --- /dev/null +++ b/sources_non_forked/ale/ale_linters/apkbuild/secfixes_check.vim @@ -0,0 +1,12 @@ +" Author: Leo +" Description: secfixes-check from atools linter for APKBUILDs + +call ale#Set('apkbuild_secfixes_check_executable', 'secfixes-check') + +call ale#linter#Define('apkbuild', { +\ 'name': 'secfixes_check', +\ 'output_stream': 'stdout', +\ 'executable': {b -> ale#Var(b, 'apkbuild_secfixes_check_executable')}, +\ 'command': '%e %t', +\ 'callback': 'ale#handlers#atools#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/asciidoc/languagetool.vim b/sources_non_forked/ale/ale_linters/asciidoc/languagetool.vim new file mode 100644 index 00000000..8e8de7f3 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/asciidoc/languagetool.vim @@ -0,0 +1,5 @@ +" Author: Horacio Sanson (hsanson [รคt] gmail.com) +" Description: languagetool for asciidoc files, copied from markdown. + + +call ale#handlers#languagetool#DefineLinter('asciidoc') diff --git a/sources_non_forked/ale/ale_linters/asm/gcc.vim b/sources_non_forked/ale/ale_linters/asm/gcc.vim index 72b293c0..cda38923 100644 --- a/sources_non_forked/ale/ale_linters/asm/gcc.vim +++ b/sources_non_forked/ale/ale_linters/asm/gcc.vim @@ -5,8 +5,11 @@ call ale#Set('asm_gcc_executable', 'gcc') call ale#Set('asm_gcc_options', '-Wall') function! ale_linters#asm#gcc#GetCommand(buffer) abort - return '%e -x assembler -fsyntax-only ' - \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) + " `-o /dev/null` or `-o null` is needed to catch all errors, + " -fsyntax-only doesn't catch everything. + return '%e -x assembler' + \ . ' -o ' . g:ale#util#nul_file + \ . '-iquote %s:h' \ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -' endfunction diff --git a/sources_non_forked/ale/ale_linters/bats/shellcheck.vim b/sources_non_forked/ale/ale_linters/bats/shellcheck.vim new file mode 100644 index 00000000..5c2a0ea9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/bats/shellcheck.vim @@ -0,0 +1,4 @@ +" Author: Ian2020 +" Description: shellcheck linter for bats scripts. + +call ale#handlers#shellcheck#DefineLinter('bats') diff --git a/sources_non_forked/ale/ale_linters/bib/bibclean.vim b/sources_non_forked/ale/ale_linters/bib/bibclean.vim index 9056a9c3..f1610e00 100644 --- a/sources_non_forked/ale/ale_linters/bib/bibclean.vim +++ b/sources_non_forked/ale/ale_linters/bib/bibclean.vim @@ -18,7 +18,12 @@ function! ale_linters#bib#bibclean#get_type(str) abort endfunction function! ale_linters#bib#bibclean#match_msg(line) abort - return matchlist(a:line, '^\(.*\) "stdin", line \(.*\): \(.*\)$') + " Legacy message pattern works for bibclean <= v2.11.4. If empty, try + " the new message pattern for bibtex > v2.11.4 + let l:matches_legacy = matchlist(a:line, '^\(.*\) "stdin", line \(\d\+\): \(.*\)$') + + return ! empty(l:matches_legacy) ? l:matches_legacy + \ : matchlist(a:line, '^\(.*\) stdin:\(\d\+\):\(.*\)$') endfunction function! ale_linters#bib#bibclean#match_entry(line) abort diff --git a/sources_non_forked/ale/ale_linters/c/cc.vim b/sources_non_forked/ale/ale_linters/c/cc.vim new file mode 100644 index 00000000..5655fbf7 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/c/cc.vim @@ -0,0 +1,53 @@ +" Author: w0rp +" Description: A C compiler linter for C files with gcc/clang, etc. + +call ale#Set('c_cc_executable', '') +call ale#Set('c_cc_options', '-std=c11 -Wall') + +function! ale_linters#c#cc#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'c_cc_executable') + + " Default to either clang or gcc. + if l:executable is# '' + if ale#engine#IsExecutable(a:buffer, 'clang') + let l:executable = 'clang' + else + let l:executable = 'gcc' + endif + endif + + return l:executable +endfunction + +function! ale_linters#c#cc#GetCommand(buffer, output) abort + let l:cflags = ale#c#GetCFlags(a:buffer, a:output) + let l:ale_flags = ale#Var(a:buffer, 'c_cc_options') + + if l:cflags =~# '-std=' + let l:ale_flags = substitute( + \ l:ale_flags, + \ '-std=\(c\|gnu\)[0-9]\{2\}', + \ '', + \ 'g') + endif + + " -iquote with the directory the file is in makes #include work for + " headers in the same directory. + " + " `-o /dev/null` or `-o null` is needed to catch all errors, + " -fsyntax-only doesn't catch everything. + return '%e -S -x c' + \ . ' -o ' . g:ale#util#nul_file + \ . ' -iquote %s:h' + \ . ale#Pad(l:cflags) + \ . ale#Pad(l:ale_flags) . ' -' +endfunction + +call ale#linter#Define('c', { +\ 'name': 'cc', +\ 'aliases': ['gcc', 'clang'], +\ 'output_stream': 'stderr', +\ 'executable': function('ale_linters#c#cc#GetExecutable'), +\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#cc#GetCommand'))}, +\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', +\}) diff --git a/sources_non_forked/ale/ale_linters/c/ccls.vim b/sources_non_forked/ale/ale_linters/c/ccls.vim index 9e3dafe9..9f105712 100644 --- a/sources_non_forked/ale/ale_linters/c/ccls.vim +++ b/sources_non_forked/ale/ale_linters/c/ccls.vim @@ -3,6 +3,7 @@ call ale#Set('c_ccls_executable', 'ccls') call ale#Set('c_ccls_init_options', {}) +call ale#Set('c_build_dir', '') call ale#linter#Define('c', { \ 'name': 'ccls', @@ -10,5 +11,5 @@ call ale#linter#Define('c', { \ 'executable': {b -> ale#Var(b, 'c_ccls_executable')}, \ 'command': '%e', \ 'project_root': function('ale#handlers#ccls#GetProjectRoot'), -\ 'initialization_options': {b -> ale#Var(b, 'c_ccls_init_options')}, +\ 'initialization_options': {b -> ale#handlers#ccls#GetInitOpts(b, 'c_ccls_init_options')}, \}) diff --git a/sources_non_forked/ale/ale_linters/c/clang.vim b/sources_non_forked/ale/ale_linters/c/clang.vim deleted file mode 100644 index 5b243bfe..00000000 --- a/sources_non_forked/ale/ale_linters/c/clang.vim +++ /dev/null @@ -1,27 +0,0 @@ -" Author: Masahiro H https://github.com/mshr-h -" Description: clang linter for c files - -call ale#Set('c_clang_executable', 'clang') -call ale#Set('c_clang_options', '-std=c11 -Wall') - -function! ale_linters#c#clang#GetCommand(buffer, output) abort - let l:cflags = ale#c#GetCFlags(a:buffer, a:output) - - " -iquote with the directory the file is in makes #include work for - " headers in the same directory. - return '%e -S -x c -fsyntax-only' - \ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) - \ . ale#Pad(l:cflags) - \ . ale#Pad(ale#Var(a:buffer, 'c_clang_options')) . ' -' -endfunction - -call ale#linter#Define('c', { -\ 'name': 'clang', -\ 'output_stream': 'stderr', -\ 'executable': {b -> ale#Var(b, 'c_clang_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#c#clang#GetCommand'} -\ ], -\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', -\}) diff --git a/sources_non_forked/ale/ale_linters/c/clangd.vim b/sources_non_forked/ale/ale_linters/c/clangd.vim index 918eadcc..c42d4497 100644 --- a/sources_non_forked/ale/ale_linters/c/clangd.vim +++ b/sources_non_forked/ale/ale_linters/c/clangd.vim @@ -3,15 +3,14 @@ call ale#Set('c_clangd_executable', 'clangd') call ale#Set('c_clangd_options', '') - -function! ale_linters#c#clangd#GetProjectRoot(buffer) abort - let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') - - return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' -endfunction +call ale#Set('c_build_dir', '') function! ale_linters#c#clangd#GetCommand(buffer) abort - return '%e' . ale#Pad(ale#Var(a:buffer, 'c_clangd_options')) + let l:build_dir = ale#c#GetBuildDirectory(a:buffer) + + return '%e' + \ . ale#Pad(ale#Var(a:buffer, 'c_clangd_options')) + \ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '') endfunction call ale#linter#Define('c', { @@ -19,5 +18,5 @@ call ale#linter#Define('c', { \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'c_clangd_executable')}, \ 'command': function('ale_linters#c#clangd#GetCommand'), -\ 'project_root': function('ale_linters#c#clangd#GetProjectRoot'), +\ 'project_root': function('ale#c#FindProjectRoot'), \}) diff --git a/sources_non_forked/ale/ale_linters/c/clangtidy.vim b/sources_non_forked/ale/ale_linters/c/clangtidy.vim index 6484f8af..553cc23b 100644 --- a/sources_non_forked/ale/ale_linters/c/clangtidy.vim +++ b/sources_non_forked/ale/ale_linters/c/clangtidy.vim @@ -11,22 +11,32 @@ call ale#Set('c_clangtidy_executable', 'clang-tidy') " http://clang.llvm.org/extra/clang-tidy/checks/list.html call ale#Set('c_clangtidy_checks', []) -" Set this option to manually set some options for clang-tidy. +" Set this option to manually set some options for clang-tidy to use as compile +" flags. " This will disable compile_commands.json detection. call ale#Set('c_clangtidy_options', '') +" Set this option to manually set options for clang-tidy directly. +call ale#Set('c_clangtidy_extra_options', '') call ale#Set('c_build_dir', '') -function! ale_linters#c#clangtidy#GetCommand(buffer) abort +function! ale_linters#c#clangtidy#GetCommand(buffer, output) abort let l:checks = join(ale#Var(a:buffer, 'c_clangtidy_checks'), ',') let l:build_dir = ale#c#GetBuildDirectory(a:buffer) + let l:options = '' " Get the extra options if we couldn't find a build directory. - let l:options = empty(l:build_dir) - \ ? ale#Var(a:buffer, 'c_clangtidy_options') - \ : '' + if empty(l:build_dir) + let l:options = ale#Var(a:buffer, 'c_clangtidy_options') + let l:cflags = ale#c#GetCFlags(a:buffer, a:output) + let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags + endif + + " Get the options to pass directly to clang-tidy + let l:extra_options = ale#Var(a:buffer, 'c_clangtidy_extra_options') return '%e' \ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '') + \ . (!empty(l:extra_options) ? ' ' . ale#Escape(l:extra_options) : '') \ . ' %s' \ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '') \ . (!empty(l:options) ? ' -- ' . l:options : '') @@ -36,7 +46,7 @@ call ale#linter#Define('c', { \ 'name': 'clangtidy', \ 'output_stream': 'stdout', \ 'executable': {b -> ale#Var(b, 'c_clangtidy_executable')}, -\ 'command': function('ale_linters#c#clangtidy#GetCommand'), +\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#clangtidy#GetCommand'))}, \ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \ 'lint_file': 1, \}) diff --git a/sources_non_forked/ale/ale_linters/c/cppcheck.vim b/sources_non_forked/ale/ale_linters/c/cppcheck.vim index 851f9f11..28c2861f 100644 --- a/sources_non_forked/ale/ale_linters/c/cppcheck.vim +++ b/sources_non_forked/ale/ale_linters/c/cppcheck.vim @@ -5,23 +5,17 @@ call ale#Set('c_cppcheck_executable', 'cppcheck') call ale#Set('c_cppcheck_options', '--enable=style') function! ale_linters#c#cppcheck#GetCommand(buffer) abort - " Search upwards from the file for compile_commands.json. - " - " If we find it, we'll `cd` to where the compile_commands.json file is, - " then use the file to set up import paths, etc. - let l:compile_commmands_path = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') - - let l:cd_command = !empty(l:compile_commmands_path) - \ ? ale#path#CdString(fnamemodify(l:compile_commmands_path, ':h')) - \ : '' - let l:compile_commands_option = !empty(l:compile_commmands_path) - \ ? '--project=compile_commands.json ' + let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer) + let l:buffer_path_include = empty(l:compile_commands_option) + \ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer) \ : '' + let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') - return l:cd_command - \ . '%e -q --language=c ' - \ . l:compile_commands_option - \ . ale#Var(a:buffer, 'c_cppcheck_options') + return '%e -q --language=c' + \ . l:template + \ . ale#Pad(l:compile_commands_option) + \ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options')) + \ . l:buffer_path_include \ . ' %t' endfunction @@ -29,6 +23,7 @@ call ale#linter#Define('c', { \ 'name': 'cppcheck', \ 'output_stream': 'both', \ 'executable': {b -> ale#Var(b, 'c_cppcheck_executable')}, +\ 'cwd': function('ale#handlers#cppcheck#GetCwd'), \ 'command': function('ale_linters#c#cppcheck#GetCommand'), \ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat', \}) diff --git a/sources_non_forked/ale/ale_linters/c/cquery.vim b/sources_non_forked/ale/ale_linters/c/cquery.vim index d2be9cd9..ff0f34af 100644 --- a/sources_non_forked/ale/ale_linters/c/cquery.vim +++ b/sources_non_forked/ale/ale_linters/c/cquery.vim @@ -5,13 +5,15 @@ call ale#Set('c_cquery_executable', 'cquery') call ale#Set('c_cquery_cache_directory', expand('~/.cache/cquery')) function! ale_linters#c#cquery#GetProjectRoot(buffer) abort - let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') + " Try to find cquery configuration files first. + let l:config = ale#path#FindNearestFile(a:buffer, '.cquery') - if empty(l:project_root) - let l:project_root = ale#path#FindNearestFile(a:buffer, '.cquery') + if !empty(l:config) + return fnamemodify(l:config, ':h') endif - return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' + " Fall back on default project root detection. + return ale#c#FindProjectRoot(a:buffer) endfunction function! ale_linters#c#cquery#GetInitializationOptions(buffer) abort diff --git a/sources_non_forked/ale/ale_linters/c/gcc.vim b/sources_non_forked/ale/ale_linters/c/gcc.vim deleted file mode 100644 index ccb1912b..00000000 --- a/sources_non_forked/ale/ale_linters/c/gcc.vim +++ /dev/null @@ -1,27 +0,0 @@ -" Author: w0rp -" Description: gcc linter for c files - -call ale#Set('c_gcc_executable', 'gcc') -call ale#Set('c_gcc_options', '-std=c11 -Wall') - -function! ale_linters#c#gcc#GetCommand(buffer, output) abort - let l:cflags = ale#c#GetCFlags(a:buffer, a:output) - - " -iquote with the directory the file is in makes #include work for - " headers in the same directory. - return '%e -S -x c -fsyntax-only' - \ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) - \ . ale#Pad(l:cflags) - \ . ale#Pad(ale#Var(a:buffer, 'c_gcc_options')) . ' -' -endfunction - -call ale#linter#Define('c', { -\ 'name': 'gcc', -\ 'output_stream': 'stderr', -\ 'executable': {b -> ale#Var(b, 'c_gcc_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#c#gcc#GetCommand'} -\ ], -\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', -\}) diff --git a/sources_non_forked/ale/ale_linters/chef/cookstyle.vim b/sources_non_forked/ale/ale_linters/chef/cookstyle.vim new file mode 100644 index 00000000..50bae2aa --- /dev/null +++ b/sources_non_forked/ale/ale_linters/chef/cookstyle.vim @@ -0,0 +1,54 @@ +" Author: Raphael Hoegger - https://github.com/pfuender +" Description: Cookstyle (RuboCop based), a code style analyzer for Ruby files + +call ale#Set('chef_cookstyle_executable', 'cookstyle') +call ale#Set('chef_cookstyle_options', '') + +function! ale_linters#chef#cookstyle#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'chef_cookstyle_options') + + return '%e' . ale#Pad(escape(l:options, '~')) . ' --force-exclusion --format json --stdin ' . ' %s' +endfunction + +function! ale_linters#chef#cookstyle#Handle(buffer, lines) abort + if len(a:lines) == 0 + return [] + endif + + let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], {}) + + if !has_key(l:errors, 'summary') + \|| l:errors['summary']['offense_count'] == 0 + \|| empty(l:errors['files']) + return [] + endif + + let l:output = [] + + for l:error in l:errors['files'][0]['offenses'] + let l:start_col = str2nr(l:error['location']['start_column']) + let l:end_col = str2nr(l:error['location']['last_column']) + + if !l:end_col + let l:end_col = l:start_col + 1 + endif + + call add(l:output, { + \ 'lnum': str2nr(l:error['location']['line']), + \ 'col': l:start_col, + \ 'end_col': l:end_col, + \ 'code': l:error['cop_name'], + \ 'text': l:error['message'], + \ 'type': l:error['severity'] is? 'convention' ? 'W' : 'E', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('chef', { +\ 'name': 'cookstyle', +\ 'executable': {b -> ale#Var(b, 'chef_cookstyle_executable')}, +\ 'command': function('ale_linters#chef#cookstyle#GetCommand'), +\ 'callback': 'ale_linters#chef#cookstyle#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim b/sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim new file mode 100644 index 00000000..a023f8b6 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/clojure/clj_kondo.vim @@ -0,0 +1,46 @@ +" Author: Masashi Iizuka +" Description: linter for clojure using clj-kondo https://github.com/borkdude/clj-kondo + +call ale#Set('clojure_clj_kondo_options', '--cache') + +function! ale_linters#clojure#clj_kondo#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'clojure_clj_kondo_options') + + let l:command = 'clj-kondo' + \ . ale#Pad(l:options) + \ . ' --lint %t' + + return l:command +endfunction + +function! ale_linters#clojure#clj_kondo#HandleCljKondoFormat(buffer, lines) abort + " output format + " ::: : + let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+)?:(\d+)?:? ((Exception|error|warning): ?(.+))$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:type = 'E' + + if l:match[4] is? 'warning' + let l:type = 'W' + endif + + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[3], + \ 'type': l:type, + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('clojure', { +\ 'name': 'clj-kondo', +\ 'output_stream': 'stdout', +\ 'executable': 'clj-kondo', +\ 'command': function('ale_linters#clojure#clj_kondo#GetCommand'), +\ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat', +\}) diff --git a/sources_non_forked/ale/ale_linters/cloudformation/cfn_python_lint.vim b/sources_non_forked/ale/ale_linters/cloudformation/cfn_python_lint.vim index d0ac7b28..16841431 100644 --- a/sources_non_forked/ale/ale_linters/cloudformation/cfn_python_lint.vim +++ b/sources_non_forked/ale/ale_linters/cloudformation/cfn_python_lint.vim @@ -29,6 +29,7 @@ endfunction call ale#linter#Define('cloudformation', { \ 'name': 'cloudformation', +\ 'aliases': ['cfn-lint'], \ 'executable': 'cfn-lint', \ 'command': 'cfn-lint --template %t --format parseable', \ 'callback': 'ale_linters#cloudformation#cfn_python_lint#Handle', diff --git a/sources_non_forked/ale/ale_linters/cpp/cc.vim b/sources_non_forked/ale/ale_linters/cpp/cc.vim new file mode 100644 index 00000000..ffb8f068 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cpp/cc.vim @@ -0,0 +1,53 @@ +" Author: w0rp +" Description: A C++ compiler linter for C++ files with gcc/clang, etc. + +call ale#Set('cpp_cc_executable', '') +call ale#Set('cpp_cc_options', '-std=c++14 -Wall') + +function! ale_linters#cpp#cc#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'cpp_cc_executable') + + " Default to either clang++ or gcc. + if l:executable is# '' + if ale#engine#IsExecutable(a:buffer, 'clang++') + let l:executable = 'clang++' + else + let l:executable = 'gcc' + endif + endif + + return l:executable +endfunction + +function! ale_linters#cpp#cc#GetCommand(buffer, output) abort + let l:cflags = ale#c#GetCFlags(a:buffer, a:output) + let l:ale_flags = ale#Var(a:buffer, 'cpp_cc_options') + + if l:cflags =~# '-std=' + let l:ale_flags = substitute( + \ l:ale_flags, + \ '-std=\(c\|gnu\)++[0-9]\{2\}', + \ '', + \ 'g') + endif + + " -iquote with the directory the file is in makes #include work for + " headers in the same directory. + " + " `-o /dev/null` or `-o null` is needed to catch all errors, + " -fsyntax-only doesn't catch everything. + return '%e -S -x c++' + \ . ' -o ' . g:ale#util#nul_file + \ . ' -iquote %s:h' + \ . ale#Pad(l:cflags) + \ . ale#Pad(l:ale_flags) . ' -' +endfunction + +call ale#linter#Define('cpp', { +\ 'name': 'cc', +\ 'aliases': ['gcc', 'clang', 'g++', 'clang++'], +\ 'output_stream': 'stderr', +\ 'executable': function('ale_linters#cpp#cc#GetExecutable'), +\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#cc#GetCommand'))}, +\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', +\}) diff --git a/sources_non_forked/ale/ale_linters/cpp/ccls.vim b/sources_non_forked/ale/ale_linters/cpp/ccls.vim index b265ff70..38f8df9c 100644 --- a/sources_non_forked/ale/ale_linters/cpp/ccls.vim +++ b/sources_non_forked/ale/ale_linters/cpp/ccls.vim @@ -3,6 +3,7 @@ call ale#Set('cpp_ccls_executable', 'ccls') call ale#Set('cpp_ccls_init_options', {}) +call ale#Set('c_build_dir', '') call ale#linter#Define('cpp', { \ 'name': 'ccls', @@ -10,5 +11,5 @@ call ale#linter#Define('cpp', { \ 'executable': {b -> ale#Var(b, 'cpp_ccls_executable')}, \ 'command': '%e', \ 'project_root': function('ale#handlers#ccls#GetProjectRoot'), -\ 'initialization_options': {b -> ale#Var(b, 'cpp_ccls_init_options')}, +\ 'initialization_options': {b -> ale#handlers#ccls#GetInitOpts(b, 'cpp_ccls_init_options')}, \}) diff --git a/sources_non_forked/ale/ale_linters/cpp/clang.vim b/sources_non_forked/ale/ale_linters/cpp/clang.vim deleted file mode 100644 index 5a465812..00000000 --- a/sources_non_forked/ale/ale_linters/cpp/clang.vim +++ /dev/null @@ -1,27 +0,0 @@ -" Author: Tomota Nakamura -" Description: clang linter for cpp files - -call ale#Set('cpp_clang_executable', 'clang++') -call ale#Set('cpp_clang_options', '-std=c++14 -Wall') - -function! ale_linters#cpp#clang#GetCommand(buffer, output) abort - let l:cflags = ale#c#GetCFlags(a:buffer, a:output) - - " -iquote with the directory the file is in makes #include work for - " headers in the same directory. - return '%e -S -x c++ -fsyntax-only' - \ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) - \ . ale#Pad(l:cflags) - \ . ale#Pad(ale#Var(a:buffer, 'cpp_clang_options')) . ' -' -endfunction - -call ale#linter#Define('cpp', { -\ 'name': 'clang', -\ 'output_stream': 'stderr', -\ 'executable': {b -> ale#Var(b, 'cpp_clang_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#cpp#clang#GetCommand'}, -\ ], -\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', -\}) diff --git a/sources_non_forked/ale/ale_linters/cpp/clangcheck.vim b/sources_non_forked/ale/ale_linters/cpp/clangcheck.vim index b511a413..4cb04864 100644 --- a/sources_non_forked/ale/ale_linters/cpp/clangcheck.vim +++ b/sources_non_forked/ale/ale_linters/cpp/clangcheck.vim @@ -12,14 +12,15 @@ function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort let l:build_dir = ale#Var(a:buffer, 'c_build_dir') if empty(l:build_dir) - let l:build_dir = ale#path#Dirname(ale#c#FindCompileCommands(a:buffer)) + let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer) + let l:build_dir = ale#path#Dirname(l:json_file) endif " The extra arguments in the command are used to prevent .plist files from " being generated. These are only added if no build directory can be " detected. return '%e -analyze %s' - \ . (empty(l:build_dir) ? ' -extra-arg -Xclang -extra-arg -analyzer-output=text' : '') + \ . (empty(l:build_dir) ? ' --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics': '') \ . ale#Pad(l:user_options) \ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '') endfunction diff --git a/sources_non_forked/ale/ale_linters/cpp/clangd.vim b/sources_non_forked/ale/ale_linters/cpp/clangd.vim index 4a8ff4f6..14f3fe55 100644 --- a/sources_non_forked/ale/ale_linters/cpp/clangd.vim +++ b/sources_non_forked/ale/ale_linters/cpp/clangd.vim @@ -3,15 +3,14 @@ call ale#Set('cpp_clangd_executable', 'clangd') call ale#Set('cpp_clangd_options', '') - -function! ale_linters#cpp#clangd#GetProjectRoot(buffer) abort - let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') - - return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' -endfunction +call ale#Set('c_build_dir', '') function! ale_linters#cpp#clangd#GetCommand(buffer) abort - return '%e' . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options')) + let l:build_dir = ale#c#GetBuildDirectory(a:buffer) + + return '%e' + \ . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options')) + \ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '') endfunction call ale#linter#Define('cpp', { @@ -19,5 +18,5 @@ call ale#linter#Define('cpp', { \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'cpp_clangd_executable')}, \ 'command': function('ale_linters#cpp#clangd#GetCommand'), -\ 'project_root': function('ale_linters#cpp#clangd#GetProjectRoot'), +\ 'project_root': function('ale#c#FindProjectRoot'), \}) diff --git a/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim b/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim index 841b795f..d6944aae 100644 --- a/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim +++ b/sources_non_forked/ale/ale_linters/cpp/clangtidy.vim @@ -5,22 +5,39 @@ call ale#Set('cpp_clangtidy_executable', 'clang-tidy') " Set this option to check the checks clang-tidy will apply. call ale#Set('cpp_clangtidy_checks', []) -" Set this option to manually set some options for clang-tidy. +" Set this option to manually set some options for clang-tidy to use as compile +" flags. " This will disable compile_commands.json detection. call ale#Set('cpp_clangtidy_options', '') +" Set this option to manually set options for clang-tidy directly. +call ale#Set('cpp_clangtidy_extra_options', '') call ale#Set('c_build_dir', '') -function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort +function! ale_linters#cpp#clangtidy#GetCommand(buffer, output) abort let l:checks = join(ale#Var(a:buffer, 'cpp_clangtidy_checks'), ',') let l:build_dir = ale#c#GetBuildDirectory(a:buffer) + let l:options = '' " Get the extra options if we couldn't find a build directory. - let l:options = empty(l:build_dir) - \ ? ale#Var(a:buffer, 'cpp_clangtidy_options') - \ : '' + if empty(l:build_dir) + let l:options = ale#Var(a:buffer, 'cpp_clangtidy_options') + let l:cflags = ale#c#GetCFlags(a:buffer, a:output) + let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags + + " Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file + " only when compile-commands.json file is not there. Adding these + " flags makes clang-tidy completely ignore compile commmands. + if expand('#' . a:buffer) =~# '\.h$' + let l:options .= !empty(l:options) ? ' -x c++' : '-x c++' + endif + endif + + " Get the options to pass directly to clang-tidy + let l:extra_options = ale#Var(a:buffer, 'cpp_clangtidy_extra_options') return '%e' \ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '') + \ . (!empty(l:extra_options) ? ' ' . ale#Escape(l:extra_options) : '') \ . ' %s' \ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '') \ . (!empty(l:options) ? ' -- ' . l:options : '') @@ -30,7 +47,7 @@ call ale#linter#Define('cpp', { \ 'name': 'clangtidy', \ 'output_stream': 'stdout', \ 'executable': {b -> ale#Var(b, 'cpp_clangtidy_executable')}, -\ 'command': function('ale_linters#cpp#clangtidy#GetCommand'), +\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#clangtidy#GetCommand'))}, \ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \ 'lint_file': 1, \}) diff --git a/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim b/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim index 5173d698..eb86adf4 100644 --- a/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim +++ b/sources_non_forked/ale/ale_linters/cpp/cppcheck.vim @@ -5,23 +5,17 @@ call ale#Set('cpp_cppcheck_executable', 'cppcheck') call ale#Set('cpp_cppcheck_options', '--enable=style') function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort - " Search upwards from the file for compile_commands.json. - " - " If we find it, we'll `cd` to where the compile_commands.json file is, - " then use the file to set up import paths, etc. - let l:compile_commmands_path = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') - - let l:cd_command = !empty(l:compile_commmands_path) - \ ? ale#path#CdString(fnamemodify(l:compile_commmands_path, ':h')) - \ : '' - let l:compile_commands_option = !empty(l:compile_commmands_path) - \ ? '--project=compile_commands.json ' + let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer) + let l:buffer_path_include = empty(l:compile_commands_option) + \ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer) \ : '' + let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') - return l:cd_command - \ . '%e -q --language=c++ ' - \ . l:compile_commands_option - \ . ale#Var(a:buffer, 'cpp_cppcheck_options') + return '%e -q --language=c++' + \ . l:template + \ . ale#Pad(l:compile_commands_option) + \ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options')) + \ . l:buffer_path_include \ . ' %t' endfunction @@ -29,6 +23,7 @@ call ale#linter#Define('cpp', { \ 'name': 'cppcheck', \ 'output_stream': 'both', \ 'executable': {b -> ale#Var(b, 'cpp_cppcheck_executable')}, +\ 'cwd': function('ale#handlers#cppcheck#GetCwd'), \ 'command': function('ale_linters#cpp#cppcheck#GetCommand'), \ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat', \}) diff --git a/sources_non_forked/ale/ale_linters/cpp/cquery.vim b/sources_non_forked/ale/ale_linters/cpp/cquery.vim index 0dd9f6ad..2971cdcb 100644 --- a/sources_non_forked/ale/ale_linters/cpp/cquery.vim +++ b/sources_non_forked/ale/ale_linters/cpp/cquery.vim @@ -5,13 +5,15 @@ call ale#Set('cpp_cquery_executable', 'cquery') call ale#Set('cpp_cquery_cache_directory', expand('~/.cache/cquery')) function! ale_linters#cpp#cquery#GetProjectRoot(buffer) abort - let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') + " Try to find cquery configuration files first. + let l:config = ale#path#FindNearestFile(a:buffer, '.cquery') - if empty(l:project_root) - let l:project_root = ale#path#FindNearestFile(a:buffer, '.cquery') + if !empty(l:config) + return fnamemodify(l:config, ':h') endif - return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' + " Fall back on default project root detection. + return ale#c#FindProjectRoot(a:buffer) endfunction function! ale_linters#cpp#cquery#GetInitializationOptions(buffer) abort diff --git a/sources_non_forked/ale/ale_linters/cpp/gcc.vim b/sources_non_forked/ale/ale_linters/cpp/gcc.vim deleted file mode 100644 index 831620d5..00000000 --- a/sources_non_forked/ale/ale_linters/cpp/gcc.vim +++ /dev/null @@ -1,28 +0,0 @@ -" Author: geam -" Description: gcc linter for cpp files -" -call ale#Set('cpp_gcc_executable', 'gcc') -call ale#Set('cpp_gcc_options', '-std=c++14 -Wall') - -function! ale_linters#cpp#gcc#GetCommand(buffer, output) abort - let l:cflags = ale#c#GetCFlags(a:buffer, a:output) - - " -iquote with the directory the file is in makes #include work for - " headers in the same directory. - return '%e -S -x c++ -fsyntax-only' - \ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) - \ . ale#Pad(l:cflags) - \ . ale#Pad(ale#Var(a:buffer, 'cpp_gcc_options')) . ' -' -endfunction - -call ale#linter#Define('cpp', { -\ 'name': 'gcc', -\ 'aliases': ['g++'], -\ 'output_stream': 'stderr', -\ 'executable': {b -> ale#Var(b, 'cpp_gcc_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#cpp#gcc#GetCommand'}, -\ ], -\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', -\}) diff --git a/sources_non_forked/ale/ale_linters/crystal/crystal.vim b/sources_non_forked/ale/ale_linters/crystal/crystal.vim index 3c2fefb7..8a905b12 100644 --- a/sources_non_forked/ale/ale_linters/crystal/crystal.vim +++ b/sources_non_forked/ale/ale_linters/crystal/crystal.vim @@ -5,6 +5,10 @@ function! ale_linters#crystal#crystal#Handle(buffer, lines) abort let l:output = [] for l:error in ale#util#FuzzyJSONDecode(a:lines, []) + if !has_key(l:error, 'file') + continue + endif + call add(l:output, { \ 'lnum': l:error.line + 0, \ 'col': l:error.column + 0, diff --git a/sources_non_forked/ale/ale_linters/cs/csc.vim b/sources_non_forked/ale/ale_linters/cs/csc.vim new file mode 100644 index 00000000..5ee3de29 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cs/csc.vim @@ -0,0 +1,90 @@ +call ale#Set('cs_csc_options', '') +call ale#Set('cs_csc_source', '') +call ale#Set('cs_csc_assembly_path', []) +call ale#Set('cs_csc_assemblies', []) + +function! ale_linters#cs#csc#GetCwd(buffer) abort + let l:cwd = ale#Var(a:buffer, 'cs_csc_source') + + return !empty(l:cwd) ? l:cwd : expand('#' . a:buffer . ':p:h') +endfunction + +function! ale_linters#cs#csc#GetCommand(buffer) abort + " Pass assembly paths via the -lib: parameter. + let l:path_list = ale#Var(a:buffer, 'cs_csc_assembly_path') + + let l:lib_option = !empty(l:path_list) + \ ? '/lib:' . join(map(copy(l:path_list), 'ale#Escape(v:val)'), ',') + \ : '' + + " Pass paths to DLL files via the -r: parameter. + let l:assembly_list = ale#Var(a:buffer, 'cs_csc_assemblies') + + let l:r_option = !empty(l:assembly_list) + \ ? '/r:' . join(map(copy(l:assembly_list), 'ale#Escape(v:val)'), ',') + \ : '' + + " register temporary module target file with ale + " register temporary module target file with ALE. + let l:out = ale#command#CreateFile(a:buffer) + + " The code is compiled as a module and the output is redirected to a + " temporary file. + return 'csc /unsafe' + \ . ale#Pad(ale#Var(a:buffer, 'cs_csc_options')) + \ . ale#Pad(l:lib_option) + \ . ale#Pad(l:r_option) + \ . ' /out:' . l:out + \ . ' /t:module' + \ . ' /recurse:' . ale#Escape('*.cs') +endfunction + +function! ale_linters#cs#csc#Handle(buffer, lines) abort + " Look for lines like the following. + " + " Tests.cs(12,29): error CSXXXX: ; expected + " + " NOTE: pattern also captures file name as linter compiles all + " files within the source tree rooted at the specified source + " path and not just the file loaded in the buffer + let l:patterns = [ + \ '^\v(.+\.cs)\((\d+),(\d+)\)\:\s+([^ ]+)\s+([cC][sS][^ ]+):\s(.+)$', + \ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$', + \] + let l:output = [] + let l:dir = ale_linters#cs#csc#GetCwd(a:buffer) + + for l:match in ale#util#GetMatches(a:lines, l:patterns) + if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS' + call add(l:output, { + \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'type': l:match[4] is# 'error' ? 'E' : 'W', + \ 'code': l:match[5], + \ 'text': l:match[6] , + \}) + elseif strlen(l:match[2]) > 2 && l:match[2][:1] is? 'CS' + call add(l:output, { + \ 'filename':'', + \ 'lnum': -1, + \ 'col': -1, + \ 'type': l:match[1] is# 'error' ? 'E' : 'W', + \ 'code': l:match[2], + \ 'text': l:match[3], + \}) + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('cs',{ +\ 'name': 'csc', +\ 'output_stream': 'stdout', +\ 'executable': 'csc', +\ 'cwd': function('ale_linters#cs#csc#GetCwd'), +\ 'command': function('ale_linters#cs#csc#GetCommand'), +\ 'callback': 'ale_linters#cs#csc#Handle', +\ 'lint_file': 1 +\}) diff --git a/sources_non_forked/ale/ale_linters/cs/mcsc.vim b/sources_non_forked/ale/ale_linters/cs/mcsc.vim index dd067eba..2dd46661 100644 --- a/sources_non_forked/ale/ale_linters/cs/mcsc.vim +++ b/sources_non_forked/ale/ale_linters/cs/mcsc.vim @@ -3,14 +3,10 @@ call ale#Set('cs_mcsc_source', '') call ale#Set('cs_mcsc_assembly_path', []) call ale#Set('cs_mcsc_assemblies', []) -function! s:GetWorkingDirectory(buffer) abort - let l:working_directory = ale#Var(a:buffer, 'cs_mcsc_source') +function! ale_linters#cs#mcsc#GetCwd(buffer) abort + let l:cwd = ale#Var(a:buffer, 'cs_mcsc_source') - if !empty(l:working_directory) - return l:working_directory - endif - - return expand('#' . a:buffer . ':p:h') + return !empty(l:cwd) ? l:cwd : expand('#' . a:buffer . ':p:h') endfunction function! ale_linters#cs#mcsc#GetCommand(buffer) abort @@ -34,8 +30,7 @@ function! ale_linters#cs#mcsc#GetCommand(buffer) abort " The code is compiled as a module and the output is redirected to a " temporary file. - return ale#path#CdString(s:GetWorkingDirectory(a:buffer)) - \ . 'mcs -unsafe' + return 'mcs -unsafe' \ . ale#Pad(ale#Var(a:buffer, 'cs_mcsc_options')) \ . ale#Pad(l:lib_option) \ . ale#Pad(l:r_option) @@ -52,20 +47,34 @@ function! ale_linters#cs#mcsc#Handle(buffer, lines) abort " NOTE: pattern also captures file name as linter compiles all " files within the source tree rooted at the specified source " path and not just the file loaded in the buffer - let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$' + let l:patterns = [ + \ '^\v(.+\.cs)\((\d+),(\d+)\)\:\s+([^ ]+)\s+([cC][sS][^ ]+):\s(.+)$', + \ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$', + \] let l:output = [] - let l:dir = s:GetWorkingDirectory(a:buffer) + let l:dir = ale_linters#cs#mcsc#GetCwd(a:buffer) - for l:match in ale#util#GetMatches(a:lines, l:pattern) - call add(l:output, { - \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), - \ 'lnum': l:match[2] + 0, - \ 'col': l:match[3] + 0, - \ 'type': l:match[4] is# 'error' ? 'E' : 'W', - \ 'code': l:match[5], - \ 'text': l:match[6], - \}) + for l:match in ale#util#GetMatches(a:lines, l:patterns) + if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS' + call add(l:output, { + \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'type': l:match[4] is# 'error' ? 'E' : 'W', + \ 'code': l:match[5], + \ 'text': l:match[6] , + \}) + elseif strlen(l:match[2]) > 2 && l:match[2][:1] is? 'CS' + call add(l:output, { + \ 'filename':'', + \ 'lnum': -1, + \ 'col': -1, + \ 'type': l:match[1] is# 'error' ? 'E' : 'W', + \ 'code': l:match[2], + \ 'text': l:match[3], + \}) + endif endfor return l:output @@ -75,6 +84,7 @@ call ale#linter#Define('cs',{ \ 'name': 'mcsc', \ 'output_stream': 'stderr', \ 'executable': 'mcs', +\ 'cwd': function('ale_linters#cs#mcsc#GetCwd'), \ 'command': function('ale_linters#cs#mcsc#GetCommand'), \ 'callback': 'ale_linters#cs#mcsc#Handle', \ 'lint_file': 1 diff --git a/sources_non_forked/ale/ale_linters/css/fecs.vim b/sources_non_forked/ale/ale_linters/css/fecs.vim new file mode 100644 index 00000000..511847c6 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/css/fecs.vim @@ -0,0 +1,9 @@ +" Author: harttle +" Description: fecs for CSS files + +call ale#linter#Define('css', { +\ 'name': 'fecs', +\ 'executable': function('ale#handlers#fecs#GetExecutable'), +\ 'command': function('ale#handlers#fecs#GetCommand'), +\ 'callback': 'ale#handlers#fecs#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/css/stylelint.vim b/sources_non_forked/ale/ale_linters/css/stylelint.vim index 38cb0e0b..e508f392 100644 --- a/sources_non_forked/ale/ale_linters/css/stylelint.vim +++ b/sources_non_forked/ale/ale_linters/css/stylelint.vim @@ -11,7 +11,7 @@ endfunction call ale#linter#Define('css', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'css_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'css_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#css#stylelint#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/cuda/clangd.vim b/sources_non_forked/ale/ale_linters/cuda/clangd.vim new file mode 100644 index 00000000..bfda821b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/cuda/clangd.vim @@ -0,0 +1,23 @@ +" Author: Tommy Chiang +" Description: Clangd language server for CUDA (modified from Andrey +" Melentyev's implementation for C++) + +call ale#Set('cuda_clangd_executable', 'clangd') +call ale#Set('cuda_clangd_options', '') +call ale#Set('c_build_dir', '') + +function! ale_linters#cuda#clangd#GetCommand(buffer) abort + let l:build_dir = ale#c#GetBuildDirectory(a:buffer) + + return '%e' + \ . ale#Pad(ale#Var(a:buffer, 'cuda_clangd_options')) + \ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '') +endfunction + +call ale#linter#Define('cuda', { +\ 'name': 'clangd', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'cuda_clangd_executable')}, +\ 'command': function('ale_linters#cuda#clangd#GetCommand'), +\ 'project_root': function('ale#c#FindProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/cuda/nvcc.vim b/sources_non_forked/ale/ale_linters/cuda/nvcc.vim index f3af07b6..2734f6ec 100644 --- a/sources_non_forked/ale/ale_linters/cuda/nvcc.vim +++ b/sources_non_forked/ale/ale_linters/cuda/nvcc.vim @@ -5,9 +5,6 @@ call ale#Set('cuda_nvcc_executable', 'nvcc') call ale#Set('cuda_nvcc_options', '-std=c++11') function! ale_linters#cuda#nvcc#GetCommand(buffer) abort - " Unused: use ale#util#nul_file - " let l:output_file = ale#util#Tempname() . '.ii' - " call ale#command#ManageFile(a:buffer, l:output_file) return '%e -cuda' \ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer))) \ . ale#Pad(ale#Var(a:buffer, 'cuda_nvcc_options')) diff --git a/sources_non_forked/ale/ale_linters/d/dmd.vim b/sources_non_forked/ale/ale_linters/d/dmd.vim index c816d592..f38e812c 100644 --- a/sources_non_forked/ale/ale_linters/d/dmd.vim +++ b/sources_non_forked/ale/ale_linters/d/dmd.vim @@ -1,53 +1,106 @@ " Author: w0rp " Description: "dmd for D files" -function! ale_linters#d#dmd#DUBCommand(buffer) abort +function! s:GetDUBCommand(buffer) abort " If we can't run dub, then skip this command. - if !executable('dub') + if executable('dub') " Returning an empty string skips to the DMD command. - return '' + let l:config = ale#d#FindDUBConfig(a:buffer) + + " To support older dub versions, we just change the directory to the + " directory where we found the dub config, and then run `dub describe` + " from that directory. + if !empty(l:config) + return [fnamemodify(l:config, ':h'), 'dub describe --data-list + \ --data=import-paths + \ --data=string-import-paths + \ --data=versions + \ --data=debug-versions + \'] + endif endif - let l:dub_file = ale#d#FindDUBConfig(a:buffer) - - if empty(l:dub_file) - return '' - endif - - " To support older dub versions, we just change the directory to - " the directory where we found the dub config, and then run `dub describe` - " from that directory. - return 'cd ' . ale#Escape(fnamemodify(l:dub_file, ':h')) - \ . ' && dub describe --import-paths' + return ['', ''] endfunction -function! ale_linters#d#dmd#DMDCommand(buffer, dub_output) abort - let l:import_list = [] +function! ale_linters#d#dmd#RunDUBCommand(buffer) abort + let [l:cwd, l:command] = s:GetDUBCommand(a:buffer) - " Build a list of import paths generated from DUB, if available. + if empty(l:command) + " If we can't run DUB, just run DMD. + return ale_linters#d#dmd#DMDCommand(a:buffer, [], {}) + endif + + return ale#command#Run( + \ a:buffer, + \ l:command, + \ function('ale_linters#d#dmd#DMDCommand'), + \ {'cwd': l:cwd}, + \) +endfunction + +function! ale_linters#d#dmd#DMDCommand(buffer, dub_output, meta) abort + let l:import_list = [] + let l:str_import_list = [] + let l:versions_list = [] + let l:deb_versions_list = [] + let l:list_ind = 1 + let l:seen_line = 0 + + " Build a list of options generated from DUB, if available. + " DUB output each path or version on a single line. + " Each list is separated by a blank line. + " Empty list are represented by a blank line (followed and/or + " preceded by a separation blank line) for l:line in a:dub_output + " line still has end of line char on windows + let l:line = substitute(l:line, '[\r\n]*$', '', '') + if !empty(l:line) - " The arguments must be '-Ifilename', not '-I filename' - call add(l:import_list, '-I' . ale#Escape(l:line)) + if l:list_ind == 1 + call add(l:import_list, '-I' . ale#Escape(l:line)) + elseif l:list_ind == 2 + call add(l:str_import_list, '-J' . ale#Escape(l:line)) + elseif l:list_ind == 3 + call add(l:versions_list, '-version=' . ale#Escape(l:line)) + elseif l:list_ind == 4 + call add(l:deb_versions_list, '-debug=' . ale#Escape(l:line)) + endif + + let l:seen_line = 1 + elseif !l:seen_line + " if list is empty must skip one empty line + let l:seen_line = 1 + else + let l:seen_line = 0 + let l:list_ind += 1 endif endfor - return 'dmd '. join(l:import_list) . ' -o- -wi -vcolumns -c %t' + return 'dmd ' . join(l:import_list) . ' ' . + \ join(l:str_import_list) . ' ' . + \ join(l:versions_list) . ' ' . + \ join(l:deb_versions_list) . ' -o- -wi -vcolumns -c %t' endfunction function! ale_linters#d#dmd#Handle(buffer, lines) abort " Matches patterns lines like the following: " /tmp/tmp.qclsa7qLP7/file.d(1): Error: function declaration without return type. (Note that constructors are always named 'this') " /tmp/tmp.G1L5xIizvB.d(8,8): Error: module weak_reference is in file 'dstruct/weak_reference.d' which cannot be read - let l:pattern = '^[^(]\+(\([0-9]\+\)\,\?\([0-9]*\)): \([^:]\+\): \(.\+\)' + let l:pattern = '\v^(\f+)\((\d+)(,(\d+))?\): (\w+): (.+)$' let l:output = [] + let l:dir = expand('#' . a:buffer . ':p:h') for l:match in ale#util#GetMatches(a:lines, l:pattern) + " If dmd was invoked with relative path, match[1] is relative, otherwise it is absolute. + " As we invoke dmd with the buffer path (in /tmp), this will generally be absolute already + let l:fname = ale#path#GetAbsPath(l:dir, l:match[1]) call add(l:output, { - \ 'lnum': l:match[1], - \ 'col': l:match[2], - \ 'type': l:match[3] is# 'Warning' ? 'W' : 'E', - \ 'text': l:match[4], + \ 'filename': l:fname, + \ 'lnum': l:match[2], + \ 'col': l:match[4], + \ 'type': l:match[5] is# 'Warning' || l:match[5] is# 'Deprecation' ? 'W' : 'E', + \ 'text': l:match[6], \}) endfor @@ -57,9 +110,7 @@ endfunction call ale#linter#Define('d', { \ 'name': 'dmd', \ 'executable': 'dmd', -\ 'command_chain': [ -\ {'callback': 'ale_linters#d#dmd#DUBCommand', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#d#dmd#DMDCommand', 'output_stream': 'stderr'}, -\ ], +\ 'command': function('ale_linters#d#dmd#RunDUBCommand'), \ 'callback': 'ale_linters#d#dmd#Handle', +\ 'output_stream': 'stderr', \}) diff --git a/sources_non_forked/ale/ale_linters/dafny/dafny.vim b/sources_non_forked/ale/ale_linters/dafny/dafny.vim index b5b90675..2a9f761a 100644 --- a/sources_non_forked/ale/ale_linters/dafny/dafny.vim +++ b/sources_non_forked/ale/ale_linters/dafny/dafny.vim @@ -6,7 +6,7 @@ function! ale_linters#dafny#dafny#Handle(buffer, lines) abort for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { - \ 'bufnr': a:buffer, + \ 'filename': l:match[1], \ 'col': l:match[3] + 0, \ 'lnum': l:match[2] + 0, \ 'text': l:match[5], @@ -14,13 +14,28 @@ function! ale_linters#dafny#dafny#Handle(buffer, lines) abort \ }) endfor + for l:match in ale#util#GetMatches(a:lines, '\v(.*)\((\d+),(\d+)\): (Verification of .{-} timed out after \d+ seconds)') + call add(l:output, { + \ 'filename': l:match[1], + \ 'col': l:match[3] + 0, + \ 'lnum': l:match[2] + 0, + \ 'text': l:match[4], + \ 'type': 'E', + \ }) + endfor + return l:output endfunction +function! ale_linters#dafny#dafny#GetCommand(buffer) abort + return printf('dafny %%s /compile:0 /timeLimit:%d', ale#Var(a:buffer, 'dafny_dafny_timelimit')) +endfunction + +call ale#Set('dafny_dafny_timelimit', 10) call ale#linter#Define('dafny', { \ 'name': 'dafny', \ 'executable': 'dafny', -\ 'command': 'dafny %s /compile:0', +\ 'command': function('ale_linters#dafny#dafny#GetCommand'), \ 'callback': 'ale_linters#dafny#dafny#Handle', \ 'lint_file': 1, \ }) diff --git a/sources_non_forked/ale/ale_linters/dart/analysis_server.vim b/sources_non_forked/ale/ale_linters/dart/analysis_server.vim new file mode 100644 index 00000000..a6870da9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/dart/analysis_server.vim @@ -0,0 +1,29 @@ +" Author: Nelson Yeung +" Description: Check Dart files with dart analysis server LSP + +call ale#Set('dart_analysis_server_executable', 'dart') + +function! ale_linters#dart#analysis_server#GetProjectRoot(buffer) abort + " Note: pub only looks for pubspec.yaml, there's no point in adding + " support for pubspec.yml + let l:pubspec = ale#path#FindNearestFile(a:buffer, 'pubspec.yaml') + + return !empty(l:pubspec) ? fnamemodify(l:pubspec, ':h:h') : '.' +endfunction + +function! ale_linters#dart#analysis_server#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'dart_analysis_server_executable') + let l:dart = resolve(exepath(l:executable)) + + return '%e ' + \ . fnamemodify(l:dart, ':h') . '/snapshots/analysis_server.dart.snapshot' + \ . ' --lsp' +endfunction + +call ale#linter#Define('dart', { +\ 'name': 'analysis_server', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'dart_analysis_server_executable')}, +\ 'command': function('ale_linters#dart#analysis_server#GetCommand'), +\ 'project_root': function('ale_linters#dart#analysis_server#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/dart/dart_analyze.vim b/sources_non_forked/ale/ale_linters/dart/dart_analyze.vim new file mode 100644 index 00000000..a00162d8 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/dart/dart_analyze.vim @@ -0,0 +1,28 @@ +" Author: ghsang +" Description: Check Dart files with dart analyze + +call ale#Set('dart_analyze_executable', 'dart') + +function! ale_linters#dart#dart_analyze#Handle(buffer, lines) abort + let l:pattern = '\v^ ([a-z]+) - (.+):(\d+):(\d+) - (.+) - (.+)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'type': l:match[1] is# 'error' ? 'E' : 'W', + \ 'text': l:match[6] . ': ' . l:match[5], + \ 'lnum': str2nr(l:match[3]), + \ 'col': str2nr(l:match[4]), + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('dart', { +\ 'name': 'dart_analyze', +\ 'executable': {b -> ale#Var(b, 'dart_analyze_executable')}, +\ 'command': '%e analyze %s', +\ 'callback': 'ale_linters#dart#dart_analyze#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/desktop/desktop_file_validate.vim b/sources_non_forked/ale/ale_linters/desktop/desktop_file_validate.vim new file mode 100644 index 00000000..5a97d315 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/desktop/desktop_file_validate.vim @@ -0,0 +1,31 @@ +call ale#Set('desktop_desktop_file_validate_options', '') + +" Example matches for pattern: +" +" foo.desktop: warning: key "TerminalOptions" in group ... +" foo.desktop: error: action "new-private-window" is defined, ... +let s:pattern = '\v^(.+): ([a-z]+): (.+)$' + +function! ale_linters#desktop#desktop_file_validate#Handle(buffer, lines) abort + " The error format doesn't specify lines, so we can just put all of the + " errors on line 1. + return ale#util#MapMatches(a:lines, s:pattern, {match -> { + \ 'lnum': 1, + \ 'col': 1, + \ 'type': match[2] is? 'error' ? 'E' : 'W', + \ 'text': match[3], + \}}) +endfunction + +call ale#linter#Define('desktop', { +\ 'name': 'desktop_file_validate', +\ 'aliases': ['desktop-file-validate'], +\ 'executable': 'desktop-file-validate', +\ 'command': {b -> +\ '%e' +\ . ale#Pad(ale#Var(b, 'desktop_desktop_file_validate_options')) +\ . ' %t' +\ }, +\ 'callback': 'ale_linters#desktop#desktop_file_validate#Handle', +\ 'output_stream': 'both', +\}) diff --git a/sources_non_forked/ale/ale_linters/dockerfile/dockerfile_lint.vim b/sources_non_forked/ale/ale_linters/dockerfile/dockerfile_lint.vim index 95768b12..0c0ad533 100644 --- a/sources_non_forked/ale/ale_linters/dockerfile/dockerfile_lint.vim +++ b/sources_non_forked/ale/ale_linters/dockerfile/dockerfile_lint.vim @@ -32,14 +32,29 @@ function! ale_linters#dockerfile#dockerfile_lint#Handle(buffer, lines) abort let l:line = get(l:object, 'line', -1) let l:message = l:object['message'] - if get(l:object, 'description', 'None') isnot# 'None' - let l:message = l:message . '. ' . l:object['description'] + let l:link = get(l:object, 'reference_url', '') + + if type(l:link) == v:t_list + " Somehow, reference_url is returned as two-part list. + " Anchor markers in that list are sometimes duplicated. + " See https://github.com/projectatomic/dockerfile_lint/issues/134 + let l:link = join(l:link, '') + let l:link = substitute(l:link, '##', '#', '') endif + let l:detail = l:message + + if get(l:object, 'description', 'None') isnot# 'None' + let l:detail .= "\n\n" . l:object['description'] + endif + + let l:detail .= "\n\n" . l:link + call add(l:messages, { \ 'lnum': l:line, \ 'text': l:message, \ 'type': ale_linters#dockerfile#dockerfile_lint#GetType(l:type), + \ 'detail': l:detail, \}) endfor endfor diff --git a/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim b/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim index e57cd76d..278e9466 100644 --- a/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim +++ b/sources_non_forked/ale/ale_linters/dockerfile/hadolint.vim @@ -7,9 +7,9 @@ call ale#Set('dockerfile_hadolint_docker_image', 'hadolint/hadolint') function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort " Matches patterns line the following: " - " /dev/stdin:19 DL3001 Pipe chain should start with a raw value. + " -:19 DL3001 warning: Pipe chain should start with a raw value. " /dev/stdin:19:3 unexpected thing - let l:pattern = '\v^/dev/stdin:(\d+):?(\d+)? ((DL|SC)(\d+) )?(.+)$' + let l:pattern = '\v^%(/dev/stdin|-):(\d+):?(\d+)? ((DL|SC)(\d+) )?((.+)?: )?(.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) @@ -24,10 +24,22 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort let l:colnum = l:match[2] + 0 endif - let l:type = 'W' - let l:text = l:match[6] - let l:detail = l:match[6] + " Shellcheck knows a 'style' severity - pin it to info level as well. + if l:match[7] is# 'style' + let l:type = 'I' + elseif l:match[7] is# 'info' + let l:type = 'I' + elseif l:match[7] is# 'warning' + let l:type = 'W' + else + let l:type = 'E' + endif + + let l:text = l:match[8] + let l:detail = l:match[8] let l:domain = 'https://github.com/hadolint/hadolint/wiki/' + let l:code = '' + let l:link = '' if l:match[4] is# 'SC' let l:domain = 'https://github.com/koalaman/shellcheck/wiki/' @@ -36,18 +48,26 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort if l:match[5] isnot# '' let l:code = l:match[4] . l:match[5] let l:link = ' ( ' . l:domain . l:code . ' )' + let l:text = l:code . ': ' . l:detail let l:detail = l:code . l:link . "\n\n" . l:detail else let l:type = 'E' + let l:detail = 'hadolint could not parse the file because of a syntax error.' endif - call add(l:output, { + let l:line_output = { \ 'lnum': l:lnum, \ 'col': l:colnum, \ 'type': l:type, \ 'text': l:text, \ 'detail': l:detail - \}) + \} + + if l:code isnot# '' + let l:line_output['code'] = l:code + endif + + call add(l:output, l:line_output) endfor return l:output @@ -82,12 +102,15 @@ endfunction function! ale_linters#dockerfile#hadolint#GetCommand(buffer) abort let l:command = ale_linters#dockerfile#hadolint#GetExecutable(a:buffer) + let l:opts = '--no-color -' if l:command is# 'docker' - return 'docker run --rm -i ' . ale#Var(a:buffer, 'dockerfile_hadolint_docker_image') + return printf('docker run --rm -i %s hadolint %s', + \ ale#Var(a:buffer, 'dockerfile_hadolint_docker_image'), + \ l:opts) endif - return 'hadolint -' + return 'hadolint ' . l:opts endfunction diff --git a/sources_non_forked/ale/ale_linters/elixir/credo.vim b/sources_non_forked/ale/ale_linters/elixir/credo.vim index 317ecab3..d6a861f4 100644 --- a/sources_non_forked/ale/ale_linters/elixir/credo.vim +++ b/sources_non_forked/ale/ale_linters/elixir/credo.vim @@ -45,19 +45,27 @@ function! ale_linters#elixir#credo#GetMode() abort endif endfunction -function! ale_linters#elixir#credo#GetCommand(buffer) abort - let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer) - let l:mode = ale_linters#elixir#credo#GetMode() +function! ale_linters#elixir#credo#GetConfigFile() abort + let l:config_file = get(g:, 'ale_elixir_credo_config_file', '') - return ale#path#CdString(l:project_root) - \ . 'mix help credo && ' + if empty(l:config_file) + return '' + endif + + return ' --config-file ' . l:config_file +endfunction + +function! ale_linters#elixir#credo#GetCommand(buffer) abort + return 'mix help credo && ' \ . 'mix credo ' . ale_linters#elixir#credo#GetMode() + \ . ale_linters#elixir#credo#GetConfigFile() \ . ' --format=flycheck --read-from-stdin %s' endfunction call ale#linter#Define('elixir', { \ 'name': 'credo', \ 'executable': 'mix', +\ 'cwd': function('ale#handlers#elixir#FindMixUmbrellaRoot'), \ 'command': function('ale_linters#elixir#credo#GetCommand'), \ 'callback': 'ale_linters#elixir#credo#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/elixir/dialyxir.vim b/sources_non_forked/ale/ale_linters/elixir/dialyxir.vim index c7da7757..9b8a5cda 100644 --- a/sources_non_forked/ale/ale_linters/elixir/dialyxir.vim +++ b/sources_non_forked/ale/ale_linters/elixir/dialyxir.vim @@ -25,17 +25,10 @@ function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort return l:output endfunction -function! ale_linters#elixir#dialyxir#GetCommand(buffer) abort - let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer) - - return ale#path#CdString(l:project_root) - \ . ' mix help dialyzer && mix dialyzer' -endfunction - call ale#linter#Define('elixir', { \ 'name': 'dialyxir', \ 'executable': 'mix', -\ 'command': function('ale_linters#elixir#dialyxir#GetCommand'), +\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'), +\ 'command': 'mix help dialyzer && mix dialyzer', \ 'callback': 'ale_linters#elixir#dialyxir#Handle', \}) - diff --git a/sources_non_forked/ale/ale_linters/elixir/dogma.vim b/sources_non_forked/ale/ale_linters/elixir/dogma.vim index 1c721158..28e7f420 100644 --- a/sources_non_forked/ale/ale_linters/elixir/dogma.vim +++ b/sources_non_forked/ale/ale_linters/elixir/dogma.vim @@ -29,17 +29,11 @@ function! ale_linters#elixir#dogma#Handle(buffer, lines) abort return l:output endfunction -function! ale_linters#elixir#dogma#GetCommand(buffer) abort - let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer) - - return ale#path#CdString(l:project_root) - \ . ' mix help dogma && mix dogma %s --format=flycheck' -endfunction - call ale#linter#Define('elixir', { \ 'name': 'dogma', \ 'executable': 'mix', -\ 'command': function('ale_linters#elixir#dogma#GetCommand'), +\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'), +\ 'command': 'mix help dogma && mix dogma %s --format=flycheck', \ 'lint_file': 1, \ 'callback': 'ale_linters#elixir#dogma#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim b/sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim index d5db7cd0..d5517de5 100644 --- a/sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim +++ b/sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim @@ -6,7 +6,7 @@ call ale#Set('elixir_elixir_ls_config', {}) function! ale_linters#elixir#elixir_ls#GetExecutable(buffer) abort let l:dir = ale#path#Simplify(ale#Var(a:buffer, 'elixir_elixir_ls_release')) - let l:cmd = ale#Has('win32') ? '\language_server.bat' : '/language_server.sh' + let l:cmd = has('win32') ? '\language_server.bat' : '/language_server.sh' return l:dir . l:cmd endfunction diff --git a/sources_non_forked/ale/ale_linters/elixir/mix.vim b/sources_non_forked/ale/ale_linters/elixir/mix.vim index abf5d0aa..948c6d36 100644 --- a/sources_non_forked/ale/ale_linters/elixir/mix.vim +++ b/sources_non_forked/ale/ale_linters/elixir/mix.vim @@ -30,22 +30,15 @@ function! ale_linters#elixir#mix#Handle(buffer, lines) abort endfunction function! ale_linters#elixir#mix#GetCommand(buffer) abort - let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer) - let l:temp_dir = ale#command#CreateDirectory(a:buffer) - let l:mix_build_path = has('win32') - \ ? 'set MIX_BUILD_PATH=' . ale#Escape(l:temp_dir) . ' &&' - \ : 'MIX_BUILD_PATH=' . ale#Escape(l:temp_dir) - - return ale#path#CdString(l:project_root) - \ . l:mix_build_path - \ . ' mix compile %s' + return ale#Env('MIX_BUILD_PATH', l:temp_dir) . 'mix compile %s' endfunction call ale#linter#Define('elixir', { \ 'name': 'mix', \ 'executable': 'mix', +\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'), \ 'command': function('ale_linters#elixir#mix#GetCommand'), \ 'callback': 'ale_linters#elixir#mix#Handle', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/elm/elm_ls.vim b/sources_non_forked/ale/ale_linters/elm/elm_ls.vim new file mode 100644 index 00000000..a02dbf42 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/elm/elm_ls.vim @@ -0,0 +1,40 @@ +" Author: antew - https://github.com/antew +" Description: elm-language-server integration for elm (diagnostics, formatting, and more) + +call ale#Set('elm_ls_executable', 'elm-language-server') +call ale#Set('elm_ls_use_global', get(g:, 'ale_use_global_executables', 1)) + +" elm-language-server will search for local and global binaries, if empty +call ale#Set('elm_ls_elm_path', '') +call ale#Set('elm_ls_elm_format_path', '') +call ale#Set('elm_ls_elm_test_path', '') +call ale#Set('elm_ls_elm_analyse_trigger', 'change') + +function! elm_ls#GetRootDir(buffer) abort + let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json') + + return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : '' +endfunction + +function! elm_ls#GetOptions(buffer) abort + return { + \ 'elmPath': ale#Var(a:buffer, 'elm_ls_elm_path'), + \ 'elmFormatPath': ale#Var(a:buffer, 'elm_ls_elm_format_path'), + \ 'elmTestPath': ale#Var(a:buffer, 'elm_ls_elm_test_path'), + \ 'elmAnalyseTrigger': ale#Var(a:buffer, 'elm_ls_elm_analyse_trigger'), + \} +endfunction + +call ale#linter#Define('elm', { +\ 'name': 'elm_ls', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#path#FindExecutable(b, 'elm_ls', [ +\ 'node_modules/.bin/elm-language-server', +\ 'node_modules/.bin/elm-lsp', +\ 'elm-lsp' +\ ])}, +\ 'command': '%e --stdio', +\ 'project_root': function('elm_ls#GetRootDir'), +\ 'language': 'elm', +\ 'initialization_options': function('elm_ls#GetOptions') +\}) diff --git a/sources_non_forked/ale/ale_linters/elm/elm_lsp.vim b/sources_non_forked/ale/ale_linters/elm/elm_lsp.vim deleted file mode 100644 index 2259286f..00000000 --- a/sources_non_forked/ale/ale_linters/elm/elm_lsp.vim +++ /dev/null @@ -1,22 +0,0 @@ -" Author: antew - https://github.com/antew -" Description: LSP integration for elm, currently supports diagnostics (linting) - -call ale#Set('elm_lsp_executable', 'elm-lsp') -call ale#Set('elm_lsp_use_global', get(g:, 'ale_use_global_executables', 0)) - -function! elm_lsp#GetRootDir(buffer) abort - let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json') - - return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : '' -endfunction - -call ale#linter#Define('elm', { -\ 'name': 'elm_lsp', -\ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'elm_lsp', [ -\ 'node_modules/.bin/elm-lsp', -\ ])}, -\ 'command': '%e --stdio', -\ 'project_root': function('elm_lsp#GetRootDir'), -\ 'language': 'elm' -\}) diff --git a/sources_non_forked/ale/ale_linters/elm/make.vim b/sources_non_forked/ale/ale_linters/elm/make.vim index 6b93257f..a7f9ea7b 100644 --- a/sources_non_forked/ale/ale_linters/elm/make.vim +++ b/sources_non_forked/ale/ale_linters/elm/make.vim @@ -186,24 +186,23 @@ function! ale_linters#elm#make#IsTest(buffer) abort endif endfunction +function! ale_linters#elm#make#GetCwd(buffer) abort + let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer) + + return !empty(l:root_dir) ? l:root_dir : '' +endfunction + " Return the command to execute the linter in the projects directory. " If it doesn't, then this will fail when imports are needed. function! ale_linters#elm#make#GetCommand(buffer) abort let l:executable = ale_linters#elm#make#GetExecutable(a:buffer) - let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer) let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer) let l:is_using_elm_test = l:executable =~# 'elm-test$' - if empty(l:root_dir) - let l:dir_set_cmd = '' - else - let l:dir_set_cmd = 'cd ' . ale#Escape(l:root_dir) . ' && ' - endif - " elm-test needs to know the path of elm-make if elm isn't installed globally. " https://github.com/rtfeldman/node-test-runner/blob/57728f10668f2d2ab3179e7e3208bcfa9a1f19aa/README.md#--compiler if l:is_v19 && l:is_using_elm_test - let l:elm_make_executable = ale#node#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm']) + let l:elm_make_executable = ale#path#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm']) let l:elm_test_compiler_flag = ' --compiler ' . l:elm_make_executable . ' ' else let l:elm_test_compiler_flag = ' ' @@ -213,7 +212,9 @@ function! ale_linters#elm#make#GetCommand(buffer) abort " a sort of flag to tell the compiler not to generate an output file, " which is why this is hard coded here. " Source: https://github.com/elm-lang/elm-compiler/blob/19d5a769b30ec0b2fc4475985abb4cd94cd1d6c3/builder/src/Generate/Output.hs#L253 - return l:dir_set_cmd . '%e make --report=json --output=/dev/null' . l:elm_test_compiler_flag . '%t' + return '%e make --report=json --output=/dev/null' + \ . l:elm_test_compiler_flag + \ . '%t' endfunction function! ale_linters#elm#make#GetExecutable(buffer) abort @@ -221,13 +222,13 @@ function! ale_linters#elm#make#GetExecutable(buffer) abort let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer) if l:is_test && l:is_v19 - return ale#node#FindExecutable( + return ale#path#FindExecutable( \ a:buffer, \ 'elm_make', \ ['node_modules/.bin/elm-test', 'node_modules/.bin/elm'] \) else - return ale#node#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm']) + return ale#path#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm']) endif endfunction @@ -235,6 +236,7 @@ call ale#linter#Define('elm', { \ 'name': 'make', \ 'executable': function('ale_linters#elm#make#GetExecutable'), \ 'output_stream': 'both', +\ 'cwd': function('ale_linters#elm#make#GetCwd'), \ 'command': function('ale_linters#elm#make#GetCommand'), \ 'callback': 'ale_linters#elm#make#Handle' \}) diff --git a/sources_non_forked/ale/ale_linters/erlang/dialyzer.vim b/sources_non_forked/ale/ale_linters/erlang/dialyzer.vim new file mode 100644 index 00000000..a97c9520 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/erlang/dialyzer.vim @@ -0,0 +1,97 @@ +" Author: Autoine Gagne - https://github.com/AntoineGagne +" Description: Define a checker that runs dialyzer on Erlang files. + +let g:ale_erlang_dialyzer_executable = +\ get(g:, 'ale_erlang_dialyzer_executable', 'dialyzer') +let g:ale_erlang_dialyzer_options = +\ get(g:, 'ale_erlang_dialyzer_options', '-Wunmatched_returns' +\ . ' -Werror_handling' +\ . ' -Wrace_conditions' +\ . ' -Wunderspecs') +let g:ale_erlang_dialyzer_plt_file = +\ get(g:, 'ale_erlang_dialyzer_plt_file', '') +let g:ale_erlang_dialyzer_rebar3_profile = +\ get(g:, 'ale_erlang_dialyzer_rebar3_profile', 'default') + +function! ale_linters#erlang#dialyzer#GetRebar3Profile(buffer) abort + return ale#Var(a:buffer, 'erlang_dialyzer_rebar3_profile') +endfunction + +function! ale_linters#erlang#dialyzer#FindPlt(buffer) abort + let l:plt_file = '' + let l:rebar3_profile = ale_linters#erlang#dialyzer#GetRebar3Profile(a:buffer) + let l:plt_file_directory = ale#path#FindNearestDirectory(a:buffer, '_build/' . l:rebar3_profile) + + if !empty(l:plt_file_directory) + let l:plt_file = globpath(l:plt_file_directory, '*_plt', 0, 1) + endif + + if !empty(l:plt_file) + return l:plt_file[0] + endif + + if !empty($REBAR_PLT_DIR) + return expand('$REBAR_PLT_DIR/dialyzer/plt') + endif + + return expand('$HOME/.dialyzer_plt') +endfunction + +function! ale_linters#erlang#dialyzer#GetPlt(buffer) abort + let l:plt_file = ale#Var(a:buffer, 'erlang_dialyzer_plt_file') + + if !empty(l:plt_file) + return l:plt_file + endif + + return ale_linters#erlang#dialyzer#FindPlt(a:buffer) +endfunction + +function! ale_linters#erlang#dialyzer#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'erlang_dialyzer_executable') +endfunction + +function! ale_linters#erlang#dialyzer#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'erlang_dialyzer_options') + + let l:command = ale#Escape(ale_linters#erlang#dialyzer#GetExecutable(a:buffer)) + \ . ' -n' + \ . ' --plt ' . ale#Escape(ale_linters#erlang#dialyzer#GetPlt(a:buffer)) + \ . ' ' . l:options + \ . ' %s' + + return l:command +endfunction + +function! ale_linters#erlang#dialyzer#Handle(buffer, lines) abort + " Match patterns like the following: + " + " erl_tidy_prv_fmt.erl:3: Callback info about the provider behaviour is not available + let l:pattern = '^\S\+:\(\d\+\): \(.\+\)$' + let l:output = [] + + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) + + if len(l:match) != 0 + let l:code = l:match[2] + + call add(l:output, { + \ 'lnum': str2nr(l:match[1]), + \ 'lcol': 0, + \ 'text': l:code, + \ 'type': 'W' + \}) + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('erlang', { +\ 'name': 'dialyzer', +\ 'executable': function('ale_linters#erlang#dialyzer#GetExecutable'), +\ 'command': function('ale_linters#erlang#dialyzer#GetCommand'), +\ 'callback': function('ale_linters#erlang#dialyzer#Handle'), +\ 'lint_file': 1 +\}) diff --git a/sources_non_forked/ale/ale_linters/erlang/elvis.vim b/sources_non_forked/ale/ale_linters/erlang/elvis.vim new file mode 100644 index 00000000..31dea3dd --- /dev/null +++ b/sources_non_forked/ale/ale_linters/erlang/elvis.vim @@ -0,0 +1,39 @@ +" Author: Dmitri Vereshchagin +" Description: Elvis linter for Erlang files + +call ale#Set('erlang_elvis_executable', 'elvis') + +function! ale_linters#erlang#elvis#Handle(buffer, lines) abort + let l:pattern = '\v:(\d+):[^:]+:(.+)' + let l:loclist = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:loclist, { + \ 'lnum': str2nr(l:match[1]), + \ 'text': s:AbbreviateMessage(l:match[2]), + \ 'type': 'W', + \}) + endfor + + return l:loclist +endfunction + +function! s:AbbreviateMessage(text) abort + let l:pattern = '\v\c^(line \d+ is too long):.*$' + + return substitute(a:text, l:pattern, '\1.', '') +endfunction + +function! s:GetCommand(buffer) abort + let l:file = ale#Escape(expand('#' . a:buffer . ':.')) + + return '%e rock --output-format=parsable ' . l:file +endfunction + +call ale#linter#Define('erlang', { +\ 'name': 'elvis', +\ 'callback': 'ale_linters#erlang#elvis#Handle', +\ 'executable': {b -> ale#Var(b, 'erlang_elvis_executable')}, +\ 'command': function('s:GetCommand'), +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/erlang/erlc.vim b/sources_non_forked/ale/ale_linters/erlang/erlc.vim index a83bacc3..0c67a73f 100644 --- a/sources_non_forked/ale/ale_linters/erlang/erlc.vim +++ b/sources_non_forked/ale/ale_linters/erlang/erlc.vim @@ -1,14 +1,22 @@ " Author: Magnus Ottenklinger - https://github.com/evnu +let g:ale_erlang_erlc_executable = get(g:, 'ale_erlang_erlc_executable', 'erlc') let g:ale_erlang_erlc_options = get(g:, 'ale_erlang_erlc_options', '') +function! ale_linters#erlang#erlc#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'erlang_erlc_executable') +endfunction + function! ale_linters#erlang#erlc#GetCommand(buffer) abort let l:output_file = ale#util#Tempname() call ale#command#ManageFile(a:buffer, l:output_file) - return 'erlc -o ' . ale#Escape(l:output_file) - \ . ' ' . ale#Var(a:buffer, 'erlang_erlc_options') - \ . ' %t' + let l:command = ale#Escape(ale_linters#erlang#erlc#GetExecutable(a:buffer)) + \ . ' -o ' . ale#Escape(l:output_file) + \ . ' ' . ale#Var(a:buffer, 'erlang_erlc_options') + \ . ' %t' + + return l:command endfunction function! ale_linters#erlang#erlc#Handle(buffer, lines) abort @@ -17,7 +25,7 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort " error.erl:4: variable 'B' is unbound " error.erl:3: Warning: function main/0 is unused " error.erl:4: Warning: variable 'A' is unused - let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+): (Warning: )?(.+)$' + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+:)? (Warning: )?(.+)$' " parse_transforms are a special case. The error message does not indicate a location: " error.erl: undefined parse transform 'some_parse_transform' @@ -57,8 +65,8 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort endif let l:line = l:match[2] - let l:warning_or_text = l:match[3] - let l:text = l:match[4] + let l:warning_or_text = l:match[4] + let l:text = l:match[5] " If this file is a header .hrl, ignore the following expected messages: " - 'no module definition' @@ -90,7 +98,7 @@ endfunction call ale#linter#Define('erlang', { \ 'name': 'erlc', -\ 'executable': 'erlc', +\ 'executable': function('ale_linters#erlang#erlc#GetExecutable'), \ 'command': function('ale_linters#erlang#erlc#GetCommand'), \ 'callback': 'ale_linters#erlang#erlc#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/erlang/syntaxerl.vim b/sources_non_forked/ale/ale_linters/erlang/syntaxerl.vim index 2b7276a1..5d555a8d 100644 --- a/sources_non_forked/ale/ale_linters/erlang/syntaxerl.vim +++ b/sources_non_forked/ale/ale_linters/erlang/syntaxerl.vim @@ -3,7 +3,17 @@ call ale#Set('erlang_syntaxerl_executable', 'syntaxerl') -function! ale_linters#erlang#syntaxerl#GetCommand(buffer, output) abort +function! ale_linters#erlang#syntaxerl#RunHelpCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'erlang_syntaxerl_executable') + + return ale#command#Run( + \ a:buffer, + \ ale#Escape(l:executable) . ' -h', + \ function('ale_linters#erlang#syntaxerl#GetCommand'), + \) +endfunction + +function! ale_linters#erlang#syntaxerl#GetCommand(buffer, output, meta) abort let l:use_b_option = match(a:output, '\C\V-b, --base\>') > -1 return '%e' . (l:use_b_option ? ' -b %s %t' : ' %t') @@ -27,9 +37,6 @@ endfunction call ale#linter#Define('erlang', { \ 'name': 'syntaxerl', \ 'executable': {b -> ale#Var(b, 'erlang_syntaxerl_executable')}, -\ 'command_chain': [ -\ {'callback': {-> '%e -h'}}, -\ {'callback': 'ale_linters#erlang#syntaxerl#GetCommand'}, -\ ], +\ 'command': {b -> ale_linters#erlang#syntaxerl#RunHelpCommand(b)}, \ 'callback': 'ale_linters#erlang#syntaxerl#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/eruby/erblint.vim b/sources_non_forked/ale/ale_linters/eruby/erblint.vim new file mode 100644 index 00000000..19960185 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/eruby/erblint.vim @@ -0,0 +1,51 @@ +" Author: Roeland Moors - https://github.com/roelandmoors +" based on the ale ruumba and robocop linters +" Description: ERB Lint, support for https://github.com/Shopify/erb-lint + +call ale#Set('eruby_erblint_executable', 'erblint') +call ale#Set('eruby_erblint_options', '') + +function! ale_linters#eruby#erblint#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'eruby_erblint_executable') + + return ale#ruby#EscapeExecutable(l:executable, 'erblint') + \ . ' --format json ' + \ . ale#Var(a:buffer, 'eruby_erblint_options') + \ . ' --stdin %s' +endfunction + +function! ale_linters#eruby#erblint#Handle(buffer, lines) abort + if empty(a:lines) + return [] + endif + + let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], []) + + if !has_key(l:errors, 'summary') + \|| l:errors['summary']['offenses'] == 0 + \|| empty(l:errors['files']) + return [] + endif + + let l:output = [] + + for l:error in l:errors['files'][0]['offenses'] + call add(l:output, { + \ 'lnum': l:error['location']['start_line'] + 0, + \ 'col': l:error['location']['start_column'] + 0, + \ 'end_col': l:error['location']['last_column'] + 0, + \ 'code': l:error['linter'], + \ 'text': l:error['message'], + \ 'type': 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('eruby', { +\ 'name': 'erblint', +\ 'executable': {b -> ale#Var(b, 'eruby_erblint_executable')}, +\ 'command': function('ale_linters#eruby#erblint#GetCommand'), +\ 'callback': 'ale_linters#eruby#erblint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/eruby/erubi.vim b/sources_non_forked/ale/ale_linters/eruby/erubi.vim index 6f2d3ac6..ddca3f61 100644 --- a/sources_non_forked/ale/ale_linters/eruby/erubi.vim +++ b/sources_non_forked/ale/ale_linters/eruby/erubi.vim @@ -1,14 +1,10 @@ " Author: Eddie Lebow https://github.com/elebow " Description: eruby checker using `erubi` -function! ale_linters#eruby#erubi#CheckErubi(buffer) abort - return 'ruby -r erubi/capture_end -e ' . ale#Escape('""') -endfunction - -function! ale_linters#eruby#erubi#GetCommand(buffer, check_erubi_output) abort +function! ale_linters#eruby#erubi#GetCommand(buffer, output, meta) abort let l:rails_root = ale#ruby#FindRailsRoot(a:buffer) - if (!empty(a:check_erubi_output)) + if !empty(a:output) " The empty command in CheckErubi returns nothing if erubi runs and " emits an error if erubi is not present return '' @@ -27,9 +23,10 @@ endfunction call ale#linter#Define('eruby', { \ 'name': 'erubi', \ 'executable': 'ruby', -\ 'command_chain': [ -\ {'callback': 'ale_linters#eruby#erubi#CheckErubi'}, -\ {'callback': 'ale_linters#eruby#erubi#GetCommand', 'output_stream': 'stderr'}, -\ ], +\ 'command': {buffer -> ale#command#Run( +\ buffer, +\ 'ruby -r erubi/capture_end -e ' . ale#Escape('""'), +\ function('ale_linters#eruby#erubi#GetCommand'), +\ )}, \ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors', \}) diff --git a/sources_non_forked/ale/ale_linters/eruby/ruumba.vim b/sources_non_forked/ale/ale_linters/eruby/ruumba.vim index e68bb51d..f415f1ab 100644 --- a/sources_non_forked/ale/ale_linters/eruby/ruumba.vim +++ b/sources_non_forked/ale/ale_linters/eruby/ruumba.vim @@ -8,10 +8,10 @@ call ale#Set('eruby_ruumba_options', '') function! ale_linters#eruby#ruumba#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'eruby_ruumba_executable') - return ale#handlers#ruby#EscapeExecutable(l:executable, 'ruumba') + return ale#ruby#EscapeExecutable(l:executable, 'ruumba') \ . ' --format json --force-exclusion ' \ . ale#Var(a:buffer, 'eruby_ruumba_options') - \ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p')) + \ . ' --stdin %s' endfunction function! ale_linters#eruby#ruumba#Handle(buffer, lines) abort diff --git a/sources_non_forked/ale/ale_linters/go/bingo.vim b/sources_non_forked/ale/ale_linters/go/bingo.vim index e446bdcc..1e43f8e4 100644 --- a/sources_non_forked/ale/ale_linters/go/bingo.vim +++ b/sources_non_forked/ale/ale_linters/go/bingo.vim @@ -5,11 +5,13 @@ call ale#Set('go_bingo_executable', 'bingo') call ale#Set('go_bingo_options', '--mode stdio') function! ale_linters#go#bingo#GetCommand(buffer) abort - return '%e' . ale#Pad(ale#Var(a:buffer, 'go_bingo_options')) + return ale#go#EnvString(a:buffer) . '%e' . ale#Pad(ale#Var(a:buffer, 'go_bingo_options')) endfunction function! ale_linters#go#bingo#FindProjectRoot(buffer) abort - let l:project_root = ale#path#FindNearestFile(a:buffer, 'go.mod') + let l:go_modules_off = ale#Var(a:buffer, 'go_go111module') is# 'off' + let l:project_root = l:go_modules_off ? + \ '' : ale#path#FindNearestFile(a:buffer, 'go.mod') let l:mods = ':h' if empty(l:project_root) diff --git a/sources_non_forked/ale/ale_linters/go/gobuild.vim b/sources_non_forked/ale/ale_linters/go/gobuild.vim index 374ded35..5210c5a8 100644 --- a/sources_non_forked/ale/ale_linters/go/gobuild.vim +++ b/sources_non_forked/ale/ale_linters/go/gobuild.vim @@ -10,7 +10,7 @@ function! ale_linters#go#gobuild#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'go_gobuild_options') " Run go test in local directory with relative path - return ale#path#BufferCdString(a:buffer) + return ale#go#EnvString(a:buffer) \ . ale#Var(a:buffer, 'go_go_executable') . ' test' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -c -o /dev/null ./' @@ -49,6 +49,7 @@ call ale#linter#Define('go', { \ 'name': 'gobuild', \ 'aliases': ['go build'], \ 'executable': {b -> ale#Var(b, 'go_go_executable')}, +\ 'cwd': '%s:h', \ 'command': function('ale_linters#go#gobuild#GetCommand'), \ 'output_stream': 'stderr', \ 'callback': 'ale_linters#go#gobuild#Handler', diff --git a/sources_non_forked/ale/ale_linters/go/gofmt.vim b/sources_non_forked/ale/ale_linters/go/gofmt.vim index 337deef8..b313f9ca 100644 --- a/sources_non_forked/ale/ale_linters/go/gofmt.vim +++ b/sources_non_forked/ale/ale_linters/go/gofmt.vim @@ -1,10 +1,15 @@ " Author: neersighted " Description: gofmt for Go files +function! ale_linters#go#gofmt#GetCommand(buffer) abort + return ale#go#EnvString(a:buffer) + \ . '%e -e %t' +endfunction + call ale#linter#Define('go', { \ 'name': 'gofmt', \ 'output_stream': 'stderr', \ 'executable': 'gofmt', -\ 'command': 'gofmt -e %t', +\ 'command': function('ale_linters#go#gofmt#GetCommand'), \ 'callback': 'ale#handlers#unix#HandleAsError', \}) diff --git a/sources_non_forked/ale/ale_linters/go/golangci_lint.vim b/sources_non_forked/ale/ale_linters/go/golangci_lint.vim index 357f7949..2c4b1a4f 100644 --- a/sources_non_forked/ale/ale_linters/go/golangci_lint.vim +++ b/sources_non_forked/ale/ale_linters/go/golangci_lint.vim @@ -10,13 +10,14 @@ function! ale_linters#go#golangci_lint#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'go_golangci_lint_options') let l:lint_package = ale#Var(a:buffer, 'go_golangci_lint_package') + if l:lint_package - return ale#path#BufferCdString(a:buffer) + return ale#go#EnvString(a:buffer) \ . '%e run ' \ . l:options endif - return ale#path#BufferCdString(a:buffer) + return ale#go#EnvString(a:buffer) \ . '%e run ' \ . ale#Escape(l:filename) \ . ' ' . l:options @@ -50,6 +51,7 @@ endfunction call ale#linter#Define('go', { \ 'name': 'golangci-lint', \ 'executable': {b -> ale#Var(b, 'go_golangci_lint_executable')}, +\ 'cwd': '%s:h', \ 'command': function('ale_linters#go#golangci_lint#GetCommand'), \ 'callback': 'ale_linters#go#golangci_lint#Handler', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/go/golint.vim b/sources_non_forked/ale/ale_linters/go/golint.vim index 765e1477..79bfaeb5 100644 --- a/sources_non_forked/ale/ale_linters/go/golint.vim +++ b/sources_non_forked/ale/ale_linters/go/golint.vim @@ -7,7 +7,7 @@ call ale#Set('go_golint_options', '') function! ale_linters#go#golint#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'go_golint_options') - return '%e' + return ale#go#EnvString(a:buffer) . '%e' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' %t' endfunction diff --git a/sources_non_forked/ale/ale_linters/go/gometalinter.vim b/sources_non_forked/ale/ale_linters/go/gometalinter.vim index 19d70a81..ac33a9f3 100644 --- a/sources_non_forked/ale/ale_linters/go/gometalinter.vim +++ b/sources_non_forked/ale/ale_linters/go/gometalinter.vim @@ -13,12 +13,12 @@ function! ale_linters#go#gometalinter#GetCommand(buffer) abort " BufferCdString is used so that we can be sure the paths output from gometalinter can " be calculated to absolute paths in the Handler if l:lint_package - return ale#path#BufferCdString(a:buffer) + return ale#go#EnvString(a:buffer) \ . '%e' \ . (!empty(l:options) ? ' ' . l:options : '') . ' .' endif - return ale#path#BufferCdString(a:buffer) + return ale#go#EnvString(a:buffer) \ . '%e' \ . ' --include=' . ale#Escape(ale#util#EscapePCRE(l:filename)) \ . (!empty(l:options) ? ' ' . l:options : '') . ' .' @@ -51,6 +51,7 @@ endfunction call ale#linter#Define('go', { \ 'name': 'gometalinter', \ 'executable': {b -> ale#Var(b, 'go_gometalinter_executable')}, +\ 'cwd': '%s:h', \ 'command': function('ale_linters#go#gometalinter#GetCommand'), \ 'callback': 'ale_linters#go#gometalinter#Handler', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/go/gopls.vim b/sources_non_forked/ale/ale_linters/go/gopls.vim new file mode 100644 index 00000000..80909830 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/go/gopls.vim @@ -0,0 +1,39 @@ +" Author: w0rp +" Author: Jerko Steiner +" Description: https://github.com/saibing/gopls + +call ale#Set('go_gopls_executable', 'gopls') +call ale#Set('go_gopls_options', '--mode stdio') +call ale#Set('go_gopls_init_options', {}) +call ale#Set('go_gopls_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale_linters#go#gopls#GetCommand(buffer) abort + return ale#go#EnvString(a:buffer) + \ . '%e' + \ . ale#Pad(ale#Var(a:buffer, 'go_gopls_options')) +endfunction + +function! ale_linters#go#gopls#FindProjectRoot(buffer) abort + let l:go_modules_off = ale#Var(a:buffer, 'go_go111module') is# 'off' + let l:project_root = l:go_modules_off ? + \ '' : ale#path#FindNearestFile(a:buffer, 'go.mod') + let l:mods = ':h' + + if empty(l:project_root) + let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git') + let l:mods = ':h:h' + endif + + return !empty(l:project_root) ? fnamemodify(l:project_root, l:mods) : '' +endfunction + +call ale#linter#Define('go', { +\ 'name': 'gopls', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#path#FindExecutable(b, 'go_gopls', [ +\ ale#go#GetGoPathExecutable('bin/gopls'), +\ ])}, +\ 'command': function('ale_linters#go#gopls#GetCommand'), +\ 'project_root': function('ale_linters#go#gopls#FindProjectRoot'), +\ 'initialization_options': {b -> ale#Var(b, 'go_gopls_init_options')}, +\}) diff --git a/sources_non_forked/ale/ale_linters/go/gosimple.vim b/sources_non_forked/ale/ale_linters/go/gosimple.vim index 281a0e53..490d15a9 100644 --- a/sources_non_forked/ale/ale_linters/go/gosimple.vim +++ b/sources_non_forked/ale/ale_linters/go/gosimple.vim @@ -1,14 +1,11 @@ " Author: Ben Reedy " Description: gosimple for Go files -function! ale_linters#go#gosimple#GetCommand(buffer) abort - return ale#path#BufferCdString(a:buffer) . ' gosimple .' -endfunction - call ale#linter#Define('go', { \ 'name': 'gosimple', \ 'executable': 'gosimple', -\ 'command': function('ale_linters#go#gosimple#GetCommand'), +\ 'cwd': '%s:h', +\ 'command': {b -> ale#go#EnvString(b) . 'gosimple .'}, \ 'callback': 'ale#handlers#go#Handler', \ 'output_stream': 'both', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/go/gotype.vim b/sources_non_forked/ale/ale_linters/go/gotype.vim index 159df892..8fd6df27 100644 --- a/sources_non_forked/ale/ale_linters/go/gotype.vim +++ b/sources_non_forked/ale/ale_linters/go/gotype.vim @@ -1,18 +1,23 @@ " Author: Jelte Fennema " Description: gotype for Go files -function! ale_linters#go#gotype#GetCommand(buffer) abort +function! ale_linters#go#gotype#GetExecutable(buffer) abort if expand('#' . a:buffer . ':p') =~# '_test\.go$' return '' endif - return ale#path#BufferCdString(a:buffer) . ' gotype .' + return 'gotype' +endfunction + +function! ale_linters#go#gotype#GetCommand(buffer) abort + return ale#go#EnvString(a:buffer) . 'gotype -e .' endfunction call ale#linter#Define('go', { \ 'name': 'gotype', \ 'output_stream': 'stderr', -\ 'executable': 'gotype', +\ 'executable': function('ale_linters#go#gotype#GetExecutable'), +\ 'cwd': '%s:h', \ 'command': function('ale_linters#go#gotype#GetCommand'), \ 'callback': 'ale#handlers#go#Handler', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/go/govet.vim b/sources_non_forked/ale/ale_linters/go/govet.vim index bb81d5d0..5da8261c 100644 --- a/sources_non_forked/ale/ale_linters/go/govet.vim +++ b/sources_non_forked/ale/ale_linters/go/govet.vim @@ -10,7 +10,7 @@ call ale#Set('go_govet_options', '') function! ale_linters#go#govet#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'go_govet_options') - return ale#path#BufferCdString(a:buffer) . ' ' + return ale#go#EnvString(a:buffer) \ . ale#Var(a:buffer, 'go_go_executable') . ' vet ' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' .' @@ -21,6 +21,7 @@ call ale#linter#Define('go', { \ 'aliases': ['go vet'], \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'go_go_executable')}, +\ 'cwd': '%s:h', \ 'command': function('ale_linters#go#govet#GetCommand'), \ 'callback': 'ale#handlers#go#Handler', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/go/langserver.vim b/sources_non_forked/ale/ale_linters/go/langserver.vim index 776186c7..7130db40 100644 --- a/sources_non_forked/ale/ale_linters/go/langserver.vim +++ b/sources_non_forked/ale/ale_linters/go/langserver.vim @@ -15,8 +15,9 @@ function! ale_linters#go#langserver#GetCommand(buffer) abort endif let l:options = uniq(sort(l:options)) + let l:env = ale#go#EnvString(a:buffer) - return join(extend(l:executable, l:options), ' ') + return l:env . join(extend(l:executable, l:options), ' ') endfunction call ale#linter#Define('go', { diff --git a/sources_non_forked/ale/ale_linters/go/revive.vim b/sources_non_forked/ale/ale_linters/go/revive.vim new file mode 100644 index 00000000..b14b5ab9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/go/revive.vim @@ -0,0 +1,21 @@ +" Author: Penghui Liao +" Description: Adds support for revive + +call ale#Set('go_revive_executable', 'revive') +call ale#Set('go_revive_options', '') + +function! ale_linters#go#revive#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'go_revive_options') + + return ale#go#EnvString(a:buffer) . '%e' + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' %t' +endfunction + +call ale#linter#Define('go', { +\ 'name': 'revive', +\ 'output_stream': 'both', +\ 'executable': {b -> ale#Var(b, 'go_revive_executable')}, +\ 'command': function('ale_linters#go#revive#GetCommand'), +\ 'callback': 'ale#handlers#unix#HandleAsWarning', +\}) diff --git a/sources_non_forked/ale/ale_linters/go/staticcheck.vim b/sources_non_forked/ale/ale_linters/go/staticcheck.vim index 26fe0193..36622440 100644 --- a/sources_non_forked/ale/ale_linters/go/staticcheck.vim +++ b/sources_non_forked/ale/ale_linters/go/staticcheck.vim @@ -1,31 +1,32 @@ " Author: Ben Reedy " Description: staticcheck for Go files +call ale#Set('go_staticcheck_executable', 'staticcheck') call ale#Set('go_staticcheck_options', '') -call ale#Set('go_staticcheck_lint_package', 0) +call ale#Set('go_staticcheck_lint_package', 1) +call ale#Set('go_staticcheck_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#go#staticcheck#GetCommand(buffer) abort - let l:filename = expand('#' . a:buffer . ':t') let l:options = ale#Var(a:buffer, 'go_staticcheck_options') let l:lint_package = ale#Var(a:buffer, 'go_staticcheck_lint_package') + let l:env = ale#go#EnvString(a:buffer) - " BufferCdString is used so that we can be sure the paths output from - " staticcheck can be calculated to absolute paths in the Handler if l:lint_package - return ale#path#BufferCdString(a:buffer) - \ . 'staticcheck' + return l:env . '%e' \ . (!empty(l:options) ? ' ' . l:options : '') . ' .' endif - return ale#path#BufferCdString(a:buffer) - \ . 'staticcheck' + return l:env . '%e' \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' ' . ale#Escape(l:filename) + \ . ' %s:t' endfunction call ale#linter#Define('go', { \ 'name': 'staticcheck', -\ 'executable': 'staticcheck', +\ 'executable': {b -> ale#path#FindExecutable(b, 'go_staticcheck', [ +\ ale#go#GetGoPathExecutable('bin/staticcheck'), +\ ])}, +\ 'cwd': '%s:h', \ 'command': function('ale_linters#go#staticcheck#GetCommand'), \ 'callback': 'ale#handlers#go#Handler', \ 'output_stream': 'both', diff --git a/sources_non_forked/ale/ale_linters/graphql/eslint.vim b/sources_non_forked/ale/ale_linters/graphql/eslint.vim index 654b8c17..a98233e9 100644 --- a/sources_non_forked/ale/ale_linters/graphql/eslint.vim +++ b/sources_non_forked/ale/ale_linters/graphql/eslint.vim @@ -4,6 +4,7 @@ call ale#linter#Define('graphql', { \ 'name': 'eslint', \ 'executable': function('ale#handlers#eslint#GetExecutable'), +\ 'cwd': function('ale#handlers#eslint#GetCwd'), \ 'command': function('ale#handlers#eslint#GetCommand'), -\ 'callback': 'ale#handlers#eslint#Handle', +\ 'callback': 'ale#handlers#eslint#HandleJSON', \}) diff --git a/sources_non_forked/ale/ale_linters/graphql/gqlint.vim b/sources_non_forked/ale/ale_linters/graphql/gqlint.vim index d5029de1..6f1ca54a 100644 --- a/sources_non_forked/ale/ale_linters/graphql/gqlint.vim +++ b/sources_non_forked/ale/ale_linters/graphql/gqlint.vim @@ -1,15 +1,10 @@ " Author: Michiel Westerbeek " Description: Linter for GraphQL Schemas -function! ale_linters#graphql#gqlint#GetCommand(buffer) abort - return ale#path#BufferCdString(a:buffer) - \ . 'gqlint' - \ . ' --reporter=simple %t' -endfunction - call ale#linter#Define('graphql', { \ 'name': 'gqlint', \ 'executable': 'gqlint', -\ 'command': function('ale_linters#graphql#gqlint#GetCommand'), +\ 'cwd': '%s:h', +\ 'command': 'gqlint --reporter=simple %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) diff --git a/sources_non_forked/ale/ale_linters/haml/hamllint.vim b/sources_non_forked/ale/ale_linters/haml/hamllint.vim index 7d7278aa..9fcd999f 100644 --- a/sources_non_forked/ale/ale_linters/haml/hamllint.vim +++ b/sources_non_forked/ale/ale_linters/haml/hamllint.vim @@ -19,7 +19,7 @@ function! ale_linters#haml#hamllint#GetCommand(buffer) abort " See https://github.com/brigade/haml-lint/blob/master/lib/haml_lint/linter/rubocop.rb#L89 " HamlLint::Linter::RuboCop#rubocop_flags if !empty(l:rubocop_config_file_path) - if ale#Has('win32') + if has('win32') let l:prefix = 'set HAML_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config_file_path) . ' &&' else let l:prefix = 'HAML_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config_file_path) diff --git a/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim b/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim index 74bd6a99..8362bb1c 100644 --- a/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim +++ b/sources_non_forked/ale/ale_linters/handlebars/embertemplatelint.vim @@ -4,6 +4,28 @@ call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint') call ale#Set('handlebars_embertemplatelint_use_global', get(g:, 'ale_use_global_executables', 0)) +function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort + return ale#path#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [ + \ 'node_modules/.bin/ember-template-lint', + \]) +endfunction + +function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer, version) abort + " Reading from stdin was introduced in ember-template-lint@1.6.0 + return ale#semver#GTE(a:version, [1, 6, 0]) + \ ? '%e --json --filename %s' + \ : '%e --json %t' +endfunction + +function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ ale_linters#handlebars#embertemplatelint#GetExecutable(a:buffer), + \ '%e --version', + \ function('ale_linters#handlebars#embertemplatelint#GetCommand'), + \) +endfunction + function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort let l:output = [] let l:json = ale#util#FuzzyJSONDecode(a:lines, {}) @@ -30,10 +52,9 @@ function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort endfunction call ale#linter#Define('handlebars', { -\ 'name': 'ember-template-lint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'handlebars_embertemplatelint', [ -\ 'node_modules/.bin/ember-template-lint', -\ ])}, -\ 'command': '%e --json %t', +\ 'name': 'embertemplatelint', +\ 'aliases': ['ember-template-lint'], +\ 'executable': function('ale_linters#handlebars#embertemplatelint#GetExecutable'), +\ 'command': function('ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck'), \ 'callback': 'ale_linters#handlebars#embertemplatelint#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim b/sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim index 59978e7e..1bb31ebb 100644 --- a/sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim +++ b/sources_non_forked/ale/ale_linters/haskell/cabal_ghc.vim @@ -14,6 +14,7 @@ call ale#linter#Define('haskell', { \ 'aliases': ['cabal-ghc'], \ 'output_stream': 'stderr', \ 'executable': 'cabal', +\ 'cwd': '%s:h', \ 'command': function('ale_linters#haskell#cabal_ghc#GetCommand'), \ 'callback': 'ale#handlers#haskell#HandleGHCFormat', \}) diff --git a/sources_non_forked/ale/ale_linters/haskell/hls.vim b/sources_non_forked/ale/ale_linters/haskell/hls.vim new file mode 100644 index 00000000..ae0556a4 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/haskell/hls.vim @@ -0,0 +1,63 @@ +" Author: Yen3 +" Description: A language server for haskell +" The file is based on hie.vim (author: Luxed +" ). It search more project root files. +" +call ale#Set('haskell_hls_executable', 'haskell-language-server-wrapper') + +function! ale_linters#haskell#hls#FindRootFile(buffer) abort + let l:serach_root_files = [ + \ 'stack.yaml', + \ 'cabal.project', + \ 'package.yaml', + \ 'hie.yaml' + \ ] + + for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) + for l:root_file in l:serach_root_files + if filereadable(l:path . l:root_file) + return l:path + endif + endfor + endfor + + return '' +endfunction + +function! ale_linters#haskell#hls#GetProjectRoot(buffer) abort + " Search for the project file first + let l:project_file = ale_linters#haskell#hls#FindRootFile(a:buffer) + + " If it's empty, search for the cabal file + if empty(l:project_file) + " Search all of the paths except for the root filesystem path. + let l:paths = join( + \ ale#path#Upwards(expand('#' . a:buffer . ':p:h'))[:-2], + \ ',' + \) + let l:project_file = globpath(l:paths, '*.cabal') + endif + + " If we still can't find one, use the current file. + if empty(l:project_file) + let l:project_file = expand('#' . a:buffer . ':p') + endif + + return fnamemodify(l:project_file, ':h') +endfunction + +function! ale_linters#haskell#hls#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_hls_executable') + + return ale#handlers#haskell_stack#EscapeExecutable(l:executable, + \ 'haskell-language-server-wrapper') + \ . ' --lsp' +endfunction + +call ale#linter#Define('haskell', { +\ 'name': 'hls', +\ 'lsp': 'stdio', +\ 'command': function('ale_linters#haskell#hls#GetCommand'), +\ 'executable': {b -> ale#Var(b, 'haskell_hls_executable')}, +\ 'project_root': function('ale_linters#haskell#hls#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim b/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim index 06af7f6d..51ecc744 100644 --- a/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim +++ b/sources_non_forked/ale/ale_linters/haskell/stack_ghc.vim @@ -15,6 +15,7 @@ call ale#linter#Define('haskell', { \ 'aliases': ['stack-ghc'], \ 'output_stream': 'stderr', \ 'executable': function('ale#handlers#haskell#GetStackExecutable'), +\ 'cwd': '%s:h', \ 'command': function('ale_linters#haskell#stack_ghc#GetCommand'), \ 'callback': 'ale#handlers#haskell#HandleGHCFormat', \}) diff --git a/sources_non_forked/ale/ale_linters/html/angular.vim b/sources_non_forked/ale/ale_linters/html/angular.vim new file mode 100644 index 00000000..17c0a751 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/html/angular.vim @@ -0,0 +1,52 @@ +" Author: w0rp +" Description: tsserver integration for ALE + +call ale#Set('html_angular_executable', 'ngserver') +call ale#Set('html_angular_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale_linters#html#angular#GetProjectRoot(buffer) abort + return ale#path#Dirname( + \ ale#path#FindNearestDirectory(a:buffer, 'node_modules') + \) +endfunction + +function! ale_linters#html#angular#GetExecutable(buffer) abort + return ale#path#FindExecutable(a:buffer, 'html_angular', [ + \ 'node_modules/@angular/language-server/bin/ngserver', + \ 'node_modules/@angular/language-server/index.js', + \]) +endfunction + +function! ale_linters#html#angular#GetCommand(buffer) abort + let l:language_service_dir = ale#path#Simplify( + \ ale#path#FindNearestDirectory( + \ a:buffer, + \ 'node_modules/@angular/language-service' + \ ) + \) + + if empty(l:language_service_dir) + return '' + endif + + let l:language_service_dir = fnamemodify(l:language_service_dir, ':h') + let l:typescript_dir = ale#path#Simplify( + \ fnamemodify(l:language_service_dir, ':h:h') + \ . '/typescript' + \) + let l:executable = ale_linters#html#angular#GetExecutable(a:buffer) + + return ale#node#Executable(a:buffer, l:executable) + \ . ' --ngProbeLocations ' . ale#Escape(l:language_service_dir) + \ . ' --tsProbeLocations ' . ale#Escape(l:typescript_dir) + \ . ' --stdio' +endfunction + +call ale#linter#Define('html', { +\ 'name': 'angular', +\ 'aliases': ['angular-language-server'], +\ 'lsp': 'stdio', +\ 'executable': function('ale_linters#html#angular#GetExecutable'), +\ 'command': function('ale_linters#html#angular#GetCommand'), +\ 'project_root': function('ale_linters#html#angular#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/html/fecs.vim b/sources_non_forked/ale/ale_linters/html/fecs.vim new file mode 100644 index 00000000..15e00e12 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/html/fecs.vim @@ -0,0 +1,9 @@ +" Author: harttle +" Description: fecs for HTMl files + +call ale#linter#Define('html', { +\ 'name': 'fecs', +\ 'executable': function('ale#handlers#fecs#GetExecutable'), +\ 'command': function('ale#handlers#fecs#GetCommand'), +\ 'callback': 'ale#handlers#fecs#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/html/htmlhint.vim b/sources_non_forked/ale/ale_linters/html/htmlhint.vim index 3e01f51a..25bf5137 100644 --- a/sources_non_forked/ale/ale_linters/html/htmlhint.vim +++ b/sources_non_forked/ale/ale_linters/html/htmlhint.vim @@ -24,7 +24,7 @@ endfunction call ale#linter#Define('html', { \ 'name': 'htmlhint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'html_htmlhint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'html_htmlhint', [ \ 'node_modules/.bin/htmlhint', \ ])}, \ 'command': function('ale_linters#html#htmlhint#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/html/stylelint.vim b/sources_non_forked/ale/ale_linters/html/stylelint.vim index ae8955f3..6b7aba40 100644 --- a/sources_non_forked/ale/ale_linters/html/stylelint.vim +++ b/sources_non_forked/ale/ale_linters/html/stylelint.vim @@ -5,7 +5,7 @@ call ale#Set('html_stylelint_options', '') call ale#Set('html_stylelint_use_global', 0) function! ale_linters#html#stylelint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'html_stylelint', [ + return ale#path#FindExecutable(a:buffer, 'html_stylelint', [ \ 'node_modules/.bin/stylelint', \]) endfunction diff --git a/sources_non_forked/ale/ale_linters/ink/ls.vim b/sources_non_forked/ale/ale_linters/ink/ls.vim new file mode 100644 index 00000000..00b2f323 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ink/ls.vim @@ -0,0 +1,35 @@ +" Author: Andreww Hayworth +" Description: Integrate ALE with ink-language-server + +call ale#Set('ink_ls_executable', 'ink-language-server') +call ale#Set('ink_ls_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('ink_ls_initialization_options', {}) + +function! ale_linters#ink#ls#GetExecutable(buffer) abort + return ale#path#FindExecutable(a:buffer, 'ink_ls', [ + \ 'ink-language-server', + \ 'node_modules/.bin/ink-language-server', + \]) +endfunction + +function! ale_linters#ink#ls#GetCommand(buffer) abort + let l:executable = ale_linters#ink#ls#GetExecutable(a:buffer) + + return ale#Escape(l:executable) . ' --stdio' +endfunction + +function! ale_linters#ink#ls#FindProjectRoot(buffer) abort + let l:main_file = get(ale#Var(a:buffer, 'ink_ls_initialization_options'), 'mainStoryPath', 'main.ink') + let l:config = ale#path#ResolveLocalPath(a:buffer, l:main_file, expand('#' . a:buffer . ':p')) + + return ale#path#Dirname(l:config) +endfunction + +call ale#linter#Define('ink', { +\ 'name': 'ink-language-server', +\ 'lsp': 'stdio', +\ 'executable': function('ale_linters#ink#ls#GetExecutable'), +\ 'command': function('ale_linters#ink#ls#GetCommand'), +\ 'project_root': function('ale_linters#ink#ls#FindProjectRoot'), +\ 'initialization_options': {b -> ale#Var(b, 'ink_ls_initialization_options')}, +\}) diff --git a/sources_non_forked/ale/ale_linters/inko/inko.vim b/sources_non_forked/ale/ale_linters/inko/inko.vim new file mode 100644 index 00000000..11558897 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/inko/inko.vim @@ -0,0 +1,33 @@ +" Author: Yorick Peterse +" Description: linting of Inko source code using the Inko compiler + +call ale#Set('inko_inko_executable', 'inko') + +function! ale_linters#inko#inko#GetCommand(buffer) abort + let l:include = '' + + " Include the tests source directory, but only for test files. + if expand('#' . a:buffer . ':p') =~? '\vtests[/\\]test[/\\]' + let l:test_dir = ale#path#FindNearestDirectory(a:buffer, 'tests') + + if isdirectory(l:test_dir) + let l:include = '--include ' . ale#Escape(l:test_dir) + endif + endif + + " We use %s instead of %t so the compiler determines the correct module + " names for the file being edited. Not doing so may lead to errors in + " certain cases. + return '%e build --check --format=json' + \ . ale#Pad(l:include) + \ . ' %s' +endfunction + +call ale#linter#Define('inko', { +\ 'name': 'inko', +\ 'executable': {b -> ale#Var(b, 'inko_inko_executable')}, +\ 'command': function('ale_linters#inko#inko#GetCommand'), +\ 'callback': 'ale#handlers#inko#Handle', +\ 'output_stream': 'stderr', +\ 'lint_file': 1 +\}) diff --git a/sources_non_forked/ale/ale_linters/java/checkstyle.vim b/sources_non_forked/ale/ale_linters/java/checkstyle.vim index 3159cd55..1ccbc505 100644 --- a/sources_non_forked/ale/ale_linters/java/checkstyle.vim +++ b/sources_non_forked/ale/ale_linters/java/checkstyle.vim @@ -1,15 +1,20 @@ " Author: Devon Meunier " Description: checkstyle for Java files +call ale#Set('java_checkstyle_executable', 'checkstyle') +call ale#Set('java_checkstyle_config', '/google_checks.xml') +call ale#Set('java_checkstyle_options', '') + function! ale_linters#java#checkstyle#Handle(buffer, lines) abort let l:output = [] " modern checkstyle versions - let l:pattern = '\v\[(WARN|ERROR)\] [a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.*) \[(.+)\]$' + let l:pattern = '\v\[(WARN|ERROR)\] [a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.*) \[(.+)\]' for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'type': l:match[1] is? 'WARN' ? 'W' : 'E', + \ 'sub_type': 'style', \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'text': l:match[4], @@ -17,12 +22,17 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort \}) endfor + if !empty(l:output) + return l:output + endif + " old checkstyle versions let l:pattern = '\v(.+):(\d+): ([^:]+): (.+)$' for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'type': l:match[3] is? 'warning' ? 'W' : 'E', + \ 'sub_type': 'style', \ 'lnum': l:match[2] + 0, \ 'text': l:match[4], \}) @@ -31,19 +41,32 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort return l:output endfunction +function! s:GetConfig(buffer, config) abort + if ale#path#IsAbsolute(a:config) + return a:config + endif + + let s:file = ale#path#FindNearestFile(a:buffer, a:config) + + return !empty(s:file) ? s:file : a:config +endfunction + function! ale_linters#java#checkstyle#GetCommand(buffer) abort - return 'checkstyle ' - \ . ale#Var(a:buffer, 'java_checkstyle_options') + let l:options = ale#Var(a:buffer, 'java_checkstyle_options') + let l:config_option = ale#Var(a:buffer, 'java_checkstyle_config') + let l:config = l:options !~# '\v(^| )-c ' && !empty(l:config_option) + \ ? s:GetConfig(a:buffer, l:config_option) + \ : '' + + return '%e' + \ . ale#Pad(l:options) + \ . (!empty(l:config) ? ' -c ' . ale#Escape(l:config) : '') \ . ' %s' endfunction -if !exists('g:ale_java_checkstyle_options') - let g:ale_java_checkstyle_options = '-c /google_checks.xml' -endif - call ale#linter#Define('java', { \ 'name': 'checkstyle', -\ 'executable': 'checkstyle', +\ 'executable': {b -> ale#Var(b, 'java_checkstyle_executable')}, \ 'command': function('ale_linters#java#checkstyle#GetCommand'), \ 'callback': 'ale_linters#java#checkstyle#Handle', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/java/eclipselsp.vim b/sources_non_forked/ale/ale_linters/java/eclipselsp.vim new file mode 100644 index 00000000..adfd1b09 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/java/eclipselsp.vim @@ -0,0 +1,195 @@ +" Author: Horacio Sanson +" Description: Support for the Eclipse language server https://github.com/eclipse/eclipse.jdt.ls + +let s:version_cache = {} + +call ale#Set('java_eclipselsp_path', ale#path#Simplify($HOME . '/eclipse.jdt.ls')) +call ale#Set('java_eclipselsp_config_path', '') +call ale#Set('java_eclipselsp_workspace_path', '') +call ale#Set('java_eclipselsp_executable', 'java') +call ale#Set('java_eclipselsp_javaagent', '') + +function! ale_linters#java#eclipselsp#Executable(buffer) abort + return ale#Var(a:buffer, 'java_eclipselsp_executable') +endfunction + +function! ale_linters#java#eclipselsp#TargetPath(buffer) abort + return ale#Var(a:buffer, 'java_eclipselsp_path') +endfunction + +function! ale_linters#java#eclipselsp#JarPath(buffer) abort + let l:path = ale_linters#java#eclipselsp#TargetPath(a:buffer) + + if has('win32') + let l:platform = 'win32' + elseif has('macunix') + let l:platform = 'macosx' + else + let l:platform = 'linux' + endif + + " Search jar file within repository path when manually built using mvn + let l:files = globpath(l:path, '**/'.l:platform.'/**/plugins/org.eclipse.equinox.launcher_*\.jar', 1, 1) + + if len(l:files) >= 1 + return l:files[0] + endif + + " Search jar file within VSCode extensions folder. + let l:files = globpath(l:path, '**/'.l:platform.'/plugins/org.eclipse.equinox.launcher_*\.jar', 1, 1) + + if len(l:files) >= 1 + return l:files[0] + endif + + " Search jar file within unzipped tar.gz file + let l:files = globpath(l:path, 'plugins/org.eclipse.equinox.launcher_*\.jar', 1, 1) + + if len(l:files) >= 1 + return l:files[0] + endif + + " Search jar file within system package path + let l:files = globpath('/usr/share/java/jdtls/plugins', 'org.eclipse.equinox.launcher_*\.jar', 1, 1) + + if len(l:files) >= 1 + return l:files[0] + endif + + return '' +endfunction + +function! ale_linters#java#eclipselsp#ConfigurationPath(buffer) abort + let l:path = fnamemodify(ale_linters#java#eclipselsp#JarPath(a:buffer), ':p:h:h') + let l:config_path = ale#Var(a:buffer, 'java_eclipselsp_config_path') + + if !empty(l:config_path) + return ale#path#Simplify(l:config_path) + endif + + if has('win32') + let l:path = l:path . '/config_win' + elseif has('macunix') + let l:path = l:path . '/config_mac' + else + let l:path = l:path . '/config_linux' + endif + + return ale#path#Simplify(l:path) +endfunction + +function! ale_linters#java#eclipselsp#VersionCheck(version_lines) abort + return s:GetVersion('', a:version_lines) +endfunction + +function! s:GetVersion(executable, version_lines) abort + let l:version = [] + + for l:line in a:version_lines + let l:match = matchlist(l:line, '\(\d\+\)\.\(\d\+\)\.\(\d\+\)') + + if !empty(l:match) + let l:version = [l:match[1] + 0, l:match[2] + 0, l:match[3] + 0] + let s:version_cache[a:executable] = l:version + break + endif + endfor + + return l:version +endfunction + +function! ale_linters#java#eclipselsp#CommandWithVersion(buffer, version_lines, meta) abort + let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer) + let l:version = s:GetVersion(l:executable, a:version_lines) + + return ale_linters#java#eclipselsp#Command(a:buffer, l:version) +endfunction + +function! ale_linters#java#eclipselsp#WorkspacePath(buffer) abort + let l:wspath = ale#Var(a:buffer, 'java_eclipselsp_workspace_path') + + if !empty(l:wspath) + return l:wspath + endif + + return ale#path#Dirname(ale#java#FindProjectRoot(a:buffer)) +endfunction + +function! ale_linters#java#eclipselsp#Javaagent(buffer) abort + let l:rets = [] + let l:raw = ale#Var(a:buffer, 'java_eclipselsp_javaagent') + + if empty(l:raw) + return '' + endif + + let l:jars = split(l:raw) + + for l:jar in l:jars + call add(l:rets, ale#Escape('-javaagent:' . l:jar)) + endfor + + return join(l:rets, ' ') +endfunction + +function! ale_linters#java#eclipselsp#Command(buffer, version) abort + let l:path = ale#Var(a:buffer, 'java_eclipselsp_path') + + let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer) + + let l:cmd = [ ale#Escape(l:executable), + \ ale_linters#java#eclipselsp#Javaagent(a:buffer), + \ '-Declipse.application=org.eclipse.jdt.ls.core.id1', + \ '-Dosgi.bundles.defaultStartLevel=4', + \ '-Declipse.product=org.eclipse.jdt.ls.core.product', + \ '-Dlog.level=ALL', + \ '-noverify', + \ '-Xmx1G', + \ '-jar', + \ ale#Escape(ale_linters#java#eclipselsp#JarPath(a:buffer)), + \ '-configuration', + \ ale#Escape(ale_linters#java#eclipselsp#ConfigurationPath(a:buffer)), + \ '-data', + \ ale#Escape(ale_linters#java#eclipselsp#WorkspacePath(a:buffer)) + \ ] + + if ale#semver#GTE(a:version, [1, 9]) + call add(l:cmd, '--add-modules=ALL-SYSTEM') + call add(l:cmd, '--add-opens java.base/java.util=ALL-UNNAMED') + call add(l:cmd, '--add-opens java.base/java.lang=ALL-UNNAMED') + endif + + return join(l:cmd, ' ') +endfunction + +function! ale_linters#java#eclipselsp#RunWithVersionCheck(buffer) abort + let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer) + + if empty(l:executable) + return '' + endif + + let l:cache = s:version_cache + + if has_key(s:version_cache, l:executable) + return ale_linters#java#eclipselsp#Command(a:buffer, s:version_cache[l:executable]) + endif + + let l:command = ale#Escape(l:executable) . ' -version' + + return ale#command#Run( + \ a:buffer, + \ l:command, + \ function('ale_linters#java#eclipselsp#CommandWithVersion'), + \ { 'output_stream': 'both' } + \) +endfunction + +call ale#linter#Define('java', { +\ 'name': 'eclipselsp', +\ 'lsp': 'stdio', +\ 'executable': function('ale_linters#java#eclipselsp#Executable'), +\ 'command': function('ale_linters#java#eclipselsp#RunWithVersionCheck'), +\ 'language': 'java', +\ 'project_root': function('ale#java#FindProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/java/javac.vim b/sources_non_forked/ale/ale_linters/java/javac.vim index 50cabacd..971e8de0 100644 --- a/sources_non_forked/ale/ale_linters/java/javac.vim +++ b/sources_non_forked/ale/ale_linters/java/javac.vim @@ -6,38 +6,52 @@ let s:classpath_sep = has('unix') ? ':' : ';' call ale#Set('java_javac_executable', 'javac') call ale#Set('java_javac_options', '') call ale#Set('java_javac_classpath', '') +call ale#Set('java_javac_sourcepath', '') -function! ale_linters#java#javac#GetImportPaths(buffer) abort - let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml') +function! ale_linters#java#javac#RunWithImportPaths(buffer) abort + let [l:cwd, l:command] = ale#maven#BuildClasspathCommand(a:buffer) - if !empty(l:pom_path) && executable('mvn') - return ale#path#CdString(fnamemodify(l:pom_path, ':h')) - \ . 'mvn dependency:build-classpath' + " Try to use Gradle if Maven isn't available. + if empty(l:command) + let [l:cwd, l:command] = ale#gradle#BuildClasspathCommand(a:buffer) endif - let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer) - - if !empty(l:classpath_command) - return l:classpath_command + " Try to use Ant if Gradle and Maven aren't available + if empty(l:command) + let [l:cwd, l:command] = ale#ant#BuildClasspathCommand(a:buffer) endif - return '' + if empty(l:command) + return ale_linters#java#javac#GetCommand(a:buffer, [], {}) + endif + + return ale#command#Run( + \ a:buffer, + \ l:command, + \ function('ale_linters#java#javac#GetCommand'), + \ {'cwd': l:cwd}, + \) endfunction function! s:BuildClassPathOption(buffer, import_paths) abort " Filter out lines like [INFO], etc. let l:class_paths = filter(a:import_paths[:], 'v:val !~# ''[''') - call extend( - \ l:class_paths, - \ split(ale#Var(a:buffer, 'java_javac_classpath'), s:classpath_sep), - \) + let l:cls_path = ale#Var(a:buffer, 'java_javac_classpath') + + if !empty(l:cls_path) && type(l:cls_path) is v:t_string + call extend(l:class_paths, split(l:cls_path, s:classpath_sep)) + endif + + if !empty(l:cls_path) && type(l:cls_path) is v:t_list + call extend(l:class_paths, l:cls_path) + endif return !empty(l:class_paths) \ ? '-cp ' . ale#Escape(join(l:class_paths, s:classpath_sep)) \ : '' endfunction -function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort +function! ale_linters#java#javac#GetCommand(buffer, import_paths, meta) abort let l:cp_option = s:BuildClassPathOption(a:buffer, a:import_paths) let l:sp_option = '' @@ -66,6 +80,27 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort endif endif + let l:source_paths = [] + let l:source_path = ale#Var(a:buffer, 'java_javac_sourcepath') + + if !empty(l:source_path) && type(l:source_path) is v:t_string + let l:source_paths = split(l:source_path, s:classpath_sep) + endif + + if !empty(l:source_path) && type(l:source_path) is v:t_list + let l:source_paths = l:source_path + endif + + if !empty(l:source_paths) + for l:path in l:source_paths + let l:sp_path = ale#path#FindNearestDirectory(a:buffer, l:path) + + if !empty(l:sp_path) + call add(l:sp_dirs, l:sp_path) + endif + endfor + endif + if !empty(l:sp_dirs) let l:sp_option = '-sourcepath ' \ . ale#Escape(join(l:sp_dirs, s:classpath_sep)) @@ -76,8 +111,7 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort " Always run javac from the directory the file is in, so we can resolve " relative paths correctly. - return ale#path#BufferCdString(a:buffer) - \ . '%e -Xlint' + return '%e -Xlint' \ . ale#Pad(l:cp_option) \ . ale#Pad(l:sp_option) \ . ' -d ' . ale#Escape(l:class_file_directory) @@ -91,14 +125,16 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort " Main.java:13: warning: [deprecation] donaught() in Testclass has been deprecated " Main.java:16: error: ';' expected let l:directory = expand('#' . a:buffer . ':p:h') - let l:pattern = '\v^(.*):(\d+): (.+):(.+)$' + let l:pattern = '\v^(.*):(\d+): (.{-1,}):(.+)$' let l:col_pattern = '\v^(\s*\^)$' let l:symbol_pattern = '\v^ +symbol: *(class|method) +([^ ]+)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:col_pattern, l:symbol_pattern]) if empty(l:match[2]) && empty(l:match[3]) - let l:output[-1].col = len(l:match[1]) + if !empty(l:match[1]) && !empty(l:output) + let l:output[-1].col = len(l:match[1]) + endif elseif empty(l:match[3]) " Add symbols to 'cannot find symbol' errors. if l:output[-1].text is# 'error: cannot find symbol' @@ -120,9 +156,8 @@ endfunction call ale#linter#Define('java', { \ 'name': 'javac', \ 'executable': {b -> ale#Var(b, 'java_javac_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale_linters#java#javac#GetImportPaths', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#java#javac#GetCommand', 'output_stream': 'stderr'}, -\ ], +\ 'cwd': '%s:h', +\ 'command': function('ale_linters#java#javac#RunWithImportPaths'), +\ 'output_stream': 'stderr', \ 'callback': 'ale_linters#java#javac#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/java/javalsp.vim b/sources_non_forked/ale/ale_linters/java/javalsp.vim index a327363d..baf584c8 100644 --- a/sources_non_forked/ale/ale_linters/java/javalsp.vim +++ b/sources_non_forked/ale/ale_linters/java/javalsp.vim @@ -1,16 +1,47 @@ " Author: Horacio Sanson " Description: Support for the Java language server https://github.com/georgewfraser/vscode-javac -call ale#Set('java_javalsp_executable', 'java') +call ale#Set('java_javalsp_executable', '') +call ale#Set('java_javalsp_config', {}) function! ale_linters#java#javalsp#Executable(buffer) abort return ale#Var(a:buffer, 'java_javalsp_executable') endfunction +function! ale_linters#java#javalsp#Config(buffer) abort + let l:defaults = { 'java': { 'classPath': [], 'externalDependencies': [] } } + let l:config = ale#Var(a:buffer, 'java_javalsp_config') + + " Ensure the config dictionary contains both classPath and + " externalDependencies keys to avoid a NPE crash on Java Language Server. + call extend(l:config, l:defaults, 'keep') + call extend(l:config['java'], l:defaults['java'], 'keep') + + return l:config +endfunction + function! ale_linters#java#javalsp#Command(buffer) abort let l:executable = ale_linters#java#javalsp#Executable(a:buffer) - return ale#Escape(l:executable) . ' -Xverify:none -m javacs/org.javacs.Main' + if fnamemodify(l:executable, ':t') is# 'java' + " For backward compatibility. + let l:cmd = [ + \ ale#Escape(l:executable), + \ '--add-exports jdk.compiler/com.sun.tools.javac.api=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.code=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.comp=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.main=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.tree=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.model=javacs', + \ '--add-exports jdk.compiler/com.sun.tools.javac.util=javacs', + \ '--add-opens jdk.compiler/com.sun.tools.javac.api=javacs', + \ '-m javacs/org.javacs.Main', + \] + + return join(l:cmd, ' ') + else + return ale#Escape(l:executable) + endif endfunction call ale#linter#Define('java', { @@ -20,4 +51,5 @@ call ale#linter#Define('java', { \ 'command': function('ale_linters#java#javalsp#Command'), \ 'language': 'java', \ 'project_root': function('ale#java#FindProjectRoot'), +\ 'lsp_config': function('ale_linters#java#javalsp#Config') \}) diff --git a/sources_non_forked/ale/ale_linters/javascript/deno.vim b/sources_non_forked/ale/ale_linters/javascript/deno.vim new file mode 100644 index 00000000..659eb855 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/javascript/deno.vim @@ -0,0 +1,11 @@ +" Author: Arnold Chand +" Description: Deno lsp linter for JavaScript files. + +call ale#linter#Define('javascript', { +\ 'name': 'deno', +\ 'lsp': 'stdio', +\ 'executable': function('ale#handlers#deno#GetExecutable'), +\ 'command': '%e lsp', +\ 'project_root': function('ale#handlers#deno#GetProjectRoot'), +\ 'initialization_options': function('ale#handlers#deno#GetInitializationOptions'), +\}) diff --git a/sources_non_forked/ale/ale_linters/javascript/eslint.vim b/sources_non_forked/ale/ale_linters/javascript/eslint.vim index 8aeac2d8..cf4de6ec 100644 --- a/sources_non_forked/ale/ale_linters/javascript/eslint.vim +++ b/sources_non_forked/ale/ale_linters/javascript/eslint.vim @@ -5,6 +5,7 @@ call ale#linter#Define('javascript', { \ '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#Handle', +\ 'callback': 'ale#handlers#eslint#HandleJSON', \}) diff --git a/sources_non_forked/ale/ale_linters/javascript/fecs.vim b/sources_non_forked/ale/ale_linters/javascript/fecs.vim new file mode 100644 index 00000000..e47c0a0b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/javascript/fecs.vim @@ -0,0 +1,10 @@ +" Author: harttle +" Description: fecs for JavaScript files + +call ale#linter#Define('javascript', { +\ 'name': 'fecs', +\ 'executable': function('ale#handlers#fecs#GetExecutable'), +\ 'command': function('ale#handlers#fecs#GetCommand'), +\ 'read_buffer': 0, +\ 'callback': 'ale#handlers#fecs#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/javascript/flow.vim b/sources_non_forked/ale/ale_linters/javascript/flow.vim index 05aae030..601bac33 100644 --- a/sources_non_forked/ale/ale_linters/javascript/flow.vim +++ b/sources_non_forked/ale/ale_linters/javascript/flow.vim @@ -22,37 +22,18 @@ function! ale_linters#javascript#flow#GetExecutable(buffer) abort return '' endif - return ale#node#FindExecutable(a:buffer, 'javascript_flow', [ + return ale#path#FindExecutable(a:buffer, 'javascript_flow', [ \ 'node_modules/.bin/flow', \]) endfunction -function! ale_linters#javascript#flow#VersionCheck(buffer) abort - let l:executable = ale_linters#javascript#flow#GetExecutable(a:buffer) - - if empty(l:executable) - return '' - endif - - return ale#Escape(l:executable) . ' --version' -endfunction - -function! ale_linters#javascript#flow#GetCommand(buffer, version_lines) abort - let l:executable = ale_linters#javascript#flow#GetExecutable(a:buffer) - - if empty(l:executable) - return '' - endif - - let l:version = ale#semver#GetVersion(l:executable, a:version_lines) - +function! ale_linters#javascript#flow#GetCommand(buffer, version) abort " If we can parse the version number, then only use --respect-pragma " if the version is >= 0.36.0, which added the argument. let l:use_respect_pragma = ale#Var(a:buffer, 'javascript_flow_use_respect_pragma') - \ && (empty(l:version) || ale#semver#GTE(l:version, [0, 36])) + \ && (empty(a:version) || ale#semver#GTE(a:version, [0, 36])) - return ale#Escape(l:executable) - \ . ' check-contents' + return '%e check-contents' \ . (l:use_respect_pragma ? ' --respect-pragma': '') \ . ' --json --from ale %s < %t' \ . (!has('win32') ? '; echo' : '') @@ -87,7 +68,6 @@ function! s:ExtraErrorMsg(current, new) abort return l:newMsg endfunction - function! s:GetDetails(error) abort let l:detail = '' @@ -169,10 +149,12 @@ endfunction call ale#linter#Define('javascript', { \ 'name': 'flow', \ 'executable': function('ale_linters#javascript#flow#GetExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#javascript#flow#VersionCheck'}, -\ {'callback': 'ale_linters#javascript#flow#GetCommand'}, -\ ], +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale_linters#javascript#flow#GetExecutable(buffer), +\ '%e --version', +\ function('ale_linters#javascript#flow#GetCommand'), +\ )}, \ 'callback': 'ale_linters#javascript#flow#Handle', \ 'read_buffer': 0, \}) diff --git a/sources_non_forked/ale/ale_linters/javascript/flow_ls.vim b/sources_non_forked/ale/ale_linters/javascript/flow_ls.vim index accaaa73..fec34011 100644 --- a/sources_non_forked/ale/ale_linters/javascript/flow_ls.vim +++ b/sources_non_forked/ale/ale_linters/javascript/flow_ls.vim @@ -19,7 +19,7 @@ endfunction call ale#linter#Define('javascript', { \ 'name': 'flow-language-server', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_flow_ls', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_flow_ls', [ \ 'node_modules/.bin/flow', \ ])}, \ 'command': '%e lsp --from ale-lsp', diff --git a/sources_non_forked/ale/ale_linters/javascript/jscs.vim b/sources_non_forked/ale/ale_linters/javascript/jscs.vim index 8905b3a1..ae3be68c 100644 --- a/sources_non_forked/ale/ale_linters/javascript/jscs.vim +++ b/sources_non_forked/ale/ale_linters/javascript/jscs.vim @@ -53,7 +53,7 @@ endfunction call ale#linter#Define('javascript', { \ 'name': 'jscs', -\ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_jscs', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_jscs', [ \ 'node_modules/.bin/jscs', \ ])}, \ 'command': function('ale_linters#javascript#jscs#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/javascript/jshint.vim b/sources_non_forked/ale/ale_linters/javascript/jshint.vim index d80a2250..26d4fda2 100644 --- a/sources_non_forked/ale/ale_linters/javascript/jshint.vim +++ b/sources_non_forked/ale/ale_linters/javascript/jshint.vim @@ -25,7 +25,7 @@ endfunction call ale#linter#Define('javascript', { \ 'name': 'jshint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_jshint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_jshint', [ \ 'node_modules/.bin/jshint', \ ])}, \ 'command': function('ale_linters#javascript#jshint#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/javascript/standard.vim b/sources_non_forked/ale/ale_linters/javascript/standard.vim index 4cd2c303..addf41dd 100644 --- a/sources_non_forked/ale/ale_linters/javascript/standard.vim +++ b/sources_non_forked/ale/ale_linters/javascript/standard.vim @@ -6,8 +6,10 @@ call ale#Set('javascript_standard_use_global', get(g:, 'ale_use_global_executabl call ale#Set('javascript_standard_options', '') function! ale_linters#javascript#standard#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_standard', [ + return ale#path#FindExecutable(a:buffer, 'javascript_standard', [ + \ 'node_modules/standardx/bin/cmd.js', \ 'node_modules/standard/bin/cmd.js', + \ 'node_modules/semistandard/bin/cmd.js', \ 'node_modules/.bin/standard', \]) endfunction diff --git a/sources_non_forked/ale/ale_linters/javascript/tsserver.vim b/sources_non_forked/ale/ale_linters/javascript/tsserver.vim index 68c252c5..caf6972b 100644 --- a/sources_non_forked/ale/ale_linters/javascript/tsserver.vim +++ b/sources_non_forked/ale/ale_linters/javascript/tsserver.vim @@ -8,7 +8,7 @@ call ale#Set('javascript_tsserver_use_global', get(g:, 'ale_use_global_executabl call ale#linter#Define('javascript', { \ 'name': 'tsserver', \ 'lsp': 'tsserver', -\ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_tsserver', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_tsserver', [ \ 'node_modules/.bin/tsserver', \ ])}, \ 'command': '%e', diff --git a/sources_non_forked/ale/ale_linters/javascript/xo.vim b/sources_non_forked/ale/ale_linters/javascript/xo.vim index 4ba39101..5e04ad5c 100644 --- a/sources_non_forked/ale/ale_linters/javascript/xo.vim +++ b/sources_non_forked/ale/ale_linters/javascript/xo.vim @@ -1,26 +1,9 @@ " Author: Daniel Lupu " Description: xo for JavaScript files -call ale#Set('javascript_xo_executable', 'xo') -call ale#Set('javascript_xo_use_global', get(g:, 'ale_use_global_executables', 0)) -call ale#Set('javascript_xo_options', '') - -function! ale_linters#javascript#xo#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_xo', [ - \ 'node_modules/.bin/xo', - \]) -endfunction - -function! ale_linters#javascript#xo#GetCommand(buffer) abort - return ale#Escape(ale_linters#javascript#xo#GetExecutable(a:buffer)) - \ . ' ' . ale#Var(a:buffer, 'javascript_xo_options') - \ . ' --reporter unix --stdin --stdin-filename %s' -endfunction - -" xo uses eslint and the output format is the same call ale#linter#Define('javascript', { \ 'name': 'xo', -\ 'executable': function('ale_linters#javascript#xo#GetExecutable'), -\ 'command': function('ale_linters#javascript#xo#GetCommand'), -\ 'callback': 'ale#handlers#eslint#Handle', +\ 'executable': function('ale#handlers#xo#GetExecutable'), +\ 'command': function('ale#handlers#xo#GetLintCommand'), +\ 'callback': 'ale#handlers#xo#HandleJSON', \}) diff --git a/sources_non_forked/ale/ale_linters/json/eslint.vim b/sources_non_forked/ale/ale_linters/json/eslint.vim new file mode 100644 index 00000000..bdabb9fa --- /dev/null +++ b/sources_non_forked/ale/ale_linters/json/eslint.vim @@ -0,0 +1,16 @@ +" Author: Joรฃo Pesce +" Description: eslint for JSON files. +" +" Requires eslint-plugin-jsonc or a similar plugin to work +" +" Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp +" + +call ale#linter#Define('json', { +\ 'name': 'eslint', +\ 'output_stream': 'both', +\ 'executable': function('ale#handlers#eslint#GetExecutable'), +\ 'cwd': function('ale#handlers#eslint#GetCwd'), +\ 'command': function('ale#handlers#eslint#GetCommand'), +\ 'callback': 'ale#handlers#eslint#HandleJSON', +\}) diff --git a/sources_non_forked/ale/ale_linters/json/jq.vim b/sources_non_forked/ale/ale_linters/json/jq.vim new file mode 100644 index 00000000..2f36a29e --- /dev/null +++ b/sources_non_forked/ale/ale_linters/json/jq.vim @@ -0,0 +1,24 @@ +" Author: jD91mZM2 +call ale#Set('json_jq_executable', 'jq') +call ale#Set('json_jq_options', '') +call ale#Set('json_jq_filters', '.') + +" Matches patterns like the following: +" parse error: Expected another key-value pair at line 4, column 3 +let s:pattern = '^parse error: \(.\+\) at line \(\d\+\), column \(\d\+\)$' + +function! ale_linters#json#jq#Handle(buffer, lines) abort + return ale#util#MapMatches(a:lines, s:pattern, {match -> { + \ 'text': match[1], + \ 'lnum': match[2] + 0, + \ 'col': match[3] + 0, + \}}) +endfunction + +call ale#linter#Define('json', { +\ 'name': 'jq', +\ 'executable': {b -> ale#Var(b, 'json_jq_executable')}, +\ 'output_stream': 'stderr', +\ 'command': '%e', +\ 'callback': 'ale_linters#json#jq#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/json/jsonlint.vim b/sources_non_forked/ale/ale_linters/json/jsonlint.vim index f677b488..812540af 100644 --- a/sources_non_forked/ale/ale_linters/json/jsonlint.vim +++ b/sources_non_forked/ale/ale_linters/json/jsonlint.vim @@ -4,7 +4,7 @@ call ale#Set('json_jsonlint_executable', 'jsonlint') call ale#Set('json_jsonlint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#json#jsonlint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'json_jsonlint', [ + return ale#path#FindExecutable(a:buffer, 'json_jsonlint', [ \ 'node_modules/.bin/jsonlint', \ 'node_modules/jsonlint/lib/cli.js', \]) diff --git a/sources_non_forked/ale/ale_linters/json/spectral.vim b/sources_non_forked/ale/ale_linters/json/spectral.vim new file mode 100644 index 00000000..14129c56 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/json/spectral.vim @@ -0,0 +1,14 @@ +" Author: t2h5 +" Description: Integration of Stoplight Spectral CLI with ALE. + +call ale#Set('json_spectral_executable', 'spectral') +call ale#Set('json_spectral_use_global', get(g:, 'ale_use_global_executables', 0)) + +call ale#linter#Define('json', { +\ 'name': 'spectral', +\ 'executable': {b -> ale#path#FindExecutable(b, 'json_spectral', [ +\ 'node_modules/.bin/spectral', +\ ])}, +\ 'command': '%e lint --ignore-unknown-format -q -f text %t', +\ 'callback': 'ale#handlers#spectral#HandleSpectralOutput' +\}) diff --git a/sources_non_forked/ale/ale_linters/json5/eslint.vim b/sources_non_forked/ale/ale_linters/json5/eslint.vim new file mode 100644 index 00000000..6207f2d7 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/json5/eslint.vim @@ -0,0 +1,16 @@ +" Author: Joรฃo Pesce +" Description: eslint for JSON5 files. +" +" Requires eslint-plugin-jsonc or a similar plugin to work +" +" Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp +" + +call ale#linter#Define('json5', { +\ 'name': 'eslint', +\ 'output_stream': 'both', +\ 'executable': function('ale#handlers#eslint#GetExecutable'), +\ 'cwd': function('ale#handlers#eslint#GetCwd'), +\ 'command': function('ale#handlers#eslint#GetCommand'), +\ 'callback': 'ale#handlers#eslint#HandleJSON', +\}) diff --git a/sources_non_forked/ale/ale_linters/jsonc/eslint.vim b/sources_non_forked/ale/ale_linters/jsonc/eslint.vim new file mode 100644 index 00000000..1a5cc528 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/jsonc/eslint.vim @@ -0,0 +1,16 @@ +" Author: Joรฃo Pesce +" Description: eslint for JSONC files. +" +" Requires eslint-plugin-jsonc or a similar plugin to work +" +" Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp +" + +call ale#linter#Define('jsonc', { +\ 'name': 'eslint', +\ 'output_stream': 'both', +\ 'executable': function('ale#handlers#eslint#GetExecutable'), +\ 'cwd': function('ale#handlers#eslint#GetCwd'), +\ 'command': function('ale#handlers#eslint#GetCommand'), +\ 'callback': 'ale#handlers#eslint#HandleJSON', +\}) diff --git a/sources_non_forked/ale/ale_linters/jsonnet/jsonnet_lint.vim b/sources_non_forked/ale/ale_linters/jsonnet/jsonnet_lint.vim new file mode 100644 index 00000000..a5ebdc39 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/jsonnet/jsonnet_lint.vim @@ -0,0 +1,59 @@ +" Author: Trevor Whitney +" Description: jsonnet-lint for jsonnet files + +call ale#Set('jsonnet_jsonnet_lint_executable', 'jsonnet-lint') +call ale#Set('jsonnet_jsonnet_lint_options', '') + +function! ale_linters#jsonnet#jsonnet_lint#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'jsonnet_jsonnet_lint_options') + + return '%e' + \ . ale#Pad(l:options) + \ . ' %t' +endfunction + + +function! ale_linters#jsonnet#jsonnet_lint#Handle(buffer, lines) abort + " Matches patterns line the following: + " + " ERROR: foo.jsonnet:22:3-12 expected token OPERATOR but got (IDENTIFIER, "bar") + " ERROR: hoge.jsonnet:20:3 unexpected: "}" while parsing terminal + " ERROR: main.jsonnet:212:1-14 Expected , or ; but got (IDENTIFIER, "older_cluster") + let l:pattern = '^ERROR: [^:]*:\(\d\+\):\(\d\+\)\(-\d\+\)* \(.*\)' + let l:output = [] + + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) + + if len(l:match) == 0 + continue + endif + + let line_number = l:match[1] + 0 + let column = l:match[2] + 0 + " l:match[3] has optional -14, when linter is showing a range + let text = l:match[4] + + + " vcol is Needed to indicate that the column is a character. + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'lnum': line_number, + \ 'vcol': 0, + \ 'col': column, + \ 'text': text, + \ 'type': 'E', + \ 'nr': -1, + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('jsonnet', { +\ 'name': 'jsonnet_lint', +\ 'output_stream': 'stderr', +\ 'executable': {b -> ale#Var(b, 'jsonnet_jsonnet_lint_executable')}, +\ 'command': function('ale_linters#jsonnet#jsonnet_lint#GetCommand'), +\ 'callback': 'ale_linters#jsonnet#jsonnet_lint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/jsonnet/jsonnetfmt.vim b/sources_non_forked/ale/ale_linters/jsonnet/jsonnetfmt.vim new file mode 100644 index 00000000..8904019e --- /dev/null +++ b/sources_non_forked/ale/ale_linters/jsonnet/jsonnetfmt.vim @@ -0,0 +1,52 @@ +" Authors: Trevor Whitney and Takuya Kosugiyama +" Description: jsonnetfmt for jsonnet files + +call ale#Set('jsonnet_jsonnetfmt_executable', 'jsonnetfmt') +call ale#Set('jsonnet_jsonnetfmt_options', '') + +function! ale_linters#jsonnet#jsonnetfmt#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_options') + + return '%e' + \ . ale#Pad(l:options) + \ . ' %t' +endfunction + + +function! ale_linters#jsonnet#jsonnetfmt#Handle(buffer, lines) abort + " Matches patterns line the following: + " + " STATIC ERROR: foo.jsonnet:22:3-12: expected token OPERATOR but got (IDENTIFIER, "bar") + " STATIC ERROR: hoge.jsonnet:20:3: unexpected: "}" while parsing terminal + let l:pattern = '^STATIC ERROR:[^:]*:\(\d\+\):\(\d\+\):*\(-\d\+\)* \(.*\)' + let l:output = [] + + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) + + if len(l:match) == 0 + continue + endif + + " vcol is Needed to indicate that the column is a character. + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'lnum': l:match[1] + 0, + \ 'vcol': 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[4], + \ 'type': 'E', + \ 'nr': -1, + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('jsonnet', { +\ 'name': 'jsonnetfmt', +\ 'output_stream': 'stderr', +\ 'executable': {b -> ale#Var(b, 'jsonnet_jsonnetfmt_executable')}, +\ 'command': function('ale_linters#jsonnet#jsonnetfmt#GetCommand'), +\ 'callback': 'ale_linters#jsonnet#jsonnetfmt#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/julia/languageserver.vim b/sources_non_forked/ale/ale_linters/julia/languageserver.vim index 564bec39..999ad815 100644 --- a/sources_non_forked/ale/ale_linters/julia/languageserver.vim +++ b/sources_non_forked/ale/ale_linters/julia/languageserver.vim @@ -6,9 +6,9 @@ call ale#Set('julia_executable', 'julia') function! ale_linters#julia#languageserver#GetCommand(buffer) abort let l:julia_executable = ale#Var(a:buffer, 'julia_executable') - let l:cmd_string = 'using LanguageServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, false); server.runlinter = true; run(server);' + let l:cmd_string = 'using LanguageServer; using Pkg; import StaticLint; import SymbolServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, dirname(Pkg.Types.Context().env.project_file)); server.runlinter = true; run(server);' - return ale#Escape(l:julia_executable) . ' --startup-file=no --history-file=no -e ' . ale#Escape(l:cmd_string) + return ale#Escape(l:julia_executable) . ' --project=@. --startup-file=no --history-file=no -e ' . ale#Escape(l:cmd_string) endfunction call ale#linter#Define('julia', { diff --git a/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim b/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim index 32dcc6d1..e8bc924d 100644 --- a/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim +++ b/sources_non_forked/ale/ale_linters/kotlin/kotlinc.vim @@ -11,26 +11,31 @@ let g:ale_kotlin_kotlinc_module_filename = get(g:, 'ale_kotlin_kotlinc_module_fi let s:classpath_sep = has('unix') ? ':' : ';' -function! ale_linters#kotlin#kotlinc#GetImportPaths(buffer) abort +function! ale_linters#kotlin#kotlinc#RunWithImportPaths(buffer) abort + let l:command = '' + " exec maven/gradle only if classpath is not set - if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# '' - return '' - else - let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml') - - if !empty(l:pom_path) && executable('mvn') - return ale#path#CdString(fnamemodify(l:pom_path, ':h')) - \ . 'mvn dependency:build-classpath' - endif - - let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer) - - if !empty(l:classpath_command) - return l:classpath_command - endif - - return '' + if !empty(ale#Var(a:buffer, 'kotlin_kotlinc_classpath')) + return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {}) endif + + let [l:cwd, l:command] = ale#maven#BuildClasspathCommand(a:buffer) + + " Try to use Gradle if Maven isn't available. + if empty(l:command) + let [l:cwd, l:command] = ale#gradle#BuildClasspathCommand(a:buffer) + endif + + if empty(l:command) + return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {}) + endif + + return ale#command#Run( + \ a:buffer, + \ l:command, + \ function('ale_linters#kotlin#kotlinc#GetCommand'), + \ {'cwd': l:cwd}, + \) endfunction function! s:BuildClassPathOption(buffer, import_paths) abort @@ -46,7 +51,7 @@ function! s:BuildClassPathOption(buffer, import_paths) abort \ : '' endfunction -function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths) abort +function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths, meta) abort let l:kotlinc_opts = ale#Var(a:buffer, 'kotlin_kotlinc_options') let l:command = 'kotlinc ' @@ -165,11 +170,8 @@ endfunction call ale#linter#Define('kotlin', { \ 'name': 'kotlinc', \ 'executable': 'kotlinc', -\ 'command_chain': [ -\ {'callback': 'ale_linters#kotlin#kotlinc#GetImportPaths', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#kotlin#kotlinc#GetCommand', 'output_stream': 'stderr'}, -\ ], +\ 'output_stream': 'stderr', +\ 'command': function('ale_linters#kotlin#kotlinc#RunWithImportPaths'), \ 'callback': 'ale_linters#kotlin#kotlinc#Handle', \ 'lint_file': 1, \}) - diff --git a/sources_non_forked/ale/ale_linters/kotlin/ktlint.vim b/sources_non_forked/ale/ale_linters/kotlin/ktlint.vim index f0384005..0bb64b19 100644 --- a/sources_non_forked/ale/ale_linters/kotlin/ktlint.vim +++ b/sources_non_forked/ale/ale_linters/kotlin/ktlint.vim @@ -6,5 +6,5 @@ call ale#linter#Define('kotlin', { \ 'executable': 'ktlint', \ 'command': function('ale#handlers#ktlint#GetCommand'), \ 'callback': 'ale#handlers#ktlint#Handle', -\ 'lint_file': 1 +\ 'output_stream': 'stderr' \}) diff --git a/sources_non_forked/ale/ale_linters/less/lessc.vim b/sources_non_forked/ale/ale_linters/less/lessc.vim index 4ec8b00e..8e21f5b4 100644 --- a/sources_non_forked/ale/ale_linters/less/lessc.vim +++ b/sources_non_forked/ale/ale_linters/less/lessc.vim @@ -38,7 +38,7 @@ endfunction call ale#linter#Define('less', { \ 'name': 'lessc', -\ 'executable': {b -> ale#node#FindExecutable(b, 'less_lessc', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'less_lessc', [ \ 'node_modules/.bin/lessc', \ ])}, \ 'command': function('ale_linters#less#lessc#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/less/stylelint.vim b/sources_non_forked/ale/ale_linters/less/stylelint.vim index efb036c2..83f784c4 100644 --- a/sources_non_forked/ale/ale_linters/less/stylelint.vim +++ b/sources_non_forked/ale/ale_linters/less/stylelint.vim @@ -12,7 +12,7 @@ endfunction call ale#linter#Define('less', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'less_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'less_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#less#stylelint#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/mail/languagetool.vim b/sources_non_forked/ale/ale_linters/mail/languagetool.vim index 330fb8ec..f68dab7a 100644 --- a/sources_non_forked/ale/ale_linters/mail/languagetool.vim +++ b/sources_non_forked/ale/ale_linters/mail/languagetool.vim @@ -1,4 +1,4 @@ -" Author: Vincent (wahrwolf [รคt] wolfpit.net) +" Author: Vincent (wahrwolf [at] wolfpit.net) " Description: languagetool for mails diff --git a/sources_non_forked/ale/ale_linters/markdown/languagetool.vim b/sources_non_forked/ale/ale_linters/markdown/languagetool.vim index d6bca22e..422a38c3 100644 --- a/sources_non_forked/ale/ale_linters/markdown/languagetool.vim +++ b/sources_non_forked/ale/ale_linters/markdown/languagetool.vim @@ -1,4 +1,4 @@ -" Author: Vincent (wahrwolf [รคt] wolfpit.net) +" Author: Vincent (wahrwolf [at] wolfpit.net) " Description: languagetool for markdown files diff --git a/sources_non_forked/ale/ale_linters/markdown/markdownlint.vim b/sources_non_forked/ale/ale_linters/markdown/markdownlint.vim index e935cbfe..7a293938 100644 --- a/sources_non_forked/ale/ale_linters/markdown/markdownlint.vim +++ b/sources_non_forked/ale/ale_linters/markdown/markdownlint.vim @@ -1,11 +1,22 @@ " Author: Ty-Lucas Kelley " Description: Adds support for markdownlint +call ale#Set('markdown_markdownlint_options', '') + +function! ale_linters#markdown#markdownlint#GetCommand(buffer) abort + let l:executable = 'markdownlint' + + let l:options = ale#Var(a:buffer, 'markdown_markdownlint_options') + + return ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') . ' %s' +endfunction + call ale#linter#Define('markdown', { \ 'name': 'markdownlint', \ 'executable': 'markdownlint', \ 'lint_file': 1, \ 'output_stream': 'both', -\ 'command': 'markdownlint %s', +\ 'command': function('ale_linters#markdown#markdownlint#GetCommand'), \ 'callback': 'ale#handlers#markdownlint#Handle' \}) diff --git a/sources_non_forked/ale/ale_linters/markdown/mdl.vim b/sources_non_forked/ale/ale_linters/markdown/mdl.vim index 305f5359..fd44de6e 100644 --- a/sources_non_forked/ale/ale_linters/markdown/mdl.vim +++ b/sources_non_forked/ale/ale_linters/markdown/mdl.vim @@ -17,18 +17,17 @@ function! ale_linters#markdown#mdl#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'markdown_mdl_options') return ale#Escape(l:executable) . l:exec_args - \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' -j' . (!empty(l:options) ? ' ' . l:options : '') endfunction function! ale_linters#markdown#mdl#Handle(buffer, lines) abort - " matches: '(stdin):173: MD004 Unordered list style' - let l:pattern = ':\(\d*\): \(.*\)$' let l:output = [] - for l:match in ale#util#GetMatches(a:lines, l:pattern) + for l:error in ale#util#FuzzyJSONDecode(a:lines, []) call add(l:output, { - \ 'lnum': l:match[1] + 0, - \ 'text': l:match[2], + \ 'lnum': l:error['line'], + \ 'code': l:error['rule'] . '/' . join(l:error['aliases'], '/'), + \ 'text': l:error['description'], \ 'type': 'W', \}) endfor diff --git a/sources_non_forked/ale/ale_linters/markdown/remark_lint.vim b/sources_non_forked/ale/ale_linters/markdown/remark_lint.vim index ed87d1ad..6085e7ef 100644 --- a/sources_non_forked/ale/ale_linters/markdown/remark_lint.vim +++ b/sources_non_forked/ale/ale_linters/markdown/remark_lint.vim @@ -39,7 +39,7 @@ endfunction call ale#linter#Define('markdown', { \ 'name': 'remark_lint', \ 'aliases': ['remark-lint'], -\ 'executable': {b -> ale#node#FindExecutable(b, 'markdown_remark_lint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'markdown_remark_lint', [ \ 'node_modules/.bin/remark', \ ])}, \ 'command': function('ale_linters#markdown#remark_lint#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/markdown/vale.vim b/sources_non_forked/ale/ale_linters/markdown/vale.vim index 838c4db2..06a64416 100644 --- a/sources_non_forked/ale/ale_linters/markdown/vale.vim +++ b/sources_non_forked/ale/ale_linters/markdown/vale.vim @@ -1,9 +1,24 @@ " Author: chew-z https://github.com/chew-z " Description: vale for Markdown files +call ale#Set('markdown_vale_executable', 'vale') +call ale#Set('markdown_vale_input_file', '%t') +call ale#Set('markdown_vale_options', '') + +function! ale_linters#markdown#vale#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'markdown_vale_executable') + let l:input_file = ale#Var(a:buffer, 'markdown_vale_input_file') + + " Defaults to `vale --output=JSON %t` + return ale#Escape(l:executable) + \ . ' --output=JSON ' + \ . ale#Var(a:buffer, 'markdown_vale_options') + \ . ' ' . l:input_file +endfunction + call ale#linter#Define('markdown', { \ 'name': 'vale', -\ 'executable': 'vale', -\ 'command': 'vale --output=JSON %t', +\ 'executable': {b -> ale#Var(b, 'markdown_vale_executable')}, +\ 'command': function('ale_linters#markdown#vale#GetCommand'), \ 'callback': 'ale#handlers#vale#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/mercury/mmc.vim b/sources_non_forked/ale/ale_linters/mercury/mmc.vim index 8a9ccc0e..85969e10 100644 --- a/sources_non_forked/ale/ale_linters/mercury/mmc.vim +++ b/sources_non_forked/ale/ale_linters/mercury/mmc.vim @@ -5,12 +5,9 @@ call ale#Set('mercury_mmc_executable', 'mmc') call ale#Set('mercury_mmc_options', '--make --output-compile-error-lines 100') function! ale_linters#mercury#mmc#GetCommand(buffer) abort - let l:module_name = expand('#' . a:buffer . ':t:r') - - return ale#path#BufferCdString(a:buffer) - \ . '%e --errorcheck-only ' + return '%e --errorcheck-only ' \ . ale#Var(a:buffer, 'mercury_mmc_options') - \ . ' ' . l:module_name + \ . ' %s:t:r' endfunction function! ale_linters#mercury#mmc#Handle(buffer, lines) abort @@ -34,6 +31,7 @@ call ale#linter#Define('mercury', { \ 'name': 'mmc', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'mercury_mmc_executable')}, +\ 'cwd': '%s:h', \ 'command': function('ale_linters#mercury#mmc#GetCommand'), \ 'callback': 'ale_linters#mercury#mmc#Handle', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/nasm/nasm.vim b/sources_non_forked/ale/ale_linters/nasm/nasm.vim index 347abc1b..c4f53629 100644 --- a/sources_non_forked/ale/ale_linters/nasm/nasm.vim +++ b/sources_non_forked/ale/ale_linters/nasm/nasm.vim @@ -7,10 +7,9 @@ call ale#Set('nasm_nasm_options', '') function! ale_linters#nasm#nasm#GetCommand(buffer) abort " Note that NASM requires a trailing slash for the -I option. let l:separator = has('win32') ? '\' : '/' - let l:path = fnamemodify(bufname(a:buffer), ':p:h') . l:separator let l:output_null = has('win32') ? 'NUL' : '/dev/null' - return '%e -X gnu -I ' . ale#Escape(l:path) + return '%e -X gnu -I %s:h' . l:separator \ . ale#Pad(ale#Var(a:buffer, 'nasm_nasm_options')) \ . ' %s' \ . ' -o ' . l:output_null diff --git a/sources_non_forked/ale/ale_linters/nim/nimcheck.vim b/sources_non_forked/ale/ale_linters/nim/nimcheck.vim index b5796dcd..b739ca04 100644 --- a/sources_non_forked/ale/ale_linters/nim/nimcheck.vim +++ b/sources_non_forked/ale/ale_linters/nim/nimcheck.vim @@ -1,6 +1,15 @@ " Author: Baabelfish " Description: Typechecking for nim files +let s:end_col_patterns = [ +\ '\v''([^'']+)'' is declared but not used.*', +\ '\videntifier expected, but found ''([^'']+)''', +\ '\vimported and not used: ''([^'']+)''.*', +\ '\vundeclared identifier: ''([^'']+)''', +\ '\v''([^'']+)'' cannot be assigned to', +\ '\vredefinition of ''([^'']+)'';', +\] + function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p:t') let l:pattern = '^\(.\+\.nim\)(\(\d\+\), \(\d\+\)) \(.\+\)' @@ -43,6 +52,11 @@ function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort let l:item.code = l:code_match[2] endif + " Find position end_col. + for l:col_match in ale#util#GetMatches(l:item.text, s:end_col_patterns) + let l:item.end_col = l:item.col + len(l:col_match[1]) - 1 + endfor + call add(l:output, l:item) endfor diff --git a/sources_non_forked/ale/ale_linters/nim/nimlsp.vim b/sources_non_forked/ale/ale_linters/nim/nimlsp.vim new file mode 100644 index 00000000..5d041043 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/nim/nimlsp.vim @@ -0,0 +1,33 @@ +" Author: jeremija +" Description: Support for nimlsp (language server for nim) + +call ale#Set('nim_nimlsp_nim_sources', '') + +function! ale_linters#nim#nimlsp#GetProjectRoot(buffer) abort + let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git') + + if !empty(l:project_root) + return fnamemodify(l:project_root, ':h:h') + endif + + return '' +endfunction + +function! ale_linters#nim#nimlsp#GetCommand(buffer) abort + let l:nim_sources = ale#Var(a:buffer, 'nim_nimlsp_nim_sources') + + if !empty(l:nim_sources) + let l:nim_sources = ale#Escape(l:nim_sources) + endif + + return '%e' . ale#Pad(l:nim_sources) +endfunction + +call ale#linter#Define('nim', { +\ 'name': 'nimlsp', +\ 'lsp': 'stdio', +\ 'executable': 'nimlsp', +\ 'command': function('ale_linters#nim#nimlsp#GetCommand'), +\ 'language': 'nim', +\ 'project_root': function('ale_linters#nim#nimlsp#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/nix/nix.vim b/sources_non_forked/ale/ale_linters/nix/nix.vim index 0a0c5c3e..3d91a9ec 100644 --- a/sources_non_forked/ale/ale_linters/nix/nix.vim +++ b/sources_non_forked/ale/ale_linters/nix/nix.vim @@ -1,18 +1,51 @@ " Author: Alistair Bill <@alibabzo> +" Author: Maximilian Bosch " Description: nix-instantiate linter for nix files +function! ale_linters#nix#nix#Command(buffer, output, meta) abort + let l:version = a:output[0][22:] + + if l:version =~# '^\(2.4\|3\).*' + return 'nix-instantiate --log-format internal-json --parse -' + else + return 'nix-instantiate --parse -' + endif +endfunction + function! ale_linters#nix#nix#Handle(buffer, lines) abort - let l:pattern = '^\(.\+\): \(.\+\), at .*:\(\d\+\):\(\d\+\)$' let l:output = [] - for l:match in ale#util#GetMatches(a:lines, l:pattern) - call add(l:output, { - \ 'lnum': l:match[3] + 0, - \ 'col': l:match[4] + 0, - \ 'text': l:match[1] . ': ' . l:match[2], - \ 'type': l:match[1] =~# '^error' ? 'E' : 'W', - \}) - endfor + if empty(a:lines) + return l:output + endif + + if a:lines[0] =~# '^@nix .*' + for l:line in a:lines + if l:line =~# '^@nix .*' + let l:result = json_decode(strpart(l:line, 4)) + + if has_key(l:result, 'column') + call add(l:output, { + \ 'type': 'E', + \ 'lnum': l:result.line, + \ 'col': l:result.column, + \ 'text': l:result.raw_msg + \}) + endif + endif + endfor + else + let l:pattern = '^\(.\+\): \(.\+\) at .*:\(\d\+\):\(\d\+\)$' + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[3] + 0, + \ 'col': l:match[4] + 0, + \ 'text': l:match[1] . ': ' . substitute(l:match[2], ',$', '', ''), + \ 'type': l:match[1] =~# '^error' ? 'E' : 'W', + \}) + endfor + endif return l:output endfunction @@ -21,6 +54,10 @@ call ale#linter#Define('nix', { \ 'name': 'nix', \ 'output_stream': 'stderr', \ 'executable': 'nix-instantiate', -\ 'command': 'nix-instantiate --parse -', +\ 'command': {buffer -> ale#command#Run( +\ buffer, +\ 'nix-instantiate --version', +\ function('ale_linters#nix#nix#Command') +\ )}, \ 'callback': 'ale_linters#nix#nix#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/nix/rnix_lsp.vim b/sources_non_forked/ale/ale_linters/nix/rnix_lsp.vim new file mode 100644 index 00000000..949bed1c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/nix/rnix_lsp.vim @@ -0,0 +1,16 @@ +" Author: jD91mZM2 +" Description: rnix-lsp language client + +function! ale_linters#nix#rnix_lsp#GetProjectRoot(buffer) abort + " rnix-lsp does not yet use the project root, so getting it right is not + " important + return fnamemodify(a:buffer, ':h') +endfunction + +call ale#linter#Define('nix', { +\ 'name': 'rnix_lsp', +\ 'lsp': 'stdio', +\ 'executable': 'rnix-lsp', +\ 'command': '%e', +\ 'project_root': function('ale_linters#nix#rnix_lsp#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/objc/ccls.vim b/sources_non_forked/ale/ale_linters/objc/ccls.vim index 51ecf056..7aef5325 100644 --- a/sources_non_forked/ale/ale_linters/objc/ccls.vim +++ b/sources_non_forked/ale/ale_linters/objc/ccls.vim @@ -3,6 +3,7 @@ call ale#Set('objc_ccls_executable', 'ccls') call ale#Set('objc_ccls_init_options', {}) +call ale#Set('c_build_dir', '') call ale#linter#Define('objc', { \ 'name': 'ccls', @@ -10,5 +11,5 @@ call ale#linter#Define('objc', { \ 'executable': {b -> ale#Var(b, 'objc_ccls_executable')}, \ 'command': '%e', \ 'project_root': function('ale#handlers#ccls#GetProjectRoot'), -\ 'initialization_options': {b -> ale#Var(b, 'objc_ccls_init_options')}, +\ 'initialization_options': {b -> ale#handlers#ccls#GetInitOpts(b, 'objc_ccls_init_options')}, \}) diff --git a/sources_non_forked/ale/ale_linters/objc/clang.vim b/sources_non_forked/ale/ale_linters/objc/clang.vim index 7873dccd..cafb97db 100644 --- a/sources_non_forked/ale/ale_linters/objc/clang.vim +++ b/sources_non_forked/ale/ale_linters/objc/clang.vim @@ -10,7 +10,7 @@ function! ale_linters#objc#clang#GetCommand(buffer) abort " -iquote with the directory the file is in makes #include work for " headers in the same directory. return 'clang -S -x objective-c -fsyntax-only ' - \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) + \ . '-iquote %s:h' \ . ' ' . ale#Var(a:buffer, 'objc_clang_options') . ' -' endfunction diff --git a/sources_non_forked/ale/ale_linters/objc/clangd.vim b/sources_non_forked/ale/ale_linters/objc/clangd.vim index ab52fec3..318d85b5 100644 --- a/sources_non_forked/ale/ale_linters/objc/clangd.vim +++ b/sources_non_forked/ale/ale_linters/objc/clangd.vim @@ -4,12 +4,6 @@ call ale#Set('objc_clangd_executable', 'clangd') call ale#Set('objc_clangd_options', '') -function! ale_linters#objc#clangd#GetProjectRoot(buffer) abort - let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') - - return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' -endfunction - function! ale_linters#objc#clangd#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'objc_clangd_options')) endfunction @@ -19,5 +13,5 @@ call ale#linter#Define('objc', { \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'objc_clangd_executable')}, \ 'command': function('ale_linters#objc#clangd#GetCommand'), -\ 'project_root': function('ale_linters#objc#clangd#GetProjectRoot'), +\ 'project_root': function('ale#c#FindProjectRoot'), \}) diff --git a/sources_non_forked/ale/ale_linters/objcpp/clang.vim b/sources_non_forked/ale/ale_linters/objcpp/clang.vim index 4dbe55b3..35a40c6f 100644 --- a/sources_non_forked/ale/ale_linters/objcpp/clang.vim +++ b/sources_non_forked/ale/ale_linters/objcpp/clang.vim @@ -10,7 +10,7 @@ function! ale_linters#objcpp#clang#GetCommand(buffer) abort " -iquote with the directory the file is in makes #include work for " headers in the same directory. return 'clang++ -S -x objective-c++ -fsyntax-only ' - \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) + \ . '-iquote %s:h' \ . ' ' . ale#Var(a:buffer, 'objcpp_clang_options') . ' -' endfunction diff --git a/sources_non_forked/ale/ale_linters/objcpp/clangd.vim b/sources_non_forked/ale/ale_linters/objcpp/clangd.vim index 3991d2ac..29455325 100644 --- a/sources_non_forked/ale/ale_linters/objcpp/clangd.vim +++ b/sources_non_forked/ale/ale_linters/objcpp/clangd.vim @@ -4,12 +4,6 @@ call ale#Set('objcpp_clangd_executable', 'clangd') call ale#Set('objcpp_clangd_options', '') -function! ale_linters#objcpp#clangd#GetProjectRoot(buffer) abort - let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') - - return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' -endfunction - function! ale_linters#objcpp#clangd#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'objcpp_clangd_options')) endfunction @@ -19,5 +13,5 @@ call ale#linter#Define('objcpp', { \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'objcpp_clangd_executable')}, \ 'command': function('ale_linters#objcpp#clangd#GetCommand'), -\ 'project_root': function('ale_linters#objcpp#clangd#GetProjectRoot'), +\ 'project_root': function('ale#c#FindProjectRoot'), \}) diff --git a/sources_non_forked/ale/ale_linters/ocaml/ocamllsp.vim b/sources_non_forked/ale/ale_linters/ocaml/ocamllsp.vim new file mode 100644 index 00000000..4ff7419c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ocaml/ocamllsp.vim @@ -0,0 +1,13 @@ +" Author: Risto Stevcev +" Description: The official language server for OCaml + +call ale#Set('ocaml_ocamllsp_use_opam', 1) + +call ale#linter#Define('ocaml', { +\ 'name': 'ocamllsp', +\ 'lsp': 'stdio', +\ 'executable': function('ale#handlers#ocamllsp#GetExecutable'), +\ 'command': function('ale#handlers#ocamllsp#GetCommand'), +\ 'language': function('ale#handlers#ocamllsp#GetLanguage'), +\ 'project_root': function('ale#handlers#ocamllsp#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/ocaml/ols.vim b/sources_non_forked/ale/ale_linters/ocaml/ols.vim index d8208c52..ec71bdb4 100644 --- a/sources_non_forked/ale/ale_linters/ocaml/ols.vim +++ b/sources_non_forked/ale/ale_linters/ocaml/ols.vim @@ -9,6 +9,6 @@ call ale#linter#Define('ocaml', { \ 'lsp': 'stdio', \ 'executable': function('ale#handlers#ols#GetExecutable'), \ 'command': function('ale#handlers#ols#GetCommand'), -\ 'language_callback': 'ale#handlers#ols#GetLanguage', +\ 'language': function('ale#handlers#ols#GetLanguage'), \ 'project_root': function('ale#handlers#ols#GetProjectRoot'), \}) diff --git a/sources_non_forked/ale/ale_linters/ocamlinterface/merlin.vim b/sources_non_forked/ale/ale_linters/ocamlinterface/merlin.vim new file mode 100644 index 00000000..799490f7 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ocamlinterface/merlin.vim @@ -0,0 +1,17 @@ +" Author: Andrey Popp -- @andreypopp +" Description: Report errors in OCaml code with Merlin + +if !exists('g:merlin') + finish +endif + +function! ale_linters#ocamlinterface#merlin#Handle(buffer, lines) abort + return merlin#ErrorLocList() +endfunction + +call ale#linter#Define('ocamlinterface', { +\ 'name': 'merlin', +\ 'executable': 'ocamlmerlin', +\ 'command': 'true', +\ 'callback': 'ale_linters#ocamlinterface#merlin#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/ocamlinterface/ocamllsp.vim b/sources_non_forked/ale/ale_linters/ocamlinterface/ocamllsp.vim new file mode 100644 index 00000000..cd4bea80 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ocamlinterface/ocamllsp.vim @@ -0,0 +1,13 @@ +" Author: Risto Stevcev +" Description: The official language server for OCaml + +call ale#Set('ocaml_ocamllsp_use_opam', 1) + +call ale#linter#Define('ocamlinterface', { +\ 'name': 'ocamllsp', +\ 'lsp': 'stdio', +\ 'executable': function('ale#handlers#ocamllsp#GetExecutable'), +\ 'command': function('ale#handlers#ocamllsp#GetCommand'), +\ 'language': function('ale#handlers#ocamllsp#GetLanguage'), +\ 'project_root': function('ale#handlers#ocamllsp#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/openapi/ibm_validator.vim b/sources_non_forked/ale/ale_linters/openapi/ibm_validator.vim new file mode 100644 index 00000000..446931a2 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/openapi/ibm_validator.vim @@ -0,0 +1,58 @@ +" Author: Horacio Sanson + +call ale#Set('openapi_ibm_validator_executable', 'lint-openapi') +call ale#Set('openapi_ibm_validator_options', '') + +function! ale_linters#openapi#ibm_validator#GetCommand(buffer) abort + return '%e' . ale#Pad(ale#Var(a:buffer, 'openapi_ibm_validator_options')) + \ . ' %t' +endfunction + +function! ale_linters#openapi#ibm_validator#Handle(buffer, lines) abort + let l:output = [] + let l:type = 'E' + let l:message = '' + let l:nr = -1 + + for l:line in a:lines + let l:match = matchlist(l:line, '^errors$') + + if !empty(l:match) + let l:type = 'E' + endif + + let l:match = matchlist(l:line, '^warnings$') + + if !empty(l:match) + let l:type = 'W' + endif + + let l:match = matchlist(l:line, '^ *Message : *\(.\+\)$') + + if !empty(l:match) + let l:message = l:match[1] + endif + + let l:match = matchlist(l:line, '^ *Line *: *\(\d\+\)$') + + if !empty(l:match) + let l:nr = l:match[1] + + call add(l:output, { + \ 'lnum': l:nr + 0, + \ 'col': 0, + \ 'text': l:message, + \ 'type': l:type, + \}) + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('openapi', { +\ 'name': 'ibm_validator', +\ 'executable': {b -> ale#Var(b, 'openapi_ibm_validator_executable')}, +\ 'command': function('ale_linters#openapi#ibm_validator#GetCommand'), +\ 'callback': 'ale_linters#openapi#ibm_validator#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/openapi/yamllint.vim b/sources_non_forked/ale/ale_linters/openapi/yamllint.vim new file mode 100644 index 00000000..2b8952cc --- /dev/null +++ b/sources_non_forked/ale/ale_linters/openapi/yamllint.vim @@ -0,0 +1,9 @@ +call ale#Set('yaml_yamllint_executable', 'yamllint') +call ale#Set('yaml_yamllint_options', '') + +call ale#linter#Define('openapi', { +\ 'name': 'yamllint', +\ 'executable': {b -> ale#Var(b, 'yaml_yamllint_executable')}, +\ 'command': function('ale#handlers#yamllint#GetCommand'), +\ 'callback': 'ale#handlers#yamllint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/perl6/perl6.vim b/sources_non_forked/ale/ale_linters/perl6/perl6.vim index 68ef4769..444ae4d7 100644 --- a/sources_non_forked/ale/ale_linters/perl6/perl6.vim +++ b/sources_non_forked/ale/ale_linters/perl6/perl6.vim @@ -88,7 +88,7 @@ function! ale_linters#perl6#perl6#Handle(buffer, lines) abort try let l:json = json_decode(join(a:lines, '')) - catch /E474/ + catch /E474\|E491/ call add(l:output, { \ 'lnum': '1', \ 'text': 'Received output in the default Perl6 error format. See :ALEDetail for details', diff --git a/sources_non_forked/ale/ale_linters/php/intelephense.vim b/sources_non_forked/ale/ale_linters/php/intelephense.vim new file mode 100644 index 00000000..0fdcc93e --- /dev/null +++ b/sources_non_forked/ale/ale_linters/php/intelephense.vim @@ -0,0 +1,32 @@ +" Author: Eric Stern , +" Arnold Chand +" Description: Intelephense language server integration for ALE + +call ale#Set('php_intelephense_executable', 'intelephense') +call ale#Set('php_intelephense_use_global', 1) +call ale#Set('php_intelephense_config', {}) + +function! ale_linters#php#intelephense#GetProjectRoot(buffer) abort + let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json') + + if (!empty(l:composer_path)) + return fnamemodify(l:composer_path, ':h') + endif + + let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') + + return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' +endfunction + +function! ale_linters#php#intelephense#GetInitializationOptions(buffer) abort + return ale#Var(a:buffer, 'php_intelephense_config') +endfunction + +call ale#linter#Define('php', { +\ 'name': 'intelephense', +\ 'lsp': 'stdio', +\ 'initialization_options': function('ale_linters#php#intelephense#GetInitializationOptions'), +\ 'executable': {b -> ale#path#FindExecutable(b, 'php_intelephense', [])}, +\ 'command': '%e --stdio', +\ 'project_root': function('ale_linters#php#intelephense#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/php/langserver.vim b/sources_non_forked/ale/ale_linters/php/langserver.vim index fdd1bf2b..c3d89a00 100644 --- a/sources_non_forked/ale/ale_linters/php/langserver.vim +++ b/sources_non_forked/ale/ale_linters/php/langserver.vim @@ -19,7 +19,7 @@ endfunction call ale#linter#Define('php', { \ 'name': 'langserver', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'php_langserver', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'php_langserver', [ \ 'vendor/bin/php-language-server.php', \ ])}, \ 'command': 'php %e', diff --git a/sources_non_forked/ale/ale_linters/php/phan.vim b/sources_non_forked/ale/ale_linters/php/phan.vim index 53cb1ea9..50c6d6e6 100644 --- a/sources_non_forked/ale/ale_linters/php/phan.vim +++ b/sources_non_forked/ale/ale_linters/php/phan.vim @@ -39,7 +39,7 @@ function! ale_linters#php#phan#Handle(buffer, lines) abort let l:pattern = '^Phan error: \(\w\+\): \(.\+\) in \(.\+\) on line \(\d\+\)$' else " /path/to/some-filename.php:18 ERRORTYPE message - let l:pattern = '^.*:\(\d\+\)\s\(\w\+\)\s\(.\+\)$' + let l:pattern = '^\(.*\):\(\d\+\)\s\(\w\+\)\s\(.\+\)$' endif let l:output = [] @@ -49,13 +49,15 @@ function! ale_linters#php#phan#Handle(buffer, lines) abort let l:dict = { \ 'lnum': l:match[4] + 0, \ 'text': l:match[2], + \ 'filename': l:match[3], \ 'type': 'W', \} else let l:dict = { - \ 'lnum': l:match[1] + 0, - \ 'text': l:match[3], + \ 'lnum': l:match[2] + 0, + \ 'text': l:match[4], \ 'type': 'W', + \ 'filename': l:match[1], \} endif diff --git a/sources_non_forked/ale/ale_linters/php/phpcs.vim b/sources_non_forked/ale/ale_linters/php/phpcs.vim index 1c92bbb2..ce47a13b 100644 --- a/sources_non_forked/ale/ale_linters/php/phpcs.vim +++ b/sources_non_forked/ale/ale_linters/php/phpcs.vim @@ -10,20 +10,19 @@ call ale#Set('php_phpcs_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#php#phpcs#GetCommand(buffer) abort let l:standard = ale#Var(a:buffer, 'php_phpcs_standard') let l:standard_option = !empty(l:standard) - \ ? '--standard=' . l:standard + \ ? '--standard=' . ale#Escape(l:standard) \ : '' - let l:options = ale#Var(a:buffer, 'php_phpcs_options') return '%e -s --report=emacs --stdin-path=%s' - \ . ale#Pad(l:standard_option) - \ . ale#Pad(l:options) + \ . ale#Pad(l:standard_option) + \ . ale#Pad(ale#Var(a:buffer, 'php_phpcs_options')) endfunction function! ale_linters#php#phpcs#Handle(buffer, lines) abort " Matches against lines like the following: " " /path/to/some-filename.php:18:3: error - Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact) - let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) (\(.\+\))$' + let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) (\(.\+\)).*$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) @@ -36,6 +35,7 @@ function! ale_linters#php#phpcs#Handle(buffer, lines) abort \ 'col': l:match[2] + 0, \ 'text': l:text, \ 'type': l:type is# 'error' ? 'E' : 'W', + \ 'sub_type': 'style', \}) endfor @@ -44,10 +44,11 @@ endfunction call ale#linter#Define('php', { \ 'name': 'phpcs', -\ 'executable': {b -> ale#node#FindExecutable(b, 'php_phpcs', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'php_phpcs', [ \ 'vendor/bin/phpcs', \ 'phpcs' \ ])}, +\ 'cwd': '%s:h', \ 'command': function('ale_linters#php#phpcs#GetCommand'), \ 'callback': 'ale_linters#php#phpcs#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/php/phpstan.vim b/sources_non_forked/ale/ale_linters/php/phpstan.vim index 34d4e799..58d4dce2 100644 --- a/sources_non_forked/ale/ale_linters/php/phpstan.vim +++ b/sources_non_forked/ale/ale_linters/php/phpstan.vim @@ -3,60 +3,60 @@ " Set to change the ruleset let g:ale_php_phpstan_executable = get(g:, 'ale_php_phpstan_executable', 'phpstan') -let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '4') +let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '') let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '') +let g:ale_php_phpstan_autoload = get(g:, 'ale_php_phpstan_autoload', '') +call ale#Set('php_phpstan_use_global', get(g:, 'ale_use_global_executables', 0)) -function! ale_linters#php#phpstan#GetExecutable(buffer) abort - return ale#Var(a:buffer, 'php_phpstan_executable') -endfunction - -function! ale_linters#php#phpstan#VersionCheck(buffer) abort - let l:executable = ale_linters#php#phpstan#GetExecutable(a:buffer) - - " If we have previously stored the version number in a cache, then - " don't look it up again. - if ale#semver#HasVersion(l:executable) - " Returning an empty string skips this command. - return '' - endif - - let l:executable = ale#Escape(l:executable) - - return l:executable . ' --version' -endfunction - -function! ale_linters#php#phpstan#GetCommand(buffer, version_output) abort +function! ale_linters#php#phpstan#GetCommand(buffer, version) abort let l:configuration = ale#Var(a:buffer, 'php_phpstan_configuration') let l:configuration_option = !empty(l:configuration) - \ ? ' -c ' . l:configuration + \ ? ' -c ' . ale#Escape(l:configuration) \ : '' - let l:executable = ale_linters#php#phpstan#GetExecutable(a:buffer) - let l:version = ale#semver#GetVersion(l:executable, a:version_output) - let l:error_format = ale#semver#GTE(l:version, [0, 10, 3]) - \ ? ' --error-format raw' - \ : ' --errorFormat raw' + let l:autoload = ale#Var(a:buffer, 'php_phpstan_autoload') + let l:autoload_option = !empty(l:autoload) + \ ? ' -a ' . ale#Escape(l:autoload) + \ : '' - return '%e analyze -l' - \ . ale#Var(a:buffer, 'php_phpstan_level') + 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 no configuration file is found, then use 4 as a default level + let l:level = '4' + endif + + let l:level_option = !empty(l:level) + \ ? ' -l ' . ale#Escape(l:level) + \ : '' + + let l:error_format = ale#semver#GTE(a:version, [0, 10, 3]) + \ ? ' --error-format json' + \ : ' --errorFormat json' + + return '%e analyze --no-progress' \ . l:error_format \ . l:configuration_option + \ . l:autoload_option + \ . l:level_option \ . ' %s' endfunction function! ale_linters#php#phpstan#Handle(buffer, lines) abort - " Matches against lines like the following: - " - " filename.php:15:message - " C:\folder\filename.php:15:message - let l:pattern = '^\([a-zA-Z]:\)\?[^:]\+:\(\d\+\):\(.*\)$' + let l:res = ale#util#FuzzyJSONDecode(a:lines, {'files': []}) let l:output = [] - for l:match in ale#util#GetMatches(a:lines, l:pattern) + if type(l:res.files) is v:t_list + return l:output + endif + + for l:err in l:res.files[expand('#' . a:buffer .':p')].messages call add(l:output, { - \ 'lnum': l:match[2] + 0, - \ 'text': l:match[3], - \ 'type': 'W', + \ 'lnum': l:err.line, + \ 'text': l:err.message, + \ 'type': 'E', \}) endfor @@ -65,10 +65,18 @@ endfunction call ale#linter#Define('php', { \ 'name': 'phpstan', -\ 'executable': function('ale_linters#php#phpstan#GetExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#php#phpstan#VersionCheck'}, -\ {'callback': 'ale_linters#php#phpstan#GetCommand'}, -\ ], +\ 'executable': {buffer -> ale#path#FindExecutable(buffer, 'php_phpstan', [ +\ 'vendor/bin/phpstan', +\ 'phpstan' +\ ])}, +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#path#FindExecutable(buffer, 'php_phpstan', [ +\ 'vendor/bin/phpstan', +\ 'phpstan' +\ ]), +\ '%e --version', +\ function('ale_linters#php#phpstan#GetCommand'), +\ )}, \ 'callback': 'ale_linters#php#phpstan#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/php/psalm.vim b/sources_non_forked/ale/ale_linters/php/psalm.vim index 3cdb026a..dbbe9453 100644 --- a/sources_non_forked/ale/ale_linters/php/psalm.vim +++ b/sources_non_forked/ale/ale_linters/php/psalm.vim @@ -1,8 +1,9 @@ " Author: Matt Brown " Description: plugin for Psalm, static analyzer for PHP -call ale#Set('psalm_langserver_executable', 'psalm-language-server') -call ale#Set('psalm_langserver_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('php_psalm_executable', 'psalm') +call ale#Set('php_psalm_options', '') +call ale#Set('php_psalm_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#php#psalm#GetProjectRoot(buffer) abort let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') @@ -10,12 +11,16 @@ function! ale_linters#php#psalm#GetProjectRoot(buffer) abort return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' endfunction +function! ale_linters#php#psalm#GetCommand(buffer) abort + return '%e --language-server' . ale#Pad(ale#Var(a:buffer, 'php_psalm_options')) +endfunction + call ale#linter#Define('php', { \ 'name': 'psalm', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'psalm_langserver', [ -\ 'vendor/bin/psalm-language-server', +\ 'executable': {b -> ale#path#FindExecutable(b, 'php_psalm', [ +\ 'vendor/bin/psalm', \ ])}, -\ 'command': '%e', +\ 'command': function('ale_linters#php#psalm#GetCommand'), \ 'project_root': function('ale_linters#php#psalm#GetProjectRoot'), \}) diff --git a/sources_non_forked/ale/ale_linters/php/tlint.vim b/sources_non_forked/ale/ale_linters/php/tlint.vim new file mode 100644 index 00000000..80bdd1f6 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/php/tlint.vim @@ -0,0 +1,80 @@ +" Author: Jose Soto +" +" Description: Tighten Opinionated PHP Linting +" Website: https://github.com/tightenco/tlint + +call ale#Set('php_tlint_executable', 'tlint') +call ale#Set('php_tlint_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('php_tlint_options', '') + +function! ale_linters#php#tlint#GetProjectRoot(buffer) abort + let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json') + + if !empty(l:composer_path) + return fnamemodify(l:composer_path, ':h') + endif + + let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') + + return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' +endfunction + +function! ale_linters#php#tlint#GetExecutable(buffer) abort + return ale#path#FindExecutable(a:buffer, 'php_tlint', [ + \ 'vendor/bin/tlint', + \ 'tlint', + \]) +endfunction + +function! ale_linters#php#tlint#GetCommand(buffer) abort + let l:executable = ale_linters#php#tlint#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'php_tlint_options') + + return ale#node#Executable(a:buffer, l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' lint %s' +endfunction + +function! ale_linters#php#tlint#Handle(buffer, lines) abort + " Matches against lines like the following: + " + " ! There should be 1 space around `.` concatenations, and additional lines should always start with a `.` + " 22 : ` $something = 'a'.'name';` + " + let l:loop_count = 0 + let l:messages_pattern = '^\! \(.*\)' + let l:output = [] + let l:pattern = '^\(\d\+\) \:' + let l:temp_messages = [] + + for l:message in ale#util#GetMatches(a:lines, l:messages_pattern) + call add(l:temp_messages, l:message) + endfor + + let l:loop_count = 0 + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:num = l:match[1] + let l:text = l:temp_messages[l:loop_count] + + call add(l:output, { + \ 'lnum': l:num, + \ 'col': 0, + \ 'text': l:text, + \ 'type': 'W', + \ 'sub_type': 'style', + \}) + + let l:loop_count += 1 + endfor + + return l:output +endfunction + +call ale#linter#Define('php', { +\ 'name': 'tlint', +\ 'executable': function('ale_linters#php#tlint#GetExecutable'), +\ 'command': function('ale_linters#php#tlint#GetCommand'), +\ 'callback': 'ale_linters#php#tlint#Handle', +\ 'project_root': function('ale_linters#php#tlint#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/powershell/powershell.vim b/sources_non_forked/ale/ale_linters/powershell/powershell.vim new file mode 100644 index 00000000..5f49f72c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/powershell/powershell.vim @@ -0,0 +1,100 @@ +" Author: Jesse Harris - https://github.com/zigford +" Description: This file adds support for powershell scripts synatax errors + +call ale#Set('powershell_powershell_executable', 'pwsh') + +function! ale_linters#powershell#powershell#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'powershell_powershell_executable') +endfunction + +" Some powershell magic to show syntax errors without executing the script +" thanks to keith hill: +" https://rkeithhill.wordpress.com/2007/10/30/powershell-quicktip-preparsing-scripts-to-check-for-syntax-errors/ +function! ale_linters#powershell#powershell#GetCommand(buffer) abort + let l:script = ['Param($Script); + \ $ErrorView = "Normal"; + \ trap {$_;continue} & { + \ $Contents = Get-Content -Path $Script; + \ $Contents = [string]::Join([Environment]::NewLine, $Contents); + \ [void]$ExecutionContext.InvokeCommand.NewScriptBlock($Contents); + \ };'] + + return ale#powershell#RunPowerShell( + \ a:buffer, 'powershell_powershell', l:script) +endfunction + +" Parse powershell error output using regex into a list of dicts +function! ale_linters#powershell#powershell#Handle(buffer, lines) abort + let l:output = [] + " Our 3 patterns we need to scrape the data for the dicts + let l:patterns = [ + \ '\v^At line:(\d+) char:(\d+)', + \ '\v^(At|\+| )@!.*', + \ '\vFullyQualifiedErrorId : (\w+)', + \] + + let l:matchcount = 0 + + for l:match in ale#util#GetMatches(a:lines, l:patterns) + " We want to work with 3 matches per syntax error + let l:matchcount = l:matchcount + 1 + + if l:matchcount == 1 || str2nr(l:match[1]) + " First match consists of 2 capture groups, and + " can capture the line and col + if exists('l:item') + " We may be here because the last syntax + " didn't emit a code, and so only had 2 + " matches + call add(l:output, l:item) + let l:matchcount = 1 + endif + + " If the match is 0, it was a failed match + " probably due to an unexpected token which + " contained a newline. Reset matchcount. to + " continue to the next match + if !empty(l:match[1]) + let l:item = { + \ 'lnum': str2nr(l:match[1]), + \ 'col': str2nr(l:match[2]), + \ 'type': 'E', + \} + else + let l:matchcount = 0 + endif + elseif l:matchcount == 2 + " Second match[0] grabs the full line in order + " to handles the text + let l:item['text'] = l:match[0] + else + " Final match handles the code, however + " powershell only emits 1 code for all errors + " so, we get the final code on the last error + " and loop over the previously added items to + " append the code we now know + call add(l:output, l:item) + unlet l:item + + if len(l:match[1]) > 0 + for l:i in l:output + let l:i['code'] = l:match[1] + endfor + endif + + " Reset the matchcount so we can begin gathering + " matches for the next syntax error + let l:matchcount = 0 + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('powershell', { +\ 'name': 'powershell', +\ 'executable': function('ale_linters#powershell#powershell#GetExecutable'), +\ 'command': function('ale_linters#powershell#powershell#GetCommand'), +\ 'output_stream': 'stdout', +\ 'callback': 'ale_linters#powershell#powershell#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/powershell/psscriptanalyzer.vim b/sources_non_forked/ale/ale_linters/powershell/psscriptanalyzer.vim new file mode 100644 index 00000000..4794d9d8 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/powershell/psscriptanalyzer.vim @@ -0,0 +1,76 @@ +" Author: Jesse Harris - https://github.com/zigford +" Description: This file adds support for lintng powershell scripts +" using the PSScriptAnalyzer module. + +" let g:ale_powershell_psscriptanalyzer_exclusions = +" \ 'PSAvoidUsingWriteHost,PSAvoidGlobalVars' +call ale#Set('powershell_psscriptanalyzer_exclusions', '') +call ale#Set('powershell_psscriptanalyzer_executable', 'pwsh') +call ale#Set('powershell_psscriptanalyzer_module', +\ 'psscriptanalyzer') + +function! ale_linters#powershell#psscriptanalyzer#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'powershell_psscriptanalyzer_executable') +endfunction + +" Run Invoke-ScriptAnalyzer and output each linting message as 4 seperate lines +" for each parsing +function! ale_linters#powershell#psscriptanalyzer#GetCommand(buffer) abort + let l:exclude_option = ale#Var( + \ a:buffer, 'powershell_psscriptanalyzer_exclusions') + let l:module = ale#Var( + \ a:buffer, 'powershell_psscriptanalyzer_module') + let l:script = ['Param($Script); + \ Invoke-ScriptAnalyzer "$Script" ' + \ . (!empty(l:exclude_option) ? '-Exclude ' . l:exclude_option : '') + \ . '| ForEach-Object { + \ $_.Line; + \ $_.Severity; + \ $_.Message; + \ $_.RuleName}'] + + return ale#powershell#RunPowerShell( + \ a:buffer, + \ 'powershell_psscriptanalyzer', + \ l:script) +endfunction + +" add every 4 lines to an item(Dict) and every item to a list +" return the list +function! ale_linters#powershell#psscriptanalyzer#Handle(buffer, lines) abort + let l:output = [] + let l:lcount = 0 + + for l:line in a:lines + if l:lcount is# 0 + " the very first line + let l:item = {'lnum': str2nr(l:line)} + elseif l:lcount is# 1 + if l:line is# 'Error' + let l:item['type'] = 'E' + elseif l:line is# 'Information' + let l:item['type'] = 'I' + else + let l:item['type'] = 'W' + endif + elseif l:lcount is# 2 + let l:item['text'] = l:line + elseif l:lcount is# 3 + let l:item['code'] = l:line + call add(l:output, l:item) + let l:lcount = -1 + endif + + let l:lcount = l:lcount + 1 + endfor + + return l:output +endfunction + +call ale#linter#Define('powershell', { +\ 'name': 'psscriptanalyzer', +\ 'executable': function('ale_linters#powershell#psscriptanalyzer#GetExecutable'), +\ 'command': function('ale_linters#powershell#psscriptanalyzer#GetCommand'), +\ 'output_stream': 'stdout', +\ 'callback': 'ale_linters#powershell#psscriptanalyzer#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/prolog/swipl.vim b/sources_non_forked/ale/ale_linters/prolog/swipl.vim index 5c601c40..82859eb0 100644 --- a/sources_non_forked/ale/ale_linters/prolog/swipl.vim +++ b/sources_non_forked/ale/ale_linters/prolog/swipl.vim @@ -35,10 +35,11 @@ function! s:Subst(format, vars) abort endfunction function! ale_linters#prolog#swipl#Handle(buffer, lines) abort - let l:pattern = '\v^(ERROR|Warning)+%(:\s*[^:]+:(\d+)%(:(\d+))?)?:\s*(.*)$' let l:output = [] let l:i = 0 + let l:pattern = '\v^(ERROR|Warning)+%(:\s*[^:]+:(\d+)%(:(\d+))?)?:\s*(.*)$' + while l:i < len(a:lines) let l:match = matchlist(a:lines[l:i], l:pattern) @@ -72,8 +73,17 @@ function! s:GetErrMsg(i, lines, text) abort let l:i = a:i + 1 let l:text = [] - while l:i < len(a:lines) && a:lines[l:i] =~# '^\s' - call add(l:text, s:Trim(a:lines[l:i])) + let l:pattern = '\v^(ERROR|Warning)?:?(.*)$' + + while l:i < len(a:lines) + let l:match = matchlist(a:lines[l:i], l:pattern) + + if empty(l:match) || empty(l:match[2]) + let l:i += 1 + break + endif + + call add(l:text, s:Trim(l:match[2])) let l:i += 1 endwhile diff --git a/sources_non_forked/ale/ale_linters/proto/protolint.vim b/sources_non_forked/ale/ale_linters/proto/protolint.vim new file mode 100644 index 00000000..2754c7b6 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/proto/protolint.vim @@ -0,0 +1,24 @@ +" Author: Yohei Yoshimuta +" Description: run the protolint for Protocol Buffer files + +call ale#Set('proto_protolint_executable', 'protolint') +call ale#Set('proto_protolint_config', '') + +function! ale_linters#proto#protolint#GetCommand(buffer) abort + let l:config = ale#Var(a:buffer, 'proto_protolint_config') + + return '%e lint' + \ . (!empty(l:config) ? ' -config_path=' . ale#Escape(l:config) : '') + \ . ' -reporter=unix' + \ . ' %s' +endfunction + +call ale#linter#Define('proto', { +\ 'name': 'protolint', +\ 'lint_file': 1, +\ 'output_stream': 'stderr', +\ 'executable': {b -> ale#Var(b, 'proto_protolint_executable')}, +\ 'command': function('ale_linters#proto#protolint#GetCommand'), +\ 'callback': 'ale#handlers#unix#HandleAsError', +\}) + diff --git a/sources_non_forked/ale/ale_linters/pug/puglint.vim b/sources_non_forked/ale/ale_linters/pug/puglint.vim index c4e0e233..b552cc06 100644 --- a/sources_non_forked/ale/ale_linters/pug/puglint.vim +++ b/sources_non_forked/ale/ale_linters/pug/puglint.vim @@ -31,12 +31,26 @@ function! ale_linters#pug#puglint#GetCommand(buffer) abort \ . ' -r inline %t' endfunction +function! ale_linters#pug#puglint#Handle(buffer, lines) abort + for l:line in a:lines[:10] + if l:line =~# '^SyntaxError: ' + return [{ + \ 'lnum': 1, + \ 'text': 'puglint configuration error (type :ALEDetail for more information)', + \ 'detail': join(a:lines, "\n"), + \}] + endif + endfor + + return ale#handlers#unix#HandleAsError(a:buffer, a:lines) +endfunction + call ale#linter#Define('pug', { \ 'name': 'puglint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'pug_puglint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'pug_puglint', [ \ 'node_modules/.bin/pug-lint', \ ])}, \ 'output_stream': 'stderr', \ 'command': function('ale_linters#pug#puglint#GetCommand'), -\ 'callback': 'ale#handlers#unix#HandleAsError', +\ 'callback': 'ale_linters#pug#puglint#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/puppet/puppet.vim b/sources_non_forked/ale/ale_linters/puppet/puppet.vim index ae648615..59228dc8 100644 --- a/sources_non_forked/ale/ale_linters/puppet/puppet.vim +++ b/sources_non_forked/ale/ale_linters/puppet/puppet.vim @@ -8,13 +8,15 @@ function! ale_linters#puppet#puppet#Handle(buffer, lines) abort " Error: Could not parse for environment production: Syntax error at ':' at /root/puppetcode/modules/nginx/manifests/init.pp:43:12 " Error: Could not parse for environment production: Syntax error at '='; expected '}' at /root/puppetcode/modules/pancakes/manifests/init.pp:5" " Error: Could not parse for environment production: Syntax error at 'parameter1' (file: /tmp/modules/mariadb/manifests/slave.pp, line: 4, column: 5) - let l:pattern = '^Error: .*: \(.\+\) \((file:\|at\) .\+\.pp\(, line: \|:\)\(\d\+\)\(, column: \|:\)\=\(\d*\)' + " Error: Illegal attempt to assign to 'a Name'. Not an assignable reference (file: /tmp/modules/waffles/manifests/syrup.pp, line: 5, column: 11) + " Error: Could not parse for environment production: Syntax error at end of input (file: /tmp/modules/bob/manifests/init.pp) + let l:pattern = '^Error:\%(.*:\)\? \(.\+\) \((file:\|at\) .\+\.pp\(\(, line: \|:\)\(\d\+\)\(, column: \|:\)\=\(\d*\)\|)$\)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { - \ 'lnum': l:match[4] + 0, - \ 'col': l:match[6] + 0, + \ 'lnum': l:match[5] + 0, + \ 'col': l:match[7] + 0, \ 'text': l:match[1], \}) endfor diff --git a/sources_non_forked/ale/ale_linters/purescript/ls.vim b/sources_non_forked/ale/ale_linters/purescript/ls.vim new file mode 100644 index 00000000..a20fae47 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/purescript/ls.vim @@ -0,0 +1,49 @@ +" Author: Drew Olson +" Description: Integrate ALE with purescript-language-server. + +call ale#Set('purescript_ls_executable', 'purescript-language-server') +call ale#Set('purescript_ls_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('purescript_ls_config', {}) + +function! ale_linters#purescript#ls#GetExecutable(buffer) abort + return ale#path#FindExecutable(a:buffer, 'purescript_ls', [ + \ 'node_modules/.bin/purescript-language-server', + \]) +endfunction + +function! ale_linters#purescript#ls#GetCommand(buffer) abort + let l:executable = ale_linters#purescript#ls#GetExecutable(a:buffer) + + return ale#Escape(l:executable) . ' --stdio' +endfunction + +function! ale_linters#purescript#ls#FindProjectRoot(buffer) abort + let l:config = ale#path#FindNearestFile(a:buffer, 'bower.json') + + if !empty(l:config) + return fnamemodify(l:config, ':h') + endif + + let l:config = ale#path#FindNearestFile(a:buffer, 'psc-package.json') + + if !empty(l:config) + return fnamemodify(l:config, ':h') + endif + + let l:config = ale#path#FindNearestFile(a:buffer, 'spago.dhall') + + if !empty(l:config) + return fnamemodify(l:config, ':h') + endif + + return '' +endfunction + +call ale#linter#Define('purescript', { +\ 'name': 'purescript-language-server', +\ 'lsp': 'stdio', +\ 'executable': function('ale_linters#purescript#ls#GetExecutable'), +\ 'command': function('ale_linters#purescript#ls#GetCommand'), +\ 'project_root': function('ale_linters#purescript#ls#FindProjectRoot'), +\ 'lsp_config': {b -> ale#Var(b, 'purescript_ls_config')}, +\}) diff --git a/sources_non_forked/ale/ale_linters/pyrex/cython.vim b/sources_non_forked/ale/ale_linters/pyrex/cython.vim index 84382ba1..247c3060 100644 --- a/sources_non_forked/ale/ale_linters/pyrex/cython.vim +++ b/sources_non_forked/ale/ale_linters/pyrex/cython.vim @@ -6,9 +6,7 @@ call ale#Set('pyrex_cython_executable', 'cython') call ale#Set('pyrex_cython_options', '--warning-extra') function! ale_linters#pyrex#cython#GetCommand(buffer) abort - let l:local_dir = ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) - - return '%e --working ' . l:local_dir . ' --include-dir ' . l:local_dir + return '%e --working %s:h --include-dir %s:h' \ . ale#Pad(ale#Var(a:buffer, 'pyrex_cython_options')) \ . ' --output-file ' . g:ale#util#nul_file . ' %t' endfunction diff --git a/sources_non_forked/ale/ale_linters/python/bandit.vim b/sources_non_forked/ale/ale_linters/python/bandit.vim index 554f5000..9cfca7c0 100644 --- a/sources_non_forked/ale/ale_linters/python/bandit.vim +++ b/sources_non_forked/ale/ale_linters/python/bandit.vim @@ -6,6 +6,7 @@ call ale#Set('python_bandit_options', '') call ale#Set('python_bandit_use_config', 1) call ale#Set('python_bandit_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_bandit_auto_pipenv', 0) +call ale#Set('python_bandit_auto_poetry', 0) function! ale_linters#python#bandit#GetExecutable(buffer) abort if ( @@ -15,6 +16,13 @@ function! ale_linters#python#bandit#GetExecutable(buffer) abort return 'pipenv' endif + if ( + \ ale#Var(a:buffer, 'python_auto_poetry') + \ || ale#Var(a:buffer, 'python_bandit_auto_poetry') + \) && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_bandit', ['bandit']) endfunction @@ -31,7 +39,7 @@ function! ale_linters#python#bandit#GetCommand(buffer) abort endif endif - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run bandit' \ : '' diff --git a/sources_non_forked/ale/ale_linters/python/flake8.vim b/sources_non_forked/ale/ale_linters/python/flake8.vim index 993d7adb..9950614a 100644 --- a/sources_non_forked/ale/ale_linters/python/flake8.vim +++ b/sources_non_forked/ale/ale_linters/python/flake8.vim @@ -4,8 +4,9 @@ call ale#Set('python_flake8_executable', 'flake8') call ale#Set('python_flake8_options', '') call ale#Set('python_flake8_use_global', get(g:, 'ale_use_global_executables', 0)) -call ale#Set('python_flake8_change_directory', 1) +call ale#Set('python_flake8_change_directory', 'project') call ale#Set('python_flake8_auto_pipenv', 0) +call ale#Set('python_flake8_auto_poetry', 0) function! s:UsingModule(buffer) abort return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8' @@ -17,6 +18,11 @@ function! ale_linters#python#flake8#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_flake8_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + if !s:UsingModule(a:buffer) return ale#python#FindExecutable(a:buffer, 'python_flake8', ['flake8']) endif @@ -24,43 +30,57 @@ function! ale_linters#python#flake8#GetExecutable(buffer) abort return ale#Var(a:buffer, 'python_flake8_executable') endfunction -function! ale_linters#python#flake8#VersionCheck(buffer) abort +function! ale_linters#python#flake8#RunWithVersionCheck(buffer) abort let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer) - " If we have previously stored the version number in a cache, then - " don't look it up again. - if ale#semver#HasVersion(l:executable) - " Returning an empty string skips this command. - return '' - endif - - let l:executable = ale#Escape(l:executable) let l:module_string = s:UsingModule(a:buffer) ? ' -m flake8' : '' + let l:command = ale#Escape(l:executable) . l:module_string . ' --version' - return l:executable . l:module_string . ' --version' + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ l:executable, + \ l:command, + \ function('ale_linters#python#flake8#GetCommand'), + \) endfunction -function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort - let l:cd_string = ale#Var(a:buffer, 'python_flake8_change_directory') - \ ? ale#path#BufferCdString(a:buffer) - \ : '' - let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer) - let l:version = ale#semver#GetVersion(l:executable, a:version_output) +function! ale_linters#python#flake8#GetCwd(buffer) abort + let l:change_directory = ale#Var(a:buffer, 'python_flake8_change_directory') + let l:cwd = '' - let l:exec_args = l:executable =~? 'pipenv$' + if l:change_directory is# 'project' + let l:project_root = ale#python#FindProjectRootIni(a:buffer) + + if !empty(l:project_root) + let l:cwd = l:project_root + endif + endif + + if (l:change_directory is# 'project' && empty(l:cwd)) + \|| l:change_directory is# 1 + \|| l:change_directory is# 'file' + let l:cwd = '%s:h' + endif + + return l:cwd +endfunction + +function! ale_linters#python#flake8#GetCommand(buffer, version) abort + let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer) + + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run flake8' \ : '' " Only include the --stdin-display-name argument if we can parse the " flake8 version, and it is recent enough to support it. - let l:display_name_args = ale#semver#GTE(l:version, [3, 0, 0]) + let l:display_name_args = ale#semver#GTE(a:version, [3, 0, 0]) \ ? ' --stdin-display-name %s' \ : '' let l:options = ale#Var(a:buffer, 'python_flake8_options') - return l:cd_string - \ . ale#Escape(l:executable) . l:exec_args + return ale#Escape(l:executable) . l:exec_args \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --format=default' \ . l:display_name_args . ' -' @@ -144,9 +164,7 @@ endfunction call ale#linter#Define('python', { \ 'name': 'flake8', \ 'executable': function('ale_linters#python#flake8#GetExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#python#flake8#VersionCheck'}, -\ {'callback': 'ale_linters#python#flake8#GetCommand', 'output_stream': 'both'}, -\ ], +\ 'cwd': function('ale_linters#python#flake8#GetCwd'), +\ 'command': function('ale_linters#python#flake8#RunWithVersionCheck'), \ 'callback': 'ale_linters#python#flake8#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/python/flakehell.vim b/sources_non_forked/ale/ale_linters/python/flakehell.vim new file mode 100644 index 00000000..ffe87e29 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/python/flakehell.vim @@ -0,0 +1,175 @@ +" Author: w0rp +" Description: flakehell for python files + +call ale#Set('python_flakehell_executable', 'flakehell') +call ale#Set('python_flakehell_options', '') +call ale#Set('python_flakehell_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_flakehell_change_directory', 'project') +call ale#Set('python_flakehell_auto_pipenv', 0) +call ale#Set('python_flakehell_auto_poetry', 0) + +function! s:UsingModule(buffer) abort + return ale#Var(a:buffer, 'python_flakehell_executable') is? 'python' +endfunction + +function! ale_linters#python#flakehell#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_flakehell_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_flakehell_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + + if !s:UsingModule(a:buffer) + return ale#python#FindExecutable(a:buffer, 'python_flakehell', ['flakehell']) + endif + + return ale#Var(a:buffer, 'python_flakehell_executable') +endfunction + +function! ale_linters#python#flakehell#RunWithVersionCheck(buffer) abort + let l:executable = ale_linters#python#flakehell#GetExecutable(a:buffer) + + let l:module_string = s:UsingModule(a:buffer) ? ' -m flakehell' : '' + let l:command = ale#Escape(l:executable) . l:module_string . ' --version' + + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ l:executable, + \ l:command, + \ function('ale_linters#python#flakehell#GetCommand'), + \) +endfunction + +function! ale_linters#python#flakehell#GetCwd(buffer) abort + let l:change_directory = ale#Var(a:buffer, 'python_flakehell_change_directory') + let l:cwd = '' + + if l:change_directory is# 'project' + let l:project_root = ale#python#FindProjectRootIni(a:buffer) + + if !empty(l:project_root) + let l:cwd = l:project_root + endif + endif + + if (l:change_directory is# 'project' && empty(l:cwd)) + \|| l:change_directory is# 1 + \|| l:change_directory is# 'file' + let l:cwd = '%s:h' + endif + + return l:cwd +endfunction + +function! ale_linters#python#flakehell#GetCommand(buffer, version) abort + let l:executable = ale_linters#python#flakehell#GetExecutable(a:buffer) + + if (l:executable =~? 'pipenv\|poetry$') + let l:exec_args = ' run flakehell' + elseif (l:executable is? 'python') + let l:exec_args = ' -m flakehell' + else + let l:exec_args = '' + endif + + " Only include the --stdin-display-name argument if we can parse the + " flakehell version, and it is recent enough to support it. + let l:display_name_args = ale#semver#GTE(a:version, [0, 8, 0]) + \ ? ' --stdin-display-name %s' + \ : '' + + let l:options = ale#Var(a:buffer, 'python_flakehell_options') + + return ale#Escape(l:executable) + \ . l:exec_args + \ . (!empty(l:options) ? ' lint ' . l:options : ' lint') + \ . ' --format=default' + \ . l:display_name_args . ' -' +endfunction + +let s:end_col_pattern_map = { +\ 'F405': '\(.\+\) may be undefined', +\ 'F821': 'undefined name ''\([^'']\+\)''', +\ 'F999': '^''\([^'']\+\)''', +\ 'F841': 'local variable ''\([^'']\+\)''', +\} + +function! ale_linters#python#flakehell#Handle(buffer, lines) abort + let l:output = ale#python#HandleTraceback(a:lines, 10) + + if !empty(l:output) + return l:output + endif + + " Matches patterns line the following: + " + " Matches patterns line the following: + " + " stdin:6:6: E111 indentation is not a multiple of four + let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):?(\d+)?: ([[:alnum:]]+):? (.*)$' + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:code = l:match[3] + + if (l:code is# 'W291' || l:code is# 'W293') + \ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + " Skip warnings for trailing whitespace if the option is off. + continue + endif + + if l:code is# 'W391' + \&& !ale#Var(a:buffer, 'warn_about_trailing_blank_lines') + " Skip warnings for trailing blank lines if the option is off + continue + endif + + let l:item = { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'vcol': 1, + \ 'text': l:match[4], + \ 'code': l:code, + \ 'type': 'W', + \} + + if l:code[:0] is# 'F' + if l:code isnot# 'F401' + let l:item.type = 'E' + endif + elseif l:code[:0] is# 'E' + let l:item.type = 'E' + + if l:code isnot# 'E999' && l:code isnot# 'E112' + let l:item.sub_type = 'style' + endif + elseif l:code[:0] is# 'W' + let l:item.sub_type = 'style' + endif + + let l:end_col_pattern = get(s:end_col_pattern_map, l:code, '') + + if !empty(l:end_col_pattern) + let l:end_col_match = matchlist(l:match[4], l:end_col_pattern) + + if !empty(l:end_col_match) + let l:item.end_col = l:item.col + len(l:end_col_match[1]) - 1 + endif + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction + +call ale#linter#Define('python', { +\ 'name': 'flakehell', +\ 'executable': function('ale_linters#python#flakehell#GetExecutable'), +\ 'cwd': function('ale_linters#python#flakehell#GetCwd'), +\ 'command': function('ale_linters#python#flakehell#RunWithVersionCheck'), +\ 'callback': 'ale_linters#python#flakehell#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/python/jedils.vim b/sources_non_forked/ale/ale_linters/python/jedils.vim new file mode 100644 index 00000000..eae5fb07 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/python/jedils.vim @@ -0,0 +1,34 @@ +" Author: Dalius Dobravolskas +" Description: https://github.com/pappasam/jedi-language-server + +call ale#Set('python_jedils_executable', 'jedi-language-server') +call ale#Set('python_jedils_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_jedils_auto_pipenv', 0) + +function! ale_linters#python#jedils#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_jedils_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + + return ale#python#FindExecutable(a:buffer, 'python_jedils', ['jedi-language-server']) +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' + \ : '' + + return ale#Escape(l:executable) . l:exec_args +endfunction + +call ale#linter#Define('python', { +\ 'name': 'jedils', +\ 'lsp': 'stdio', +\ 'executable': function('ale_linters#python#jedils#GetExecutable'), +\ 'command': function('ale_linters#python#jedils#GetCommand'), +\ 'project_root': function('ale#python#FindProjectRoot'), +\ 'completion_filter': 'ale#completion#python#CompletionItemFilter', +\}) diff --git a/sources_non_forked/ale/ale_linters/python/mypy.vim b/sources_non_forked/ale/ale_linters/python/mypy.vim index c4c6507f..9d469a1a 100644 --- a/sources_non_forked/ale/ale_linters/python/mypy.vim +++ b/sources_non_forked/ale/ale_linters/python/mypy.vim @@ -3,9 +3,11 @@ call ale#Set('python_mypy_executable', 'mypy') call ale#Set('python_mypy_ignore_invalid_syntax', 0) +call ale#Set('python_mypy_show_notes', 1) call ale#Set('python_mypy_options', '') call ale#Set('python_mypy_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_mypy_auto_pipenv', 0) +call ale#Set('python_mypy_auto_poetry', 0) function! ale_linters#python#mypy#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_mypy_auto_pipenv')) @@ -13,11 +15,25 @@ function! ale_linters#python#mypy#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_mypy_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy']) endfunction " The directory to change to before running mypy -function! s:GetDir(buffer) abort +function! ale_linters#python#mypy#GetCwd(buffer) abort + " If we find a directory with "mypy.ini" in it use that, + " else try and find the "python project" root, or failing + " that, run from the same folder as the current file + for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) + if filereadable(l:path . '/mypy.ini') + return l:path + endif + endfor + let l:project_root = ale#python#FindProjectRoot(a:buffer) return !empty(l:project_root) @@ -26,24 +42,19 @@ function! s:GetDir(buffer) abort endfunction function! ale_linters#python#mypy#GetCommand(buffer) abort - let l:dir = s:GetDir(a:buffer) let l:executable = ale_linters#python#mypy#GetExecutable(a:buffer) - - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run mypy' \ : '' - " We have to always switch to an explicit directory for a command so - " we can know with certainty the base path for the 'filename' keys below. - return ale#path#CdString(l:dir) - \ . ale#Escape(l:executable) . l:exec_args - \ . ' --show-column-numbers ' - \ . ale#Var(a:buffer, 'python_mypy_options') + return '%e' . l:exec_args + \ . ale#Pad(ale#Var(a:buffer, 'python_mypy_options')) + \ . ' --show-column-numbers' \ . ' --shadow-file %s %t %s' endfunction function! ale_linters#python#mypy#Handle(buffer, lines) abort - let l:dir = s:GetDir(a:buffer) + let l:dir = ale_linters#python#mypy#GetCwd(a:buffer) " Look for lines like the following: " " file.py:4: error: No library stub file for module 'django.db' @@ -51,7 +62,16 @@ function! ale_linters#python#mypy#Handle(buffer, lines) abort " Lines like these should be ignored below: " " file.py:4: note: (Stub files are from https://github.com/python/typeshed) - let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: (error|warning): (.+)$' + + let l:types = 'error|warning' + + if ale#Var(a:buffer, 'python_mypy_show_notes') + let l:types = 'error|warning|note' + endif + + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: (' + \ . l:types + \ . '): (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) @@ -65,7 +85,7 @@ function! ale_linters#python#mypy#Handle(buffer, lines) abort \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, - \ 'type': l:match[4] is# 'error' ? 'E' : 'W', + \ 'type': l:match[4] is# 'error' ? 'E' : (l:match[4] is# 'note' ? 'I': 'W'), \ 'text': l:match[5], \}) endfor @@ -76,6 +96,8 @@ endfunction call ale#linter#Define('python', { \ 'name': 'mypy', \ 'executable': function('ale_linters#python#mypy#GetExecutable'), +\ 'cwd': function('ale_linters#python#mypy#GetCwd'), \ 'command': function('ale_linters#python#mypy#GetCommand'), \ 'callback': 'ale_linters#python#mypy#Handle', +\ 'output_stream': 'both' \}) diff --git a/sources_non_forked/ale/ale_linters/python/prospector.vim b/sources_non_forked/ale/ale_linters/python/prospector.vim index ee47012f..3623bda0 100644 --- a/sources_non_forked/ale/ale_linters/python/prospector.vim +++ b/sources_non_forked/ale/ale_linters/python/prospector.vim @@ -2,6 +2,7 @@ " Description: prospector linter python files call ale#Set('python_prospector_auto_pipenv', 0) +call ale#Set('python_prospector_auto_poetry', 0) let g:ale_python_prospector_executable = \ get(g:, 'ale_python_prospector_executable', 'prospector') @@ -17,13 +18,18 @@ function! ale_linters#python#prospector#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_prospector_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector']) endfunction function! ale_linters#python#prospector#GetCommand(buffer) abort let l:executable = ale_linters#python#prospector#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run prospector' \ : '' diff --git a/sources_non_forked/ale/ale_linters/python/pycodestyle.vim b/sources_non_forked/ale/ale_linters/python/pycodestyle.vim index fb521bc1..3fb94d69 100644 --- a/sources_non_forked/ale/ale_linters/python/pycodestyle.vim +++ b/sources_non_forked/ale/ale_linters/python/pycodestyle.vim @@ -5,6 +5,7 @@ call ale#Set('python_pycodestyle_executable', 'pycodestyle') call ale#Set('python_pycodestyle_options', '') call ale#Set('python_pycodestyle_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pycodestyle_auto_pipenv', 0) +call ale#Set('python_pycodestyle_auto_poetry', 0) function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pycodestyle_auto_pipenv')) @@ -12,13 +13,18 @@ function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pycodestyle_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_pycodestyle', ['pycodestyle']) endfunction function! ale_linters#python#pycodestyle#GetCommand(buffer) abort let l:executable = ale_linters#python#pycodestyle#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run pycodestyle' \ : '' diff --git a/sources_non_forked/ale/ale_linters/python/pydocstyle.vim b/sources_non_forked/ale/ale_linters/python/pydocstyle.vim index 3901db4d..aa0e8b20 100644 --- a/sources_non_forked/ale/ale_linters/python/pydocstyle.vim +++ b/sources_non_forked/ale/ale_linters/python/pydocstyle.vim @@ -5,6 +5,7 @@ call ale#Set('python_pydocstyle_executable', 'pydocstyle') call ale#Set('python_pydocstyle_options', '') call ale#Set('python_pydocstyle_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pydocstyle_auto_pipenv', 0) +call ale#Set('python_pydocstyle_auto_poetry', 0) function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pydocstyle_auto_pipenv')) @@ -12,21 +13,23 @@ function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pydocstyle_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_pydocstyle', ['pydocstyle']) endfunction function! ale_linters#python#pydocstyle#GetCommand(buffer) abort - let l:dir = fnamemodify(bufname(a:buffer), ':p:h') let l:executable = ale_linters#python#pydocstyle#GetExecutable(a:buffer) - - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run pydocstyle' \ : '' - return ale#path#CdString(l:dir) - \ . ale#Escape(l:executable) . l:exec_args - \ . ' ' . ale#Var(a:buffer, 'python_pydocstyle_options') - \ . ' ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:t')) + return ale#Escape(l:executable) . l:exec_args + \ . ale#Pad(ale#Var(a:buffer, 'python_pydocstyle_options')) + \ . ' %s:t' endfunction function! ale_linters#python#pydocstyle#Handle(buffer, lines) abort @@ -68,6 +71,7 @@ endfunction call ale#linter#Define('python', { \ 'name': 'pydocstyle', \ 'executable': function('ale_linters#python#pydocstyle#GetExecutable'), +\ 'cwd': '%s:h', \ 'command': function('ale_linters#python#pydocstyle#GetCommand'), \ 'callback': 'ale_linters#python#pydocstyle#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/python/pyflakes.vim b/sources_non_forked/ale/ale_linters/python/pyflakes.vim index b5127022..2567c533 100644 --- a/sources_non_forked/ale/ale_linters/python/pyflakes.vim +++ b/sources_non_forked/ale/ale_linters/python/pyflakes.vim @@ -4,6 +4,7 @@ call ale#Set('python_pyflakes_executable', 'pyflakes') call ale#Set('python_pyflakes_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pyflakes_auto_pipenv', 0) +call ale#Set('python_pyflakes_auto_poetry', 0) function! ale_linters#python#pyflakes#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflakes_auto_pipenv')) @@ -11,13 +12,18 @@ function! ale_linters#python#pyflakes#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pyflakes_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes']) endfunction function! ale_linters#python#pyflakes#GetCommand(buffer) abort let l:executable = ale_linters#python#pyflakes#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run pyflakes' \ : '' diff --git a/sources_non_forked/ale/ale_linters/python/pylama.vim b/sources_non_forked/ale/ale_linters/python/pylama.vim index 38dd2836..73b59b07 100644 --- a/sources_non_forked/ale/ale_linters/python/pylama.vim +++ b/sources_non_forked/ale/ale_linters/python/pylama.vim @@ -5,6 +5,7 @@ call ale#Set('python_pylama_executable', 'pylama') call ale#Set('python_pylama_options', '') call ale#Set('python_pylama_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pylama_auto_pipenv', 0) +call ale#Set('python_pylama_auto_poetry', 0) call ale#Set('python_pylama_change_directory', 1) function! ale_linters#python#pylama#GetExecutable(buffer) abort @@ -13,32 +14,37 @@ function! ale_linters#python#pylama#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pylama_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_pylama', ['pylama']) endfunction -function! ale_linters#python#pylama#GetCommand(buffer) abort - let l:cd_string = '' - +function! ale_linters#python#pylama#GetCwd(buffer) abort if ale#Var(a:buffer, 'python_pylama_change_directory') " Pylama loads its configuration from the current directory only, and " applies file masks using paths relative to the current directory. " Run from project root, if found, otherwise buffer dir. let l:project_root = ale#python#FindProjectRoot(a:buffer) - let l:cd_string = l:project_root isnot# '' - \ ? ale#path#CdString(l:project_root) - \ : ale#path#BufferCdString(a:buffer) + + return !empty(l:project_root) ? l:project_root : '%s:h' endif + return '' +endfunction + +function! ale_linters#python#pylama#GetCommand(buffer) abort let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run pylama' \ : '' " Note: Using %t to lint changes would be preferable, but many pylama " checks use surrounding paths (e.g. C0103 module name, E0402 relative " import beyond top, etc.). Neither is ideal. - return l:cd_string - \ . ale#Escape(l:executable) . l:exec_args + return ale#Escape(l:executable) . l:exec_args \ . ale#Pad(ale#Var(a:buffer, 'python_pylama_options')) \ . ' %s' endfunction @@ -86,6 +92,7 @@ endfunction call ale#linter#Define('python', { \ 'name': 'pylama', \ 'executable': function('ale_linters#python#pylama#GetExecutable'), +\ 'cwd': function('ale_linters#python#pylama#GetCwd'), \ 'command': function('ale_linters#python#pylama#GetCommand'), \ 'callback': 'ale_linters#python#pylama#Handle', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/python/pylint.vim b/sources_non_forked/ale/ale_linters/python/pylint.vim index 57e82691..2ce5376f 100644 --- a/sources_non_forked/ale/ale_linters/python/pylint.vim +++ b/sources_non_forked/ale/ale_linters/python/pylint.vim @@ -6,6 +6,8 @@ call ale#Set('python_pylint_options', '') call ale#Set('python_pylint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pylint_change_directory', 1) call ale#Set('python_pylint_auto_pipenv', 0) +call ale#Set('python_pylint_auto_poetry', 0) +call ale#Set('python_pylint_use_msg_id', 0) function! ale_linters#python#pylint#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pylint_auto_pipenv')) @@ -13,41 +15,51 @@ function! ale_linters#python#pylint#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pylint_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint']) endfunction -function! ale_linters#python#pylint#GetCommand(buffer) abort - let l:cd_string = '' - +function! ale_linters#python#pylint#GetCwd(buffer) abort if ale#Var(a:buffer, 'python_pylint_change_directory') " pylint only checks for pylintrc in the packages above its current " directory before falling back to user and global pylintrc. " Run from project root, if found, otherwise buffer dir. let l:project_root = ale#python#FindProjectRoot(a:buffer) - let l:cd_string = l:project_root isnot# '' - \ ? ale#path#CdString(l:project_root) - \ : ale#path#BufferCdString(a:buffer) + + return !empty(l:project_root) ? l:project_root : '%s:h' endif - let l:executable = ale_linters#python#pylint#GetExecutable(a:buffer) + return '' +endfunction - let l:exec_args = l:executable =~? 'pipenv$' +function! ale_linters#python#pylint#GetCommand(buffer, version) abort + let l:executable = ale_linters#python#pylint#GetExecutable(a:buffer) + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run pylint' \ : '' - return l:cd_string - \ . ale#Escape(l:executable) . l:exec_args - \ . ' ' . ale#Var(a:buffer, 'python_pylint_options') + return ale#Escape(l:executable) . l:exec_args + \ . ale#Pad(ale#Var(a:buffer, 'python_pylint_options')) \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n' + \ . (ale#semver#GTE(a:version, [2, 4, 0]) ? ' --from-stdin' : '') \ . ' %s' endfunction function! ale_linters#python#pylint#Handle(buffer, lines) abort + let l:output = ale#python#HandleTraceback(a:lines, 10) + + if !empty(l:output) + return l:output + endif + " Matches patterns like the following: " " test.py:4:4: W0101 (unreachable) Unreachable code let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+): ([[:alnum:]]+) \(([^(]*)\) (.*)$' - let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) "let l:failed = append(0, l:match) @@ -64,13 +76,25 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort continue endif - call add(l:output, { + if ale#Var(a:buffer, 'python_pylint_use_msg_id') is# 1 + let l:code_out = l:code + else + let l:code_out = l:match[4] + endif + + let l:item = { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 1, \ 'text': l:match[5], - \ 'code': l:match[4], - \ 'type': l:code[:0] is# 'E' ? 'E' : 'W', - \}) + \ 'code': l:code_out, + \ 'type': 'W', + \} + + if l:code[:0] is# 'E' + let l:item.type = 'E' + endif + + call add(l:output, l:item) endfor return l:output @@ -79,7 +103,18 @@ endfunction call ale#linter#Define('python', { \ 'name': 'pylint', \ 'executable': function('ale_linters#python#pylint#GetExecutable'), -\ 'command': function('ale_linters#python#pylint#GetCommand'), +\ 'lint_file': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#Var(buffer, 'python_pylint_executable'), +\ '%e --version', +\ {buffer, version -> !ale#semver#GTE(version, [2, 4, 0])}, +\ )}, +\ 'cwd': function('ale_linters#python#pylint#GetCwd'), +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#Var(buffer, 'python_pylint_executable'), +\ '%e --version', +\ function('ale_linters#python#pylint#GetCommand'), +\ )}, \ 'callback': 'ale_linters#python#pylint#Handle', -\ 'lint_file': 1, \}) diff --git a/sources_non_forked/ale/ale_linters/python/pyls.vim b/sources_non_forked/ale/ale_linters/python/pyls.vim deleted file mode 100644 index c7f91430..00000000 --- a/sources_non_forked/ale/ale_linters/python/pyls.vim +++ /dev/null @@ -1,36 +0,0 @@ -" Author: aurieh -" Description: A language server for Python - -call ale#Set('python_pyls_executable', 'pyls') -call ale#Set('python_pyls_use_global', get(g:, 'ale_use_global_executables', 0)) -call ale#Set('python_pyls_auto_pipenv', 0) -call ale#Set('python_pyls_config', {}) - -function! ale_linters#python#pyls#GetExecutable(buffer) abort - if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyls_auto_pipenv')) - \ && ale#python#PipenvPresent(a:buffer) - return 'pipenv' - endif - - return ale#python#FindExecutable(a:buffer, 'python_pyls', ['pyls']) -endfunction - -function! ale_linters#python#pyls#GetCommand(buffer) abort - let l:executable = ale_linters#python#pyls#GetExecutable(a:buffer) - - let l:exec_args = l:executable =~? 'pipenv$' - \ ? ' run pyls' - \ : '' - - return ale#Escape(l:executable) . l:exec_args -endfunction - -call ale#linter#Define('python', { -\ 'name': 'pyls', -\ 'lsp': 'stdio', -\ 'executable': function('ale_linters#python#pyls#GetExecutable'), -\ 'command': function('ale_linters#python#pyls#GetCommand'), -\ 'project_root': function('ale#python#FindProjectRoot'), -\ 'completion_filter': 'ale#completion#python#CompletionItemFilter', -\ 'lsp_config': {b -> ale#Var(b, 'python_pyls_config')}, -\}) diff --git a/sources_non_forked/ale/ale_linters/python/pylsp.vim b/sources_non_forked/ale/ale_linters/python/pylsp.vim new file mode 100644 index 00000000..537d1e74 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/python/pylsp.vim @@ -0,0 +1,43 @@ +" Author: aurieh +" Description: A language server for Python + +call ale#Set('python_pylsp_executable', 'pylsp') +call ale#Set('python_pylsp_options', '') +call ale#Set('python_pylsp_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_pylsp_auto_pipenv', 0) +call ale#Set('python_pylsp_auto_poetry', 0) +call ale#Set('python_pylsp_config', {}) + +function! ale_linters#python#pylsp#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pylsp_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' + endif + + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pylsp_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + + return ale#python#FindExecutable(a:buffer, 'python_pylsp', ['pylsp']) +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' + \ : '' + + return 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'), +\ 'command': function('ale_linters#python#pylsp#GetCommand'), +\ 'project_root': function('ale#python#FindProjectRoot'), +\ 'completion_filter': 'ale#completion#python#CompletionItemFilter', +\ 'lsp_config': {b -> ale#Var(b, 'python_pylsp_config')}, +\}) diff --git a/sources_non_forked/ale/ale_linters/python/pyre.vim b/sources_non_forked/ale/ale_linters/python/pyre.vim index 4edd80f7..5e5786f9 100644 --- a/sources_non_forked/ale/ale_linters/python/pyre.vim +++ b/sources_non_forked/ale/ale_linters/python/pyre.vim @@ -4,6 +4,7 @@ call ale#Set('python_pyre_executable', 'pyre') call ale#Set('python_pyre_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pyre_auto_pipenv', 0) +call ale#Set('python_pyre_auto_poetry', 0) function! ale_linters#python#pyre#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyre_auto_pipenv')) @@ -11,19 +12,27 @@ function! ale_linters#python#pyre#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pyre_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_pyre', ['pyre']) endfunction function! ale_linters#python#pyre#GetCommand(buffer) abort let l:executable = ale_linters#python#pyre#GetExecutable(a:buffer) - - let l:exec_args = l:executable =~? 'pipenv$' - \ ? ' run pyre persistent' - \ : ' persistent' + let l:exec_args = (l:executable =~? 'pipenv\|poetry$' ? ' run pyre' : '') . ' persistent' return ale#Escape(l:executable) . l:exec_args endfunction +function! ale_linters#python#pyre#GetCwd(buffer) abort + let l:local_config = ale#path#FindNearestFile(a:buffer, '.pyre_configuration.local') + + return fnamemodify(l:local_config, ':h') +endfunction + call ale#linter#Define('python', { \ 'name': 'pyre', \ 'lsp': 'stdio', @@ -31,4 +40,5 @@ call ale#linter#Define('python', { \ 'command': function('ale_linters#python#pyre#GetCommand'), \ 'project_root': function('ale#python#FindProjectRoot'), \ 'completion_filter': 'ale#completion#python#CompletionItemFilter', +\ 'cwd': function('ale_linters#python#pyre#GetCwd'), \}) diff --git a/sources_non_forked/ale/ale_linters/python/pyright.vim b/sources_non_forked/ale/ale_linters/python/pyright.vim new file mode 100644 index 00000000..422ecd61 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/python/pyright.vim @@ -0,0 +1,43 @@ +call ale#Set('python_pyright_executable', 'pyright-langserver') +call ale#Set('python_pyright_config', {}) + +function! ale_linters#python#pyright#GetConfig(buffer) abort + let l:config = deepcopy(ale#Var(a:buffer, 'python_pyright_config')) + + if !has_key(l:config, 'python') + let l:config.python = {} + endif + + if type(l:config.python) is v:t_dict + " Automatically detect the virtualenv path and use it. + if !has_key(l:config.python, 'venvPath') + let l:venv = ale#python#FindVirtualenv(a:buffer) + + if !empty(l:venv) + let l:config.python.venvPath = l:venv + endif + endif + + " Automatically use the version of Python in virtualenv. + if type(get(l:config.python, 'venvPath')) is v:t_string + \&& !empty(l:config.python.venvPath) + \&& !has_key(l:config.python, 'pythonPath') + let l:config.python.pythonPath = ale#path#Simplify( + \ l:config.python.venvPath + \ . (has('win32') ? '/Scripts/python' : '/bin/python') + \) + endif + endif + + return l:config +endfunction + +call ale#linter#Define('python', { +\ 'name': 'pyright', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'python_pyright_executable')}, +\ 'command': '%e --stdio', +\ 'project_root': function('ale#python#FindProjectRoot'), +\ 'completion_filter': 'ale#completion#python#CompletionItemFilter', +\ 'lsp_config': function('ale_linters#python#pyright#GetConfig'), +\}) diff --git a/sources_non_forked/ale/ale_linters/python/vulture.vim b/sources_non_forked/ale/ale_linters/python/vulture.vim index d328d262..a7ba1860 100644 --- a/sources_non_forked/ale/ale_linters/python/vulture.vim +++ b/sources_non_forked/ale/ale_linters/python/vulture.vim @@ -6,7 +6,6 @@ call ale#Set('python_vulture_options', '') call ale#Set('python_vulture_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_vulture_change_directory', 1) - " The directory to change to before running vulture function! s:GetDir(buffer) abort let l:project_root = ale#python#FindProjectRoot(a:buffer) @@ -16,29 +15,28 @@ function! s:GetDir(buffer) abort \ : expand('#' . a:buffer . ':p:h') endfunction - function! ale_linters#python#vulture#GetExecutable(buffer) abort return ale#python#FindExecutable(a:buffer, 'python_vulture', ['vulture']) endfunction +function! ale_linters#python#vulture#GetCwd(buffer) abort + if !ale#Var(a:buffer, 'python_vulture_change_directory') + return '' + endif + + return s:GetDir(a:buffer) +endfunction function! ale_linters#python#vulture#GetCommand(buffer) abort - let l:change_dir = ale#Var(a:buffer, 'python_vulture_change_directory') - \ ? ale#path#CdString(s:GetDir(a:buffer)) - \ : '' - let l:executable = ale_linters#python#vulture#GetExecutable(a:buffer) - - let l:exec_args = l:executable =~? 'pipenv$' + let l:exec_args = l:executable =~? 'pipenv\|poetry$' \ ? ' run vulture' \ : '' - let l:lint_dest = ale#Var(a:buffer, 'python_vulture_change_directory') \ ? ' .' \ : ' %s' - return l:change_dir - \ . ale#Escape(l:executable) . l:exec_args + return ale#Escape(l:executable) . l:exec_args \ . ' ' \ . ale#Var(a:buffer, 'python_vulture_options') \ . l:lint_dest @@ -74,6 +72,7 @@ endfunction call ale#linter#Define('python', { \ 'name': 'vulture', \ 'executable': function('ale_linters#python#vulture#GetExecutable'), +\ 'cwd': function('ale_linters#python#vulture#GetCwd'), \ 'command': function('ale_linters#python#vulture#GetCommand'), \ 'callback': 'ale_linters#python#vulture#Handle', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/r/languageserver.vim b/sources_non_forked/ale/ale_linters/r/languageserver.vim new file mode 100644 index 00000000..bab869d1 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/r/languageserver.vim @@ -0,0 +1,27 @@ +" Author: Eric Zhao <21zhaoe@protonmail.com> +" Author: ourigen +" Description: Implementation of the Language Server Protocol for R. + +call ale#Set('r_languageserver_cmd', 'languageserver::run()') +call ale#Set('r_languageserver_config', {}) + +function! ale_linters#r#languageserver#GetCommand(buffer) abort + let l:cmd_string = ale#Var(a:buffer, 'r_languageserver_cmd') + + return 'Rscript --no-save --no-restore --no-site-file --no-init-file -e ' . ale#Escape(l:cmd_string) +endfunction + +function! ale_linters#r#languageserver#GetProjectRoot(buffer) abort + let l:project_root = ale#path#FindNearestFile(a:buffer, '.Rprofile') + + return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : fnamemodify(a:buffer, ':h') +endfunction + +call ale#linter#Define('r', { +\ 'name': 'languageserver', +\ 'lsp': 'stdio', +\ 'lsp_config': {b -> ale#Var(b, 'r_languageserver_config')}, +\ 'executable': 'Rscript', +\ 'command': function('ale_linters#r#languageserver#GetCommand'), +\ 'project_root': function('ale_linters#r#languageserver#GetProjectRoot') +\}) diff --git a/sources_non_forked/ale/ale_linters/r/lintr.vim b/sources_non_forked/ale/ale_linters/r/lintr.vim index 3164c06f..339ad2b0 100644 --- a/sources_non_forked/ale/ale_linters/r/lintr.vim +++ b/sources_non_forked/ale/ale_linters/r/lintr.vim @@ -1,5 +1,6 @@ " Author: Michel Lang , w0rp , -" Fenner Macrae +" Fenner Macrae , +" ourigen " Description: This file adds support for checking R code with lintr. let g:ale_r_lintr_options = get(g:, 'ale_r_lintr_options', 'with_defaults()') @@ -21,14 +22,13 @@ function! ale_linters#r#lintr#GetCommand(buffer) abort let l:cmd_string = 'suppressPackageStartupMessages(library(lintr));' \ . l:lint_cmd - return ale#path#BufferCdString(a:buffer) - \ . 'Rscript --vanilla -e ' - \ . ale#Escape(l:cmd_string) . ' %t' + return 'Rscript --no-save --no-restore --no-site-file --no-init-file -e ' . ale#Escape(l:cmd_string) . ' %t' endfunction call ale#linter#Define('r', { \ 'name': 'lintr', \ 'executable': 'Rscript', +\ 'cwd': '%s:h', \ 'command': function('ale_linters#r#lintr#GetCommand'), \ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \ 'output_stream': 'both', diff --git a/sources_non_forked/ale/ale_linters/racket/langserver.vim b/sources_non_forked/ale/ale_linters/racket/langserver.vim new file mode 100644 index 00000000..ec80ed7b --- /dev/null +++ b/sources_non_forked/ale/ale_linters/racket/langserver.vim @@ -0,0 +1,7 @@ +call ale#linter#Define('racket', { +\ 'name': 'racket_langserver', +\ 'lsp': 'stdio', +\ 'executable': 'racket', +\ 'command': '%e -l racket-langserver', +\ 'project_root': function('ale#racket#FindProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/racket/raco.vim b/sources_non_forked/ale/ale_linters/racket/raco.vim index e5ee4fb4..5b26065f 100644 --- a/sources_non_forked/ale/ale_linters/racket/raco.vim +++ b/sources_non_forked/ale/ale_linters/racket/raco.vim @@ -14,6 +14,7 @@ function! ale_linters#racket#raco#Handle(buffer, lines) abort for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { + \ 'filename': l:match[2], \ 'lnum': l:match[3] + 0, \ 'col': l:match[4] + 0, \ 'type': 'E', diff --git a/sources_non_forked/ale/ale_linters/reason/ls.vim b/sources_non_forked/ale/ale_linters/reason/ls.vim new file mode 100644 index 00000000..fb1114ae --- /dev/null +++ b/sources_non_forked/ale/ale_linters/reason/ls.vim @@ -0,0 +1,23 @@ +" Author: David Buchan-Swanson +" Description: Integrate ALE with reason-language-server. + +call ale#Set('reason_ls_executable', '') + +function! ale_linters#reason#ls#FindProjectRoot(buffer) abort + let l:reason_config = ale#path#FindNearestFile(a:buffer, 'bsconfig.json') + + if !empty(l:reason_config) + return fnamemodify(l:reason_config, ':h') + endif + + return '' +endfunction + +call ale#linter#Define('reason', { +\ 'name': 'reason-language-server', +\ 'lsp': 'stdio', +\ 'executable': {buffer -> ale#Var(buffer, 'reason_ls_executable')}, +\ 'command': '%e', +\ 'project_root': function('ale_linters#reason#ls#FindProjectRoot'), +\ 'language': 'reason', +\}) diff --git a/sources_non_forked/ale/ale_linters/reason/ols.vim b/sources_non_forked/ale/ale_linters/reason/ols.vim index 66137e1b..9fbd9b4f 100644 --- a/sources_non_forked/ale/ale_linters/reason/ols.vim +++ b/sources_non_forked/ale/ale_linters/reason/ols.vim @@ -9,6 +9,6 @@ call ale#linter#Define('reason', { \ 'lsp': 'stdio', \ 'executable': function('ale#handlers#ols#GetExecutable'), \ 'command': function('ale#handlers#ols#GetCommand'), -\ 'language_callback': 'ale#handlers#ols#GetLanguage', +\ 'language': function('ale#handlers#ols#GetLanguage'), \ 'project_root': function('ale#handlers#ols#GetProjectRoot'), \}) diff --git a/sources_non_forked/ale/ale_linters/robot/rflint.vim b/sources_non_forked/ale/ale_linters/robot/rflint.vim new file mode 100644 index 00000000..8fe2d797 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/robot/rflint.vim @@ -0,0 +1,46 @@ +" Author: Samuel Branisa +" Description: rflint linting for robot framework files + +call ale#Set('robot_rflint_executable', 'rflint') + +function! ale_linters#robot#rflint#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'robot_rflint_executable') +endfunction + +function! ale_linters#robot#rflint#GetCommand(buffer) abort + let l:executable = ale_linters#robot#rflint#GetExecutable(a:buffer) + let l:flags = '--format' + \ . ' "{filename}:{severity}:{linenumber}:{char}:{rulename}:{message}"' + + return l:executable + \ . ' ' + \ . l:flags + \ . ' %s' +endfunction + +function! ale_linters#robot#rflint#Handle(buffer, lines) abort + let l:pattern = '\v^([[:alnum:][:punct:]]+):(W|E):([[:digit:]]+):([[:digit:]]+):([[:alnum:]]+):(.*)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'filename': l:match[1], + \ 'type': l:match[2], + \ 'lnum': str2nr(l:match[3]), + \ 'col': str2nr(l:match[4]), + \ 'text': l:match[5], + \ 'detail': l:match[6], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('robot', { +\ 'name': 'rflint', +\ 'executable': function('ale_linters#robot#rflint#GetExecutable'), +\ 'command': function('ale_linters#robot#rflint#GetCommand'), +\ 'callback': 'ale_linters#robot#rflint#Handle', +\}) + diff --git a/sources_non_forked/ale/ale_linters/rst/rstcheck.vim b/sources_non_forked/ale/ale_linters/rst/rstcheck.vim index 39e11d6e..e0cf0798 100644 --- a/sources_non_forked/ale/ale_linters/rst/rstcheck.vim +++ b/sources_non_forked/ale/ale_linters/rst/rstcheck.vim @@ -1,6 +1,5 @@ " Author: John Nduli https://github.com/jnduli " Description: Rstcheck for reStructuredText files -" function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort " matches: 'bad_rst.rst:1: (SEVERE/4) Title overline & underline @@ -22,17 +21,11 @@ function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort return l:output endfunction -function! ale_linters#rst#rstcheck#GetCommand(buffer) abort - return ale#path#BufferCdString(a:buffer) - \ . 'rstcheck' - \ . ' %t' -endfunction - - call ale#linter#Define('rst', { \ 'name': 'rstcheck', \ 'executable': 'rstcheck', -\ 'command': function('ale_linters#rst#rstcheck#GetCommand'), +\ 'cwd': '%s:h', +\ 'command': 'rstcheck %t', \ 'callback': 'ale_linters#rst#rstcheck#Handle', \ 'output_stream': 'both', \}) diff --git a/sources_non_forked/ale/ale_linters/ruby/brakeman.vim b/sources_non_forked/ale/ale_linters/ruby/brakeman.vim index a8088080..2dc48740 100644 --- a/sources_non_forked/ale/ale_linters/ruby/brakeman.vim +++ b/sources_non_forked/ale/ale_linters/ruby/brakeman.vim @@ -36,7 +36,7 @@ function! ale_linters#ruby#brakeman#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'ruby_brakeman_executable') - return ale#handlers#ruby#EscapeExecutable(l:executable, 'brakeman') + return ale#ruby#EscapeExecutable(l:executable, 'brakeman') \ . ' -f json -q ' \ . ale#Var(a:buffer, 'ruby_brakeman_options') \ . ' -p ' . ale#Escape(l:rails_root) diff --git a/sources_non_forked/ale/ale_linters/ruby/debride.vim b/sources_non_forked/ale/ale_linters/ruby/debride.vim new file mode 100644 index 00000000..3b2cc443 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ruby/debride.vim @@ -0,0 +1,42 @@ +" Author: Eddie Lebow https://github.com/elebow +" Description: debride, a dead method detector for Ruby files + +call ale#Set('ruby_debride_executable', 'debride') +call ale#Set('ruby_debride_options', '') + +function! ale_linters#ruby#debride#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'ruby_debride_executable') + + return ale#ruby#EscapeExecutable(l:executable, 'debride') + \ . ale#Var(a:buffer, 'ruby_debride_options') + \ . ' %s' +endfunction + +function! ale_linters#ruby#debride#HandleOutput(buffer, lines) abort + let l:output = [] + + for l:line in a:lines + if l:line !~# '^ ' + continue + endif + + let l:elements = split(l:line) + let l:method_name = l:elements[0] + let l:lnum = split(l:elements[1], ':')[1] + + call add(l:output, { + \ 'lnum': 0 + l:lnum, + \ 'text': 'Possible unused method: ' . l:method_name, + \ 'type': 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('ruby', { +\ 'name': 'debride', +\ 'executable': {b -> ale#Var(b, 'ruby_debride_executable')}, +\ 'command': function('ale_linters#ruby#debride#GetCommand'), +\ 'callback': 'ale_linters#ruby#debride#HandleOutput', +\}) diff --git a/sources_non_forked/ale/ale_linters/ruby/rails_best_practices.vim b/sources_non_forked/ale/ale_linters/ruby/rails_best_practices.vim index 680cc364..36646647 100644 --- a/sources_non_forked/ale/ale_linters/ruby/rails_best_practices.vim +++ b/sources_non_forked/ale/ale_linters/ruby/rails_best_practices.vim @@ -30,10 +30,10 @@ function! ale_linters#ruby#rails_best_practices#GetCommand(buffer) abort endif let l:executable = ale#Var(a:buffer, 'ruby_rails_best_practices_executable') - let l:output_file = ale#Has('win32') ? '%t ' : '/dev/stdout ' - let l:cat_file = ale#Has('win32') ? '; type %t' : '' + let l:output_file = has('win32') ? '%t ' : '/dev/stdout ' + let l:cat_file = has('win32') ? '; type %t' : '' - return ale#handlers#ruby#EscapeExecutable(l:executable, 'rails_best_practices') + return ale#ruby#EscapeExecutable(l:executable, 'rails_best_practices') \ . ' --silent -f json --output-file ' . l:output_file \ . ale#Var(a:buffer, 'ruby_rails_best_practices_options') \ . ale#Escape(l:rails_root) diff --git a/sources_non_forked/ale/ale_linters/ruby/reek.vim b/sources_non_forked/ale/ale_linters/ruby/reek.vim index 26f6e36c..226b452e 100644 --- a/sources_non_forked/ale/ale_linters/ruby/reek.vim +++ b/sources_non_forked/ale/ale_linters/ruby/reek.vim @@ -6,30 +6,15 @@ call ale#Set('ruby_reek_show_wiki_link', 0) call ale#Set('ruby_reek_options', '') call ale#Set('ruby_reek_executable', 'reek') -function! ale_linters#ruby#reek#VersionCheck(buffer) abort - " If we have previously stored the version number in a cache, then - " don't look it up again. - if ale#semver#HasVersion('reek') - " Returning an empty string skips this command. - return '' - endif - - let l:executable = ale#Var(a:buffer, 'ruby_reek_executable') - - return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek') - \ . ' --version' -endfunction - -function! ale_linters#ruby#reek#GetCommand(buffer, version_output) abort - let l:version = ale#semver#GetVersion('reek', a:version_output) +function! ale_linters#ruby#reek#GetCommand(buffer, version) abort let l:executable = ale#Var(a:buffer, 'ruby_reek_executable') " Tell reek what the filename is if the version of reek is new enough. - let l:display_name_args = ale#semver#GTE(l:version, [5, 0, 0]) + let l:display_name_args = ale#semver#GTE(a:version, [5, 0, 0]) \ ? ' --stdin-filename %s' \ : '' - return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek') + return ale#ruby#EscapeExecutable(l:executable, 'reek') \ . ' -f json --no-progress --no-color --force-exclusion' \ . l:display_name_args endfunction @@ -70,9 +55,11 @@ endfunction call ale#linter#Define('ruby', { \ 'name': 'reek', \ 'executable': {b -> ale#Var(b, 'ruby_reek_executable')}, -\ 'command_chain': [ -\ {'callback': 'ale_linters#ruby#reek#VersionCheck'}, -\ {'callback': 'ale_linters#ruby#reek#GetCommand'}, -\ ], +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#Var(buffer, 'ruby_reek_executable'), +\ '%e --version', +\ function('ale_linters#ruby#reek#GetCommand'), +\ )}, \ 'callback': 'ale_linters#ruby#reek#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/ruby/rubocop.vim b/sources_non_forked/ale/ale_linters/ruby/rubocop.vim index 8b9e9c84..483806a6 100644 --- a/sources_non_forked/ale/ale_linters/ruby/rubocop.vim +++ b/sources_non_forked/ale/ale_linters/ruby/rubocop.vim @@ -7,10 +7,10 @@ call ale#Set('ruby_rubocop_options', '') function! ale_linters#ruby#rubocop#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable') - return ale#handlers#ruby#EscapeExecutable(l:executable, 'rubocop') + return ale#ruby#EscapeExecutable(l:executable, 'rubocop') \ . ' --format json --force-exclusion ' \ . ale#Var(a:buffer, 'ruby_rubocop_options') - \ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p')) + \ . ' --stdin %s' endfunction function! ale_linters#ruby#rubocop#GetType(severity) abort diff --git a/sources_non_forked/ale/ale_linters/ruby/ruby.vim b/sources_non_forked/ale/ale_linters/ruby/ruby.vim index 2dc55eb0..621fcbc0 100644 --- a/sources_non_forked/ale/ale_linters/ruby/ruby.vim +++ b/sources_non_forked/ale/ale_linters/ruby/ruby.vim @@ -6,7 +6,7 @@ call ale#Set('ruby_ruby_executable', 'ruby') call ale#linter#Define('ruby', { \ 'name': 'ruby', \ 'executable': {b -> ale#Var(b, 'ruby_ruby_executable')}, -\ 'command': '%e -w -c -T1 %t', +\ 'command': '%e -w -c %t', \ 'output_stream': 'stderr', \ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors', \}) diff --git a/sources_non_forked/ale/ale_linters/ruby/sorbet.vim b/sources_non_forked/ale/ale_linters/ruby/sorbet.vim new file mode 100644 index 00000000..c67e20cc --- /dev/null +++ b/sources_non_forked/ale/ale_linters/ruby/sorbet.vim @@ -0,0 +1,26 @@ +call ale#Set('ruby_sorbet_executable', 'srb') +call ale#Set('ruby_sorbet_options', '') +call ale#Set('ruby_sorbet_enable_watchman', 0) + +function! ale_linters#ruby#sorbet#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'ruby_sorbet_executable') + let l:options = ale#Var(a:buffer, 'ruby_sorbet_options') + let l:enable_watchman = ale#Var(a:buffer, 'ruby_sorbet_enable_watchman') + + return ale#ruby#EscapeExecutable(l:executable, 'srb') + \ . ' tc' + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --lsp' + \ . (l:enable_watchman ? '' : ' --disable-watchman') +endfunction + +call ale#linter#Define('ruby', { +\ 'name': 'sorbet', +\ 'aliases': ['srb'], +\ 'lsp': 'stdio', +\ 'language': 'ruby', +\ 'executable': {b -> ale#Var(b, 'ruby_sorbet_executable')}, +\ 'command': function('ale_linters#ruby#sorbet#GetCommand'), +\ 'project_root': function('ale#ruby#FindProjectRoot') +\}) + diff --git a/sources_non_forked/ale/ale_linters/ruby/standardrb.vim b/sources_non_forked/ale/ale_linters/ruby/standardrb.vim index f075a7d5..6ccfd2d6 100644 --- a/sources_non_forked/ale/ale_linters/ruby/standardrb.vim +++ b/sources_non_forked/ale/ale_linters/ruby/standardrb.vim @@ -8,10 +8,10 @@ call ale#Set('ruby_standardrb_options', '') function! ale_linters#ruby#standardrb#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'ruby_standardrb_executable') - return ale#handlers#ruby#EscapeExecutable(l:executable, 'standardrb') + return ale#ruby#EscapeExecutable(l:executable, 'standardrb') \ . ' --format json --force-exclusion ' \ . ale#Var(a:buffer, 'ruby_standardrb_options') - \ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p')) + \ . ' --stdin %s' endfunction " standardrb is based on RuboCop so the callback is the same diff --git a/sources_non_forked/ale/ale_linters/rust/analyzer.vim b/sources_non_forked/ale/ale_linters/rust/analyzer.vim new file mode 100644 index 00000000..77d946f7 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/rust/analyzer.vim @@ -0,0 +1,24 @@ +" Author: Jon Gjengset +" Description: The next generation language server for Rust + +call ale#Set('rust_analyzer_executable', 'rust-analyzer') +call ale#Set('rust_analyzer_config', {}) + +function! ale_linters#rust#analyzer#GetCommand(buffer) abort + return '%e' +endfunction + +function! ale_linters#rust#analyzer#GetProjectRoot(buffer) abort + let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml') + + return !empty(l:cargo_file) ? fnamemodify(l:cargo_file, ':h') : '' +endfunction + +call ale#linter#Define('rust', { +\ 'name': 'analyzer', +\ 'lsp': 'stdio', +\ 'initialization_options': {b -> ale#Var(b, 'rust_analyzer_config')}, +\ 'executable': {b -> ale#Var(b, 'rust_analyzer_executable')}, +\ 'command': function('ale_linters#rust#analyzer#GetCommand'), +\ 'project_root': function('ale_linters#rust#analyzer#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/rust/cargo.vim b/sources_non_forked/ale/ale_linters/rust/cargo.vim index b4eabfae..37fd10a8 100644 --- a/sources_non_forked/ale/ale_linters/rust/cargo.vim +++ b/sources_non_forked/ale/ale_linters/rust/cargo.vim @@ -11,6 +11,7 @@ call ale#Set('rust_cargo_default_feature_behavior', 'default') call ale#Set('rust_cargo_include_features', '') call ale#Set('rust_cargo_use_clippy', 0) call ale#Set('rust_cargo_clippy_options', '') +call ale#Set('rust_cargo_target_dir', '') function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# '' @@ -22,26 +23,31 @@ function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort endif endfunction -function! ale_linters#rust#cargo#VersionCheck(buffer) abort - return !ale#semver#HasVersion('cargo') - \ ? 'cargo --version' - \ : '' +function! ale_linters#rust#cargo#GetCwd(buffer) abort + if ale#Var(a:buffer, 'rust_cargo_avoid_whole_workspace') + let l:nearest_cargo = ale#path#FindNearestFile(a:buffer, 'Cargo.toml') + let l:nearest_cargo_dir = fnamemodify(l:nearest_cargo, ':h') + + if l:nearest_cargo_dir isnot# '.' + return l:nearest_cargo_dir + endif + endif + + return '' endfunction -function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort - let l:version = ale#semver#GetVersion('cargo', a:version_output) - +function! ale_linters#rust#cargo#GetCommand(buffer, version) abort let l:use_check = ale#Var(a:buffer, 'rust_cargo_use_check') - \ && ale#semver#GTE(l:version, [0, 17, 0]) - let l:use_all_targets = l:use_check - \ && ale#Var(a:buffer, 'rust_cargo_check_all_targets') - \ && ale#semver#GTE(l:version, [0, 22, 0]) - let l:use_examples = l:use_check - \ && ale#Var(a:buffer, 'rust_cargo_check_examples') - \ && ale#semver#GTE(l:version, [0, 22, 0]) - let l:use_tests = l:use_check - \ && ale#Var(a:buffer, 'rust_cargo_check_tests') - \ && ale#semver#GTE(l:version, [0, 22, 0]) + \ && ale#semver#GTE(a:version, [0, 17, 0]) + let l:use_all_targets = ale#Var(a:buffer, 'rust_cargo_check_all_targets') + \ && ale#semver#GTE(a:version, [0, 22, 0]) + let l:use_examples = ale#Var(a:buffer, 'rust_cargo_check_examples') + \ && ale#semver#GTE(a:version, [0, 22, 0]) + let l:use_tests = ale#Var(a:buffer, 'rust_cargo_check_tests') + \ && ale#semver#GTE(a:version, [0, 22, 0]) + let l:target_dir = ale#Var(a:buffer, 'rust_cargo_target_dir') + let l:use_target_dir = !empty(l:target_dir) + \ && ale#semver#GTE(a:version, [0, 17, 0]) let l:include_features = ale#Var(a:buffer, 'rust_cargo_include_features') @@ -49,18 +55,6 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort let l:include_features = ' --features ' . ale#Escape(l:include_features) endif - let l:avoid_whole_workspace = ale#Var(a:buffer, 'rust_cargo_avoid_whole_workspace') - let l:nearest_cargo_prefix = '' - - if l:avoid_whole_workspace - let l:nearest_cargo = ale#path#FindNearestFile(a:buffer, 'Cargo.toml') - let l:nearest_cargo_dir = fnamemodify(l:nearest_cargo, ':h') - - if l:nearest_cargo_dir isnot# '.' - let l:nearest_cargo_prefix = 'cd '. ale#Escape(l:nearest_cargo_dir) .' && ' - endif - endif - let l:default_feature_behavior = ale#Var(a:buffer, 'rust_cargo_default_feature_behavior') if l:default_feature_behavior is# 'all' @@ -77,14 +71,23 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort if ale#Var(a:buffer, 'rust_cargo_use_clippy') let l:subcommand = 'clippy' - let l:clippy_options = ' ' . ale#Var(a:buffer, 'rust_cargo_clippy_options') + let l:clippy_options = ale#Var(a:buffer, 'rust_cargo_clippy_options') + + if l:clippy_options =~# '^-- ' + let l:clippy_options = join(split(l:clippy_options, '-- ')) + endif + + if l:clippy_options isnot# '' + let l:clippy_options = ' -- ' . l:clippy_options + endif endif - return l:nearest_cargo_prefix . 'cargo ' + return 'cargo ' \ . l:subcommand \ . (l:use_all_targets ? ' --all-targets' : '') \ . (l:use_examples ? ' --examples' : '') \ . (l:use_tests ? ' --tests' : '') + \ . (l:use_target_dir ? (' --target-dir ' . ale#Escape(l:target_dir)) : '') \ . ' --frozen --message-format=json -q' \ . l:default_feature \ . l:include_features @@ -94,10 +97,13 @@ endfunction call ale#linter#Define('rust', { \ 'name': 'cargo', \ 'executable': function('ale_linters#rust#cargo#GetCargoExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#rust#cargo#VersionCheck'}, -\ {'callback': 'ale_linters#rust#cargo#GetCommand'}, -\ ], +\ 'cwd': function('ale_linters#rust#cargo#GetCwd'), +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale_linters#rust#cargo#GetCargoExecutable(buffer), +\ '%e --version', +\ function('ale_linters#rust#cargo#GetCommand'), +\ )}, \ 'callback': 'ale#handlers#rust#HandleRustErrors', \ 'output_stream': 'both', \ 'lint_file': 1, diff --git a/sources_non_forked/ale/ale_linters/rust/rls.vim b/sources_non_forked/ale/ale_linters/rust/rls.vim index 0e5c326c..111d7558 100644 --- a/sources_non_forked/ale/ale_linters/rust/rls.vim +++ b/sources_non_forked/ale/ale_linters/rust/rls.vim @@ -2,7 +2,7 @@ " Description: A language server for Rust call ale#Set('rust_rls_executable', 'rls') -call ale#Set('rust_rls_toolchain', 'nightly') +call ale#Set('rust_rls_toolchain', '') call ale#Set('rust_rls_config', {}) function! ale_linters#rust#rls#GetCommand(buffer) abort diff --git a/sources_non_forked/ale/ale_linters/salt/salt_lint.vim b/sources_non_forked/ale/ale_linters/salt/salt_lint.vim new file mode 100644 index 00000000..47f66d83 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/salt/salt_lint.vim @@ -0,0 +1,33 @@ +" Author: Benjamin BINIER +" Description: salt-lint, saltstack linter + +call ale#Set('salt_salt_lint_executable', 'salt-lint') +call ale#Set('salt_salt_lint_options', '') + +function! ale_linters#salt#salt_lint#GetCommand(buffer) abort + return '%e' . ale#Pad(ale#Var(a:buffer, 'salt_salt_lint_options')) + \ . ' --json' +endfunction + +function! ale_linters#salt#salt_lint#Handle(buffer, lines) abort + let l:output = [] + + for l:error in ale#util#FuzzyJSONDecode(a:lines, []) + call add(l:output, { + \ 'lnum': l:error.linenumber + 0, + \ 'code': l:error.id + 0, + \ 'text': l:error.message, + \ 'type': l:error.severity is# 'HIGH' ? 'E' : 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('salt', { +\ 'name': 'salt_lint', +\ 'aliases': ['salt-lint'], +\ 'executable': {b -> ale#Var(b, 'salt_salt_lint_executable')}, +\ 'command': function('ale_linters#salt#salt_lint#GetCommand'), +\ 'callback': 'ale_linters#salt#salt_lint#Handle' +\}) diff --git a/sources_non_forked/ale/ale_linters/sass/sasslint.vim b/sources_non_forked/ale/ale_linters/sass/sasslint.vim index 17cd3667..ff396e68 100644 --- a/sources_non_forked/ale/ale_linters/sass/sasslint.vim +++ b/sources_non_forked/ale/ale_linters/sass/sasslint.vim @@ -5,7 +5,7 @@ call ale#Set('sass_sasslint_options', '') call ale#Set('sass_sasslint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#sass#sasslint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'sass_sasslint', [ + return ale#path#FindExecutable(a:buffer, 'sass_sasslint', [ \ 'node_modules/sass-lint/bin/sass-lint.js', \ 'node_modules/.bin/sass-lint', \]) diff --git a/sources_non_forked/ale/ale_linters/sass/stylelint.vim b/sources_non_forked/ale/ale_linters/sass/stylelint.vim index 7b14c6b4..22abef9b 100644 --- a/sources_non_forked/ale/ale_linters/sass/stylelint.vim +++ b/sources_non_forked/ale/ale_linters/sass/stylelint.vim @@ -5,7 +5,7 @@ call ale#Set('sass_stylelint_use_global', get(g:, 'ale_use_global_executables', call ale#linter#Define('sass', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'sass_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'sass_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': '%e --stdin-filename %s', diff --git a/sources_non_forked/ale/ale_linters/scala/metals.vim b/sources_non_forked/ale/ale_linters/scala/metals.vim new file mode 100644 index 00000000..da9e855d --- /dev/null +++ b/sources_non_forked/ale/ale_linters/scala/metals.vim @@ -0,0 +1,50 @@ +" Author: Jeffrey Lau - https://github.com/zoonfafer +" Description: Metals Language Server for Scala https://scalameta.org/metals/ + +call ale#Set('scala_metals_executable', 'metals-vim') +call ale#Set('scala_metals_project_root', '') + +function! ale_linters#scala#metals#GetProjectRoot(buffer) abort + let l:project_root = ale#Var(a:buffer, 'scala_metals_project_root') + + if !empty(l:project_root) + return l:project_root + endif + + let l:potential_roots = [ + \ 'build.sc', + \ 'build.sbt', + \ '.bloop', + \ '.metals', + \] + + for l:root in l:potential_roots + let l:project_root = ale#path#ResolveLocalPath( + \ a:buffer, + \ l:root, + \ '' + \) + + if !empty(l:project_root) + return fnamemodify( + \ l:project_root, + \ ':h', + \) + endif + endfor + + return '' +endfunction + +function! ale_linters#scala#metals#GetCommand(buffer) abort + return '%e' . ale#Pad('stdio') +endfunction + +call ale#linter#Define('scala', { +\ 'name': 'metals', +\ 'lsp': 'stdio', +\ 'language': 'scala', +\ 'executable': {b -> ale#Var(b, 'scala_metals_executable')}, +\ 'command': function('ale_linters#scala#metals#GetCommand'), +\ 'project_root': function('ale_linters#scala#metals#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/scss/sasslint.vim b/sources_non_forked/ale/ale_linters/scss/sasslint.vim index cf13546e..99027051 100644 --- a/sources_non_forked/ale/ale_linters/scss/sasslint.vim +++ b/sources_non_forked/ale/ale_linters/scss/sasslint.vim @@ -5,7 +5,7 @@ call ale#Set('scss_sasslint_options', '') call ale#Set('scss_sasslint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#scss#sasslint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'scss_sasslint', [ + return ale#path#FindExecutable(a:buffer, 'scss_sasslint', [ \ 'node_modules/sass-lint/bin/sass-lint.js', \ 'node_modules/.bin/sass-lint', \]) diff --git a/sources_non_forked/ale/ale_linters/scss/stylelint.vim b/sources_non_forked/ale/ale_linters/scss/stylelint.vim index b5b21536..fea4ea8f 100644 --- a/sources_non_forked/ale/ale_linters/scss/stylelint.vim +++ b/sources_non_forked/ale/ale_linters/scss/stylelint.vim @@ -11,7 +11,7 @@ endfunction call ale#linter#Define('scss', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'scss_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'scss_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#scss#stylelint#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/sh/bashate.vim b/sources_non_forked/ale/ale_linters/sh/bashate.vim new file mode 100644 index 00000000..3cd84245 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/sh/bashate.vim @@ -0,0 +1,43 @@ +" Author: hsanson +" Description: Lints sh files using bashate +" URL: https://github.com/openstack/bashate + +call ale#Set('sh_bashate_executable', 'bashate') +call ale#Set('sh_bashate_options', '') + +function! ale_linters#sh#bashate#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'sh_bashate_executable') +endfunction + +function! ale_linters#sh#bashate#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'sh_bashate_options') + let l:executable = ale_linters#sh#bashate#GetExecutable(a:buffer) + + return ale#Escape(l:executable) . ' ' . l:options . ' ' . '%t' +endfunction + +function! ale_linters#sh#bashate#Handle(buffer, lines) abort + " Matches patterns line the following: + " + " /path/to/script/file:694:1: E003 Indent not multiple of 4 + let l:pattern = ':\(\d\+\):\(\d\+\): \(.*\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': str2nr(l:match[1]), + \ 'col': str2nr(l:match[2]), + \ 'text': l:match[3], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('sh', { +\ 'name': 'bashate', +\ 'output_stream': 'stdout', +\ 'executable': function('ale_linters#sh#bashate#GetExecutable'), +\ 'command': function('ale_linters#sh#bashate#GetCommand'), +\ 'callback': 'ale_linters#sh#bashate#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/sh/language_server.vim b/sources_non_forked/ale/ale_linters/sh/language_server.vim index 5a3b0e9a..c6781584 100644 --- a/sources_non_forked/ale/ale_linters/sh/language_server.vim +++ b/sources_non_forked/ale/ale_linters/sh/language_server.vim @@ -6,7 +6,7 @@ call ale#Set('sh_language_server_executable', 'bash-language-server') call ale#Set('sh_language_server_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#sh#language_server#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'sh_language_server', [ + return ale#path#FindExecutable(a:buffer, 'sh_language_server', [ \ 'node_modules/.bin/bash-language-server', \]) endfunction diff --git a/sources_non_forked/ale/ale_linters/sh/shell.vim b/sources_non_forked/ale/ale_linters/sh/shell.vim index 189dc21d..73ab3608 100644 --- a/sources_non_forked/ale/ale_linters/sh/shell.vim +++ b/sources_non_forked/ale/ale_linters/sh/shell.vim @@ -1,5 +1,5 @@ " Author: w0rp -" Description: Lints sh files using bash -n +" Description: Lints shell files by invoking the shell with -n " Backwards compatibility if exists('g:ale_linters_sh_shell_default_shell') @@ -34,8 +34,10 @@ function! ale_linters#sh#shell#Handle(buffer, lines) abort " Matches patterns line the following: " " bash: line 13: syntax error near unexpected token `d' + " bash:่กŒ0: ๆœช้ข„ๆœŸ็š„็ฌฆๅทโ€œdoneโ€้™„่ฟ‘ๆœ‰่ฏญๆณ•้”™่ฏฏ + " bash: ๅˆ— 90: ๅฐ‹ๆ‰พๅŒน้…็š„ใ€Œ"ใ€ๆ™‚้‡ๅˆฐไบ†ๆœช้ ๆœŸ็š„ๆช”ๆกˆ็ตๆŸ็ฌฆ " sh: 11: Syntax error: "(" unexpected - let l:pattern = '\v(line |: ?)(\d+): (.+)$' + let l:pattern = '\v([^:]+:\D*)(\d+): (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) diff --git a/sources_non_forked/ale/ale_linters/sh/shellcheck.vim b/sources_non_forked/ale/ale_linters/sh/shellcheck.vim index bb7048cd..d9945126 100644 --- a/sources_non_forked/ale/ale_linters/sh/shellcheck.vim +++ b/sources_non_forked/ale/ale_linters/sh/shellcheck.vim @@ -1,117 +1,4 @@ " Author: w0rp -" Description: This file adds support for using the shellcheck linter with -" shell scripts. +" Description: shellcheck linter for shell scripts. -" This global variable can be set with a string of comma-separated error -" codes to exclude from shellcheck. For example: -" -" let g:ale_sh_shellcheck_exclusions = 'SC2002,SC2004' -call ale#Set('sh_shellcheck_exclusions', get(g:, 'ale_linters_sh_shellcheck_exclusions', '')) -call ale#Set('sh_shellcheck_executable', 'shellcheck') -call ale#Set('sh_shellcheck_dialect', 'auto') -call ale#Set('sh_shellcheck_options', '') - -function! ale_linters#sh#shellcheck#GetExecutable(buffer) abort - return ale#Var(a:buffer, 'sh_shellcheck_executable') -endfunction - -function! ale_linters#sh#shellcheck#GetDialectArgument(buffer) abort - let l:shell_type = ale#handlers#sh#GetShellType(a:buffer) - - if !empty(l:shell_type) - " Use the dash dialect for /bin/ash, etc. - if l:shell_type is# 'ash' - return 'dash' - endif - - return l:shell_type - endif - - " If there's no hashbang, try using Vim's buffer variables. - if getbufvar(a:buffer, 'is_bash', 0) - return 'bash' - elseif getbufvar(a:buffer, 'is_sh', 0) - return 'sh' - elseif getbufvar(a:buffer, 'is_kornshell', 0) - return 'ksh' - endif - - return '' -endfunction - -function! ale_linters#sh#shellcheck#VersionCheck(buffer) abort - let l:executable = ale_linters#sh#shellcheck#GetExecutable(a:buffer) - - " Don't check the version again if we've already cached it. - return !ale#semver#HasVersion(l:executable) - \ ? ale#Escape(l:executable) . ' --version' - \ : '' -endfunction - -function! ale_linters#sh#shellcheck#GetCommand(buffer, version_output) abort - let l:executable = ale_linters#sh#shellcheck#GetExecutable(a:buffer) - let l:version = ale#semver#GetVersion(l:executable, a:version_output) - - let l:options = ale#Var(a:buffer, 'sh_shellcheck_options') - let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions') - let l:dialect = ale#Var(a:buffer, 'sh_shellcheck_dialect') - let l:external_option = ale#semver#GTE(l:version, [0, 4, 0]) ? ' -x' : '' - - if l:dialect is# 'auto' - let l:dialect = ale_linters#sh#shellcheck#GetDialectArgument(a:buffer) - endif - - return ale#path#BufferCdString(a:buffer) - \ . ale#Escape(l:executable) - \ . (!empty(l:dialect) ? ' -s ' . l:dialect : '') - \ . (!empty(l:options) ? ' ' . l:options : '') - \ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '') - \ . l:external_option - \ . ' -f gcc -' -endfunction - -function! ale_linters#sh#shellcheck#Handle(buffer, lines) abort - let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+) \[([^\]]+)\]$' - let l:output = [] - - for l:match in ale#util#GetMatches(a:lines, l:pattern) - if l:match[4] is# 'error' - let l:type = 'E' - elseif l:match[4] is# 'note' - let l:type = 'I' - else - let l:type = 'W' - endif - - let l:item = { - \ 'lnum': str2nr(l:match[2]), - \ 'type': l:type, - \ 'text': l:match[5], - \ 'code': l:match[6], - \} - - if !empty(l:match[3]) - let l:item.col = str2nr(l:match[3]) - endif - - " If the filename is something like , or -, then - " this is an error for the file we checked. - if l:match[1] isnot# '-' && l:match[1][0] isnot# '<' - let l:item['filename'] = l:match[1] - endif - - call add(l:output, l:item) - endfor - - return l:output -endfunction - -call ale#linter#Define('sh', { -\ 'name': 'shellcheck', -\ 'executable': function('ale_linters#sh#shellcheck#GetExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#sh#shellcheck#VersionCheck'}, -\ {'callback': 'ale_linters#sh#shellcheck#GetCommand'}, -\ ], -\ 'callback': 'ale_linters#sh#shellcheck#Handle', -\}) +call ale#handlers#shellcheck#DefineLinter('sh') diff --git a/sources_non_forked/ale/ale_linters/slim/slimlint.vim b/sources_non_forked/ale/ale_linters/slim/slimlint.vim index 1a4008ae..1b365e25 100644 --- a/sources_non_forked/ale/ale_linters/slim/slimlint.vim +++ b/sources_non_forked/ale/ale_linters/slim/slimlint.vim @@ -11,7 +11,7 @@ function! ale_linters#slim#slimlint#GetCommand(buffer) abort " " See https://github.com/sds/slim-lint/blob/master/lib/slim_lint/linter/README.md#rubocop if !empty(l:rubocop_config) - if ale#Has('win32') + if has('win32') let l:command = 'set SLIM_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config) . ' && ' . l:command else let l:command = 'SLIM_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config) . ' ' . l:command diff --git a/sources_non_forked/ale/ale_linters/solidity/solc.vim b/sources_non_forked/ale/ale_linters/solidity/solc.vim new file mode 100644 index 00000000..28977083 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/solidity/solc.vim @@ -0,0 +1,53 @@ +" Author: Karl Bartel - http://karl.berlin/ +" Description: Report solc compiler errors in Solidity code + +call ale#Set('solidity_solc_executable', 'solc') +call ale#Set('solidity_solc_options', '') + +function! ale_linters#solidity#solc#Handle(buffer, lines) abort + " Matches patterns like the following: + " Error: Expected ';' but got '(' + " --> /path/to/file/file.sol:1:10:) + let l:pattern = '\v(Error|Warning): (.*)$' + let l:line_and_column_pattern = '\v\.sol:(\d+):(\d+):' + let l:output = [] + + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) + + if len(l:match) == 0 + let l:match = matchlist(l:line, l:line_and_column_pattern) + + if len(l:match) > 0 + let l:index = len(l:output) - 1 + let l:output[l:index]['lnum'] = l:match[1] + 0 + let l:output[l:index]['col'] = l:match[2] + 0 + endif + else + let l:isError = l:match[1] is? 'Error' + + call add(l:output, { + \ 'lnum': 0, + \ 'col': 0, + \ 'text': l:match[2], + \ 'type': l:isError ? 'E' : 'W', + \}) + endif + endfor + + return l:output +endfunction + +function! ale_linters#solidity#solc#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'solidity_solc_executable') + + return l:executable . ale#Pad(ale#Var(a:buffer, 'solidity_solc_options')) . ' %s' +endfunction + +call ale#linter#Define('solidity', { +\ 'name': 'solc', +\ 'executable': {b -> ale#Var(b, 'solidity_solc_executable')}, +\ 'command': function('ale_linters#solidity#solc#GetCommand'), +\ 'callback': 'ale_linters#solidity#solc#Handle', +\ 'output_stream': 'stderr', +\}) diff --git a/sources_non_forked/ale/ale_linters/solidity/solhint.vim b/sources_non_forked/ale/ale_linters/solidity/solhint.vim index 8ea33e07..505bd5bb 100644 --- a/sources_non_forked/ale/ale_linters/solidity/solhint.vim +++ b/sources_non_forked/ale/ale_linters/solidity/solhint.vim @@ -1,29 +1,12 @@ -" Author: Franco Victorio - https://github.com/fvictorio +" Authors: Franco Victorio - https://github.com/fvictorio, Henrique Barcelos +" https://github.com/hbarcelos " Description: Report errors in Solidity code with solhint -function! ale_linters#solidity#solhint#Handle(buffer, lines) abort - " Matches patterns like the following: - " /path/to/file/file.sol: line 1, col 10, Error - 'addOne' is defined but never used. (no-unused-vars) - let l:pattern = '\v^[^:]+: line (\d+), col (\d+), (Error|Warning) - (.*) \((.*)\)$' - let l:output = [] - - for l:match in ale#util#GetMatches(a:lines, l:pattern) - let l:isError = l:match[3] is? 'error' - call add(l:output, { - \ 'lnum': l:match[1] + 0, - \ 'col': l:match[2] + 0, - \ 'text': l:match[4], - \ 'code': l:match[5], - \ 'type': l:isError ? 'E' : 'W', - \}) - endfor - - return l:output -endfunction - call ale#linter#Define('solidity', { \ 'name': 'solhint', -\ 'executable': 'solhint', -\ 'command': 'solhint --formatter compact %t', -\ 'callback': 'ale_linters#solidity#solhint#Handle', +\ 'output_stream': 'both', +\ 'executable': function('ale#handlers#solhint#GetExecutable'), +\ 'cwd': function('ale#handlers#solhint#GetCwd'), +\ 'command': function('ale#handlers#solhint#GetCommand'), +\ 'callback': 'ale#handlers#solhint#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/spec/rpmlint.vim b/sources_non_forked/ale/ale_linters/spec/rpmlint.vim index 92ef4d63..5594e3b8 100644 --- a/sources_non_forked/ale/ale_linters/spec/rpmlint.vim +++ b/sources_non_forked/ale/ale_linters/spec/rpmlint.vim @@ -29,11 +29,18 @@ call ale#Set('spec_rpmlint_executable', 'rpmlint') call ale#Set('spec_rpmlint_options', '') -function! ale_linters#spec#rpmlint#GetCommand(buffer) abort +function! ale_linters#spec#rpmlint#GetCommand(buffer, version) abort + if ale#semver#GTE(a:version, [2, 0, 0]) + " The -o/--option flag was removed in version 2.0.0 + let l:version_dependent_args = '' + else + let l:version_dependent_args = ' -o "NetworkEnabled False"' + endif + return '%e' \ . ale#Pad(ale#Var(a:buffer, 'spec_rpmlint_options')) - \ . ' -o "NetworkEnabled False"' \ . ' -v' + \ . l:version_dependent_args \ . ' %t' endfunction @@ -73,6 +80,11 @@ endfunction call ale#linter#Define('spec', { \ 'name': 'rpmlint', \ 'executable': {b -> ale#Var(b, 'spec_rpmlint_executable')}, -\ 'command': function('ale_linters#spec#rpmlint#GetCommand'), +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#Var(buffer, 'spec_rpmlint_executable'), +\ '%e --version', +\ function('ale_linters#spec#rpmlint#GetCommand'), +\ )}, \ 'callback': 'ale_linters#spec#rpmlint#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/sql/sqllint.vim b/sources_non_forked/ale/ale_linters/sql/sqllint.vim new file mode 100644 index 00000000..78396fe9 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/sql/sqllint.vim @@ -0,0 +1,33 @@ +" ale_linters/sql/sqllint.vim +" Author: Joe Reynolds +" Description: sql-lint for SQL files. +" sql-lint can be found at +" https://www.npmjs.com/package/sql-lint +" https://github.com/joereynolds/sql-lint + +function! ale_linters#sql#sqllint#Handle(buffer, lines) abort + " Matches patterns like the following: + " + " stdin:1 [ER_NO_DB_ERROR] No database selected + let l:pattern = '\v^[^:]+:(\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][0], + \ 'text': l:match[0], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('sql', { +\ 'name': 'sqllint', +\ 'aliases': ['sql-lint'], +\ 'executable': 'sql-lint', +\ 'command': 'sql-lint', +\ 'callback': 'ale_linters#sql#sqllint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/stylus/stylelint.vim b/sources_non_forked/ale/ale_linters/stylus/stylelint.vim index ce6f9426..b60e38ed 100644 --- a/sources_non_forked/ale/ale_linters/stylus/stylelint.vim +++ b/sources_non_forked/ale/ale_linters/stylus/stylelint.vim @@ -12,7 +12,7 @@ endfunction call ale#linter#Define('stylus', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'stylus_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'stylus_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#stylus#stylelint#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/sugarss/stylelint.vim b/sources_non_forked/ale/ale_linters/sugarss/stylelint.vim index 6c705e46..879ff0ca 100644 --- a/sources_non_forked/ale/ale_linters/sugarss/stylelint.vim +++ b/sources_non_forked/ale/ale_linters/sugarss/stylelint.vim @@ -13,7 +13,7 @@ endfunction call ale#linter#Define('sugarss', { \ 'name': 'stylelint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'sugarss_stylelint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'sugarss_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#sugarss#stylelint#GetCommand'), diff --git a/sources_non_forked/ale/ale_linters/svelte/svelteserver.vim b/sources_non_forked/ale/ale_linters/svelte/svelteserver.vim new file mode 100644 index 00000000..2200b582 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/svelte/svelteserver.vim @@ -0,0 +1,21 @@ +" Author: Joakim Repomaa +" Description: Svelte Language Server integration for ALE + +call ale#Set('svelte_svelteserver_executable', 'svelteserver') +call ale#Set('svelte_svelteserver_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale_linters#svelte#svelteserver#GetProjectRoot(buffer) abort + let l:package_path = ale#path#FindNearestFile(a:buffer, 'package.json') + + return !empty(l:package_path) ? fnamemodify(l:package_path, ':h') : '' +endfunction + +call ale#linter#Define('svelte', { +\ 'name': 'svelteserver', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#path#FindExecutable(b, 'svelte_svelteserver', [ +\ 'node_modules/.bin/svelteserver', +\ ])}, +\ 'command': '%e --stdio', +\ 'project_root': function('ale_linters#svelte#svelteserver#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/swift/appleswiftformat.vim b/sources_non_forked/ale/ale_linters/swift/appleswiftformat.vim new file mode 100644 index 00000000..4c61764d --- /dev/null +++ b/sources_non_forked/ale/ale_linters/swift/appleswiftformat.vim @@ -0,0 +1,43 @@ +" Authors: Klaas Pieter Annema , bosr +" Description: Support for swift-format https://github.com/apple/swift-format + +function! ale_linters#swift#appleswiftformat#GetLinterCommand(buffer) abort + let l:command_args = ale#swift#GetAppleSwiftFormatCommand(a:buffer) . ' lint %t' + let l:config_args = ale#swift#GetAppleSwiftFormatConfigArgs(a:buffer) + + if l:config_args isnot# '' + let l:command_args = l:command_args . ' ' . l:config_args + endif + + return l:command_args +endfunction + +function! ale_linters#swift#appleswiftformat#Handle(buffer, lines) abort + " Matches the typical output of swift-format, that is lines of the following pattern: + " + " Sources/main.swift:4:21: warning: [DoNotUseSemicolons] remove ';' and move the next statement to the new line + " Sources/main.swift:3:12: warning: [Spacing] remove 1 space + let l:pattern = '\v^.*:(\d+):(\d+): (\S+): \[(\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, + \ 'type': l:match[3] is# 'error' ? 'E' : 'W', + \ 'code': l:match[4], + \ 'text': l:match[5], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('swift', { +\ 'name': 'apple-swift-format', +\ 'executable': function('ale#swift#GetAppleSwiftFormatExecutable'), +\ 'command': function('ale_linters#swift#appleswiftformat#GetLinterCommand'), +\ 'output_stream': 'stderr', +\ 'language': 'swift', +\ 'callback': 'ale_linters#swift#appleswiftformat#Handle' +\}) diff --git a/sources_non_forked/ale/ale_linters/swift/sourcekitlsp.vim b/sources_non_forked/ale/ale_linters/swift/sourcekitlsp.vim new file mode 100644 index 00000000..560893bf --- /dev/null +++ b/sources_non_forked/ale/ale_linters/swift/sourcekitlsp.vim @@ -0,0 +1,13 @@ +" Author: Dan Loman +" Description: Support for sourcekit-lsp https://github.com/apple/sourcekit-lsp + +call ale#Set('sourcekit_lsp_executable', 'sourcekit-lsp') + +call ale#linter#Define('swift', { +\ 'name': 'sourcekitlsp', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'sourcekit_lsp_executable')}, +\ 'command': '%e', +\ 'project_root': function('ale#swift#FindProjectRoot'), +\ 'language': 'swift', +\}) diff --git a/sources_non_forked/ale/ale_linters/swift/swiftlint.vim b/sources_non_forked/ale/ale_linters/swift/swiftlint.vim index 237c45d3..d08c68f6 100644 --- a/sources_non_forked/ale/ale_linters/swift/swiftlint.vim +++ b/sources_non_forked/ale/ale_linters/swift/swiftlint.vim @@ -5,7 +5,7 @@ call ale#Set('swift_swiftlint_executable', 'swiftlint') call ale#Set('swift_swiftlint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#swift#swiftlint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'swift_swiftlint', [ + return ale#path#FindExecutable(a:buffer, 'swift_swiftlint', [ \ 'Pods/SwiftLint/swiftlint', \ 'ios/Pods/SwiftLint/swiftlint', \ 'swiftlint', diff --git a/sources_non_forked/ale/ale_linters/systemd/systemd_analyze.vim b/sources_non_forked/ale/ale_linters/systemd/systemd_analyze.vim new file mode 100644 index 00000000..64eef8cf --- /dev/null +++ b/sources_non_forked/ale/ale_linters/systemd/systemd_analyze.vim @@ -0,0 +1,18 @@ +function! ale_linters#systemd#systemd_analyze#Handle(buffer, lines) abort + return ale#util#MapMatches(a:lines, '\v(.+):([0-9]+): (.+)', {match -> { + \ 'lnum': str2nr(match[2]), + \ 'col': 1, + \ 'type': 'W', + \ 'text': match[3], + \}}) +endfunction + +call ale#linter#Define('systemd', { +\ 'name': 'systemd_analyze', +\ 'aliases': ['systemd-analyze'], +\ 'executable': 'systemd-analyze', +\ 'command': 'SYSTEMD_LOG_COLOR=0 %e --user verify %s', +\ 'callback': 'ale_linters#systemd#systemd_analyze#Handle', +\ 'output_stream': 'both', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/terraform/terraform.vim b/sources_non_forked/ale/ale_linters/terraform/terraform.vim new file mode 100644 index 00000000..cf134460 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/terraform/terraform.vim @@ -0,0 +1,63 @@ +" Author: Keith Maxwell +" Description: terraform fmt to check for errors + +call ale#Set('terraform_terraform_executable', 'terraform') + +function! ale_linters#terraform#terraform#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'terraform_terraform_executable') +endfunction + +function! ale_linters#terraform#terraform#GetCommand(buffer) abort + return ale#Escape(ale_linters#terraform#terraform#GetExecutable(a:buffer)) + \ . ' validate -no-color -json ' +endfunction + +function! ale_linters#terraform#terraform#GetType(severity) abort + if a:severity is? 'warning' + return 'W' + endif + + return 'E' +endfunction + +function! ale_linters#terraform#terraform#GetDetail(error) abort + return get(a:error, 'detail', get(a:error, 'summary', '')) +endfunction + +function! ale_linters#terraform#terraform#Handle(buffer, lines) abort + let l:output = [] + + let l:errors = ale#util#FuzzyJSONDecode(a:lines, {'diagnostics': []}) + let l:dir = expand('#' . a:buffer . ':p:h') + let l:file = expand('#' . a:buffer . ':p') + + for l:error in l:errors['diagnostics'] + if has_key(l:error, 'range') + call add(l:output, { + \ 'filename': ale#path#GetAbsPath(l:dir, l:error['range']['filename']), + \ 'lnum': l:error['range']['start']['line'], + \ 'col': l:error['range']['start']['column'], + \ 'text': ale_linters#terraform#terraform#GetDetail(l:error), + \ 'type': ale_linters#terraform#terraform#GetType(l:error['severity']), + \}) + else + call add(l:output, { + \ 'filename': l:file, + \ 'lnum': 0, + \ 'col': 0, + \ 'text': ale_linters#terraform#terraform#GetDetail(l:error), + \ 'type': ale_linters#terraform#terraform#GetType(l:error['severity']), + \}) + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('terraform', { +\ 'name': 'terraform', +\ 'output_stream': 'stdout', +\ 'executable': function('ale_linters#terraform#terraform#GetExecutable'), +\ 'command': function('ale_linters#terraform#terraform#GetCommand'), +\ 'callback': 'ale_linters#terraform#terraform#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/terraform/terraform_ls.vim b/sources_non_forked/ale/ale_linters/terraform/terraform_ls.vim new file mode 100644 index 00000000..ab35126e --- /dev/null +++ b/sources_non_forked/ale/ale_linters/terraform/terraform_ls.vim @@ -0,0 +1,38 @@ +" Author: Horacio Sanson +" Description: terraform-ls integration for ALE (cf. https://github.com/hashicorp/terraform-ls) + +call ale#Set('terraform_terraform_executable', 'terraform') +call ale#Set('terraform_ls_executable', 'terraform-ls') +call ale#Set('terraform_ls_options', '') + +function! ale_linters#terraform#terraform_ls#GetTerraformExecutable(buffer) abort + let l:terraform_executable = ale#Var(a:buffer, 'terraform_terraform_executable') + + if(ale#path#IsAbsolute(l:terraform_executable)) + return '-tf-exec ' . l:terraform_executable + endif + + return '' +endfunction + +function! ale_linters#terraform#terraform_ls#GetCommand(buffer) abort + return '%e' + \ . ale#Pad('serve') + \ . ale#Pad(ale_linters#terraform#terraform_ls#GetTerraformExecutable(a:buffer)) + \ . ale#Pad(ale#Var(a:buffer, 'terraform_ls_options')) +endfunction + +function! ale_linters#terraform#terraform_ls#GetProjectRoot(buffer) abort + let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform') + + return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : '' +endfunction + +call ale#linter#Define('terraform', { +\ 'name': 'terraform_ls', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'terraform_ls_executable')}, +\ 'command': function('ale_linters#terraform#terraform_ls#GetCommand'), +\ 'project_root': function('ale_linters#terraform#terraform_ls#GetProjectRoot'), +\ 'language': 'terraform', +\}) diff --git a/sources_non_forked/ale/ale_linters/terraform/terraform_lsp.vim b/sources_non_forked/ale/ale_linters/terraform/terraform_lsp.vim new file mode 100644 index 00000000..e2408c15 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/terraform/terraform_lsp.vim @@ -0,0 +1,25 @@ +" Author: OJFord +" Description: terraform-lsp integration for ALE (cf. https://github.com/juliosueiras/terraform-lsp) + +call ale#Set('terraform_langserver_executable', 'terraform-lsp') +call ale#Set('terraform_langserver_options', '') + +function! ale_linters#terraform#terraform_lsp#GetCommand(buffer) abort + return '%e' + \ . ale#Pad(ale#Var(a:buffer, 'terraform_langserver_options')) +endfunction + +function! ale_linters#terraform#terraform_lsp#GetProjectRoot(buffer) abort + let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform') + + return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : '' +endfunction + +call ale#linter#Define('terraform', { +\ 'name': 'terraform_lsp', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'terraform_langserver_executable')}, +\ 'command': function('ale_linters#terraform#terraform_lsp#GetCommand'), +\ 'project_root': function('ale_linters#terraform#terraform_lsp#GetProjectRoot'), +\ 'language': 'terraform', +\}) diff --git a/sources_non_forked/ale/ale_linters/terraform/tflint.vim b/sources_non_forked/ale/ale_linters/terraform/tflint.vim index 6d54a8b1..86b5b74a 100644 --- a/sources_non_forked/ale/ale_linters/terraform/tflint.vim +++ b/sources_non_forked/ale/ale_linters/terraform/tflint.vim @@ -9,23 +9,69 @@ call ale#Set('terraform_tflint_executable', 'tflint') function! ale_linters#terraform#tflint#Handle(buffer, lines) abort let l:output = [] + let l:pattern = '\v^(.*):(\d+),(\d+)-(\d+)?,?(\d+): (.{-1,}); (.+)$' + let l:json = ale#util#FuzzyJSONDecode(a:lines, {}) - for l:error in ale#util#FuzzyJSONDecode(a:lines, []) - if l:error.type is# 'ERROR' - let l:type = 'E' - elseif l:error.type is# 'NOTICE' - let l:type = 'I' - else - let l:type = 'W' - endif + " This is a rough test for tflint's output format + " On versions prior to 0.11 it outputs all errors as a single level list + if type(l:json) is v:t_list + for l:error in l:json + if l:error.type is# 'ERROR' + let l:type = 'E' + elseif l:error.type is# 'NOTICE' + let l:type = 'I' + else + let l:type = 'W' + endif - call add(l:output, { - \ 'lnum': l:error.line, - \ 'text': l:error.message, - \ 'type': l:type, - \ 'code': l:error.detector, - \}) - endfor + call add(l:output, { + \ 'lnum': l:error.line, + \ 'text': l:error.message, + \ 'type': l:type, + \ 'code': l:error.detector, + \}) + endfor + else + for l:error in get(l:json, 'errors', []) + for l:match in ale#util#GetMatches(l:error.message, [l:pattern]) + if l:match[4] is# '' + let l:match[4] = l:match[2] + endif + + call add(l:output, { + \ 'filename': l:match[1], + \ 'lnum': str2nr(l:match[2]), + \ 'col': str2nr(l:match[3]), + \ 'end_lnum': str2nr(l:match[4]), + \ 'end_col': str2nr(l:match[5]), + \ 'text': l:match[7], + \ 'code': l:match[6], + \ 'type': 'E', + \}) + endfor + endfor + + for l:error in get(l:json, 'issues', []) + if l:error.rule.severity is# 'ERROR' + let l:type = 'E' + elseif l:error.rule.severity is# 'NOTICE' + let l:type = 'I' + else + let l:type = 'W' + endif + + call add(l:output, { + \ 'filename': l:error.range.filename, + \ 'lnum': l:error.range.start.line, + \ 'col': l:error.range.start.column, + \ 'end_lnum': l:error.range.end.line, + \ 'end_col': l:error.range.end.column, + \ 'text': l:error.message, + \ 'code': l:error.rule.name, + \ 'type': l:type, + \}) + endfor + endif return l:output endfunction @@ -45,7 +91,7 @@ function! ale_linters#terraform#tflint#GetCommand(buffer) abort let l:cmd .= ' ' . l:opts endif - let l:cmd .= ' -f json %t' + let l:cmd .= ' -f json' return l:cmd endfunction @@ -53,6 +99,7 @@ endfunction call ale#linter#Define('terraform', { \ 'name': 'tflint', \ 'executable': {b -> ale#Var(b, 'terraform_tflint_executable')}, +\ 'cwd': '%s:h', \ 'command': function('ale_linters#terraform#tflint#GetCommand'), \ 'callback': 'ale_linters#terraform#tflint#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/tex/texlab.vim b/sources_non_forked/ale/ale_linters/tex/texlab.vim new file mode 100644 index 00000000..0794bf51 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/tex/texlab.vim @@ -0,0 +1,24 @@ +" Author: Ricardo Liang +" Author: ourigen +" Description: Texlab language server (Rust rewrite) + +call ale#Set('tex_texlab_executable', 'texlab') +call ale#Set('tex_texlab_options', '') + +function! ale_linters#tex#texlab#GetProjectRoot(buffer) abort + let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') + + return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' +endfunction + +function! ale_linters#tex#texlab#GetCommand(buffer) abort + return '%e' . ale#Pad(ale#Var(a:buffer, 'tex_texlab_options')) +endfunction + +call ale#linter#Define('tex', { +\ 'name': 'texlab', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'tex_texlab_executable')}, +\ 'command': function('ale_linters#tex#texlab#GetCommand'), +\ 'project_root': function('ale_linters#tex#texlab#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/thrift/thriftcheck.vim b/sources_non_forked/ale/ale_linters/thrift/thriftcheck.vim new file mode 100644 index 00000000..bf929d10 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/thrift/thriftcheck.vim @@ -0,0 +1,46 @@ +" Author: Jon Parise + +call ale#Set('thrift_thriftcheck_executable', 'thriftcheck') +call ale#Set('thrift_thriftcheck_options', '') + +function! ale_linters#thrift#thriftcheck#GetCommand(buffer) abort + return '%e' + \ . ale#Pad(ale#Var(a:buffer, 'thrift_thriftcheck_options')) + \ . ' --stdin-filename %s' + \ . ' %t' +endfunction + +function! ale_linters#thrift#thriftcheck#Handle(buffer, lines) abort + " Matches lines like the following: + " + " file.thrift:1:1: error: "py" namespace must match "^idl\\." (namespace.pattern) + " file.thrift:3:5: warning: 64-bit integer constant -2147483649 may not work in all languages (int.64bit) + let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+): ?([^:]+): (.+) \(([^\)]+)\)$' + + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + if l:match[3] is# 'warning' + let l:type = 'W' + else + let l:type = 'E' + endif + + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'type': l:type, + \ 'text': l:match[4], + \ 'code': l:match[5], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('thrift', { +\ 'name': 'thriftcheck', +\ 'executable': {b -> ale#Var(b, 'thrift_thriftcheck_executable')}, +\ 'command': function('ale_linters#thrift#thriftcheck#GetCommand'), +\ 'callback': 'ale_linters#thrift#thriftcheck#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/typescript/deno.vim b/sources_non_forked/ale/ale_linters/typescript/deno.vim new file mode 100644 index 00000000..f47fac7a --- /dev/null +++ b/sources_non_forked/ale/ale_linters/typescript/deno.vim @@ -0,0 +1,12 @@ +" Author: Mohammed Chelouti - https://github.com/motato1 +" Arnold Chand +" Description: Deno lsp linter for TypeScript files. + +call ale#linter#Define('typescript', { +\ 'name': 'deno', +\ 'lsp': 'stdio', +\ 'executable': function('ale#handlers#deno#GetExecutable'), +\ 'command': '%e lsp', +\ 'project_root': function('ale#handlers#deno#GetProjectRoot'), +\ 'initialization_options': function('ale#handlers#deno#GetInitializationOptions'), +\}) diff --git a/sources_non_forked/ale/ale_linters/typescript/eslint.vim b/sources_non_forked/ale/ale_linters/typescript/eslint.vim index bf849337..eaeac307 100644 --- a/sources_non_forked/ale/ale_linters/typescript/eslint.vim +++ b/sources_non_forked/ale/ale_linters/typescript/eslint.vim @@ -4,6 +4,7 @@ call ale#linter#Define('typescript', { \ 'name': 'eslint', \ 'executable': function('ale#handlers#eslint#GetExecutable'), +\ 'cwd': function('ale#handlers#eslint#GetCwd'), \ 'command': function('ale#handlers#eslint#GetCommand'), -\ 'callback': 'ale#handlers#eslint#Handle', +\ 'callback': 'ale#handlers#eslint#HandleJSON', \}) diff --git a/sources_non_forked/ale/ale_linters/typescript/standard.vim b/sources_non_forked/ale/ale_linters/typescript/standard.vim new file mode 100644 index 00000000..1d524a10 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/typescript/standard.vim @@ -0,0 +1,31 @@ +" Author: Ahmed El Gabri <@ahmedelgabri> +" Description: standardjs for typescript files + +call ale#Set('typescript_standard_executable', 'standard') +call ale#Set('typescript_standard_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('typescript_standard_options', '') + +function! ale_linters#typescript#standard#GetExecutable(buffer) abort + return ale#path#FindExecutable(a:buffer, 'typescript_standard', [ + \ 'node_modules/standardx/bin/cmd.js', + \ 'node_modules/standard/bin/cmd.js', + \ 'node_modules/.bin/standard', + \]) +endfunction + +function! ale_linters#typescript#standard#GetCommand(buffer) abort + let l:executable = ale_linters#typescript#standard#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'typescript_standard_options') + + return ale#node#Executable(a:buffer, l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --stdin %s' +endfunction + +" standard uses eslint and the output format is the same +call ale#linter#Define('typescript', { +\ 'name': 'standard', +\ 'executable': function('ale_linters#typescript#standard#GetExecutable'), +\ 'command': function('ale_linters#typescript#standard#GetCommand'), +\ 'callback': 'ale#handlers#eslint#Handle', +\}) diff --git a/sources_non_forked/ale/ale_linters/typescript/tslint.vim b/sources_non_forked/ale/ale_linters/typescript/tslint.vim index f70c2e45..886a3cd4 100644 --- a/sources_non_forked/ale/ale_linters/typescript/tslint.vim +++ b/sources_non_forked/ale/ale_linters/typescript/tslint.vim @@ -59,8 +59,7 @@ function! ale_linters#typescript#tslint#GetCommand(buffer) abort \ ? ' -r ' . ale#Escape(l:tslint_rules_dir) \ : '' - return ale#path#BufferCdString(a:buffer) - \ . ale#Escape(ale#handlers#tslint#GetExecutable(a:buffer)) + return ale#Escape(ale#handlers#tslint#GetExecutable(a:buffer)) \ . ' --format json' \ . l:tslint_config_option \ . l:tslint_rules_option @@ -70,6 +69,7 @@ endfunction call ale#linter#Define('typescript', { \ 'name': 'tslint', \ 'executable': function('ale#handlers#tslint#GetExecutable'), +\ 'cwd': '%s:h', \ 'command': function('ale_linters#typescript#tslint#GetCommand'), \ 'callback': 'ale_linters#typescript#tslint#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/typescript/tsserver.vim b/sources_non_forked/ale/ale_linters/typescript/tsserver.vim index 840889f3..d97becca 100644 --- a/sources_non_forked/ale/ale_linters/typescript/tsserver.vim +++ b/sources_non_forked/ale/ale_linters/typescript/tsserver.vim @@ -8,7 +8,8 @@ call ale#Set('typescript_tsserver_use_global', get(g:, 'ale_use_global_executabl call ale#linter#Define('typescript', { \ 'name': 'tsserver', \ 'lsp': 'tsserver', -\ 'executable': {b -> ale#node#FindExecutable(b, 'typescript_tsserver', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'typescript_tsserver', [ +\ '.yarn/sdks/typescript/bin/tsserver', \ 'node_modules/.bin/tsserver', \ ])}, \ 'command': '%e', diff --git a/sources_non_forked/ale/ale_linters/typescript/xo.vim b/sources_non_forked/ale/ale_linters/typescript/xo.vim new file mode 100644 index 00000000..6f4ee50c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/typescript/xo.vim @@ -0,0 +1,6 @@ +call ale#linter#Define('typescript', { +\ 'name': 'xo', +\ 'executable': function('ale#handlers#xo#GetExecutable'), +\ 'command': function('ale#handlers#xo#GetLintCommand'), +\ 'callback': 'ale#handlers#xo#HandleJSON', +\}) diff --git a/sources_non_forked/ale/ale_linters/v/v.vim b/sources_non_forked/ale/ale_linters/v/v.vim new file mode 100644 index 00000000..afa98c56 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/v/v.vim @@ -0,0 +1,82 @@ +" Author: fiatjaf +" Description: v build for V files + +call ale#Set('v_v_executable', 'v') +call ale#Set('v_v_options', '') + +function! ale_linters#v#v#GetCommand(buffer) abort + let l:options = ale#Var(a:buffer, 'v_v_options') + + " Run v in local directory with relative path + let l:command = ale#Var(a:buffer, 'v_v_executable') + \ . ale#Pad(l:options) + \ . ' .' . ' -o /tmp/vim-ale-v' + + return l:command +endfunction + +function! ale_linters#v#v#Handler(buffer, lines) abort + let l:dir = expand('#' . a:buffer . ':p:h') + let l:output = [] + + " Matches patterns like the following: + " + " ./const.v:4:3: warning: const names cannot contain uppercase letters, use snake_case instead + " 2 | + " 3 | const ( + " 4 | BUTTON_TEXT = 'OK' + " | ~~~~~~~~~~~ + " 5 | ) + " ./main.v:4:8: warning: module 'os' is imported but never used + " 2 | + " 3 | import ui + " 4 | import os + " | ~~ + " 5 | + " 6 | const ( + " ./main.v:20:10: error: undefined ident: `win_widt` + " 18 | mut app := &App{} + " 19 | app.window = ui.window({ + " 20 | width: win_widt + " | ~~~~~~~~ + " 21 | height: win_height + " 22 | title: 'Counter' + let l:current = {} + + for l:line in a:lines + " matches basic error description + let l:match = matchlist(l:line, + \ '\([^:]\+\):\([^:]\+\):\([^:]\+\): \([^:]\+\): \(.*\)') + + if !empty(l:match) + let l:current = { + \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'text': l:match[5], + \ 'type': l:match[4] is# 'error' ? 'E' : 'W', + \} + call add(l:output, l:current) + continue + endif + + " try to get information about the ending column + let l:tildematch = matchstr(l:line, '\~\+') + + if !empty(l:tildematch) + let l:current['end_col'] = l:current['col'] + len(l:tildematch) + endif + endfor + + return l:output +endfunction + +call ale#linter#Define('v', { +\ 'name': 'v', +\ 'aliases': [], +\ 'executable': {b -> ale#Var(b, 'v_v_executable')}, +\ 'command': function('ale_linters#v#v#GetCommand'), +\ 'output_stream': 'stderr', +\ 'callback': 'ale_linters#v#v#Handler', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/vala/vala_lint.vim b/sources_non_forked/ale/ale_linters/vala/vala_lint.vim new file mode 100644 index 00000000..7f8a566a --- /dev/null +++ b/sources_non_forked/ale/ale_linters/vala/vala_lint.vim @@ -0,0 +1,66 @@ +" Author: Atsuya Takagi +" Description: A linter for Vala using Vala-Lint. + +call ale#Set('vala_vala_lint_config_filename', 'vala-lint.conf') +call ale#Set('vala_vala_lint_executable', 'io.elementary.vala-lint') + +function! ale_linters#vala#vala_lint#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'vala_vala_lint_executable') +endfunction + +function! ale_linters#vala#vala_lint#GetCommand(buffer) abort + let l:command = ale_linters#vala#vala_lint#GetExecutable(a:buffer) + + let l:config_filename = ale#Var(a:buffer, 'vala_vala_lint_config_filename') + let l:config_path = ale#path#FindNearestFile(a:buffer, l:config_filename) + + if !empty(l:config_path) + let l:command .= ' -c ' . l:config_path + endif + + return l:command . ' %s' +endfunction + +function! ale_linters#vala#vala_lint#Handle(buffer, lines) abort + let l:pattern = '^\s*\(\d\+\)\.\(\d\+\)\s\+\(error\|warn\)\s\+\(.\+\)\s\([A-Za-z0-9_\-]\+\)' + let l:output = [] + + for l:line in a:lines + " remove color escape sequences since vala-lint doesn't support + " output without colors + let l:cleaned_line = substitute(l:line, '\e\[[0-9;]\+[mK]', '', 'g') + let l:match = matchlist(l:cleaned_line, l:pattern) + + if len(l:match) == 0 + continue + endif + + let l:refined_type = l:match[3] is# 'warn' ? 'W' : 'E' + let l:cleaned_text = substitute(l:match[4], '^\s*\(.\{-}\)\s*$', '\1', '') + + let l:lnum = l:match[1] + 0 + let l:column = l:match[2] + 0 + let l:type = l:refined_type + let l:text = l:cleaned_text + let l:code = l:match[5] + + call add(l:output, { + \ 'lnum': l:lnum, + \ 'col': l:column, + \ 'text': l:text, + \ 'type': l:type, + \ 'code': l:code, + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('vala', { +\ 'name': 'vala_lint', +\ 'output_stream': 'stdout', +\ 'executable': function('ale_linters#vala#vala_lint#GetExecutable'), +\ 'command': function('ale_linters#vala#vala_lint#GetCommand'), +\ 'callback': 'ale_linters#vala#vala_lint#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/verilog/hdl_checker.vim b/sources_non_forked/ale/ale_linters/verilog/hdl_checker.vim new file mode 100644 index 00000000..b05d8565 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/verilog/hdl_checker.vim @@ -0,0 +1,5 @@ +" Author: suoto +" Description: Adds support for HDL Code Checker, which wraps vcom/vlog, ghdl +" or xvhdl. More info on https://github.com/suoto/hdl_checker + +call ale#handlers#hdl_checker#DefineLinter('verilog') diff --git a/sources_non_forked/ale/ale_linters/verilog/verilator.vim b/sources_non_forked/ale/ale_linters/verilog/verilator.vim index 64bb6e41..006e310d 100644 --- a/sources_non_forked/ale/ale_linters/verilog/verilator.vim +++ b/sources_non_forked/ale/ale_linters/verilog/verilator.vim @@ -7,16 +7,11 @@ if !exists('g:ale_verilog_verilator_options') endif function! ale_linters#verilog#verilator#GetCommand(buffer) abort - let l:filename = ale#util#Tempname() . '_verilator_linted.v' - - " Create a special filename, so we can detect it in the handler. - call ale#command#ManageFile(a:buffer, l:filename) - let l:lines = getbufline(a:buffer, 1, '$') - call ale#util#Writefile(a:buffer, l:lines, l:filename) - + " the path to the current file is systematically added to the search path return 'verilator --lint-only -Wall -Wno-DECLFILENAME ' + \ . '-I%s:h ' \ . ale#Var(a:buffer, 'verilog_verilator_options') .' ' - \ . ale#Escape(l:filename) + \ . '%t' endfunction function! ale_linters#verilog#verilator#Handle(buffer, lines) abort @@ -28,22 +23,28 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines) abort " %Warning-UNDRIVEN: test.v:3: Signal is not driven: clk " %Warning-UNUSED: test.v:4: Signal is not used: dout " %Warning-BLKSEQ: test.v:10: Blocking assignments (=) in sequential (flop or latch) block; suggest delayed assignments (<=). - let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\): \(.\+\)$' + " Since version 4.032 (04/2020) verilator linter messages also contain the column number, + " and look like: + " %Error: /tmp/test.sv:3:1: syntax error, unexpected endmodule, expecting ';' + " + " to stay compatible with old versions of the tool, the column number is + " optional in the researched pattern + let l:pattern = '^%\(Warning\|Error\)[^:]*:\s*\([^:]\+\):\(\d\+\):\(\d\+\)\?:\? \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) - let l:line = l:match[3] + 0 - let l:type = l:match[1] is# 'Error' ? 'E' : 'W' - let l:text = l:match[4] - let l:file = l:match[2] + let l:item = { + \ 'lnum': str2nr(l:match[3]), + \ 'text': l:match[5], + \ 'type': l:match[1] is# 'Error' ? 'E' : 'W', + \ 'filename': l:match[2], + \} - if l:file =~# '_verilator_linted.v' - call add(l:output, { - \ 'lnum': l:line, - \ 'text': l:text, - \ 'type': l:type, - \}) + if !empty(l:match[4]) + let l:item.col = str2nr(l:match[4]) endif + + call add(l:output, l:item) endfor return l:output diff --git a/sources_non_forked/ale/ale_linters/verilog/vlog.vim b/sources_non_forked/ale/ale_linters/verilog/vlog.vim index 37d21c4c..45e1977c 100644 --- a/sources_non_forked/ale/ale_linters/verilog/vlog.vim +++ b/sources_non_forked/ale/ale_linters/verilog/vlog.vim @@ -13,14 +13,30 @@ function! ale_linters#verilog#vlog#Handle(buffer, lines) abort "Matches patterns like the following: "** Warning: add.v(7): (vlog-2623) Undefined variable: C. "** Error: file.v(1): (vlog-13294) Identifier must be declared with a port mode: C. - let l:pattern = '^**\s\(\w*\):[a-zA-Z0-9\-\.\_\/ ]\+(\(\d\+\)):\s\+\(.*\)' + let l:pattern = '^**\s\(\w*\): \([a-zA-Z0-9\-\.\_\/ ]\+\)(\(\d\+\)):\s\+\(.*\)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { - \ 'lnum': l:match[2] + 0, + \ 'lnum': l:match[3] + 0, \ 'type': l:match[1] is? 'Error' ? 'E' : 'W', - \ 'text': l:match[3], + \ 'text': l:match[4], + \ 'filename': l:match[2], + \}) + endfor + + "Matches patterns like the following: + "** Warning: (vlog-2623) add.v(7): Undefined variable: C. + "** Error: (vlog-13294) file.v(1): Identifier must be declared with a port mode: C. + " let l:pattern = '^**\s\(\w*\):[a-zA-Z0-9\-\.\_\/ ]\+(\(\d\+\)):\s\+\(.*\)' + let l:pattern = '^**\s\(\w*\):\s\([^)]*)\) \([a-zA-Z0-9\-\.\_\/ ]\+\)(\(\d\+\)):\s\+\(.*\)' + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[4] + 0, + \ 'type': l:match[1] is? 'Error' ? 'E' : 'W', + \ 'text': l:match[2] . ' ' . l:match[5], + \ 'filename': l:match[3], \}) endfor diff --git a/sources_non_forked/ale/ale_linters/verilog/yosys.vim b/sources_non_forked/ale/ale_linters/verilog/yosys.vim new file mode 100644 index 00000000..29657755 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/verilog/yosys.vim @@ -0,0 +1,42 @@ +" Author: Nathan Sharp +" Description: Yosys for Verilog files + +call ale#Set('verilog_yosys_executable', 'yosys') +call ale#Set('verilog_yosys_options', '-Q -T -p ''read_verilog %s''') + +function! ale_linters#verilog#yosys#GetCommand(buffer) abort + return '%e ' . ale#Var(a:buffer, 'verilog_yosys_options') . ' 2>&1' +endfunction + +function! ale_linters#verilog#yosys#Handle(buffer, lines) abort + let l:output = [] + let l:path = fnamemodify(bufname(a:buffer), ':p') + + for l:match in ale#util#GetMatches(a:lines, '^\([^:]\+\):\(\d\+\): \(WARNING\|ERROR\): \(.\+\)$') + call add(l:output, { + \ 'lnum': str2nr(l:match[2]), + \ 'text': l:match[4], + \ 'type': l:match[3][0], + \ 'filename': l:match[1], + \}) + endfor + + for l:match in ale#util#GetMatches(a:lines, '^\(Warning\|ERROR\): \(.\+\)$') + call add(l:output, { + \ 'lnum': 1, + \ 'text': l:match[2], + \ 'type': l:match[1][0], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('verilog', { +\ 'name': 'yosys', +\ 'output_stream': 'stdout', +\ 'executable': {b -> ale#Var(b, 'verilog_yosys_executable')}, +\ 'command': function('ale_linters#verilog#yosys#GetCommand'), +\ 'callback': 'ale_linters#verilog#yosys#Handle', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/vhdl/hdl_checker.vim b/sources_non_forked/ale/ale_linters/vhdl/hdl_checker.vim new file mode 100644 index 00000000..c9d306b3 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/vhdl/hdl_checker.vim @@ -0,0 +1,5 @@ +" Author: suoto +" Description: Adds support for HDL Code Checker, which wraps vcom/vlog, ghdl +" or xvhdl. More info on https://github.com/suoto/hdl_checker + +call ale#handlers#hdl_checker#DefineLinter('vhdl') diff --git a/sources_non_forked/ale/ale_linters/vim/ale_custom_linting_rules.vim b/sources_non_forked/ale/ale_linters/vim/ale_custom_linting_rules.vim index 822eb30a..5ca2f149 100644 --- a/sources_non_forked/ale/ale_linters/vim/ale_custom_linting_rules.vim +++ b/sources_non_forked/ale/ale_linters/vim/ale_custom_linting_rules.vim @@ -22,16 +22,20 @@ function! s:GetALEProjectDir(buffer) abort return ale#path#Dirname(ale#path#Dirname(ale#path#Dirname(l:executable))) endfunction -function! ale_linters#vim#ale_custom_linting_rules#GetCommand(buffer) abort - let l:dir = s:GetALEProjectDir(a:buffer) +function! ale_linters#vim#ale_custom_linting_rules#GetCwd(buffer) abort + let l:executable = ale_linters#vim#ale_custom_linting_rules#GetExecutable(a:buffer) + return ale#path#Dirname(ale#path#Dirname(ale#path#Dirname(l:executable))) +endfunction + +function! ale_linters#vim#ale_custom_linting_rules#GetCommand(buffer) abort let l:temp_dir = ale#command#CreateDirectory(a:buffer) let l:temp_file = l:temp_dir . '/example.vim' let l:lines = getbufline(a:buffer, 1, '$') call ale#util#Writefile(a:buffer, l:lines, l:temp_file) - return ale#path#CdString(l:dir) . '%e ' . ale#Escape(l:temp_dir) + return '%e ' . ale#Escape(l:temp_dir) endfunction function! ale_linters#vim#ale_custom_linting_rules#Handle(buffer, lines) abort @@ -59,6 +63,7 @@ endfunction call ale#linter#Define('vim', { \ 'name': 'ale_custom_linting_rules', \ 'executable': function('ale_linters#vim#ale_custom_linting_rules#GetExecutable'), +\ 'cwd': function('ale_linters#vim#ale_custom_linting_rules#GetCwd'), \ 'command': function('ale_linters#vim#ale_custom_linting_rules#GetCommand'), \ 'callback': 'ale_linters#vim#ale_custom_linting_rules#Handle', \ 'read_buffer': 0, diff --git a/sources_non_forked/ale/ale_linters/vim/vimls.vim b/sources_non_forked/ale/ale_linters/vim/vimls.vim new file mode 100644 index 00000000..7003eb04 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/vim/vimls.vim @@ -0,0 +1,61 @@ +" Author: Jeffrey Lau - https://github.com/zoonfafer +" Description: Vim Language Server integration for ALE + +call ale#Set('vim_vimls_executable', 'vim-language-server') +call ale#Set('vim_vimls_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('vim_vimls_config', {}) + +function! ale_linters#vim#vimls#GetProjectRoot(buffer) abort + let l:trigger_file_candidates = [ + \ '.vimrc', + \ 'init.vim', + \] + + for l:candidate in l:trigger_file_candidates + let l:trigger_file = fnamemodify(bufname(a:buffer), ':t') + + if l:trigger_file is# l:candidate + return fnamemodify( + \ bufname(a:buffer), + \ ':h', + \) + endif + endfor + + let l:trigger_dir_candidates = [ + \ 'autoload', + \ 'plugin', + \ '.git', + \] + + let l:path_upwards = ale#path#Upwards(fnamemodify(bufname(a:buffer), ':p:h')) + + for l:path in l:path_upwards + for l:candidate in l:trigger_dir_candidates + let l:trigger_dir = ale#path#Simplify( + \ l:path . '/' . l:candidate, + \) + + if isdirectory(l:trigger_dir) + return fnamemodify( + \ l:trigger_dir, + \ ':p:h:h', + \) + endif + endfor + endfor + + return '' +endfunction + +call ale#linter#Define('vim', { +\ 'name': 'vimls', +\ 'lsp': 'stdio', +\ 'lsp_config': {b -> ale#Var(b, 'vim_vimls_config')}, +\ 'executable': {b -> ale#path#FindExecutable(b, 'vim_vimls', [ +\ 'node_modules/.bin/vim-language-server', +\ ])}, +\ 'command': '%e --stdio', +\ 'language': 'vim', +\ 'project_root': function('ale_linters#vim#vimls#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/ale_linters/vim/vint.vim b/sources_non_forked/ale/ale_linters/vim/vint.vim index 3808c47e..f7054ffb 100644 --- a/sources_non_forked/ale/ale_linters/vim/vint.vim +++ b/sources_non_forked/ale/ale_linters/vim/vint.vim @@ -5,36 +5,25 @@ call ale#Set('vim_vint_show_style_issues', 1) call ale#Set('vim_vint_executable', 'vint') let s:enable_neovim = has('nvim') ? ' --enable-neovim' : '' -let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"' +let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {policy_name} - {description} (see {reference})"' -function! ale_linters#vim#vint#GetExecutable(buffer) abort - return ale#Var(a:buffer, 'vim_vint_executable') -endfunction - -function! ale_linters#vim#vint#VersionCommand(buffer) abort - let l:executable = ale_linters#vim#vint#GetExecutable(a:buffer) - - " Check the Vint version if we haven't checked it already. - return !ale#semver#HasVersion(l:executable) - \ ? ale#Escape(l:executable) . ' --version' - \ : '' -endfunction - -function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort - let l:executable = ale_linters#vim#vint#GetExecutable(a:buffer) - let l:version = ale#semver#GetVersion(l:executable, a:version_output) - - let l:can_use_no_color_flag = empty(l:version) - \ || ale#semver#GTE(l:version, [0, 3, 7]) +function! ale_linters#vim#vint#GetCommand(buffer, version) abort + let l:can_use_no_color_flag = empty(a:version) + \ || ale#semver#GTE(a:version, [0, 3, 7]) let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w' - return ale#Escape(l:executable) + " Use the --stdin-display-name argument if supported, temp file otherwise. + let l:stdin_or_temp = ale#semver#GTE(a:version, [0, 4, 0]) + \ ? ' --stdin-display-name %s -' + \ : ' %t' + + return '%e' \ . ' ' . l:warning_flag \ . (l:can_use_no_color_flag ? ' --no-color' : '') \ . s:enable_neovim \ . ' ' . s:format - \ . ' %t' + \ . l:stdin_or_temp endfunction let s:word_regex_list = [ @@ -65,10 +54,12 @@ endfunction call ale#linter#Define('vim', { \ 'name': 'vint', -\ 'executable': function('ale_linters#vim#vint#GetExecutable'), -\ 'command_chain': [ -\ {'callback': 'ale_linters#vim#vint#VersionCommand', 'output_stream': 'stderr'}, -\ {'callback': 'ale_linters#vim#vint#GetCommand', 'output_stream': 'stdout'}, -\ ], +\ 'executable': {buffer -> ale#Var(buffer, 'vim_vint_executable')}, +\ 'command': {buffer -> ale#semver#RunWithVersionCheck( +\ buffer, +\ ale#Var(buffer, 'vim_vint_executable'), +\ '%e --version', +\ function('ale_linters#vim#vint#GetCommand'), +\ )}, \ 'callback': 'ale_linters#vim#vint#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/vue/vls.vim b/sources_non_forked/ale/ale_linters/vue/vls.vim index ac451f3c..4bd75286 100644 --- a/sources_non_forked/ale/ale_linters/vue/vls.vim +++ b/sources_non_forked/ale/ale_linters/vue/vls.vim @@ -13,7 +13,7 @@ endfunction call ale#linter#Define('vue', { \ 'name': 'vls', \ 'lsp': 'stdio', -\ 'executable': {b -> ale#node#FindExecutable(b, 'vue_vls', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'vue_vls', [ \ 'node_modules/.bin/vls', \ ])}, \ 'command': '%e --stdio', diff --git a/sources_non_forked/ale/ale_linters/yaml/circleci.vim b/sources_non_forked/ale/ale_linters/yaml/circleci.vim new file mode 100644 index 00000000..20835454 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/yaml/circleci.vim @@ -0,0 +1,35 @@ +function! ale_linters#yaml#circleci#Handle(buffer, lines) abort + let l:match_index = -1 + let l:output = [] + + for l:index in range(len(a:lines)) + let l:line = a:lines[l:index] + + if l:line =~? 'Error: ERROR IN CONFIG FILE:' + let l:match_index = l:index + 1 + break + endif + endfor + + if l:match_index > 0 + return [{ + \ 'type': 'E', + \ 'lnum': 1, + \ 'text': a:lines[l:match_index], + \ 'detail': join(a:lines[l:match_index :], "\n"), + \}] + endif + + return [] +endfunction + +" The circleci validate requires network requests, so we'll only run it when +" files are saved to prevent the server from being hammered. +call ale#linter#Define('yaml', { +\ 'name': 'circleci', +\ 'executable': {b -> expand('#' . b . ':p') =~? '\.circleci' ? 'circleci' : ''}, +\ 'command': 'circleci --skip-update-check config validate - < %s', +\ 'callback': 'ale_linters#yaml#circleci#Handle', +\ 'output_stream': 'stderr', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/yaml/spectral.vim b/sources_non_forked/ale/ale_linters/yaml/spectral.vim new file mode 100644 index 00000000..13654f06 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/yaml/spectral.vim @@ -0,0 +1,14 @@ +" Author: t2h5 +" Description: Integration of Stoplight Spectral CLI with ALE. + +call ale#Set('yaml_spectral_executable', 'spectral') +call ale#Set('yaml_spectral_use_global', get(g:, 'ale_use_global_executables', 0)) + +call ale#linter#Define('yaml', { +\ 'name': 'spectral', +\ 'executable': {b -> ale#path#FindExecutable(b, 'yaml_spectral', [ +\ 'node_modules/.bin/spectral', +\ ])}, +\ 'command': '%e lint --ignore-unknown-format -q -f text %t', +\ 'callback': 'ale#handlers#spectral#HandleSpectralOutput' +\}) diff --git a/sources_non_forked/ale/ale_linters/yaml/swaglint.vim b/sources_non_forked/ale/ale_linters/yaml/swaglint.vim index 1f140e37..7fc2b430 100644 --- a/sources_non_forked/ale/ale_linters/yaml/swaglint.vim +++ b/sources_non_forked/ale/ale_linters/yaml/swaglint.vim @@ -32,7 +32,7 @@ endfunction call ale#linter#Define('yaml', { \ 'name': 'swaglint', -\ 'executable': {b -> ale#node#FindExecutable(b, 'yaml_swaglint', [ +\ 'executable': {b -> ale#path#FindExecutable(b, 'yaml_swaglint', [ \ 'node_modules/.bin/swaglint', \ ])}, \ 'command': '%e -r compact --stdin', diff --git a/sources_non_forked/ale/ale_linters/yaml/yamllint.vim b/sources_non_forked/ale/ale_linters/yaml/yamllint.vim index bedb7bf1..39011df1 100644 --- a/sources_non_forked/ale/ale_linters/yaml/yamllint.vim +++ b/sources_non_forked/ale/ale_linters/yaml/yamllint.vim @@ -3,48 +3,9 @@ call ale#Set('yaml_yamllint_executable', 'yamllint') call ale#Set('yaml_yamllint_options', '') -function! ale_linters#yaml#yamllint#GetCommand(buffer) abort - return '%e' . ale#Pad(ale#Var(a:buffer, 'yaml_yamllint_options')) - \ . ' -f parsable %t' -endfunction - -function! ale_linters#yaml#yamllint#Handle(buffer, lines) abort - " Matches patterns line the following: - " something.yaml:1:1: [warning] missing document start "---" (document-start) - " something.yml:2:1: [error] syntax error: expected the node content, but found '' - let l:pattern = '\v^.*:(\d+):(\d+): \[(error|warning)\] (.+)$' - let l:output = [] - - for l:match in ale#util#GetMatches(a:lines, l:pattern) - let l:item = { - \ 'lnum': l:match[1] + 0, - \ 'col': l:match[2] + 0, - \ 'text': l:match[4], - \ 'type': l:match[3] is# 'error' ? 'E' : 'W', - \} - - let l:code_match = matchlist(l:item.text, '\v^(.+) \(([^)]+)\)$') - - if !empty(l:code_match) - if l:code_match[2] is# 'trailing-spaces' - \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') - " Skip warnings for trailing whitespace if the option is off. - continue - endif - - let l:item.text = l:code_match[1] - let l:item.code = l:code_match[2] - endif - - call add(l:output, l:item) - endfor - - return l:output -endfunction - call ale#linter#Define('yaml', { \ 'name': 'yamllint', \ 'executable': {b -> ale#Var(b, 'yaml_yamllint_executable')}, -\ 'command': function('ale_linters#yaml#yamllint#GetCommand'), -\ 'callback': 'ale_linters#yaml#yamllint#Handle', +\ 'command': function('ale#handlers#yamllint#GetCommand'), +\ 'callback': 'ale#handlers#yamllint#Handle', \}) diff --git a/sources_non_forked/ale/ale_linters/zeek/zeek.vim b/sources_non_forked/ale/ale_linters/zeek/zeek.vim new file mode 100644 index 00000000..e976d75c --- /dev/null +++ b/sources_non_forked/ale/ale_linters/zeek/zeek.vim @@ -0,0 +1,22 @@ +" Author: Benjamin Bannier +" Description: Support for checking Zeek files. +" +call ale#Set('zeek_zeek_executable', 'zeek') + +function! ale_linters#zeek#zeek#HandleErrors(buffer, lines) abort + let l:pattern = 'error in \v.*, line (\d+): (.*)$' + + return map(ale#util#GetMatches(a:lines, l:pattern), "{ + \ 'lnum': str2nr(v:val[1]), + \ 'text': v:val[2], + \}") +endfunction + +call ale#linter#Define('zeek', { +\ 'name': 'zeek', +\ 'executable': {b -> ale#Var(b, 'zeek_zeek_executable')}, +\ 'output_stream': 'stderr', +\ 'command': {-> '%e --parse-only %s'}, +\ 'callback': 'ale_linters#zeek#zeek#HandleErrors', +\ 'lint_file': 1, +\}) diff --git a/sources_non_forked/ale/ale_linters/zig/zls.vim b/sources_non_forked/ale/ale_linters/zig/zls.vim new file mode 100644 index 00000000..1390f6b1 --- /dev/null +++ b/sources_non_forked/ale/ale_linters/zig/zls.vim @@ -0,0 +1,20 @@ +" Author: CherryMan +" Description: A language server for Zig + +call ale#Set('zig_zls_executable', 'zls') +call ale#Set('zig_zls_config', {}) + +function! ale_linters#zig#zls#GetProjectRoot(buffer) abort + let l:build_rs = ale#path#FindNearestFile(a:buffer, 'build.zig') + + return !empty(l:build_rs) ? fnamemodify(l:build_rs, ':h') : '' +endfunction + +call ale#linter#Define('zig', { +\ 'name': 'zls', +\ 'lsp': 'stdio', +\ 'lsp_config': {b -> ale#Var(b, 'zig_zls_config')}, +\ 'executable': {b -> ale#Var(b, 'zig_zls_executable')}, +\ 'command': '%e', +\ 'project_root': function('ale_linters#zig#zls#GetProjectRoot'), +\}) diff --git a/sources_non_forked/ale/autoload/ale.vim b/sources_non_forked/ale/autoload/ale.vim index 5aa5fbfc..97483b45 100644 --- a/sources_non_forked/ale/autoload/ale.vim +++ b/sources_non_forked/ale/autoload/ale.vim @@ -5,9 +5,17 @@ " Strings used for severity in the echoed message let g:ale_echo_msg_error_str = get(g:, 'ale_echo_msg_error_str', 'Error') let g:ale_echo_msg_info_str = get(g:, 'ale_echo_msg_info_str', 'Info') +let g:ale_echo_msg_log_str = get(g:, 'ale_echo_msg_log_str', 'Log') let g:ale_echo_msg_warning_str = get(g:, 'ale_echo_msg_warning_str', 'Warning') " Ignoring linters, for disabling some, or ignoring LSP diagnostics. let g:ale_linters_ignore = get(g:, 'ale_linters_ignore', {}) +let g:ale_disable_lsp = get(g:, 'ale_disable_lsp', 0) + +" LSP window/showMessage format +let g:ale_lsp_show_message_format = get(g:, 'ale_lsp_show_message_format', '%severity%:%linter%: %s') +" Valid values mimic LSP definitions (error, warning and information; log is +" never shown) +let g:ale_lsp_show_message_severity = get(g:, 'ale_lsp_show_message_severity', 'error') let s:lint_timer = -1 let s:getcmdwintype_exists = exists('*getcmdwintype') @@ -42,6 +50,11 @@ function! ale#ShouldDoNothing(buffer) abort return 1 endif + " Do nothing for diff buffers. + if getbufvar(a:buffer, '&diff') + return 1 + endif + " Do nothing for blacklisted files. if index(get(g:, 'ale_filetype_blacklist', []), l:filetype) >= 0 return 1 @@ -87,12 +100,7 @@ function! s:Lint(buffer, should_lint_file, timer_id) abort " Use the filetype from the buffer let l:filetype = getbufvar(a:buffer, '&filetype') let l:linters = ale#linter#Get(l:filetype) - - " Apply ignore lists for linters only if needed. - let l:ignore_config = ale#Var(a:buffer, 'linters_ignore') - let l:linters = !empty(l:ignore_config) - \ ? ale#engine#ignore#Exclude(l:filetype, l:linters, l:ignore_config) - \ : l:linters + let l:linters = ale#linter#RemoveIgnored(a:buffer, l:filetype, l:linters) " Tell other sources that they can start checking the buffer now. let g:ale_want_results_buffer = a:buffer @@ -149,12 +157,19 @@ function! ale#Queue(delay, ...) abort endif endfunction -let g:ale_has_override = get(g:, 'ale_has_override', {}) +let s:current_ale_version = [3, 1, 0] -" Call has(), but check a global Dictionary so we can force flags on or off -" for testing purposes. +" A function used to check for ALE features in files outside of the project. function! ale#Has(feature) abort - return get(g:ale_has_override, a:feature, has(a:feature)) + let l:match = matchlist(a:feature, '\c\v^ale-(\d+)\.(\d+)(\.(\d+))?$') + + if !empty(l:match) + let l:version = [l:match[1] + 0, l:match[2] + 0, l:match[4] + 0] + + return ale#semver#GTE(s:current_ale_version, l:version) + endif + + return 0 endfunction " Given a buffer number and a variable name, look for that variable in the @@ -237,11 +252,33 @@ function! ale#GetLocItemMessage(item, format_string) abort " Replace special markers with certain information. " \=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%linter%', '\=l:linter_name', 'g') - let l:msg = substitute(l:msg, '\v\%([^\%]*)code([^\%]*)\%', l:code_repl, 'g') " Replace %s with the text. let l:msg = substitute(l:msg, '\V%s', '\=a:item.text', 'g') + " Windows may insert carriage return line endings (^M), strip these characters. + let l:msg = substitute(l:msg, '\r', '', 'g') return l:msg endfunction + +" Given a buffer and a linter or fixer name, return an Array of two-item +" Arrays describing how to map filenames to and from the local to foreign file +" systems. +function! ale#GetFilenameMappings(buffer, name) abort + let l:linter_mappings = ale#Var(a:buffer, 'filename_mappings') + + if type(l:linter_mappings) is v:t_list + return l:linter_mappings + endif + + let l:name = a:name + + if !has_key(l:linter_mappings, l:name) + " Use * as a default setting for all tools. + let l:name = '*' + endif + + return get(l:linter_mappings, l:name, []) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/ant.vim b/sources_non_forked/ale/autoload/ale/ant.vim new file mode 100644 index 00000000..b6d4217f --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/ant.vim @@ -0,0 +1,45 @@ +" Author: Andrew Lee . +" Inspired by ale/gradle.vim by Michael Pardo +" Description: Functions for working with Ant projects. + +" Given a buffer number, find an Ant project root +function! ale#ant#FindProjectRoot(buffer) abort + let l:build_xml_path = ale#path#FindNearestFile(a:buffer, 'build.xml') + + if !empty(l:build_xml_path) + return fnamemodify(l:build_xml_path, ':h') + endif + + return '' +endfunction + +" Given a buffer number, find the path to the `ant` executable. Returns an empty +" string if cannot find the executable. +function! ale#ant#FindExecutable(buffer) abort + if executable('ant') + return 'ant' + endif + + return '' +endfunction + +" Given a buffer number, get a working directory and command to print the +" classpath of the root project. +" +" Returns an empty string for the command if Ant is not detected. +function! ale#ant#BuildClasspathCommand(buffer) abort + let l:executable = ale#ant#FindExecutable(a:buffer) + + if !empty(l:executable) + let l:project_root = ale#ant#FindProjectRoot(a:buffer) + + if !empty(l:project_root) + return [ + \ l:project_root, + \ ale#Escape(l:executable) .' classpath -S -q' + \] + endif + endif + + return ['', ''] +endfunction diff --git a/sources_non_forked/ale/autoload/ale/assert.vim b/sources_non_forked/ale/autoload/ale/assert.vim index 6c2586a6..141cd0f2 100644 --- a/sources_non_forked/ale/autoload/ale/assert.vim +++ b/sources_non_forked/ale/autoload/ale/assert.vim @@ -1,7 +1,7 @@ -let s:chain_results = [] +let s:command_output = [] -function! ale#assert#WithChainResults(...) abort - let s:chain_results = a:000 +function! ale#assert#GivenCommandOutput(...) abort + let s:command_output = a:000 endfunction function! s:GetLinter() abort @@ -19,6 +19,69 @@ function! s:GetLinter() abort return l:filetype_linters[0] endfunction +function! s:FormatExe(command, executable) abort + return substitute(a:command, '%e', '\=ale#Escape(a:executable)', 'g') +endfunction + +function! s:ProcessDeferredCommands(initial_result) abort + let l:result = a:initial_result + let l:command_index = 0 + let l:command = [] + + while ale#command#IsDeferred(l:result) + call add(l:command, s:FormatExe(l:result.command, l:result.executable)) + + if get(g:, 'ale_run_synchronously_emulate_commands') + " Don't run commands, but simulate the results. + let l:Callback = g:ale_run_synchronously_callbacks[0] + let l:output = get(s:command_output, l:command_index, []) + call l:Callback(0, l:output) + unlet g:ale_run_synchronously_callbacks + + let l:command_index += 1 + else + " Run the commands in the shell, synchronously. + call ale#test#FlushJobs() + endif + + let l:result = l:result.value + endwhile + + call add(l:command, l:result) + + return l:command +endfunction + +function! s:ProcessDeferredCwds(initial_command, initial_cwd) abort + let l:result = a:initial_command + let l:last_cwd = v:null + let l:command_index = 0 + let l:cwd_list = [] + + while ale#command#IsDeferred(l:result) + call add(l:cwd_list, l:result.cwd) + + if get(g:, 'ale_run_synchronously_emulate_commands') + " Don't run commands, but simulate the results. + let l:Callback = g:ale_run_synchronously_callbacks[0] + let l:output = get(s:command_output, l:command_index, []) + call l:Callback(0, l:output) + unlet g:ale_run_synchronously_callbacks + + let l:command_index += 1 + else + " Run the commands in the shell, synchronously. + call ale#test#FlushJobs() + endif + + let l:result = l:result.value + endwhile + + call add(l:cwd_list, a:initial_cwd is v:null ? l:last_cwd : a:initial_cwd) + + return l:cwd_list +endfunction + " Load the currently loaded linter for a test case, and check that the command " matches the given string. function! ale#assert#Linter(expected_executable, expected_command) abort @@ -31,47 +94,20 @@ function! ale#assert#Linter(expected_executable, expected_command) abort let l:executable = l:executable.value endwhile - if has_key(l:linter, 'command_chain') - let l:callbacks = map(copy(l:linter.command_chain), 'v:val.callback') + let l:command = s:ProcessDeferredCommands( + \ ale#linter#GetCommand(l:buffer, l:linter), + \) - " If the expected command is a string, just check the last one. - if type(a:expected_command) is v:t_string - if len(l:callbacks) is 1 - let l:command = call(l:callbacks[0], [l:buffer]) - else - let l:input = get(s:chain_results, len(l:callbacks) - 2, []) - let l:command = call(l:callbacks[-1], [l:buffer, l:input]) - endif - else - let l:command = [] - let l:chain_index = 0 - - for l:Callback in l:callbacks - if l:chain_index is 0 - call add(l:command, call(l:Callback, [l:buffer])) - else - let l:input = get(s:chain_results, l:chain_index - 1, []) - call add(l:command, call(l:Callback, [l:buffer, l:input])) - endif - - let l:chain_index += 1 - endfor - endif - else - let l:command = ale#linter#GetCommand(l:buffer, l:linter) - - while ale#command#IsDeferred(l:command) - call ale#test#FlushJobs() - let l:command = l:command.value - endwhile + if type(a:expected_command) isnot v:t_list + let l:command = l:command[-1] endif if type(l:command) is v:t_string " Replace %e with the escaped executable, so tests keep passing after " linters are changed to use %e. - let l:command = substitute(l:command, '%e', '\=ale#Escape(l:executable)', 'g') + let l:command = s:FormatExe(l:command, l:executable) elseif type(l:command) is v:t_list - call map(l:command, 'substitute(v:val, ''%e'', ''\=ale#Escape(l:executable)'', ''g'')') + call map(l:command, 's:FormatExe(v:val, l:executable)') endif AssertEqual @@ -79,12 +115,75 @@ function! ale#assert#Linter(expected_executable, expected_command) abort \ [l:executable, l:command] endfunction +function! ale#assert#LinterCwd(expected_cwd) abort + let l:buffer = bufnr('') + let l:linter = s:GetLinter() + + let l:initial_cwd = ale#linter#GetCwd(l:buffer, l:linter) + call ale#command#SetCwd(l:buffer, l:initial_cwd) + + let l:cwd = s:ProcessDeferredCwds( + \ ale#linter#GetCommand(l:buffer, l:linter), + \ l:initial_cwd, + \) + + call ale#command#ResetCwd(l:buffer) + + if type(a:expected_cwd) isnot v:t_list + let l:cwd = l:cwd[-1] + endif + + AssertEqual a:expected_cwd, l:cwd +endfunction + +function! ale#assert#FixerCwd(expected_cwd) abort + let l:buffer = bufnr('') + let l:cwd = s:ProcessDeferredCwds(s:FixerFunction(l:buffer), v:null) + + if type(a:expected_cwd) isnot v:t_list + let l:cwd = l:cwd[-1] + endif + + AssertEqual a:expected_cwd, l:cwd +endfunction + +function! ale#assert#Fixer(expected_result) abort + let l:buffer = bufnr('') + let l:result = s:ProcessDeferredCommands(s:FixerFunction(l:buffer)) + + if type(a:expected_result) isnot v:t_list + let l:result = l:result[-1] + endif + + AssertEqual a:expected_result, l:result +endfunction + +function! ale#assert#FixerNotExecuted() abort + let l:buffer = bufnr('') + let l:result = s:ProcessDeferredCommands(s:FixerFunction(l:buffer))[-1] + + Assert empty(l:result), "The fixer will be executed when it shouldn't be" +endfunction + function! ale#assert#LinterNotExecuted() abort let l:buffer = bufnr('') let l:linter = s:GetLinter() let l:executable = ale#linter#GetExecutable(l:buffer, l:linter) + let l:executed = 1 - Assert empty(l:executable), "The linter will be executed when it shouldn't be" + if !empty(l:executable) + let l:command = ale#linter#GetCommand(l:buffer, l:linter) + + if type(l:command) is v:t_list + let l:command = l:command[-1] + endif + + let l:executed = !empty(l:command) + else + let l:executed = 0 + endif + + Assert !l:executed, "The linter will be executed when it shouldn't be" endfunction function! ale#assert#LSPOptions(expected_options) abort @@ -106,7 +205,7 @@ endfunction function! ale#assert#LSPLanguage(expected_language) abort let l:buffer = bufnr('') let l:linter = s:GetLinter() - let l:language = ale#util#GetFunction(l:linter.language_callback)(l:buffer) + let l:language = ale#linter#GetLanguage(l:buffer, l:linter) AssertEqual a:expected_language, l:language endfunction @@ -128,7 +227,8 @@ function! ale#assert#LSPAddress(expected_address) abort endfunction function! ale#assert#SetUpLinterTestCommands() abort - command! -nargs=+ WithChainResults :call ale#assert#WithChainResults() + command! -nargs=+ GivenCommandOutput :call ale#assert#GivenCommandOutput() + command! -nargs=+ AssertLinterCwd :call ale#assert#LinterCwd() command! -nargs=+ AssertLinter :call ale#assert#Linter() command! -nargs=0 AssertLinterNotExecuted :call ale#assert#LinterNotExecuted() command! -nargs=+ AssertLSPOptions :call ale#assert#LSPOptions() @@ -138,6 +238,37 @@ function! ale#assert#SetUpLinterTestCommands() abort command! -nargs=+ AssertLSPAddress :call ale#assert#LSPAddress() endfunction +function! ale#assert#SetUpFixerTestCommands() abort + command! -nargs=+ GivenCommandOutput :call ale#assert#GivenCommandOutput() + command! -nargs=+ AssertFixerCwd :call ale#assert#FixerCwd() + command! -nargs=+ AssertFixer :call ale#assert#Fixer() + command! -nargs=0 AssertFixerNotExecuted :call ale#assert#FixerNotExecuted() +endfunction + +function! ale#assert#ResetVariables(filetype, name, ...) abort + " If the suffix of the option names format is different, an additional + " argument can be used for that instead. + if a:0 > 1 + throw 'Too many arguments' + endif + + let l:option_suffix = get(a:000, 0, a:name) + let l:prefix = 'ale_' . a:filetype . '_' + \ . substitute(l:option_suffix, '-', '_', 'g') + let l:filter_expr = 'v:val[: len(l:prefix) - 1] is# l:prefix' + + " Save and clear linter variables. + " We'll load the runtime file to reset them to defaults. + for l:key in filter(keys(g:), l:filter_expr) + execute 'Save g:' . l:key + unlet g:[l:key] + endfor + + for l:key in filter(keys(b:), l:filter_expr) + unlet b:[l:key] + endfor +endfunction + " A dummy function for making sure this module is loaded. function! ale#assert#SetUpLinterTest(filetype, name) abort " Set up a marker so ALE doesn't create real random temporary filenames. @@ -147,46 +278,44 @@ function! ale#assert#SetUpLinterTest(filetype, name) abort call ale#linter#Reset() call ale#linter#PreventLoading(a:filetype) - let l:prefix = 'ale_' . a:filetype . '_' . a:name - let b:filter_expr = 'v:val[: len(l:prefix) - 1] is# l:prefix' + Save g:ale_root + let g:ale_root = {} - Save g:ale_lsp_root - let g:ale_lsp_root = {} + Save b:ale_root + unlet! b:ale_root - Save b:ale_lsp_root - unlet! b:ale_lsp_root + call ale#assert#ResetVariables(a:filetype, a:name) Save g:ale_c_build_dir unlet! g:ale_c_build_dir - - " Save and clear linter variables. - " We'll load the runtime file to reset them to defaults. - for l:key in filter(keys(g:), b:filter_expr) - execute 'Save g:' . l:key - unlet g:[l:key] - endfor - unlet! b:ale_c_build_dir - for l:key in filter(keys(b:), b:filter_expr) - unlet b:[l:key] - endfor - execute 'runtime ale_linters/' . a:filetype . '/' . a:name . '.vim' if !exists('g:dir') - call ale#test#SetDirectory('/testplugin/test/command_callback') + call ale#test#SetDirectory('/testplugin/test/linter') endif call ale#assert#SetUpLinterTestCommands() + + let g:ale_run_synchronously = 1 + let g:ale_run_synchronously_emulate_commands = 1 endfunction function! ale#assert#TearDownLinterTest() abort unlet! g:ale_create_dummy_temporary_file - let s:chain_results = [] + unlet! g:ale_run_synchronously + unlet! g:ale_run_synchronously_callbacks + unlet! g:ale_run_synchronously_emulate_commands + unlet! g:ale_run_synchronously_command_results + let s:command_output = [] - if exists(':WithChainResults') - delcommand WithChainResults + if exists(':GivenCommandOutput') + delcommand GivenCommandOutput + endif + + if exists(':AssertLinterCwd') + delcommand AssertLinterCwd endif if exists(':AssertLinter') @@ -229,3 +358,67 @@ function! ale#assert#TearDownLinterTest() abort call ale#semver#ResetVersionCache() endif endfunction + +function! ale#assert#SetUpFixerTest(filetype, name, ...) abort + " If the suffix of the option names format is different, an additional + " argument can be used for that instead. + if a:0 > 1 + throw 'Too many arguments' + endif + + " Set up a marker so ALE doesn't create real random temporary filenames. + let g:ale_create_dummy_temporary_file = 1 + + let l:function_name = ale#fix#registry#GetFunc(a:name) + let s:FixerFunction = function(l:function_name) + + let l:option_suffix = get(a:000, 0, a:name) + call ale#assert#ResetVariables(a:filetype, a:name, l:option_suffix) + + execute 'runtime autoload/ale/fixers/' . substitute(a:name, '-', '_', 'g') . '.vim' + + if !exists('g:dir') + call ale#test#SetDirectory('/testplugin/test/fixers') + endif + + call ale#assert#SetUpFixerTestCommands() + + let g:ale_run_synchronously = 1 + let g:ale_run_synchronously_emulate_commands = 1 +endfunction + +function! ale#assert#TearDownFixerTest() abort + unlet! g:ale_create_dummy_temporary_file + unlet! g:ale_run_synchronously + unlet! g:ale_run_synchronously_callbacks + unlet! g:ale_run_synchronously_emulate_commands + unlet! g:ale_run_synchronously_command_results + let s:command_output = [] + unlet! s:FixerFunction + + if exists('g:dir') + call ale#test#RestoreDirectory() + endif + + Restore + + if exists('*ale#semver#ResetVersionCache') + call ale#semver#ResetVersionCache() + endif + + if exists(':GivenCommandOutput') + delcommand GivenCommandOutput + endif + + if exists(':AssertFixerCwd') + delcommand AssertFixerCwd + endif + + if exists(':AssertFixer') + delcommand AssertFixer + endif + + if exists(':AssertFixerNotExecuted') + delcommand AssertFixerNotExecuted + endif +endfunction diff --git a/sources_non_forked/ale/autoload/ale/balloon.vim b/sources_non_forked/ale/autoload/ale/balloon.vim index 72f6b91c..8678376f 100644 --- a/sources_non_forked/ale/autoload/ale/balloon.vim +++ b/sources_non_forked/ale/autoload/ale/balloon.vim @@ -2,23 +2,39 @@ " Description: balloonexpr support for ALE. function! ale#balloon#MessageForPos(bufnr, lnum, col) abort + let l:set_balloons = ale#Var(a:bufnr, 'set_balloons') + let l:show_problems = 0 + let l:show_hover = 0 + + if l:set_balloons is 1 + let l:show_problems = 1 + let l:show_hover = 1 + elseif l:set_balloons is# 'hover' + let l:show_hover = 1 + endif + " Don't show balloons if they are disabled, or linting is disabled. - if !ale#Var(a:bufnr, 'set_balloons') + if !(l:show_problems || l:show_hover) \|| !g:ale_enabled \|| !getbufvar(a:bufnr, 'ale_enabled', 1) return '' endif - let l:loclist = get(g:ale_buffer_info, a:bufnr, {'loclist': []}).loclist - let l:index = ale#util#BinarySearch(l:loclist, a:bufnr, a:lnum, a:col) + if l:show_problems + let l:loclist = get(g:ale_buffer_info, a:bufnr, {'loclist': []}).loclist + let l:index = ale#util#BinarySearch(l:loclist, a:bufnr, a:lnum, a:col) + endif " Show the diagnostics message if found, 'Hover' output otherwise - if l:index >= 0 + if l:show_problems && l:index >= 0 return l:loclist[l:index].text - elseif exists('*balloon_show') || getbufvar( - \ a:bufnr, - \ 'ale_set_balloons_legacy_echo', - \ get(g:, 'ale_set_balloons_legacy_echo', 0) + elseif l:show_hover && ( + \ exists('*balloon_show') + \ || getbufvar( + \ a:bufnr, + \ 'ale_set_balloons_legacy_echo', + \ get(g:, 'ale_set_balloons_legacy_echo', 0) + \ ) \) " Request LSP/tsserver hover information, but only if this version of " Vim supports the balloon_show function, or if we turned a legacy diff --git a/sources_non_forked/ale/autoload/ale/c.vim b/sources_non_forked/ale/autoload/ale/c.vim index d759b25a..e729aec8 100644 --- a/sources_non_forked/ale/autoload/ale/c.vim +++ b/sources_non_forked/ale/autoload/ale/c.vim @@ -2,20 +2,28 @@ " Description: Functions for integrating with C-family linters. call ale#Set('c_parse_makefile', 0) -call ale#Set('c_parse_compile_commands', 0) +call ale#Set('c_always_make', has('unix') && !has('macunix')) +call ale#Set('c_parse_compile_commands', 1) + let s:sep = has('win32') ? '\' : '/' " Set just so tests can override it. let g:__ale_c_project_filenames = ['.git/HEAD', 'configure', 'Makefile', 'CMakeLists.txt'] -function! ale#c#GetBuildDirectory(buffer) abort - " Don't include build directory for header files, as compile_commands.json - " files don't consider headers to be translation units, and provide no - " commands for compiling header files. - if expand('#' . a:buffer) =~# '\v\.(h|hpp)$' - return '' - endif +let g:ale_c_build_dir_names = get(g:, 'ale_c_build_dir_names', [ +\ 'build', +\ 'bin', +\]) +function! s:CanParseMakefile(buffer) abort + " Something somewhere seems to delete this setting in tests, so ensure we + " always have a default value. + call ale#Set('c_parse_makefile', 0) + + return ale#Var(a:buffer, 'c_parse_makefile') +endfunction + +function! ale#c#GetBuildDirectory(buffer) abort let l:build_dir = ale#Var(a:buffer, 'c_build_dir') " c_build_dir has the priority if defined @@ -23,104 +31,187 @@ function! ale#c#GetBuildDirectory(buffer) abort return l:build_dir endif - return ale#path#Dirname(ale#c#FindCompileCommands(a:buffer)) + let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer) + + return ale#path#Dirname(l:json_file) endfunction - -function! ale#c#FindProjectRoot(buffer) abort - for l:project_filename in g:__ale_c_project_filenames - let l:full_path = ale#path#FindNearestFile(a:buffer, l:project_filename) - - if !empty(l:full_path) - let l:path = fnamemodify(l:full_path, ':h') - - " Correct .git path detection. - if fnamemodify(l:path, ':t') is# '.git' - let l:path = fnamemodify(l:path, ':h') - endif - - return l:path - endif - endfor - - return '' -endfunction - -function! ale#c#AreSpecialCharsBalanced(option) abort - " Escape \" - let l:option_escaped = substitute(a:option, '\\"', '', 'g') - - " Retain special chars only - let l:special_chars = substitute(l:option_escaped, '[^"''()`]', '', 'g') - let l:special_chars = split(l:special_chars, '\zs') - - " Check if they are balanced +function! ale#c#ShellSplit(line) abort let l:stack = [] + let l:args = [''] + let l:prev = '' - for l:char in l:special_chars - if l:char is# ')' - if len(l:stack) == 0 || get(l:stack, -1) isnot# '(' - return 0 - endif - - call remove(l:stack, -1) - elseif l:char is# '(' - call add(l:stack, l:char) - else - if len(l:stack) > 0 && get(l:stack, -1) is# l:char + for l:char in split(a:line, '\zs') + if l:char is# '''' + if len(l:stack) > 0 && get(l:stack, -1) is# '''' call remove(l:stack, -1) - else + elseif (len(l:stack) == 0 || get(l:stack, -1) isnot# '"') && l:prev isnot# '\' call add(l:stack, l:char) endif + elseif (l:char is# '"' || l:char is# '`') && l:prev isnot# '\' + if len(l:stack) > 0 && get(l:stack, -1) is# l:char + call remove(l:stack, -1) + elseif len(l:stack) == 0 || get(l:stack, -1) isnot# '''' + call add(l:stack, l:char) + endif + elseif (l:char is# '(' || l:char is# '[' || l:char is# '{') && l:prev isnot# '\' + if len(l:stack) == 0 || get(l:stack, -1) isnot# '''' + call add(l:stack, l:char) + endif + elseif (l:char is# ')' || l:char is# ']' || l:char is# '}') && l:prev isnot# '\' + if len(l:stack) > 0 && get(l:stack, -1) is# {')': '(', ']': '[', '}': '{'}[l:char] + call remove(l:stack, -1) + endif + elseif l:char is# ' ' && len(l:stack) == 0 + if len(get(l:args, -1)) > 0 + call add(l:args, '') + endif + + continue + endif + + let l:args[-1] = get(l:args, -1) . l:char + endfor + + return l:args +endfunction + +" Takes the path prefix and a list of cflags and expands @file arguments to +" the contents of the file. +" +" @file arguments are command line arguments recognised by gcc and clang. For +" instance, if @./path/to/file was given to gcc, it would load .path/to/file +" and use the contents of that file as arguments. +function! ale#c#ExpandAtArgs(path_prefix, raw_split_lines) abort + let l:out_lines = [] + + for l:option in a:raw_split_lines + if stridx(l:option, '@') == 0 + " This is an argument specifying a location of a file containing other arguments + let l:path = join(split(l:option, '\zs')[1:], '') + + " Make path absolute + if !ale#path#IsAbsolute(l:path) + let l:rel_path = substitute(l:path, '"', '', 'g') + let l:rel_path = substitute(l:rel_path, '''', '', 'g') + let l:path = ale#path#GetAbsPath(a:path_prefix, l:rel_path) + endif + + " Read the file and add all the arguments + try + let l:additional_args = readfile(l:path) + catch + continue " All we can really do is skip this argument + endtry + + let l:file_lines = [] + + for l:line in l:additional_args + let l:file_lines += ale#c#ShellSplit(l:line) + endfor + + " @file arguments can include other @file arguments, so we must + " recurse. + let l:out_lines += ale#c#ExpandAtArgs(a:path_prefix, l:file_lines) + else + " This is not an @file argument, so don't touch it. + let l:out_lines += [l:option] endif endfor - return len(l:stack) == 0 + return l:out_lines endfunction -function! ale#c#ParseCFlags(path_prefix, cflag_line) abort - let l:split_lines = split(a:cflag_line) +" Quote C/C++ a compiler argument, if needed. +" +" Quoting arguments might cause issues with some systems/compilers, so we only +" quote them if we need to. +function! ale#c#QuoteArg(arg) abort + if a:arg !~# '\v[#$&*()\\|[\]{};''"<>/?! ^%]' + return a:arg + endif + + return ale#Escape(a:arg) +endfunction + +function! ale#c#ParseCFlags(path_prefix, should_quote, raw_arguments) abort + " Expand @file arguments now before parsing + let l:arguments = ale#c#ExpandAtArgs(a:path_prefix, a:raw_arguments) + " A list of [already_quoted, argument] + let l:items = [] let l:option_index = 0 - while l:option_index < len(l:split_lines) - let l:next_option_index = l:option_index + 1 - - " Join space-separated option - while l:next_option_index < len(l:split_lines) - \&& stridx(l:split_lines[l:next_option_index], '-') != 0 - let l:next_option_index += 1 - endwhile - - let l:option = join(l:split_lines[l:option_index : l:next_option_index-1], ' ') - call remove(l:split_lines, l:option_index, l:next_option_index-1) - call insert(l:split_lines, l:option, l:option_index) - - " Ignore invalid or conflicting options - if stridx(l:option, '-') != 0 - \|| stridx(l:option, '-o') == 0 - \|| stridx(l:option, '-c') == 0 - call remove(l:split_lines, l:option_index) - let l:option_index = l:option_index - 1 - " Fix relative path - elseif stridx(l:option, '-I') == 0 - if !(stridx(l:option, ':') == 2+1 || stridx(l:option, '/') == 2+0) - let l:option = '-I' . a:path_prefix . s:sep . l:option[2:] - call remove(l:split_lines, l:option_index) - call insert(l:split_lines, l:option, l:option_index) - endif - endif - + while l:option_index < len(l:arguments) + let l:option = l:arguments[l:option_index] let l:option_index = l:option_index + 1 + + " Include options, that may need relative path fix + if stridx(l:option, '-I') == 0 + \ || stridx(l:option, '-iquote') == 0 + \ || stridx(l:option, '-isystem') == 0 + \ || stridx(l:option, '-idirafter') == 0 + \ || stridx(l:option, '-iframework') == 0 + if stridx(l:option, '-I') == 0 && l:option isnot# '-I' + let l:arg = join(split(l:option, '\zs')[2:], '') + let l:option = '-I' + else + let l:arg = l:arguments[l:option_index] + let l:option_index = l:option_index + 1 + endif + + " Fix relative paths if needed + if !ale#path#IsAbsolute(l:arg) + let l:rel_path = substitute(l:arg, '"', '', 'g') + let l:rel_path = substitute(l:rel_path, '''', '', 'g') + let l:arg = ale#path#GetAbsPath(a:path_prefix, l:rel_path) + endif + + call add(l:items, [1, l:option]) + call add(l:items, [1, ale#Escape(l:arg)]) + " Options with arg that can be grouped with the option or separate + elseif stridx(l:option, '-D') == 0 || stridx(l:option, '-B') == 0 + if l:option is# '-D' || l:option is# '-B' + call add(l:items, [1, l:option]) + call add(l:items, [0, l:arguments[l:option_index]]) + let l:option_index = l:option_index + 1 + else + call add(l:items, [0, l:option]) + endif + " Options that have an argument (always separate) + elseif l:option is# '-iprefix' || stridx(l:option, '-iwithprefix') == 0 + \ || l:option is# '-isysroot' || l:option is# '-imultilib' + \ || l:option is# '-include' || l:option is# '-imacros' + call add(l:items, [0, l:option]) + call add(l:items, [0, l:arguments[l:option_index]]) + let l:option_index = l:option_index + 1 + " Options without argument + elseif (stridx(l:option, '-W') == 0 && stridx(l:option, '-Wa,') != 0 && stridx(l:option, '-Wl,') != 0 && stridx(l:option, '-Wp,') != 0) + \ || l:option is# '-w' || stridx(l:option, '-pedantic') == 0 + \ || l:option is# '-ansi' || stridx(l:option, '-std=') == 0 + \ || stridx(l:option, '-f') == 0 && l:option !~# '\v^-f(dump|diagnostics|no-show-column|stack-usage)' + \ || stridx(l:option, '-O') == 0 + \ || l:option is# '-C' || l:option is# '-CC' || l:option is# '-trigraphs' + \ || stridx(l:option, '-nostdinc') == 0 || stridx(l:option, '-iplugindir=') == 0 + \ || stridx(l:option, '--sysroot=') == 0 || l:option is# '--no-sysroot-suffix' + \ || stridx(l:option, '-m') == 0 + call add(l:items, [0, l:option]) + endif endwhile - call uniq(l:split_lines) + if a:should_quote + " Quote C arguments that haven't already been quoted above. + " If and only if we've been asked to quote them. + call map(l:items, 'v:val[0] ? v:val[1] : ale#c#QuoteArg(v:val[1])') + else + call map(l:items, 'v:val[1]') + endif - return join(l:split_lines, ' ') + return join(l:items, ' ') endfunction function! ale#c#ParseCFlagsFromMakeOutput(buffer, make_output) abort - if !g:ale_c_parse_makefile - return '' + if !s:CanParseMakefile(a:buffer) + return v:null endif let l:buffer_filename = expand('#' . a:buffer . ':t') @@ -137,17 +228,20 @@ function! ale#c#ParseCFlagsFromMakeOutput(buffer, make_output) abort let l:makefile_path = ale#path#FindNearestFile(a:buffer, 'Makefile') let l:makefile_dir = fnamemodify(l:makefile_path, ':p:h') - return ale#c#ParseCFlags(l:makefile_dir, l:cflag_line) + return ale#c#ParseCFlags(l:makefile_dir, 0, ale#c#ShellSplit(l:cflag_line)) endfunction -" Given a buffer number, find the build subdirectory with compile commands -" The subdirectory is returned without the trailing / +" Given a buffer number, find the project directory containing +" compile_commands.json, and the path to the compile_commands.json file. +" +" If compile_commands.json cannot be found, two empty strings will be +" returned. function! ale#c#FindCompileCommands(buffer) abort " Look above the current source file to find compile_commands.json let l:json_file = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') if !empty(l:json_file) - return l:json_file + return [fnamemodify(l:json_file, ':h'), l:json_file] endif " Search in build directories if we can't find it in the project. @@ -157,12 +251,42 @@ function! ale#c#FindCompileCommands(buffer) abort let l:json_file = l:c_build_dir . s:sep . 'compile_commands.json' if filereadable(l:json_file) - return l:json_file + return [l:path, l:json_file] endif endfor endfor - return '' + return ['', ''] +endfunction + +" Find the project root for C/C++ projects. +" +" The location of compile_commands.json will be used to find project roots. +" +" If compile_commands.json cannot be found, other common configuration files +" will be used to detect the project root. +function! ale#c#FindProjectRoot(buffer) abort + let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer) + + " Fall back on detecting the project root based on other filenames. + if empty(l:root) + for l:project_filename in g:__ale_c_project_filenames + let l:full_path = ale#path#FindNearestFile(a:buffer, l:project_filename) + + if !empty(l:full_path) + let l:path = fnamemodify(l:full_path, ':h') + + " Correct .git path detection. + if fnamemodify(l:path, ':t') is# '.git' + let l:path = fnamemodify(l:path, ':h') + endif + + return l:path + endif + endfor + endif + + return l:root endfunction " Cache compile_commands.json data in a Dictionary, so we don't need to read @@ -172,6 +296,10 @@ if !exists('s:compile_commands_cache') let s:compile_commands_cache = {} endif +function! ale#c#ResetCompileCommandsCache() abort + let s:compile_commands_cache = {} +endfunction + function! s:GetLookupFromCompileCommandsFile(compile_commands_file) abort let l:empty = [{}, {}] @@ -194,13 +322,28 @@ function! s:GetLookupFromCompileCommandsFile(compile_commands_file) abort let l:raw_data = [] silent! let l:raw_data = json_decode(join(readfile(a:compile_commands_file), '')) + if type(l:raw_data) isnot v:t_list + let l:raw_data = [] + endif + let l:file_lookup = {} let l:dir_lookup = {} - for l:entry in l:raw_data + for l:entry in (type(l:raw_data) is v:t_list ? l:raw_data : []) + let l:filename = ale#path#GetAbsPath(l:entry.directory, l:entry.file) + + " Store a key for lookups by the absolute path to the filename. + let l:file_lookup[l:filename] = get(l:file_lookup, l:filename, []) + [l:entry] + + " Store a key for fuzzy lookups by the absolute path to the directory. + let l:dirname = fnamemodify(l:filename, ':h') + let l:dir_lookup[l:dirname] = get(l:dir_lookup, l:dirname, []) + [l:entry] + + " Store a key for fuzzy lookups by just the basename of the file. let l:basename = tolower(fnamemodify(l:entry.file, ':t')) let l:file_lookup[l:basename] = get(l:file_lookup, l:basename, []) + [l:entry] + " Store a key for fuzzy lookups by just the basename of the directory. let l:dirbasename = tolower(fnamemodify(l:entry.directory, ':p:h:t')) let l:dir_lookup[l:dirbasename] = get(l:dir_lookup, l:dirbasename, []) + [l:entry] endfor @@ -215,27 +358,113 @@ function! s:GetLookupFromCompileCommandsFile(compile_commands_file) abort return l:empty endfunction +" Get [should_quote, arguments] from either 'command' or 'arguments' +" 'arguments' should be quoted later, the split 'command' strings should not. +function! s:GetArguments(json_item) abort + if has_key(a:json_item, 'arguments') + return [1, a:json_item.arguments] + elseif has_key(a:json_item, 'command') + return [0, ale#c#ShellSplit(a:json_item.command)] + endif + + return [0, []] +endfunction + function! ale#c#ParseCompileCommandsFlags(buffer, file_lookup, dir_lookup) abort + let l:buffer_filename = ale#path#Simplify(expand('#' . a:buffer . ':p')) + let l:basename = tolower(fnamemodify(l:buffer_filename, ':t')) + " Look for any file in the same directory if we can't find an exact match. + let l:dir = fnamemodify(l:buffer_filename, ':h') + " Search for an exact file match first. - let l:basename = tolower(expand('#' . a:buffer . ':t')) - let l:file_list = get(a:file_lookup, l:basename, []) + let l:file_list = get(a:file_lookup, l:buffer_filename, []) + + " We may have to look for /foo/bar instead of C:\foo\bar + if empty(l:file_list) && has('win32') + let l:file_list = get( + \ a:file_lookup, + \ ale#path#RemoveDriveLetter(l:buffer_filename), + \ [] + \) + endif + + " Try the absolute path to the directory second. + let l:dir_list = get(a:dir_lookup, l:dir, []) + + if empty(l:dir_list) && has('win32') + let l:dir_list = get( + \ a:dir_lookup, + \ ale#path#RemoveDriveLetter(l:dir), + \ [] + \) + endif + + if empty(l:file_list) && empty(l:dir_list) + " If we can't find matches with the path to the file, try a + " case-insensitive match for any similarly-named file. + let l:file_list = get(a:file_lookup, l:basename, []) + + " If we can't find matches with the path to the directory, try a + " case-insensitive match for anything in similarly-named directory. + let l:dir_list = get(a:dir_lookup, tolower(fnamemodify(l:dir, ':t')), []) + endif + + " A source file matching the header filename. + let l:source_file = '' + + if empty(l:file_list) && l:basename =~? '\.h$\|\.hpp$' + for l:suffix in ['.c', '.cpp'] + " Try to find a source file by an absolute path first. + let l:key = fnamemodify(l:buffer_filename, ':r') . l:suffix + let l:file_list = get(a:file_lookup, l:key, []) + + if empty(l:file_list) && has('win32') + let l:file_list = get( + \ a:file_lookup, + \ ale#path#RemoveDriveLetter(l:key), + \ [] + \) + endif + + if empty(l:file_list) + " Look fuzzy matches on the basename second. + let l:key = fnamemodify(l:basename, ':r') . l:suffix + let l:file_list = get(a:file_lookup, l:key, []) + endif + + if !empty(l:file_list) + let l:source_file = l:key + break + endif + endfor + endif for l:item in l:file_list - if bufnr(l:item.file) is a:buffer && has_key(l:item, 'command') - return ale#c#ParseCFlags(l:item.directory, l:item.command) + let l:filename = ale#path#GetAbsPath(l:item.directory, l:item.file) + + " Load the flags for this file, or for a source file matching the + " header file. + if ( + \ bufnr(l:filename) is a:buffer + \ || ( + \ !empty(l:source_file) + \ && l:filename[-len(l:source_file):] is? l:source_file + \ ) + \) + let [l:should_quote, l:args] = s:GetArguments(l:item) + + return ale#c#ParseCFlags(l:item.directory, l:should_quote, l:args) endif endfor - " Look for any file in the same directory if we can't find an exact match. - let l:dir = ale#path#Simplify(expand('#' . a:buffer . ':p:h')) - - let l:dirbasename = tolower(expand('#' . a:buffer . ':p:h:t')) - let l:dir_list = get(a:dir_lookup, l:dirbasename, []) - for l:item in l:dir_list - if ale#path#Simplify(fnamemodify(l:item.file, ':h')) is? l:dir - \&& has_key(l:item, 'command') - return ale#c#ParseCFlags(l:item.directory, l:item.command) + let l:filename = ale#path#GetAbsPath(l:item.directory, l:item.file) + + if ale#path#RemoveDriveLetter(fnamemodify(l:filename, ':h')) + \ is? ale#path#RemoveDriveLetter(l:dir) + let [l:should_quote, l:args] = s:GetArguments(l:item) + + return ale#c#ParseCFlags(l:item.directory, l:should_quote, l:args) endif endfor @@ -251,37 +480,61 @@ function! ale#c#FlagsFromCompileCommands(buffer, compile_commands_file) abort endfunction function! ale#c#GetCFlags(buffer, output) abort - let l:cflags = ' ' - - if ale#Var(a:buffer, 'c_parse_makefile') && !empty(a:output) - let l:cflags = ale#c#ParseCFlagsFromMakeOutput(a:buffer, a:output) - endif + let l:cflags = v:null if ale#Var(a:buffer, 'c_parse_compile_commands') - let l:json_file = ale#c#FindCompileCommands(a:buffer) + let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer) if !empty(l:json_file) let l:cflags = ale#c#FlagsFromCompileCommands(a:buffer, l:json_file) endif endif - if l:cflags is# ' ' + if empty(l:cflags) && s:CanParseMakefile(a:buffer) && !empty(a:output) + let l:cflags = ale#c#ParseCFlagsFromMakeOutput(a:buffer, a:output) + endif + + if l:cflags is v:null let l:cflags = ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)) endif - return l:cflags + return l:cflags isnot v:null ? l:cflags : '' endfunction function! ale#c#GetMakeCommand(buffer) abort - if ale#Var(a:buffer, 'c_parse_makefile') - let l:makefile_path = ale#path#FindNearestFile(a:buffer, 'Makefile') + if s:CanParseMakefile(a:buffer) + let l:path = ale#path#FindNearestFile(a:buffer, 'Makefile') - if !empty(l:makefile_path) - return 'cd '. fnamemodify(l:makefile_path, ':p:h') . ' && make -n' + if empty(l:path) + let l:path = ale#path#FindNearestFile(a:buffer, 'GNUmakefile') + endif + + if !empty(l:path) + let l:always_make = ale#Var(a:buffer, 'c_always_make') + + return [ + \ fnamemodify(l:path, ':h'), + \ 'make -n' . (l:always_make ? ' --always-make' : ''), + \] endif endif - return '' + return ['', ''] +endfunction + +function! ale#c#RunMakeCommand(buffer, Callback) abort + let [l:cwd, l:command] = ale#c#GetMakeCommand(a:buffer) + + if empty(l:command) + return a:Callback(a:buffer, []) + endif + + return ale#command#Run( + \ a:buffer, + \ l:command, + \ {b, output -> a:Callback(a:buffer, output)}, + \ {'cwd': l:cwd}, + \) endfunction " Given a buffer number, search for a project root, and output a List @@ -332,8 +585,3 @@ function! ale#c#IncludeOptions(include_paths) abort return join(l:option_list) endfunction - -let g:ale_c_build_dir_names = get(g:, 'ale_c_build_dir_names', [ -\ 'build', -\ 'bin', -\]) diff --git a/sources_non_forked/ale/autoload/ale/code_action.vim b/sources_non_forked/ale/autoload/ale/code_action.vim new file mode 100644 index 00000000..917190be --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/code_action.vim @@ -0,0 +1,411 @@ +" Author: Jerko Steiner +" Description: Code action support for LSP / tsserver + +function! ale#code_action#ReloadBuffer() abort + let l:buffer = bufnr('') + + execute 'augroup ALECodeActionReloadGroup' . l:buffer + autocmd! + augroup END + + silent! execute 'augroup! ALECodeActionReloadGroup' . l:buffer + + call ale#util#Execute(':e!') +endfunction + +function! ale#code_action#HandleCodeAction(code_action, options) abort + let l:current_buffer = bufnr('') + let l:changes = a:code_action.changes + let l:should_save = get(a:options, 'should_save') + + for l:file_code_edit in l:changes + call ale#code_action#ApplyChanges( + \ l:file_code_edit.fileName, + \ l:file_code_edit.textChanges, + \ l:should_save, + \) + endfor +endfunction + +function! s:ChangeCmp(left, right) abort + if a:left.start.line < a:right.start.line + return -1 + endif + + if a:left.start.line > a:right.start.line + return 1 + endif + + if a:left.start.offset < a:right.start.offset + return -1 + endif + + if a:left.start.offset > a:right.start.offset + return 1 + endif + + if a:left.end.line < a:right.end.line + return -1 + endif + + if a:left.end.line > a:right.end.line + return 1 + endif + + if a:left.end.offset < a:right.end.offset + return -1 + endif + + if a:left.end.offset > a:right.end.offset + return 1 + endif + + return 0 +endfunction + +function! ale#code_action#ApplyChanges(filename, changes, should_save) abort + let l:current_buffer = bufnr('') + " The buffer is used to determine the fileformat, if available. + let l:buffer = bufnr(a:filename) + let l:is_current_buffer = l:buffer > 0 && l:buffer == l:current_buffer + + if l:buffer > 0 + let l:lines = getbufline(l:buffer, 1, '$') + + " Add empty line if there's trailing newline, like readfile() does. + if getbufvar(l:buffer, '&eol') + let l:lines += [''] + endif + else + let l:lines = readfile(a:filename, 'b') + endif + + if l:is_current_buffer + let l:pos = getpos('.')[1:2] + else + let l:pos = [1, 1] + endif + + " Changes have to be sorted so we apply them from bottom-to-top + for l:code_edit in reverse(sort(copy(a:changes), function('s:ChangeCmp'))) + let l:line = l:code_edit.start.line + let l:column = l:code_edit.start.offset + let l:end_line = l:code_edit.end.line + let l:end_column = l:code_edit.end.offset + let l:text = l:code_edit.newText + + let l:insertions = split(l:text, '\n', 1) + + " Fix invalid columns + let l:column = l:column > 0 ? l:column : 1 + let l:end_column = l:end_column > 0 ? l:end_column : 1 + + " Clamp start to BOF + if l:line < 1 + let [l:line, l:column] = [1, 1] + endif + + " Clamp start to EOF + if l:line > len(l:lines) || l:line == len(l:lines) && l:column > len(l:lines[-1]) + 1 + let [l:line, l:column] = [len(l:lines), len(l:lines[-1]) + 1] + " Special case when start is after EOL + elseif l:line < len(l:lines) && l:column > len(l:lines[l:line - 1]) + 1 + let [l:line, l:column] = [l:line + 1, 1] + endif + + " Adjust end: clamp if invalid and/or adjust if we moved start + if l:end_line < l:line || l:end_line == l:line && l:end_column < l:column + let [l:end_line, l:end_column] = [l:line, l:column] + endif + + " Clamp end to EOF + if l:end_line > len(l:lines) || l:end_line == len(l:lines) && l:end_column > len(l:lines[-1]) + 1 + let [l:end_line, l:end_column] = [len(l:lines), len(l:lines[-1]) + 1] + " Special case when end is after EOL + elseif l:end_line < len(l:lines) && l:end_column > len(l:lines[l:end_line - 1]) + 1 + let [l:end_line, l:end_column] = [l:end_line + 1, 1] + endif + + " Careful, [:-1] is not an empty list + let l:start = l:line is 1 ? [] : l:lines[: l:line - 2] + let l:middle = l:column is 1 ? [''] : [l:lines[l:line - 1][: l:column - 2]] + + let l:middle[-1] .= l:insertions[0] + let l:middle += l:insertions[1:] + let l:middle[-1] .= l:lines[l:end_line - 1][l:end_column - 1 :] + + let l:end_line_len = len(l:lines[l:end_line - 1]) + let l:lines_before_change = len(l:lines) + let l:lines = l:start + l:middle + l:lines[l:end_line :] + + let l:current_line_offset = len(l:lines) - l:lines_before_change + let l:column_offset = len(l:middle[-1]) - l:end_line_len + + " Keep cursor where it was (if outside of changes) or move it after + " the changed text (if inside), but don't touch it when the change + " spans the entire buffer, in which case we have no clue and it's + " better to not do anything. + if l:line isnot 1 || l:column isnot 1 + \|| l:end_line < l:lines_before_change + \|| l:end_line == l:lines_before_change && l:end_column <= l:end_line_len + let l:pos = s:UpdateCursor(l:pos, + \ [l:line, l:column], + \ [l:end_line, l:end_column], + \ [l:current_line_offset, l:column_offset]) + endif + endfor + + if l:buffer > 0 + " Make sure ale#util#{Writefile,SetBufferContents} add trailing + " newline if and only if it should be added. + if l:lines[-1] is# '' && getbufvar(l:buffer, '&eol') + call remove(l:lines, -1) + else + call setbufvar(l:buffer, '&eol', 0) + endif + elseif exists('+fixeol') && &fixeol && l:lines[-1] is# '' + " Not in buffer, ale#util#Writefile can't check &eol and always adds + " newline if &fixeol: remove to prevent double trailing newline. + call remove(l:lines, -1) + endif + + if a:should_save || l:buffer < 0 + call ale#util#Writefile(l:buffer, l:lines, a:filename) + else + call ale#util#SetBufferContents(l:buffer, l:lines) + endif + + if l:is_current_buffer + if a:should_save + call ale#util#Execute(':e!') + endif + + call setpos('.', [0, l:pos[0], l:pos[1], 0]) + endif + + if a:should_save && l:buffer > 0 && !l:is_current_buffer + " Set up a one-time use event that will delete itself to reload the + " buffer next time it's entered to view the changes made to it. + execute 'augroup ALECodeActionReloadGroup' . l:buffer + autocmd! + + execute printf( + \ 'autocmd BufEnter ' + \ . ' call ale#code_action#ReloadBuffer()', + \ l:buffer + \) + augroup END + endif +endfunction + +function! s:UpdateCursor(cursor, start, end, offset) abort + let l:cur_line = a:cursor[0] + let l:cur_column = a:cursor[1] + let l:line = a:start[0] + let l:column = a:start[1] + let l:end_line = a:end[0] + let l:end_column = a:end[1] + let l:line_offset = a:offset[0] + let l:column_offset = a:offset[1] + + if l:end_line < l:cur_line + " both start and end lines are before the cursor. only line offset + " needs to be updated + let l:cur_line += l:line_offset + elseif l:end_line == l:cur_line + " end line is at the same location as cursor, which means + " l:line <= l:cur_line + if l:line < l:cur_line || l:column <= l:cur_column + " updates are happening either before or around the cursor + if l:end_column < l:cur_column + " updates are happening before the cursor, update the + " column offset for cursor + let l:cur_line += l:line_offset + let l:cur_column += l:column_offset + else + " updates are happening around the cursor, move the cursor + " to the end of the changes + let l:cur_line += l:line_offset + let l:cur_column = l:end_column + l:column_offset + endif + " else is not necessary, it means modifications are happening + " after the cursor so no cursor updates need to be done + endif + else + " end line is after the cursor + if l:line < l:cur_line || l:line == l:cur_line && l:column <= l:cur_column + " changes are happening around the cursor, move the cursor + " to the end of the changes + let l:cur_line = l:end_line + l:line_offset + let l:cur_column = l:end_column + l:column_offset + " else is not necesary, it means modifications are happening + " after the cursor so no cursor updates need to be done + endif + endif + + return [l:cur_line, l:cur_column] +endfunction + +function! ale#code_action#GetChanges(workspace_edit) abort + if a:workspace_edit is v:null + return {} + endif + + let l:changes = {} + + if has_key(a:workspace_edit, 'changes') && !empty(a:workspace_edit.changes) + return a:workspace_edit.changes + elseif has_key(a:workspace_edit, 'documentChanges') + let l:document_changes = [] + + if type(a:workspace_edit.documentChanges) is v:t_dict + \ && has_key(a:workspace_edit.documentChanges, 'edits') + call add(l:document_changes, a:workspace_edit.documentChanges) + elseif type(a:workspace_edit.documentChanges) is v:t_list + let l:document_changes = a:workspace_edit.documentChanges + endif + + for l:text_document_edit in l:document_changes + let l:filename = l:text_document_edit.textDocument.uri + let l:edits = l:text_document_edit.edits + let l:changes[l:filename] = l:edits + endfor + endif + + return l:changes +endfunction + +function! ale#code_action#BuildChangesList(changes_map) abort + let l:changes = [] + + for l:file_name in keys(a:changes_map) + let l:text_edits = a:changes_map[l:file_name] + let l:text_changes = [] + + for l:edit in l:text_edits + let l:range = l:edit.range + let l:new_text = l:edit.newText + + call add(l:text_changes, { + \ 'start': { + \ 'line': l:range.start.line + 1, + \ 'offset': l:range.start.character + 1, + \ }, + \ 'end': { + \ 'line': l:range.end.line + 1, + \ 'offset': l:range.end.character + 1, + \ }, + \ 'newText': l:new_text, + \}) + endfor + + call add(l:changes, { + \ 'fileName': ale#path#FromURI(l:file_name), + \ 'textChanges': l:text_changes, + \}) + endfor + + return l:changes +endfunction + +function! s:EscapeMenuName(text) abort + return substitute(a:text, '\\\| \|\.\|&', '\\\0', 'g') +endfunction + +function! s:UpdateMenu(data, menu_items) abort + silent! aunmenu PopUp.Refactor\.\.\. + + if empty(a:data) + return + endif + + for [l:type, l:item] in a:menu_items + let l:name = l:type is# 'tsserver' ? l:item.name : l:item.title + let l:func_name = l:type is# 'tsserver' + \ ? 'ale#codefix#ApplyTSServerCodeAction' + \ : 'ale#codefix#ApplyLSPCodeAction' + + execute printf( + \ 'anoremenu PopUp.&Refactor\.\.\..%s' + \ . ' :call %s(%s, %s)', + \ s:EscapeMenuName(l:name), + \ l:func_name, + \ string(a:data), + \ string(l:item), + \) + endfor + + if empty(a:menu_items) + silent! anoremenu PopUp.Refactor\.\.\..(None) :silent + endif +endfunction + +function! s:GetCodeActions(linter, options) abort + let l:buffer = bufnr('') + let [l:line, l:column] = getpos('.')[1:2] + let l:column = min([l:column, len(getline(l:line))]) + + let l:location = { + \ 'buffer': l:buffer, + \ 'line': l:line, + \ 'column': l:column, + \ 'end_line': l:line, + \ 'end_column': l:column, + \} + let l:Callback = function('s:OnReady', [l:location, a:options]) + call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback) +endfunction + +function! ale#code_action#GetCodeActions(options) abort + silent! aunmenu PopUp.Rename + silent! aunmenu PopUp.Refactor\.\.\. + + " Only display the menu items if there's an LSP server. + let l:has_lsp = 0 + + for l:linter in ale#linter#Get(&filetype) + if !empty(l:linter.lsp) + let l:has_lsp = 1 + + break + endif + endfor + + if l:has_lsp + if !empty(expand('')) + silent! anoremenu PopUp.Rename :ALERename + endif + + silent! anoremenu PopUp.Refactor\.\.\..(None) :silent + + call ale#codefix#Execute( + \ mode() is# 'v' || mode() is# "\", + \ function('s:UpdateMenu') + \) + endif +endfunction + +function! s:Setup(enabled) abort + augroup ALECodeActionsGroup + autocmd! + + if a:enabled + autocmd MenuPopup * :call ale#code_action#GetCodeActions({}) + endif + augroup END + + if !a:enabled + silent! augroup! ALECodeActionsGroup + + silent! aunmenu PopUp.Rename + silent! aunmenu PopUp.Refactor\.\.\. + endif +endfunction + +function! ale#code_action#EnablePopUpMenu() abort + call s:Setup(1) +endfunction + +function! ale#code_action#DisablePopUpMenu() abort + call s:Setup(0) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/codefix.vim b/sources_non_forked/ale/autoload/ale/codefix.vim new file mode 100644 index 00000000..853ee4e8 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/codefix.vim @@ -0,0 +1,497 @@ +" Author: Dalius Dobravolskas +" Description: Code Fix support for tsserver and LSP servers + +let s:codefix_map = {} + +" Used to get the codefix map in tests. +function! ale#codefix#GetMap() abort + return deepcopy(s:codefix_map) +endfunction + +" Used to set the codefix map in tests. +function! ale#codefix#SetMap(map) abort + let s:codefix_map = a:map +endfunction + +function! ale#codefix#ClearLSPData() abort + let s:codefix_map = {} +endfunction + +function! s:message(message) abort + call ale#util#Execute('echom ' . string(a:message)) +endfunction + +function! ale#codefix#ApplyTSServerCodeAction(data, item) abort + if has_key(a:item, 'changes') + let l:changes = a:item.changes + + call ale#code_action#HandleCodeAction( + \ { + \ 'description': 'codefix', + \ 'changes': l:changes, + \ }, + \ {}, + \) + else + let l:message = ale#lsp#tsserver_message#GetEditsForRefactor( + \ a:data.buffer, + \ a:data.line, + \ a:data.column, + \ a:data.end_line, + \ a:data.end_column, + \ a:item.id[0], + \ a:item.id[1], + \) + + let l:request_id = ale#lsp#Send(a:data.connection_id, l:message) + + let s:codefix_map[l:request_id] = a:data + endif +endfunction + +function! ale#codefix#HandleTSServerResponse(conn_id, response) abort + if !has_key(a:response, 'request_seq') + \ || !has_key(s:codefix_map, a:response.request_seq) + return + endif + + let l:data = remove(s:codefix_map, a:response.request_seq) + let l:MenuCallback = get(l:data, 'menu_callback', v:null) + + if get(a:response, 'command', '') is# 'getCodeFixes' + if get(a:response, 'success', v:false) is v:false + \&& l:MenuCallback is v:null + let l:message = get(a:response, 'message', 'unknown') + call s:message('Error while getting code fixes. Reason: ' . l:message) + + return + endif + + let l:result = get(a:response, 'body', []) + call filter(l:result, 'has_key(v:val, ''changes'')') + + if l:MenuCallback isnot v:null + call l:MenuCallback( + \ l:data, + \ map(copy(l:result), '[''tsserver'', v:val]') + \) + + return + endif + + if len(l:result) == 0 + call s:message('No code fixes available.') + + return + endif + + let l:code_fix_to_apply = 0 + + if len(l:result) == 1 + let l:code_fix_to_apply = 1 + else + let l:codefix_no = 1 + let l:codefixstring = "Code Fixes:\n" + + for l:codefix in l:result + let l:codefixstring .= l:codefix_no . ') ' + \ . l:codefix.description . "\n" + let l:codefix_no += 1 + endfor + + let l:codefixstring .= 'Type number and (empty cancels): ' + + let l:code_fix_to_apply = ale#util#Input(l:codefixstring, '') + let l:code_fix_to_apply = str2nr(l:code_fix_to_apply) + + if l:code_fix_to_apply == 0 + return + endif + endif + + call ale#codefix#ApplyTSServerCodeAction( + \ l:data, + \ l:result[l:code_fix_to_apply - 1], + \) + elseif get(a:response, 'command', '') is# 'getApplicableRefactors' + if get(a:response, 'success', v:false) is v:false + \&& l:MenuCallback is v:null + let l:message = get(a:response, 'message', 'unknown') + call s:message('Error while getting applicable refactors. Reason: ' . l:message) + + return + endif + + let l:result = get(a:response, 'body', []) + + if len(l:result) == 0 + call s:message('No applicable refactors available.') + + return + endif + + let l:refactors = [] + + for l:item in l:result + for l:action in l:item.actions + call add(l:refactors, { + \ 'name': l:action.description, + \ 'id': [l:item.name, l:action.name], + \}) + endfor + endfor + + if l:MenuCallback isnot v:null + call l:MenuCallback( + \ l:data, + \ map(copy(l:refactors), '[''tsserver'', v:val]') + \) + + return + endif + + let l:refactor_no = 1 + let l:refactorstring = "Applicable refactors:\n" + + for l:refactor in l:refactors + let l:refactorstring .= l:refactor_no . ') ' + \ . l:refactor.name . "\n" + let l:refactor_no += 1 + endfor + + let l:refactorstring .= 'Type number and (empty cancels): ' + + let l:refactor_to_apply = ale#util#Input(l:refactorstring, '') + let l:refactor_to_apply = str2nr(l:refactor_to_apply) + + if l:refactor_to_apply == 0 + return + endif + + let l:id = l:refactors[l:refactor_to_apply - 1].id + + call ale#codefix#ApplyTSServerCodeAction( + \ l:data, + \ l:refactors[l:refactor_to_apply - 1], + \) + elseif get(a:response, 'command', '') is# 'getEditsForRefactor' + if get(a:response, 'success', v:false) is v:false + let l:message = get(a:response, 'message', 'unknown') + call s:message('Error while getting edits for refactor. Reason: ' . l:message) + + return + endif + + call ale#code_action#HandleCodeAction( + \ { + \ 'description': 'editsForRefactor', + \ 'changes': a:response.body.edits, + \ }, + \ {}, + \) + endif +endfunction + +function! ale#codefix#ApplyLSPCodeAction(data, item) abort + if has_key(a:item, 'command') + \&& type(a:item.command) == v:t_dict + let l:command = a:item.command + let l:message = ale#lsp#message#ExecuteCommand( + \ l:command.command, + \ l:command.arguments, + \) + + let l:request_id = ale#lsp#Send(a:data.connection_id, l:message) + elseif has_key(a:item, 'command') && has_key(a:item, 'arguments') + \&& type(a:item.command) == v:t_string + let l:message = ale#lsp#message#ExecuteCommand( + \ a:item.command, + \ a:item.arguments, + \) + + let l:request_id = ale#lsp#Send(a:data.connection_id, l:message) + elseif has_key(a:item, 'edit') || has_key(a:item, 'arguments') + if has_key(a:item, 'edit') + let l:topass = a:item.edit + else + let l:topass = a:item.arguments[0] + endif + + let l:changes_map = ale#code_action#GetChanges(l:topass) + + if empty(l:changes_map) + return + endif + + let l:changes = ale#code_action#BuildChangesList(l:changes_map) + + call ale#code_action#HandleCodeAction( + \ { + \ 'description': 'codeaction', + \ 'changes': l:changes, + \ }, + \ {}, + \) + endif +endfunction + +function! ale#codefix#HandleLSPResponse(conn_id, response) abort + if has_key(a:response, 'method') + \ && a:response.method is# 'workspace/applyEdit' + \ && has_key(a:response, 'params') + let l:params = a:response.params + + let l:changes_map = ale#code_action#GetChanges(l:params.edit) + + if empty(l:changes_map) + return + endif + + let l:changes = ale#code_action#BuildChangesList(l:changes_map) + + call ale#code_action#HandleCodeAction( + \ { + \ 'description': 'applyEdit', + \ 'changes': l:changes, + \ }, + \ {} + \) + elseif has_key(a:response, 'id') + \&& has_key(s:codefix_map, a:response.id) + let l:data = remove(s:codefix_map, a:response.id) + let l:MenuCallback = get(l:data, 'menu_callback', v:null) + + let l:result = get(a:response, 'result') + + if type(l:result) != v:t_list + let l:result = [] + endif + + " Send the results to the menu callback, if set. + if l:MenuCallback isnot v:null + call l:MenuCallback( + \ l:data, + \ map(copy(l:result), '[''lsp'', v:val]') + \) + + return + endif + + if len(l:result) == 0 + call s:message('No code actions received from server') + + return + endif + + let l:codeaction_no = 1 + let l:codeactionstring = "Code Fixes:\n" + + for l:codeaction in l:result + let l:codeactionstring .= l:codeaction_no . ') ' + \ . l:codeaction.title . "\n" + let l:codeaction_no += 1 + endfor + + let l:codeactionstring .= 'Type number and (empty cancels): ' + + let l:codeaction_to_apply = ale#util#Input(l:codeactionstring, '') + let l:codeaction_to_apply = str2nr(l:codeaction_to_apply) + + if l:codeaction_to_apply == 0 + return + endif + + let l:item = l:result[l:codeaction_to_apply - 1] + + call ale#codefix#ApplyLSPCodeAction(l:data, l:item) + endif +endfunction + +function! s:FindError(buffer, line, column, end_line, end_column, linter_name) abort + let l:nearest_error = v:null + + if a:line == a:end_line + \&& a:column == a:end_column + \&& has_key(g:ale_buffer_info, a:buffer) + let l:nearest_error_diff = -1 + + for l:error in get(g:ale_buffer_info[a:buffer], 'loclist', []) + if has_key(l:error, 'code') + \ && (a:linter_name is v:null || l:error.linter_name is# a:linter_name) + \ && l:error.lnum == a:line + let l:diff = abs(l:error.col - a:column) + + if l:nearest_error_diff == -1 || l:diff < l:nearest_error_diff + let l:nearest_error_diff = l:diff + let l:nearest_error = l:error + endif + endif + endfor + endif + + return l:nearest_error +endfunction + +function! s:OnReady( +\ line, +\ column, +\ end_line, +\ end_column, +\ MenuCallback, +\ linter, +\ lsp_details, +\) abort + let l:id = a:lsp_details.connection_id + + if !ale#lsp#HasCapability(l:id, 'code_actions') + return + endif + + let l:buffer = a:lsp_details.buffer + + if a:linter.lsp is# 'tsserver' + let l:nearest_error = + \ s:FindError(l:buffer, a:line, a:column, a:end_line, a:end_column, a:linter.lsp) + + if l:nearest_error isnot v:null + let l:message = ale#lsp#tsserver_message#GetCodeFixes( + \ l:buffer, + \ a:line, + \ a:column, + \ a:line, + \ a:column, + \ [l:nearest_error.code], + \) + else + let l:message = ale#lsp#tsserver_message#GetApplicableRefactors( + \ l:buffer, + \ a:line, + \ a:column, + \ a:end_line, + \ a:end_column, + \) + endif + else + " Send a message saying the buffer has changed first, otherwise + " completions won't know what text is nearby. + call ale#lsp#NotifyForChanges(l:id, l:buffer) + + let l:diagnostics = [] + let l:nearest_error = + \ s:FindError(l:buffer, a:line, a:column, a:end_line, a:end_column, v:null) + + if l:nearest_error isnot v:null + let l:diagnostics = [ + \ { + \ 'code': l:nearest_error.code, + \ 'message': l:nearest_error.text, + \ 'range': { + \ 'start': { + \ 'line': l:nearest_error.lnum - 1, + \ 'character': l:nearest_error.col - 1, + \ }, + \ 'end': { + \ 'line': l:nearest_error.end_lnum - 1, + \ 'character': l:nearest_error.end_col, + \ }, + \ }, + \ }, + \] + endif + + let l:message = ale#lsp#message#CodeAction( + \ l:buffer, + \ a:line, + \ a:column, + \ a:end_line, + \ a:end_column, + \ l:diagnostics, + \) + endif + + let l:Callback = a:linter.lsp is# 'tsserver' + \ ? function('ale#codefix#HandleTSServerResponse') + \ : function('ale#codefix#HandleLSPResponse') + + call ale#lsp#RegisterCallback(l:id, l:Callback) + + let l:request_id = ale#lsp#Send(l:id, l:message) + + let s:codefix_map[l:request_id] = { + \ 'connection_id': l:id, + \ 'buffer': l:buffer, + \ 'line': a:line, + \ 'column': a:column, + \ 'end_line': a:end_line, + \ 'end_column': a:end_column, + \ 'menu_callback': a:MenuCallback, + \} +endfunction + +function! s:ExecuteGetCodeFix(linter, range, MenuCallback) abort + let l:buffer = bufnr('') + + if a:range == 0 + let [l:line, l:column] = getpos('.')[1:2] + let l:end_line = l:line + let l:end_column = l:column + + " Expand the range to cover the current word, if there is one. + let l:cword = expand('') + + if !empty(l:cword) + let l:search_pos = searchpos('\V' . l:cword, 'bn', l:line) + + if l:search_pos != [0, 0] + let l:column = l:search_pos[1] + let l:end_column = l:column + len(l:cword) - 1 + endif + endif + elseif mode() is# 'v' || mode() is# "\" + " You need to get the start and end in a different way when you're in + " visual mode. + let [l:line, l:column] = getpos('v')[1:2] + let [l:end_line, l:end_column] = getpos('.')[1:2] + else + let [l:line, l:column] = getpos("'<")[1:2] + let [l:end_line, l:end_column] = getpos("'>")[1:2] + endif + + let l:column = min([l:column, len(getline(l:line))]) + let l:end_column = min([l:end_column, len(getline(l:end_line))]) + + let l:Callback = function( + \ 's:OnReady', [l:line, l:column, l:end_line, l:end_column, a:MenuCallback] + \) + + call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback) +endfunction + +function! ale#codefix#Execute(range, ...) abort + if a:0 > 1 + throw 'Too many arguments' + endif + + let l:MenuCallback = get(a:000, 0, v:null) + let l:lsp_linters = [] + + for l:linter in ale#linter#Get(&filetype) + if !empty(l:linter.lsp) + call add(l:lsp_linters, l:linter) + endif + endfor + + if empty(l:lsp_linters) + if l:MenuCallback is v:null + call s:message('No active LSPs') + else + call l:MenuCallback({}, []) + endif + + return + endif + + for l:lsp_linter in l:lsp_linters + call s:ExecuteGetCodeFix(l:lsp_linter, a:range, l:MenuCallback) + endfor +endfunction diff --git a/sources_non_forked/ale/autoload/ale/command.vim b/sources_non_forked/ale/autoload/ale/command.vim index 33ce577c..c9dc8d94 100644 --- a/sources_non_forked/ale/autoload/ale/command.vim +++ b/sources_non_forked/ale/autoload/ale/command.vim @@ -7,6 +7,9 @@ if !exists('s:buffer_data') let s:buffer_data = {} endif +" The regular expression used for formatting filenames with modifiers. +let s:path_format_regex = '\v\%s(%(:h|:t|:r|:e)*)' + " Used to get the data in tests. function! ale#command#GetData() abort return deepcopy(s:buffer_data) @@ -26,6 +29,19 @@ function! ale#command#InitData(buffer) abort endif endfunction +" Set the cwd for commands that are about to run. +" Used internally. +function! ale#command#SetCwd(buffer, cwd) abort + call ale#command#InitData(a:buffer) + let s:buffer_data[a:buffer].cwd = a:cwd +endfunction + +function! ale#command#ResetCwd(buffer) abort + if has_key(s:buffer_data, a:buffer) + let s:buffer_data[a:buffer].cwd = v:null + endif +endfunction + function! ale#command#ManageFile(buffer, file) abort call ale#command#InitData(a:buffer) call add(s:buffer_data[a:buffer].file_list, a:file) @@ -133,14 +149,62 @@ function! ale#command#EscapeCommandPart(command_part) abort return substitute(a:command_part, '%', '%%', 'g') endfunction +" Format a filename, converting it with filename mappings, if non-empty, +" and escaping it for putting into a command string. +" +" The filename can be modified. +function! s:FormatFilename(filename, mappings, modifiers) abort + let l:filename = a:filename + + if !empty(a:mappings) + let l:filename = ale#filename_mapping#Map(l:filename, a:mappings) + endif + + if !empty(a:modifiers) + let l:filename = fnamemodify(l:filename, a:modifiers) + endif + + return ale#Escape(l:filename) +endfunction + +" Produce a command prefix to check to a particular directory for a command. +" %s format markers with filename-modifiers can be used as the directory, and +" will be returned verbatim for formatting in paths relative to files. +function! ale#command#CdString(directory) abort + let l:match = matchstrpos(a:directory, s:path_format_regex) + " Do not escape the directory here if it's a valid format string. + " This allows us to use sequences like %s:h, %s:h:h, etc. + let l:directory = l:match[1:] == [0, len(a:directory)] + \ ? a:directory + \ : ale#Escape(a:directory) + + if has('win32') + return 'cd /d ' . l:directory . ' && ' + endif + + return 'cd ' . l:directory . ' && ' +endfunction + " Given a command string, replace every... " %s -> with the current filename " %t -> with the name of an unused file in a temporary directory " %% -> with a literal % -function! ale#command#FormatCommand(buffer, executable, command, pipe_file_if_needed, input) abort +function! ale#command#FormatCommand( +\ buffer, +\ executable, +\ command, +\ pipe_file_if_needed, +\ input, +\ cwd, +\ mappings, +\) abort let l:temporary_file = '' let l:command = a:command + if !empty(a:cwd) + let l:command = ale#command#CdString(a:cwd) . l:command + endif + " First replace all uses of %%, used for literal percent characters, " with an ugly string. let l:command = substitute(l:command, '%%', '<>', 'g') @@ -154,14 +218,24 @@ function! ale#command#FormatCommand(buffer, executable, command, pipe_file_if_ne " file. if l:command =~# '%s' let l:filename = fnamemodify(bufname(a:buffer), ':p') - let l:command = substitute(l:command, '%s', '\=ale#Escape(l:filename)', 'g') + let l:command = substitute( + \ l:command, + \ s:path_format_regex, + \ '\=s:FormatFilename(l:filename, a:mappings, submatch(1))', + \ 'g' + \) endif if a:input isnot v:false && l:command =~# '%t' " Create a temporary filename, / " The file itself will not be created by this function. let l:temporary_file = s:TemporaryFilename(a:buffer) - let l:command = substitute(l:command, '%t', '\=ale#Escape(l:temporary_file)', 'g') + let l:command = substitute( + \ l:command, + \ '\v\%t(%(:h|:t|:r|:e)*)', + \ '\=s:FormatFilename(l:temporary_file, a:mappings, submatch(1))', + \ 'g' + \) endif " Finish formatting so %% becomes %. @@ -244,9 +318,16 @@ function! s:ExitCallback(buffer, line_list, Callback, data) abort let l:result = a:data.result let l:result.value = l:value - if get(l:result, 'result_callback', v:null) isnot v:null - call call(l:result.result_callback, [l:value]) - endif + " Set the default cwd for this buffer in this call stack. + call ale#command#SetCwd(a:buffer, l:result.cwd) + + try + if get(l:result, 'result_callback', v:null) isnot v:null + call call(l:result.result_callback, [l:value]) + endif + finally + call ale#command#ResetCwd(a:buffer) + endtry endfunction function! ale#command#Run(buffer, command, Callback, ...) abort @@ -258,6 +339,13 @@ function! ale#command#Run(buffer, command, Callback, ...) abort let l:output_stream = get(l:options, 'output_stream', 'stdout') let l:line_list = [] + let l:cwd = get(l:options, 'cwd', v:null) + + if l:cwd is v:null + " Default the working directory to whatever it was for the last + " command run in the chain. + let l:cwd = get(get(s:buffer_data, a:buffer, {}), 'cwd', v:null) + endif let [l:temporary_file, l:command, l:file_created] = ale#command#FormatCommand( \ a:buffer, @@ -265,6 +353,8 @@ function! ale#command#Run(buffer, command, Callback, ...) abort \ a:command, \ get(l:options, 'read_buffer', 0), \ get(l:options, 'input', v:null), + \ l:cwd, + \ get(l:options, 'filename_mappings', []), \) let l:command = ale#job#PrepareCommand(a:buffer, l:command) let l:job_options = { @@ -329,30 +419,50 @@ function! ale#command#Run(buffer, command, Callback, ...) abort " " The `_deferred_job_id` is used for both checking the type of object, and " for checking the job ID and status. - let l:result = {'_deferred_job_id': l:job_id} + " + " The cwd is kept and used as the default value for the next command in + " the chain. + " + " The original command here is used in tests. + let l:result = { + \ '_deferred_job_id': l:job_id, + \ 'executable': get(l:options, 'executable', ''), + \ 'cwd': l:cwd, + \ 'command': a:command, + \} if get(g:, 'ale_run_synchronously') == 1 && l:job_id - " Run a command synchronously if this test option is set. - call extend(l:line_list, systemlist( - \ type(l:command) is v:t_list - \ ? join(l:command[0:1]) . ' ' . ale#Escape(l:command[2]) - \ : l:command - \)) - - " Don't capture output when the callbacks aren't set. - if !has_key(l:job_options, 'out_cb') - \&& !has_key(l:job_options, 'err_cb') - let l:line_list = [] - endif - if !exists('g:ale_run_synchronously_callbacks') let g:ale_run_synchronously_callbacks = [] endif - call add( - \ g:ale_run_synchronously_callbacks, - \ {-> l:job_options.exit_cb(l:job_id, v:shell_error)} - \) + if get(g:, 'ale_run_synchronously_emulate_commands', 0) + call add( + \ g:ale_run_synchronously_callbacks, + \ {exit_code, output -> [ + \ extend(l:line_list, output), + \ l:job_options.exit_cb(l:job_id, exit_code), + \ ]} + \) + else + " Run a command synchronously if this test option is set. + call extend(l:line_list, systemlist( + \ type(l:command) is v:t_list + \ ? join(l:command[0:1]) . ' ' . ale#Escape(l:command[2]) + \ : l:command + \)) + + " Don't capture output when the callbacks aren't set. + if !has_key(l:job_options, 'out_cb') + \&& !has_key(l:job_options, 'err_cb') + let l:line_list = [] + endif + + call add( + \ g:ale_run_synchronously_callbacks, + \ {-> l:job_options.exit_cb(l:job_id, v:shell_error)} + \) + endif endif return l:result diff --git a/sources_non_forked/ale/autoload/ale/completion.vim b/sources_non_forked/ale/autoload/ale/completion.vim index 682f4c43..e139feaa 100644 --- a/sources_non_forked/ale/autoload/ale/completion.vim +++ b/sources_non_forked/ale/autoload/ale/completion.vim @@ -1,10 +1,11 @@ " Author: w0rp " Description: Completion support for LSP linters +scriptencoding utf-8 " The omnicompletion menu is shown through a special Plug mapping which is " only valid in Insert mode. This way, feedkeys() won't send these keys if you " quit Insert mode quickly enough. -inoremap (ale_show_completion_menu) +inoremap (ale_show_completion_menu) " If we hit the key sequence in normal mode, then we won't show the menu, so " we should restore the old settings right away. nnoremap (ale_show_completion_menu) :call ale#completion#RestoreCompletionOptions() @@ -15,29 +16,108 @@ onoremap (ale_show_completion_menu) let g:ale_completion_delay = get(g:, 'ale_completion_delay', 100) let g:ale_completion_excluded_words = get(g:, 'ale_completion_excluded_words', []) let g:ale_completion_max_suggestions = get(g:, 'ale_completion_max_suggestions', 50) +let g:ale_completion_autoimport = get(g:, 'ale_completion_autoimport', 0) +let g:ale_completion_tsserver_remove_warnings = get(g:, 'ale_completion_tsserver_remove_warnings', 0) let s:timer_id = -1 let s:last_done_pos = [] " CompletionItemKind values from the LSP protocol. -let s:LSP_COMPLETION_TEXT_KIND = 1 -let s:LSP_COMPLETION_METHOD_KIND = 2 -let s:LSP_COMPLETION_FUNCTION_KIND = 3 -let s:LSP_COMPLETION_CONSTRUCTOR_KIND = 4 -let s:LSP_COMPLETION_FIELD_KIND = 5 -let s:LSP_COMPLETION_VARIABLE_KIND = 6 -let s:LSP_COMPLETION_CLASS_KIND = 7 -let s:LSP_COMPLETION_INTERFACE_KIND = 8 -let s:LSP_COMPLETION_MODULE_KIND = 9 -let s:LSP_COMPLETION_PROPERTY_KIND = 10 -let s:LSP_COMPLETION_UNIT_KIND = 11 -let s:LSP_COMPLETION_VALUE_KIND = 12 -let s:LSP_COMPLETION_ENUM_KIND = 13 -let s:LSP_COMPLETION_KEYWORD_KIND = 14 -let s:LSP_COMPLETION_SNIPPET_KIND = 15 -let s:LSP_COMPLETION_COLOR_KIND = 16 -let s:LSP_COMPLETION_FILE_KIND = 17 -let s:LSP_COMPLETION_REFERENCE_KIND = 18 +let g:ale_lsp_types = { +\ 1: 'text', +\ 2: 'method', +\ 3: 'function', +\ 4: 'constructor', +\ 5: 'field', +\ 6: 'variable', +\ 7: 'class', +\ 8: 'interface', +\ 9: 'module', +\ 10: 'property', +\ 11: 'unit', +\ 12: 'value', +\ 13: 'enum', +\ 14: 'keyword', +\ 15: 'snippet', +\ 16: 'color', +\ 17: 'file', +\ 18: 'reference', +\ 19: 'folder', +\ 20: 'enum_member', +\ 21: 'constant', +\ 22: 'struct', +\ 23: 'event', +\ 24: 'operator', +\ 25: 'type_parameter', +\ } + +" from https://github.com/microsoft/TypeScript/blob/29becf05012bfa7ba20d50b0d16813971e46b8a6/lib/protocol.d.ts#L2472 +let g:ale_tsserver_types = { +\ 'warning': 'text', +\ 'keyword': 'keyword', +\ 'script': 'file', +\ 'module': 'module', +\ 'class': 'class', +\ 'local class': 'class', +\ 'interface': 'interface', +\ 'type': 'class', +\ 'enum': 'enum', +\ 'enum member': 'enum_member', +\ 'var': 'variable', +\ 'local var': 'variable', +\ 'function': 'function', +\ 'local function': 'function', +\ 'method': 'method', +\ 'getter': 'property', +\ 'setter': 'method', +\ 'property': 'property', +\ 'constructor': 'constructor', +\ 'call': 'method', +\ 'index': 'index', +\ 'construct': 'constructor', +\ 'parameter': 'parameter', +\ 'type parameter': 'type_parameter', +\ 'primitive type': 'unit', +\ 'label': 'text', +\ 'alias': 'class', +\ 'const': 'constant', +\ 'let': 'variable', +\ 'directory': 'folder', +\ 'external module name': 'text', +\ 'JSX attribute': 'parameter', +\ 'string': 'text' +\ } + +" For compatibility reasons, we only use built in VIM completion kinds +" See :help complete-items for Vim completion kinds +let g:ale_completion_symbols = get(g:, 'ale_completion_symbols', { +\ 'text': 'v', +\ 'method': 'f', +\ 'function': 'f', +\ 'constructor': 'f', +\ 'field': 'm', +\ 'variable': 'v', +\ 'class': 't', +\ 'interface': 't', +\ 'module': 'd', +\ 'property': 'm', +\ 'unit': 'v', +\ 'value': 'v', +\ 'enum': 't', +\ 'keyword': 'v', +\ 'snippet': 'v', +\ 'color': 'v', +\ 'file': 'v', +\ 'reference': 'v', +\ 'folder': 'v', +\ 'enum_member': 'm', +\ 'constant': 'm', +\ 'struct': 't', +\ 'event': 'v', +\ 'operator': 'f', +\ 'type_parameter': 'p', +\ '': 'v' +\ }) let s:LSP_INSERT_TEXT_FORMAT_PLAIN = 1 let s:LSP_INSERT_TEXT_FORMAT_SNIPPET = 2 @@ -52,6 +132,7 @@ let s:should_complete_map = { \ 'lisp': s:lisp_regex, \ 'typescript': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|''$|"$', \ 'rust': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$', +\ 'cpp': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$|-\>$', \} " Regular expressions for finding the start column to replace with completion. @@ -59,11 +140,13 @@ let s:omni_start_map = { \ '': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$', \} -" A map of exact characters for triggering LSP completions. +" A map of exact characters for triggering LSP completions. Do not forget to +" update self.input_patterns in ale.py in updating entries in this map. let s:trigger_character_map = { \ '': ['.'], \ 'typescript': ['.', '''', '"'], \ 'rust': ['.', '::'], +\ 'cpp': ['.', '::', '->'], \} function! s:GetFiletypeValue(map, filetype) abort @@ -105,7 +188,13 @@ function! ale#completion#GetTriggerCharacter(filetype, prefix) abort return '' endfunction -function! ale#completion#Filter(buffer, filetype, suggestions, prefix) abort +function! ale#completion#Filter( +\ buffer, +\ filetype, +\ suggestions, +\ prefix, +\ exact_prefix_match, +\) abort let l:excluded_words = ale#Var(a:buffer, 'completion_excluded_words') if empty(a:prefix) @@ -132,10 +221,17 @@ function! ale#completion#Filter(buffer, filetype, suggestions, prefix) abort " Dictionaries is accepted here. let l:word = type(l:item) is v:t_string ? l:item : l:item.word - " Add suggestions if the suggestion starts with a - " case-insensitive match for the prefix. - if l:word[: len(a:prefix) - 1] is? a:prefix - call add(l:filtered_suggestions, l:item) + if a:exact_prefix_match + " Add suggestions if the word is an exact match. + if l:word is# a:prefix + call add(l:filtered_suggestions, l:item) + endif + else + " Add suggestions if the suggestion starts with a + " case-insensitive match for the prefix. + if l:word[: len(a:prefix) - 1] is? a:prefix + call add(l:filtered_suggestions, l:item) + endif endif endfor endif @@ -158,7 +254,7 @@ function! ale#completion#Filter(buffer, filetype, suggestions, prefix) abort return l:filtered_suggestions endfunction -function! s:ReplaceCompletionOptions() abort +function! s:ReplaceCompletionOptions(source) abort " Remember the old omnifunc value, if there is one. " If we don't store an old one, we'll just never reset the option. " This will stop some random exceptions from appearing. @@ -166,20 +262,26 @@ function! s:ReplaceCompletionOptions() abort let b:ale_old_omnifunc = &l:omnifunc endif - let &l:omnifunc = 'ale#completion#OmniFunc' + let &l:omnifunc = 'ale#completion#AutomaticOmniFunc' - let l:info = get(b:, 'ale_completion_info', {}) - - if !get(l:info, 'manual') + if a:source is# 'ale-automatic' if !exists('b:ale_old_completeopt') let b:ale_old_completeopt = &l:completeopt endif - if &l:completeopt =~# 'preview' - let &l:completeopt = 'menu,menuone,preview,noselect,noinsert' - else - let &l:completeopt = 'menu,menuone,noselect,noinsert' - endif + let l:opt_list = split(&l:completeopt, ',') + " The menu and noinsert options must be set, or automatic completion + " will be annoying. + let l:new_opt_list = ['menu', 'menuone', 'noinsert'] + + " Permit some other completion options, provided users have set them. + for l:opt in ['preview', 'popup', 'noselect'] + if index(l:opt_list, l:opt) >= 0 + call add(l:new_opt_list, l:opt) + endif + endfor + + let &l:completeopt = join(l:new_opt_list, ',') endif endfunction @@ -199,64 +301,159 @@ function! ale#completion#RestoreCompletionOptions() abort endif endfunction -function! ale#completion#OmniFunc(findstart, base) abort +function! ale#completion#GetCompletionPosition() abort + if !exists('b:ale_completion_info') + return 0 + endif + + let l:line = b:ale_completion_info.line + let l:column = b:ale_completion_info.column + let l:regex = s:GetFiletypeValue(s:omni_start_map, &filetype) + let l:up_to_column = getline(l:line)[: l:column - 2] + let l:match = matchstr(l:up_to_column, l:regex) + + return l:column - len(l:match) - 1 +endfunction + +function! ale#completion#GetCompletionPositionForDeoplete(input) abort + return match(a:input, '\k*$') +endfunction + +function! ale#completion#GetCompletionResult() abort + if exists('b:ale_completion_result') + return b:ale_completion_result + endif + + return v:null +endfunction + +function! ale#completion#AutomaticOmniFunc(findstart, base) abort if a:findstart - let l:line = b:ale_completion_info.line - let l:column = b:ale_completion_info.column - let l:regex = s:GetFiletypeValue(s:omni_start_map, &filetype) - let l:up_to_column = getline(l:line)[: l:column - 2] - let l:match = matchstr(l:up_to_column, l:regex) - - return l:column - len(l:match) - 1 + return ale#completion#GetCompletionPosition() else - " Parse a new response if there is one. - if exists('b:ale_completion_response') - \&& exists('b:ale_completion_parser') - let l:response = b:ale_completion_response - let l:parser = b:ale_completion_parser + let l:result = ale#completion#GetCompletionResult() - unlet b:ale_completion_response - unlet b:ale_completion_parser + let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '') - let b:ale_completion_result = function(l:parser)(l:response) + if l:source is# 'ale-automatic' || l:source is# 'ale-manual' + call s:ReplaceCompletionOptions(l:source) endif - call s:ReplaceCompletionOptions() - - return get(b:, 'ale_completion_result', []) + return l:result isnot v:null ? l:result : [] endif endfunction -function! ale#completion#Show(response, completion_parser) abort - if ale#util#Mode() isnot# 'i' +function! s:OpenCompletionMenu(...) abort + if !&l:paste + call ale#util#FeedKeys("\(ale_show_completion_menu)") + endif +endfunction + +function! ale#completion#Show(result) abort + let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '') + + if ale#util#Mode() isnot# 'i' && l:source isnot# 'ale-import' return endif - " Set the list in the buffer, temporarily replace omnifunc with our - " function, and then start omni-completion. - let b:ale_completion_response = a:response - let b:ale_completion_parser = a:completion_parser - " Replace completion options shortly before opening the menu. - call s:ReplaceCompletionOptions() + " Set the list in the buffer. + let b:ale_completion_result = a:result - call timer_start(0, {-> ale#util#FeedKeys("\(ale_show_completion_menu)")}) + " Don't try to open the completion menu if there's nothing to show. + if empty(b:ale_completion_result) + if l:source is# 'ale-import' + " If we ran completion from :ALEImport, + " tell the user that nothing is going to happen. + call s:message('No possible imports found.') + endif + + return + endif + + " Replace completion options shortly before opening the menu. + if l:source is# 'ale-automatic' || l:source is# 'ale-manual' + call s:ReplaceCompletionOptions(l:source) + + call timer_start(0, function('s:OpenCompletionMenu')) + endif + + if l:source is# 'ale-callback' + call b:CompleteCallback(b:ale_completion_result) + endif + + if l:source is# 'ale-import' + call ale#completion#HandleUserData(b:ale_completion_result[0]) + + let l:text_changed = '' . g:ale_lint_on_text_changed + + " Check the buffer again right away, if linting is enabled. + if g:ale_enabled + \&& ( + \ l:text_changed is# '1' + \ || l:text_changed is# 'always' + \ || l:text_changed is# 'normal' + \ || l:text_changed is# 'insert' + \) + call ale#Queue(0, '') + endif + endif +endfunction + +function! ale#completion#GetAllTriggers() abort + return deepcopy(s:trigger_character_map) +endfunction + +function! ale#completion#GetCompletionKind(kind) abort + let l:lsp_symbol = get(g:ale_lsp_types, a:kind, '') + + if !empty(l:lsp_symbol) + return l:lsp_symbol + endif + + return get(g:ale_tsserver_types, a:kind, '') +endfunction + +function! ale#completion#GetCompletionSymbols(kind) abort + let l:kind = ale#completion#GetCompletionKind(a:kind) + let l:symbol = get(g:ale_completion_symbols, l:kind, '') + + if !empty(l:symbol) + return l:symbol + endif + + return get(g:ale_completion_symbols, '', 'v') endfunction function! s:CompletionStillValid(request_id) abort let [l:line, l:column] = getpos('.')[1:2] - return ale#util#Mode() is# 'i' - \&& has_key(b:, 'ale_completion_info') + return has_key(b:, 'ale_completion_info') + \&& ( + \ ale#util#Mode() is# 'i' + \ || b:ale_completion_info.source is# 'ale-import' + \) \&& b:ale_completion_info.request_id == a:request_id \&& b:ale_completion_info.line == l:line - \&& b:ale_completion_info.column == l:column + \&& ( + \ b:ale_completion_info.column == l:column + \ || b:ale_completion_info.source is# 'ale-omnifunc' + \ || b:ale_completion_info.source is# 'ale-callback' + \ || b:ale_completion_info.source is# 'ale-import' + \) endfunction function! ale#completion#ParseTSServerCompletions(response) abort let l:names = [] for l:suggestion in a:response.body - call add(l:names, l:suggestion.name) + let l:kind = get(l:suggestion, 'kind', '') + + if g:ale_completion_tsserver_remove_warnings == 0 || l:kind isnot# 'warning' + call add(l:names, { + \ 'word': l:suggestion.name, + \ 'source': get(l:suggestion, 'source', ''), + \}) + endif endfor return l:names @@ -266,11 +463,26 @@ function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort let l:buffer = bufnr('') let l:results = [] let l:names_with_details = [] + let l:info = get(b:, 'ale_completion_info', {}) for l:suggestion in a:response.body let l:displayParts = [] + let l:local_name = v:null + + for l:action in get(l:suggestion, 'codeActions', []) + call add(l:displayParts, l:action.description . ' ') + endfor for l:part in l:suggestion.displayParts + " Stop on stop on line breaks for the menu. + if get(l:part, 'kind') is# 'lineBreak' + break + endif + + if get(l:part, 'kind') is# 'localName' + let l:local_name = l:part.text + endif + call add(l:displayParts, l:part.text) endfor @@ -281,22 +493,37 @@ function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort call add(l:documentationParts, l:part.text) endfor - if l:suggestion.kind is# 'className' - let l:kind = 'f' - elseif l:suggestion.kind is# 'parameterName' - let l:kind = 'f' - else - let l:kind = 'v' - endif - " See :help complete-items - call add(l:results, { - \ 'word': l:suggestion.name, - \ 'kind': l:kind, + let l:result = { + \ 'word': ( + \ l:suggestion.name is# 'default' + \ && l:suggestion.kind is# 'alias' + \ && !empty(l:local_name) + \ ? l:local_name + \ : l:suggestion.name + \ ), + \ 'kind': ale#completion#GetCompletionSymbols(l:suggestion.kind), \ 'icase': 1, \ 'menu': join(l:displayParts, ''), + \ 'dup': get(l:info, 'additional_edits_only', 0) + \ || g:ale_completion_autoimport, \ 'info': join(l:documentationParts, ''), - \}) + \} + " This flag is used to tell if this completion came from ALE or not. + let l:user_data = {'_ale_completion_item': 1} + + if has_key(l:suggestion, 'codeActions') + let l:user_data.code_actions = l:suggestion.codeActions + endif + + let l:result.user_data = json_encode(l:user_data) + + " Include this item if we'll accept any items, + " or if we only want items with additional edits, and this has them. + if !get(l:info, 'additional_edits_only', 0) + \|| has_key(l:user_data, 'code_actions') + call add(l:results, l:result) + endif endfor let l:names = getbufvar(l:buffer, 'ale_tsserver_completion_names', []) @@ -305,16 +532,17 @@ function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort let l:names_with_details = map(copy(l:results), 'v:val.word') let l:missing_names = filter( \ copy(l:names), - \ 'index(l:names_with_details, v:val) < 0', + \ 'index(l:names_with_details, v:val.word) < 0', \) for l:name in l:missing_names call add(l:results, { - \ 'word': l:name, + \ 'word': l:name.word, \ 'kind': 'v', \ 'icase': 1, \ 'menu': '', \ 'info': '', + \ 'user_data': json_encode({'_ale_completion_item': 1}), \}) endfor endif @@ -356,6 +584,8 @@ function! ale#completion#ParseLSPCompletions(response) abort if get(l:item, 'insertTextFormat') is s:LSP_INSERT_TEXT_FORMAT_PLAIN \&& type(get(l:item, 'textEdit')) is v:t_dict let l:text = l:item.textEdit.newText + elseif type(get(l:item, 'insertText')) is v:t_string + let l:text = l:item.insertText else let l:text = l:item.label endif @@ -366,21 +596,14 @@ function! ale#completion#ParseLSPCompletions(response) abort continue endif - " See :help complete-items for Vim completion kinds - if !has_key(l:item, 'kind') - let l:kind = 'v' - elseif l:item.kind is s:LSP_COMPLETION_METHOD_KIND - let l:kind = 'm' - elseif l:item.kind is s:LSP_COMPLETION_CONSTRUCTOR_KIND - let l:kind = 'm' - elseif l:item.kind is s:LSP_COMPLETION_FUNCTION_KIND - let l:kind = 'f' - elseif l:item.kind is s:LSP_COMPLETION_CLASS_KIND - let l:kind = 'f' - elseif l:item.kind is s:LSP_COMPLETION_INTERFACE_KIND - let l:kind = 'f' - else - let l:kind = 'v' + " Don't use LSP items with additional text edits when autoimport for + " completions is turned off. + if !empty(get(l:item, 'additionalTextEdits')) + \&& !( + \ get(l:info, 'additional_edits_only', 0) + \ || g:ale_completion_autoimport + \) + continue endif let l:doc = get(l:item, 'documentation', '') @@ -389,17 +612,70 @@ function! ale#completion#ParseLSPCompletions(response) abort let l:doc = l:doc.value endif - call add(l:results, { + " Collapse whitespaces and line breaks into a single space. + let l:detail = substitute(get(l:item, 'detail', ''), '\_s\+', ' ', 'g') + + let l:result = { \ 'word': l:word, - \ 'kind': l:kind, + \ 'kind': ale#completion#GetCompletionSymbols(get(l:item, 'kind', '')), \ 'icase': 1, - \ 'menu': get(l:item, 'detail', ''), + \ 'menu': l:detail, + \ 'dup': get(l:info, 'additional_edits_only', 0) + \ || g:ale_completion_autoimport, \ 'info': (type(l:doc) is v:t_string ? l:doc : ''), - \}) + \} + " This flag is used to tell if this completion came from ALE or not. + let l:user_data = {'_ale_completion_item': 1} + + if has_key(l:item, 'additionalTextEdits') + \ && l:item.additionalTextEdits isnot v:null + let l:text_changes = [] + + for l:edit in l:item.additionalTextEdits + call add(l:text_changes, { + \ 'start': { + \ 'line': l:edit.range.start.line + 1, + \ 'offset': l:edit.range.start.character + 1, + \ }, + \ 'end': { + \ 'line': l:edit.range.end.line + 1, + \ 'offset': l:edit.range.end.character + 1, + \ }, + \ 'newText': l:edit.newText, + \}) + endfor + + if !empty(l:text_changes) + let l:user_data.code_actions = [{ + \ 'description': 'completion', + \ 'changes': [ + \ { + \ 'fileName': expand('#' . l:buffer . ':p'), + \ 'textChanges': l:text_changes, + \ }, + \ ], + \}] + endif + endif + + let l:result.user_data = json_encode(l:user_data) + + " Include this item if we'll accept any items, + " or if we only want items with additional edits, and this has them. + if !get(l:info, 'additional_edits_only', 0) + \|| has_key(l:user_data, 'code_actions') + call add(l:results, l:result) + endif endfor if has_key(l:info, 'prefix') - let l:results = ale#completion#Filter(l:buffer, &filetype, l:results, l:info.prefix) + let l:results = ale#completion#Filter( + \ l:buffer, + \ &filetype, + \ l:results, + \ l:info.prefix, + \ get(l:info, 'additional_edits_only', 0), + \) endif return l:results[: g:ale_completion_max_suggestions - 1] @@ -423,27 +699,47 @@ function! ale#completion#HandleTSServerResponse(conn_id, response) abort \ &filetype, \ ale#completion#ParseTSServerCompletions(a:response), \ b:ale_completion_info.prefix, + \ get(b:ale_completion_info, 'additional_edits_only', 0), \)[: g:ale_completion_max_suggestions - 1] " We need to remember some names for tsserver, as it doesn't send " details back for everything we send. call setbufvar(l:buffer, 'ale_tsserver_completion_names', l:names) - if !empty(l:names) + if empty(l:names) + " Response with no results now and skip making a redundant request + " for nothing. + call ale#completion#Show([]) + else + let l:identifiers = [] + + for l:name in l:names + let l:identifier = { + \ 'name': l:name.word, + \} + let l:source = get(l:name, 'source', '') + + " Empty source results in no details for the completed item + if !empty(l:source) + call extend(l:identifier, { 'source': l:source }) + endif + + call add(l:identifiers, l:identifier) + endfor + let b:ale_completion_info.request_id = ale#lsp#Send( \ b:ale_completion_info.conn_id, \ ale#lsp#tsserver_message#CompletionEntryDetails( \ l:buffer, \ b:ale_completion_info.line, \ b:ale_completion_info.column, - \ l:names, + \ l:identifiers, \ ), \) endif elseif l:command is# 'completionEntryDetails' call ale#completion#Show( - \ a:response, - \ 'ale#completion#ParseTSServerCompletionEntryDetails', + \ ale#completion#ParseTSServerCompletionEntryDetails(a:response), \) endif endfunction @@ -455,8 +751,7 @@ function! ale#completion#HandleLSPResponse(conn_id, response) abort endif call ale#completion#Show( - \ a:response, - \ 'ale#completion#ParseLSPCompletions', + \ ale#completion#ParseLSPCompletions(a:response), \) endfunction @@ -480,11 +775,17 @@ function! s:OnReady(linter, lsp_details) abort call ale#lsp#RegisterCallback(l:id, l:Callback) if a:linter.lsp is# 'tsserver' + if get(g:, 'ale_completion_tsserver_autoimport') is 1 + execute 'echom `g:ale_completion_tsserver_autoimport` is deprecated. Use `g:ale_completion_autoimport` instead.''' + endif + let l:message = ale#lsp#tsserver_message#Completions( \ l:buffer, \ b:ale_completion_info.line, \ b:ale_completion_info.column, \ b:ale_completion_info.prefix, + \ get(b:ale_completion_info, 'additional_edits_only', 0) + \ || g:ale_completion_autoimport, \) else " Send a message saying the buffer has changed first, otherwise @@ -497,10 +798,7 @@ function! s:OnReady(linter, lsp_details) abort let l:message = ale#lsp#message#Completion( \ l:buffer, \ b:ale_completion_info.line, - \ min([ - \ b:ale_completion_info.line_length, - \ b:ale_completion_info.column, - \ ]) + 1, + \ b:ale_completion_info.column, \ ale#completion#GetTriggerCharacter(&filetype, b:ale_completion_info.prefix), \) endif @@ -517,15 +815,51 @@ function! s:OnReady(linter, lsp_details) abort endif endfunction +" This function can be called to check if ALE can provide completion data for +" the current buffer. 1 will be returned if there's a potential source of +" completion data ALE can use, and 0 will be returned otherwise. +function! ale#completion#CanProvideCompletions() abort + for l:linter in ale#linter#Get(&filetype) + if !empty(l:linter.lsp) + return 1 + endif + endfor + + return 0 +endfunction + " This function can be used to manually trigger autocomplete, even when " g:ale_completion_enabled is set to false -function! ale#completion#GetCompletions(manual) abort - let [l:line, l:column] = getpos('.')[1:2] +function! ale#completion#GetCompletions(...) abort + let l:source = get(a:000, 0, '') + let l:options = get(a:000, 1, {}) - let l:prefix = ale#completion#GetPrefix(&filetype, l:line, l:column) + if len(a:000) > 2 + throw 'Too many arguments!' + endif - if !a:manual && empty(l:prefix) - return + let l:CompleteCallback = get(l:options, 'callback', v:null) + + if l:CompleteCallback isnot v:null + let b:CompleteCallback = l:CompleteCallback + endif + + if has_key(l:options, 'line') && has_key(l:options, 'column') + " Use a provided line and column, if given. + let l:line = l:options.line + let l:column = l:options.column + else + let [l:line, l:column] = getpos('.')[1:2] + endif + + if has_key(l:options, 'prefix') + let l:prefix = l:options.prefix + else + let l:prefix = ale#completion#GetPrefix(&filetype, l:line, l:column) + endif + + if l:source is# 'ale-automatic' && empty(l:prefix) + return 0 endif let l:line_length = len(getline('.')) @@ -537,21 +871,87 @@ function! ale#completion#GetCompletions(manual) abort \ 'prefix': l:prefix, \ 'conn_id': 0, \ 'request_id': 0, - \ 'manual': a:manual, + \ 'source': l:source, \} + unlet! b:ale_completion_result + + if has_key(l:options, 'additional_edits_only') + let b:ale_completion_info.additional_edits_only = + \ l:options.additional_edits_only + endif let l:buffer = bufnr('') let l:Callback = function('s:OnReady') + let l:started = 0 + for l:linter in ale#linter#Get(&filetype) if !empty(l:linter.lsp) - call ale#lsp_linter#StartLSP(l:buffer, l:linter, l:Callback) + if ale#lsp_linter#StartLSP(l:buffer, l:linter, l:Callback) + let l:started = 1 + endif endif endfor + + return l:started +endfunction + +function! s:message(message) abort + call ale#util#Execute('echom ' . string(a:message)) +endfunction + +" This function implements the :ALEImport command. +function! ale#completion#Import() abort + let l:word = expand('') + + if empty(l:word) + call s:message('Nothing to complete at cursor!') + + return + endif + + let [l:line, l:column] = getpos('.')[1:2] + let l:column = searchpos('\V' . escape(l:word, '/\'), 'bn', l:line)[1] + + if l:column isnot 0 + let l:started = ale#completion#GetCompletions('ale-import', { + \ 'line': l:line, + \ 'column': l:column, + \ 'prefix': l:word, + \ 'additional_edits_only': 1, + \}) + + if !l:started + call s:message('No completion providers are available.') + endif + endif +endfunction + +function! ale#completion#OmniFunc(findstart, base) abort + if a:findstart + let l:started = ale#completion#GetCompletions('ale-omnifunc') + + if !l:started + " This is the special value for cancelling completions silently. + " See :help complete-functions + return -3 + endif + + return ale#completion#GetCompletionPosition() + else + let l:result = ale#completion#GetCompletionResult() + + while l:result is v:null && !complete_check() + sleep 2ms + let l:result = ale#completion#GetCompletionResult() + endwhile + + return l:result isnot v:null ? l:result : [] + endif endfunction function! s:TimerHandler(...) abort - if !g:ale_completion_enabled + if !get(b:, 'ale_completion_enabled', g:ale_completion_enabled) return endif @@ -562,7 +962,7 @@ function! s:TimerHandler(...) abort " When running the timer callback, we have to be sure that the cursor " hasn't moved from where it was when we requested completions by typing. if s:timer_pos == [l:line, l:column] && ale#util#Mode() is# 'i' - call ale#completion#GetCompletions(0) + call ale#completion#GetCompletions('ale-automatic') endif endfunction @@ -576,7 +976,7 @@ function! ale#completion#StopTimer() abort endfunction function! ale#completion#Queue() abort - if !g:ale_completion_enabled + if !get(b:, 'ale_completion_enabled', g:ale_completion_enabled) return endif @@ -599,6 +999,31 @@ function! ale#completion#Queue() abort let s:timer_id = timer_start(g:ale_completion_delay, function('s:TimerHandler')) endfunction +function! ale#completion#HandleUserData(completed_item) abort + let l:user_data_json = get(a:completed_item, 'user_data', '') + let l:user_data = type(l:user_data_json) is v:t_dict + \ ? l:user_data_json + \ : ale#util#FuzzyJSONDecode(l:user_data_json, {}) + + if !has_key(l:user_data, '_ale_completion_item') + return + endif + + let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '') + + if l:source is# 'ale-automatic' + \|| l:source is# 'ale-manual' + \|| l:source is# 'ale-callback' + \|| l:source is# 'ale-import' + \|| l:source is# 'ale-omnifunc' + for l:code_action in get(l:user_data, 'code_actions', []) + call ale#code_action#HandleCodeAction(l:code_action, {}) + endfor + endif + + silent doautocmd User ALECompletePost +endfunction + function! ale#completion#Done() abort silent! pclose @@ -607,6 +1032,12 @@ function! ale#completion#Done() abort let s:last_done_pos = getpos('.')[1:2] endfunction +augroup ALECompletionActions + autocmd! + + autocmd CompleteDone * call ale#completion#HandleUserData(v:completed_item) +augroup END + function! s:Setup(enabled) abort augroup ALECompletionGroup autocmd! diff --git a/sources_non_forked/ale/autoload/ale/cursor.vim b/sources_non_forked/ale/autoload/ale/cursor.vim index eea8ffe6..e8478e93 100644 --- a/sources_non_forked/ale/autoload/ale/cursor.vim +++ b/sources_non_forked/ale/autoload/ale/cursor.vim @@ -9,7 +9,6 @@ let g:ale_echo_delay = get(g:, 'ale_echo_delay', 10) let g:ale_echo_msg_format = get(g:, 'ale_echo_msg_format', '%code: %%s') let s:cursor_timer = -1 -let s:last_pos = [0, 0, 0] function! ale#cursor#TruncatedEcho(original_message) abort let l:message = a:original_message @@ -25,7 +24,7 @@ function! ale#cursor#TruncatedEcho(original_message) abort let l:cursor_position = getpos('.') " The message is truncated and saved to the history. - setlocal shortmess+=T + silent! setlocal shortmess+=T try exec "norm! :echomsg l:message\n" @@ -39,6 +38,8 @@ function! ale#cursor#TruncatedEcho(original_message) abort endif exec 'echomsg l:message' + catch /E481/ + " Do nothing if running from a visual selection. endtry " Reset the cursor position if we moved off the end of the line. @@ -116,14 +117,18 @@ function! ale#cursor#EchoCursorWarningWithDelay() abort let l:pos = getpos('.')[0:2] + if !exists('w:last_pos') + let w:last_pos = [0, 0, 0] + endif + " Check the current buffer, line, and column number against the last " recorded position. If the position has actually changed, *then* " we should echo something. Otherwise we can end up doing processing " the echo message far too frequently. - if l:pos != s:last_pos + if l:pos != w:last_pos let l:delay = ale#Var(l:buffer, 'echo_delay') - let s:last_pos = l:pos + let w:last_pos = l:pos let s:cursor_timer = timer_start( \ l:delay, \ function('ale#cursor#EchoCursorWarning') @@ -137,11 +142,16 @@ function! s:ShowCursorDetailForItem(loc, options) abort let s:last_detailed_line = line('.') let l:message = get(a:loc, 'detail', a:loc.text) let l:lines = split(l:message, "\n") - call ale#preview#Show(l:lines, {'stay_here': l:stay_here}) - " Clear the echo message if we manually displayed details. - if !l:stay_here - execute 'echo' + if g:ale_floating_preview || g:ale_detail_to_floating_preview + call ale#floating_preview#Show(l:lines) + else + call ale#preview#Show(l:lines, {'stay_here': l:stay_here}) + + " Clear the echo message if we manually displayed details. + if !l:stay_here + execute 'echo' + endif endif endfunction diff --git a/sources_non_forked/ale/autoload/ale/debugging.vim b/sources_non_forked/ale/autoload/ale/debugging.vim index e4bf5e7e..efd52776 100644 --- a/sources_non_forked/ale/autoload/ale/debugging.vim +++ b/sources_non_forked/ale/autoload/ale/debugging.vim @@ -8,6 +8,7 @@ let s:global_variable_list = [ \ 'ale_completion_delay', \ 'ale_completion_enabled', \ 'ale_completion_max_suggestions', +\ 'ale_disable_lsp', \ 'ale_echo_cursor', \ 'ale_echo_msg_error_str', \ 'ale_echo_msg_format', @@ -28,16 +29,17 @@ let s:global_variable_list = [ \ 'ale_linter_aliases', \ 'ale_linters', \ 'ale_linters_explicit', +\ 'ale_linters_ignore', \ 'ale_list_vertical', \ 'ale_list_window_size', \ 'ale_loclist_msg_format', -\ 'ale_lsp_root', \ 'ale_max_buffer_history_size', \ 'ale_max_signs', \ 'ale_maximum_file_size', \ 'ale_open_list', \ 'ale_pattern_options', \ 'ale_pattern_options_enabled', +\ 'ale_root', \ 'ale_set_balloons', \ 'ale_set_highlights', \ 'ale_set_loclist', @@ -50,6 +52,7 @@ let s:global_variable_list = [ \ 'ale_sign_style_error', \ 'ale_sign_style_warning', \ 'ale_sign_warning', +\ 'ale_sign_highlight_linenrs', \ 'ale_statusline_format', \ 'ale_type_map', \ 'ale_use_global_executables', @@ -62,7 +65,7 @@ function! s:Echo(message) abort execute 'echo a:message' endfunction -function! s:GetLinterVariables(filetype, linter_names) abort +function! s:GetLinterVariables(filetype, exclude_linter_names) abort let l:variable_list = [] let l:filetype_parts = split(a:filetype, '\.') @@ -73,7 +76,7 @@ function! s:GetLinterVariables(filetype, linter_names) abort " Include matching variables. if !empty(l:match) \&& index(l:filetype_parts, l:match[1]) >= 0 - \&& index(a:linter_names, l:match[2]) >= 0 + \&& index(a:exclude_linter_names, l:match[2]) == -1 call add(l:variable_list, l:key) endif endfor @@ -195,6 +198,7 @@ function! s:EchoLSPErrorMessages(all_linter_names) abort endfunction function! ale#debugging#Info() abort + let l:buffer = bufnr('') let l:filetype = &filetype " We get the list of enabled linters for free by the above function. @@ -211,19 +215,30 @@ function! ale#debugging#Info() abort let l:all_names = map(copy(l:all_linters), 'v:val[''name'']') let l:enabled_names = map(copy(l:enabled_linters), 'v:val[''name'']') + let l:exclude_names = filter(copy(l:all_names), 'index(l:enabled_names, v:val) == -1') " Load linter variables to display " This must be done after linters are loaded. - let l:variable_list = s:GetLinterVariables(l:filetype, l:enabled_names) + let l:variable_list = s:GetLinterVariables(l:filetype, l:exclude_names) let l:fixers = ale#fix#registry#SuggestedFixers(l:filetype) let l:fixers = uniq(sort(l:fixers[0] + l:fixers[1])) let l:fixers_string = join(map(copy(l:fixers), '"\n " . v:val'), '') + let l:non_ignored_names = map( + \ copy(ale#linter#RemoveIgnored(l:buffer, l:filetype, l:enabled_linters)), + \ 'v:val[''name'']', + \) + let l:ignored_names = filter( + \ copy(l:enabled_names), + \ 'index(l:non_ignored_names, v:val) < 0' + \) + call s:Echo(' Current Filetype: ' . l:filetype) call s:Echo('Available Linters: ' . string(l:all_names)) call s:EchoLinterAliases(l:all_linters) call s:Echo(' Enabled Linters: ' . string(l:enabled_names)) + call s:Echo(' Ignored Linters: ' . string(l:ignored_names)) call s:Echo(' Suggested Fixers: ' . l:fixers_string) call s:Echo(' Linter Variables:') call s:Echo('') @@ -238,9 +253,13 @@ function! ale#debugging#Info() abort endfunction function! ale#debugging#InfoToClipboard() abort - redir => l:output - silent call ale#debugging#Info() - redir END + if !has('clipboard') + call s:Echo('clipboard not available. Try :ALEInfoToFile instead.') + + return + endif + + let l:output = execute('call ale#debugging#Info()') let @+ = l:output call s:Echo('ALEInfo copied to your clipboard') @@ -249,9 +268,7 @@ endfunction function! ale#debugging#InfoToFile(filename) abort let l:expanded_filename = expand(a:filename) - redir => l:output - silent call ale#debugging#Info() - redir END + let l:output = execute('call ale#debugging#Info()') call writefile(split(l:output, "\n"), l:expanded_filename) call s:Echo('ALEInfo written to ' . l:expanded_filename) diff --git a/sources_non_forked/ale/autoload/ale/definition.vim b/sources_non_forked/ale/autoload/ale/definition.vim index 521f0b45..9574017b 100644 --- a/sources_non_forked/ale/autoload/ale/definition.vim +++ b/sources_non_forked/ale/autoload/ale/definition.vim @@ -3,6 +3,10 @@ let s:go_to_definition_map = {} +" Enable automatic updates of the tagstack +let g:ale_update_tagstack = get(g:, 'ale_update_tagstack', 1) +let g:ale_default_navigation = get(g:, 'ale_default_navigation', 'buffer') + " Used to get the definition map in tests. function! ale#definition#GetMap() abort return deepcopy(s:go_to_definition_map) @@ -17,8 +21,22 @@ function! ale#definition#ClearLSPData() abort let s:go_to_definition_map = {} endfunction +function! ale#definition#UpdateTagStack() abort + let l:should_update_tagstack = exists('*gettagstack') && exists('*settagstack') && g:ale_update_tagstack + + if l:should_update_tagstack + " Grab the old location (to jump back to) and the word under the + " cursor (as a label for the tagstack) + let l:old_location = [bufnr('%'), line('.'), col('.'), 0] + let l:tagname = expand('') + let l:winid = win_getid() + call settagstack(l:winid, {'items': [{'from': l:old_location, 'tagname': l:tagname}]}, 'a') + call settagstack(l:winid, {'curidx': len(gettagstack(l:winid)['items']) + 1}) + endif +endfunction + function! ale#definition#HandleTSServerResponse(conn_id, response) abort - if get(a:response, 'command', '') is# 'definition' + if has_key(a:response, 'request_seq') \&& has_key(s:go_to_definition_map, a:response.request_seq) let l:options = remove(s:go_to_definition_map, a:response.request_seq) @@ -27,6 +45,7 @@ function! ale#definition#HandleTSServerResponse(conn_id, response) abort let l:line = a:response.body[0].start.line let l:column = a:response.body[0].start.offset + call ale#definition#UpdateTagStack() call ale#util#Open(l:filename, l:line, l:column, l:options) endif endif @@ -47,10 +66,19 @@ function! ale#definition#HandleLSPResponse(conn_id, response) abort endif for l:item in l:result - let l:filename = ale#path#FromURI(l:item.uri) - let l:line = l:item.range.start.line + 1 - let l:column = l:item.range.start.character + 1 + if has_key(l:item, 'targetUri') + " LocationLink items use targetUri + let l:filename = ale#path#FromURI(l:item.targetUri) + let l:line = l:item.targetRange.start.line + 1 + let l:column = l:item.targetRange.start.character + 1 + else + " LocationLink items use uri + let l:filename = ale#path#FromURI(l:item.uri) + let l:line = l:item.range.start.line + 1 + let l:column = l:item.range.start.character + 1 + endif + call ale#definition#UpdateTagStack() call ale#util#Open(l:filename, l:line, l:column, l:options) break endfor @@ -72,11 +100,19 @@ function! s:OnReady(line, column, options, capability, linter, lsp_details) abor call ale#lsp#RegisterCallback(l:id, l:Callback) if a:linter.lsp is# 'tsserver' - let l:message = ale#lsp#tsserver_message#Definition( - \ l:buffer, - \ a:line, - \ a:column - \) + if a:capability is# 'definition' + let l:message = ale#lsp#tsserver_message#Definition( + \ l:buffer, + \ a:line, + \ a:column + \) + elseif a:capability is# 'typeDefinition' + let l:message = ale#lsp#tsserver_message#TypeDefinition( + \ l:buffer, + \ a:line, + \ a:column + \) + endif else " Send a message saying the buffer has changed first, or the " definition position probably won't make sense. @@ -125,13 +161,37 @@ endfunction function! ale#definition#GoToType(options) abort for l:linter in ale#linter#Get(&filetype) if !empty(l:linter.lsp) - " TODO: handle typeDefinition for tsserver if supported by the - " protocol - if l:linter.lsp is# 'tsserver' - continue - endif - call s:GoToLSPDefinition(l:linter, a:options, 'typeDefinition') endif endfor endfunction + +function! ale#definition#GoToCommandHandler(command, ...) abort + let l:options = {} + + if len(a:000) > 0 + for l:option in a:000 + if l:option is? '-tab' + let l:options.open_in = 'tab' + elseif l:option is? '-split' + let l:options.open_in = 'split' + elseif l:option is? '-vsplit' + let l:options.open_in = 'vsplit' + endif + endfor + endif + + if !has_key(l:options, 'open_in') + let l:default_navigation = ale#Var(bufnr(''), 'default_navigation') + + if index(['tab', 'split', 'vsplit'], l:default_navigation) >= 0 + let l:options.open_in = l:default_navigation + endif + endif + + if a:command is# 'type' + call ale#definition#GoToType(l:options) + else + call ale#definition#GoTo(l:options) + endif +endfunction diff --git a/sources_non_forked/ale/autoload/ale/dhall.vim b/sources_non_forked/ale/autoload/ale/dhall.vim new file mode 100644 index 00000000..cc54418f --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/dhall.vim @@ -0,0 +1,24 @@ +" Author: Pat Brisbin , toastal +" Description: Functions for working with Dhallโ€™s executable + +call ale#Set('dhall_executable', 'dhall') +call ale#Set('dhall_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('dhall_options', '') + +function! ale#dhall#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'dhall_executable') + + " Dhall is written in Haskell and commonly installed with Stack + return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'dhall') +endfunction + +function! ale#dhall#GetExecutableWithOptions(buffer) abort + let l:executable = ale#dhall#GetExecutable(a:buffer) + + return l:executable + \ . ale#Pad(ale#Var(a:buffer, 'dhall_options')) +endfunction + +function! ale#dhall#GetCommand(buffer) abort + return '%e ' . ale#Pad(ale#Var(a:buffer, 'dhall_options')) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/engine.vim b/sources_non_forked/ale/autoload/ale/engine.vim index 340f6913..5b9b1fca 100644 --- a/sources_non_forked/ale/autoload/ale/engine.vim +++ b/sources_non_forked/ale/autoload/ale/engine.vim @@ -4,6 +4,7 @@ " Remapping of linter problems. let g:ale_type_map = get(g:, 'ale_type_map', {}) +let g:ale_filename_mappings = get(g:, 'ale_filename_mappings', {}) if !has_key(s:, 'executable_cache_map') let s:executable_cache_map = {} @@ -39,8 +40,8 @@ function! ale#engine#MarkLinterActive(info, linter) abort endif endfunction -function! ale#engine#MarkLinterInactive(info, linter) abort - call filter(a:info.active_linter_list, 'v:val.name isnot# a:linter.name') +function! ale#engine#MarkLinterInactive(info, linter_name) abort + call filter(a:info.active_linter_list, 'v:val.name isnot# a:linter_name') endfunction function! ale#engine#ResetExecutableCache() abort @@ -104,30 +105,6 @@ function! ale#engine#IsCheckingBuffer(buffer) abort \ || !empty(get(l:info, 'active_other_sources_list', [])) endfunction -" Register a temporary file to be managed with the ALE engine for -" a current job run. -function! ale#engine#ManageFile(buffer, filename) abort - " TODO: Emit deprecation warning here later. - call ale#command#ManageFile(a:buffer, a:filename) -endfunction - -" Same as the above, but manage an entire directory. -function! ale#engine#ManageDirectory(buffer, directory) abort - " TODO: Emit deprecation warning here later. - call ale#command#ManageDirectory(a:buffer, a:directory) -endfunction - -function! ale#engine#CreateFile(buffer) abort - " TODO: Emit deprecation warning here later. - return ale#command#CreateFile(a:buffer) -endfunction - -" Create a new temporary directory and manage it in one go. -function! ale#engine#CreateDirectory(buffer) abort - " TODO: Emit deprecation warning here later. - return ale#command#CreateDirectory(a:buffer) -endfunction - function! ale#engine#HandleLoclist(linter_name, buffer, loclist, from_other_source) abort let l:info = get(g:ale_buffer_info, a:buffer, {}) @@ -180,10 +157,9 @@ function! s:HandleExit(job_info, buffer, output, data) abort let l:linter = a:job_info.linter let l:executable = a:job_info.executable - let l:next_chain_index = a:job_info.next_chain_index " Remove this job from the list. - call ale#engine#MarkLinterInactive(l:buffer_info, l:linter) + call ale#engine#MarkLinterInactive(l:buffer_info, l:linter.name) " Stop here if we land in the handle for a job completing if we're in " a sandbox. @@ -195,20 +171,6 @@ function! s:HandleExit(job_info, buffer, output, data) abort call remove(a:output, -1) endif - if l:next_chain_index < len(get(l:linter, 'command_chain', [])) - let [l:command, l:options] = ale#engine#ProcessChain( - \ a:buffer, - \ l:executable, - \ l:linter, - \ l:next_chain_index, - \ a:output, - \) - - call s:RunJob(l:command, l:options) - - return - endif - try let l:loclist = ale#util#GetFunction(l:linter.callback)(a:buffer, a:output) " Handle the function being unknown, or being deleted. @@ -295,6 +257,13 @@ function! s:RemapItemTypes(type_map, loclist) abort endfunction function! ale#engine#FixLocList(buffer, linter_name, from_other_source, loclist) abort + let l:mappings = ale#GetFilenameMappings(a:buffer, a:linter_name) + + if !empty(l:mappings) + " We need to apply reverse filename mapping here. + let l:mappings = ale#filename_mapping#Invert(l:mappings) + endif + let l:bufnr_map = {} let l:new_loclist = [] @@ -335,13 +304,19 @@ function! ale#engine#FixLocList(buffer, linter_name, from_other_source, loclist) let l:item.code = l:old_item.code endif - if has_key(l:old_item, 'filename') - \&& !ale#path#IsTempName(l:old_item.filename) + let l:old_name = get(l:old_item, 'filename', '') + + " Map parsed from output to local filesystem files. + if !empty(l:old_name) && !empty(l:mappings) + let l:old_name = ale#filename_mapping#Map(l:old_name, l:mappings) + endif + + if !empty(l:old_name) && !ale#path#IsTempName(l:old_name) " Use the filename given. " Temporary files are assumed to be for this buffer, " and the filename is not included then, because it looks bad " in the loclist window. - let l:filename = l:old_item.filename + let l:filename = l:old_name let l:item.filename = l:filename if has_key(l:old_item, 'bufnr') @@ -438,24 +413,25 @@ function! s:RunJob(command, options) abort return 0 endif + let l:cwd = a:options.cwd let l:executable = a:options.executable let l:buffer = a:options.buffer let l:linter = a:options.linter let l:output_stream = a:options.output_stream - let l:next_chain_index = a:options.next_chain_index - let l:read_buffer = a:options.read_buffer + let l:read_buffer = a:options.read_buffer && !a:options.lint_file let l:info = g:ale_buffer_info[l:buffer] let l:Callback = function('s:HandleExit', [{ \ 'linter': l:linter, \ 'executable': l:executable, - \ 'next_chain_index': l:next_chain_index, \}]) let l:result = ale#command#Run(l:buffer, l:command, l:Callback, { + \ 'cwd': l:cwd, \ 'output_stream': l:output_stream, \ 'executable': l:executable, \ 'read_buffer': l:read_buffer, - \ 'log_output': l:next_chain_index >= len(get(l:linter, 'command_chain', [])), + \ 'log_output': 1, + \ 'filename_mappings': ale#GetFilenameMappings(l:buffer, l:linter.name), \}) " Only proceed if the job is being run. @@ -470,69 +446,7 @@ function! s:RunJob(command, options) abort return 1 endfunction -" Determine which commands to run for a link in a command chain, or -" just a regular command. -function! ale#engine#ProcessChain(buffer, executable, linter, chain_index, input) abort - let l:output_stream = get(a:linter, 'output_stream', 'stdout') - let l:read_buffer = a:linter.read_buffer - let l:chain_index = a:chain_index - let l:input = a:input - - while l:chain_index < len(a:linter.command_chain) - " Run a chain of commands, one asynchronous command after the other, - " so that many programs can be run in a sequence. - let l:chain_item = a:linter.command_chain[l:chain_index] - - if l:chain_index == 0 - " The first callback in the chain takes only a buffer number. - let l:command = ale#util#GetFunction(l:chain_item.callback)( - \ a:buffer - \) - else - " The second callback in the chain takes some input too. - let l:command = ale#util#GetFunction(l:chain_item.callback)( - \ a:buffer, - \ l:input - \) - endif - - " If we have a command to run, execute that. - if !empty(l:command) - " The chain item can override the output_stream option. - if has_key(l:chain_item, 'output_stream') - let l:output_stream = l:chain_item.output_stream - endif - - " The chain item can override the read_buffer option. - if has_key(l:chain_item, 'read_buffer') - let l:read_buffer = l:chain_item.read_buffer - elseif l:chain_index != len(a:linter.command_chain) - 1 - " Don't read the buffer for commands besides the last one - " in the chain by default. - let l:read_buffer = 0 - endif - - break - endif - - " Command chain items can return an empty string to indicate that - " a command should be skipped, so we should try the next item - " with no input. - let l:input = [] - let l:chain_index += 1 - endwhile - - return [l:command, { - \ 'executable': a:executable, - \ 'buffer': a:buffer, - \ 'linter': a:linter, - \ 'output_stream': l:output_stream, - \ 'next_chain_index': l:chain_index + 1, - \ 'read_buffer': l:read_buffer, - \}] -endfunction - -function! s:StopCurrentJobs(buffer, clear_lint_file_jobs) abort +function! s:StopCurrentJobs(buffer, clear_lint_file_jobs, linter_slots) abort let l:info = get(g:ale_buffer_info, a:buffer, {}) call ale#command#StopJobs(a:buffer, 'linter') @@ -541,11 +455,25 @@ function! s:StopCurrentJobs(buffer, clear_lint_file_jobs) abort call ale#command#StopJobs(a:buffer, 'file_linter') let l:info.active_linter_list = [] else + let l:lint_file_map = {} + + " Use a previously computed map of `lint_file` values to find + " linters that are used for linting files. + for [l:lint_file, l:linter] in a:linter_slots + if l:lint_file is 1 + let l:lint_file_map[l:linter.name] = 1 + endif + endfor + " Keep jobs for linting files when we're only linting buffers. - call filter(l:info.active_linter_list, 'get(v:val, ''lint_file'')') + call filter(l:info.active_linter_list, 'get(l:lint_file_map, v:val.name)') endif endfunction +function! ale#engine#Stop(buffer) abort + call s:StopCurrentJobs(a:buffer, 1, []) +endfunction + function! s:RemoveProblemsForDisabledLinters(buffer, linters) abort " Figure out which linters are still enabled, and remove " problems for linters which are no longer enabled. @@ -596,10 +524,15 @@ function! s:AddProblemsFromOtherBuffers(buffer, linters) abort endif endfunction -function! s:RunIfExecutable(buffer, linter, executable) abort +function! s:RunIfExecutable(buffer, linter, lint_file, executable) abort if ale#command#IsDeferred(a:executable) let a:executable.result_callback = { - \ executable -> s:RunIfExecutable(a:buffer, a:linter, executable) + \ executable -> s:RunIfExecutable( + \ a:buffer, + \ a:linter, + \ a:lint_file, + \ executable + \ ) \} return 1 @@ -607,29 +540,31 @@ function! s:RunIfExecutable(buffer, linter, executable) abort if ale#engine#IsExecutable(a:buffer, a:executable) " Use different job types for file or linter jobs. - let l:job_type = a:linter.lint_file ? 'file_linter' : 'linter' + let l:job_type = a:lint_file ? 'file_linter' : 'linter' call setbufvar(a:buffer, 'ale_job_type', l:job_type) - if has_key(a:linter, 'command_chain') - let [l:command, l:options] = ale#engine#ProcessChain( - \ a:buffer, - \ a:executable, - \ a:linter, - \ 0, - \ [] - \) + " Get the cwd for the linter and set it before we call GetCommand. + " This will ensure that ale#command#Run uses it by default. + let l:cwd = ale#linter#GetCwd(a:buffer, a:linter) - return s:RunJob(l:command, l:options) + if l:cwd isnot v:null + call ale#command#SetCwd(a:buffer, l:cwd) endif let l:command = ale#linter#GetCommand(a:buffer, a:linter) + + if l:cwd isnot v:null + call ale#command#ResetCwd(a:buffer) + endif + let l:options = { + \ 'cwd': l:cwd, \ 'executable': a:executable, \ 'buffer': a:buffer, \ 'linter': a:linter, \ 'output_stream': get(a:linter, 'output_stream', 'stdout'), - \ 'next_chain_index': 1, \ 'read_buffer': a:linter.read_buffer, + \ 'lint_file': a:lint_file, \} return s:RunJob(l:command, l:options) @@ -641,22 +576,73 @@ endfunction " Run a linter for a buffer. " " Returns 1 if the linter was successfully run. -function! s:RunLinter(buffer, linter) abort +function! s:RunLinter(buffer, linter, lint_file) abort if !empty(a:linter.lsp) return ale#lsp_linter#CheckWithLSP(a:buffer, a:linter) else let l:executable = ale#linter#GetExecutable(a:buffer, a:linter) - return s:RunIfExecutable(a:buffer, a:linter, l:executable) + return s:RunIfExecutable(a:buffer, a:linter, a:lint_file, l:executable) endif return 0 endfunction -function! ale#engine#RunLinters(buffer, linters, should_lint_file) abort - " Initialise the buffer information if needed. - let l:new_buffer = ale#engine#InitBufferInfo(a:buffer) - call s:StopCurrentJobs(a:buffer, a:should_lint_file) +function! s:GetLintFileSlots(buffer, linters) abort + let l:linter_slots = [] + + for l:linter in a:linters + let l:LintFile = l:linter.lint_file + + if type(l:LintFile) is v:t_func + let l:LintFile = l:LintFile(a:buffer) + endif + + call add(l:linter_slots, [l:LintFile, l:linter]) + endfor + + return l:linter_slots +endfunction + +function! s:GetLintFileValues(slots, Callback) abort + let l:deferred_list = [] + let l:new_slots = [] + + for [l:lint_file, l:linter] in a:slots + while ale#command#IsDeferred(l:lint_file) && has_key(l:lint_file, 'value') + " If we've already computed the return value, use it. + let l:lint_file = l:lint_file.value + endwhile + + if ale#command#IsDeferred(l:lint_file) + " If we are going to return the result later, wait for it. + call add(l:deferred_list, l:lint_file) + else + " If we have the value now, coerce it to 0 or 1. + let l:lint_file = l:lint_file is 1 + endif + + call add(l:new_slots, [l:lint_file, l:linter]) + endfor + + if !empty(l:deferred_list) + for l:deferred in l:deferred_list + let l:deferred.result_callback = + \ {-> s:GetLintFileValues(l:new_slots, a:Callback)} + endfor + else + call a:Callback(l:new_slots) + endif +endfunction + +function! s:RunLinters( +\ buffer, +\ linters, +\ slots, +\ should_lint_file, +\ new_buffer, +\) abort + call s:StopCurrentJobs(a:buffer, a:should_lint_file, a:slots) call s:RemoveProblemsForDisabledLinters(a:buffer, a:linters) " We can only clear the results if we aren't checking the buffer. @@ -664,10 +650,10 @@ function! ale#engine#RunLinters(buffer, linters, should_lint_file) abort silent doautocmd User ALELintPre - for l:linter in a:linters + for [l:lint_file, l:linter] in a:slots " Only run lint_file linters if we should. - if !l:linter.lint_file || a:should_lint_file - if s:RunLinter(a:buffer, l:linter) + if !l:lint_file || a:should_lint_file + if s:RunLinter(a:buffer, l:linter, l:lint_file) " If a single linter ran, we shouldn't clear everything. let l:can_clear_results = 0 endif @@ -682,11 +668,32 @@ function! ale#engine#RunLinters(buffer, linters, should_lint_file) abort " disabled, or ALE itself is disabled. if l:can_clear_results call ale#engine#SetResults(a:buffer, []) - elseif l:new_buffer - call s:AddProblemsFromOtherBuffers(a:buffer, a:linters) + elseif a:new_buffer + call s:AddProblemsFromOtherBuffers( + \ a:buffer, + \ map(copy(a:slots), 'v:val[1]') + \) endif endfunction +function! ale#engine#RunLinters(buffer, linters, should_lint_file) abort + " Initialise the buffer information if needed. + let l:new_buffer = ale#engine#InitBufferInfo(a:buffer) + + call s:GetLintFileValues( + \ s:GetLintFileSlots(a:buffer, a:linters), + \ { + \ slots -> s:RunLinters( + \ a:buffer, + \ a:linters, + \ slots, + \ a:should_lint_file, + \ l:new_buffer, + \ ) + \ } + \) +endfunction + " Clean up a buffer. " " This function will stop all current jobs for the buffer, @@ -698,6 +705,10 @@ function! ale#engine#Cleanup(buffer) abort return endif + if exists('*ale#lsp#CloseDocument') + call ale#lsp#CloseDocument(a:buffer) + endif + if !has_key(g:ale_buffer_info, a:buffer) return endif diff --git a/sources_non_forked/ale/autoload/ale/engine/ignore.vim b/sources_non_forked/ale/autoload/ale/engine/ignore.vim index 2db2c6c1..80574656 100644 --- a/sources_non_forked/ale/autoload/ale/engine/ignore.vim +++ b/sources_non_forked/ale/autoload/ale/engine/ignore.vim @@ -22,7 +22,7 @@ function! ale#engine#ignore#GetList(filetype, config) abort endfunction " Given a List of linter descriptions, exclude the linters to be ignored. -function! ale#engine#ignore#Exclude(filetype, all_linters, config) abort +function! ale#engine#ignore#Exclude(filetype, all_linters, config, disable_lsp) abort let l:names_to_remove = ale#engine#ignore#GetList(a:filetype, a:config) let l:filtered_linters = [] @@ -37,6 +37,10 @@ function! ale#engine#ignore#Exclude(filetype, all_linters, config) abort endif endfor + if a:disable_lsp && has_key(l:linter, 'lsp') && l:linter.lsp isnot# '' + let l:should_include = 0 + endif + if l:should_include call add(l:filtered_linters, l:linter) endif diff --git a/sources_non_forked/ale/autoload/ale/events.vim b/sources_non_forked/ale/autoload/ale/events.vim index c3dbd378..3568c117 100644 --- a/sources_non_forked/ale/autoload/ale/events.vim +++ b/sources_non_forked/ale/autoload/ale/events.vim @@ -105,11 +105,11 @@ function! ale#events#Init() abort if g:ale_enabled if l:text_changed is? 'always' || l:text_changed is# '1' - autocmd TextChanged,TextChangedI * call ale#Queue(g:ale_lint_delay) + autocmd TextChanged,TextChangedI * call ale#Queue(ale#Var(str2nr(expand('')), 'lint_delay')) elseif l:text_changed is? 'normal' - autocmd TextChanged * call ale#Queue(g:ale_lint_delay) + autocmd TextChanged * call ale#Queue(ale#Var(str2nr(expand('')), 'lint_delay')) elseif l:text_changed is? 'insert' - autocmd TextChangedI * call ale#Queue(g:ale_lint_delay) + autocmd TextChangedI * call ale#Queue(ale#Var(str2nr(expand('')), 'lint_delay')) endif if g:ale_lint_on_enter @@ -128,7 +128,7 @@ function! ale#events#Init() abort endif if g:ale_lint_on_insert_leave - autocmd InsertLeave * call ale#Queue(0) + autocmd InsertLeave * if ale#Var(str2nr(expand('')), 'lint_on_insert_leave') | call ale#Queue(0) | endif endif if g:ale_echo_cursor || g:ale_cursor_detail @@ -147,6 +147,10 @@ function! ale#events#Init() abort autocmd InsertLeave * if exists('*ale#engine#Cleanup') | call ale#virtualtext#ShowCursorWarning() | endif endif + if g:ale_hover_cursor + autocmd CursorHold * if exists('*ale#lsp#Send') | call ale#hover#ShowTruncatedMessageAtCursor() | endif + endif + if g:ale_close_preview_on_insert autocmd InsertEnter * if exists('*ale#preview#CloseIfTypeMatches') | call ale#preview#CloseIfTypeMatches('ale-preview') | endif endif diff --git a/sources_non_forked/ale/autoload/ale/filename_mapping.vim b/sources_non_forked/ale/autoload/ale/filename_mapping.vim new file mode 100644 index 00000000..76d47acc --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/filename_mapping.vim @@ -0,0 +1,22 @@ +" Author: w0rp +" Description: Logic for handling mappings between files + +" Invert filesystem mappings so they can be mapped in reverse. +function! ale#filename_mapping#Invert(filename_mappings) abort + return map(copy(a:filename_mappings), '[v:val[1], v:val[0]]') +endfunction + +" Given a filename and some filename_mappings, map a filename. +function! ale#filename_mapping#Map(filename, filename_mappings) abort + let l:simplified_filename = ale#path#Simplify(a:filename) + + for [l:mapping_from, l:mapping_to] in a:filename_mappings + let l:mapping_from = ale#path#Simplify(l:mapping_from) + + if l:simplified_filename[:len(l:mapping_from) - 1] is# l:mapping_from + return l:mapping_to . l:simplified_filename[len(l:mapping_from):] + endif + endfor + + return a:filename +endfunction diff --git a/sources_non_forked/ale/autoload/ale/filetypes.vim b/sources_non_forked/ale/autoload/ale/filetypes.vim index 6cdc9ece..340a9c4e 100644 --- a/sources_non_forked/ale/autoload/ale/filetypes.vim +++ b/sources_non_forked/ale/autoload/ale/filetypes.vim @@ -4,9 +4,7 @@ function! ale#filetypes#LoadExtensionMap() abort " Output includes: " '*.erl setf erlang' - redir => l:output - silent exec 'autocmd' - redir end + let l:output = execute('exec "autocmd"') let l:map = {} diff --git a/sources_non_forked/ale/autoload/ale/fix.vim b/sources_non_forked/ale/autoload/ale/fix.vim index b8674606..8ebba9fe 100644 --- a/sources_non_forked/ale/autoload/ale/fix.vim +++ b/sources_non_forked/ale/autoload/ale/fix.vim @@ -1,45 +1,47 @@ +" Author: w0rp +" Description: Functions for fixing code with programs, or other means. + +let g:ale_fix_on_save_ignore = get(g:, 'ale_fix_on_save_ignore', {}) +let g:ale_filename_mappings = get(g:, 'ale_filename_mappings', {}) + " Apply fixes queued up for buffers which may be hidden. " Vim doesn't let you modify hidden buffers. -function! ale#fix#ApplyQueuedFixes() abort - let l:buffer = bufnr('') - let l:data = get(g:ale_fix_buffer_data, l:buffer, {'done': 0}) +function! ale#fix#ApplyQueuedFixes(buffer) abort + let l:data = get(g:ale_fix_buffer_data, a:buffer, {'done': 0}) - if !l:data.done + if !l:data.done || (!ale#util#HasBuflineApi() && a:buffer isnot bufnr('')) return endif - call remove(g:ale_fix_buffer_data, l:buffer) + call remove(g:ale_fix_buffer_data, a:buffer) - if l:data.changes_made - let l:start_line = len(l:data.output) + 1 - let l:end_line = len(l:data.lines_before) + try + if l:data.changes_made + let l:new_lines = ale#util#SetBufferContents(a:buffer, l:data.output) - if l:end_line >= l:start_line - let l:save = winsaveview() - silent execute l:start_line . ',' . l:end_line . 'd_' - call winrestview(l:save) - endif - - " If the file is in DOS mode, we have to remove carriage returns from - " the ends of lines before calling setline(), or we will see them - " twice. - let l:lines_to_set = getbufvar(l:buffer, '&fileformat') is# 'dos' - \ ? map(copy(l:data.output), 'substitute(v:val, ''\r\+$'', '''', '''')') - \ : l:data.output - - call setline(1, l:lines_to_set) - - if l:data.should_save - if empty(&buftype) - noautocmd :w! - else - set nomodified + if l:data.should_save + if a:buffer is bufnr('') + if empty(&buftype) + noautocmd :w! + else + set nomodified + endif + else + call writefile(l:new_lines, expand('#' . a:buffer . ':p')) " no-custom-checks + call setbufvar(a:buffer, '&modified', 0) + endif endif endif - endif + catch /E21/ + " If we cannot modify the buffer now, try again later. + let g:ale_fix_buffer_data[a:buffer] = l:data + + return + endtry if l:data.should_save - let l:should_lint = g:ale_fix_on_save + let l:should_lint = ale#Var(a:buffer, 'fix_on_save') + \ && ale#Var(a:buffer, 'lint_on_save') else let l:should_lint = l:data.changes_made endif @@ -50,7 +52,7 @@ function! ale#fix#ApplyQueuedFixes() abort " fixing problems. if g:ale_enabled \&& l:should_lint - \&& !ale#events#QuitRecently(l:buffer) + \&& !ale#events#QuitRecently(a:buffer) call ale#Queue(0, l:data.should_save ? 'lint_file' : '') endif endfunction @@ -58,7 +60,7 @@ endfunction function! ale#fix#ApplyFixes(buffer, output) abort let l:data = g:ale_fix_buffer_data[a:buffer] let l:data.output = a:output - let l:data.changes_made = l:data.lines_before != l:data.output + let l:data.changes_made = l:data.lines_before !=# l:data.output " no-custom-checks let l:data.done = 1 call ale#command#RemoveManagedFiles(a:buffer) @@ -73,7 +75,10 @@ function! ale#fix#ApplyFixes(buffer, output) abort if l:data.lines_before != l:lines call remove(g:ale_fix_buffer_data, a:buffer) - execute 'echoerr ''The file was changed before fixing finished''' + + if !l:data.ignore_file_changed_errors + execute 'echoerr ''The file was changed before fixing finished''' + endif return endif @@ -81,7 +86,7 @@ function! ale#fix#ApplyFixes(buffer, output) abort " We can only change the lines of a buffer which is currently open, " so try and apply the fixes to the current buffer. - call ale#fix#ApplyQueuedFixes() + call ale#fix#ApplyQueuedFixes(a:buffer) endfunction function! s:HandleExit(job_info, buffer, job_output, data) abort @@ -99,7 +104,6 @@ function! s:HandleExit(job_info, buffer, job_output, data) abort let l:output = a:job_output endif - let l:ChainCallback = get(a:job_info, 'chain_with', v:null) let l:ProcessWith = get(a:job_info, 'process_with', v:null) " Post-process the output with a function if we have one. @@ -111,23 +115,17 @@ function! s:HandleExit(job_info, buffer, job_output, data) abort " otherwise skip this job and use the input from before. " " We'll use the input from before for chained commands. - if l:ChainCallback is v:null && !empty(split(join(l:output))) + if !empty(split(join(l:output))) let l:input = l:output else let l:input = a:job_info.input endif - let l:next_index = l:ChainCallback is v:null - \ ? a:job_info.callback_index + 1 - \ : a:job_info.callback_index - call s:RunFixer({ \ 'buffer': a:buffer, \ 'input': l:input, - \ 'output': l:output, \ 'callback_list': a:job_info.callback_list, - \ 'callback_index': l:next_index, - \ 'chain_callback': l:ChainCallback, + \ 'callback_index': a:job_info.callback_index + 1, \}) endfunction @@ -140,6 +138,7 @@ function! s:RunJob(result, options) abort let l:buffer = a:options.buffer let l:input = a:options.input + let l:fixer_name = a:options.fixer_name if a:result is 0 || type(a:result) is v:t_list if type(a:result) is v:t_list @@ -157,27 +156,23 @@ function! s:RunJob(result, options) abort endif let l:command = get(a:result, 'command', '') - let l:ChainWith = get(a:result, 'chain_with', v:null) if empty(l:command) - " If the command is empty, skip to the next item, or call the - " chain_with function. + " If the command is empty, skip to the next item. call s:RunFixer({ \ 'buffer': l:buffer, \ 'input': l:input, - \ 'callback_index': a:options.callback_index + (l:ChainWith is v:null), + \ 'callback_index': a:options.callback_index, \ 'callback_list': a:options.callback_list, - \ 'chain_callback': l:ChainWith, - \ 'output': [], \}) return endif let l:read_temporary_file = get(a:result, 'read_temporary_file', 0) - " Default to piping the buffer for the last fixer in the chain. - let l:read_buffer = get(a:result, 'read_buffer', l:ChainWith is v:null) + let l:read_buffer = get(a:result, 'read_buffer', 1) let l:output_stream = get(a:result, 'output_stream', 'stdout') + let l:cwd = get(a:result, 'cwd', v:null) if l:read_temporary_file let l:output_stream = 'none' @@ -185,7 +180,6 @@ function! s:RunJob(result, options) abort let l:Callback = function('s:HandleExit', [{ \ 'input': l:input, - \ 'chain_with': l:ChainWith, \ 'callback_index': a:options.callback_index, \ 'callback_list': a:options.callback_list, \ 'process_with': get(a:result, 'process_with', v:null), @@ -197,6 +191,8 @@ function! s:RunJob(result, options) abort \ 'read_buffer': l:read_buffer, \ 'input': l:input, \ 'log_output': 0, + \ 'cwd': l:cwd, + \ 'filename_mappings': ale#GetFilenameMappings(l:buffer, l:fixer_name), \}) if empty(l:run_result) @@ -220,32 +216,22 @@ function! s:RunFixer(options) abort return endif - let l:ChainCallback = get(a:options, 'chain_callback', v:null) - - let l:Function = l:ChainCallback isnot v:null - \ ? ale#util#GetFunction(l:ChainCallback) - \ : a:options.callback_list[l:index] + let [l:fixer_name, l:Function] = a:options.callback_list[l:index] " Record new jobs started as fixer jobs. call setbufvar(l:buffer, 'ale_job_type', 'fixer') - if l:ChainCallback isnot v:null - " Chained commands accept (buffer, output, [input]) - let l:result = ale#util#FunctionArgCount(l:Function) == 2 - \ ? call(l:Function, [l:buffer, a:options.output]) - \ : call(l:Function, [l:buffer, a:options.output, copy(l:input)]) - else - " Regular fixer commands accept (buffer, [input]) - let l:result = ale#util#FunctionArgCount(l:Function) == 1 - \ ? call(l:Function, [l:buffer]) - \ : call(l:Function, [l:buffer, copy(l:input)]) - endif + " Regular fixer commands accept (buffer, [input]) + let l:result = ale#util#FunctionArgCount(l:Function) == 1 + \ ? call(l:Function, [l:buffer]) + \ : call(l:Function, [l:buffer, copy(l:input)]) call s:RunJob(l:result, { \ 'buffer': l:buffer, \ 'input': l:input, \ 'callback_list': a:options.callback_list, \ 'callback_index': l:index, + \ 'fixer_name': l:fixer_name, \}) endfunction @@ -261,7 +247,21 @@ function! s:AddSubCallbacks(full_list, callbacks) abort return 1 endfunction -function! s:GetCallbacks(buffer, fixers) abort +function! s:IgnoreFixers(callback_list, filetype, config) abort + if type(a:config) is v:t_list + let l:ignore_list = a:config + else + let l:ignore_list = [] + + for l:part in split(a:filetype , '\.') + call extend(l:ignore_list, get(a:config, l:part, [])) + endfor + endif + + call filter(a:callback_list, 'index(l:ignore_list, v:val) < 0') +endfunction + +function! s:GetCallbacks(buffer, fixing_flag, fixers) abort if len(a:fixers) let l:callback_list = a:fixers elseif type(get(b:, 'ale_fixers')) is v:t_list @@ -286,8 +286,12 @@ function! s:GetCallbacks(buffer, fixers) abort endif endif - if empty(l:callback_list) - return [] + if a:fixing_flag is# 'save_file' + let l:config = ale#Var(a:buffer, 'fix_on_save_ignore') + + if !empty(l:config) + call s:IgnoreFixers(l:callback_list, &filetype, l:config) + endif endif let l:corrected_list = [] @@ -295,16 +299,24 @@ function! s:GetCallbacks(buffer, fixers) abort " Variables with capital characters are needed, or Vim will complain about " funcref variables. for l:Item in l:callback_list + " Try to capture the names of registered fixer names, so we can use + " them for filename mapping or other purposes later. + let l:fixer_name = v:null + if type(l:Item) is v:t_string let l:Func = ale#fix#registry#GetFunc(l:Item) if !empty(l:Func) + let l:fixer_name = l:Item let l:Item = l:Func endif endif try - call add(l:corrected_list, ale#util#GetFunction(l:Item)) + call add(l:corrected_list, [ + \ l:fixer_name, + \ ale#util#GetFunction(l:Item) + \]) catch /E475/ " Rethrow exceptions for failing to get a function so we can print " a friendly message about it. @@ -322,6 +334,7 @@ function! ale#fix#InitBufferData(buffer, fixing_flag) abort \ 'lines_before': getbufline(a:buffer, 1, '$'), \ 'done': 0, \ 'should_save': a:fixing_flag is# 'save_file', + \ 'ignore_file_changed_errors': a:fixing_flag is# '!', \ 'temporary_directory_list': [], \} endfunction @@ -330,19 +343,23 @@ endfunction " " Returns 0 if no fixes can be applied, and 1 if fixing can be done. function! ale#fix#Fix(buffer, fixing_flag, ...) abort - if a:fixing_flag isnot# '' && a:fixing_flag isnot# 'save_file' - throw "fixing_flag must be either '' or 'save_file'" + if a:fixing_flag isnot# '' + \&& a:fixing_flag isnot# '!' + \&& a:fixing_flag isnot# 'save_file' + throw "fixing_flag must be '', '!', or 'save_file'" endif try - let l:callback_list = s:GetCallbacks(a:buffer, a:000) + let l:callback_list = s:GetCallbacks(a:buffer, a:fixing_flag, a:000) catch /E700\|BADNAME/ - let l:function_name = join(split(split(v:exception, ':')[3])) - let l:echo_message = printf( - \ 'There is no fixer named `%s`. Check :ALEFixSuggest', - \ l:function_name, - \) - execute 'echom l:echo_message' + if a:fixing_flag isnot# '!' + let l:function_name = join(split(split(v:exception, ':')[3])) + let l:echo_message = printf( + \ 'There is no fixer named `%s`. Check :ALEFixSuggest', + \ l:function_name, + \) + execute 'echom l:echo_message' + endif return 0 endtry @@ -375,5 +392,5 @@ endfunction " Set up an autocmd command to try and apply buffer fixes when available. augroup ALEBufferFixGroup autocmd! - autocmd BufEnter * call ale#fix#ApplyQueuedFixes() + autocmd BufEnter * call ale#fix#ApplyQueuedFixes(str2nr(expand(''))) augroup END diff --git a/sources_non_forked/ale/autoload/ale/fix/registry.vim b/sources_non_forked/ale/autoload/ale/fix/registry.vim index 7118c44a..c6764daf 100644 --- a/sources_non_forked/ale/autoload/ale/fix/registry.vim +++ b/sources_non_forked/ale/autoload/ale/fix/registry.vim @@ -12,6 +12,16 @@ let s:default_registry = { \ 'suggested_filetypes': ['help'], \ 'description': 'Align help tags to the right margin', \ }, +\ 'autoimport': { +\ 'function': 'ale#fixers#autoimport#Fix', +\ 'suggested_filetypes': ['python'], +\ 'description': 'Fix import issues with autoimport.', +\ }, +\ 'autoflake': { +\ 'function': 'ale#fixers#autoflake#Fix', +\ 'suggested_filetypes': ['python'], +\ 'description': 'Fix flake issues with autoflake.', +\ }, \ 'autopep8': { \ 'function': 'ale#fixers#autopep8#Fix', \ 'suggested_filetypes': ['python'], @@ -27,6 +37,47 @@ let s:default_registry = { \ 'suggested_filetypes': ['python'], \ 'description': 'Fix PEP8 issues with black.', \ }, +\ 'buildifier': { +\ 'function': 'ale#fixers#buildifier#Fix', +\ 'suggested_filetypes': ['bzl'], +\ 'description': 'Format BUILD and .bzl files with buildifier.', +\ }, +\ 'deno': { +\ 'function': 'ale#fixers#deno#Fix', +\ 'suggested_filetypes': ['typescript'], +\ 'description': 'Fix TypeScript using deno fmt.', +\ }, +\ 'dfmt': { +\ 'function': 'ale#fixers#dfmt#Fix', +\ 'suggested_filetypes': ['d'], +\ 'description': 'Fix D files with dfmt.', +\ }, +\ 'dhall': { +\ 'function': 'ale#fixers#dhall#Fix', +\ 'suggested_filetypes': ['dhall'], +\ 'description': 'Fix Dhall files with dhall-format.', +\ }, +\ 'dhall-format': { +\ 'function': 'ale#fixers#dhall_format#Fix', +\ 'suggested_filetypes': ['dhall'], +\ 'description': 'Standard code formatter for the Dhall language', +\ 'aliases': ['dhall'], +\ }, +\ 'dhall-freeze': { +\ 'function': 'ale#fixers#dhall_freeze#Freeze', +\ 'suggested_filetypes': ['dhall'], +\ 'description': 'Add integrity checks to remote import statements of an expression for the Dhall language', +\ }, +\ 'dhall-lint': { +\ 'function': 'ale#fixers#dhall_lint#Fix', +\ 'suggested_filetypes': ['dhall'], +\ 'description': 'Standard code formatter for the Dhall language and removing dead code', +\ }, +\ 'fecs': { +\ 'function': 'ale#fixers#fecs#Fix', +\ 'suggested_filetypes': ['javascript', 'css', 'html'], +\ 'description': 'Apply fecs format to a file.', +\ }, \ 'tidy': { \ 'function': 'ale#fixers#tidy#Fix', \ 'suggested_filetypes': ['html'], @@ -44,6 +95,16 @@ let s:default_registry = { \ 'description': 'Apply elm-format to a file.', \ 'aliases': ['format'], \ }, +\ 'nimpretty': { +\ 'function': 'ale#fixers#nimpretty#Fix', +\ 'suggested_filetypes': ['nim'], +\ 'description': 'Apply nimpretty to a file.', +\ }, +\ 'erblint': { +\ 'function': 'ale#fixers#erblint#Fix', +\ 'suggested_filetypes': ['eruby'], +\ 'description': 'Apply erblint --autocorrect to a file.', +\ }, \ 'eslint': { \ 'function': 'ale#fixers#eslint#Fix', \ 'suggested_filetypes': ['javascript', 'typescript'], @@ -61,7 +122,7 @@ let s:default_registry = { \ }, \ 'prettier': { \ 'function': 'ale#fixers#prettier#Fix', -\ 'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue', 'html', 'yaml'], +\ 'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue', 'svelte', 'html', 'yaml', 'openapi', 'ruby'], \ 'description': 'Apply prettier to a file.', \ }, \ 'prettier_eslint': { @@ -90,6 +151,11 @@ let s:default_registry = { \ 'suggested_filetypes': [], \ 'description': 'Remove all trailing whitespace characters at the end of every line.', \ }, +\ 'yamlfix': { +\ 'function': 'ale#fixers#yamlfix#Fix', +\ 'suggested_filetypes': ['yaml'], +\ 'description': 'Fix yaml files with yamlfix.', +\ }, \ 'yapf': { \ 'function': 'ale#fixers#yapf#Fix', \ 'suggested_filetypes': ['python'], @@ -107,9 +173,14 @@ let s:default_registry = { \ }, \ 'scalafmt': { \ 'function': 'ale#fixers#scalafmt#Fix', -\ 'suggested_filetypes': ['scala'], +\ 'suggested_filetypes': ['sbt', 'scala'], \ 'description': 'Fix Scala files using scalafmt', \ }, +\ 'sorbet': { +\ 'function': 'ale#fixers#sorbet#Fix', +\ 'suggested_filetypes': ['ruby'], +\ 'description': 'Fix ruby files with srb tc --autocorrect.', +\ }, \ 'standard': { \ 'function': 'ale#fixers#standard#Fix', \ 'suggested_filetypes': ['javascript'], @@ -130,6 +201,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['swift'], \ 'description': 'Apply SwiftFormat to a file.', \ }, +\ 'apple-swift-format': { +\ 'function': 'ale#fixers#appleswiftformat#Fix', +\ 'suggested_filetypes': ['swift'], +\ 'description': 'Apply apple/swift-format to a file.', +\ }, \ 'phpcbf': { \ 'function': 'ale#fixers#phpcbf#Fix', \ 'suggested_filetypes': ['php'], @@ -140,6 +216,16 @@ let s:default_registry = { \ 'suggested_filetypes': ['php'], \ 'description': 'Fix PHP files with php-cs-fixer.', \ }, +\ 'astyle': { +\ 'function': 'ale#fixers#astyle#Fix', +\ 'suggested_filetypes': ['c', 'cpp'], +\ 'description': 'Fix C/C++ with astyle.', +\ }, +\ 'clangtidy': { +\ 'function': 'ale#fixers#clangtidy#Fix', +\ 'suggested_filetypes': ['c', 'cpp', 'objc'], +\ 'description': 'Fix C/C++ and ObjectiveC files with clang-tidy.', +\ }, \ 'clang-format': { \ 'function': 'ale#fixers#clangformat#Fix', \ 'suggested_filetypes': ['c', 'cpp', 'cuda'], @@ -150,6 +236,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['cmake'], \ 'description': 'Fix CMake files with cmake-format.', \ }, +\ 'fish_indent': { +\ 'function': 'ale#fixers#fish_indent#Fix', +\ 'suggested_filetypes': ['fish'], +\ 'description': 'Format fish scripts using fish_indent.', +\ }, \ 'gofmt': { \ 'function': 'ale#fixers#gofmt#Fix', \ 'suggested_filetypes': ['go'], @@ -160,6 +251,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['go'], \ 'description': 'Fix Go files imports with goimports.', \ }, +\ 'golines': { +\ 'function': 'ale#fixers#golines#Fix', +\ 'suggested_filetypes': ['go'], +\ 'description': 'Fix Go file long lines with golines', +\ }, \ 'gomod': { \ 'function': 'ale#fixers#gomod#Fix', \ 'suggested_filetypes': ['gomod'], @@ -185,6 +281,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['hack'], \ 'description': 'Fix Hack files with hackfmt.', \ }, +\ 'floskell': { +\ 'function': 'ale#fixers#floskell#Fix', +\ 'suggested_filetypes': ['haskell'], +\ 'description': 'Fix Haskell files with floskell.', +\ }, \ 'hfmt': { \ 'function': 'ale#fixers#hfmt#Fix', \ 'suggested_filetypes': ['haskell'], @@ -195,6 +296,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['haskell'], \ 'description': 'Fix Haskell files with brittany.', \ }, +\ 'hindent': { +\ 'function': 'ale#fixers#hindent#Fix', +\ 'suggested_filetypes': ['haskell'], +\ 'description': 'Fix Haskell files with hindent.', +\ }, \ 'hlint': { \ 'function': 'ale#fixers#hlint#Fix', \ 'suggested_filetypes': ['haskell'], @@ -205,16 +311,36 @@ let s:default_registry = { \ 'suggested_filetypes': ['haskell'], \ 'description': 'Refactor Haskell files with stylish-haskell.', \ }, +\ 'purs-tidy': { +\ 'function': 'ale#fixers#purs_tidy#Fix', +\ 'suggested_filetypes': ['purescript'], +\ 'description': 'Format PureScript files with purs-tidy.', +\ }, +\ 'purty': { +\ 'function': 'ale#fixers#purty#Fix', +\ 'suggested_filetypes': ['purescript'], +\ 'description': 'Format PureScript files with purty.', +\ }, \ 'ocamlformat': { \ 'function': 'ale#fixers#ocamlformat#Fix', -\ 'suggested_filetypes': ['ocaml'], +\ 'suggested_filetypes': ['ocaml', 'ocamlinterface'], \ 'description': 'Fix OCaml files with ocamlformat.', \ }, +\ 'ocp-indent': { +\ 'function': 'ale#fixers#ocp_indent#Fix', +\ 'suggested_filetypes': ['ocaml', 'ocamlinterface'], +\ 'description': 'Fix OCaml files with ocp-indent.', +\ }, \ 'refmt': { \ 'function': 'ale#fixers#refmt#Fix', \ 'suggested_filetypes': ['reason'], \ 'description': 'Fix ReasonML files with refmt.', \ }, +\ 'pandoc': { +\ 'function': 'ale#fixers#pandoc#Fix', +\ 'suggested_filetypes': ['markdown'], +\ 'description': 'Fix markdown files with pandoc.', +\ }, \ 'shfmt': { \ 'function': 'ale#fixers#shfmt#Fix', \ 'suggested_filetypes': ['sh'], @@ -225,6 +351,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['sql'], \ 'description': 'Fix SQL files with sqlfmt.', \ }, +\ 'sqlformat': { +\ 'function': 'ale#fixers#sqlformat#Fix', +\ 'suggested_filetypes': ['sql'], +\ 'description': 'Fix SQL files with sqlformat.', +\ }, \ 'google_java_format': { \ 'function': 'ale#fixers#google_java_format#Fix', \ 'suggested_filetypes': ['java'], @@ -240,6 +371,11 @@ let s:default_registry = { \ 'suggested_filetypes': ['json'], \ 'description': 'Fix JSON files with jq.', \ }, +\ 'protolint': { +\ 'function': 'ale#fixers#protolint#Fix', +\ 'suggested_filetypes': ['proto'], +\ 'description': 'Fix Protocol Buffer files with protolint.', +\ }, \ 'perltidy': { \ 'function': 'ale#fixers#perltidy#Fix', \ 'suggested_filetypes': ['perl'], @@ -247,8 +383,8 @@ let s:default_registry = { \ }, \ 'xo': { \ 'function': 'ale#fixers#xo#Fix', -\ 'suggested_filetypes': ['javascript'], -\ 'description': 'Fix JavaScript files using xo --fix.', +\ 'suggested_filetypes': ['javascript', 'typescript'], +\ 'description': 'Fix JavaScript/TypeScript files using xo --fix.', \ }, \ 'qmlfmt': { \ 'function': 'ale#fixers#qmlfmt#Fix', @@ -260,6 +396,16 @@ let s:default_registry = { \ 'suggested_filetypes': ['dart'], \ 'description': 'Fix Dart files with dartfmt.', \ }, +\ 'dart-format': { +\ 'function': 'ale#fixers#dart_format#Fix', +\ 'suggested_filetypes': ['dart'], +\ 'description': 'Fix Dart files with dart format.', +\ }, +\ 'dotnet-format': { +\ 'function': 'ale#fixers#dotnet_format#Fix', +\ 'suggested_filetypes': ['cs'], +\ 'description': 'Fix C# files with dotnet format.', +\ }, \ 'xmllint': { \ 'function': 'ale#fixers#xmllint#Fix', \ 'suggested_filetypes': ['xml'], @@ -277,9 +423,89 @@ let s:default_registry = { \ }, \ 'ktlint': { \ 'function': 'ale#fixers#ktlint#Fix', -\ 'suggested_filetypes': ['kt'], +\ 'suggested_filetypes': ['kt', 'kotlin'], \ 'description': 'Fix Kotlin files with ktlint.', \ }, +\ 'styler': { +\ 'function': 'ale#fixers#styler#Fix', +\ 'suggested_filetypes': ['r', 'rmarkdown', 'rmd'], +\ 'description': 'Fix R files with styler.', +\ }, +\ 'latexindent': { +\ 'function': 'ale#fixers#latexindent#Fix', +\ 'suggested_filetypes': ['tex'], +\ 'description' : 'Indent code within environments, commands, after headings and within special code blocks.', +\ }, +\ 'pgformatter': { +\ 'function': 'ale#fixers#pgformatter#Fix', +\ 'suggested_filetypes': ['sql'], +\ 'description': 'A PostgreSQL SQL syntax beautifier', +\ }, +\ 'reorder-python-imports': { +\ 'function': 'ale#fixers#reorder_python_imports#Fix', +\ 'suggested_filetypes': ['python'], +\ 'description': 'Sort Python imports with reorder-python-imports.', +\ }, +\ 'gnatpp': { +\ 'function': 'ale#fixers#gnatpp#Fix', +\ 'suggested_filetypes': ['ada'], +\ 'description': 'Format Ada files with gnatpp.', +\ }, +\ 'nixfmt': { +\ 'function': 'ale#fixers#nixfmt#Fix', +\ 'suggested_filetypes': ['nix'], +\ 'description': 'A nix formatter written in Haskell.', +\ }, +\ 'nixpkgs-fmt': { +\ 'function': 'ale#fixers#nixpkgsfmt#Fix', +\ 'suggested_filetypes': ['nix'], +\ 'description': 'A formatter for Nix code', +\ }, +\ 'remark-lint': { +\ 'function': 'ale#fixers#remark_lint#Fix', +\ 'suggested_filetypes': ['markdown'], +\ 'description': 'Fix markdown files with remark-lint', +\ }, +\ 'html-beautify': { +\ 'function': 'ale#fixers#html_beautify#Fix', +\ 'suggested_filetypes': ['html', 'htmldjango'], +\ 'description': 'Fix HTML files with html-beautify.', +\ }, +\ 'lua-format': { +\ 'function': 'ale#fixers#lua_format#Fix', +\ 'suggested_filetypes': ['lua'], +\ 'description': 'Fix Lua files with lua-format.', +\ }, +\ 'luafmt': { +\ 'function': 'ale#fixers#luafmt#Fix', +\ 'suggested_filetypes': ['lua'], +\ 'description': 'Fix Lua files with luafmt.', +\ }, +\ 'stylua': { +\ 'function': 'ale#fixers#stylua#Fix', +\ 'suggested_filetypes': ['lua'], +\ 'description': 'Fix Lua files with stylua.', +\ }, +\ 'ormolu': { +\ 'function': 'ale#fixers#ormolu#Fix', +\ 'suggested_filetypes': ['haskell'], +\ 'description': 'A formatter for Haskell source code.', +\ }, +\ 'jsonnetfmt': { +\ 'function': 'ale#fixers#jsonnetfmt#Fix', +\ 'suggested_filetypes': ['jsonnet'], +\ 'description': 'Fix jsonnet files with jsonnetfmt', +\ }, +\ 'ptop': { +\ 'function': 'ale#fixers#ptop#Fix', +\ 'suggested_filetypes': ['pascal'], +\ 'description': 'Fix Pascal files with ptop.', +\ }, +\ 'vfmt': { +\ 'function': 'ale#fixers#vfmt#Fix', +\ 'suggested_filetypes': ['v'], +\ 'description': 'A formatter for V source code.', +\ } \} " Reset the function registry to the default entries. diff --git a/sources_non_forked/ale/autoload/ale/fixers/appleswiftformat.vim b/sources_non_forked/ale/autoload/ale/fixers/appleswiftformat.vim new file mode 100644 index 00000000..ca27e82c --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/appleswiftformat.vim @@ -0,0 +1,16 @@ +" Author: (bosr) +" Description: Integration of apple/swift-format formatter with ALE. + +function! ale#fixers#appleswiftformat#Fix(buffer) abort + let l:command_args = ale#swift#GetAppleSwiftFormatCommand(a:buffer) . ' format --in-place %t' + let l:config_args = ale#swift#GetAppleSwiftFormatConfigArgs(a:buffer) + + if l:config_args isnot# '' + let l:command_args = l:command_args . ' ' . l:config_args + endif + + return { + \ 'read_temporary_file': 1, + \ 'command': l:command_args, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/astyle.vim b/sources_non_forked/ale/autoload/ale/fixers/astyle.vim new file mode 100644 index 00000000..3a5a70a1 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/astyle.vim @@ -0,0 +1,59 @@ +" Author: James Kim +" Description: Fix C/C++ files with astyle. + +function! s:set_variables() abort + for l:ft in ['c', 'cpp'] + call ale#Set(l:ft . '_astyle_executable', 'astyle') + call ale#Set(l:ft . '_astyle_project_options', '') + endfor +endfunction + +call s:set_variables() + + +function! ale#fixers#astyle#Var(buffer, name) abort + let l:ft = getbufvar(str2nr(a:buffer), '&filetype') + let l:ft = l:ft =~# 'cpp' ? 'cpp' : 'c' + + return ale#Var(a:buffer, l:ft . '_astyle_' . a:name) +endfunction + +" Try to find a project options file. +function! ale#fixers#astyle#FindProjectOptions(buffer) abort + let l:proj_options = ale#fixers#astyle#Var(a:buffer, 'project_options') + + " If user has set project options variable then use it and skip any searching. + " This would allow users to use project files named differently than .astylerc. + if !empty(l:proj_options) + return l:proj_options + endif + + " Try to find nearest .astylerc file. + let l:proj_options = fnamemodify(ale#path#FindNearestFile(a:buffer, '.astylerc'), ':t') + + if !empty(l:proj_options) + return l:proj_options + endif + + " Try to find nearest _astylerc file. + let l:proj_options = fnamemodify(ale#path#FindNearestFile(a:buffer, '_astylerc'), ':t') + + if !empty(l:proj_options) + return l:proj_options + endif + + " If no project options file is found return an empty string. + return '' +endfunction + +function! ale#fixers#astyle#Fix(buffer) abort + let l:executable = ale#fixers#astyle#Var(a:buffer, 'executable') + let l:proj_options = ale#fixers#astyle#FindProjectOptions(a:buffer) + let l:command = ' --stdin=' . ale#Escape(expand('#' . a:buffer)) + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:proj_options) ? '' : ' --project=' . l:proj_options) + \ . l:command + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/autoflake.vim b/sources_non_forked/ale/autoload/ale/fixers/autoflake.vim new file mode 100644 index 00000000..e2ad6536 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/autoflake.vim @@ -0,0 +1,28 @@ +" Author: circld +" Description: Fixing files with autoflake. + +call ale#Set('python_autoflake_executable', 'autoflake') +call ale#Set('python_autoflake_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_autoflake_options', '') + +function! ale#fixers#autoflake#Fix(buffer) abort + let l:executable = ale#python#FindExecutable( + \ a:buffer, + \ 'python_autoflake', + \ ['autoflake'], + \) + + if !executable(l:executable) + return 0 + endif + + let l:options = ale#Var(a:buffer, 'python_autoflake_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --in-place ' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/autoimport.vim b/sources_non_forked/ale/autoload/ale/fixers/autoimport.vim new file mode 100644 index 00000000..700d36b5 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/autoimport.vim @@ -0,0 +1,27 @@ +" Author: lyz-code +" Description: Fixing Python imports with autoimport. + +call ale#Set('python_autoimport_executable', 'autoimport') +call ale#Set('python_autoimport_options', '') +call ale#Set('python_autoimport_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale#fixers#autoimport#Fix(buffer) abort + let l:options = ale#Var(a:buffer, 'python_autoimport_options') + + let l:executable = ale#python#FindExecutable( + \ a:buffer, + \ 'python_autoimport', + \ ['autoimport'], + \) + + if !executable(l:executable) + return 0 + endif + + return { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' -', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/black.vim b/sources_non_forked/ale/autoload/ale/fixers/black.vim index 367b8d52..4a88c5cd 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/black.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/black.vim @@ -5,6 +5,7 @@ call ale#Set('python_black_executable', 'black') call ale#Set('python_black_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_black_options', '') call ale#Set('python_black_auto_pipenv', 0) +call ale#Set('python_black_auto_poetry', 0) call ale#Set('python_black_change_directory', 1) function! ale#fixers#black#GetExecutable(buffer) abort @@ -13,25 +14,39 @@ function! ale#fixers#black#GetExecutable(buffer) abort return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_black_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + return ale#python#FindExecutable(a:buffer, 'python_black', ['black']) endfunction function! ale#fixers#black#Fix(buffer) abort - let l:cd_string = ale#Var(a:buffer, 'python_black_change_directory') - \ ? ale#path#BufferCdString(a:buffer) - \ : '' - let l:executable = ale#fixers#black#GetExecutable(a:buffer) + let l:cmd = [ale#Escape(l:executable)] - let l:exec_args = l:executable =~? 'pipenv$' - \ ? ' run black' - \ : '' + if l:executable =~? 'pipenv\|poetry$' + call extend(l:cmd, ['run', 'black']) + endif let l:options = ale#Var(a:buffer, 'python_black_options') - return { - \ 'command': l:cd_string . ale#Escape(l:executable) . l:exec_args - \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' -', - \} + if !empty(l:options) + call add(l:cmd, l:options) + endif + + if expand('#' . a:buffer . ':e') is? 'pyi' + call add(l:cmd, '--pyi') + endif + + call add(l:cmd, '-') + + let l:result = {'command': join(l:cmd, ' ')} + + if ale#Var(a:buffer, 'python_black_change_directory') + let l:result.cwd = '%s:h' + endif + + return l:result endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/buildifier.vim b/sources_non_forked/ale/autoload/ale/fixers/buildifier.vim new file mode 100644 index 00000000..48103b2e --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/buildifier.vim @@ -0,0 +1,26 @@ +" Author: Jon Parise +" Description: Format Bazel BUILD and .bzl files with buildifier. +" +call ale#Set('bazel_buildifier_executable', 'buildifier') +call ale#Set('bazel_buildifier_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('bazel_buildifier_options', '') + +function! ale#fixers#buildifier#GetExecutable(buffer) abort + return ale#path#FindExecutable(a:buffer, 'bazel_buildifier', [ + \ 'buildifier', + \]) +endfunction + +function! ale#fixers#buildifier#Fix(buffer) abort + let l:executable = ale#Escape(ale#fixers#buildifier#GetExecutable(a:buffer)) + let l:options = ale#Var(a:buffer, 'bazel_buildifier_options') + let l:filename = ale#Escape(bufname(a:buffer)) + + let l:command = l:executable . ' -mode fix -lint fix -path ' . l:filename + + if l:options isnot# '' + let l:command .= ' ' . l:options + endif + + return {'command': l:command . ' -'} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim b/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim index eae1a7b4..81498ebd 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/clangformat.vim @@ -5,18 +5,43 @@ scriptencoding utf-8 call ale#Set('c_clangformat_executable', 'clang-format') call ale#Set('c_clangformat_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('c_clangformat_options', '') +call ale#Set('c_clangformat_style_option', '') +call ale#Set('c_clangformat_use_local_file', 0) function! ale#fixers#clangformat#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'c_clangformat', [ + return ale#path#FindExecutable(a:buffer, 'c_clangformat', [ \ 'clang-format', \]) endfunction function! ale#fixers#clangformat#Fix(buffer) abort + let l:executable = ale#Escape(ale#fixers#clangformat#GetExecutable(a:buffer)) + let l:filename = ale#Escape(bufname(a:buffer)) let l:options = ale#Var(a:buffer, 'c_clangformat_options') + let l:style_option = ale#Var(a:buffer, 'c_clangformat_style_option') + let l:use_local_file = ale#Var(a:buffer, 'c_clangformat_use_local_file') - return { - \ 'command': ale#Escape(ale#fixers#clangformat#GetExecutable(a:buffer)) - \ . ' ' . l:options, - \} + if l:style_option isnot# '' + let l:style_option = '-style=' . "'" . l:style_option . "'" + endif + + if l:use_local_file + let l:config = ale#path#FindNearestFile(a:buffer, '.clang-format') + + if !empty(l:config) + let l:style_option = '-style=file' + endif + endif + + if l:style_option isnot# '' + let l:options .= ' ' . l:style_option + endif + + let l:command = l:executable . ' --assume-filename=' . l:filename + + if l:options isnot# '' + let l:command .= ' ' . l:options + endif + + return {'command': l:command} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/clangtidy.vim b/sources_non_forked/ale/autoload/ale/fixers/clangtidy.vim new file mode 100644 index 00000000..b37360a7 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/clangtidy.vim @@ -0,0 +1,52 @@ +scriptencoding utf-8 +" Author: ObserverOfTime +" Description: Fixing C/C++ files with clang-tidy. + +function! s:set_variables() abort + let l:use_global = get(g:, 'ale_use_global_executables', 0) + + for l:ft in ['c', 'cpp'] + call ale#Set(l:ft . '_clangtidy_executable', 'clang-tidy') + call ale#Set(l:ft . '_clangtidy_use_global', l:use_global) + call ale#Set(l:ft . '_clangtidy_checks', []) + call ale#Set(l:ft . '_clangtidy_options', '') + call ale#Set(l:ft . '_clangtidy_extra_options', '') + call ale#Set(l:ft . '_clangtidy_fix_errors', 1) + endfor + + call ale#Set('c_build_dir', '') +endfunction + +call s:set_variables() + +function! ale#fixers#clangtidy#Var(buffer, name) abort + let l:ft = getbufvar(str2nr(a:buffer), '&filetype') + let l:ft = l:ft =~# 'cpp' ? 'cpp' : 'c' + + return ale#Var(a:buffer, l:ft . '_clangtidy_' . a:name) +endfunction + +function! ale#fixers#clangtidy#GetCommand(buffer) abort + let l:checks = join(ale#fixers#clangtidy#Var(a:buffer, 'checks'), ',') + let l:extra_options = ale#fixers#clangtidy#Var(a:buffer, 'extra_options') + let l:build_dir = ale#c#GetBuildDirectory(a:buffer) + let l:options = empty(l:build_dir) + \ ? ale#fixers#clangtidy#Var(a:buffer, 'options') : '' + let l:fix_errors = ale#fixers#clangtidy#Var(a:buffer, 'fix_errors') + + return ' -fix' . (l:fix_errors ? ' -fix-errors' : '') + \ . (empty(l:checks) ? '' : ' -checks=' . ale#Escape(l:checks)) + \ . (empty(l:extra_options) ? '' : ' ' . l:extra_options) + \ . (empty(l:build_dir) ? '' : ' -p ' . ale#Escape(l:build_dir)) + \ . ' %t' . (empty(l:options) ? '' : ' -- ' . l:options) +endfunction + +function! ale#fixers#clangtidy#Fix(buffer) abort + let l:executable = ale#fixers#clangtidy#Var(a:buffer, 'executable') + let l:command = ale#fixers#clangtidy#GetCommand(a:buffer) + + return { + \ 'command': ale#Escape(l:executable) . l:command, + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/cmakeformat.vim b/sources_non_forked/ale/autoload/ale/fixers/cmakeformat.vim index f40ed6ed..dcc29cf3 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/cmakeformat.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/cmakeformat.vim @@ -10,9 +10,7 @@ function! ale#fixers#cmakeformat#Fix(buffer) abort return { \ 'command': ale#Escape(l:executable) - \ . ' -i ' \ . (empty(l:options) ? '' : ' ' . l:options) - \ . ' %t', - \ 'read_temporary_file': 1, + \ . ' -' \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/dart_format.vim b/sources_non_forked/ale/autoload/ale/fixers/dart_format.vim new file mode 100644 index 00000000..4b8f730b --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/dart_format.vim @@ -0,0 +1,18 @@ +" Author: ghsang +" Description: Integration of dart format with ALE. + +call ale#Set('dart_format_executable', 'dart') +call ale#Set('dart_format_options', '') + +function! ale#fixers#dart_format#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'dart_format_executable') + let l:options = ale#Var(a:buffer, 'dart_format_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' format' + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/deno.vim b/sources_non_forked/ale/autoload/ale/fixers/deno.vim new file mode 100644 index 00000000..7154c6ee --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/deno.vim @@ -0,0 +1,17 @@ +function! ale#fixers#deno#Fix(buffer) abort + let l:executable = ale#handlers#deno#GetExecutable(a:buffer) + + if !executable(l:executable) + return 0 + endif + + let l:options = ' fmt -' + + if ale#Var(a:buffer, 'deno_unstable') + let l:options = l:options . ' --unstable' + endif + + return { + \ 'command': ale#Escape(l:executable) . l:options + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/dfmt.vim b/sources_non_forked/ale/autoload/ale/fixers/dfmt.vim new file mode 100644 index 00000000..0072e045 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/dfmt.vim @@ -0,0 +1,18 @@ +" Author: theoldmoon0602 +" Description: Integration of dfmt with ALE. + +call ale#Set('d_dfmt_executable', 'dfmt') +call ale#Set('d_dfmt_options', '') + +function! ale#fixers#dfmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'd_dfmt_executable') + let l:options = ale#Var(a:buffer, 'd_dfmt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' -i' + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/dhall_format.vim b/sources_non_forked/ale/autoload/ale/fixers/dhall_format.vim new file mode 100644 index 00000000..4f12abc8 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/dhall_format.vim @@ -0,0 +1,11 @@ +" Author: toastal +" Description: Dhallโ€™s built-in formatter +" +function! ale#fixers#dhall_format#Fix(buffer) abort + let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer) + + return { + \ 'command': l:executable + \ . ' format' + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/dhall_freeze.vim b/sources_non_forked/ale/autoload/ale/fixers/dhall_freeze.vim new file mode 100644 index 00000000..ff54482d --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/dhall_freeze.vim @@ -0,0 +1,14 @@ +" Author: toastal +" Description: Dhallโ€™s package freezing + +call ale#Set('dhall_freeze_options', '') + +function! ale#fixers#dhall_freeze#Freeze(buffer) abort + let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer) + + return { + \ 'command': l:executable + \ . ' freeze' + \ . ale#Pad(ale#Var(a:buffer, 'dhall_freeze_options')) + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/dhall_lint.vim b/sources_non_forked/ale/autoload/ale/fixers/dhall_lint.vim new file mode 100644 index 00000000..149a6581 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/dhall_lint.vim @@ -0,0 +1,11 @@ +" Author: toastal +" Description: Dhallโ€™s built-in linter/formatter + +function! ale#fixers#dhall_lint#Fix(buffer) abort + let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer) + + return { + \ 'command': l:executable + \ . ' lint' + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/dotnet_format.vim b/sources_non_forked/ale/autoload/ale/fixers/dotnet_format.vim new file mode 100644 index 00000000..b44a28bd --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/dotnet_format.vim @@ -0,0 +1,18 @@ +" Author: ghsang +" Description: Integration of dotnet format with ALE. + +call ale#Set('cs_dotnet_format_executable', 'dotnet') +call ale#Set('cs_dotnet_format_options', '') + +function! ale#fixers#dotnet_format#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'cs_dotnet_format_executable') + let l:options = ale#Var(a:buffer, 'cs_dotnet_format_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' format' + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' --folder --include %t "$(dirname %t)"', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/elm_format.vim b/sources_non_forked/ale/autoload/ale/fixers/elm_format.vim index cd2be2c3..a4740db4 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/elm_format.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/elm_format.vim @@ -6,7 +6,7 @@ call ale#Set('elm_format_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('elm_format_options', '--yes') function! ale#fixers#elm_format#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'elm_format', [ + return ale#path#FindExecutable(a:buffer, 'elm_format', [ \ 'node_modules/.bin/elm-format', \]) endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/erblint.vim b/sources_non_forked/ale/autoload/ale/fixers/erblint.vim new file mode 100644 index 00000000..41aca0c8 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/erblint.vim @@ -0,0 +1,40 @@ +" Author: Roeland Moors - https://github.com/roelandmoors +" Description: ERB Lint, support for https://github.com/Shopify/erb-lint + +call ale#Set('eruby_erblint_executable', 'erblint') +call ale#Set('eruby_erblint_options', '') + + +" Erblint fixer outputs diagnostics first and then the fixed +" output. These are delimited by something like this: +" ================ /path/to/demo.html.erb ================== +" We only need the output after this +function! ale#fixers#erblint#PostProcess(buffer, output) abort + let l:line = 0 + + for l:output in a:output + let l:line = l:line + 1 + + if l:output =~# "^=\\+.*=\\+$" + break + endif + endfor + + return a:output[l:line :] +endfunction + +function! ale#fixers#erblint#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'eruby_erblint_executable') + let l:options = ale#Var(a:buffer, 'eruby_erblint_options') + + return ale#ruby#EscapeExecutable(l:executable, 'erblint') + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --autocorrect --stdin %s' +endfunction + +function! ale#fixers#erblint#Fix(buffer) abort + return { + \ 'command': ale#fixers#erblint#GetCommand(a:buffer), + \ 'process_with': 'ale#fixers#erblint#PostProcess' + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/erlfmt.vim b/sources_non_forked/ale/autoload/ale/fixers/erlfmt.vim new file mode 100644 index 00000000..f9951e9d --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/erlfmt.vim @@ -0,0 +1,21 @@ +" Author: AntoineGagne - https://github.com/AntoineGagne +" Description: Integration of erlfmt with ALE. + +call ale#Set('erlang_erlfmt_executable', 'erlfmt') +call ale#Set('erlang_erlfmt_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('erlang_erlfmt_options', '') + +function! ale#fixers#erlfmt#GetExecutable(buffer) abort + return ale#path#FindExecutable(a:buffer, 'erlang_erlfmt', ['erlfmt']) +endfunction + +function! ale#fixers#erlfmt#Fix(buffer) abort + let l:options = ale#Var(a:buffer, 'erlang_erlfmt_options') + let l:executable = ale#fixers#erlfmt#GetExecutable(a:buffer) + + let l:command = ale#Escape(l:executable) . (empty(l:options) ? '' : ' ' . l:options) . ' %s' + + return { + \ 'command': l:command + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/eslint.vim b/sources_non_forked/ale/autoload/ale/fixers/eslint.vim index ea5b2a63..c9535cb0 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/eslint.vim @@ -3,15 +3,15 @@ function! ale#fixers#eslint#Fix(buffer) abort let l:executable = ale#handlers#eslint#GetExecutable(a:buffer) + let l:command = ale#node#Executable(a:buffer, l:executable) + \ . ' --version' - let l:command = ale#semver#HasVersion(l:executable) - \ ? '' - \ : ale#node#Executable(a:buffer, l:executable) . ' --version' - - return { - \ 'command': l:command, - \ 'chain_with': 'ale#fixers#eslint#ApplyFixForVersion', - \} + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ l:executable, + \ l:command, + \ function('ale#fixers#eslint#ApplyFixForVersion'), + \) endfunction function! ale#fixers#eslint#ProcessFixDryRunOutput(buffer, output) abort @@ -33,37 +33,50 @@ function! ale#fixers#eslint#ProcessEslintDOutput(buffer, output) abort return a:output endfunction -function! ale#fixers#eslint#ApplyFixForVersion(buffer, version_output) abort +function! ale#fixers#eslint#ApplyFixForVersion(buffer, version) abort let l:executable = ale#handlers#eslint#GetExecutable(a:buffer) - let l:version = ale#semver#GetVersion(l:executable, a:version_output) + let l:options = ale#Var(a:buffer, 'javascript_eslint_options') - let l:config = ale#handlers#eslint#FindConfig(a:buffer) + " Use the configuration file from the options, if configured. + if l:options =~# '\v(^| )-c|(^| )--config' + let l:config = '' + let l:has_config = 1 + else + let l:config = ale#handlers#eslint#FindConfig(a:buffer) + let l:has_config = !empty(l:config) + endif - if empty(l:config) + if !l:has_config return 0 endif " Use --fix-to-stdout with eslint_d - if l:executable =~# 'eslint_d$' && ale#semver#GTE(l:version, [3, 19, 0]) + if l:executable =~# 'eslint_d$' && ale#semver#GTE(a:version, [3, 19, 0]) return { + \ 'cwd': ale#handlers#eslint#GetCwd(a:buffer), \ 'command': ale#node#Executable(a:buffer, l:executable) + \ . ale#Pad(l:options) \ . ' --stdin-filename %s --stdin --fix-to-stdout', \ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput', \} endif " 4.9.0 is the first version with --fix-dry-run - if ale#semver#GTE(l:version, [4, 9, 0]) + if ale#semver#GTE(a:version, [4, 9, 0]) return { + \ 'cwd': ale#handlers#eslint#GetCwd(a:buffer), \ 'command': ale#node#Executable(a:buffer, l:executable) + \ . ale#Pad(l:options) \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json', \ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput', \} endif return { + \ 'cwd': ale#handlers#eslint#GetCwd(a:buffer), \ 'command': ale#node#Executable(a:buffer, l:executable) - \ . ' -c ' . ale#Escape(l:config) + \ . ale#Pad(l:options) + \ . (!empty(l:config) ? ' -c ' . ale#Escape(l:config) : '') \ . ' --fix %t', \ 'read_temporary_file': 1, \} diff --git a/sources_non_forked/ale/autoload/ale/fixers/fecs.vim b/sources_non_forked/ale/autoload/ale/fixers/fecs.vim new file mode 100644 index 00000000..d692bc97 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/fecs.vim @@ -0,0 +1,17 @@ +" Author: harttle +" Description: Apply fecs format to a file. + +function! ale#fixers#fecs#Fix(buffer) abort + let l:executable = ale#handlers#fecs#GetExecutable(a:buffer) + + if !executable(l:executable) + return 0 + endif + + let l:config_options = ' format --replace=true %t' + + return { + \ 'command': ale#Escape(l:executable) . l:config_options, + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/fish_indent.vim b/sources_non_forked/ale/autoload/ale/fixers/fish_indent.vim new file mode 100644 index 00000000..ebf17c5a --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/fish_indent.vim @@ -0,0 +1,19 @@ +" Author: Chen YuanYuan +" Description: Integration of fish_indent with ALE. + +call ale#Set('fish_fish_indent_executable', 'fish_indent') +call ale#Set('fish_fish_indent_options', '') + +function! ale#fixers#fish_indent#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'fish_fish_indent_executable') + let l:options = ale#Var(a:buffer, 'fish_fish_indent_options') + let l:filename = ale#Escape(bufname(a:buffer)) + + return { + \ 'command': ale#Escape(l:executable) + \ . ' -w ' + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/fixjson.vim b/sources_non_forked/ale/autoload/ale/fixers/fixjson.vim index 33ce0af3..4bad8f9b 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/fixjson.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/fixjson.vim @@ -6,7 +6,7 @@ call ale#Set('json_fixjson_options', '') call ale#Set('json_fixjson_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale#fixers#fixjson#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'json_fixjson', [ + return ale#path#FindExecutable(a:buffer, 'json_fixjson', [ \ 'node_modules/.bin/fixjson', \]) endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/floskell.vim b/sources_non_forked/ale/autoload/ale/fixers/floskell.vim new file mode 100644 index 00000000..f0015db7 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/floskell.vim @@ -0,0 +1,20 @@ +" Author: robertjlooby +" Description: Integration of floskell with ALE. + +call ale#Set('haskell_floskell_executable', 'floskell') + +function! ale#fixers#floskell#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_floskell_executable') + + return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'floskell') +endfunction + +function! ale#fixers#floskell#Fix(buffer) abort + let l:executable = ale#fixers#floskell#GetExecutable(a:buffer) + + return { + \ 'command': l:executable + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/gnatpp.vim b/sources_non_forked/ale/autoload/ale/fixers/gnatpp.vim new file mode 100644 index 00000000..bf3d484e --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/gnatpp.vim @@ -0,0 +1,17 @@ +" Author: tim +" Description: Fix files with gnatpp. + +call ale#Set('ada_gnatpp_executable', 'gnatpp') +call ale#Set('ada_gnatpp_options', '') + +function! ale#fixers#gnatpp#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'ada_gnatpp_executable') + let l:options = ale#Var(a:buffer, 'ada_gnatpp_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/gofmt.vim b/sources_non_forked/ale/autoload/ale/fixers/gofmt.vim index 66b67a9e..b9cfbb58 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/gofmt.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/gofmt.vim @@ -7,12 +7,10 @@ call ale#Set('go_gofmt_options', '') function! ale#fixers#gofmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'go_gofmt_executable') let l:options = ale#Var(a:buffer, 'go_gofmt_options') + let l:env = ale#go#EnvString(a:buffer) return { - \ 'command': ale#Escape(l:executable) - \ . ' -l -w' + \ 'command': l:env . ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) - \ . ' %t', - \ 'read_temporary_file': 1, \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/goimports.vim b/sources_non_forked/ale/autoload/ale/fixers/goimports.vim index 783d0206..65f0fd98 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/goimports.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/goimports.vim @@ -7,13 +7,14 @@ call ale#Set('go_goimports_options', '') function! ale#fixers#goimports#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'go_goimports_executable') let l:options = ale#Var(a:buffer, 'go_goimports_options') + let l:env = ale#go#EnvString(a:buffer) if !executable(l:executable) return 0 endif return { - \ 'command': ale#Escape(l:executable) + \ 'command': l:env . ale#Escape(l:executable) \ . ' -l -w -srcdir %s' \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' %t', diff --git a/sources_non_forked/ale/autoload/ale/fixers/golines.vim b/sources_non_forked/ale/autoload/ale/fixers/golines.vim new file mode 100644 index 00000000..9326f482 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/golines.vim @@ -0,0 +1,21 @@ +" Author Pig Frown +" Description: Fix Go files long lines with golines" + +call ale#Set('go_golines_executable', 'golines') + +call ale#Set('go_golines_options', '') + +function! ale#fixers#golines#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'go_golines_executable') + let l:options = ale#Var(a:buffer, 'go_golines_options') + let l:env = ale#go#EnvString(a:buffer) + + if !executable(l:executable) + return 0 + endif + + return { + \ 'command': l:env . ale#Escape(l:executable) + \ . (empty(l:options) ? '' : ' ' . l:options) + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/gomod.vim b/sources_non_forked/ale/autoload/ale/fixers/gomod.vim index 68895f9b..ee8c46c9 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/gomod.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/gomod.vim @@ -2,9 +2,10 @@ call ale#Set('go_go_executable', 'go') function! ale#fixers#gomod#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'go_go_executable') + let l:env = ale#go#EnvString(a:buffer) return { - \ 'command': ale#Escape(l:executable) . ' mod edit -fmt %t', + \ 'command': l:env . ale#Escape(l:executable) . ' mod edit -fmt %t', \ 'read_temporary_file': 1, \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/hindent.vim b/sources_non_forked/ale/autoload/ale/fixers/hindent.vim new file mode 100644 index 00000000..b6009a2c --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/hindent.vim @@ -0,0 +1,20 @@ +" Author: AlexeiDrake +" Description: Integration of hindent formatting with ALE. +" +call ale#Set('haskell_hindent_executable', 'hindent') + +function! ale#fixers#hindent#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_hindent_executable') + + return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hindent') +endfunction + +function! ale#fixers#hindent#Fix(buffer) abort + let l:executable = ale#fixers#hindent#GetExecutable(a:buffer) + + return { + \ 'command': l:executable + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/html_beautify.vim b/sources_non_forked/ale/autoload/ale/fixers/html_beautify.vim new file mode 100644 index 00000000..236cb6ec --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/html_beautify.vim @@ -0,0 +1,21 @@ +" Author: WhyNotHugo +" Description: Lint HTML files with html-beautify. +" +call ale#Set('html_beautify_executable', 'html-beautify') +call ale#Set('html_beautify_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('html_beautify_options', '') +call ale#Set('html_beautify_change_directory', 1) + +function! ale#fixers#html_beautify#Fix(buffer) abort + let l:executable = ale#python#FindExecutable( + \ a:buffer, + \ 'html_beautify', + \ ['html-beautify'] + \) + + let l:options = ale#Var(a:buffer, 'html_beautify_options') + + return { + \ 'command': ale#Escape(l:executable). ' ' . l:options . ' -', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/isort.vim b/sources_non_forked/ale/autoload/ale/fixers/isort.vim index 9070fb27..6eb6a67c 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/isort.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/isort.vim @@ -2,24 +2,70 @@ " Description: Fixing Python imports with isort. call ale#Set('python_isort_executable', 'isort') -call ale#Set('python_isort_options', '') call ale#Set('python_isort_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('python_isort_options', '') +call ale#Set('python_isort_auto_pipenv', 0) +call ale#Set('python_isort_auto_poetry', 0) -function! ale#fixers#isort#Fix(buffer) abort - let l:options = ale#Var(a:buffer, 'python_isort_options') - - let l:executable = ale#python#FindExecutable( - \ a:buffer, - \ 'python_isort', - \ ['isort'], - \) - - if !executable(l:executable) - return 0 +function! ale#fixers#isort#GetExecutable(buffer) abort + if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_isort_auto_pipenv')) + \ && ale#python#PipenvPresent(a:buffer) + return 'pipenv' endif + if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_isort_auto_poetry')) + \ && ale#python#PoetryPresent(a:buffer) + return 'poetry' + endif + + return ale#python#FindExecutable(a:buffer, 'python_isort', ['isort']) +endfunction + +function! ale#fixers#isort#GetCmd(buffer) abort + let l:executable = ale#fixers#isort#GetExecutable(a:buffer) + let l:cmd = [ale#Escape(l:executable)] + + if l:executable =~? 'pipenv\|poetry$' + call extend(l:cmd, ['run', 'isort']) + endif + + return join(l:cmd, ' ') +endfunction + +function! ale#fixers#isort#FixForVersion(buffer, version) abort + let l:executable = ale#fixers#isort#GetExecutable(a:buffer) + let l:cmd = [ale#Escape(l:executable)] + + if l:executable =~? 'pipenv\|poetry$' + call extend(l:cmd, ['run', 'isort']) + endif + + if ale#semver#GTE(a:version, [5, 7, 0]) + call add(l:cmd, '--filename %s') + endif + + let l:options = ale#Var(a:buffer, 'python_isort_options') + + if !empty(l:options) + call add(l:cmd, l:options) + endif + + call add(l:cmd, '-') + return { - \ 'command': ale#path#BufferCdString(a:buffer) - \ . ale#Escape(l:executable) . (!empty(l:options) ? ' ' . l:options : '') . ' -', + \ 'cwd': '%s:h', + \ 'command': join(l:cmd, ' '), \} endfunction + +function! ale#fixers#isort#Fix(buffer) abort + let l:executable = ale#fixers#isort#GetExecutable(a:buffer) + let l:command = ale#fixers#isort#GetCmd(a:buffer) . ale#Pad('--version') + + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ l:executable, + \ l:command, + \ function('ale#fixers#isort#FixForVersion'), + \) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/jsonnetfmt.vim b/sources_non_forked/ale/autoload/ale/fixers/jsonnetfmt.vim new file mode 100644 index 00000000..f1e41cd5 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/jsonnetfmt.vim @@ -0,0 +1,18 @@ +" Authors: Trevor Whitney and Takuya Kosugiyama +" Description: Integration of jsonnetfmt with ALE. + +call ale#Set('jsonnet_jsonnetfmt_executable', 'jsonnetfmt') +call ale#Set('jsonnet_jsonnetfmt_options', '') + +function! ale#fixers#jsonnetfmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_executable') + let l:options = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' -i' + \ . ale#Pad(l:options) + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/ktlint.vim b/sources_non_forked/ale/autoload/ale/fixers/ktlint.vim index cb975d6c..64d1340d 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/ktlint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/ktlint.vim @@ -3,7 +3,6 @@ function! ale#fixers#ktlint#Fix(buffer) abort return { - \ 'command': ale#handlers#ktlint#GetCommand(a:buffer) . ' --format', - \ 'read_temporary_file': 1, + \ 'command': ale#handlers#ktlint#GetCommand(a:buffer) . ' --format' \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/latexindent.vim b/sources_non_forked/ale/autoload/ale/fixers/latexindent.vim new file mode 100644 index 00000000..54f1231e --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/latexindent.vim @@ -0,0 +1,16 @@ +" Author: riley-martine +" Description: Integration of latexindent with ALE. + +call ale#Set('tex_latexindent_executable', 'latexindent') +call ale#Set('tex_latexindent_options', '') + +function! ale#fixers#latexindent#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'tex_latexindent_executable') + let l:options = ale#Var(a:buffer, 'tex_latexindent_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' -l' + \ . (empty(l:options) ? '' : ' ' . l:options) + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/lua_format.vim b/sources_non_forked/ale/autoload/ale/fixers/lua_format.vim new file mode 100644 index 00000000..98b155c0 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/lua_format.vim @@ -0,0 +1,16 @@ +" Author: Mathias Jean Johansen +" Description: Integration of LuaFormatter with ALE. + +call ale#Set('lua_lua_format_executable', 'lua-format') +call ale#Set('lua_lua_format_options', '') + +function! ale#fixers#lua_format#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'lua_lua_format_executable') + let l:options = ale#Var(a:buffer, 'lua_lua_format_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ale#Pad(l:options) + \ . ' -i', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/luafmt.vim b/sources_non_forked/ale/autoload/ale/fixers/luafmt.vim new file mode 100644 index 00000000..6cb9ef4a --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/luafmt.vim @@ -0,0 +1,13 @@ +call ale#Set('lua_luafmt_executable', 'luafmt') +call ale#Set('lua_luafmt_options', '') + +function! ale#fixers#luafmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'lua_luafmt_executable') + let l:options = ale#Var(a:buffer, 'lua_luafmt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' --stdin', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/nimpretty.vim b/sources_non_forked/ale/autoload/ale/fixers/nimpretty.vim new file mode 100644 index 00000000..fe2e7136 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/nimpretty.vim @@ -0,0 +1,15 @@ +" Author: Nhan +" Description: Integration of nimpretty with ALE. + +call ale#Set('nim_nimpretty_executable', 'nimpretty') +call ale#Set('nim_nimpretty_options', '--maxLineLen:80') + +function! ale#fixers#nimpretty#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'nim_nimpretty_executable') + let l:options = ale#Var(a:buffer, 'nim_nimpretty_options') + + return { + \ 'command': ale#Escape(l:executable) . ' %t' . ale#Pad(l:options), + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/nixfmt.vim b/sources_non_forked/ale/autoload/ale/fixers/nixfmt.vim new file mode 100644 index 00000000..4a548b23 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/nixfmt.vim @@ -0,0 +1,15 @@ +scriptencoding utf-8 +" Author: houstdav000 +" Description: Fix files with nixfmt + +call ale#Set('nix_nixfmt_executable', 'nixfmt') +call ale#Set('nix_nixfmt_options', '') + +function! ale#fixers#nixfmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'nix_nixfmt_executable') + let l:options = ale#Var(a:buffer, 'nix_nixfmt_options') + + return { + \ 'command': ale#Escape(l:executable) . ale#Pad(l:options), + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/nixpkgsfmt.vim b/sources_non_forked/ale/autoload/ale/fixers/nixpkgsfmt.vim new file mode 100644 index 00000000..403ce798 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/nixpkgsfmt.vim @@ -0,0 +1,12 @@ +call ale#Set('nix_nixpkgsfmt_executable', 'nixpkgs-fmt') +call ale#Set('nix_nixpkgsfmt_options', '') + +function! ale#fixers#nixpkgsfmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'nix_nixpkgsfmt_executable') + let l:options = ale#Var(a:buffer, 'nix_nixpkgsfmt_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:options) ? '' : ' ' . l:options), + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/ocamlformat.vim b/sources_non_forked/ale/autoload/ale/fixers/ocamlformat.vim index 9b7c3e12..b12d2eb9 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/ocamlformat.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/ocamlformat.vim @@ -5,14 +5,13 @@ call ale#Set('ocaml_ocamlformat_executable', 'ocamlformat') call ale#Set('ocaml_ocamlformat_options', '') function! ale#fixers#ocamlformat#Fix(buffer) abort - let l:filename = expand('#' . a:buffer . ':p') let l:executable = ale#Var(a:buffer, 'ocaml_ocamlformat_executable') let l:options = ale#Var(a:buffer, 'ocaml_ocamlformat_options') return { \ 'command': ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) - \ . ' --name=' . ale#Escape(l:filename) + \ . ' --name=%s' \ . ' -' \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/ocp_indent.vim b/sources_non_forked/ale/autoload/ale/fixers/ocp_indent.vim new file mode 100644 index 00000000..e1b047b3 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/ocp_indent.vim @@ -0,0 +1,18 @@ +" Author: Kanenobu Mitsuru +" Description: Integration of ocp-indent with ALE. + +call ale#Set('ocaml_ocp_indent_executable', 'ocp-indent') +call ale#Set('ocaml_ocp_indent_options', '') +call ale#Set('ocaml_ocp_indent_config', '') + +function! ale#fixers#ocp_indent#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'ocaml_ocp_indent_executable') + let l:config = ale#Var(a:buffer, 'ocaml_ocp_indent_config') + let l:options = ale#Var(a:buffer, 'ocaml_ocp_indent_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:config) ? '' : ' --config=' . ale#Escape(l:config)) + \ . (empty(l:options) ? '': ' ' . l:options) + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/ormolu.vim b/sources_non_forked/ale/autoload/ale/fixers/ormolu.vim new file mode 100644 index 00000000..69b55c1f --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/ormolu.vim @@ -0,0 +1,12 @@ +call ale#Set('haskell_ormolu_executable', 'ormolu') +call ale#Set('haskell_ormolu_options', '') + +function! ale#fixers#ormolu#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'haskell_ormolu_executable') + let l:options = ale#Var(a:buffer, 'haskell_ormolu_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:options) ? '' : ' ' . l:options), + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/pandoc.vim b/sources_non_forked/ale/autoload/ale/fixers/pandoc.vim new file mode 100644 index 00000000..d704c8a2 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/pandoc.vim @@ -0,0 +1,16 @@ +scriptencoding utf-8 +" Author: Jesse Hathaway +" Description: Fix markdown files with pandoc. + +call ale#Set('markdown_pandoc_executable', 'pandoc') +call ale#Set('markdown_pandoc_options', '-f gfm -t gfm -s -') + +function! ale#fixers#pandoc#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'markdown_pandoc_executable') + let l:options = ale#Var(a:buffer, 'markdown_pandoc_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' ' . l:options, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/pgformatter.vim b/sources_non_forked/ale/autoload/ale/fixers/pgformatter.vim new file mode 100644 index 00000000..9ea08ec6 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/pgformatter.vim @@ -0,0 +1,12 @@ +call ale#Set('sql_pgformatter_executable', 'pg_format') +call ale#Set('sql_pgformatter_options', '') + +function! ale#fixers#pgformatter#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'sql_pgformatter_executable') + let l:options = ale#Var(a:buffer, 'sql_pgformatter_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:options) ? '' : ' ' . l:options), + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/php_cs_fixer.vim b/sources_non_forked/ale/autoload/ale/fixers/php_cs_fixer.vim index 5c59e262..c8f9c7b0 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/php_cs_fixer.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/php_cs_fixer.vim @@ -6,7 +6,7 @@ call ale#Set('php_cs_fixer_use_global', get(g:, 'ale_use_global_executables', 0) call ale#Set('php_cs_fixer_options', '') function! ale#fixers#php_cs_fixer#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'php_cs_fixer', [ + return ale#path#FindExecutable(a:buffer, 'php_cs_fixer', [ \ 'vendor/bin/php-cs-fixer', \ 'php-cs-fixer' \]) diff --git a/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim b/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim index f14b8406..494bf346 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/phpcbf.vim @@ -2,11 +2,12 @@ " Description: Fixing files with phpcbf. call ale#Set('php_phpcbf_standard', '') +call ale#Set('php_phpcbf_options', '') call ale#Set('php_phpcbf_executable', 'phpcbf') call ale#Set('php_phpcbf_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale#fixers#phpcbf#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'php_phpcbf', [ + return ale#path#FindExecutable(a:buffer, 'php_phpcbf', [ \ 'vendor/bin/phpcbf', \ 'phpcbf' \]) @@ -20,6 +21,6 @@ function! ale#fixers#phpcbf#Fix(buffer) abort \ : '' return { - \ 'command': ale#Escape(l:executable) . ' --stdin-path=%s ' . l:standard_option . ' -' + \ 'command': ale#Escape(l:executable) . ' --stdin-path=%s ' . l:standard_option . ale#Pad(ale#Var(a:buffer, 'php_phpcbf_options')) . ' -' \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim index 0f99ae97..8a67e2ff 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/prettier.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier.vim @@ -7,7 +7,7 @@ call ale#Set('javascript_prettier_use_global', get(g:, 'ale_use_global_executabl call ale#Set('javascript_prettier_options', '') function! ale#fixers#prettier#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_prettier', [ + return ale#path#FindExecutable(a:buffer, 'javascript_prettier', [ \ 'node_modules/.bin/prettier_d', \ 'node_modules/prettier-cli/index.js', \ 'node_modules/.bin/prettier', @@ -15,16 +15,12 @@ function! ale#fixers#prettier#GetExecutable(buffer) abort endfunction function! ale#fixers#prettier#Fix(buffer) abort - let l:executable = ale#fixers#prettier#GetExecutable(a:buffer) - - let l:command = ale#semver#HasVersion(l:executable) - \ ? '' - \ : ale#Escape(l:executable) . ' --version' - - return { - \ 'command': l:command, - \ 'chain_with': 'ale#fixers#prettier#ApplyFixForVersion', - \} + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ ale#fixers#prettier#GetExecutable(a:buffer), + \ '%e --version', + \ function('ale#fixers#prettier#ApplyFixForVersion'), + \) endfunction function! ale#fixers#prettier#ProcessPrettierDOutput(buffer, output) abort @@ -38,19 +34,31 @@ function! ale#fixers#prettier#ProcessPrettierDOutput(buffer, output) abort return a:output endfunction -function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort +function! ale#fixers#prettier#GetCwd(buffer) abort + let l:config = ale#path#FindNearestFile(a:buffer, '.prettierignore') + + " Fall back to the directory of the buffer + return !empty(l:config) ? fnamemodify(l:config, ':h') : '%s:h' +endfunction + +function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort let l:executable = ale#fixers#prettier#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'javascript_prettier_options') - let l:version = ale#semver#GetVersion(l:executable, a:version_output) let l:parser = '' + let l:filetypes = split(getbufvar(a:buffer, '&filetype'), '\.') + + if index(l:filetypes, 'handlebars') > -1 + let l:parser = 'glimmer' + endif + " Append the --parser flag depending on the current filetype (unless it's " already set in g:javascript_prettier_options). - if empty(expand('#' . a:buffer . ':e')) && match(l:options, '--parser') == -1 + if empty(expand('#' . a:buffer . ':e')) && l:parser is# '' && match(l:options, '--parser') == -1 " Mimic Prettier's defaults. In cases without a file extension or " filetype (scratch buffer), Prettier needs `parser` set to know how " to process the buffer. - if ale#semver#GTE(l:version, [1, 16, 0]) + if ale#semver#GTE(a:version, [1, 16, 0]) let l:parser = 'babel' else let l:parser = 'babylon' @@ -66,11 +74,14 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort \ 'graphql': 'graphql', \ 'markdown': 'markdown', \ 'vue': 'vue', + \ 'svelte': 'svelte', \ 'yaml': 'yaml', + \ 'openapi': 'yaml', \ 'html': 'html', + \ 'ruby': 'ruby', \} - for l:filetype in split(getbufvar(a:buffer, '&filetype'), '\.') + for l:filetype in l:filetypes if has_key(l:prettier_parsers, l:filetype) let l:parser = l:prettier_parsers[l:filetype] break @@ -85,8 +96,8 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort " Special error handling needed for prettier_d if l:executable =~# 'prettier_d$' return { - \ 'command': ale#path#BufferCdString(a:buffer) - \ . ale#Escape(l:executable) + \ 'cwd': '%s:h', + \ 'command':ale#Escape(l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --stdin-filepath %s --stdin', \ 'process_with': 'ale#fixers#prettier#ProcessPrettierDOutput', @@ -94,10 +105,10 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort endif " 1.4.0 is the first version with --stdin-filepath - if ale#semver#GTE(l:version, [1, 4, 0]) + if ale#semver#GTE(a:version, [1, 4, 0]) return { - \ 'command': ale#path#BufferCdString(a:buffer) - \ . ale#Escape(l:executable) + \ 'cwd': ale#fixers#prettier#GetCwd(a:buffer), + \ 'command': ale#Escape(l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --stdin-filepath %s --stdin', \} diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim index bc0caadd..0b9c88b7 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier_eslint.vim @@ -2,42 +2,32 @@ " w0rp , morhetz (Pavel Pertsev) " Description: Integration between Prettier and ESLint. -function! ale#fixers#prettier_eslint#SetOptionDefaults() abort - call ale#Set('javascript_prettier_eslint_executable', 'prettier-eslint') - call ale#Set('javascript_prettier_eslint_use_global', get(g:, 'ale_use_global_executables', 0)) - call ale#Set('javascript_prettier_eslint_options', '') -endfunction - -call ale#fixers#prettier_eslint#SetOptionDefaults() +call ale#Set('javascript_prettier_eslint_executable', 'prettier-eslint') +call ale#Set('javascript_prettier_eslint_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('javascript_prettier_eslint_options', '') function! ale#fixers#prettier_eslint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_prettier_eslint', [ + return ale#path#FindExecutable(a:buffer, 'javascript_prettier_eslint', [ \ 'node_modules/prettier-eslint-cli/dist/index.js', \ 'node_modules/.bin/prettier-eslint', \]) endfunction function! ale#fixers#prettier_eslint#Fix(buffer) abort - let l:executable = ale#fixers#prettier_eslint#GetExecutable(a:buffer) - - let l:command = ale#semver#HasVersion(l:executable) - \ ? '' - \ : ale#Escape(l:executable) . ' --version' - - return { - \ 'command': l:command, - \ 'chain_with': 'ale#fixers#prettier_eslint#ApplyFixForVersion', - \} + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ ale#fixers#prettier_eslint#GetExecutable(a:buffer), + \ '%e --version', + \ function('ale#fixers#prettier_eslint#ApplyFixForVersion'), + \) endfunction -function! ale#fixers#prettier_eslint#ApplyFixForVersion(buffer, version_output) abort +function! ale#fixers#prettier_eslint#ApplyFixForVersion(buffer, version) abort let l:options = ale#Var(a:buffer, 'javascript_prettier_eslint_options') let l:executable = ale#fixers#prettier_eslint#GetExecutable(a:buffer) - let l:version = ale#semver#GetVersion(l:executable, a:version_output) - " 4.2.0 is the first version with --eslint-config-path - let l:config = ale#semver#GTE(l:version, [4, 2, 0]) + let l:config = ale#semver#GTE(a:version, [4, 2, 0]) \ ? ale#handlers#eslint#FindConfig(a:buffer) \ : '' let l:eslint_config_option = !empty(l:config) @@ -45,10 +35,10 @@ function! ale#fixers#prettier_eslint#ApplyFixForVersion(buffer, version_output) \ : '' " 4.4.0 is the first version with --stdin-filepath - if ale#semver#GTE(l:version, [4, 4, 0]) + if ale#semver#GTE(a:version, [4, 4, 0]) return { - \ 'command': ale#path#BufferCdString(a:buffer) - \ . ale#Escape(l:executable) + \ 'cwd': '%s:h', + \ 'command': ale#Escape(l:executable) \ . l:eslint_config_option \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --stdin-filepath %s --stdin', diff --git a/sources_non_forked/ale/autoload/ale/fixers/prettier_standard.vim b/sources_non_forked/ale/autoload/ale/fixers/prettier_standard.vim index b6e0a6f9..c8c09e31 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/prettier_standard.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/prettier_standard.vim @@ -6,7 +6,7 @@ call ale#Set('javascript_prettier_standard_use_global', get(g:, 'ale_use_global_ call ale#Set('javascript_prettier_standard_options', '') function! ale#fixers#prettier_standard#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_prettier_standard', [ + return ale#path#FindExecutable(a:buffer, 'javascript_prettier_standard', [ \ 'node_modules/prettier-standard/lib/index.js', \ 'node_modules/.bin/prettier-standard', \]) @@ -17,8 +17,8 @@ function! ale#fixers#prettier_standard#Fix(buffer) abort return { \ 'command': ale#Escape(ale#fixers#prettier_standard#GetExecutable(a:buffer)) - \ . ' %t' + \ . ' --stdin' + \ . ' --stdin-filepath=%s' \ . ' ' . l:options, - \ 'read_temporary_file': 1, \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/protolint.vim b/sources_non_forked/ale/autoload/ale/fixers/protolint.vim new file mode 100644 index 00000000..9b8e72f1 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/protolint.vim @@ -0,0 +1,26 @@ +" Author: Yohei Yoshimuta +" Description: Integration of protolint with ALE. + +call ale#Set('proto_protolint_executable', 'protolint') +call ale#Set('proto_protolint_config', '') + +function! ale#fixers#protolint#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'proto_protolint_executable') + + return ale#Escape(l:executable) +endfunction + +function! ale#fixers#protolint#Fix(buffer) abort + let l:executable = ale#fixers#protolint#GetExecutable(a:buffer) + let l:config = ale#Var(a:buffer, 'proto_protolint_config') + + return { + \ 'command': l:executable + \ . (!empty(l:config) ? ' -config_path=' . ale#Escape(l:config) : '') + \ . ' -fix' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction + + diff --git a/sources_non_forked/ale/autoload/ale/fixers/ptop.vim b/sources_non_forked/ale/autoload/ale/fixers/ptop.vim new file mode 100644 index 00000000..98345226 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/ptop.vim @@ -0,0 +1,17 @@ +" Author: BarrOff https://github.com/BarrOff +" Description: Integration of ptop with ALE. + +call ale#Set('pascal_ptop_executable', 'ptop') +call ale#Set('pascal_ptop_options', '') + +function! ale#fixers#ptop#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'pascal_ptop_executable') + let l:options = ale#Var(a:buffer, 'pascal_ptop_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (empty(l:options) ? '' : ' ' . l:options) + \ . ' %s %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/purs_tidy.vim b/sources_non_forked/ale/autoload/ale/fixers/purs_tidy.vim new file mode 100644 index 00000000..09fa631b --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/purs_tidy.vim @@ -0,0 +1,24 @@ +" Author: toastal +" Description: Integration of purs-tidy with ALE. + +call ale#Set('purescript_tidy_executable', 'purs-tidy') +call ale#Set('purescript_tidy_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('purescript_tidy_options', '') + +function! ale#fixers#purs_tidy#GetExecutable(buffer) abort + return ale#path#FindExecutable(a:buffer, 'purescript_tidy', [ + \ 'node_modules/purescript-tidy/bin/index.js', + \ 'node_modules/.bin/purs-tidy', + \]) +endfunction + +function! ale#fixers#purs_tidy#Fix(buffer) abort + let l:executable = ale#fixers#purs_tidy#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'purescript_tidy_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . ' format' + \ . ale#Pad(l:options) + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/purty.vim b/sources_non_forked/ale/autoload/ale/fixers/purty.vim new file mode 100644 index 00000000..46d2cacd --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/purty.vim @@ -0,0 +1,22 @@ +" Author: iclanzan +" Description: Integration of purty with ALE. + +call ale#Set('purescript_purty_executable', 'purty') + +function! ale#fixers#purty#GetExecutable(buffer) abort + let l:executable = ale#Var(a:buffer, 'purescript_purty_executable') + + return ale#Escape(l:executable) +endfunction + +function! ale#fixers#purty#Fix(buffer) abort + let l:executable = ale#fixers#purty#GetExecutable(a:buffer) + + return { + \ 'command': l:executable + \ . ' --write' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/fixers/remark_lint.vim b/sources_non_forked/ale/autoload/ale/fixers/remark_lint.vim new file mode 100644 index 00000000..85593b44 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/remark_lint.vim @@ -0,0 +1,24 @@ +" Author: blyoa +" Description: Fixing files with remark-lint. + +call ale#Set('markdown_remark_lint_executable', 'remark') +call ale#Set('markdown_remark_lint_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('markdown_remark_lint_options', '') + +function! ale#fixers#remark_lint#GetExecutable(buffer) abort + return ale#path#FindExecutable(a:buffer, 'markdown_remark_lint', [ + \ 'node_modules/remark-cli/cli.js', + \ 'node_modules/.bin/remark', + \]) +endfunction + +function! ale#fixers#remark_lint#Fix(buffer) abort + let l:executable = ale#fixers#remark_lint#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'markdown_remark_lint_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : ''), + \} +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/fixers/reorder_python_imports.vim b/sources_non_forked/ale/autoload/ale/fixers/reorder_python_imports.vim new file mode 100644 index 00000000..42a0a6e2 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/reorder_python_imports.vim @@ -0,0 +1,25 @@ +" Author: jake +" Description: Fixing Python imports with reorder-python-imports. + +call ale#Set('python_reorder_python_imports_executable', 'reorder-python-imports') +call ale#Set('python_reorder_python_imports_options', '') +call ale#Set('python_reorder_python_imports_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale#fixers#reorder_python_imports#Fix(buffer) abort + let l:executable = ale#python#FindExecutable( + \ a:buffer, + \ 'python_reorder_python_imports', + \ ['reorder-python-imports'], + \) + + if !executable(l:executable) + return 0 + endif + + let l:options = ale#Var(a:buffer, 'python_reorder_python_imports_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') . ' -', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/rubocop.vim b/sources_non_forked/ale/autoload/ale/fixers/rubocop.vim index 33ba6887..5a1b7959 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/rubocop.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/rubocop.vim @@ -1,20 +1,38 @@ call ale#Set('ruby_rubocop_options', '') +call ale#Set('ruby_rubocop_auto_correct_all', 0) call ale#Set('ruby_rubocop_executable', 'rubocop') +" Rubocop fixer outputs diagnostics first and then the fixed +" output. These are delimited by a "=======" string that we +" look for to remove everything before it. +function! ale#fixers#rubocop#PostProcess(buffer, output) abort + let l:line = 0 + + for l:output in a:output + let l:line = l:line + 1 + + if l:output =~# "^=\\+$" + break + endif + endfor + + return a:output[l:line :] +endfunction + function! ale#fixers#rubocop#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable') - let l:config = ale#path#FindNearestFile(a:buffer, '.rubocop.yml') let l:options = ale#Var(a:buffer, 'ruby_rubocop_options') + let l:auto_correct_all = ale#Var(a:buffer, 'ruby_rubocop_auto_correct_all') - return ale#handlers#ruby#EscapeExecutable(l:executable, 'rubocop') - \ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '') + return ale#ruby#EscapeExecutable(l:executable, 'rubocop') \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' --auto-correct --force-exclusion %t' + \ . (l:auto_correct_all ? ' --auto-correct-all' : ' --auto-correct') + \ . ' --force-exclusion --stdin %s' endfunction function! ale#fixers#rubocop#Fix(buffer) abort return { \ 'command': ale#fixers#rubocop#GetCommand(a:buffer), - \ 'read_temporary_file': 1, + \ 'process_with': 'ale#fixers#rubocop#PostProcess' \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/sorbet.vim b/sources_non_forked/ale/autoload/ale/fixers/sorbet.vim new file mode 100644 index 00000000..7c12fa1e --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/sorbet.vim @@ -0,0 +1,19 @@ +call ale#Set('ruby_sorbet_executable', 'srb') +call ale#Set('ruby_sorbet_options', '') + +function! ale#fixers#sorbet#GetCommand(buffer) abort + let l:executable = ale#Var(a:buffer, 'ruby_sorbet_executable') + let l:options = ale#Var(a:buffer, 'ruby_sorbet_options') + + return ale#ruby#EscapeExecutable(l:executable, 'srb') + \ . ' tc' + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --autocorrect --file %t' +endfunction + +function! ale#fixers#sorbet#Fix(buffer) abort + return { + \ 'command': ale#fixers#sorbet#GetCommand(a:buffer), + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/sqlformat.vim b/sources_non_forked/ale/autoload/ale/fixers/sqlformat.vim new file mode 100644 index 00000000..6319c1ac --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/sqlformat.vim @@ -0,0 +1,16 @@ +" Author: Cluas +" Description: Fixing files with sqlformat. + +call ale#Set('sql_sqlformat_executable', 'sqlformat') +call ale#Set('sql_sqlformat_options', '') + +function! ale#fixers#sqlformat#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'sql_sqlformat_executable') + let l:options = ale#Var(a:buffer, 'sql_sqlformat_options') + + return { + \ 'command': ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' -' + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/standard.vim b/sources_non_forked/ale/autoload/ale/fixers/standard.vim index 77712d40..b9d60ebb 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/standard.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/standard.vim @@ -6,7 +6,8 @@ call ale#Set('javascript_standard_use_global', get(g:, 'ale_use_global_executabl call ale#Set('javascript_standard_options', '') function! ale#fixers#standard#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_standard', [ + return ale#path#FindExecutable(a:buffer, 'javascript_standard', [ + \ 'node_modules/standardx/bin/cmd.js', \ 'node_modules/standard/bin/cmd.js', \ 'node_modules/.bin/standard', \]) @@ -14,12 +15,19 @@ endfunction function! ale#fixers#standard#Fix(buffer) abort let l:executable = ale#fixers#standard#GetExecutable(a:buffer) - let l:options = ale#Var(a:buffer, 'javascript_standard_options') + let l:filetype = getbufvar(a:buffer, '&filetype') + let l:options_type = 'javascript_standard_options' + + if l:filetype =~# 'typescript' + let l:options_type = 'typescript_standard_options' + endif + + let l:options = ale#Var(a:buffer, l:options_type) return { \ 'command': ale#node#Executable(a:buffer, l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' --fix %t', + \ . ' --fix --stdin < %s > %t', \ 'read_temporary_file': 1, \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/standardrb.vim b/sources_non_forked/ale/autoload/ale/fixers/standardrb.vim index fab1e2bc..acb310c6 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/standardrb.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/standardrb.vim @@ -9,15 +9,15 @@ function! ale#fixers#standardrb#GetCommand(buffer) abort let l:config = ale#path#FindNearestFile(a:buffer, '.standard.yml') let l:options = ale#Var(a:buffer, 'ruby_standardrb_options') - return ale#handlers#ruby#EscapeExecutable(l:executable, 'standardrb') + return ale#ruby#EscapeExecutable(l:executable, 'standardrb') \ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '') \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' --fix --force-exclusion %t' + \ . ' --fix --force-exclusion --stdin %s' endfunction function! ale#fixers#standardrb#Fix(buffer) abort return { \ 'command': ale#fixers#standardrb#GetCommand(a:buffer), - \ 'read_temporary_file': 1, + \ 'process_with': 'ale#fixers#rubocop#PostProcess' \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/stylelint.vim b/sources_non_forked/ale/autoload/ale/fixers/stylelint.vim index 6bfb2fde..650b9c4a 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/stylelint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/stylelint.vim @@ -3,9 +3,10 @@ call ale#Set('stylelint_executable', 'stylelint') call ale#Set('stylelint_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('stylelint_options', '') function! ale#fixers#stylelint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'stylelint', [ + return ale#path#FindExecutable(a:buffer, 'stylelint', [ \ 'node_modules/stylelint/bin/stylelint.js', \ 'node_modules/.bin/stylelint', \]) @@ -13,10 +14,13 @@ endfunction function! ale#fixers#stylelint#Fix(buffer) abort let l:executable = ale#fixers#stylelint#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'stylelint_options') return { + \ 'cwd': '%s:h', \ 'command': ale#node#Executable(a:buffer, l:executable) - \ . ' --fix %t', - \ 'read_temporary_file': 1, + \ . ale#Pad(l:options) + \ . ' --fix --stdin --stdin-filename %s', + \ 'read_temporary_file': 0, \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/styler.vim b/sources_non_forked/ale/autoload/ale/fixers/styler.vim new file mode 100644 index 00000000..1c7607bd --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/styler.vim @@ -0,0 +1,16 @@ +" Author: tvatter +" Description: Fixing R files with styler. + +call ale#Set('r_styler_executable', 'Rscript') +call ale#Set('r_styler_options', 'tidyverse_style()') + +function! ale#fixers#styler#Fix(buffer) abort + return { + \ 'command': 'Rscript --vanilla -e ' + \ . '"suppressPackageStartupMessages(library(styler));' + \ . 'style_file(commandArgs(TRUE), transformers = ' + \ . ale#Var(a:buffer, 'r_styler_options') . ')"' + \ . ' %t', + \ 'read_temporary_file': 1, + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/stylua.vim b/sources_non_forked/ale/autoload/ale/fixers/stylua.vim new file mode 100644 index 00000000..3521c935 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/stylua.vim @@ -0,0 +1,14 @@ +" Author: Robert Liebowitz +" Description: https://github.com/johnnymorganz/stylua + +call ale#Set('lua_stylua_executable', 'stylua') +call ale#Set('lua_stylua_options', '') + +function! ale#fixers#stylua#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'lua_stylua_executable') + let l:options = ale#Var(a:buffer, 'lua_stylua_options') + + return { + \ 'command': ale#Escape(l:executable) . ale#Pad(l:options) . ' -', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/swiftformat.vim b/sources_non_forked/ale/autoload/ale/fixers/swiftformat.vim index 304182b2..cc553b7d 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/swiftformat.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/swiftformat.vim @@ -6,7 +6,7 @@ call ale#Set('swift_swiftformat_use_global', get(g:, 'ale_use_global_executables call ale#Set('swift_swiftformat_options', '') function! ale#fixers#swiftformat#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'swift_swiftformat', [ + return ale#path#FindExecutable(a:buffer, 'swift_swiftformat', [ \ 'Pods/SwiftFormat/CommandLineTool/swiftformat', \ 'ios/Pods/SwiftFormat/CommandLineTool/swiftformat', \ 'swiftformat', diff --git a/sources_non_forked/ale/autoload/ale/fixers/tidy.vim b/sources_non_forked/ale/autoload/ale/fixers/tidy.vim index 1af4120b..2c79e73a 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/tidy.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/tidy.vim @@ -5,7 +5,7 @@ call ale#Set('html_tidy_executable', 'tidy') call ale#Set('html_tidy_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale#fixers#tidy#Fix(buffer) abort - let l:executable = ale#node#FindExecutable( + let l:executable = ale#path#FindExecutable( \ a:buffer, \ 'html_tidy', \ ['tidy'], diff --git a/sources_non_forked/ale/autoload/ale/fixers/tslint.vim b/sources_non_forked/ale/autoload/ale/fixers/tslint.vim index b352af3a..15768fd5 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/tslint.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/tslint.vim @@ -16,7 +16,7 @@ function! ale#fixers#tslint#Fix(buffer) abort return { \ 'command': ale#node#Executable(a:buffer, l:executable) \ . l:tslint_config_option - \ . ' --fix %t', + \ . ' --outputAbsolutePaths --fix %t', \ 'read_temporary_file': 1, \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/vfmt.vim b/sources_non_forked/ale/autoload/ale/fixers/vfmt.vim new file mode 100644 index 00000000..2e780318 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/vfmt.vim @@ -0,0 +1,13 @@ +" Author: fiatjaf +" Description: Integration of `v fmt` with ALE. + +call ale#Set('v_vfmt_options', '') + +function! ale#fixers#vfmt#Fix(buffer) abort + let l:executable = ale#Var(a:buffer, 'v_v_executable') + let l:options = ale#Var(a:buffer, 'v_vfmt_options') + + return { + \ 'command': ale#Escape(l:executable) . ' fmt' . ale#Pad(l:options) + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/xo.vim b/sources_non_forked/ale/autoload/ale/fixers/xo.vim index 882350be..dcf4c737 100644 --- a/sources_non_forked/ale/autoload/ale/fixers/xo.vim +++ b/sources_non_forked/ale/autoload/ale/fixers/xo.vim @@ -1,23 +1,36 @@ " Author: Albert Marquez - https://github.com/a-marquez " Description: Fixing files with XO. -call ale#Set('javascript_xo_executable', 'xo') -call ale#Set('javascript_xo_use_global', get(g:, 'ale_use_global_executables', 0)) -call ale#Set('javascript_xo_options', '') +function! ale#fixers#xo#Fix(buffer) abort + let l:executable = ale#handlers#xo#GetExecutable(a:buffer) + let l:options = ale#handlers#xo#GetOptions(a:buffer) -function! ale#fixers#xo#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_xo', [ - \ 'node_modules/xo/cli.js', - \ 'node_modules/.bin/xo', - \]) + return ale#semver#RunWithVersionCheck( + \ a:buffer, + \ l:executable, + \ '%e --version', + \ {b, v -> ale#fixers#xo#ApplyFixForVersion(b, v, l:executable, l:options)} + \) endfunction -function! ale#fixers#xo#Fix(buffer) abort - let l:executable = ale#fixers#xo#GetExecutable(a:buffer) +function! ale#fixers#xo#ApplyFixForVersion(buffer, version, executable, options) abort + let l:executable = ale#node#Executable(a:buffer, a:executable) + let l:options = ale#Pad(a:options) + + " 0.30.0 is the first version with a working --stdin --fix + if ale#semver#GTE(a:version, [0, 30, 0]) + return { + \ 'command': l:executable + \ . ' --stdin --stdin-filename %s' + \ . ' --fix' + \ . l:options, + \} + endif return { - \ 'command': ale#node#Executable(a:buffer, l:executable) - \ . ' --fix %t', + \ 'command': l:executable + \ . ' --fix %t' + \ . l:options, \ 'read_temporary_file': 1, \} endfunction diff --git a/sources_non_forked/ale/autoload/ale/fixers/yamlfix.vim b/sources_non_forked/ale/autoload/ale/fixers/yamlfix.vim new file mode 100644 index 00000000..6654a25c --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/fixers/yamlfix.vim @@ -0,0 +1,25 @@ +" Author: lyz-code +" Description: Fixing yaml files with yamlfix. + +call ale#Set('yaml_yamlfix_executable', 'yamlfix') +call ale#Set('yaml_yamlfix_options', '') +call ale#Set('yaml_yamlfix_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale#fixers#yamlfix#Fix(buffer) abort + let l:options = ale#Var(a:buffer, 'yaml_yamlfix_options') + let l:executable = ale#python#FindExecutable( + \ a:buffer, + \ 'yaml_yamlfix', + \ ['yamlfix'], + \) + + if !executable(l:executable) + return 0 + endif + + return { + \ 'cwd': '%s:h', + \ 'command': ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') . ' -', + \} +endfunction diff --git a/sources_non_forked/ale/autoload/ale/floating_preview.vim b/sources_non_forked/ale/autoload/ale/floating_preview.vim new file mode 100644 index 00000000..f0bc8f80 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/floating_preview.vim @@ -0,0 +1,203 @@ +" Author: Jan-Grimo Sobez +" Author: Kevin Clark +" Author: D. Ben Knoble +" Description: Floating preview window for showing whatever information in. + +" Precondition: exists('*nvim_open_win') || has('popupwin') + +function! ale#floating_preview#Show(lines, ...) abort + if !exists('*nvim_open_win') && !has('popupwin') + execute 'echom ''Floating windows not supported in this vim instance.''' + + return + endif + + let l:options = get(a:000, 0, {}) + + if has('nvim') + call s:NvimShow(a:lines, l:options) + else + call s:VimShow(a:lines, l:options) + endif +endfunction + +function! s:NvimShow(lines, options) abort + " Remove the close autocmd so it doesn't happen mid update + augroup ale_floating_preview_window + autocmd! + augroup END + + " Only create a new window if we need it + if !exists('w:preview') || index(nvim_list_wins(), w:preview['id']) is# -1 + call s:NvimCreate(a:options) + else + call nvim_buf_set_option(w:preview['buffer'], 'modifiable', v:true) + endif + + " Execute commands in window context + let l:parent_window = nvim_get_current_win() + + call nvim_set_current_win(w:preview['id']) + + for l:command in get(a:options, 'commands', []) + call execute(l:command) + endfor + + call nvim_set_current_win(l:parent_window) + + " Return to parent context on move + augroup ale_floating_preview_window + autocmd! + + if g:ale_close_preview_on_insert + autocmd CursorMoved,TabLeave,WinLeave,InsertEnter ++once call s:NvimClose() + else + autocmd CursorMoved,TabLeave,WinLeave ++once call s:NvimClose() + endif + augroup END + + let [l:lines, l:width, l:height] = s:NvimPrepareWindowContent(a:lines) + + call nvim_win_set_width(w:preview['id'], l:width) + call nvim_win_set_height(w:preview['id'], l:height) + call nvim_buf_set_lines(w:preview['buffer'], 0, -1, v:false, l:lines) + call nvim_buf_set_option(w:preview['buffer'], 'modified', v:false) + call nvim_buf_set_option(w:preview['buffer'], 'modifiable', v:false) +endfunction + +function! s:VimShow(lines, options) abort + if g:ale_close_preview_on_insert + " Remove the close autocmd so it doesn't happen mid update + silent! autocmd! ale_floating_preview_window + endif + + " Only create a new window if we need it + if !exists('w:preview') || index(popup_list(), w:preview['id']) is# -1 + call s:VimCreate(a:options) + endif + + " Execute commands in window context + for l:command in get(a:options, 'commands', []) + call win_execute(w:preview['id'], l:command) + endfor + + call popup_settext(w:preview['id'], a:lines) + + if g:ale_close_preview_on_insert + augroup ale_floating_preview_window + autocmd! + autocmd InsertEnter * ++once call s:VimClose() + augroup END + endif +endfunction + +function! s:NvimPrepareWindowContent(lines) abort + let l:max_height = 10 + + 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:hor = g:ale_floating_window_border[0] + let l:top = g:ale_floating_window_border[1] + let l:top_left = g:ale_floating_window_border[2] + let l:top_right = g:ale_floating_window_border[3] + let l:bottom_right = g:ale_floating_window_border[4] + let l:bottom_left = g:ale_floating_window_border[5] + + 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:hor . l:line . repeat(' ', l:width - l:line_width - 2). l:hor) + 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:top, l:width - 2) . l:bottom_right) + + return [l:lines, l:width, l:height] +endfunction + +function! s:NvimCreate(options) abort + let l:buffer = nvim_create_buf(v:false, v:false) + let l:winid = nvim_open_win(l:buffer, v:false, { + \ 'relative': 'cursor', + \ 'row': 1, + \ 'col': 0, + \ 'width': 42, + \ 'height': 4, + \ 'style': 'minimal' + \ }) + call nvim_buf_set_option(l:buffer, 'buftype', 'acwrite') + call nvim_buf_set_option(l:buffer, 'bufhidden', 'delete') + call nvim_buf_set_option(l:buffer, 'swapfile', v:false) + call nvim_buf_set_option(l:buffer, 'filetype', get(a:options, 'filetype', 'ale-preview')) + + let w:preview = {'id': l:winid, 'buffer': l:buffer} +endfunction + +function! s:VimCreate(options) abort + let l:popup_id = popup_create([], { + \ 'line': 'cursor+1', + \ 'col': 'cursor', + \ 'drag': v:true, + \ 'resize': v:true, + \ 'close': 'button', + \ 'padding': [0, 1, 0, 1], + \ 'border': [], + \ 'borderchars': empty(g:ale_floating_window_border) ? [' '] : [ + \ g:ale_floating_window_border[1], + \ g:ale_floating_window_border[0], + \ g:ale_floating_window_border[1], + \ g:ale_floating_window_border[0], + \ g:ale_floating_window_border[2], + \ g:ale_floating_window_border[3], + \ g:ale_floating_window_border[4], + \ g:ale_floating_window_border[5], + \ ], + \ 'moved': 'any', + \ }) + call setbufvar(winbufnr(l:popup_id), '&filetype', get(a:options, 'filetype', 'ale-preview')) + let w:preview = {'id': l:popup_id} +endfunction + +function! s:NvimClose() abort + let l:mode = mode() + let l:restore_visual = l:mode is# 'v' || l:mode is# 'V' || l:mode is# "\" + + if !exists('w:preview') + return + endif + + call setbufvar(w:preview['buffer'], '&modified', 0) + + if win_id2win(w:preview['id']) > 0 + execute win_id2win(w:preview['id']).'wincmd c' + endif + + unlet w:preview + + if l:restore_visual + normal! gv + endif +endfunction + +function! s:VimClose() abort + if !exists('w:preview') + return + endif + + call popup_close(w:preview['id']) + unlet w:preview +endfunction diff --git a/sources_non_forked/ale/autoload/ale/go.vim b/sources_non_forked/ale/autoload/ale/go.vim index cd7d9503..bce85a87 100644 --- a/sources_non_forked/ale/autoload/ale/go.vim +++ b/sources_non_forked/ale/autoload/ale/go.vim @@ -25,3 +25,34 @@ function! ale#go#FindProjectRoot(buffer) abort return '' endfunction + + +call ale#Set('go_go111module', '') + +" Return a string setting Go-specific environment variables +function! ale#go#EnvString(buffer) abort + let l:env = '' + + " GO111MODULE - turn go modules behavior on/off + let l:go111module = ale#Var(a:buffer, 'go_go111module') + + if !empty(l:go111module) + let l:env = ale#Env('GO111MODULE', l:go111module) . l:env + endif + + return l:env +endfunction + +function! ale#go#GetGoPathExecutable(suffix) abort + let l:prefix = $GOPATH + + if !empty($GOPATH) + let l:prefix = $GOPATH + elseif has('win32') + let l:prefix = $USERPROFILE . '/go' + else + let l:prefix = $HOME . '/go' + endif + + return ale#path#Simplify(l:prefix . '/' . a:suffix) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/gradle.vim b/sources_non_forked/ale/autoload/ale/gradle.vim index dc377fb9..ba1add4d 100644 --- a/sources_non_forked/ale/autoload/ale/gradle.vim +++ b/sources_non_forked/ale/autoload/ale/gradle.vim @@ -50,18 +50,25 @@ function! ale#gradle#FindExecutable(buffer) abort return '' endfunction -" Given a buffer number, build a command to print the classpath of the root -" project. Returns an empty string if cannot build the command. +" Given a buffer number, get a working directory and command to print the +" classpath of the root project. +" +" Returns an empty string for the command if Gradle is not detected. function! ale#gradle#BuildClasspathCommand(buffer) abort let l:executable = ale#gradle#FindExecutable(a:buffer) - let l:project_root = ale#gradle#FindProjectRoot(a:buffer) - if !empty(l:executable) && !empty(l:project_root) - return ale#path#CdString(l:project_root) - \ . ale#Escape(l:executable) - \ . ' -I ' . ale#Escape(s:init_path) - \ . ' -q printClasspath' + if !empty(l:executable) + let l:project_root = ale#gradle#FindProjectRoot(a:buffer) + + if !empty(l:project_root) + return [ + \ l:project_root, + \ ale#Escape(l:executable) + \ . ' -I ' . ale#Escape(s:init_path) + \ . ' -q printClasspath' + \] + endif endif - return '' + return ['', ''] endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/alex.vim b/sources_non_forked/ale/autoload/ale/handlers/alex.vim index 190a7f86..6ef4867f 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/alex.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/alex.vim @@ -3,7 +3,7 @@ scriptencoding utf-8 " Description: Error handling for errors in alex output format function! ale#handlers#alex#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'alex', [ + return ale#path#FindExecutable(a:buffer, 'alex', [ \ 'node_modules/.bin/alex', \ 'node_modules/alex/cli.js', \]) diff --git a/sources_non_forked/ale/autoload/ale/handlers/atools.vim b/sources_non_forked/ale/autoload/ale/handlers/atools.vim new file mode 100644 index 00000000..c273fc40 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/atools.vim @@ -0,0 +1,41 @@ +" Author: Leo +" Description: Handlers for output expected from atools + +function! ale#handlers#atools#Handle(buffer, lines) abort + " Format: SEVERITY:[TAG]:PATH:LINENUM:MSG + " Example: MC:[AL5]:./APKBUILD:12:variable set to empty string: install= + let l:pattern = '\([^:]\+\):\([^:]\+\):\([^:]\+\):\(\d\+\):\(.\+\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + " We are expected to receive 2 characters, the first character + " can be 'S', 'I', 'M' 'T', which are respectively: + " Serious (Error) + " Important (Error) + " Minor (Warning) + " Style (Warning) + " + " The second character can be either 'C' or 'P', which are respectively: + " Certain (Error) + " Possible (Warning) + let l:severity = matchstr(l:match[1], '^.') + let l:certainty = matchstr(l:match[1], '.$') + + let l:type = 'E' + " If the tag returns 'Minor' or 'Style' or is 'Possible' + " then return a warning + + if l:severity is# 'M' || l:severity is# 'T' || l:certainty is# 'P' + let l:type = 'W' + endif + + call add(l:output, { + \ 'lnum': l:match[4] + 0, + \ 'text': l:match[5], + \ 'type': l:type, + \ 'code': matchstr(l:match[2], 'AL[0-9]*'), + \}) + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/ccls.vim b/sources_non_forked/ale/autoload/ale/handlers/ccls.vim index 29dd6aed..290f5852 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/ccls.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/ccls.vim @@ -3,15 +3,24 @@ scriptencoding utf-8 " Description: Utilities for ccls function! ale#handlers#ccls#GetProjectRoot(buffer) abort - let l:project_root = ale#path#FindNearestFile(a:buffer, '.ccls-root') + " Try to find ccls configuration files first. + let l:config = ale#path#FindNearestFile(a:buffer, '.ccls-root') - if empty(l:project_root) - let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') + if empty(l:config) + let l:config = ale#path#FindNearestFile(a:buffer, '.ccls') endif - if empty(l:project_root) - let l:project_root = ale#path#FindNearestFile(a:buffer, '.ccls') + if !empty(l:config) + return fnamemodify(l:config, ':h') endif - return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' + " Fall back on default project root detection. + return ale#c#FindProjectRoot(a:buffer) +endfunction + +function! ale#handlers#ccls#GetInitOpts(buffer, init_options_var) abort + let l:build_dir = ale#c#GetBuildDirectory(a:buffer) + let l:init_options = empty(l:build_dir) ? {} : {'compilationDatabaseDirectory': l:build_dir} + + return extend(l:init_options, ale#Var(a:buffer, a:init_options_var)) endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim b/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim index dc56cd0b..a07d0aed 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/cppcheck.vim @@ -1,18 +1,67 @@ " Description: Handle errors for cppcheck. +function! ale#handlers#cppcheck#GetCwd(buffer) abort + let [l:dir, l:json_path] = ale#c#FindCompileCommands(a:buffer) + + return !empty(l:dir) ? l:dir : '' +endfunction + +function! ale#handlers#cppcheck#GetBufferPathIncludeOptions(buffer) abort + let l:buffer_path_include = '' + + " Get path to this buffer so we can include it into cppcheck with -I + " This could be expanded to get more -I directives from the compile + " command in compile_commands.json, if it's found. + let l:buffer_path = fnamemodify(bufname(a:buffer), ':p:h') + let l:buffer_path_include = ' -I' . ale#Escape(l:buffer_path) + + return l:buffer_path_include +endfunction + +function! ale#handlers#cppcheck#GetCompileCommandsOptions(buffer) abort + " If the current buffer is modified, using compile_commands.json does no + " good, so include the file's directory instead. It's not quite as good as + " using --project, but is at least equivalent to running cppcheck on this + " file manually from the file's directory. + let l:modified = getbufvar(a:buffer, '&modified') + + if l:modified + return '' + endif + + " Search upwards from the file for compile_commands.json. + " + " If we find it, we'll `cd` to where the compile_commands.json file is, + " then use the file to set up import paths, etc. + let [l:dir, l:json_path] = ale#c#FindCompileCommands(a:buffer) + + return !empty(l:json_path) + \ ? '--project=' . ale#Escape(l:json_path[len(l:dir) + 1: ]) + \ : '' +endfunction + function! ale#handlers#cppcheck#HandleCppCheckFormat(buffer, lines) abort " Look for lines like the following. " - " [test.cpp:5]: (error) Array 'a[10]' accessed at index 10, which is out of bounds - let l:pattern = '\v^\[(.+):(\d+)\]: \(([a-z]+)\) (.+)$' + "test.cpp:974:6: error:inconclusive Array 'n[3]' accessed at index 3, which is out of bounds. [arrayIndexOutOfBounds]\ + " n[3]=3; + " ^ + "" OR if cppcheck doesn't support {column} or {inconclusive:text}: + "test.cpp:974:{column}: error:{inconclusive:inconclusive} Array 'n[3]' accessed at index 3, which is out of bounds. [arrayIndexOutOfBounds]\ + " n[3]=3; + " ^ + let l:pattern = '\v(\f+):(\d+):(\d+|\{column\}): (\w+):(\{inconclusive:inconclusive\})? ?(.*) \[(\w+)\]\' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) if ale#path#IsBufferPath(a:buffer, l:match[1]) call add(l:output, { - \ 'lnum': str2nr(l:match[2]), - \ 'type': l:match[3] is# 'error' ? 'E' : 'W', - \ 'text': l:match[4], + \ 'lnum': str2nr(l:match[2]), + \ 'col': match(l:match[3],'{column}') >= 0 ? 1 : str2nr(l:match[3]), + \ 'type': l:match[4] is# 'error' ? 'E' : 'W', + \ 'sub_type': l:match[4] is# 'style' ? 'style' : '', + \ 'text': l:match[6], + \ 'code': l:match[7] \}) endif endfor diff --git a/sources_non_forked/ale/autoload/ale/handlers/deno.vim b/sources_non_forked/ale/autoload/ale/handlers/deno.vim new file mode 100644 index 00000000..1b5e1718 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/deno.vim @@ -0,0 +1,74 @@ +" Author: Mohammed Chelouti - https://github.com/motato1 +" Arnold Chand +" Description: Handler functions for Deno. + +call ale#Set('deno_executable', 'deno') +call ale#Set('deno_unstable', 0) +call ale#Set('deno_importMap', 'import_map.json') +call ale#Set('deno_lsp_project_root', '') + +function! ale#handlers#deno#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'deno_executable') +endfunction + +" Find project root for Deno's language server. +" +" Deno projects do not require a project or configuration file at the project root. +" This means the root directory has to be guessed, +" unless it is explicitly specified by the user. +" +" The project root is determined by ... +" 1. using a user-specified value from deno_lsp_project_root +" 2. looking for common top-level files/dirs +" 3. using the buffer's directory +function! ale#handlers#deno#GetProjectRoot(buffer) abort + let l:project_root = ale#Var(a:buffer, 'deno_lsp_project_root') + + if !empty(l:project_root) + return l:project_root + endif + + let l:possible_project_roots = [ + \ 'tsconfig.json', + \ '.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 + +" Initialization Options for deno, for javascript and typescript +function! ale#handlers#deno#GetInitializationOptions(buffer) abort + let l:options = { + \ 'enable': v:true, + \ 'lint': v:true, + \ 'unstable': v:false, + \ 'importMap': ale#path#FindNearestFile(a:buffer, 'import_map.json'), + \ } + + if ale#Var(a:buffer, 'deno_unstable') + let l:options.unstable = v:true + endif + + if ale#Var(a:buffer, 'deno_importMap') isnot# '' + let l:options.importMap = ale#path#FindNearestFile(a:buffer, ale#Var(a:buffer, 'deno_importMap')) + endif + + return l:options +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim index bc7c0321..374460bc 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/eslint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/eslint.vim @@ -1,6 +1,12 @@ " Author: w0rp " Description: Functions for working with eslint, for checking or fixing files. +let s:executables = [ +\ '.yarn/sdks/eslint/bin/eslint.js', +\ 'node_modules/.bin/eslint_d', +\ 'node_modules/eslint/bin/eslint.js', +\ 'node_modules/.bin/eslint', +\] let s:sep = has('win32') ? '\' : '/' call ale#Set('javascript_eslint_options', '') @@ -30,11 +36,36 @@ function! ale#handlers#eslint#FindConfig(buffer) abort endfunction function! ale#handlers#eslint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'javascript_eslint', [ - \ 'node_modules/.bin/eslint_d', - \ 'node_modules/eslint/bin/eslint.js', - \ 'node_modules/.bin/eslint', - \]) + return ale#path#FindExecutable(a:buffer, 'javascript_eslint', s:executables) +endfunction + +" Given a buffer, return an appropriate working directory for ESLint. +function! ale#handlers#eslint#GetCwd(buffer) abort + " ESLint 6 loads plugins/configs/parsers from the project root + " By default, the project root is simply the CWD of the running process. + " https://github.com/eslint/rfcs/blob/master/designs/2018-simplified-package-loading/README.md + " https://github.com/dense-analysis/ale/issues/2787 + " + " If eslint is installed in a directory which contains the buffer, assume + " it is the ESLint project root. Otherwise, use nearest node_modules. + " Note: If node_modules not present yet, can't load local deps anyway. + let l:executable = ale#path#FindNearestExecutable(a:buffer, s:executables) + + if !empty(l:executable) + let l:modules_index = strridx(l:executable, 'node_modules') + let l:modules_root = l:modules_index > -1 ? l:executable[0:l:modules_index - 2] : '' + + let l:sdks_index = strridx(l:executable, ale#path#Simplify('.yarn/sdks')) + let l:sdks_root = l:sdks_index > -1 ? l:executable[0:l:sdks_index - 2] : '' + else + let l:modules_dir = ale#path#FindNearestDirectory(a:buffer, 'node_modules') + let l:modules_root = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : '' + + let l:sdks_dir = ale#path#FindNearestDirectory(a:buffer, ale#path#Simplify('.yarn/sdks')) + let l:sdks_root = !empty(l:sdks_dir) ? fnamemodify(l:sdks_dir, ':h:h:h') : '' + endif + + return strlen(l:modules_root) > strlen(l:sdks_root) ? l:modules_root : l:sdks_root endfunction function! ale#handlers#eslint#GetCommand(buffer) abort @@ -44,16 +75,9 @@ function! ale#handlers#eslint#GetCommand(buffer) abort return ale#node#Executable(a:buffer, l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' -f unix --stdin --stdin-filename %s' + \ . ' -f json --stdin --stdin-filename %s' endfunction -let s:col_end_patterns = [ -\ '\vParsing error: Unexpected token (.+) ?', -\ '\v''(.+)'' is not defined.', -\ '\v%(Unexpected|Redundant use of) [''`](.+)[''`]', -\ '\vUnexpected (console) statement', -\] - function! s:AddHintsForTypeScriptParsingErrors(output) abort for l:item in a:output let l:item.text = substitute( @@ -90,22 +114,74 @@ function! s:CheckForBadConfig(buffer, lines) abort return 0 endfunction -function! ale#handlers#eslint#Handle(buffer, lines) abort - if s:CheckForBadConfig(a:buffer, a:lines) - return [{ - \ 'lnum': 1, - \ 'text': 'eslint configuration error (type :ALEDetail for more information)', - \ 'detail': join(a:lines, "\n"), - \}] +function! s:parseJSON(buffer, lines) abort + let l:parsed = [] + + for l:line in a:lines + try + let l:parsed = extend(l:parsed, json_decode(l:line)) + catch + endtry + endfor + + if type(l:parsed) != v:t_list || empty(l:parsed) + return [] endif - if a:lines == ['Could not connect'] - return [{ - \ 'lnum': 1, - \ 'text': 'Could not connect to eslint_d. Try updating eslint_d or killing it.', - \}] + let l:errors = l:parsed[0]['messages'] + + if empty(l:errors) + return [] endif + let l:output = [] + + for l:error in l:errors + let l:obj = ({ + \ 'lnum': get(l:error, 'line', 0), + \ 'text': get(l:error, 'message', ''), + \ 'type': 'E', + \}) + + if get(l:error, 'severity', 0) is# 1 + let l:obj.type = 'W' + endif + + if has_key(l:error, 'ruleId') + let l:code = l:error['ruleId'] + + " Sometimes ESLint returns null here + if !empty(l:code) + let l:obj.code = l:code + endif + endif + + if has_key(l:error, 'column') + let l:obj.col = l:error['column'] + endif + + if has_key(l:error, 'endColumn') + let l:obj.end_col = l:error['endColumn'] - 1 + endif + + if has_key(l:error, 'endLine') + let l:obj.end_lnum = l:error['endLine'] + endif + + call add(l:output, l:obj) + endfor + + return l:output +endfunction + +let s:col_end_patterns = [ +\ '\vParsing error: Unexpected token (.+) ?', +\ '\v''(.+)'' is not defined.', +\ '\v%(Unexpected|Redundant use of) [''`](.+)[''`]', +\ '\vUnexpected (console) statement', +\] + +function! s:parseLines(buffer, lines) abort " Matches patterns line the following: " " /path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle] @@ -120,12 +196,6 @@ function! ale#handlers#eslint#Handle(buffer, lines) abort for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:parsing_pattern]) let l:text = l:match[3] - if ale#Var(a:buffer, 'javascript_eslint_suppress_eslintignore') - if l:text =~# '^File ignored' - continue - endif - endif - let l:obj = { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, @@ -152,9 +222,59 @@ function! ale#handlers#eslint#Handle(buffer, lines) abort call add(l:output, l:obj) endfor + return l:output +endfunction + +function! s:FilterResult(buffer, obj) abort + if ale#Var(a:buffer, 'javascript_eslint_suppress_eslintignore') + if a:obj.text =~# '^File ignored' + return 0 + endif + endif + + if has_key(a:obj, 'code') && a:obj.code is# 'no-trailing-spaces' + \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + return 0 + endif + + return 1 +endfunction + +function! s:HandleESLintOutput(buffer, lines, type) abort + if s:CheckForBadConfig(a:buffer, a:lines) + return [{ + \ 'lnum': 1, + \ 'text': 'eslint configuration error (type :ALEDetail for more information)', + \ 'detail': join(a:lines, "\n"), + \}] + endif + + if a:lines == ['Could not connect'] + return [{ + \ 'lnum': 1, + \ 'text': 'Could not connect to eslint_d. Try updating eslint_d or killing it.', + \}] + endif + + if a:type is# 'json' + let l:output = s:parseJSON(a:buffer, a:lines) + else + let l:output = s:parseLines(a:buffer, a:lines) + endif + + call filter(l:output, {idx, obj -> s:FilterResult(a:buffer, obj)}) + if expand('#' . a:buffer . ':t') =~? '\.tsx\?$' call s:AddHintsForTypeScriptParsingErrors(l:output) endif return l:output endfunction + +function! ale#handlers#eslint#HandleJSON(buffer, lines) abort + return s:HandleESLintOutput(a:buffer, a:lines, 'json') +endfunction + +function! ale#handlers#eslint#Handle(buffer, lines) abort + return s:HandleESLintOutput(a:buffer, a:lines, 'lines') +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/fecs.vim b/sources_non_forked/ale/autoload/ale/handlers/fecs.vim new file mode 100644 index 00000000..064b927e --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/fecs.vim @@ -0,0 +1,52 @@ +" Author: harttle +" Description: fecs http://fecs.baidu.com/ + +call ale#Set('javascript_fecs_executable', 'fecs') +call ale#Set('javascript_fecs_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale#handlers#fecs#GetCommand(buffer) abort + return '%e check --colors=false --rule=true %t' +endfunction + +function! ale#handlers#fecs#GetExecutable(buffer) abort + return ale#path#FindExecutable(a:buffer, 'javascript_fecs', [ + \ 'node_modules/.bin/fecs', + \ 'node_modules/fecs/bin/fecs', + \]) +endfunction + +function! ale#handlers#fecs#Handle(buffer, lines) abort + " Matches patterns looking like the following + " + " fecs WARN โ†’ line 20, col 25: Unexpected console statement. (no-console) + " fecs ERROR โ†’ line 24, col 36: Missing radix parameter. (radix) + " + let l:pattern = '\v^.*(WARN|ERROR)\s+โ†’\s+line (\d+),\s+col\s+(\d+):\s+(.*)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:obj = { + \ 'lnum': l:match[2] + 0, + \ 'col': l:match[3] + 0, + \ 'text': l:match[4] + \} + + let l:code_match = matchlist(l:match[4], '\v^(.{-})\s*\((.+)\)$') + + if !empty(l:code_match) + let l:obj.code = l:code_match[2] + let l:obj.text = l:code_match[1] + endif + + if l:match[1] is# 'WARN' + let l:obj.type = 'W' + elseif l:match[1] is# 'ERROR' + let l:obj.type = 'E' + endif + + call add(l:output, l:obj) + endfor + + return l:output +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/handlers/gcc.vim b/sources_non_forked/ale/autoload/ale/handlers/gcc.vim index 72d639da..0b37c98a 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/gcc.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/gcc.vim @@ -10,7 +10,8 @@ let s:pragma_error = '#pragma once in main file' " :8:5: warning: conversion lacks type at end of format [-Wformat=] " :10:27: error: invalid operands to binary - (have โ€˜intโ€™ and โ€˜char *โ€™) " -:189:7: note: $/${} is unnecessary on arithmetic variables. [SC2004] -let s:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+)$' +let s:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+)?:?(\d+)?:? ([^:]+): (.+)$' +let s:inline_pattern = '\v inlined from .* at \:(\d+):(\d+):$' function! s:IsHeaderFile(filename) abort return a:filename =~? '\v\.(h|hpp)$' @@ -25,6 +26,28 @@ function! s:RemoveUnicodeQuotes(text) abort return l:text endfunction +function! s:ParseInlinedFunctionProblems(buffer, lines) abort + let l:output = [] + let l:pos_match = [] + + for l:line in a:lines + let l:match = matchlist(l:line, s:pattern) + + if !empty(l:match) && !empty(l:pos_match) + call add(l:output, { + \ 'lnum': str2nr(l:pos_match[1]), + \ 'col': str2nr(l:pos_match[2]), + \ 'type': (l:match[4] is# 'error' || l:match[4] is# 'fatal error') ? 'E' : 'W', + \ 'text': s:RemoveUnicodeQuotes(l:match[5]), + \}) + endif + + let l:pos_match = matchlist(l:line, s:inline_pattern) + endfor + + return l:output +endfunction + " Report problems inside of header files just for gcc and clang function! s:ParseProblemsInHeaders(buffer, lines) abort let l:output = [] @@ -94,6 +117,23 @@ function! ale#handlers#gcc#HandleGCCFormat(buffer, lines) abort if !empty(l:output) if !has_key(l:output[-1], 'detail') let l:output[-1].detail = l:output[-1].text + + " handle macro expansion errors/notes + if l:match[5] =~? '^in expansion of macro โ€˜\w*\wโ€™$' + " if the macro expansion is in the file we're in, add + " the lnum and col keys to the previous error + if l:match[1] is# '' + \ && !has_key(l:output[-1], 'col') + let l:output[-1].lnum = str2nr(l:match[2]) + let l:output[-1].col = str2nr(l:match[3]) + else + " the error is not in the current file, and since + " macro expansion errors don't show the full path to + " the error from the current file, we have to just + " give out a generic error message + let l:output[-1].text = 'Error found in macro expansion. See :ALEDetail' + endif + endif endif let l:output[-1].detail = l:output[-1].detail . "\n" @@ -129,6 +169,7 @@ endfunction function! ale#handlers#gcc#HandleGCCFormatWithIncludes(buffer, lines) abort let l:output = ale#handlers#gcc#HandleGCCFormat(a:buffer, a:lines) + call extend(l:output, s:ParseInlinedFunctionProblems(a:buffer, a:lines)) call extend(l:output, s:ParseProblemsInHeaders(a:buffer, a:lines)) return l:output diff --git a/sources_non_forked/ale/autoload/ale/handlers/go.vim b/sources_non_forked/ale/autoload/ale/handlers/go.vim index f17cd862..c969669d 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/go.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/go.vim @@ -6,9 +6,12 @@ " " Author: Ben Paxton " Description: moved to generic Golang file from govet +" +" Author: mostfunkyduck +" Description: updated to work with go 1.14 function! ale#handlers#go#Handler(buffer, lines) abort - let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? ?(.+)$' + let l:pattern = '\v^%(vet: )?([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? ?(.+)$' let l:output = [] let l:dir = expand('#' . a:buffer . ':p:h') diff --git a/sources_non_forked/ale/autoload/ale/handlers/hdl_checker.vim b/sources_non_forked/ale/autoload/ale/handlers/hdl_checker.vim new file mode 100644 index 00000000..e11c5377 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/hdl_checker.vim @@ -0,0 +1,73 @@ +" Author: suoto +" Description: Adds support for HDL Code Checker, which wraps vcom/vlog, ghdl +" or xvhdl. More info on https://github.com/suoto/hdl_checker + +call ale#Set('hdl_checker_executable', 'hdl_checker') +call ale#Set('hdl_checker_config_file', has('unix') ? '.hdl_checker.config' : '_hdl_checker.config') +call ale#Set('hdl_checker_options', '') + +" Use this as a function so we can mock it on testing. Need to do this because +" test files are inside /testplugin (which refers to the ale repo), which will +" always have a .git folder +function! ale#handlers#hdl_checker#IsDotGit(path) abort + return ! empty(a:path) && isdirectory(a:path) +endfunction + +" Sould return (in order of preference) +" 1. Nearest config file +" 2. Nearest .git directory +" 3. The current path +function! ale#handlers#hdl_checker#GetProjectRoot(buffer) abort + let l:project_root = ale#path#FindNearestFile( + \ a:buffer, + \ ale#Var(a:buffer, 'hdl_checker_config_file')) + + if !empty(l:project_root) + return fnamemodify(l:project_root, ':h') + endif + + " Search for .git to use as root + let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git') + + if ale#handlers#hdl_checker#IsDotGit(l:project_root) + return fnamemodify(l:project_root, ':h:h') + endif + + return '' +endfunction + +function! ale#handlers#hdl_checker#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'hdl_checker_executable') +endfunction + +function! ale#handlers#hdl_checker#GetCommand(buffer) abort + let l:command = ale#Escape(ale#handlers#hdl_checker#GetExecutable(a:buffer)) . ' --lsp' + + " Add extra parameters only if config has been set + let l:options = ale#Var(a:buffer, 'hdl_checker_options') + + if ! empty(l:options) + let l:command = l:command . ' ' . l:options + endif + + return l:command +endfunction + +" To allow testing +function! ale#handlers#hdl_checker#GetInitOptions(buffer) abort + return {'project_file': ale#Var(a:buffer, 'hdl_checker_config_file')} +endfunction + +" Define the hdl_checker linter for a given filetype. +function! ale#handlers#hdl_checker#DefineLinter(filetype) abort + call ale#linter#Define(a:filetype, { + \ 'name': 'hdl-checker', + \ 'lsp': 'stdio', + \ 'language': a:filetype, + \ 'executable': function('ale#handlers#hdl_checker#GetExecutable'), + \ 'command': function('ale#handlers#hdl_checker#GetCommand'), + \ 'project_root': function('ale#handlers#hdl_checker#GetProjectRoot'), + \ 'initialization_options': function('ale#handlers#hdl_checker#GetInitOptions'), + \ }) +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/handlers/inko.vim b/sources_non_forked/ale/autoload/ale/handlers/inko.vim new file mode 100644 index 00000000..73f06871 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/inko.vim @@ -0,0 +1,37 @@ +" Author: Yorick Peterse +" Description: output handlers for the Inko JSON format + +function! ale#handlers#inko#GetType(severity) abort + if a:severity is? 'warning' + return 'W' + endif + + return 'E' +endfunction + +function! ale#handlers#inko#Handle(buffer, lines) abort + try + let l:errors = json_decode(join(a:lines, '')) + catch + return [] + endtry + + if empty(l:errors) + return [] + endif + + let l:output = [] + let l:dir = expand('#' . a:buffer . ':p:h') + + for l:error in l:errors + call add(l:output, { + \ 'filename': ale#path#GetAbsPath(l:dir, l:error['file']), + \ 'lnum': l:error['line'], + \ 'col': l:error['column'], + \ 'text': l:error['message'], + \ 'type': ale#handlers#inko#GetType(l:error['level']), + \}) + endfor + + return l:output +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/ktlint.vim b/sources_non_forked/ale/autoload/ale/handlers/ktlint.vim index ad999485..77e7ab66 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/ktlint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/ktlint.vim @@ -13,7 +13,7 @@ function! ale#handlers#ktlint#GetCommand(buffer) abort return ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) \ . (empty(l:rulesets) ? '' : ' ' . l:rulesets) - \ . ' %t' + \ . ' --stdin' endfunction function! ale#handlers#ktlint#GetRulesets(buffer) abort diff --git a/sources_non_forked/ale/autoload/ale/handlers/languagetool.vim b/sources_non_forked/ale/autoload/ale/handlers/languagetool.vim index 10e049df..73974ceb 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/languagetool.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/languagetool.vim @@ -2,6 +2,7 @@ " Description: languagetool for markdown files " call ale#Set('languagetool_executable', 'languagetool') +call ale#Set('languagetool_options', '--autoDetect') function! ale#handlers#languagetool#GetExecutable(buffer) abort return ale#Var(a:buffer, 'languagetool_executable') @@ -9,8 +10,10 @@ endfunction function! ale#handlers#languagetool#GetCommand(buffer) abort let l:executable = ale#handlers#languagetool#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'languagetool_options') - return ale#Escape(l:executable) . ' --autoDetect %s' + return ale#Escape(l:executable) + \ . (empty(l:options) ? '' : ' ' . l:options) . ' %s' endfunction function! ale#handlers#languagetool#HandleOutput(buffer, lines) abort diff --git a/sources_non_forked/ale/autoload/ale/handlers/markdownlint.vim b/sources_non_forked/ale/autoload/ale/handlers/markdownlint.vim index daaa1d66..6c273bd0 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/markdownlint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/markdownlint.vim @@ -2,15 +2,22 @@ " Description: Adds support for markdownlint function! ale#handlers#markdownlint#Handle(buffer, lines) abort - let l:pattern=': \(\d*\): \(MD\d\{3}\)\(\/\)\([A-Za-z0-9-]\+\)\(.*\)$' + let l:pattern=': \?\(\d\+\)\(:\(\d\+\)\?\)\? \(MD\d\{3}/[A-Za-z0-9-/]\+\) \(.*\)$' let l:output=[] for l:match in ale#util#GetMatches(a:lines, l:pattern) - call add(l:output, { + let l:result = ({ \ 'lnum': l:match[1] + 0, - \ 'text': '(' . l:match[2] . l:match[3] . l:match[4] . ')' . l:match[5], + \ 'code': l:match[4], + \ 'text': l:match[5], \ 'type': 'W', \}) + + if len(l:match[3]) > 0 + let l:result.col = (l:match[3] + 0) + endif + + call add(l:output, l:result) endfor return l:output diff --git a/sources_non_forked/ale/autoload/ale/handlers/ocamllsp.vim b/sources_non_forked/ale/autoload/ale/handlers/ocamllsp.vim new file mode 100644 index 00000000..2738ea2b --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/ocamllsp.vim @@ -0,0 +1,30 @@ +" Author: Risto Stevcev +" Description: Handlers for the official OCaml language server + +let s:language_id_of_filetype = { +\ 'menhir': 'ocaml.menhir', +\ 'ocaml': 'ocaml', +\ 'ocamlinterface': 'ocaml.interface', +\ 'ocamllex': 'ocaml.lex' +\} + +function! ale#handlers#ocamllsp#GetExecutable(buffer) abort + return 'ocamllsp' +endfunction + +function! ale#handlers#ocamllsp#GetCommand(buffer) abort + let l:executable = ale#handlers#ocamllsp#GetExecutable(a:buffer) + let l:ocaml_ocamllsp_use_opam = ale#Var(a:buffer, 'ocaml_ocamllsp_use_opam') + + return l:ocaml_ocamllsp_use_opam ? 'opam config exec -- ' . l:executable : l:executable +endfunction + +function! ale#handlers#ocamllsp#GetLanguage(buffer) abort + return s:language_id_of_filetype[getbufvar(a:buffer, '&filetype')] +endfunction + +function! ale#handlers#ocamllsp#GetProjectRoot(buffer) abort + let l:dune_project_file = ale#path#FindNearestFile(a:buffer, 'dune-project') + + return !empty(l:dune_project_file) ? fnamemodify(l:dune_project_file, ':h') : '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/ols.vim b/sources_non_forked/ale/autoload/ale/handlers/ols.vim index 74130a26..c292c6d9 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/ols.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/ols.vim @@ -4,7 +4,7 @@ function! ale#handlers#ols#GetExecutable(buffer) abort let l:ols_setting = ale#handlers#ols#GetLanguage(a:buffer) . '_ols' - return ale#node#FindExecutable(a:buffer, l:ols_setting, [ + return ale#path#FindExecutable(a:buffer, l:ols_setting, [ \ 'node_modules/.bin/ocaml-language-server', \]) endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/redpen.vim b/sources_non_forked/ale/autoload/ale/handlers/redpen.vim index 84e331ed..195057ca 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/redpen.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/redpen.vim @@ -4,10 +4,10 @@ function! ale#handlers#redpen#HandleRedpenOutput(buffer, lines) abort " Only one file was passed to redpen. So response array has only one " element. - let l:res = json_decode(join(a:lines))[0] + let l:res = get(ale#util#FuzzyJSONDecode(a:lines, []), 0, {}) let l:output = [] - for l:err in l:res.errors + for l:err in get(l:res, 'errors', []) let l:item = { \ 'text': l:err.message, \ 'type': 'W', diff --git a/sources_non_forked/ale/autoload/ale/handlers/ruby.vim b/sources_non_forked/ale/autoload/ale/handlers/ruby.vim index c28b8b75..7a1c5765 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/ruby.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/ruby.vim @@ -36,11 +36,3 @@ endfunction function! ale#handlers#ruby#HandleSyntaxErrors(buffer, lines) abort return s:HandleSyntaxError(a:buffer, a:lines) endfunction - -function! ale#handlers#ruby#EscapeExecutable(executable, bundle_exec) abort - let l:exec_args = a:executable =~? 'bundle' - \ ? ' exec ' . a:bundle_exec - \ : '' - - return ale#Escape(a:executable) . l:exec_args -endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/rust.vim b/sources_non_forked/ale/autoload/ale/handlers/rust.vim index dda6466e..a7fac464 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/rust.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/rust.vim @@ -56,14 +56,20 @@ function! ale#handlers#rust#HandleRustErrors(buffer, lines) abort endif if !empty(l:span) - call add(l:output, { + let l:output_line = { \ 'lnum': l:span.line_start, \ 'end_lnum': l:span.line_end, \ 'col': l:span.column_start, \ 'end_col': l:span.column_end-1, \ 'text': empty(l:span.label) ? l:error.message : printf('%s: %s', l:error.message, l:span.label), \ 'type': toupper(l:error.level[0]), - \}) + \} + + if has_key(l:error, 'rendered') && !empty(l:error.rendered) + let l:output_line.detail = l:error.rendered + endif + + call add(l:output, l:output_line) endif endfor endfor diff --git a/sources_non_forked/ale/autoload/ale/handlers/sh.vim b/sources_non_forked/ale/autoload/ale/handlers/sh.vim index 75eaf71f..6ed9fea3 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/sh.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/sh.vim @@ -1,20 +1,37 @@ " Author: w0rp -" Get the shell type for a buffer, based on the hashbang line. function! ale#handlers#sh#GetShellType(buffer) abort - let l:bang_line = get(getbufline(a:buffer, 1), 0, '') + let l:shebang = get(getbufline(a:buffer, 1), 0, '') - " Take the shell executable from the hashbang, if we can. - if l:bang_line[:1] is# '#!' + let l:command = '' + + " Take the shell executable from the shebang, if we can. + if l:shebang[:1] is# '#!' " Remove options like -e, etc. - let l:command = substitute(l:bang_line, ' --\?[a-zA-Z0-9]\+', '', 'g') - - for l:possible_shell in ['bash', 'dash', 'ash', 'tcsh', 'csh', 'zsh', 'ksh', 'sh'] - if l:command =~# l:possible_shell . '\s*$' - return l:possible_shell - endif - endfor + let l:command = substitute(l:shebang, ' --\?[a-zA-Z0-9]\+', '', 'g') endif + " With no shebang line, attempt to use Vim's buffer-local variables. + if l:command is# '' + if getbufvar(a:buffer, 'is_bash', 0) + let l:command = 'bash' + elseif getbufvar(a:buffer, 'is_sh', 0) + let l:command = 'sh' + elseif getbufvar(a:buffer, 'is_kornshell', 0) + let l:command = 'ksh' + endif + endif + + " If we couldn't find a shebang, try the filetype + if l:command is# '' + let l:command = &filetype + endif + + for l:possible_shell in ['bash', 'dash', 'ash', 'tcsh', 'csh', 'zsh', 'ksh', 'sh'] + if l:command =~# l:possible_shell . '\s*$' + return l:possible_shell + endif + endfor + return '' endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim b/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim new file mode 100644 index 00000000..17de2912 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/shellcheck.vim @@ -0,0 +1,123 @@ +" Author: w0rp +" Description: This file adds support for using the shellcheck linter + +" Shellcheck supports shell directives to define the shell dialect for scripts +" that do not have a shebang for some reason. +" https://github.com/koalaman/shellcheck/wiki/Directive#shell +function! ale#handlers#shellcheck#GetShellcheckDialectDirective(buffer) abort + let l:linenr = 0 + let l:pattern = '\s\{-}#\s\{-}shellcheck\s\{-}shell=\(.*\)' + let l:possible_shell = ['bash', 'dash', 'ash', 'tcsh', 'csh', 'zsh', 'ksh', 'sh'] + + while l:linenr < min([50, line('$')]) + let l:linenr += 1 + let l:match = matchlist(getline(l:linenr), l:pattern) + + if len(l:match) > 1 && index(l:possible_shell, l:match[1]) >= 0 + return l:match[1] + endif + endwhile + + return '' +endfunction + +function! ale#handlers#shellcheck#GetDialectArgument(buffer) abort + let l:shell_type = ale#handlers#shellcheck#GetShellcheckDialectDirective(a:buffer) + + if empty(l:shell_type) + let l:shell_type = ale#handlers#sh#GetShellType(a:buffer) + endif + + if !empty(l:shell_type) + " Use the dash dialect for /bin/ash, etc. + if l:shell_type is# 'ash' + return 'dash' + endif + + return l:shell_type + endif + + return '' +endfunction + +function! ale#handlers#shellcheck#GetCwd(buffer) abort + return ale#Var(a:buffer, 'sh_shellcheck_change_directory') ? '%s:h' : '' +endfunction + +function! ale#handlers#shellcheck#GetCommand(buffer, version) abort + let l:options = ale#Var(a:buffer, 'sh_shellcheck_options') + let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions') + let l:dialect = ale#Var(a:buffer, 'sh_shellcheck_dialect') + let l:external_option = ale#semver#GTE(a:version, [0, 4, 0]) ? ' -x' : '' + + if l:dialect is# 'auto' + let l:dialect = ale#handlers#shellcheck#GetDialectArgument(a:buffer) + endif + + return '%e' + \ . (!empty(l:dialect) ? ' -s ' . l:dialect : '') + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '') + \ . l:external_option + \ . ' -f gcc -' +endfunction + +function! ale#handlers#shellcheck#Handle(buffer, lines) abort + let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+) \[([^\]]+)\]$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + if l:match[4] is# 'error' + let l:type = 'E' + elseif l:match[4] is# 'note' + let l:type = 'I' + else + let l:type = 'W' + endif + + let l:item = { + \ 'lnum': str2nr(l:match[2]), + \ 'type': l:type, + \ 'text': l:match[5], + \ 'code': l:match[6], + \} + + if !empty(l:match[3]) + let l:item.col = str2nr(l:match[3]) + endif + + " If the filename is something like , or -, then + " this is an error for the file we checked. + if l:match[1] isnot# '-' && l:match[1][0] isnot# '<' + let l:item['filename'] = l:match[1] + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction + +function! ale#handlers#shellcheck#DefineLinter(filetype) abort + " This global variable can be set with a string of comma-separated error + " codes to exclude from shellcheck. For example: + " let g:ale_sh_shellcheck_exclusions = 'SC2002,SC2004' + call ale#Set('sh_shellcheck_exclusions', get(g:, 'ale_linters_sh_shellcheck_exclusions', '')) + call ale#Set('sh_shellcheck_executable', 'shellcheck') + call ale#Set('sh_shellcheck_dialect', 'auto') + call ale#Set('sh_shellcheck_options', '') + call ale#Set('sh_shellcheck_change_directory', 1) + + call ale#linter#Define(a:filetype, { + \ 'name': 'shellcheck', + \ 'executable': {buffer -> ale#Var(buffer, 'sh_shellcheck_executable')}, + \ 'cwd': function('ale#handlers#shellcheck#GetCwd'), + \ 'command': {buffer -> ale#semver#RunWithVersionCheck( + \ buffer, + \ ale#Var(buffer, 'sh_shellcheck_executable'), + \ '%e --version', + \ function('ale#handlers#shellcheck#GetCommand'), + \ )}, + \ 'callback': 'ale#handlers#shellcheck#Handle', + \}) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/sml.vim b/sources_non_forked/ale/autoload/ale/handlers/sml.vim index 594ee4f7..f5365dd6 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/sml.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/sml.vim @@ -56,19 +56,19 @@ function! ale#handlers#sml#Handle(buffer, lines) abort " Try to match basic sml errors " TODO(jez) We can get better errorfmt strings from Syntastic let l:out = [] - let l:pattern = '^.*\:\([0-9\.]\+\)\ \(\w\+\)\:\ \(.*\)' - let l:pattern2 = '^.*\:\([0-9]\+\)\.\?\([0-9]\+\).* \(\(Warning\|Error\): .*\)' + let l:pattern = '^\(.*\)\:\([0-9\.]\+\)\ \(\w\+\)\:\ \(.*\)' + let l:pattern2 = '^\(.*\)\:\([0-9]\+\)\.\?\([0-9]\+\).* \(\(Warning\|Error\): .*\)' for l:line in a:lines let l:match2 = matchlist(l:line, l:pattern2) if len(l:match2) != 0 call add(l:out, { - \ 'bufnr': a:buffer, - \ 'lnum': l:match2[1] + 0, - \ 'col' : l:match2[2] - 1, - \ 'text': l:match2[3], - \ 'type': l:match2[3] =~# '^Warning' ? 'W' : 'E', + \ 'filename': l:match2[1], + \ 'lnum': l:match2[2] + 0, + \ 'col' : l:match2[3] - 1, + \ 'text': l:match2[4], + \ 'type': l:match2[4] =~# '^Warning' ? 'W' : 'E', \}) continue @@ -78,10 +78,10 @@ function! ale#handlers#sml#Handle(buffer, lines) abort if len(l:match) != 0 call add(l:out, { - \ 'bufnr': a:buffer, - \ 'lnum': l:match[1] + 0, - \ 'text': l:match[2] . ': ' . l:match[3], - \ 'type': l:match[2] is# 'error' ? 'E' : 'W', + \ 'filename': l:match[1], + \ 'lnum': l:match[2] + 0, + \ 'text': l:match[3] . ': ' . l:match[4], + \ 'type': l:match[3] is# 'error' ? 'E' : 'W', \}) continue endif diff --git a/sources_non_forked/ale/autoload/ale/handlers/solhint.vim b/sources_non_forked/ale/autoload/ale/handlers/solhint.vim new file mode 100644 index 00000000..611aa7bd --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/solhint.vim @@ -0,0 +1,98 @@ +" Author: Henrique Barcelos <@hbarcelos> +" Description: Functions for working with local solhint for checking *.sol files. + +let s:executables = [ +\ 'node_modules/.bin/solhint', +\ 'node_modules/solhint/solhint.js', +\ 'solhint', +\] + +let s:sep = has('win32') ? '\' : '/' + +call ale#Set('solidity_solhint_options', '') +call ale#Set('solidity_solhint_executable', 'solhint') +call ale#Set('solidity_solhint_use_global', get(g:, 'ale_use_global_executables', 0)) + +function! ale#handlers#solhint#Handle(buffer, lines) abort + " Matches patterns like the following: + " /path/to/file/file.sol: line 1, col 10, Error - 'addOne' is defined but never used. (no-unused-vars) + let l:output = [] + + let l:lint_pattern = '\v^[^:]+: line (\d+), col (\d+), (Error|Warning) - (.*) \((.*)\)$' + + for l:match in ale#util#GetMatches(a:lines, l:lint_pattern) + let l:isError = l:match[3] is? 'error' + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[4], + \ 'code': l:match[5], + \ 'type': l:isError ? 'E' : 'W', + \}) + endfor + + let l:syntax_pattern = '\v^[^:]+: line (\d+), col (\d+), (Error|Warning) - (Parse error): (.*)$' + + for l:match in ale#util#GetMatches(a:lines, l:syntax_pattern) + let l:isError = l:match[3] is? 'error' + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[5], + \ 'code': l:match[4], + \ 'type': l:isError ? 'E' : 'W', + \}) + endfor + + return l:output +endfunction + +function! ale#handlers#solhint#FindConfig(buffer) abort + for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) + for l:basename in [ + \ '.solhintrc.js', + \ '.solhintrc.json', + \ '.solhintrc', + \] + let l:config = ale#path#Simplify(join([l:path, l:basename], s:sep)) + + if filereadable(l:config) + return l:config + endif + endfor + endfor + + return ale#path#FindNearestFile(a:buffer, 'package.json') +endfunction + +function! ale#handlers#solhint#GetExecutable(buffer) abort + return ale#path#FindExecutable(a:buffer, 'solidity_solhint', s:executables) +endfunction + +" Given a buffer, return an appropriate working directory for solhint. +function! ale#handlers#solhint#GetCwd(buffer) abort + " If solhint is installed in a directory which contains the buffer, assume + " it is the solhint project root. Otherwise, use nearest node_modules. + " Note: If node_modules not present yet, can't load local deps anyway. + let l:executable = ale#path#FindNearestExecutable(a:buffer, s:executables) + + if !empty(l:executable) + let l:nmi = strridx(l:executable, 'node_modules') + let l:project_dir = l:executable[0:l:nmi - 2] + else + let l:modules_dir = ale#path#FindNearestDirectory(a:buffer, 'node_modules') + let l:project_dir = !empty(l:modules_dir) ? fnamemodify(l:modules_dir, ':h:h') : '' + endif + + return !empty(l:project_dir) ? l:project_dir : '' +endfunction + +function! ale#handlers#solhint#GetCommand(buffer) abort + let l:executable = ale#handlers#solhint#GetExecutable(a:buffer) + + let l:options = ale#Var(a:buffer, 'solidity_solhint_options') + + return ale#node#Executable(a:buffer, l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') + \ . ' --formatter compact %s' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/spectral.vim b/sources_non_forked/ale/autoload/ale/handlers/spectral.vim new file mode 100644 index 00000000..1eb4a5de --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/spectral.vim @@ -0,0 +1,31 @@ +" Author: t2h5 +" Description: Integration of Stoplight Spectral CLI with ALE. + +function! ale#handlers#spectral#HandleSpectralOutput(buffer, lines) abort + " Matches patterns like the following: + " openapi.yml:1:1 error oas3-schema "Object should have required property `info`." + " openapi.yml:1:1 warning oas3-api-servers "OpenAPI `servers` must be present and non-empty array." + let l:pattern = '\v^.*:(\d+):(\d+) (error|warning) (.*)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:obj = { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'type': l:match[3] is# 'error' ? 'E' : 'W', + \ 'text': l:match[4], + \} + + let l:code_match = matchlist(l:obj.text, '\v^(.+) "(.+)"$') + + if !empty(l:code_match) + let l:obj.code = l:code_match[1] + let l:obj.text = l:code_match[2] + endif + + call add(l:output, l:obj) + endfor + + return l:output +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/handlers/textlint.vim b/sources_non_forked/ale/autoload/ale/handlers/textlint.vim index 6d495b0d..7a648617 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/textlint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/textlint.vim @@ -6,7 +6,7 @@ call ale#Set('textlint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('textlint_options', '') function! ale#handlers#textlint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'textlint', [ + return ale#path#FindExecutable(a:buffer, 'textlint', [ \ 'node_modules/.bin/textlint', \ 'node_modules/textlint/bin/textlint.js', \]) diff --git a/sources_non_forked/ale/autoload/ale/handlers/tslint.vim b/sources_non_forked/ale/autoload/ale/handlers/tslint.vim index 90579344..ee091d24 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/tslint.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/tslint.vim @@ -7,7 +7,7 @@ function! ale#handlers#tslint#InitVariables() abort endfunction function! ale#handlers#tslint#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'typescript_tslint', [ + return ale#path#FindExecutable(a:buffer, 'typescript_tslint', [ \ 'node_modules/.bin/tslint', \]) endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/writegood.vim b/sources_non_forked/ale/autoload/ale/handlers/writegood.vim index 8ae61a38..b5b91b3f 100644 --- a/sources_non_forked/ale/autoload/ale/handlers/writegood.vim +++ b/sources_non_forked/ale/autoload/ale/handlers/writegood.vim @@ -11,7 +11,7 @@ endfunction call ale#handlers#writegood#ResetOptions() function! ale#handlers#writegood#GetExecutable(buffer) abort - return ale#node#FindExecutable(a:buffer, 'writegood', [ + return ale#path#FindExecutable(a:buffer, 'writegood', [ \ 'node_modules/.bin/write-good', \ 'node_modules/write-good/bin/write-good.js', \]) diff --git a/sources_non_forked/ale/autoload/ale/handlers/xo.vim b/sources_non_forked/ale/autoload/ale/handlers/xo.vim new file mode 100644 index 00000000..a87c6d8f --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/xo.vim @@ -0,0 +1,44 @@ +call ale#Set('javascript_xo_executable', 'xo') +call ale#Set('javascript_xo_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('javascript_xo_options', '') + +call ale#Set('typescript_xo_executable', 'xo') +call ale#Set('typescript_xo_use_global', get(g:, 'ale_use_global_executables', 0)) +call ale#Set('typescript_xo_options', '') + +function! ale#handlers#xo#GetExecutable(buffer) abort + let l:type = ale#handlers#xo#GetType(a:buffer) + + return ale#path#FindExecutable(a:buffer, l:type . '_xo', [ + \ 'node_modules/xo/cli.js', + \ 'node_modules/.bin/xo', + \]) +endfunction + +function! ale#handlers#xo#GetLintCommand(buffer) abort + return ale#Escape(ale#handlers#xo#GetExecutable(a:buffer)) + \ . ale#Pad(ale#handlers#xo#GetOptions(a:buffer)) + \ . ' --reporter json --stdin --stdin-filename %s' +endfunction + +function! ale#handlers#xo#GetOptions(buffer) abort + let l:type = ale#handlers#xo#GetType(a:buffer) + + return ale#Var(a:buffer, l:type . '_xo_options') +endfunction + +" xo uses eslint and the output format is the same +function! ale#handlers#xo#HandleJSON(buffer, lines) abort + return ale#handlers#eslint#HandleJSON(a:buffer, a:lines) +endfunction + +function! ale#handlers#xo#GetType(buffer) abort + let l:filetype = getbufvar(a:buffer, '&filetype') + let l:type = 'javascript' + + if l:filetype =~# 'typescript' + let l:type = 'typescript' + endif + + return l:type +endfunction diff --git a/sources_non_forked/ale/autoload/ale/handlers/yamllint.vim b/sources_non_forked/ale/autoload/ale/handlers/yamllint.vim new file mode 100644 index 00000000..5e04577d --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/handlers/yamllint.vim @@ -0,0 +1,39 @@ +function! ale#handlers#yamllint#GetCommand(buffer) abort + return '%e' . ale#Pad(ale#Var(a:buffer, 'yaml_yamllint_options')) + \ . ' -f parsable %t' +endfunction + +function! ale#handlers#yamllint#Handle(buffer, lines) abort + " Matches patterns line the following: + " something.yaml:1:1: [warning] missing document start "---" (document-start) + " something.yml:2:1: [error] syntax error: expected the node content, but found '' + let l:pattern = '\v^.*:(\d+):(\d+): \[(error|warning)\] (.+)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:item = { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'text': l:match[4], + \ 'type': l:match[3] is# 'error' ? 'E' : 'W', + \} + + let l:code_match = matchlist(l:item.text, '\v^(.+) \(([^)]+)\)$') + + if !empty(l:code_match) + if l:code_match[2] is# 'trailing-spaces' + \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') + " Skip warnings for trailing whitespace if the option is off. + continue + endif + + let l:item.text = l:code_match[1] + let l:item.code = l:code_match[2] + endif + + call add(l:output, l:item) + endfor + + return l:output +endfunction + diff --git a/sources_non_forked/ale/autoload/ale/highlight.vim b/sources_non_forked/ale/autoload/ale/highlight.vim index ae1f3e7d..473ad354 100644 --- a/sources_non_forked/ale/autoload/ale/highlight.vim +++ b/sources_non_forked/ale/autoload/ale/highlight.vim @@ -26,6 +26,25 @@ endif let s:MAX_POS_VALUES = 8 let s:MAX_COL_SIZE = 1073741824 " pow(2, 30) +let s:has_nvim_highlight = exists('*nvim_buf_add_highlight') && exists('*nvim_buf_clear_namespace') + +if s:has_nvim_highlight + let s:ns_id = nvim_create_namespace('ale_highlight') +endif + +" Wrappers are necessary to test this functionality by faking the calls in tests. +function! ale#highlight#nvim_buf_add_highlight(buffer, ns_id, hl_group, line, col_start, col_end) abort + " Ignore all errors for adding highlights. + try + call nvim_buf_add_highlight(a:buffer, a:ns_id, a:hl_group, a:line, a:col_start, a:col_end) + catch + endtry +endfunction + +function! ale#highlight#nvim_buf_clear_namespace(buffer, ns_id, line_start, line_end) abort + call nvim_buf_clear_namespace(a:buffer, a:ns_id, a:line_start, a:line_end) +endfunction + function! ale#highlight#CreatePositions(line, col, end_line, end_col) abort if a:line >= a:end_line " For single lines, just return the one position. @@ -49,12 +68,69 @@ endfunction " Given a loclist for current items to highlight, remove all highlights " except these which have matching loclist item entries. + function! ale#highlight#RemoveHighlights() abort - for l:match in getmatches() - if l:match.group =~# '^ALE' - call matchdelete(l:match.id) - endif - endfor + if s:has_nvim_highlight + call ale#highlight#nvim_buf_clear_namespace(bufnr(''), s:ns_id, 0, -1) + else + for l:match in getmatches() + if l:match.group =~? '\v^ALE(Style)?(Error|Warning|Info)(Line)?$' + call matchdelete(l:match.id) + endif + endfor + endif +endfunction + +" Same semantics of matchaddpos but will use nvim_buf_add_highlight if +" available. This involves iterating over the position list, switching from +" 1-based indexing to 0-based indexing, and translating the multiple ways +" that position can be specified for matchaddpos into line + col_start + +" col_end. +function! s:matchaddpos(group, pos_list) abort + if s:has_nvim_highlight + for l:pos in a:pos_list + let l:line = type(l:pos) == v:t_number + \ ? l:pos - 1 + \ : l:pos[0] - 1 + + if type(l:pos) == v:t_number || len(l:pos) == 1 + let l:col_start = 0 + let l:col_end = s:MAX_COL_SIZE + else + let l:col_start = l:pos[1] - 1 + let l:col_end = l:col_start + get(l:pos, 2, 1) + endif + + call ale#highlight#nvim_buf_add_highlight( + \ bufnr(''), + \ s:ns_id, + \ a:group, + \ l:line, + \ l:col_start, + \ l:col_end, + \) + endfor + else + call matchaddpos(a:group, a:pos_list) + endif +endfunction + +function! s:highlight_line(bufnr, lnum, group) abort + call s:matchaddpos(a:group, [a:lnum]) +endfunction + +function! s:highlight_range(bufnr, range, group) abort + " Set all of the positions, which are chunked into Lists which + " are as large as will be accepted by matchaddpos. + call map( + \ ale#highlight#CreatePositions( + \ a:range.lnum, + \ a:range.col, + \ a:range.end_lnum, + \ a:range.end_col + \ ), + \ 's:matchaddpos(a:group, v:val)' + \) endfunction function! ale#highlight#UpdateHighlights() abort @@ -79,17 +155,14 @@ function! ale#highlight#UpdateHighlights() abort let l:group = 'ALEError' endif - let l:line = l:item.lnum - let l:col = l:item.col - let l:end_line = get(l:item, 'end_lnum', l:line) - let l:end_col = get(l:item, 'end_col', l:col) + let l:range = { + \ 'lnum': l:item.lnum, + \ 'col': l:item.col, + \ 'end_lnum': get(l:item, 'end_lnum', l:item.lnum), + \ 'end_col': get(l:item, 'end_col', l:item.col) + \} - " Set all of the positions, which are chunked into Lists which - " are as large as will be accepted by matchaddpos. - call map( - \ ale#highlight#CreatePositions(l:line, l:col, l:end_line, l:end_col), - \ 'matchaddpos(l:group, v:val)' - \) + call s:highlight_range(l:item.bufnr, l:range, l:group) endfor " If highlights are enabled and signs are not enabled, we should still @@ -111,7 +184,7 @@ function! ale#highlight#UpdateHighlights() abort endif if l:available_groups[l:group] - call matchaddpos(l:group, [l:item.lnum]) + call s:highlight_line(l:item.bufnr, l:item.lnum, l:group) endif endfor endif @@ -137,6 +210,12 @@ function! ale#highlight#SetHighlights(buffer, loclist) abort " Set the list in the buffer variable. call setbufvar(str2nr(a:buffer), 'ale_highlight_items', l:new_list) + let l:exclude_list = ale#Var(a:buffer, 'exclude_highlights') + + if !empty(l:exclude_list) + call filter(l:new_list, 'empty(ale#util#GetMatches(v:val.text, l:exclude_list))') + endif + " Update highlights for the current buffer, which may or may not " be the buffer we just set highlights for. call ale#highlight#UpdateHighlights() diff --git a/sources_non_forked/ale/autoload/ale/hover.vim b/sources_non_forked/ale/autoload/ale/hover.vim index 2af35aa4..4513c6ad 100644 --- a/sources_non_forked/ale/autoload/ale/hover.vim +++ b/sources_non_forked/ale/autoload/ale/hover.vim @@ -24,6 +24,8 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort if get(a:response, 'success', v:false) is v:true \&& get(a:response, 'body', v:null) isnot v:null + let l:set_balloons = ale#Var(l:options.buffer, 'set_balloons') + " If we pass the show_documentation flag, we should show the full " documentation, and always in the preview window. if get(l:options, 'show_documentation', 0) @@ -40,8 +42,21 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort endif elseif get(l:options, 'hover_from_balloonexpr', 0) \&& exists('*balloon_show') - \&& ale#Var(l:options.buffer, 'set_balloons') + \&& (l:set_balloons is 1 || l:set_balloons is# 'hover') call balloon_show(a:response.body.displayString) + elseif get(l:options, 'truncated_echo', 0) + if !empty(a:response.body.displayString) + call ale#cursor#TruncatedEcho(split(a:response.body.displayString, "\n")[0]) + endif + elseif g:ale_hover_to_floating_preview || g:ale_floating_preview + call ale#floating_preview#Show(split(a:response.body.displayString, "\n"), { + \ 'filetype': 'ale-preview.message', + \}) + elseif g:ale_hover_to_preview + call ale#preview#Show(split(a:response.body.displayString, "\n"), { + \ 'filetype': 'ale-preview.message', + \ 'stay_here': 1, + \}) else call ale#util#ShowMessage(a:response.body.displayString) endif @@ -49,6 +64,137 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort endif endfunction +" Convert a language name to another one. +" The language name could be an empty string or v:null +function! s:ConvertLanguageName(language) abort + return a:language +endfunction + +function! ale#hover#ParseLSPResult(contents) abort + let l:includes = {} + let l:highlights = [] + let l:lines = [] + let l:list = type(a:contents) is v:t_list ? a:contents : [a:contents] + let l:region_index = 0 + + for l:item in l:list + if !empty(l:lines) + call add(l:lines, '') + endif + + if type(l:item) is v:t_dict && has_key(l:item, 'kind') + if l:item.kind is# 'markdown' + " Handle markdown values as we handle strings below. + let l:item = get(l:item, 'value', '') + elseif l:item.kind is# 'plaintext' + " We shouldn't try to parse plaintext as markdown. + " Pass the lines on and skip parsing them. + call extend(l:lines, split(get(l:item, 'value', ''), "\n")) + + continue + endif + endif + + let l:marked_list = [] + + " If the item is a string, then we should parse it as Markdown text. + if type(l:item) is v:t_string + let l:fence_language = v:null + let l:fence_lines = [] + + for l:line in split(l:item, "\n") + if l:fence_language is v:null + " Look for the start of a code fence. (```python, etc.) + let l:match = matchlist(l:line, '^```\(.*\)$') + + if !empty(l:match) + let l:fence_language = l:match[1] + + if !empty(l:marked_list) + call add(l:fence_lines, '') + endif + else + if !empty(l:marked_list) + \&& l:marked_list[-1][0] isnot v:null + call add(l:marked_list, [v:null, ['']]) + endif + + call add(l:marked_list, [v:null, [l:line]]) + endif + elseif l:line =~# '^```$' + " When we hit the end of a code fence, pass the fenced + " lines on to the next steps below. + call add(l:marked_list, [l:fence_language, l:fence_lines]) + let l:fence_language = v:null + let l:fence_lines = [] + else + " Gather lines inside of a code fence. + call add(l:fence_lines, l:line) + endif + endfor + " If the result from the LSP server is a {language: ..., value: ...} + " Dictionary, then that should be interpreted as if it was: + " + " ```${language} + " ${value} + " ``` + elseif type(l:item) is v:t_dict + \&& has_key(l:item, 'language') + \&& type(l:item.language) is v:t_string + \&& has_key(l:item, 'value') + \&& type(l:item.value) is v:t_string + call add( + \ l:marked_list, + \ [l:item.language, split(l:item.value, "\n")], + \) + endif + + for [l:language, l:marked_lines] in l:marked_list + if l:language is v:null + " NOTE: We could handle other Markdown formatting here. + call map( + \ l:marked_lines, + \ 'substitute(v:val, ''\\_'', ''_'', ''g'')', + \) + else + let l:language = s:ConvertLanguageName(l:language) + + if !empty(l:language) + let l:includes[l:language] = printf( + \ 'syntax/%s.vim', + \ l:language, + \) + + let l:start = len(l:lines) + 1 + let l:end = l:start + len(l:marked_lines) + let l:region_index += 1 + + call add(l:highlights, 'syntax region' + \ . ' ALE_hover_' . l:region_index + \ . ' start=/\%' . l:start . 'l/' + \ . ' end=/\%' . l:end . 'l/' + \ . ' contains=@ALE_hover_' . l:language + \) + endif + endif + + call extend(l:lines, l:marked_lines) + endfor + endfor + + let l:include_commands = [] + + for [l:language, l:lang_path] in sort(items(l:includes)) + call add(l:include_commands, 'unlet! b:current_syntax') + call add( + \ l:include_commands, + \ printf('syntax include @ALE_hover_%s %s', l:language, l:lang_path), + \) + endfor + + return [l:include_commands + l:highlights, l:lines] +endfunction + function! ale#hover#HandleLSPResponse(conn_id, response) abort if has_key(a:response, 'id') \&& has_key(s:hover_map, a:response.id) @@ -75,32 +221,32 @@ function! ale#hover#HandleLSPResponse(conn_id, response) abort return endif - let l:result = l:result.contents + let [l:commands, l:lines] = ale#hover#ParseLSPResult(l:result.contents) - if type(l:result) is v:t_string - " The result can be just a string. - let l:result = [l:result] - endif + if !empty(l:lines) + let l:set_balloons = ale#Var(l:options.buffer, 'set_balloons') - if type(l:result) is v:t_dict - " If the result is an object, then it's markup content. - let l:result = [l:result.value] - endif - - if type(l:result) is v:t_list - " Replace objects with text values. - call map(l:result, 'type(v:val) is v:t_string ? v:val : v:val.value') - let l:str = join(l:result, "\n") - let l:str = substitute(l:str, '^\s*\(.\{-}\)\s*$', '\1', '') - - if !empty(l:str) - if get(l:options, 'hover_from_balloonexpr', 0) - \&& exists('*balloon_show') - \&& ale#Var(l:options.buffer, 'set_balloons') - call balloon_show(l:str) - else - call ale#util#ShowMessage(l:str) - endif + if get(l:options, 'hover_from_balloonexpr', 0) + \&& exists('*balloon_show') + \&& (l:set_balloons is 1 || l:set_balloons is# 'hover') + call balloon_show(join(l:lines, "\n")) + elseif get(l:options, 'truncated_echo', 0) + call ale#cursor#TruncatedEcho(l:lines[0]) + elseif g:ale_hover_to_floating_preview || g:ale_floating_preview + call ale#floating_preview#Show(l:lines, { + \ 'filetype': 'ale-preview.message', + \ 'commands': l:commands, + \}) + elseif g:ale_hover_to_preview + call ale#preview#Show(l:lines, { + \ 'filetype': 'ale-preview.message', + \ 'stay_here': 1, + \ 'commands': l:commands, + \}) + else + call ale#util#ShowMessage(join(l:lines, "\n"), { + \ 'commands': l:commands, + \}) endif endif endif @@ -133,7 +279,10 @@ function! s:OnReady(line, column, opt, linter, lsp_details) abort " hover position probably won't make sense. call ale#lsp#NotifyForChanges(l:id, l:buffer) - let l:column = min([a:column, len(getbufline(l:buffer, a:line)[0])]) + let l:column = max([ + \ min([a:column, len(getbufline(l:buffer, a:line)[0])]), + \ 1, + \]) let l:message = ale#lsp#message#Hover(l:buffer, a:line, l:column) endif @@ -146,6 +295,7 @@ function! s:OnReady(line, column, opt, linter, lsp_details) abort \ 'column': l:column, \ 'hover_from_balloonexpr': get(a:opt, 'called_from_balloonexpr', 0), \ 'show_documentation': get(a:opt, 'show_documentation', 0), + \ 'truncated_echo': get(a:opt, 'truncated_echo', 0), \} endfunction @@ -171,6 +321,8 @@ function! ale#hover#Show(buffer, line, col, opt) abort endfor endfunction +let s:last_pos = [0, 0, 0] + " This function implements the :ALEHover command. function! ale#hover#ShowAtCursor() abort let l:buffer = bufnr('') @@ -179,6 +331,25 @@ function! ale#hover#ShowAtCursor() abort call ale#hover#Show(l:buffer, l:pos[1], l:pos[2], {}) endfunction +function! ale#hover#ShowTruncatedMessageAtCursor() abort + let l:buffer = bufnr('') + let l:pos = getpos('.')[0:2] + + if l:pos != s:last_pos + let s:last_pos = l:pos + let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer) + + if empty(l:loc) + call ale#hover#Show( + \ l:buffer, + \ l:pos[1], + \ l:pos[2], + \ {'truncated_echo': 1}, + \) + endif + endif +endfunction + " This function implements the :ALEDocumentation command. function! ale#hover#ShowDocumentationAtCursor() abort let l:buffer = bufnr('') diff --git a/sources_non_forked/ale/autoload/ale/java.vim b/sources_non_forked/ale/autoload/ale/java.vim index b7fd10bd..e641ac6c 100644 --- a/sources_non_forked/ale/autoload/ale/java.vim +++ b/sources_non_forked/ale/autoload/ale/java.vim @@ -16,5 +16,11 @@ function! ale#java#FindProjectRoot(buffer) abort return fnamemodify(l:maven_pom_file, ':h') endif + let l:ant_root = ale#ant#FindProjectRoot(a:buffer) + + if !empty(l:ant_root) + return l:ant_root + endif + return '' endfunction diff --git a/sources_non_forked/ale/autoload/ale/linter.vim b/sources_non_forked/ale/autoload/ale/linter.vim index 4937a6d7..cbc79064 100644 --- a/sources_non_forked/ale/autoload/ale/linter.vim +++ b/sources_non_forked/ale/autoload/ale/linter.vim @@ -12,11 +12,18 @@ let s:linters = {} let s:default_ale_linter_aliases = { \ 'Dockerfile': 'dockerfile', \ 'csh': 'sh', +\ 'javascriptreact': ['javascript', 'jsx'], \ 'plaintex': 'tex', +\ 'ps1': 'powershell', +\ 'rmarkdown': 'r', +\ 'rmd': 'r', \ 'systemverilog': 'verilog', +\ 'typescriptreact': ['typescript', 'tsx'], \ 'verilog_systemverilog': ['verilog_systemverilog', 'verilog'], \ 'vimwiki': 'markdown', \ 'vue': ['vue', 'javascript'], +\ 'xsd': ['xsd', 'xml'], +\ 'xslt': ['xslt', 'xml'], \ 'zsh': 'sh', \} @@ -25,25 +32,28 @@ let s:default_ale_linter_aliases = { " " No linters are used for plaintext files by default. " -" Only cargo is enabled for Rust by default. +" Only cargo and rls are enabled for Rust by default. " rpmlint is disabled by default because it can result in code execution. " hhast is disabled by default because it executes code in the project root. " " NOTE: Update the g:ale_linters documentation when modifying this. let s:default_ale_linters = { +\ 'apkbuild': ['apkbuild_lint', 'secfixes_check'], \ 'csh': ['shell'], -\ 'elixir': ['credo', 'dialyxir', 'dogma', 'elixir-ls'], -\ 'go': ['gofmt', 'golint', 'go vet'], +\ 'elixir': ['credo', 'dialyxir', 'dogma'], +\ 'go': ['gofmt', 'golint', 'gopls', 'govet'], \ 'hack': ['hack'], \ 'help': [], +\ 'inko': ['inko'], \ 'perl': ['perlcritic'], \ 'perl6': [], -\ 'python': ['flake8', 'mypy', 'pylint'], -\ 'rust': ['cargo'], +\ 'python': ['flake8', 'mypy', 'pylint', 'pyright'], +\ 'rust': ['cargo', 'rls'], \ 'spec': [], \ 'text': [], \ 'vue': ['eslint', 'vls'], \ 'zsh': ['shell'], +\ 'v': ['v'], \} " Testing/debugging helper to unload all linters. @@ -70,10 +80,6 @@ function! s:IsBoolean(value) abort return type(a:value) is v:t_number && (a:value == 0 || a:value == 1) endfunction -function! s:LanguageGetter(buffer) dict abort - return l:self.language -endfunction - function! ale#linter#PreProcess(filetype, linter) abort if type(a:linter) isnot v:t_dict throw 'The linter object must be a Dictionary' @@ -107,14 +113,7 @@ function! ale#linter#PreProcess(filetype, linter) abort if !l:needs_executable if has_key(a:linter, 'executable') - \|| has_key(a:linter, 'executable_callback') - throw '`executable` and `executable_callback` cannot be used when lsp == ''socket''' - endif - elseif has_key(a:linter, 'executable_callback') - let l:obj.executable_callback = a:linter.executable_callback - - if !s:IsCallback(l:obj.executable_callback) - throw '`executable_callback` must be a callback if defined' + throw '`executable` cannot be used when lsp == ''socket''' endif elseif has_key(a:linter, 'executable') let l:obj.executable = a:linter.executable @@ -124,54 +123,12 @@ function! ale#linter#PreProcess(filetype, linter) abort throw '`executable` must be a String or Function if defined' endif else - throw 'Either `executable` or `executable_callback` must be defined' + throw '`executable` must be defined' endif if !l:needs_command if has_key(a:linter, 'command') - \|| has_key(a:linter, 'command_callback') - \|| has_key(a:linter, 'command_chain') - throw '`command` and `command_callback` and `command_chain` cannot be used when lsp == ''socket''' - endif - elseif has_key(a:linter, 'command_chain') - let l:obj.command_chain = a:linter.command_chain - - if type(l:obj.command_chain) isnot v:t_list - throw '`command_chain` must be a List' - endif - - if empty(l:obj.command_chain) - throw '`command_chain` must contain at least one item' - endif - - let l:link_index = 0 - - for l:link in l:obj.command_chain - let l:err_prefix = 'The `command_chain` item ' . l:link_index . ' ' - - if !s:IsCallback(get(l:link, 'callback')) - throw l:err_prefix . 'must define a `callback` function' - endif - - if has_key(l:link, 'output_stream') - if type(l:link.output_stream) isnot v:t_string - \|| index(['stdout', 'stderr', 'both'], l:link.output_stream) < 0 - throw l:err_prefix . '`output_stream` flag must be ' - \ . "'stdout', 'stderr', or 'both'" - endif - endif - - if has_key(l:link, 'read_buffer') && !s:IsBoolean(l:link.read_buffer) - throw l:err_prefix . 'value for `read_buffer` must be `0` or `1`' - endif - - let l:link_index += 1 - endfor - elseif has_key(a:linter, 'command_callback') - let l:obj.command_callback = a:linter.command_callback - - if !s:IsCallback(l:obj.command_callback) - throw '`command_callback` must be a callback if defined' + throw '`command` cannot be used when lsp == ''socket''' endif elseif has_key(a:linter, 'command') let l:obj.command = a:linter.command @@ -181,22 +138,12 @@ function! ale#linter#PreProcess(filetype, linter) abort throw '`command` must be a String or Function if defined' endif else - throw 'Either `command`, `executable_callback`, `command_chain` ' - \ . 'must be defined' - endif - - if ( - \ has_key(a:linter, 'command') - \ + has_key(a:linter, 'command_chain') - \ + has_key(a:linter, 'command_callback') - \) > 1 - throw 'Only one of `command`, `command_callback`, or `command_chain` ' - \ . 'should be set' + throw '`command` must be defined' endif if !l:needs_address - if has_key(a:linter, 'address') || has_key(a:linter, 'address_callback') - throw '`address` or `address_callback` cannot be used when lsp != ''socket''' + if has_key(a:linter, 'address') + throw '`address` cannot be used when lsp != ''socket''' endif elseif has_key(a:linter, 'address') if type(a:linter.address) isnot v:t_string @@ -205,41 +152,30 @@ function! ale#linter#PreProcess(filetype, linter) abort endif let l:obj.address = a:linter.address - elseif has_key(a:linter, 'address_callback') - let l:obj.address_callback = a:linter.address_callback - if !s:IsCallback(l:obj.address_callback) - throw '`address_callback` must be a callback if defined' + if has_key(a:linter, 'cwd') + throw '`cwd` makes no sense for socket LSP connections' endif else - throw '`address` or `address_callback` must be defined for getting the LSP address' + throw '`address` must be defined for getting the LSP address' + endif + + if has_key(a:linter, 'cwd') + let l:obj.cwd = a:linter.cwd + + if type(l:obj.cwd) isnot v:t_string + \&& type(l:obj.cwd) isnot v:t_func + throw '`cwd` must be a String or Function if defined' + endif endif if l:needs_lsp_details - if has_key(a:linter, 'language_callback') - if has_key(a:linter, 'language') - throw 'Only one of `language` or `language_callback` ' - \ . 'should be set' - endif + " Default to using the filetype as the language. + let l:obj.language = get(a:linter, 'language', a:filetype) - let l:obj.language_callback = get(a:linter, 'language_callback') - - if !s:IsCallback(l:obj.language_callback) - throw '`language_callback` must be a callback for LSP linters' - endif - else - " Default to using the filetype as the language. - let l:Language = get(a:linter, 'language', a:filetype) - - if type(l:Language) is v:t_string - " Make 'language_callback' return the 'language' value. - let l:obj.language = l:Language - let l:obj.language_callback = function('s:LanguageGetter') - elseif type(l:Language) is v:t_func - let l:obj.language_callback = l:Language - else - throw '`language` must be a String or Funcref' - endif + if type(l:obj.language) isnot v:t_string + \&& type(l:obj.language) isnot v:t_func + throw '`language` must be a String or Function if defined' endif if has_key(a:linter, 'project_root') @@ -247,16 +183,10 @@ function! ale#linter#PreProcess(filetype, linter) abort if type(l:obj.project_root) isnot v:t_string \&& type(l:obj.project_root) isnot v:t_func - throw '`project_root` must be a String or Function if defined' - endif - elseif has_key(a:linter, 'project_root_callback') - let l:obj.project_root_callback = a:linter.project_root_callback - - if !s:IsCallback(l:obj.project_root_callback) - throw '`project_root_callback` must be a callback if defined' + throw '`project_root` must be a String or Function' endif else - throw '`project_root` or `project_root_callback` must be defined for LSP linters' + throw '`project_root` must be defined for LSP linters' endif if has_key(a:linter, 'completion_filter') @@ -267,37 +197,16 @@ function! ale#linter#PreProcess(filetype, linter) abort endif endif - if has_key(a:linter, 'initialization_options_callback') - if has_key(a:linter, 'initialization_options') - throw 'Only one of `initialization_options` or ' - \ . '`initialization_options_callback` should be set' - endif - - let l:obj.initialization_options_callback = a:linter.initialization_options_callback - - if !s:IsCallback(l:obj.initialization_options_callback) - throw '`initialization_options_callback` must be a callback if defined' - endif - elseif has_key(a:linter, 'initialization_options') + if has_key(a:linter, 'initialization_options') let l:obj.initialization_options = a:linter.initialization_options if type(l:obj.initialization_options) isnot v:t_dict \&& type(l:obj.initialization_options) isnot v:t_func - throw '`initialization_options` must be a String or Function if defined' + throw '`initialization_options` must be a Dictionary or Function if defined' endif endif - if has_key(a:linter, 'lsp_config_callback') - if has_key(a:linter, 'lsp_config') - throw 'Only one of `lsp_config` or `lsp_config_callback` should be set' - endif - - let l:obj.lsp_config_callback = a:linter.lsp_config_callback - - if !s:IsCallback(l:obj.lsp_config_callback) - throw '`lsp_config_callback` must be a callback if defined' - endif - elseif has_key(a:linter, 'lsp_config') + if has_key(a:linter, 'lsp_config') if type(a:linter.lsp_config) isnot v:t_dict \&& type(a:linter.lsp_config) isnot v:t_func throw '`lsp_config` must be a Dictionary or Function if defined' @@ -318,21 +227,17 @@ function! ale#linter#PreProcess(filetype, linter) abort " file on disk. let l:obj.lint_file = get(a:linter, 'lint_file', 0) - if !s:IsBoolean(l:obj.lint_file) - throw '`lint_file` must be `0` or `1`' + if !s:IsBoolean(l:obj.lint_file) && type(l:obj.lint_file) isnot v:t_func + throw '`lint_file` must be `0`, `1`, or a Function' endif " An option indicating that the buffer should be read. - let l:obj.read_buffer = get(a:linter, 'read_buffer', !l:obj.lint_file) + let l:obj.read_buffer = get(a:linter, 'read_buffer', 1) if !s:IsBoolean(l:obj.read_buffer) throw '`read_buffer` must be `0` or `1`' endif - if l:obj.lint_file && l:obj.read_buffer - throw 'Only one of `lint_file` or `read_buffer` can be `1`' - endif - let l:obj.aliases = get(a:linter, 'aliases', []) if type(l:obj.aliases) isnot v:t_list @@ -340,8 +245,6 @@ function! ale#linter#PreProcess(filetype, linter) abort throw '`aliases` must be a List of String values' endif - " TODO: Emit deprecation warnings for deprecated options later. - return l:obj endfunction @@ -349,12 +252,14 @@ function! ale#linter#Define(filetype, linter) abort " This command will throw from the sandbox. let &l:equalprg=&l:equalprg + let l:new_linter = ale#linter#PreProcess(a:filetype, a:linter) + if !has_key(s:linters, a:filetype) let s:linters[a:filetype] = [] endif - let l:new_linter = ale#linter#PreProcess(a:filetype, a:linter) - + " Remove previously defined linters with the same name. + call filter(s:linters[a:filetype], 'v:val.name isnot# a:linter.name') call add(s:linters[a:filetype], l:new_linter) endfunction @@ -505,36 +410,47 @@ function! ale#linter#Get(original_filetypes) abort return reverse(l:combined_linters) endfunction +function! ale#linter#RemoveIgnored(buffer, filetype, linters) abort + " Apply ignore lists for linters only if needed. + let l:ignore_config = ale#Var(a:buffer, 'linters_ignore') + let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp') + + return !empty(l:ignore_config) || l:disable_lsp + \ ? ale#engine#ignore#Exclude(a:filetype, a:linters, l:ignore_config, l:disable_lsp) + \ : a:linters +endfunction + " Given a buffer and linter, get the executable String for the linter. function! ale#linter#GetExecutable(buffer, linter) abort - let l:Executable = has_key(a:linter, 'executable_callback') - \ ? function(a:linter.executable_callback) - \ : a:linter.executable + let l:Executable = a:linter.executable return type(l:Executable) is v:t_func \ ? l:Executable(a:buffer) \ : l:Executable endfunction -" Given a buffer and linter, get the command String for the linter. -" The command_chain key is not supported. -function! ale#linter#GetCommand(buffer, linter) abort - let l:Command = has_key(a:linter, 'command_callback') - \ ? function(a:linter.command_callback) - \ : a:linter.command +function! ale#linter#GetCwd(buffer, linter) abort + let l:Cwd = get(a:linter, 'cwd', v:null) - return type(l:Command) is v:t_func - \ ? l:Command(a:buffer) - \ : l:Command + return type(l:Cwd) is v:t_func ? l:Cwd(a:buffer) : l:Cwd +endfunction + +" Given a buffer and linter, get the command String for the linter. +function! ale#linter#GetCommand(buffer, linter) abort + let l:Command = a:linter.command + + return type(l:Command) is v:t_func ? l:Command(a:buffer) : l:Command endfunction " Given a buffer and linter, get the address for connecting to the server. function! ale#linter#GetAddress(buffer, linter) abort - let l:Address = has_key(a:linter, 'address_callback') - \ ? function(a:linter.address_callback) - \ : a:linter.address + let l:Address = a:linter.address - return type(l:Address) is v:t_func - \ ? l:Address(a:buffer) - \ : l:Address + return type(l:Address) is v:t_func ? l:Address(a:buffer) : l:Address +endfunction + +function! ale#linter#GetLanguage(buffer, linter) abort + let l:Language = a:linter.language + + return type(l:Language) is v:t_func ? l:Language(a:buffer) : l:Language endfunction diff --git a/sources_non_forked/ale/autoload/ale/list.vim b/sources_non_forked/ale/autoload/ale/list.vim index 3417575c..089aa2c0 100644 --- a/sources_non_forked/ale/autoload/ale/list.vim +++ b/sources_non_forked/ale/autoload/ale/list.vim @@ -20,11 +20,17 @@ endif " Return 1 if there is a buffer with buftype == 'quickfix' in bufffer list function! ale#list#IsQuickfixOpen() abort - for l:buf in range(1, bufnr('$')) - if getbufvar(l:buf, '&buftype') is# 'quickfix' - return 1 - endif - endfor + let l:res = getqflist({ 'winid' : winnr() }) + + if has_key(l:res, 'winid') && l:res.winid > 0 + return 1 + endif + + let l:res = getloclist(0, { 'winid' : winnr() }) + + if has_key(l:res, 'winid') && l:res.winid > 0 + return 1 + endif return 0 endfunction @@ -38,6 +44,15 @@ function! s:ShouldOpen(buffer) abort return l:val is 1 || (l:val is# 'on_save' && l:saved) endfunction +function! s:Deduplicate(list) abort + let l:list = a:list + + call sort(l:list, function('ale#util#LocItemCompareWithText')) + call uniq(l:list, function('ale#util#LocItemCompareWithText')) + + return l:list +endfunction + function! ale#list#GetCombinedList() abort let l:list = [] @@ -45,10 +60,7 @@ function! ale#list#GetCombinedList() abort call extend(l:list, l:info.loclist) endfor - call sort(l:list, function('ale#util#LocItemCompareWithText')) - call uniq(l:list, function('ale#util#LocItemCompareWithText')) - - return l:list + return s:Deduplicate(l:list) endfunction function! s:FixList(buffer, list) abort @@ -71,8 +83,8 @@ function! s:FixList(buffer, list) abort return l:new_list endfunction -function! s:BufWinId(buffer) abort - return exists('*bufwinid') ? bufwinid(str2nr(a:buffer)) : 0 +function! s:WinFindBuf(buffer) abort + return exists('*win_findbuf') ? win_findbuf(str2nr(a:buffer)) : [0] endfunction function! s:SetListsImpl(timer_id, buffer, loclist) abort @@ -88,19 +100,26 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort call setqflist([], 'r', {'title': l:title}) endif elseif g:ale_set_loclist - " If windows support is off, bufwinid() may not exist. + " If windows support is off, win_findbuf() may not exist. " We'll set result in the current window, which might not be correct, " but it's better than nothing. - let l:id = s:BufWinId(a:buffer) + let l:ids = s:WinFindBuf(a:buffer) - if has('nvim') - call setloclist(l:id, s:FixList(a:buffer, a:loclist), ' ', l:title) - else - call setloclist(l:id, s:FixList(a:buffer, a:loclist)) - call setloclist(l:id, [], 'r', {'title': l:title}) - endif + let l:loclist = s:Deduplicate(a:loclist) + + for l:id in l:ids + if has('nvim') + call setloclist(l:id, s:FixList(a:buffer, l:loclist), ' ', l:title) + else + call setloclist(l:id, s:FixList(a:buffer, l:loclist)) + call setloclist(l:id, [], 'r', {'title': l:title}) + endif + endfor endif + " Save the current view before opening/closing any window + call setbufvar(a:buffer, 'ale_winview', winsaveview()) + " Open a window to show the problems if we need to. " " We'll check if the current buffer's List is not empty here, so the @@ -108,14 +127,12 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort if s:ShouldOpen(a:buffer) && !empty(a:loclist) let l:winnr = winnr() let l:mode = mode() - let l:reset_visual_selection = l:mode is? 'v' || l:mode is# "\" - let l:reset_character_selection = l:mode is? 's' || l:mode is# "\" " open windows vertically instead of default horizontally let l:open_type = '' if ale#Var(a:buffer, 'list_vertical') == 1 - let l:open_type = 'vert ' + let l:open_type = 'vert rightbelow ' endif if g:ale_set_quickfix @@ -131,15 +148,18 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort wincmd p endif - if l:reset_visual_selection || l:reset_character_selection - " If we were in a selection mode before, select the last selection. - normal! gv - - if l:reset_character_selection - " Switch back to Select mode, if we were in that. + " Return to original mode when applicable + if mode() != l:mode + if l:mode is? 'v' || l:mode is# "\" + " Reset our last visual selection + normal! gv + elseif l:mode is? 's' || l:mode is# "\" + " Reset our last character selection normal! "\" endif endif + + call s:RestoreViewIfNeeded(a:buffer) endif " If ALE isn't currently checking for more problems, close the window if @@ -150,6 +170,30 @@ function! s:SetListsImpl(timer_id, buffer, loclist) abort endif endfunction +" Try to restore the window view after closing any of the lists to avoid making +" the it moving around, especially useful when on insert mode +function! s:RestoreViewIfNeeded(buffer) abort + let l:saved_view = getbufvar(a:buffer, 'ale_winview', {}) + + " Saved view is empty, can't do anything + if empty(l:saved_view) + return + endif + + " Check wether the cursor has moved since linting was actually requested. If + " the user has indeed moved lines, do nothing + let l:current_view = winsaveview() + + if l:current_view['lnum'] != l:saved_view['lnum'] + return + endif + + " Anchor view by topline if the list is set to open horizontally + if ale#Var(a:buffer, 'list_vertical') == 0 + call winrestview({'topline': l:saved_view['topline']}) + endif +endfunction + function! ale#list#SetLists(buffer, loclist) abort if get(g:, 'ale_set_lists_synchronously') == 1 \|| getbufvar(a:buffer, 'ale_save_event_fired', 0) @@ -173,21 +217,31 @@ function! s:CloseWindowIfNeeded(buffer) abort return endif + let l:did_close_any_list = 0 + try " Only close windows if the quickfix list or loclist is completely empty, " including errors set through other means. if g:ale_set_quickfix if empty(getqflist()) cclose + let l:did_close_any_list = 1 endif else - let l:win_id = s:BufWinId(a:buffer) + let l:win_ids = s:WinFindBuf(a:buffer) - if g:ale_set_loclist && empty(getloclist(l:win_id)) - lclose - endif + for l:win_id in l:win_ids + if g:ale_set_loclist && empty(getloclist(l:win_id)) + lclose + let l:did_close_any_list = 1 + endif + endfor endif " Ignore 'Cannot close last window' errors. catch /E444/ endtry + + if l:did_close_any_list + call s:RestoreViewIfNeeded(a:buffer) + endif endfunction diff --git a/sources_non_forked/ale/autoload/ale/loclist_jumping.vim b/sources_non_forked/ale/autoload/ale/loclist_jumping.vim index 1d3ef7e5..55097d12 100644 --- a/sources_non_forked/ale/autoload/ale/loclist_jumping.vim +++ b/sources_non_forked/ale/autoload/ale/loclist_jumping.vim @@ -111,7 +111,7 @@ function! ale#loclist_jumping#Jump(direction, ...) abort if !empty(l:nearest) normal! m` - call cursor(l:nearest) + call cursor([l:nearest[0], max([l:nearest[1], 1])]) endif endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp.vim b/sources_non_forked/ale/autoload/ale/lsp.vim index 7186d2a9..75d81525 100644 --- a/sources_non_forked/ale/autoload/ale/lsp.vim +++ b/sources_non_forked/ale/autoload/ale/lsp.vim @@ -37,12 +37,16 @@ function! ale#lsp#Register(executable_or_address, project, init_options) abort \ 'init_queue': [], \ 'capabilities': { \ 'hover': 0, + \ 'rename': 0, \ 'references': 0, \ 'completion': 0, \ 'completion_trigger_characters': [], \ 'definition': 0, \ 'typeDefinition': 0, \ 'symbol_search': 0, + \ 'code_actions': 0, + \ 'did_save': 0, + \ 'includeText': 0, \ }, \} endif @@ -63,6 +67,9 @@ endfunction " Used only in tests. function! ale#lsp#GetConnections() abort + " This command will throw from the sandbox. + let &l:equalprg=&l:equalprg + return s:connections endfunction @@ -195,10 +202,34 @@ function! s:UpdateCapabilities(conn, capabilities) abort let a:conn.capabilities.hover = 1 endif + if type(get(a:capabilities, 'hoverProvider')) is v:t_dict + let a:conn.capabilities.hover = 1 + endif + if get(a:capabilities, 'referencesProvider') is v:true let a:conn.capabilities.references = 1 endif + if type(get(a:capabilities, 'referencesProvider')) is v:t_dict + let a:conn.capabilities.references = 1 + endif + + if get(a:capabilities, 'renameProvider') is v:true + let a:conn.capabilities.rename = 1 + endif + + if type(get(a:capabilities, 'renameProvider')) is v:t_dict + let a:conn.capabilities.rename = 1 + endif + + if get(a:capabilities, 'codeActionProvider') is v:true + let a:conn.capabilities.code_actions = 1 + endif + + if type(get(a:capabilities, 'codeActionProvider')) is v:t_dict + let a:conn.capabilities.code_actions = 1 + endif + if !empty(get(a:capabilities, 'completionProvider')) let a:conn.capabilities.completion = 1 endif @@ -215,13 +246,43 @@ function! s:UpdateCapabilities(conn, capabilities) abort let a:conn.capabilities.definition = 1 endif + if type(get(a:capabilities, 'definitionProvider')) is v:t_dict + let a:conn.capabilities.definition = 1 + endif + if get(a:capabilities, 'typeDefinitionProvider') is v:true let a:conn.capabilities.typeDefinition = 1 endif + if type(get(a:capabilities, 'typeDefinitionProvider')) is v:t_dict + let a:conn.capabilities.typeDefinition = 1 + endif + if get(a:capabilities, 'workspaceSymbolProvider') is v:true let a:conn.capabilities.symbol_search = 1 endif + + if type(get(a:capabilities, 'workspaceSymbolProvider')) is v:t_dict + let a:conn.capabilities.symbol_search = 1 + endif + + if type(get(a:capabilities, 'textDocumentSync')) is v:t_dict + let l:syncOptions = get(a:capabilities, 'textDocumentSync') + + if get(l:syncOptions, 'save') is v:true + let a:conn.capabilities.did_save = 1 + endif + + if type(get(l:syncOptions, 'save')) is v:t_dict + let a:conn.capabilities.did_save = 1 + + let l:saveOptions = get(l:syncOptions, 'save') + + if get(l:saveOptions, 'includeText') is v:true + let a:conn.capabilities.includeText = 1 + endif + endif + endif endfunction " Update a connection's configuration dictionary and notify LSP servers @@ -316,12 +377,77 @@ function! ale#lsp#MarkConnectionAsTsserver(conn_id) abort let l:conn.capabilities.completion = 1 let l:conn.capabilities.completion_trigger_characters = ['.'] let l:conn.capabilities.definition = 1 + let l:conn.capabilities.typeDefinition = 1 let l:conn.capabilities.symbol_search = 1 + let l:conn.capabilities.rename = 1 + let l:conn.capabilities.code_actions = 1 endfunction function! s:SendInitMessage(conn) abort let [l:init_id, l:init_data] = ale#lsp#CreateMessageData( - \ ale#lsp#message#Initialize(a:conn.root, a:conn.init_options), + \ ale#lsp#message#Initialize( + \ a:conn.root, + \ a:conn.init_options, + \ { + \ 'workspace': { + \ 'applyEdit': v:false, + \ 'didChangeConfiguration': { + \ 'dynamicRegistration': v:false, + \ }, + \ 'symbol': { + \ 'dynamicRegistration': v:false, + \ }, + \ 'workspaceFolders': v:false, + \ 'configuration': v:false, + \ }, + \ 'textDocument': { + \ 'synchronization': { + \ 'dynamicRegistration': v:false, + \ 'willSave': v:false, + \ 'willSaveWaitUntil': v:false, + \ 'didSave': v:true, + \ }, + \ 'completion': { + \ 'dynamicRegistration': v:false, + \ 'completionItem': { + \ 'snippetSupport': v:false, + \ 'commitCharactersSupport': v:false, + \ 'documentationFormat': ['plaintext'], + \ 'deprecatedSupport': v:false, + \ 'preselectSupport': v:false, + \ }, + \ 'contextSupport': v:false, + \ }, + \ 'hover': { + \ 'dynamicRegistration': v:false, + \ 'contentFormat': ['plaintext'], + \ }, + \ 'references': { + \ 'dynamicRegistration': v:false, + \ }, + \ 'documentSymbol': { + \ 'dynamicRegistration': v:false, + \ 'hierarchicalDocumentSymbolSupport': v:false, + \ }, + \ 'definition': { + \ 'dynamicRegistration': v:false, + \ 'linkSupport': v:false, + \ }, + \ 'typeDefinition': { + \ 'dynamicRegistration': v:false, + \ }, + \ 'publishDiagnostics': { + \ 'relatedInformation': v:true, + \ }, + \ 'codeAction': { + \ 'dynamicRegistration': v:false, + \ }, + \ 'rename': { + \ 'dynamicRegistration': v:false, + \ }, + \ }, + \ }, + \ ), \) let a:conn.init_request_id = l:init_id call s:SendMessageData(a:conn, l:init_data) @@ -357,6 +483,7 @@ function! ale#lsp#StartProgram(conn_id, executable, command) abort endif if l:started && !l:conn.is_tsserver + let l:conn.initialized = 0 call s:SendInitMessage(l:conn) endif @@ -484,6 +611,35 @@ function! ale#lsp#OpenDocument(conn_id, buffer, language_id) abort return l:opened endfunction +" Notify LSP servers or tsserver that a document is closed, if opened before. +" If a document is closed, 1 will be returned, otherwise 0 will be returned. +" +" Only the buffer number is required here. A message will be sent to every +" language server that was notified previously of the document being opened. +function! ale#lsp#CloseDocument(buffer) abort + let l:closed = 0 + + " The connection keys are sorted so the messages are easier to test, and + " so messages are sent in a consistent order. + for l:conn_id in sort(keys(s:connections)) + let l:conn = s:connections[l:conn_id] + + if l:conn.initialized && has_key(l:conn.open_documents, a:buffer) + if l:conn.is_tsserver + let l:message = ale#lsp#tsserver_message#Close(a:buffer) + else + let l:message = ale#lsp#message#DidClose(a:buffer) + endif + + call ale#lsp#Send(l:conn_id, l:message) + call remove(l:conn.open_documents, a:buffer) + let l:closed = 1 + endif + endfor + + return l:closed +endfunction + " Notify LSP servers or tsserver that a document has changed, if needed. " If a notification is sent, 1 will be returned, otherwise 0 will be returned. function! ale#lsp#NotifyForChanges(conn_id, buffer) abort diff --git a/sources_non_forked/ale/autoload/ale/lsp/message.vim b/sources_non_forked/ale/autoload/ale/lsp/message.vim index 646dbd20..b40c4407 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/message.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/message.vim @@ -28,14 +28,13 @@ function! ale#lsp#message#GetNextVersionID() abort return l:id endfunction -function! ale#lsp#message#Initialize(root_path, initialization_options) abort - " TODO: Define needed capabilities. +function! ale#lsp#message#Initialize(root_path, options, capabilities) abort " NOTE: rootPath is deprecated in favour of rootUri return [0, 'initialize', { \ 'processId': getpid(), \ 'rootPath': a:root_path, - \ 'capabilities': {}, - \ 'initializationOptions': a:initialization_options, + \ 'capabilities': a:capabilities, + \ 'initializationOptions': a:options, \ 'rootUri': ale#path#ToURI(a:root_path), \}] endfunction @@ -78,12 +77,19 @@ function! ale#lsp#message#DidChange(buffer) abort \}] endfunction -function! ale#lsp#message#DidSave(buffer) abort - return [1, 'textDocument/didSave', { +function! ale#lsp#message#DidSave(buffer, includeText) abort + let l:response = [1, 'textDocument/didSave', { \ 'textDocument': { \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), \ }, \}] + + if a:includeText + let l:response[2].textDocument.version = ale#lsp#message#GetNextVersionID() + let l:response[2].text = ale#util#GetBufferContents(a:buffer) + endif + + return l:response endfunction function! ale#lsp#message#DidClose(buffer) abort @@ -159,7 +165,39 @@ function! ale#lsp#message#Hover(buffer, line, column) abort endfunction function! ale#lsp#message#DidChangeConfiguration(buffer, config) abort - return [0, 'workspace/didChangeConfiguration', { + return [1, 'workspace/didChangeConfiguration', { \ 'settings': a:config, \}] endfunction + +function! ale#lsp#message#Rename(buffer, line, column, new_name) abort + return [0, 'textDocument/rename', { + \ 'textDocument': { + \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ }, + \ 'position': {'line': a:line - 1, 'character': a:column - 1}, + \ 'newName': a:new_name, + \}] +endfunction + +function! ale#lsp#message#CodeAction(buffer, line, column, end_line, end_column, diagnostics) abort + return [0, 'textDocument/codeAction', { + \ 'textDocument': { + \ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')), + \ }, + \ 'range': { + \ 'start': {'line': a:line - 1, 'character': a:column - 1}, + \ 'end': {'line': a:end_line - 1, 'character': a:end_column}, + \ }, + \ 'context': { + \ 'diagnostics': a:diagnostics + \ }, + \}] +endfunction + +function! ale#lsp#message#ExecuteCommand(command, arguments) abort + return [0, 'workspace/executeCommand', { + \ 'command': a:command, + \ 'arguments': a:arguments, + \}] +endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp/response.vim b/sources_non_forked/ale/autoload/ale/lsp/response.vim index b91d875b..a4f80980 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/response.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/response.vim @@ -28,7 +28,7 @@ function! ale#lsp#response#ReadDiagnostics(response) abort for l:diagnostic in a:response.params.diagnostics let l:severity = get(l:diagnostic, 'severity', 0) let l:loclist_item = { - \ 'text': l:diagnostic.message, + \ 'text': substitute(l:diagnostic.message, '\(\r\n\|\n\|\r\)', ' ', 'g'), \ 'type': 'E', \ 'lnum': l:diagnostic.range.start.line + 1, \ 'col': l:diagnostic.range.start.character + 1, @@ -56,6 +56,7 @@ function! ale#lsp#response#ReadDiagnostics(response) abort endif if has_key(l:diagnostic, 'relatedInformation') + \ && l:diagnostic.relatedInformation isnot v:null let l:related = deepcopy(l:diagnostic.relatedInformation) call map(l:related, {key, val -> \ ale#path#FromURI(val.location.uri) . @@ -90,7 +91,7 @@ function! ale#lsp#response#ReadTSServerDiagnostics(response) abort \ 'lnum': l:diagnostic.start.line, \ 'col': l:diagnostic.start.offset, \ 'end_lnum': l:diagnostic.end.line, - \ 'end_col': l:diagnostic.end.offset, + \ 'end_col': l:diagnostic.end.offset - 1, \} if has_key(l:diagnostic, 'code') diff --git a/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim b/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim index d6919516..00213a75 100644 --- a/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim +++ b/sources_non_forked/ale/autoload/ale/lsp/tsserver_message.vim @@ -36,12 +36,14 @@ function! ale#lsp#tsserver_message#Geterr(buffer) abort return [1, 'ts@geterr', {'files': [expand('#' . a:buffer . ':p')]}] endfunction -function! ale#lsp#tsserver_message#Completions(buffer, line, column, prefix) abort +function! ale#lsp#tsserver_message#Completions( +\ buffer, line, column, prefix, include_external) abort return [0, 'ts@completions', { \ 'line': a:line, \ 'offset': a:column, \ 'file': expand('#' . a:buffer . ':p'), \ 'prefix': a:prefix, + \ 'includeExternalModuleExports': a:include_external, \}] endfunction @@ -62,6 +64,14 @@ function! ale#lsp#tsserver_message#Definition(buffer, line, column) abort \}] endfunction +function! ale#lsp#tsserver_message#TypeDefinition(buffer, line, column) abort + return [0, 'ts@typeDefinition', { + \ 'line': a:line, + \ 'offset': a:column, + \ 'file': expand('#' . a:buffer . ':p'), + \}] +endfunction + function! ale#lsp#tsserver_message#References(buffer, line, column) abort return [0, 'ts@references', { \ 'line': a:line, @@ -77,3 +87,63 @@ function! ale#lsp#tsserver_message#Quickinfo(buffer, line, column) abort \ 'file': expand('#' . a:buffer . ':p'), \}] endfunction + +function! ale#lsp#tsserver_message#Rename( +\ buffer, line, column, find_in_comments, find_in_strings) abort + return [0, 'ts@rename', { + \ 'line': a:line, + \ 'offset': a:column, + \ 'file': expand('#' . a:buffer . ':p'), + \ 'arguments': { + \ 'findInComments': a:find_in_comments, + \ 'findInStrings': a:find_in_strings, + \ } + \}] +endfunction + +function! ale#lsp#tsserver_message#OrganizeImports(buffer) abort + return [0, 'ts@organizeImports', { + \ 'scope': { + \ 'type': 'file', + \ 'args': { + \ 'file': expand('#' . a:buffer . ':p'), + \ }, + \ }, + \}] +endfunction + +function! ale#lsp#tsserver_message#GetCodeFixes(buffer, line, column, end_line, end_column, error_codes) abort + " The lines and columns are 1-based. + " The errors codes must be a list of tsserver error codes to fix. + return [0, 'ts@getCodeFixes', { + \ 'startLine': a:line, + \ 'startOffset': a:column, + \ 'endLine': a:end_line, + \ 'endOffset': a:end_column + 1, + \ 'file': expand('#' . a:buffer . ':p'), + \ 'errorCodes': a:error_codes, + \}] +endfunction + +function! ale#lsp#tsserver_message#GetApplicableRefactors(buffer, line, column, end_line, end_column) abort + " The arguments for this request can also be just 'line' and 'offset' + return [0, 'ts@getApplicableRefactors', { + \ 'startLine': a:line, + \ 'startOffset': a:column, + \ 'endLine': a:end_line, + \ 'endOffset': a:end_column + 1, + \ 'file': expand('#' . a:buffer . ':p'), + \}] +endfunction + +function! ale#lsp#tsserver_message#GetEditsForRefactor(buffer, line, column, end_line, end_column, refactor, action) abort + return [0, 'ts@getEditsForRefactor', { + \ 'startLine': a:line, + \ 'startOffset': a:column, + \ 'endLine': a:end_line, + \ 'endOffset': a:end_column + 1, + \ 'file': expand('#' . a:buffer . ':p'), + \ 'refactor': a:refactor, + \ 'action': a:action, + \}] +endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp_linter.vim b/sources_non_forked/ale/autoload/ale/lsp_linter.vim index d544916a..230b3141 100644 --- a/sources_non_forked/ale/autoload/ale/lsp_linter.vim +++ b/sources_non_forked/ale/autoload/ale/lsp_linter.vim @@ -8,8 +8,16 @@ if !has_key(s:, 'lsp_linter_map') let s:lsp_linter_map = {} endif +" A Dictionary to track one-shot handlers for custom LSP requests +let s:custom_handlers_map = get(s:, 'custom_handlers_map', {}) + " Check if diagnostics for a particular linter should be ignored. function! s:ShouldIgnore(buffer, linter_name) abort + " Ignore all diagnostics if LSP integration is disabled. + if ale#Var(a:buffer, 'disable_lsp') + return 1 + endif + let l:config = ale#Var(a:buffer, 'linters_ignore') " Don't load code for ignoring diagnostics if there's nothing to ignore. @@ -26,13 +34,18 @@ endfunction function! s:HandleLSPDiagnostics(conn_id, response) abort let l:linter_name = s:lsp_linter_map[a:conn_id] let l:filename = ale#path#FromURI(a:response.params.uri) - let l:buffer = bufnr(l:filename) + let l:escaped_name = escape( + \ fnameescape(l:filename), + \ has('win32') ? '^' : '^,}]' + \) + let l:buffer = bufnr('^' . l:escaped_name . '$') + let l:info = get(g:ale_buffer_info, l:buffer, {}) - if s:ShouldIgnore(l:buffer, l:linter_name) + if empty(l:info) return endif - if l:buffer <= 0 + if s:ShouldIgnore(l:buffer, l:linter_name) return endif @@ -43,13 +56,19 @@ endfunction function! s:HandleTSServerDiagnostics(response, error_type) abort let l:linter_name = 'tsserver' - let l:buffer = bufnr(a:response.body.file) + let l:escaped_name = escape( + \ fnameescape(a:response.body.file), + \ has('win32') ? '^' : '^,}]' + \) + let l:buffer = bufnr('^' . l:escaped_name . '$') let l:info = get(g:ale_buffer_info, l:buffer, {}) if empty(l:info) return endif + call ale#engine#MarkLinterInactive(l:info, l:linter_name) + if s:ShouldIgnore(l:buffer, l:linter_name) return endif @@ -66,12 +85,18 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort endif let l:info.syntax_loclist = l:thislist - else + elseif a:error_type is# 'semantic' if len(l:thislist) is 0 && len(get(l:info, 'semantic_loclist', [])) is 0 let l:no_changes = 1 endif let l:info.semantic_loclist = l:thislist + else + if len(l:thislist) is 0 && len(get(l:info, 'suggestion_loclist', [])) is 0 + let l:no_changes = 1 + endif + + let l:info.suggestion_loclist = l:thislist endif if l:no_changes @@ -79,6 +104,7 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort endif let l:loclist = get(l:info, 'semantic_loclist', []) + \ + get(l:info, 'suggestion_loclist', []) \ + get(l:info, 'syntax_loclist', []) call ale#engine#HandleLoclist(l:linter_name, l:buffer, l:loclist, 0) @@ -119,12 +145,22 @@ function! ale#lsp_linter#HandleLSPResponse(conn_id, response) abort call s:HandleLSPErrorMessage(l:linter_name, a:response) elseif l:method is# 'textDocument/publishDiagnostics' call s:HandleLSPDiagnostics(a:conn_id, a:response) + elseif l:method is# 'window/showMessage' + call ale#lsp_window#HandleShowMessage( + \ s:lsp_linter_map[a:conn_id], + \ g:ale_lsp_show_message_format, + \ a:response.params + \) elseif get(a:response, 'type', '') is# 'event' \&& get(a:response, 'event', '') is# 'semanticDiag' call s:HandleTSServerDiagnostics(a:response, 'semantic') elseif get(a:response, 'type', '') is# 'event' \&& get(a:response, 'event', '') is# 'syntaxDiag' call s:HandleTSServerDiagnostics(a:response, 'syntax') + elseif get(a:response, 'type', '') is# 'event' + \&& get(a:response, 'event', '') is# 'suggestionDiag' + \&& get(g:, 'ale_lsp_suggestions', '1') == 1 + call s:HandleTSServerDiagnostics(a:response, 'suggestion') endif endfunction @@ -165,7 +201,11 @@ function! ale#lsp_linter#GetConfig(buffer, linter) abort endfunction function! ale#lsp_linter#FindProjectRoot(buffer, linter) abort - let l:buffer_ale_root = getbufvar(a:buffer, 'ale_lsp_root', {}) + let l:buffer_ale_root = getbufvar( + \ a:buffer, + \ 'ale_root', + \ getbufvar(a:buffer, 'ale_lsp_root', {}) + \) if type(l:buffer_ale_root) is v:t_string return l:buffer_ale_root @@ -182,9 +222,15 @@ function! ale#lsp_linter#FindProjectRoot(buffer, linter) abort endif endif + let l:global_root = g:ale_root + + if empty(g:ale_root) && exists('g:ale_lsp_root') + let l:global_root = g:ale_lsp_root + endif + " Try to get a global setting for the root - if has_key(g:ale_lsp_root, a:linter.name) - let l:Root = g:ale_lsp_root[a:linter.name] + if has_key(l:global_root, a:linter.name) + let l:Root = l:global_root[a:linter.name] if type(l:Root) is v:t_func return l:Root(a:buffer) @@ -210,7 +256,7 @@ function! ale#lsp_linter#OnInit(linter, details, Callback) abort let l:command = a:details.command let l:config = ale#lsp_linter#GetConfig(l:buffer, a:linter) - let l:language_id = ale#util#GetFunction(a:linter.language_callback)(l:buffer) + let l:language_id = ale#linter#GetLanguage(l:buffer, a:linter) call ale#lsp#UpdateConfig(l:conn_id, l:buffer, l:config) @@ -225,6 +271,30 @@ function! ale#lsp_linter#OnInit(linter, details, Callback) abort call ale#lsp#NotifyForChanges(l:conn_id, l:buffer) endif + " Tell the relevant buffer that the LSP has started via an autocmd. + if l:buffer > 0 + if l:buffer == bufnr('') + silent doautocmd User ALELSPStarted + else + execute 'augroup ALELSPStartedGroup' . l:buffer + autocmd! + + execute printf( + \ 'autocmd BufEnter ' + \ . ' doautocmd User ALELSPStarted', + \ l:buffer + \) + + " Replicate ++once behavior for backwards compatibility. + execute printf( + \ 'autocmd BufEnter ' + \ . ' autocmd! ALELSPStartedGroup%d', + \ l:buffer, l:buffer + \) + augroup END + endif + endif + call a:Callback(a:linter, a:details) endfunction @@ -248,7 +318,16 @@ function! s:StartLSP(options, address, executable, command) abort call ale#lsp#MarkConnectionAsTsserver(l:conn_id) endif - let l:command = ale#command#FormatCommand(l:buffer, a:executable, a:command, 0, v:false)[1] + let l:cwd = ale#linter#GetCwd(l:buffer, l:linter) + let l:command = ale#command#FormatCommand( + \ l:buffer, + \ a:executable, + \ a:command, + \ 0, + \ v:false, + \ l:cwd, + \ ale#GetFilenameMappings(l:buffer, l:linter.name), + \)[1] let l:command = ale#job#PrepareCommand(l:buffer, l:command) let l:ready = ale#lsp#StartProgram(l:conn_id, a:executable, l:command) endif @@ -376,6 +455,10 @@ function! s:CheckWithLSP(linter, details) abort if a:linter.lsp is# 'tsserver' let l:message = ale#lsp#tsserver_message#Geterr(l:buffer) let l:notified = ale#lsp#Send(l:id, l:message) != 0 + + if l:notified + call ale#engine#MarkLinterActive(l:info, a:linter) + endif else let l:notified = ale#lsp#NotifyForChanges(l:id, l:buffer) endif @@ -383,13 +466,11 @@ function! s:CheckWithLSP(linter, details) abort " If this was a file save event, also notify the server of that. if a:linter.lsp isnot# 'tsserver' \&& getbufvar(l:buffer, 'ale_save_event_fired', 0) - let l:save_message = ale#lsp#message#DidSave(l:buffer) + \&& ale#lsp#HasCapability(l:buffer, 'did_save') + let l:include_text = ale#lsp#HasCapability(l:buffer, 'includeText') + let l:save_message = ale#lsp#message#DidSave(l:buffer, l:include_text) let l:notified = ale#lsp#Send(l:id, l:save_message) != 0 endif - - if l:notified - call ale#engine#MarkLinterActive(l:info, a:linter) - endif endfunction function! ale#lsp_linter#CheckWithLSP(buffer, linter) abort @@ -399,9 +480,57 @@ endfunction " Clear LSP linter data for the linting engine. function! ale#lsp_linter#ClearLSPData() abort let s:lsp_linter_map = {} + let s:custom_handlers_map = {} endfunction " Just for tests. function! ale#lsp_linter#SetLSPLinterMap(replacement_map) abort let s:lsp_linter_map = a:replacement_map endfunction + +function! s:HandleLSPResponseToCustomRequests(conn_id, response) abort + if has_key(a:response, 'id') + \&& has_key(s:custom_handlers_map, a:response.id) + let l:Handler = remove(s:custom_handlers_map, a:response.id) + call l:Handler(a:response) + endif +endfunction + +function! s:OnReadyForCustomRequests(args, linter, lsp_details) abort + let l:id = a:lsp_details.connection_id + let l:request_id = ale#lsp#Send(l:id, a:args.message) + + if l:request_id > 0 && has_key(a:args, 'handler') + let l:Callback = function('s:HandleLSPResponseToCustomRequests') + call ale#lsp#RegisterCallback(l:id, l:Callback) + let s:custom_handlers_map[l:request_id] = a:args.handler + endif +endfunction + +" Send a custom request to an LSP linter. +function! ale#lsp_linter#SendRequest(buffer, linter_name, message, ...) abort + let l:filetype = ale#linter#ResolveFiletype(getbufvar(a:buffer, '&filetype')) + let l:linter_list = ale#linter#GetAll(l:filetype) + let l:linter_list = filter(l:linter_list, {_, v -> v.name is# a:linter_name}) + + if len(l:linter_list) < 1 + throw 'Linter "' . a:linter_name . '" not found!' + endif + + let l:linter = l:linter_list[0] + + if empty(l:linter.lsp) + throw 'Linter "' . a:linter_name . '" does not support LSP!' + endif + + let l:is_notification = a:message[0] + let l:callback_args = {'message': a:message} + + if !l:is_notification && a:0 + let l:callback_args.handler = a:1 + endif + + let l:Callback = function('s:OnReadyForCustomRequests', [l:callback_args]) + + return ale#lsp_linter#StartLSP(a:buffer, l:linter, l:Callback) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/lsp_window.vim b/sources_non_forked/ale/autoload/ale/lsp_window.vim new file mode 100644 index 00000000..9a27f2f1 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/lsp_window.vim @@ -0,0 +1,58 @@ +" Author: suoto +" Description: Handling of window/* LSP methods, although right now only +" handles window/showMessage + +" Constants for message type codes +let s:LSP_MESSAGE_TYPE_DISABLED = 0 +let s:LSP_MESSAGE_TYPE_ERROR = 1 +let s:LSP_MESSAGE_TYPE_WARNING = 2 +let s:LSP_MESSAGE_TYPE_INFORMATION = 3 +let s:LSP_MESSAGE_TYPE_LOG = 4 + +" Translate strings from the user config to a number so we can check +" severities +let s:CFG_TO_LSP_SEVERITY = { +\ 'disabled': s:LSP_MESSAGE_TYPE_DISABLED, +\ 'error': s:LSP_MESSAGE_TYPE_ERROR, +\ 'warning': s:LSP_MESSAGE_TYPE_WARNING, +\ 'information': s:LSP_MESSAGE_TYPE_INFORMATION, +\ 'info': s:LSP_MESSAGE_TYPE_INFORMATION, +\ 'log': s:LSP_MESSAGE_TYPE_LOG +\} + +" Handle window/showMessage response. +" - details: dict containing linter name and format (g:ale_lsp_show_message_format) +" - params: dict with the params for the call in the form of {type: number, message: string} +function! ale#lsp_window#HandleShowMessage(linter_name, format, params) abort + let l:message = a:params.message + let l:type = a:params.type + + " Get the configured severity level threshold and check if the message + " should be displayed or not + let l:configured_severity = tolower(get(g:, 'ale_lsp_show_message_severity', 'error')) + " If the user has configured with a value we can't find on the conversion + " dict, fall back to warning + let l:cfg_severity_threshold = get(s:CFG_TO_LSP_SEVERITY, l:configured_severity, s:LSP_MESSAGE_TYPE_WARNING) + + if l:type > l:cfg_severity_threshold + return + endif + + " Severity will depend on the message type + if l:type is# s:LSP_MESSAGE_TYPE_ERROR + let l:severity = g:ale_echo_msg_error_str + elseif l:type is# s:LSP_MESSAGE_TYPE_INFORMATION + let l:severity = g:ale_echo_msg_info_str + elseif l:type is# s:LSP_MESSAGE_TYPE_LOG + let l:severity = g:ale_echo_msg_log_str + else + " Default to warning just in case + let l:severity = g:ale_echo_msg_warning_str + endif + + let l:string = substitute(a:format, '\V%severity%', l:severity, 'g') + let l:string = substitute(l:string, '\V%linter%', a:linter_name, 'g') + let l:string = substitute(l:string, '\V%s\>', l:message, 'g') + + call ale#util#ShowMessage(l:string) +endfunction diff --git a/sources_non_forked/ale/autoload/ale/maven.vim b/sources_non_forked/ale/autoload/ale/maven.vim new file mode 100644 index 00000000..4f87ebb7 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/maven.vim @@ -0,0 +1,57 @@ +" Description: Functions for working with Maven projects. +" +" Given a buffer number, find a Maven project root. +function! ale#maven#FindProjectRoot(buffer) abort + let l:wrapper_path = ale#path#FindNearestFile(a:buffer, 'mvnw') + + if !empty(l:wrapper_path) + return fnamemodify(l:wrapper_path, ':h') + endif + + let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml') + + if !empty(l:pom_path) + return fnamemodify(l:pom_path, ':h') + endif + + return '' +endfunction + +" Given a buffer number, find the path to the executable. +" First search on the path for 'mvnw' (mvnw.cmd on Windows), if nothing is found, +" try the global command. Returns an empty string if cannot find the executable. +function! ale#maven#FindExecutable(buffer) abort + let l:wrapper_cmd = has('unix') ? 'mvnw' : 'mvnw.cmd' + let l:wrapper_path = ale#path#FindNearestFile(a:buffer, l:wrapper_cmd) + + if !empty(l:wrapper_path) && executable(l:wrapper_path) + return l:wrapper_path + endif + + if executable('mvn') + return 'mvn' + endif + + return '' +endfunction + +" Given a buffer number, get a working directory and command to print the +" classpath of the root project. +" +" Returns an empty string for the command if Maven is not detected. +function! ale#maven#BuildClasspathCommand(buffer) abort + let l:executable = ale#maven#FindExecutable(a:buffer) + + if !empty(l:executable) + let l:project_root = ale#maven#FindProjectRoot(a:buffer) + + if !empty(l:project_root) + return [ + \ l:project_root, + \ ale#Escape(l:executable) . ' dependency:build-classpath' + \] + endif + endif + + return ['', ''] +endfunction diff --git a/sources_non_forked/ale/autoload/ale/node.vim b/sources_non_forked/ale/autoload/ale/node.vim index f75280b7..9e11ca7e 100644 --- a/sources_non_forked/ale/autoload/ale/node.vim +++ b/sources_non_forked/ale/autoload/ale/node.vim @@ -3,26 +3,6 @@ call ale#Set('windows_node_executable_path', 'node.exe') -" Given a buffer number, a base variable name, and a list of paths to search -" for in ancestor directories, detect the executable path for a Node program. -" -" The use_global and executable options for the relevant program will be used. -function! ale#node#FindExecutable(buffer, base_var_name, path_list) abort - if ale#Var(a:buffer, a:base_var_name . '_use_global') - return ale#Var(a:buffer, a:base_var_name . '_executable') - endif - - for l:path in a:path_list - let l:executable = ale#path#FindNearestFile(a:buffer, l:path) - - if !empty(l:executable) - return l:executable - endif - endfor - - return ale#Var(a:buffer, a:base_var_name . '_executable') -endfunction - " Create a executable string which executes a Node.js script command with a " Node.js executable if needed. " @@ -32,7 +12,7 @@ endfunction " " The executable is only prefixed for Windows machines function! ale#node#Executable(buffer, executable) abort - if ale#Has('win32') && a:executable =~? '\.js$' + if has('win32') && a:executable =~? '\.js$' let l:node = ale#Var(a:buffer, 'windows_node_executable_path') return ale#Escape(l:node) . ' ' . ale#Escape(a:executable) diff --git a/sources_non_forked/ale/autoload/ale/organize_imports.vim b/sources_non_forked/ale/autoload/ale/organize_imports.vim new file mode 100644 index 00000000..e2b1c0d2 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/organize_imports.vim @@ -0,0 +1,62 @@ +" Author: Jerko Steiner +" Description: Organize imports support for tsserver +" +function! ale#organize_imports#HandleTSServerResponse(conn_id, response) abort + if get(a:response, 'command', '') isnot# 'organizeImports' + return + endif + + if get(a:response, 'success', v:false) isnot v:true + return + endif + + let l:file_code_edits = a:response.body + + call ale#code_action#HandleCodeAction( + \ { + \ 'description': 'Organize Imports', + \ 'changes': l:file_code_edits, + \ }, + \ {} + \) +endfunction + +function! s:OnReady(linter, lsp_details) abort + let l:id = a:lsp_details.connection_id + + if a:linter.lsp isnot# 'tsserver' + call ale#util#Execute('echom ''OrganizeImports currently only works with tsserver''') + + return + endif + + let l:buffer = a:lsp_details.buffer + + let l:Callback = function('ale#organize_imports#HandleTSServerResponse') + + call ale#lsp#RegisterCallback(l:id, l:Callback) + + let l:message = ale#lsp#tsserver_message#OrganizeImports(l:buffer) + + let l:request_id = ale#lsp#Send(l:id, l:message) +endfunction + +function! s:OrganizeImports(linter) abort + let l:buffer = bufnr('') + let [l:line, l:column] = getpos('.')[1:2] + + if a:linter.lsp isnot# 'tsserver' + let l:column = min([l:column, len(getline(l:line))]) + endif + + let l:Callback = function('s:OnReady') + call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback) +endfunction + +function! ale#organize_imports#Execute() abort + for l:linter in ale#linter#Get(&filetype) + if !empty(l:linter.lsp) + call s:OrganizeImports(l:linter) + endif + endfor +endfunction diff --git a/sources_non_forked/ale/autoload/ale/path.vim b/sources_non_forked/ale/autoload/ale/path.vim index 60d42eb5..c7bfd47e 100644 --- a/sources_non_forked/ale/autoload/ale/path.vim +++ b/sources_non_forked/ale/autoload/ale/path.vim @@ -3,13 +3,20 @@ " simplify a path, and fix annoying issues with paths on Windows. " -" Forward slashes are changed to back slashes so path equality works better. +" Forward slashes are changed to back slashes so path equality works better +" on Windows. Back slashes are changed to forward slashes on Unix. +" +" Unix paths can technically contain back slashes, but in practice no path +" should, and replacing back slashes with forward slashes makes linters work +" in environments like MSYS. " " Paths starting with more than one forward slash are changed to only one " forward slash, to prevent the paths being treated as special MSYS paths. function! ale#path#Simplify(path) abort if has('unix') - return substitute(simplify(a:path), '^//\+', '/', 'g') " no-custom-checks + let l:unix_path = substitute(a:path, '\\', '/', 'g') + + return substitute(simplify(l:unix_path), '^//\+', '/', 'g') " no-custom-checks endif let l:win_path = substitute(a:path, '/', '\\', 'g') @@ -17,6 +24,14 @@ function! ale#path#Simplify(path) abort return substitute(simplify(l:win_path), '^\\\+', '\', 'g') " no-custom-checks endfunction +" Simplify a path without a Windows drive letter. +" This function can be used for checking if paths are equal. +function! ale#path#RemoveDriveLetter(path) abort + return has('win32') && a:path[1:2] is# ':\' + \ ? ale#path#Simplify(a:path[2:]) + \ : ale#path#Simplify(a:path) +endfunction + " Given a buffer and a filename, find the nearest file by searching upwards " through the paths relative to the given buffer. function! ale#path#FindNearestFile(buffer, filename) abort @@ -47,14 +62,14 @@ function! ale#path#FindNearestDirectory(buffer, directory_name) abort return '' endfunction -" Given a buffer, a string to search for, an a global fallback for when +" Given a buffer, a string to search for, and a global fallback for when " the search fails, look for a file in parent paths, and if that fails, " use the global fallback path instead. function! ale#path#ResolveLocalPath(buffer, search_string, global_fallback) abort " Search for a locally installed file first. let l:path = ale#path#FindNearestFile(a:buffer, a:search_string) - " If the serach fails, try the global executable instead. + " If the search fails, try the global executable instead. if empty(l:path) let l:path = a:global_fallback endif @@ -62,20 +77,40 @@ function! ale#path#ResolveLocalPath(buffer, search_string, global_fallback) abor return l:path endfunction -" Output 'cd && ' -" This function can be used changing the directory for a linter command. -function! ale#path#CdString(directory) abort - if has('win32') - return 'cd /d ' . ale#Escape(a:directory) . ' && ' - else - return 'cd ' . ale#Escape(a:directory) . ' && ' - endif +" Given a buffer number, a base variable name, and a list of paths to search +" for in ancestor directories, detect the executable path for a program. +function! ale#path#FindNearestExecutable(buffer, path_list) abort + for l:path in a:path_list + if ale#path#IsAbsolute(l:path) + let l:executable = filereadable(l:path) ? l:path : '' + else + let l:executable = ale#path#FindNearestFile(a:buffer, l:path) + endif + + if !empty(l:executable) + return l:executable + endif + endfor + + return '' endfunction -" Output 'cd && ' -" This function can be used changing the directory for a linter command. -function! ale#path#BufferCdString(buffer) abort - return ale#path#CdString(fnamemodify(bufname(a:buffer), ':p:h')) +" Given a buffer number, a base variable name, and a list of paths to search +" for in ancestor directories, detect the executable path for a program. +" +" The use_global and executable options for the relevant program will be used. +function! ale#path#FindExecutable(buffer, base_var_name, path_list) abort + if ale#Var(a:buffer, a:base_var_name . '_use_global') + return ale#Var(a:buffer, a:base_var_name . '_executable') + endif + + let l:nearest = ale#path#FindNearestExecutable(a:buffer, a:path_list) + + if !empty(l:nearest) + return l:nearest + endif + + return ale#Var(a:buffer, a:base_var_name . '_executable') endfunction " Return 1 if a path is an absolute path. @@ -88,7 +123,7 @@ function! ale#path#IsAbsolute(filename) abort return a:filename[:0] is# '/' || a:filename[1:2] is# ':\' endfunction -let s:temp_dir = ale#path#Simplify(fnamemodify(ale#util#Tempname(), ':h')) +let s:temp_dir = ale#path#Simplify(fnamemodify(ale#util#Tempname(), ':h:h')) " Given a filename, return 1 if the file represents some temporary file " created by Vim. @@ -117,7 +152,7 @@ function! ale#path#Dirname(path) abort endif " For /foo/bar/ we need :h:h to get /foo - if a:path[-1:] is# '/' + if a:path[-1:] is# '/' || (has('win32') && a:path[-1:] is# '\') return fnamemodify(a:path, ':h:h') endif diff --git a/sources_non_forked/ale/autoload/ale/powershell.vim b/sources_non_forked/ale/autoload/ale/powershell.vim new file mode 100644 index 00000000..8c163206 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/powershell.vim @@ -0,0 +1,32 @@ +" Author: zigford +" Description: Functions for integrating with Powershell linters. + +" Write a powershell script to a temp file for execution +" return the command used to execute it +function! s:TemporaryPSScript(buffer, input) abort + let l:filename = 'script.ps1' + " Create a temp dir to house our temp .ps1 script + " a temp dir is needed as powershell needs the .ps1 + " extension + let l:tempdir = ale#util#Tempname() . (has('win32') ? '\' : '/') + let l:tempscript = l:tempdir . l:filename + " Create the temporary directory for the file, unreadable by 'other' + " users. + call mkdir(l:tempdir, '', 0750) + " Automatically delete the directory later. + call ale#command#ManageDirectory(a:buffer, l:tempdir) + " Write the script input out to a file. + call ale#util#Writefile(a:buffer, a:input, l:tempscript) + + return l:tempscript +endfunction + +function! ale#powershell#RunPowerShell(buffer, base_var_name, command) abort + let l:executable = ale#Var(a:buffer, a:base_var_name . '_executable') + let l:tempscript = s:TemporaryPSScript(a:buffer, a:command) + + return ale#Escape(l:executable) + \ . ' -Exe Bypass -NoProfile -File ' + \ . ale#Escape(l:tempscript) + \ . ' %t' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/preview.vim b/sources_non_forked/ale/autoload/ale/preview.vim index 6d58aca9..1aca03ea 100644 --- a/sources_non_forked/ale/autoload/ale/preview.vim +++ b/sources_non_forked/ale/autoload/ale/preview.vim @@ -1,6 +1,22 @@ " Author: w0rp " Description: Preview windows for showing whatever information in. +if !has_key(s:, 'last_list') + let s:last_list = [] +endif + +if !has_key(s:, 'last_options') + let s:last_options = {} +endif + +function! ale#preview#SetLastSelection(item_list, options) abort + let s:last_list = a:item_list + let s:last_options = { + \ 'open_in': get(a:options, 'open_in', 'current-buffer'), + \ 'use_relative_paths': get(a:options, 'use_relative_paths', 0), + \} +endfunction + " Open a preview window and show some lines in it. " A second argument can be passed as a Dictionary with options. They are... " @@ -23,6 +39,10 @@ function! ale#preview#Show(lines, ...) abort setlocal readonly let &l:filetype = get(l:options, 'filetype', 'ale-preview') + for l:command in get(l:options, 'commands', []) + call execute(l:command) + endfor + if get(l:options, 'stay_here') wincmd p endif @@ -67,32 +87,51 @@ function! ale#preview#ShowSelection(item_list, ...) abort call ale#preview#Show(l:lines, {'filetype': 'ale-preview-selection'}) let b:ale_preview_item_list = a:item_list + let b:ale_preview_item_open_in = get(l:options, 'open_in', 'current-buffer') + + " Jump to an index for a previous selection, if set. + if has_key(l:options, 'jump_to_index') + let l:pos = getpos('.') + let l:pos[1] = l:options.jump_to_index + 1 + call setpos('.', l:pos) + endif + + " Remember preview state, so we can repeat it later. + call ale#preview#SetLastSelection(a:item_list, l:options) endfunction -function! s:Open(open_in_tab) abort +function! ale#preview#RepeatSelection() abort + if !empty(s:last_list) + call ale#preview#ShowSelection(s:last_list, s:last_options) + endif +endfunction + +function! s:Open(open_in) abort let l:item_list = get(b:, 'ale_preview_item_list', []) - let l:item = get(l:item_list, getpos('.')[1] - 1, {}) + let l:index = getpos('.')[1] - 1 + let l:item = get(l:item_list, l:index, {}) if empty(l:item) return endif - if !a:open_in_tab - :q! - endif + " Remember an index to jump to when repeating a selection. + let s:last_options.jump_to_index = l:index + + :q! call ale#util#Open( \ l:item.filename, \ l:item.line, \ l:item.column, - \ {'open_in_tab': a:open_in_tab}, + \ {'open_in': a:open_in}, \) endfunction -function! ale#preview#OpenSelectionInBuffer() abort - call s:Open(0) +function! ale#preview#OpenSelection() abort + call s:Open(b:ale_preview_item_open_in) endfunction function! ale#preview#OpenSelectionInTab() abort - call s:Open(1) + call s:Open('tab') endfunction diff --git a/sources_non_forked/ale/autoload/ale/python.vim b/sources_non_forked/ale/autoload/ale/python.vim index 2f28214b..81cb06e0 100644 --- a/sources_non_forked/ale/autoload/ale/python.vim +++ b/sources_non_forked/ale/autoload/ale/python.vim @@ -2,6 +2,7 @@ " Description: Functions for integrating with Python linters. call ale#Set('python_auto_pipenv', '0') +call ale#Set('python_auto_poetry', '0') let s:sep = has('win32') ? '\' : '/' " bin is used for Unix virtualenv directories, and Scripts is for Windows. @@ -23,15 +24,19 @@ function! ale#python#FindProjectRootIni(buffer) abort \|| filereadable(l:path . '/setup.cfg') \|| filereadable(l:path . '/pytest.ini') \|| filereadable(l:path . '/tox.ini') + \|| filereadable(l:path . '/.pyre_configuration.local') \|| filereadable(l:path . '/mypy.ini') \|| filereadable(l:path . '/pycodestyle.cfg') - \|| filereadable(l:path . '/flake8.cfg') + \|| filereadable(l:path . '/.flake8') \|| filereadable(l:path . '/.flake8rc') \|| filereadable(l:path . '/pylama.ini') \|| filereadable(l:path . '/pylintrc') \|| filereadable(l:path . '/.pylintrc') \|| filereadable(l:path . '/Pipfile') \|| filereadable(l:path . '/Pipfile.lock') + \|| filereadable(l:path . '/poetry.lock') + \|| filereadable(l:path . '/pyproject.toml') + \|| filereadable(l:path . '/.tool-versions') return l:path endif endfor @@ -155,3 +160,8 @@ endfunction function! ale#python#PipenvPresent(buffer) abort return findfile('Pipfile.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# '' endfunction + +" Detects whether a poetry environment is present. +function! ale#python#PoetryPresent(buffer) abort + return findfile('poetry.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# '' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/racket.vim b/sources_non_forked/ale/autoload/ale/racket.vim new file mode 100644 index 00000000..ff896108 --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/racket.vim @@ -0,0 +1,12 @@ +function! ale#racket#FindProjectRoot(buffer) abort + let l:cwd = expand('#' . a:buffer . ':p:h') + let l:highest_init = l:cwd + + for l:path in ale#path#Upwards(l:cwd) + if filereadable(l:path.'/init.rkt') + let l:highest_init = l:path + endif + endfor + + return l:highest_init +endfunction diff --git a/sources_non_forked/ale/autoload/ale/references.vim b/sources_non_forked/ale/autoload/ale/references.vim index 0e88afe2..38ff0d3d 100644 --- a/sources_non_forked/ale/autoload/ale/references.vim +++ b/sources_non_forked/ale/autoload/ale/references.vim @@ -1,3 +1,5 @@ +let g:ale_default_navigation = get(g:, 'ale_default_navigation', 'buffer') + let s:references_map = {} " Used to get the references map in tests. @@ -49,13 +51,15 @@ function! ale#references#HandleLSPResponse(conn_id, response) abort let l:result = get(a:response, 'result', []) let l:item_list = [] - for l:response_item in l:result - call add(l:item_list, { - \ 'filename': ale#path#FromURI(l:response_item.uri), - \ 'line': l:response_item.range.start.line + 1, - \ 'column': l:response_item.range.start.character + 1, - \}) - endfor + if type(l:result) is v:t_list + for l:response_item in l:result + call add(l:item_list, { + \ 'filename': ale#path#FromURI(l:response_item.uri), + \ 'line': l:response_item.range.start.line + 1, + \ 'column': l:response_item.range.start.character + 1, + \}) + endfor + endif if empty(l:item_list) call ale#util#Execute('echom ''No references found.''') @@ -97,7 +101,8 @@ function! s:OnReady(line, column, options, linter, lsp_details) abort let l:request_id = ale#lsp#Send(l:id, l:message) let s:references_map[l:request_id] = { - \ 'use_relative_paths': has_key(a:options, 'use_relative_paths') ? a:options.use_relative_paths : 0 + \ 'use_relative_paths': has_key(a:options, 'use_relative_paths') ? a:options.use_relative_paths : 0, + \ 'open_in': get(a:options, 'open_in', 'current-buffer'), \} endfunction @@ -108,10 +113,24 @@ function! ale#references#Find(...) abort for l:option in a:000 if l:option is? '-relative' let l:options.use_relative_paths = 1 + elseif l:option is? '-tab' + let l:options.open_in = 'tab' + elseif l:option is? '-split' + let l:options.open_in = 'split' + elseif l:option is? '-vsplit' + let l:options.open_in = 'vsplit' endif endfor endif + if !has_key(l:options, 'open_in') + let l:default_navigation = ale#Var(bufnr(''), 'default_navigation') + + if index(['tab', 'split', 'vsplit'], l:default_navigation) >= 0 + let l:options.open_in = l:default_navigation + endif + endif + let l:buffer = bufnr('') let [l:line, l:column] = getpos('.')[1:2] let l:column = min([l:column, len(getline(l:line))]) diff --git a/sources_non_forked/ale/autoload/ale/rename.vim b/sources_non_forked/ale/autoload/ale/rename.vim new file mode 100644 index 00000000..9030618e --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/rename.vim @@ -0,0 +1,208 @@ +" Author: Jerko Steiner +" Description: Rename symbol support for LSP / tsserver + +let s:rename_map = {} + +" Used to get the rename map in tests. +function! ale#rename#GetMap() abort + return deepcopy(s:rename_map) +endfunction + +" Used to set the rename map in tests. +function! ale#rename#SetMap(map) abort + let s:rename_map = a:map +endfunction + +function! ale#rename#ClearLSPData() abort + let s:rename_map = {} +endfunction + +let g:ale_rename_tsserver_find_in_comments = get(g:, 'ale_rename_tsserver_find_in_comments') +let g:ale_rename_tsserver_find_in_strings = get(g:, 'ale_rename_tsserver_find_in_strings') + +function! s:message(message) abort + call ale#util#Execute('echom ' . string(a:message)) +endfunction + +function! ale#rename#HandleTSServerResponse(conn_id, response) abort + if get(a:response, 'command', '') isnot# 'rename' + return + endif + + if !has_key(s:rename_map, a:response.request_seq) + return + endif + + let l:options = remove(s:rename_map, a:response.request_seq) + + let l:old_name = l:options.old_name + let l:new_name = l:options.new_name + + if get(a:response, 'success', v:false) is v:false + let l:message = get(a:response, 'message', 'unknown') + call s:message('Error renaming "' . l:old_name . '" to: "' . l:new_name + \ . '". Reason: ' . l:message) + + return + endif + + let l:changes = [] + + for l:response_item in a:response.body.locs + let l:filename = l:response_item.file + let l:text_changes = [] + + for l:loc in l:response_item.locs + call add(l:text_changes, { + \ 'start': { + \ 'line': l:loc.start.line, + \ 'offset': l:loc.start.offset, + \ }, + \ 'end': { + \ 'line': l:loc.end.line, + \ 'offset': l:loc.end.offset, + \ }, + \ 'newText': l:new_name, + \}) + endfor + + call add(l:changes, { + \ 'fileName': l:filename, + \ 'textChanges': l:text_changes, + \}) + endfor + + if empty(l:changes) + call s:message('Error renaming "' . l:old_name . '" to: "' . l:new_name . '"') + + return + endif + + call ale#code_action#HandleCodeAction( + \ { + \ 'description': 'rename', + \ 'changes': l:changes, + \ }, + \ { + \ 'should_save': 1, + \ }, + \) +endfunction + +function! ale#rename#HandleLSPResponse(conn_id, response) abort + if has_key(a:response, 'id') + \&& has_key(s:rename_map, a:response.id) + let l:options = remove(s:rename_map, a:response.id) + + if !has_key(a:response, 'result') + call s:message('No rename result received from server') + + return + endif + + let l:changes_map = ale#code_action#GetChanges(a:response.result) + + if empty(l:changes_map) + call s:message('No changes received from server') + + return + endif + + let l:changes = ale#code_action#BuildChangesList(l:changes_map) + + call ale#code_action#HandleCodeAction( + \ { + \ 'description': 'rename', + \ 'changes': l:changes, + \ }, + \ { + \ 'should_save': 1, + \ }, + \) + endif +endfunction + +function! s:OnReady(line, column, options, linter, lsp_details) abort + let l:id = a:lsp_details.connection_id + + if !ale#lsp#HasCapability(l:id, 'rename') + return + endif + + let l:buffer = a:lsp_details.buffer + + let l:Callback = a:linter.lsp is# 'tsserver' + \ ? function('ale#rename#HandleTSServerResponse') + \ : function('ale#rename#HandleLSPResponse') + + call ale#lsp#RegisterCallback(l:id, l:Callback) + + if a:linter.lsp is# 'tsserver' + let l:message = ale#lsp#tsserver_message#Rename( + \ l:buffer, + \ a:line, + \ a:column, + \ g:ale_rename_tsserver_find_in_comments, + \ g:ale_rename_tsserver_find_in_strings, + \) + else + " Send a message saying the buffer has changed first, or the + " rename position probably won't make sense. + call ale#lsp#NotifyForChanges(l:id, l:buffer) + + let l:message = ale#lsp#message#Rename( + \ l:buffer, + \ a:line, + \ a:column, + \ a:options.new_name + \) + endif + + let l:request_id = ale#lsp#Send(l:id, l:message) + + let s:rename_map[l:request_id] = a:options +endfunction + +function! s:ExecuteRename(linter, options) abort + let l:buffer = bufnr('') + let [l:line, l:column] = getpos('.')[1:2] + + if a:linter.lsp isnot# 'tsserver' + let l:column = min([l:column, len(getline(l:line))]) + endif + + let l:Callback = function('s:OnReady', [l:line, l:column, a:options]) + call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback) +endfunction + +function! ale#rename#Execute() abort + let l:lsp_linters = [] + + for l:linter in ale#linter#Get(&filetype) + if !empty(l:linter.lsp) + call add(l:lsp_linters, l:linter) + endif + endfor + + if empty(l:lsp_linters) + call s:message('No active LSPs') + + return + endif + + let l:old_name = expand('') + let l:new_name = ale#util#Input('New name: ', l:old_name) + + if empty(l:new_name) + call s:message('New name cannot be empty!') + + return + endif + + for l:lsp_linter in l:lsp_linters + call s:ExecuteRename(l:lsp_linter, { + \ 'old_name': l:old_name, + \ 'new_name': l:new_name, + \}) + endfor +endfunction diff --git a/sources_non_forked/ale/autoload/ale/ruby.vim b/sources_non_forked/ale/autoload/ale/ruby.vim index 69d7a0c0..d941bb2c 100644 --- a/sources_non_forked/ale/autoload/ale/ruby.vim +++ b/sources_non_forked/ale/autoload/ale/ruby.vim @@ -1,7 +1,7 @@ " Author: Eddie Lebow https://github.com/elebow " Description: Functions for integrating with Ruby tools -" Find the nearest dir contining "app", "db", and "config", and assume it is +" Find the nearest dir containing "app", "db", and "config", and assume it is " the root of a Rails app. function! ale#ruby#FindRailsRoot(buffer) abort for l:name in ['app', 'config', 'db'] @@ -74,3 +74,10 @@ function! ale#ruby#HandleRubocopOutput(buffer, lines) abort return l:output endfunction +function! ale#ruby#EscapeExecutable(executable, bundle_exec) abort + let l:exec_args = a:executable =~? 'bundle' + \ ? ' exec ' . a:bundle_exec + \ : '' + + return ale#Escape(a:executable) . l:exec_args +endfunction diff --git a/sources_non_forked/ale/autoload/ale/semver.vim b/sources_non_forked/ale/autoload/ale/semver.vim index 5f1b46fc..e3eb49c0 100644 --- a/sources_non_forked/ale/autoload/ale/semver.vim +++ b/sources_non_forked/ale/autoload/ale/semver.vim @@ -5,31 +5,52 @@ function! ale#semver#ResetVersionCache() abort let s:version_cache = {} endfunction +function! ale#semver#ParseVersion(version_lines) abort + for l:line in a:version_lines + let l:match = matchlist(l:line, '\v(\d+)\.(\d+)(\.(\d+))?') + + if !empty(l:match) + return [l:match[1] + 0, l:match[2] + 0, l:match[4] + 0] + endif + endfor + + return [] +endfunction + " Given an executable name and some lines of output, which can be empty, " parse the version from the lines of output, or return the cached version " triple [major, minor, patch] " " If the version cannot be found, an empty List will be returned instead. -function! ale#semver#GetVersion(executable, version_lines) abort +function! s:GetVersion(executable, version_lines) abort let l:version = get(s:version_cache, a:executable, []) + let l:parsed_version = ale#semver#ParseVersion(a:version_lines) - for l:line in a:version_lines - let l:match = matchlist(l:line, '\v(\d+)\.(\d+)(\.(\d+))?') - - if !empty(l:match) - let l:version = [l:match[1] + 0, l:match[2] + 0, l:match[4] + 0] - let s:version_cache[a:executable] = l:version - - break - endif - endfor + if !empty(l:parsed_version) + let l:version = l:parsed_version + let s:version_cache[a:executable] = l:version + endif return l:version endfunction -" Return 1 if the semver version has been cached for a given executable. -function! ale#semver#HasVersion(executable) abort - return has_key(s:version_cache, a:executable) +function! ale#semver#RunWithVersionCheck(buffer, executable, command, Callback) abort + if empty(a:executable) + return '' + endif + + let l:cache = s:version_cache + + if has_key(s:version_cache, a:executable) + return a:Callback(a:buffer, s:version_cache[a:executable]) + endif + + return ale#command#Run( + \ a:buffer, + \ a:command, + \ {_, output -> a:Callback(a:buffer, s:GetVersion(a:executable, output))}, + \ {'output_stream': 'both', 'executable': a:executable} + \) endfunction " Given two triples of integers [major, minor, patch], compare the triples diff --git a/sources_non_forked/ale/autoload/ale/sign.vim b/sources_non_forked/ale/autoload/ale/sign.vim index 933fc055..21e06313 100644 --- a/sources_non_forked/ale/autoload/ale/sign.vim +++ b/sources_non_forked/ale/autoload/ale/sign.vim @@ -14,12 +14,16 @@ let g:ale_sign_style_error = get(g:, 'ale_sign_style_error', g:ale_sign_error) let g:ale_sign_warning = get(g:, 'ale_sign_warning', '--') let g:ale_sign_style_warning = get(g:, 'ale_sign_style_warning', g:ale_sign_warning) let g:ale_sign_info = get(g:, 'ale_sign_info', g:ale_sign_warning) +let g:ale_sign_priority = get(g:, 'ale_sign_priority', 30) " This variable sets an offset which can be set for sign IDs. " This ID can be changed depending on what IDs are set for other plugins. " The dummy sign will use the ID exactly equal to the offset. let g:ale_sign_offset = get(g:, 'ale_sign_offset', 1000000) " This flag can be set to 1 to keep sign gutter always open let g:ale_sign_column_always = get(g:, 'ale_sign_column_always', 0) +let g:ale_sign_highlight_linenrs = get(g:, 'ale_sign_highlight_linenrs', 0) + +let s:supports_sign_groups = has('nvim-0.4.2') || has('patch-8.1.614') if !hlexists('ALEErrorSign') highlight link ALEErrorSign error @@ -46,9 +50,10 @@ if !hlexists('ALESignColumnWithErrors') endif function! ale#sign#SetUpDefaultColumnWithoutErrorsHighlight() abort - redir => l:output - 0verbose silent highlight SignColumn - redir end + let l:verbose = &verbose + set verbose=0 + let l:output = execute('highlight SignColumn', 'silent') + let &verbose = l:verbose let l:highlight_syntax = join(split(l:output)[2:]) let l:match = matchlist(l:highlight_syntax, '\vlinks to (.+)$') @@ -66,7 +71,7 @@ endif " Spaces and backslashes need to be escaped for signs. function! s:EscapeSignText(sign_text) abort - return substitute(a:sign_text, '\\\| ', '\\\0', 'g') + return substitute(substitute(a:sign_text, ' *$', '', ''), '\\\| ', '\\\0', 'g') endfunction " Signs show up on the left for error markers. @@ -80,7 +85,35 @@ execute 'sign define ALEStyleWarningSign text=' . s:EscapeSignText(g:ale_sign_st \ . ' texthl=ALEStyleWarningSign linehl=ALEWarningLine' execute 'sign define ALEInfoSign text=' . s:EscapeSignText(g:ale_sign_info) \ . ' texthl=ALEInfoSign linehl=ALEInfoLine' -sign define ALEDummySign +sign define ALEDummySign text=\ texthl=SignColumn + +if g:ale_sign_highlight_linenrs && has('nvim-0.3.2') + if !hlexists('ALEErrorSignLineNr') + highlight link ALEErrorSignLineNr CursorLineNr + endif + + if !hlexists('ALEStyleErrorSignLineNr') + highlight link ALEStyleErrorSignLineNr CursorLineNr + endif + + if !hlexists('ALEWarningSignLineNr') + highlight link ALEWarningSignLineNr CursorLineNr + endif + + if !hlexists('ALEStyleWarningSignLineNr') + highlight link ALEStyleWarningSignLineNr CursorLineNr + endif + + if !hlexists('ALEInfoSignLineNr') + highlight link ALEInfoSignLineNr CursorLineNr + endif + + sign define ALEErrorSign numhl=ALEErrorSignLineNr + sign define ALEStyleErrorSign numhl=ALEStyleErrorSignLineNr + sign define ALEWarningSign numhl=ALEWarningSignLineNr + sign define ALEStyleWarningSign numhl=ALEStyleWarningSignLineNr + sign define ALEInfoSign numhl=ALEInfoSignLineNr +endif function! ale#sign#GetSignName(sublist) abort let l:priority = g:ale#util#style_warning_priority @@ -118,24 +151,80 @@ function! ale#sign#GetSignName(sublist) abort return 'ALEErrorSign' endfunction +function! s:PriorityCmd() abort + if s:supports_sign_groups + return ' priority=' . g:ale_sign_priority . ' ' + else + return '' + endif +endfunction + +function! s:GroupCmd() abort + if s:supports_sign_groups + return ' group=ale ' + else + return ' ' + endif +endfunction + " Read sign data for a buffer to a list of lines. function! ale#sign#ReadSigns(buffer) abort - redir => l:output - silent execute 'sign place buffer=' . a:buffer - redir end + let l:output = execute( + \ 'sign place ' . s:GroupCmd() . s:PriorityCmd() + \ . ' buffer=' . a:buffer + \ ) return split(l:output, "\n") endfunction +function! ale#sign#ParsePattern() abort + if s:supports_sign_groups + " Matches output like : + " line=4 id=1 group=ale name=ALEErrorSign + " ัั‚ั€ะพะบะฐ=1 id=1000001 ะณั€ัƒะฟะฟะฐ=ale ะธะผั=ALEErrorSign + " ่กŒ=1 ่ญ˜ๅˆฅๅญ=1000001 ใ‚ฐใƒซใƒผใƒ—=ale ๅๅ‰=ALEWarningSign + " lรญnea=12 id=1000001 grupo=ale nombre=ALEWarningSign + " riga=1 id=1000001 gruppo=ale nome=ALEWarningSign + " Zeile=235 id=1000001 Gruppe=ale Name=ALEErrorSign + let l:pattern = '\v^.*\=(\d+).*\=(\d+).*\=ale>.*\=(ALE[a-zA-Z]+Sign)' + else + " Matches output like : + " line=4 id=1 name=ALEErrorSign + " ัั‚ั€ะพะบะฐ=1 id=1000001 ะธะผั=ALEErrorSign + " ่กŒ=1 ่ญ˜ๅˆฅๅญ=1000001 ๅๅ‰=ALEWarningSign + " lรญnea=12 id=1000001 nombre=ALEWarningSign + " riga=1 id=1000001 nome=ALEWarningSign + " Zeile=235 id=1000001 Name=ALEErrorSign + let l:pattern = '\v^.*\=(\d+).*\=(\d+).*\=(ALE[a-zA-Z]+Sign)' + endif + + return l:pattern +endfunction + +" Given a buffer number, return a List of placed signs [line, id, group] +function! ale#sign#ParseSignsWithGetPlaced(buffer) abort + let l:signs = sign_getplaced(a:buffer, { 'group': s:supports_sign_groups ? 'ale' : '' })[0].signs + let l:result = [] + let l:is_dummy_sign_set = 0 + + for l:sign in l:signs + if l:sign['name'] is# 'ALEDummySign' + let l:is_dummy_sign_set = 1 + else + call add(l:result, [ + \ str2nr(l:sign['lnum']), + \ str2nr(l:sign['id']), + \ l:sign['name'], + \]) + endif + endfor + + return [l:is_dummy_sign_set, l:result] +endfunction + " Given a list of lines for sign output, return a List of [line, id, group] function! ale#sign#ParseSigns(line_list) abort - " Matches output like : - " line=4 id=1 name=ALEErrorSign - " ัั‚ั€ะพะบะฐ=1 id=1000001 ะธะผั=ALEErrorSign - " ่กŒ=1 ่ญ˜ๅˆฅๅญ=1000001 ๅๅ‰=ALEWarningSign - " lรญnea=12 id=1000001 nombre=ALEWarningSign - " riga=1 id=1000001, nome=ALEWarningSign - let l:pattern = '\v^.*\=(\d+).*\=(\d+).*\=(ALE[a-zA-Z]+Sign)' + let l:pattern =ale#sign#ParsePattern() let l:result = [] let l:is_dummy_sign_set = 0 @@ -159,9 +248,13 @@ function! ale#sign#ParseSigns(line_list) abort endfunction function! ale#sign#FindCurrentSigns(buffer) abort - let l:line_list = ale#sign#ReadSigns(a:buffer) + if exists('*sign_getplaced') + return ale#sign#ParseSignsWithGetPlaced(a:buffer) + else + let l:line_list = ale#sign#ReadSigns(a:buffer) - return ale#sign#ParseSigns(l:line_list) + return ale#sign#ParseSigns(l:line_list) + endif endfunction " Given a loclist, group the List into with one List per line. @@ -290,8 +383,10 @@ function! ale#sign#GetSignCommands(buffer, was_sign_set, sign_map) abort if !l:is_dummy_sign_set && (!empty(a:sign_map) || g:ale_sign_column_always) call add(l:command_list, 'sign place ' \ . g:ale_sign_offset - \ . ' line=1 name=ALEDummySign buffer=' - \ . a:buffer + \ . s:GroupCmd() + \ . s:PriorityCmd() + \ . ' line=1 name=ALEDummySign ' + \ . ' buffer=' . a:buffer \) let l:is_dummy_sign_set = 1 endif @@ -308,6 +403,8 @@ function! ale#sign#GetSignCommands(buffer, was_sign_set, sign_map) abort if index(l:info.current_id_list, l:info.new_id) < 0 call add(l:command_list, 'sign place ' \ . (l:info.new_id) + \ . s:GroupCmd() + \ . s:PriorityCmd() \ . ' line=' . l:line_str \ . ' name=' . (l:info.new_name) \ . ' buffer=' . a:buffer @@ -322,6 +419,7 @@ function! ale#sign#GetSignCommands(buffer, was_sign_set, sign_map) abort if l:current_id isnot l:info.new_id call add(l:command_list, 'sign unplace ' \ . l:current_id + \ . s:GroupCmd() \ . ' buffer=' . a:buffer \) endif @@ -332,6 +430,7 @@ function! ale#sign#GetSignCommands(buffer, was_sign_set, sign_map) abort if l:is_dummy_sign_set && !g:ale_sign_column_always call add(l:command_list, 'sign unplace ' \ . g:ale_sign_offset + \ . s:GroupCmd() \ . ' buffer=' . a:buffer \) endif @@ -386,3 +485,12 @@ function! ale#sign#SetSigns(buffer, loclist) abort highlight link SignColumn ALESignColumnWithoutErrors endif endfunction + +" Remove all signs. +function! ale#sign#Clear() abort + if s:supports_sign_groups + sign unplace group=ale * + else + sign unplace * + endif +endfunction diff --git a/sources_non_forked/ale/autoload/ale/socket.vim b/sources_non_forked/ale/autoload/ale/socket.vim index 7e069fb5..61f11e70 100644 --- a/sources_non_forked/ale/autoload/ale/socket.vim +++ b/sources_non_forked/ale/autoload/ale/socket.vim @@ -72,9 +72,8 @@ function! ale#socket#Open(address, options) abort elseif exists('*chansend') && exists('*sockconnect') " NeoVim 0.3+ try - let l:channel_id = sockconnect('tcp', a:address, { - \ 'on_data': function('s:NeoVimOutputCallback'), - \}) + let l:channel_id = sockconnect(stridx(a:address, ':') != -1 ? 'tcp' : 'pipe', + \ a:address, {'on_data': function('s:NeoVimOutputCallback')}) let l:channel_info.last_line = '' catch /connection failed/ let l:channel_id = -1 diff --git a/sources_non_forked/ale/autoload/ale/swift.vim b/sources_non_forked/ale/autoload/ale/swift.vim new file mode 100644 index 00000000..3232d42a --- /dev/null +++ b/sources_non_forked/ale/autoload/ale/swift.vim @@ -0,0 +1,70 @@ +" Author: Dan Loman +" Description: Functions for integrating with Swift tools + +" Find the nearest dir containing a Package.swift file and assume it is the root of the Swift project. +function! ale#swift#FindProjectRoot(buffer) abort + let l:swift_config = ale#path#FindNearestFile(a:buffer, 'Package.swift') + + if !empty(l:swift_config) + return fnamemodify(l:swift_config, ':h') + endif + + return '' +endfunction + +" Support Apple Swift Format {{{1 + +call ale#Set('swift_appleswiftformat_executable', 'swift-format') +call ale#Set('swift_appleswiftformat_use_swiftpm', 0) + +" Return the executable depending on whether or not to use Swift Package Manager. +" +" If not asked to use Swift Package Manager (use_swiftpm = 0), the returned +" value is the global executable, else the returned value is 'swift' because +" the final command line will be `swift run swift-format ...`. +" +" Failure is expected if use_swiftpm is `1` but no Package.swift can be located. +function! ale#swift#GetAppleSwiftFormatExecutable(buffer) abort + if !ale#Var(a:buffer, 'swift_appleswiftformat_use_swiftpm') + return ale#Var(a:buffer, 'swift_appleswiftformat_executable') + endif + + if ale#path#FindNearestFile(a:buffer, 'Package.swift') is# '' + " If there is no Package.swift file, we don't use swift-format even if it exists, + " so we return '' to indicate failure. + return '' + endif + + return 'swift' +endfunction + +" Return the command depending on whether or not to use Swift Package Manager. +" +" If asked to use Swift Package Manager (use_swiftpm = 1), the command +" arguments are prefixed with 'swift run'. +" +" In either case, the configuration file is located and added to the command. +function! ale#swift#GetAppleSwiftFormatCommand(buffer) abort + let l:executable = ale#swift#GetAppleSwiftFormatExecutable(a:buffer) + let l:command_args = '' + + if ale#Var(a:buffer, 'swift_appleswiftformat_use_swiftpm') + let l:command_args = ' ' . 'run swift-format' + endif + + return ale#Escape(l:executable) . l:command_args +endfunction + +" Locate the nearest '.swift-format' configuration file, and return the +" arguments, else return an empty string. +function! ale#swift#GetAppleSwiftFormatConfigArgs(buffer) abort + let l:config_filepath = ale#path#FindNearestFile(a:buffer, '.swift-format') + + if l:config_filepath isnot# '' + return '--configuration' . ' ' . l:config_filepath + endif + + return '' +endfunction + +" }}} diff --git a/sources_non_forked/ale/autoload/ale/test.vim b/sources_non_forked/ale/autoload/ale/test.vim index 082d91ff..4d75d515 100644 --- a/sources_non_forked/ale/autoload/ale/test.vim +++ b/sources_non_forked/ale/autoload/ale/test.vim @@ -34,12 +34,11 @@ function! ale#test#RestoreDirectory() abort unlet! g:dir endfunction -" Change the filename for the current buffer using a relative path to -" the script without running autocmd commands. +" Get a filename for the current buffer using a relative path to the script. " " If a g:dir variable is set, it will be used as the path to the directory " containing the test file. -function! ale#test#SetFilename(path) abort +function! ale#test#GetFilename(path) abort let l:dir = get(g:, 'dir', '') if empty(l:dir) @@ -50,7 +49,17 @@ function! ale#test#SetFilename(path) abort \ ? a:path \ : l:dir . '/' . a:path - silent! noautocmd execute 'file ' . fnameescape(ale#path#Simplify(l:full_path)) + return ale#path#Simplify(l:full_path) +endfunction + +" Change the filename for the current buffer using a relative path to +" the script without running autocmd commands. +" +" If a g:dir variable is set, it will be used as the path to the directory +" containing the test file. +function! ale#test#SetFilename(path) abort + let l:full_path = ale#test#GetFilename(a:path) + silent! noautocmd execute 'file ' . fnameescape(l:full_path) endfunction function! s:RemoveModule(results) abort @@ -145,8 +154,8 @@ function! ale#test#WaitForJobs(deadline) abort " end, but before handlers are run. sleep 10ms - " We must check the buffer data again to see if new jobs started - " for command_chain linters. + " We must check the buffer data again to see if new jobs started for + " linters with chained commands. let l:has_new_jobs = 0 " Check again to see if any jobs are running. diff --git a/sources_non_forked/ale/autoload/ale/uri.vim b/sources_non_forked/ale/autoload/ale/uri.vim index 934637d9..e71c6340 100644 --- a/sources_non_forked/ale/autoload/ale/uri.vim +++ b/sources_non_forked/ale/autoload/ale/uri.vim @@ -1,9 +1,18 @@ -" This probably doesn't handle Unicode characters well. +function! s:EncodeChar(char) abort + let l:result = '' + + for l:index in range(strlen(a:char)) + let l:result .= printf('%%%02x', char2nr(a:char[l:index])) + endfor + + return l:result +endfunction + function! ale#uri#Encode(value) abort return substitute( \ a:value, \ '\([^a-zA-Z0-9\\/$\-_.!*''(),]\)', - \ '\=printf(''%%%02x'', char2nr(submatch(1)))', + \ '\=s:EncodeChar(submatch(1))', \ 'g' \) endfunction @@ -12,7 +21,7 @@ function! ale#uri#Decode(value) abort return substitute( \ a:value, \ '%\(\x\x\)', - \ '\=nr2char(''0x'' . submatch(1))', + \ '\=printf("%c", str2nr(submatch(1), 16))', \ 'g' \) endfunction diff --git a/sources_non_forked/ale/autoload/ale/util.vim b/sources_non_forked/ale/autoload/ale/util.vim index e57307e4..ec9383ac 100644 --- a/sources_non_forked/ale/autoload/ale/util.vim +++ b/sources_non_forked/ale/autoload/ale/util.vim @@ -16,7 +16,9 @@ endfunction " Vim 8 does not support echoing long messages from asynchronous callbacks, " but NeoVim does. Small messages can be echoed in Vim 8, and larger messages " have to be shown in preview windows. -function! ale#util#ShowMessage(string) abort +function! ale#util#ShowMessage(string, ...) abort + let l:options = get(a:000, 0, {}) + if !has('nvim') call ale#preview#CloseIfTypeMatches('ale-preview.message') endif @@ -25,10 +27,13 @@ function! ale#util#ShowMessage(string) abort if has('nvim') || (a:string !~? "\n" && len(a:string) < &columns) execute 'echo a:string' else - call ale#preview#Show(split(a:string, "\n"), { - \ 'filetype': 'ale-preview.message', - \ 'stay_here': 1, - \}) + call ale#preview#Show(split(a:string, "\n"), extend( + \ { + \ 'filetype': 'ale-preview.message', + \ 'stay_here': 1, + \ }, + \ l:options, + \)) endif endfunction @@ -91,17 +96,17 @@ endfunction " options['open_in'] can be: " current-buffer (default) " tab -" vertical-split -" horizontal-split +" split +" vsplit function! ale#util#Open(filename, line, column, options) abort let l:open_in = get(a:options, 'open_in', 'current-buffer') let l:args_to_open = '+' . a:line . ' ' . fnameescape(a:filename) if l:open_in is# 'tab' call ale#util#Execute('tabedit ' . l:args_to_open) - elseif l:open_in is# 'horizontal-split' + elseif l:open_in is# 'split' call ale#util#Execute('split ' . l:args_to_open) - elseif l:open_in is# 'vertical-split' + elseif l:open_in is# 'vsplit' call ale#util#Execute('vsplit ' . l:args_to_open) elseif bufnr(a:filename) isnot bufnr('') " Open another file only if we need to. @@ -335,16 +340,22 @@ function! ale#util#GetMatches(lines, patterns) abort return l:matches endfunction +" Given a single line, or a List of lines, and a single pattern, or a List of +" patterns, and a callback function for mapping the items matches, return the +" result of mapping all of the matches for the lines from the given patterns, +" using matchlist() +" +" Only the first pattern which matches a line will be returned. +function! ale#util#MapMatches(lines, patterns, Callback) abort + return map(ale#util#GetMatches(a:lines, a:patterns), 'a:Callback(v:val)') +endfunction + function! s:LoadArgCount(function) abort - let l:Function = a:function - - redir => l:output - silent! function Function - redir END - - if !exists('l:output') + try + let l:output = execute('function a:function') + catch /E123/ return 0 - endif + endtry let l:match = matchstr(split(l:output, "\n")[0], '\v\([^)]+\)')[1:-2] let l:arg_list = filter(split(l:match, ', '), 'v:val isnot# ''...''') @@ -408,7 +419,7 @@ function! ale#util#FuzzyJSONDecode(data, default) abort endif return l:result - catch /E474/ + catch /E474\|E491/ return a:default endtry endfunction @@ -422,7 +433,10 @@ function! ale#util#Writefile(buffer, lines, filename) abort \ ? map(copy(a:lines), 'substitute(v:val, ''\r*$'', ''\r'', '''')') \ : a:lines - call writefile(l:corrected_lines, a:filename) " no-custom-checks + " Set binary flag if buffer doesn't have eol and nofixeol to avoid appending newline + let l:flags = !getbufvar(a:buffer, '&eol') && exists('+fixeol') && !&fixeol ? 'bS' : 'S' + + call writefile(l:corrected_lines, a:filename, l:flags) " no-custom-checks endfunction if !exists('s:patial_timers') @@ -477,3 +491,51 @@ function! ale#util#FindItemAtCursor(buffer) abort return [l:info, l:loc] endfunction +function! ale#util#Input(message, value) abort + return input(a:message, a:value) +endfunction + +function! ale#util#HasBuflineApi() abort + return exists('*deletebufline') && exists('*setbufline') +endfunction + +" Sets buffer contents to lines +function! ale#util#SetBufferContents(buffer, lines) abort + let l:has_bufline_api = ale#util#HasBuflineApi() + + if !l:has_bufline_api && a:buffer isnot bufnr('') + return + endif + + " If the file is in DOS mode, we have to remove carriage returns from + " the ends of lines before calling setline(), or we will see them + " twice. + let l:new_lines = getbufvar(a:buffer, '&fileformat') is# 'dos' + \ ? map(copy(a:lines), 'substitute(v:val, ''\r\+$'', '''', '''')') + \ : a:lines + let l:first_line_to_remove = len(l:new_lines) + 1 + + " Use a Vim API for setting lines in other buffers, if available. + if l:has_bufline_api + call setbufline(a:buffer, 1, l:new_lines) + call deletebufline(a:buffer, l:first_line_to_remove, '$') + " Fall back on setting lines the old way, for the current buffer. + else + let l:old_line_length = line('$') + + if l:old_line_length >= l:first_line_to_remove + let l:save = winsaveview() + silent execute + \ l:first_line_to_remove . ',' . l:old_line_length . 'd_' + call winrestview(l:save) + endif + + call setline(1, l:new_lines) + endif + + return l:new_lines +endfunction + +function! ale#util#GetBufferContents(buffer) abort + return join(getbufline(a:buffer, 1, '$'), '\n') . '\n' +endfunction diff --git a/sources_non_forked/ale/autoload/ale/virtualtext.vim b/sources_non_forked/ale/autoload/ale/virtualtext.vim index 532427fb..598bc1bf 100644 --- a/sources_non_forked/ale/autoload/ale/virtualtext.vim +++ b/sources_non_forked/ale/autoload/ale/virtualtext.vim @@ -7,9 +7,15 @@ scriptencoding utf-8 let g:ale_virtualtext_delay = get(g:, 'ale_virtualtext_delay', 10) let s:cursor_timer = -1 let s:last_pos = [0, 0, 0] +let s:has_virt_text = 0 if has('nvim-0.3.2') let s:ns_id = nvim_create_namespace('ale') + let s:has_virt_text = 1 +elseif has('textprop') && has('popupwin') + call prop_type_add('ale', {}) + let s:last_popup = -1 + let s:has_virt_text = 1 endif if !hlexists('ALEVirtualTextError') @@ -33,25 +39,51 @@ if !hlexists('ALEVirtualTextInfo') endif function! ale#virtualtext#Clear() abort - if !has('nvim-0.3.2') + if !s:has_virt_text return endif let l:buffer = bufnr('') - call nvim_buf_clear_highlight(l:buffer, s:ns_id, 0, -1) + if has('nvim') + call nvim_buf_clear_highlight(l:buffer, s:ns_id, 0, -1) + else + if s:last_popup != -1 + call prop_remove({'type': 'ale'}) + call popup_close(s:last_popup) + let s:last_popup = -1 + endif + endif endfunction function! ale#virtualtext#ShowMessage(message, hl_group) abort - if !has('nvim-0.3.2') + if !s:has_virt_text return endif let l:line = line('.') let l:buffer = bufnr('') let l:prefix = get(g:, 'ale_virtualtext_prefix', '> ') + let l:msg = l:prefix.trim(substitute(a:message, '\n', ' ', 'g')) - call nvim_buf_set_virtual_text(l:buffer, s:ns_id, l:line-1, [[l:prefix.a:message, a:hl_group]], {}) + if has('nvim') + call nvim_buf_set_virtual_text(l:buffer, s:ns_id, l:line-1, [[l:msg, a:hl_group]], {}) + else + let l:left_pad = col('$') + call prop_add(l:line, l:left_pad, { + \ 'type': 'ale', + \}) + let s:last_popup = popup_create(l: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 + \}) + endif endfunction function! s:StopCursorTimer() abort @@ -81,7 +113,7 @@ function! ale#virtualtext#ShowCursorWarning(...) abort call ale#virtualtext#Clear() if !empty(l:loc) - let l:msg = get(l:loc, 'detail', l:loc.text) + let l:msg = l:loc.text let l:hl_group = 'ALEVirtualTextInfo' let l:type = get(l:loc, 'type', 'E') diff --git a/sources_non_forked/ale/autoload/asyncomplete/sources/ale.vim b/sources_non_forked/ale/autoload/asyncomplete/sources/ale.vim new file mode 100644 index 00000000..ce793773 --- /dev/null +++ b/sources_non_forked/ale/autoload/asyncomplete/sources/ale.vim @@ -0,0 +1,26 @@ +function! asyncomplete#sources#ale#get_source_options(...) abort + let l:default = extend({ + \ 'name': 'ale', + \ 'completor': function('asyncomplete#sources#ale#completor'), + \ 'whitelist': ['*'], + \ 'triggers': asyncomplete#sources#ale#get_triggers(), + \ }, a:0 >= 1 ? a:1 : {}) + + return extend(l:default, {'refresh_pattern': '\k\+$'}) +endfunction + +function! asyncomplete#sources#ale#get_triggers() abort + let l:triggers = ale#completion#GetAllTriggers() + let l:triggers['*'] = l:triggers[''] + + return l:triggers +endfunction + +function! asyncomplete#sources#ale#completor(options, context) abort + let l:keyword = matchstr(a:context.typed, '\w\+$') + let l:startcol = a:context.col - len(l:keyword) + + call ale#completion#GetCompletions('ale-callback', { 'callback': {completions -> + \ asyncomplete#complete(a:options.name, a:context, l:startcol, completions) + \ }}) +endfunction diff --git a/sources_non_forked/ale/doc/ale-ada.txt b/sources_non_forked/ale/doc/ale-ada.txt index 93e3261a..0fc55a9c 100644 --- a/sources_non_forked/ale/doc/ale-ada.txt +++ b/sources_non_forked/ale/doc/ale-ada.txt @@ -21,5 +21,46 @@ g:ale_ada_gcc_options *g:ale_ada_gcc_options* This variable can be set to pass additional options to gcc. +=============================================================================== +gnatpp *ale-ada-gnatpp* + +g:ale_ada_gnatpp_options *g:ale_ada_gnatpp_options* + *b:ale_ada_gnatpp_options* + Type: |String| + Default: `''` + + This variable can be set to pass extra options to the gnatpp fixer. + + +=============================================================================== +ada-language-server *ale-ada-language-server* + +g:ale_ada_adals_executable *g:ale_ada_adals_executable* + *b:ale_ada_adals_executable* + Type: |String| + Default: `'ada_language_server'` + + This variable can be changed to use a different executable for Ada Language + Server. + + +g:ale_ada_adals_project *g:ale_ada_adals_project* + *b:ale_ada_adals_project* + Type: |String| + Default: `'default.gpr'` + +This variable can be changed to use a different GPR file for +Ada Language Server. + + +g:ale_ada_adals_encoding *g:ale_ada_adals_encoding* + *b:ale_ada_adals_encoding* + Type: |String| + Default: `'utf-8'` + +This variable can be changed to use a different file encoding for +Ada Language Server. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-apkbuild.txt b/sources_non_forked/ale/doc/ale-apkbuild.txt new file mode 100644 index 00000000..05261400 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-apkbuild.txt @@ -0,0 +1,30 @@ +=============================================================================== +ALE APKBUILD Integration *ale-apkbuild-options* + + +=============================================================================== +apkbuild-lint *ale-apkbuild-apkbuild-lint* + +g:ale_apkbuild_apkbuild_lint_executable + *g:ale_apkbuild_apkbuild_lint_executable* + *b:ale_apkbuild_apkbuild_lint_executable* + + Type: |String| + Default: `'apkbuild-lint'` + + This variable can be set to change the path to apkbuild-lint + +=============================================================================== +secfixes-check *ale-apkbuild-secfixes-check* + +g:ale_apkbuild_secfixes_check_executable + *g:ale_apkbuild_secfixes_check_executable* + *b:ale_apkbuild_secfixes_check_executable* + + Type: |String| + Default: `'secfixes-check'` + + This variable can be set to change the path to secfixes-check + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-bats.txt b/sources_non_forked/ale/doc/ale-bats.txt new file mode 100644 index 00000000..cf2199ec --- /dev/null +++ b/sources_non_forked/ale/doc/ale-bats.txt @@ -0,0 +1,13 @@ +=============================================================================== +ALE Bats Integration *ale-bats-options* + + +=============================================================================== +shellcheck *ale-bats-shellcheck* + +The `shellcheck` linter for Bats uses the sh options for `shellcheck`; see: +|ale-sh-shellcheck|. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-bazel.txt b/sources_non_forked/ale/doc/ale-bazel.txt new file mode 100644 index 00000000..e2922aaf --- /dev/null +++ b/sources_non_forked/ale/doc/ale-bazel.txt @@ -0,0 +1,28 @@ +=============================================================================== +ALE Bazel Integration *ale-bazel-options* + +=============================================================================== +buildifier *ale-bazel-buildifier* + +g:ale_bazel_buildifier_executable *g:ale_bazel_buildifier_executable* + *b:ale_bazel_buildifier_executable* + Type: |String| + Default: `'buildifier'` + + See |ale-integrations-local-executables| + + +g:ale_bazel_buildifier_options *g:ale_bazel_buildifier_options* + *b:ale_bazel_buildifier_options* + Type: |String| + Default: `''` + + This variable can be set to pass extra options to buildifier. + + +g:ale_bazel_buildifier_use_global *g:ale_bazel_buildifier_use_global* + *b:ale_bazel_buildifier_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| diff --git a/sources_non_forked/ale/doc/ale-c.txt b/sources_non_forked/ale/doc/ale-c.txt index be0a3d77..3b9fbc44 100644 --- a/sources_non_forked/ale/doc/ale-c.txt +++ b/sources_non_forked/ale/doc/ale-c.txt @@ -1,22 +1,36 @@ =============================================================================== ALE C Integration *ale-c-options* +For basic checking of problems with C files, ALE offers the `cc` linter, which +runs either `clang`, or `gcc`. See |ale-c-cc|. + =============================================================================== Global Options +g:ale_c_always_make *g:ale_c_always_make* + *b:ale_c_always_make* + Type: |Number| + Default: `has('unix') && !has('macunix')` + + If set to `1`, use `--always-make` for `make`, which means that output will + always be parsed from `make` dry runs with GNU make. BSD `make` does not + support this option, so you probably want to turn this option off when using + a BSD variant. + + g:ale_c_build_dir_names *g:ale_c_build_dir_names* *b:ale_c_build_dir_names* Type: |List| Default: `['build', 'bin']` - A list of directory names to be used when searching upwards from cpp - files to discover compilation databases with. For directory named `'foo'`, - ALE will search for `'foo/compile_commands.json'` in all directories on and above - the directory containing the cpp file to find path to compilation database. - This feature is useful for the clang tools wrapped around LibTooling (namely - here, clang-tidy) + A list of directory names to be used when searching upwards from cpp files + to discover compilation databases with. For directory named `'foo'`, ALE + will search for `'foo/compile_commands.json'` in all directories on and + above the directory containing the cpp file to find path to compilation + database. This feature is useful for the clang tools wrapped around + LibTooling (namely here, clang-tidy) g:ale_c_build_dir *g:ale_c_build_dir* @@ -37,7 +51,7 @@ g:ale_c_build_dir *g:ale_c_build_dir* g:ale_c_parse_compile_commands *g:ale_c_parse_compile_commands* *b:ale_c_parse_compile_commands* Type: |Number| - Default: `0` + Default: `1` If set to `1`, ALE will parse `compile_commands.json` files to automatically determine flags for C or C++ compilers. ALE will first search for the @@ -45,9 +59,6 @@ g:ale_c_parse_compile_commands *g:ale_c_parse_compile_commands* `compile_commands.json` files in the directories for |g:ale_c_build_dir_names|. - If |g:ale_c_parse_makefile| or |b:ale_c_parse_makefile| is set to `1`, the - output of `make -n` will be preferred over `compile_commands.json` files. - g:ale_c_parse_makefile *g:ale_c_parse_makefile* *b:ale_c_parse_makefile* @@ -58,24 +69,102 @@ g:ale_c_parse_makefile *g:ale_c_parse_makefile* set for C or C++ compilers. This can make it easier to determine the correct build flags to use for different files. + NOTE: When using this option on BSD, you may need to set + |g:ale_c_always_make| to `0`, and `make -n` will not provide consistent + results if binaries have already been built, so use `make clean` when + editing your files. + + WARNING: Running `make -n` automatically can execute arbitrary code, even + though it's supposed to be a dry run, so enable this option with care. You + might prefer to use the buffer-local version of the option instead with + |g:ale_pattern_options|, or you own code for checking which project you're + in. + + You might want to disable this option if `make -n` takes too long to run for + projects you work on. + + If |g:ale_c_parse_compile_commands| or |b:ale_c_parse_compile_commands| is + set to `1`, flags taken from `compile_commands.json` will be preferred over + `make -n` output. + =============================================================================== -clang *ale-c-clang* +astyle *ale-c-astyle* -g:ale_c_clang_executable *g:ale_c_clang_executable* - *b:ale_c_clang_executable* +g:ale_c_astyle_executable *g:ale_c_astyle_executable* + *b:ale_c_astyle_executable* Type: |String| - Default: `'clang'` + Default: `'astyle'` - This variable can be changed to use a different executable for clang. + This variable can be changed to use a different executable for astyle. -g:ale_c_clang_options *g:ale_c_clang_options* - *b:ale_c_clang_options* +g:ale_c_astyle_project_options *g:ale_c_astyle_project_options* + *b:ale_c_astyle_project_options* + Type: |String| + Default: `''` + + This variable can be changed to use an option file for project level + configurations. Provide only the filename of the option file that should be + present at the project's root directory. + + For example, if .astylrc is specified, the file is searched in the parent + directories of the source file's directory. + + +=============================================================================== +cc *ale-c-cc* + *ale-c-gcc* + *ale-c-clang* + +g:ale_c_cc_executable *g:ale_c_cc_executable* + *b:ale_c_cc_executable* + Type: |String| + Default: `''` + + This variable can be changed to use a different executable for a C compiler. + + ALE will try to use `clang` if Clang is available, otherwise ALE will + default to checking C code with `gcc`. + + +g:ale_c_cc_options *g:ale_c_cc_options* + *b:ale_c_cc_options* Type: |String| Default: `'-std=c11 -Wall'` - This variable can be changed to modify flags given to clang. + This variable can be change to modify flags given to the C compiler. + + +=============================================================================== +ccls *ale-c-ccls* + +g:ale_c_ccls_executable *g:ale_c_ccls_executable* + *b:ale_c_ccls_executable* + Type: |String| + Default: `'ccls'` + + This variable can be changed to use a different executable for ccls. + + +g:ale_c_ccls_init_options *g:ale_c_ccls_init_options* + *b:ale_c_ccls_init_options* + Type: |Dictionary| + Default: `{}` + + This variable can be changed to customize ccls initialization options. + Example: > + { + \ 'cacheDirectory': '/tmp/ccls', + \ 'cacheFormat': 'binary', + \ 'diagnostics': { + \ 'onOpen': 0, + \ 'opChange': 1000, + \ }, + \ } +< + Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all + available options and explanations. =============================================================================== @@ -113,7 +202,45 @@ g:ale_c_clangformat_options *g:ale_c_clangformat_options* Type: |String| Default: `''` - This variable can be change to modify flags given to clang-format. + This variable can be changed to modify flags given to clang-format. + + +g:ale_c_clangformat_style_option *g:ale_c_clangformat_style_option* + *b:ale_c_clangformat_style_option* + Type: |String| + Default: `''` + + This variable can be changed to modify only the style flag given to + clang-format. The contents of the variable are passed directly to the -style + flag of clang-format. + + Example: > + { + \ BasedOnStyle: Microsoft, + \ ColumnLimit: 80, + \ AllowShortBlocksOnASingleLine: Always, + \ AllowShortFunctionsOnASingleLine: Inline, + \ } +< + If you set this variable, ensure you don't modify -style in + |g:ale_c_clangformat_options|, as this will cause clang-format to error. + + +g:ale_c_clangformat_use_local_file *g:ale_c_clangformat_use_local_file* + *b:ale_c_clangformat_use_local_file* + Type: |Number| + Default: `0` + + This variable can be changed to modify whether to use a local .clang-format + file. If the file is found, the flag '-style=file' is passed to clang-format + and any options configured via |g:ale_c_clangformat_style_option| are not + passed. + + If this option is enabled but no .clang-format file is found, default back to + |g:ale_c_clangformat_style_option|, if it set. + + If you set this variable, ensure you don't modify -style in + |g:ale_c_clangformat_options|, as this will cause clang-format to error. =============================================================================== @@ -156,7 +283,7 @@ g:ale_c_clangtidy_options *g:ale_c_clangtidy_options* Type: |String| Default: `''` - This variable can be changed to modify flags given to clang-tidy. + This variable can be changed to modify compiler flags given to clang-tidy. - Setting this variable to a non-empty string, - and working in a buffer where no compilation database is found using @@ -169,6 +296,23 @@ g:ale_c_clangtidy_options *g:ale_c_clangtidy_options* of the |g:ale_c_build_dir_names| directories of the project tree. +g:ale_c_clangtidy_extra_options *g:ale_c_clangtidy_extra_options* + *b:ale_c_clangtidy_extra_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to clang-tidy. + + +g:ale_c_clangtidy_fix_errors *g:ale_c_clangtidy_fix_errors* + *b:ale_c_clangtidy_fix_errors* + Type: |Number| + Default: `1` + + This variable can be changed to disable the `-fix-errors` option for the + |clangtidy| fixer. + + =============================================================================== cppcheck *ale-c-cppcheck* @@ -243,25 +387,6 @@ g:ale_c_flawfinder_error_severity *g:ale_c_flawfinder_error_severity* error. This setting also applies to flawfinder for c++. -=============================================================================== -gcc *ale-c-gcc* - -g:ale_c_gcc_executable *g:ale_c_gcc_executable* - *b:ale_c_gcc_executable* - Type: |String| - Default: `'gcc'` - - This variable can be changed to use a different executable for gcc. - - -g:ale_c_gcc_options *g:ale_c_gcc_options* - *b:ale_c_gcc_options* - Type: |String| - Default: `'-std=c11 -Wall'` - - This variable can be change to modify flags given to gcc. - - =============================================================================== uncrustify *ale-c-uncrustify* @@ -281,36 +406,5 @@ g:ale_c_uncrustify_options *g:ale_c_uncrustify_options* This variable can be change to modify flags given to uncrustify. -=============================================================================== -ccls *ale-c-ccls* - -g:ale_c_ccls_executable *g:ale_c_ccls_executable* - *b:ale_c_ccls_executable* - Type: |String| - Default: `'ccls'` - - This variable can be changed to use a different executable for ccls. - - -g:ale_c_ccls_init_options *g:ale_c_ccls_init_options* - *b:ale_c_ccls_init_options* - Type: |Dictionary| - Default: `{}` - - This variable can be changed to customize ccls initialization options. - Example: > - { - \ 'cacheDirectory': '/tmp/ccls', - \ 'cacheFormat': 'binary', - \ 'diagnostics': { - \ 'onOpen': 0, - \ 'opChange': 1000, - \ }, - \ } -< - Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all - available options and explanations. - - =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-chef.txt b/sources_non_forked/ale/doc/ale-chef.txt index 5024e279..75e144ec 100644 --- a/sources_non_forked/ale/doc/ale-chef.txt +++ b/sources_non_forked/ale/doc/ale-chef.txt @@ -2,6 +2,26 @@ ALE Chef Integration *ale-chef-options* +=============================================================================== +cookstyle *ale-chef-cookstyle* + +g:ale_chef_cookstyle_options *g:ale_chef_cookstyle_options* + *b:ale_chef_cookstyle_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to cookstyle. + + +g:ale_chef_cookstyle_executable *g:ale_chef_cookstyle_executable* + *b:ale_chef_cookstyle_executable* + Type: |String| + Default: `'cookstyle'` + + This variable can be changed to point to the cookstyle binary in case it's + not on the $PATH or a specific version/path must be used. + + =============================================================================== foodcritic *ale-chef-foodcritic* diff --git a/sources_non_forked/ale/doc/ale-clojure.txt b/sources_non_forked/ale/doc/ale-clojure.txt index a83e336f..3ff367f6 100644 --- a/sources_non_forked/ale/doc/ale-clojure.txt +++ b/sources_non_forked/ale/doc/ale-clojure.txt @@ -2,6 +2,21 @@ ALE Clojure Integration *ale-clojure-options* +=============================================================================== +clj-kondo *ale-clojure-clj-kondo* + +A minimal and opinionated linter for code that sparks joy. + +https://github.com/borkdude/clj-kondo + +g:ale_clojure_clj_kondo_options *g:ale_clojure_clj_kondo_options* + *b:ale_clojure_clj_kondo_options* + Type: |String| + Default: `'--cache'` + + This variable can be changed to modify options passed to clj-kondo. + + =============================================================================== joker *ale-clojure-joker* diff --git a/sources_non_forked/ale/doc/ale-cloudformation.txt b/sources_non_forked/ale/doc/ale-cloudformation.txt index 59c6af06..9724403b 100644 --- a/sources_non_forked/ale/doc/ale-cloudformation.txt +++ b/sources_non_forked/ale/doc/ale-cloudformation.txt @@ -7,8 +7,40 @@ cfn-python-lint *ale-cloudformation-cfn-python-lint* cfn-python-lint is a linter for AWS CloudFormation template file. -https://github.com/awslabs/cfn-python-lint +Website: https://github.com/awslabs/cfn-python-lint +Installation +------------------------------------------------------------------------------- + + +Install cfn-python-lint using either pip or brew: > + +`pip install cfn-lint`. If pip is not available, run +`python setup.py clean --all` then `python setup.py install`. + + Homebrew (macOS): + +`brew install cfn-lint` + +< +Configuration +------------------------------------------------------------------------------- + +To get cloudformation linter to work on only CloudFormation files we must set +the buffer |filetype| to yaml.cloudformation. +This causes ALE to lint the file with linters configured for cloudformation and +yaml files. + +Just put: + +> + + au BufRead,BufNewFile *.template.yaml set filetype=yaml.cloudformation + +< + +on `ftdetect/cloudformation.vim` + +This will get both cloudformation and yaml linters to work on any file with `.template.yaml` ext. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: - diff --git a/sources_non_forked/ale/doc/ale-cpp.txt b/sources_non_forked/ale/doc/ale-cpp.txt index e1f64ab5..17894e6e 100644 --- a/sources_non_forked/ale/doc/ale-cpp.txt +++ b/sources_non_forked/ale/doc/ale-cpp.txt @@ -1,12 +1,16 @@ =============================================================================== ALE C++ Integration *ale-cpp-options* +For basic checking of problems with C++ files, ALE offers the `cc` linter, +which runs either `clang++`, or `gcc`. See |ale-cpp-cc|. + =============================================================================== Global Options The following C options also apply to some C++ linters too. +* |g:ale_c_always_make| * |g:ale_c_build_dir_names| * |g:ale_c_build_dir| * |g:ale_c_parse_makefile| @@ -14,41 +18,82 @@ The following C options also apply to some C++ linters too. =============================================================================== -clang *ale-cpp-clang* +astyle *ale-cpp-astyle* -g:ale_cpp_clang_executable *g:ale_cpp_clang_executable* - *b:ale_cpp_clang_executable* +g:ale_cpp_astyle_executable *g:ale_cpp_astyle_executable* + *b:ale_cpp_astyle_executable* Type: |String| - Default: `'clang++'` + Default: `'astyle'` - This variable can be changed to use a different executable for clang. + This variable can be changed to use a different executable for astyle. -g:ale_cpp_clang_options *g:ale_cpp_clang_options* - *b:ale_cpp_clang_options* - Type: |String| - Default: `'-std=c++14 -Wall'` - - This variable can be changed to modify flags given to clang. - - -=============================================================================== -clangd *ale-cpp-clangd* - -g:ale_cpp_clangd_executable *g:ale_cpp_clangd_executable* - *b:ale_cpp_clangd_executable* - Type: |String| - Default: `'clangd'` - - This variable can be changed to use a different executable for clangd. - - -g:ale_cpp_clangd_options *g:ale_cpp_clangd_options* - *b:ale_cpp_clangd_options* +g:ale_cpp_astyle_project_options *g:ale_cpp_astyle_project_options* + *b:ale_cpp_astyle_project_options* Type: |String| Default: `''` - This variable can be changed to modify flags given to clangd. + This variable can be changed to use an option file for project level + configurations. Provide only the filename of the option file that should be + present at the project's root directory. + + For example, if .astylrc is specified, the file is searched in the parent + directories of the source file's directory. + + +=============================================================================== +cc *ale-cpp-cc* + *ale-cpp-gcc* + *ale-cpp-clang* + +g:ale_cpp_cc_executable *g:ale_cpp_cc_executable* + *b:ale_cpp_cc_executable* + Type: |String| + Default: `''` + + This variable can be changed to use a different executable for a C++ compiler. + + ALE will try to use `clang++` if Clang is available, otherwise ALE will + default to checking C++ code with `gcc`. + + +g:ale_cpp_cc_options *g:ale_cpp_cc_options* + *b:ale_cpp_cc_options* + Type: |String| + Default: `'-std=c++14 -Wall'` + + This variable can be change to modify flags given to the C++ compiler. + + +=============================================================================== +ccls *ale-cpp-ccls* + +g:ale_cpp_ccls_executable *g:ale_cpp_ccls_executable* + *b:ale_cpp_ccls_executable* + Type: |String| + Default: `'ccls'` + + This variable can be changed to use a different executable for ccls. + + +g:ale_cpp_ccls_init_options *g:ale_cpp_ccls_init_options* + *b:ale_cpp_ccls_init_options* + Type: |Dictionary| + Default: `{}` + + This variable can be changed to customize ccls initialization options. + Example: > + { + \ 'cacheDirectory': '/tmp/ccls', + \ 'cacheFormat': 'binary', + \ 'diagnostics': { + \ 'onOpen': 0, + \ 'opChange': 1000, + \ }, + \ } +< + Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all + available options and explanations. =============================================================================== @@ -82,6 +127,25 @@ g:ale_cpp_clangcheck_options *g:ale_cpp_clangcheck_options* option. +=============================================================================== +clangd *ale-cpp-clangd* + +g:ale_cpp_clangd_executable *g:ale_cpp_clangd_executable* + *b:ale_cpp_clangd_executable* + Type: |String| + Default: `'clangd'` + + This variable can be changed to use a different executable for clangd. + + +g:ale_cpp_clangd_options *g:ale_cpp_clangd_options* + *b:ale_cpp_clangd_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to clangd. + + =============================================================================== clang-format *ale-cpp-clangformat* @@ -125,7 +189,7 @@ g:ale_cpp_clangtidy_options *g:ale_cpp_clangtidy_options* Type: |String| Default: `''` - This variable can be changed to modify flags given to clang-tidy. + This variable can be changed to modify compiler flags given to clang-tidy. - Setting this variable to a non-empty string, - and working in a buffer where no compilation database is found using @@ -138,6 +202,23 @@ g:ale_cpp_clangtidy_options *g:ale_cpp_clangtidy_options* of the |g:ale_c_build_dir_names| directories of the project tree. +g:ale_cpp_clangtidy_extra_options *g:ale_cpp_clangtidy_extra_options* + *b:ale_cpp_clangtidy_extra_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to clang-tidy. + + +g:ale_cpp_clangtidy_fix_errors *g:ale_cpp_clangtidy_fix_errors* + *b:ale_cpp_clangtidy_fix_errors* + Type: |Number| + Default: `1` + + This variable can be changed to disable the `-fix-errors` option for the + |clangtidy| fixer. + + =============================================================================== clazy *ale-cpp-clazy* @@ -254,61 +335,11 @@ g:ale_cpp_flawfinder_options *g:ale-cpp-flawfinder* This variable can be used to pass extra options into the flawfinder command. -=============================================================================== -gcc *ale-cpp-gcc* - -g:ale_cpp_gcc_executable *g:ale_cpp_gcc_executable* - *b:ale_cpp_gcc_executable* - Type: |String| - Default: `'gcc'` - - This variable can be changed to use a different executable for gcc. - - -g:ale_cpp_gcc_options *g:ale_cpp_gcc_options* - *b:ale_cpp_gcc_options* - Type: |String| - Default: `'-std=c++14 -Wall'` - - This variable can be changed to modify flags given to gcc. - - =============================================================================== uncrustify *ale-cpp-uncrustify* See |ale-c-uncrustify| for information about the available options. -=============================================================================== -ccls *ale-cpp-ccls* - -g:ale_cpp_ccls_executable *g:ale_cpp_ccls_executable* - *b:ale_cpp_ccls_executable* - Type: |String| - Default: `'ccls'` - - This variable can be changed to use a different executable for ccls. - - -g:ale_cpp_ccls_init_options *g:ale_cpp_ccls_init_options* - *b:ale_cpp_ccls_init_options* - Type: |Dictionary| - Default: `{}` - - This variable can be changed to customize ccls initialization options. - Example: > - { - \ 'cacheDirectory': '/tmp/ccls', - \ 'cacheFormat': 'binary', - \ 'diagnostics': { - \ 'onOpen': 0, - \ 'opChange': 1000, - \ }, - \ } -< - Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all - available options and explanations. - - =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-cs.txt b/sources_non_forked/ale/doc/ale-cs.txt index 01e6348f..bef495b9 100644 --- a/sources_non_forked/ale/doc/ale-cs.txt +++ b/sources_non_forked/ale/doc/ale-cs.txt @@ -6,11 +6,129 @@ In addition to the linters that are provided with ALE, C# code can be checked with the OmniSharp plugin. See here: https://github.com/OmniSharp/omnisharp-vim +=============================================================================== +csc *ale-cs-csc* + + The |ale-cs-csc| linter checks for semantic errors when files are opened or + saved. + + See |ale-lint-file-linters| for more information on linters which do not + check for problems while you type. + + The csc linter uses the mono csc compiler, providing full C# 7 and newer + support, to generate a temporary module target file (/t:module). The module + includes all '*.cs' files contained in the directory tree rooted at the path + defined by the |g:ale_cs_csc_source| or |b:ale_cs_csc_source| variable and + all sub directories. + + It will in future replace the |ale-cs-mcs| and |ale-cs-mcsc| linters as both + utilize the mcsc compiler which, according to the mono project, is no longer + actively developed, and only receives maintenance updates. However, because + the csc compiler does not support the -syntax option, this linter does not + offer any as-you-type syntax checking, similar to the |ale-cs-mcsc| linter. + + The paths to search for additional assembly files can be specified using the + |g:ale_cs_csc_assembly_path| or |b:ale_cs_csc_assembly_path| variables. + + NOTE: ALE will not find any errors in files apart from syntax errors if any + one of the source files contains a syntax error. Syntax errors must be fixed + first before other errors will be shown. + + +g:ale_cs_csc_options *g:ale_cs_csc_options* + *b:ale_cs_csc_options* + Type: |String| + Default: `''` + + This option can be set to pass additional arguments to the `csc` compiler. + + For example, to add the dotnet package which is not added per default: > + + let g:ale_cs_mcs_options = ' /warn:4 /langversion:7.2' +< + NOTE: the `/unsafe` option is always passed to `csc`. + + +g:ale_cs_csc_source *g:ale_cs_csc_source* + *b:ale_cs_csc_source* + Type: |String| + Default: `''` + + This variable defines the root path of the directory tree searched for the + '*.cs' files to be linted. If this option is empty, the source file's + directory will be used. + + NOTE: Currently it is not possible to specify sub directories and + directory sub trees which shall not be searched for *.cs files. + + +g:ale_cs_csc_assembly_path *g:ale_cs_csc_assembly_path* + *b:ale_cs_csc_assembly_path* + Type: |List| + Default: `[]` + + This variable defines a list of path strings to be searched for external + assembly files. The list is passed to the csc compiler using the `/lib:` + flag. + + +g:ale_cs_csc_assemblies *g:ale_cs_csc_assemblies* + *b:ale_cs_csc_assemblies* + Type: |List| + Default: `[]` + + This variable defines a list of external assembly (*.dll) files required + by the mono mcs compiler to generate a valid module target. The list is + passed the csc compiler using the `/r:` flag. + + For example: > + + " Compile C# programs with the Unity engine DLL file on Mac. + let g:ale_cs_mcsc_assemblies = [ + \ '/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll', + \ 'path-to-unityproject/obj/Debug', + \] +< + +=============================================================================== +dotnet-format *ale-cs-dotnet-format* + +Installation +------------------------------------------------------------------------------- + +Installing .NET SDK should probably ensure that `dotnet` is in your `$PATH`. +For .NET 6 the `dotnet format` tool is already included in the .NET SDK. For +.NET 5 or below you will have to manually install it using the instructions +from listed in this repository: https://github.com/dotnet/format + + +Options +------------------------------------------------------------------------------- + +g:ale_cs_dotnet_format_executable *g:ale_cs_dotnet_format_executable* + *b:ale_cs_dotnet_format_executable* + Type: |String| + Default: `'dotnet'` + + This variable can be set to specify an absolute path to the + `dotnet` executable (or to specify an alternate executable). + + +g:ale_cs_dotnet_format_options *g:ale_cs_dotnet_format_options* + *b:ale_cs_dotnet_format_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the `dotnet format` + fixer. + + =============================================================================== mcs *ale-cs-mcs* - The `mcs` linter looks only for syntax errors while you type. See |ale-cs-mcsc| - for the separately configured linter for checking for semantic errors. + The `mcs` linter looks only for syntax errors while you type. See + |ale-cs-mcsc| for the separately configured linter for checking for semantic + errors. g:ale_cs_mcs_options *g:ale_cs_mcs_options* diff --git a/sources_non_forked/ale/doc/ale-css.txt b/sources_non_forked/ale/doc/ale-css.txt index f3cae385..ff74b263 100644 --- a/sources_non_forked/ale/doc/ale-css.txt +++ b/sources_non_forked/ale/doc/ale-css.txt @@ -2,6 +2,14 @@ ALE CSS Integration *ale-css-options* +=============================================================================== +fecs *ale-css-fecs* + +`fecs` options for CSS is the same as the options for JavaScript, and both of +them reads `./.fecsrc` as the default configuration file. See: +|ale-javascript-fecs|. + + =============================================================================== prettier *ale-css-prettier* diff --git a/sources_non_forked/ale/doc/ale-cuda.txt b/sources_non_forked/ale/doc/ale-cuda.txt index 0e53f756..06aa48ce 100644 --- a/sources_non_forked/ale/doc/ale-cuda.txt +++ b/sources_non_forked/ale/doc/ale-cuda.txt @@ -21,6 +21,24 @@ g:ale_cuda_nvcc_options *g:ale_cuda_nvcc_options* This variable can be changed to modify flags given to nvcc. +=============================================================================== +clangd *ale-cuda-clangd* + +g:ale_cuda_clangd_executable *g:ale_cuda_clangd_executable* + *b:ale_cuda_clangd_executable* + Type: |String| + Default: `'clangd'` + + This variable can be changed to use a different executable for clangd. + + +g:ale_cuda_clangd_options *g:ale_cuda_clangd_options* + *b:ale_cuda_clangd_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to clangd. + =============================================================================== clang-format *ale-cuda-clangformat* diff --git a/sources_non_forked/ale/doc/ale-d.txt b/sources_non_forked/ale/doc/ale-d.txt index 55596062..72349a20 100644 --- a/sources_non_forked/ale/doc/ale-d.txt +++ b/sources_non_forked/ale/doc/ale-d.txt @@ -1,6 +1,15 @@ =============================================================================== ALE D Integration *ale-d-options* +=============================================================================== +dfmt *ale-d-dfmt* + +g:ale_d_dfmt_options *g:ale_d_dfmt_options* + *b:ale_d_dfmt_options* + Type: |String| + Default: `''` + +This variable can be set to pass additional options to the dfmt fixer. =============================================================================== dls *ale-d-dls* diff --git a/sources_non_forked/ale/doc/ale-dafny.txt b/sources_non_forked/ale/doc/ale-dafny.txt new file mode 100644 index 00000000..005170ad --- /dev/null +++ b/sources_non_forked/ale/doc/ale-dafny.txt @@ -0,0 +1,16 @@ +=============================================================================== +ALE Dafny Integration *ale-dafny-options* + + +=============================================================================== +dafny *ale-dafny-dafny* + +g:ale_dafny_dafny_timelimit *g:ale_dafny_dafny_timelimit* + *b:ale_dafny_dafny_timelimit* + Type: |Number| + Default: `10` + + This variable sets the `/timeLimit` used for dafny. + + + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-dart.txt b/sources_non_forked/ale/doc/ale-dart.txt index a6d88dd8..a046808b 100644 --- a/sources_non_forked/ale/doc/ale-dart.txt +++ b/sources_non_forked/ale/doc/ale-dart.txt @@ -2,6 +2,92 @@ ALE Dart Integration *ale-dart-options* +=============================================================================== +analysis_server *ale-dart-analysis_server* + +Installation +------------------------------------------------------------------------------- + +Install Dart via whatever means. `analysis_server` will be included in the SDK. + +In case that `dart` is not in your path, try to set the executable option to +its absolute path. : > + " Set the executable path for dart to the absolute path to it. + let g:ale_dart_analysis_server_executable = '/usr/local/bin/dart' +< + +Options +------------------------------------------------------------------------------- + +g:ale_dart_analysis_server_executable *g:ale_dart_analysis_server_executable* + *b:ale_dart_analysis_server_executable* + Type: |String| + Default: `'dart'` + + This variable can be set to change the path of dart. + + +=============================================================================== +dart-analyze *ale-dart-analyze* + +Installation +------------------------------------------------------------------------------- + +Installing Dart should probably ensure that `dart` is in your `$PATH`. + +In case it is not, try to set the executable option to its absolute path. : > + " Set the executable path for dart to the absolute path to it. + let g:ale_dart_format_executable = '/usr/lib/dart/bin/dart' + > + +Install Dart via whatever means. `dart analyze` will be included in the SDK. + +Options +------------------------------------------------------------------------------- + +g:ale_dart_analyze_executable *g:ale_dart_analyze_executable* + *b:ale_dart_analyze_executable* + Type: |String| + Default: `'dart'` + + This variable can be set to specify an absolute path to the + format executable (or to specify an alternate executable). + + +=============================================================================== +dart-format *ale-dart-format* + +Installation +------------------------------------------------------------------------------- + +Installing Dart should probably ensure that `dart` is in your `$PATH`. + +In case it is not, try to set the executable option to its absolute path. : > + " Set the executable path for dart to the absolute path to it. + let g:ale_dart_format_executable = '/usr/lib/dart/bin/dart' + > + +Options +------------------------------------------------------------------------------- + +g:ale_dart_format_executable *g:ale_dart_format_executable* + *b:ale_dart_format_executable* + Type: |String| + Default: `'dart'` + + This variable can be set to specify an absolute path to the + format executable (or to specify an alternate executable). + + +g:ale_dart_format_options *g:ale_dart_format_options* + *b:ale_dart_format_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the dart format fixer. + + + =============================================================================== dartanalyzer *ale-dart-dartanalyzer* diff --git a/sources_non_forked/ale/doc/ale-desktop.txt b/sources_non_forked/ale/doc/ale-desktop.txt new file mode 100644 index 00000000..62269e9c --- /dev/null +++ b/sources_non_forked/ale/doc/ale-desktop.txt @@ -0,0 +1,21 @@ +=============================================================================== +ALE desktop Integration *ale-desktop-options* + + +=============================================================================== +desktop-file-validate *ale-desktop-desktop-file-validate* + +ALE supports checking .desktop files with `desktop-file-validate.` + + +g:ale_desktop_desktop_file_validate_options + *g:ale_desktop_desktop_file_validate_options* + *b:ale_desktop_desktop_file_validate_options* + Type: |String| + Default: `''` + + This variable can be changed to set options for `desktop-file-validate`, + such as `'--warn-kde'`. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-development.txt b/sources_non_forked/ale/doc/ale-development.txt index 408b176f..3d0dd524 100644 --- a/sources_non_forked/ale/doc/ale-development.txt +++ b/sources_non_forked/ale/doc/ale-development.txt @@ -12,6 +12,8 @@ CONTENTS *ale-development-contents* 3. Coding Standards.....................|ale-coding-standards| 4. Testing ALE..........................|ale-development-tests| 4.1. Writing Linter Tests.............|ale-development-linter-tests| + 4.2. Writing Fixer Tests..............|ale-development-fixer-tests| + 4.3. Running Tests in a Windows VM....|ale-development-windows-tests| =============================================================================== 1. Introduction *ale-development-introduction* @@ -146,14 +148,16 @@ Apply the following rules when writing Bash scripts. =============================================================================== 4. Testing ALE *ale-development-tests* *ale-dev-tests* *ale-tests* -ALE is tested with a suite of tests executed in Travis CI and AppVeyor. ALE -runs tests with the following versions of Vim in the following environments. +ALE is tested with a suite of tests executed via GitHub Actions and AppVeyor. +ALE runs tests with the following versions of Vim in the following +environments. -1. Vim 8.0.0027 on Linux via Travis CI. -2. Vim 8.1.0204 on Linux via Travis CI. -3. NeoVim 0.2.0 on Linux via Travis CI. -4. NeoVim 0.3.0 on Linux via Travis CI. -5. Vim 8 (stable builds) on Windows via AppVeyor. +1. Vim 8.0.0027 on Linux via GitHub Actions. +2. Vim 8.2.2401 on Linux via GitHub Actions. +3. NeoVim 0.2.0 on Linux via GitHub Actions. +4. NeoVim 0.4.4 on Linux via GitHub Actions. +5. NeoVim 0.5.0 on Linux via GitHub Actions. +6. Vim 8 (stable builds) on Windows via AppVeyor. If you are developing ALE code on Linux, Mac OSX, or BSD, you can run ALEs tests by installing Docker and running the `run-tests` script. Follow the @@ -169,27 +173,36 @@ will run all of the tests in Vader, Vint checks, and several Bash scripts for finding extra issues. Run `./run-tests --help` to see all of the options the script supports. Note that the script supports selecting particular test files. +Once you get used to dealing with Vim and NeoVim compatibility issues, you +probably want to use `./run-tests --fast -q` for running tests with only the +fastest available Vim version, and with success messages from tests +suppressed. + Generally write tests for any changes you make. The following types of tests are recommended for the following types of code. * New/edited error handler callbacks -> Write tests in `test/handler` -* New/edited command callbacks -> Write tests in `test/command_callback` +* New/edited linter definition -> Write tests in `test/linter` * New/edited fixer functions -> Write tests in `test/fixers` Look at existing tests in the codebase for examples of how to write tests. Refer to the Vader documentation for general information on how to write Vader tests: https://github.com/junegunn/vader.vim +If you need to add any supporting files for tests, such as empty files present +to test searching upwards through paths for configuration files, they can be +added to the `test/test-files` directory. + See |ale-development-linter-tests| for more information on how to write linter tests. -When you add new linters or fixers, make sure to add them into the table in -the README, and also into the |ale-support| list in the main help file. If you -forget to keep them both in sync, you should see an error like the following -in Travis CI. > - +When you add new linters or fixers, make sure to add them into the tables in +supported-tools.md and |ale-supported-languages-and-tools.txt|. If you forget to +keep them both in sync, you should see an error like the following in the +builds run for GitHub Actions. +> ======================================== - diff README.md and doc/ale.txt tables + diff supported-tools.md and doc/ale-supported-languages-and-tools.txt tables ======================================== Differences follow: @@ -266,8 +279,8 @@ be written like so. > \ '1:Something went wrong', \ ] < -Tests for what ALE runs should go in the `test/command_callback` directory, -and should be written like so. > +Tests for what ALE runs should go in the `test/linter` directory, and should +be written like so. > Before: " Load the linter and set up a series of commands, reset linter variables, @@ -288,10 +301,10 @@ and should be written like so. > AssertLinter 'some-command', ale#Escape('some-command') . ' --foo' Execute(Check chained commands): - " WithChainResults can be called with 1 or more list for passing output + " GivenCommandOutput can be called with 1 or more list for passing output " to chained commands. The output for each callback defaults to an empty " list. - WithChainResults ['v2.1.2'] + GivenCommandOutput ['v2.1.2'] " Given a List of commands, check all of them. " Given a String, only the last command in the chain will be checked. AssertLinter 'some-command', [ @@ -302,7 +315,8 @@ and should be written like so. > The full list of commands that will be temporarily defined for linter tests given the above setup are as follows. -`WithChainResults [...]` - Define output for command chain functions. +`GivenCommandOutput [...]` - Define output for ale#command#Run. +`AssertLinterCwd cwd` - Check the `cwd` for the linter. `AssertLinter executable, command` - Check the executable and command. `AssertLinterNotExecuted` - Check that linters will not be executed. `AssertLSPLanguage language` - Check the language given to an LSP server. @@ -311,5 +325,124 @@ 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* + +Tests for ALE fixers should go in the `test/fixers` directory, and should +be written like so. > + + Before: + " Load the fixer and set up a series of commands, reset fixer variables, + " clear caches, etc. + " + " Vader's 'Save' command will be called here for fixer variables. + call ale#assert#SetUpFixerTest('filetype', 'fixer_name') + + After: + " Reset fixers, variables, etc. + " + " Vader's 'Restore' command will be called here. + call ale#assert#TearDownFixerTest() + + Execute(The default command should be correct): + " AssertFixer checks the result of the loaded fixer function. + AssertFixer {'command': ale#Escape('some-command') . ' --foo'} + + Execute(Check chained commands): + " Same as above for linter tests. + GivenCommandOutput ['v2.1.2'] + " Given a List of commands, check all of them. + " Given anything else, only the last result will be checked. + AssertFixer [ + \ ale#Escape('some-command') . ' --version', + \ {'command': ale#Escape('some-command') . ' --foo'} + \] +< +The full list of commands that will be temporarily defined for fixer tests +given the above setup are as follows. + +`GivenCommandOutput [...]` - Define output for ale#command#Run. +`AssertFixerCwd cwd` - Check the `cwd` for the fixer. +`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* + +Tests are run for ALE in a build of Vim 8 for Windows via AppVeyor. These +tests can frequently break due to minor differences in paths and how escaping +is done for commands on Windows. If you are a Linux or Mac user, running these +tests locally can be difficult. Here is a process that will make that easier. + +First, you want to install a Windows image with VirtualBox. Install VirtualBox +and grab a VirtualBox image for Windows such as from here: +https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ + +NOTE: If you need to enter a password for the virtual machine at any point, +the password is "Passw0rd!" without the double quotes. + +NOTE: If your trial period for Windows runs out, run the commands like the +wallpaper tells you to. + +Your virtual machine will need to have PowerShell installed. Before you go any +further, confirm that PowerShell is installed in your Windows virtual machine. + +Consult the VirtualBox documentation on how to install "Guest Additions." +You probably want to install "Guest Additions" for most things to work +properly. + +After you've loaded your virtual machine image, go into "Settings" for your +virtual machine, and "Shared Folders." Add a shared folder with the name +"ale", and set the "Folder Path" to the path to your ALE repository, for +example: "/home/w0rp/ale" + +Find out which drive letter "ale" has been mounted as in Windows. We'll use +"E:" as the drive letter, for example. Open the command prompt as an +administrator by typing in `cmd` in the start menu, right clicking on the +command prompt application, and clicking "Run as administrator." Click "Yes" +when prompted to ask if you're sure you want to run the command prompt. You +should type in the following command to mount the "ale" directory for testing, +where "E:" is replaced with your drive letter. > + + mklink /D C:\testplugin E: +< +Close the administrator Command Prompt, and try running the command +`type C:\testplugin\LICENSE` in a new Command Prompt which you are NOT running +as administrator. You should see the license for ALE in your terminal. After +you have confirmed that you have mounted ALE on your machine, search in the +Start Menu for "power shell," run PowerShell as an administrator, and issue +the following commands to install the correct Vim and Vader versions for +running tests. > + + Add-Type -A System.IO.Compression.FileSystem + + Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586w32.zip -OutFile C:\vim.zip + [IO.Compression.ZipFile]::ExtractToDirectory('C:\vim.zip', 'C:\vim') + rm C:\vim.zip + + Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586rt.zip -OutFile C:\rt.zip + [IO.Compression.ZipFile]::ExtractToDirectory('C:\rt.zip', 'C:\vim') + rm C:\rt.zip + + Invoke-WebRequest https://github.com/junegunn/vader.vim/archive/c6243dd81c98350df4dec608fa972df98fa2a3af.zip -OutFile C:\vader.zip + [IO.Compression.ZipFile]::ExtractToDirectory('C:\vader.zip', 'C:\') + mv C:\vader.vim-c6243dd81c98350df4dec608fa972df98fa2a3af C:\vader + rm C:\vader.zip +< +After you have finished installing everything, you can run all of the tests +in Windows by opening a Command Prompt NOT as an administrator by navigating +to the directory where you've mounted the ALE code, which must be named +`C:\testplugin`, and by running the `run-tests.bat` batch file. > + + cd C:\testplugin + run-tests +< +It will probably take several minutes for all of the tests to run. Be patient. +You can run a specific test by passing the filename as an argument to the +batch file, for example: `run-tests test/test_c_flag_parsing.vader` . This will +give you results much more quickly. + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-dhall.txt b/sources_non_forked/ale/doc/ale-dhall.txt new file mode 100644 index 00000000..9b997b9e --- /dev/null +++ b/sources_non_forked/ale/doc/ale-dhall.txt @@ -0,0 +1,52 @@ +=============================================================================== +ALE Dhall Integration *ale-dhall-options* + +g:ale_dhall_executable *g:ale_dhall_executable* + *b:ale_dhall_executable* + Type: |String| + Default: `'dhall'` + +g:ale_dhall_options *g:ale_dhall_options* + *b:ale_dhall_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the 'dhall` executable. + This is shared with `dhall-freeze` and `dhall-lint`. +> + let g:ale_dhall_options = '--ascii' +< + +=============================================================================== +dhall-format *ale-dhall-format* + +Dhall + (https://dhall-lang.org/) + + +=============================================================================== +dhall-freeze *ale-dhall-freeze* + +Dhall + (https://dhall-lang.org/) + +g:ale_dhall_freeze_options *g:ale_dhall_freeze_options* + *b:ale_dhall_freeze_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the 'dhall freeze` + executable. +> + let g:ale_dhall_freeze_options = '--all' +< + +=============================================================================== +dhall-lint *ale-dhall-lint* + +Dhall + (https://dhall-lang.org/) + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-elixir.txt b/sources_non_forked/ale/doc/ale-elixir.txt index 5864f728..a4e5c2c6 100644 --- a/sources_non_forked/ale/doc/ale-elixir.txt +++ b/sources_non_forked/ale/doc/ale-elixir.txt @@ -6,7 +6,7 @@ ALE Elixir Integration *ale-elixir-options* mix *ale-elixir-mix* -The `mix` linter is disabled by default, as it can bee too expensive to run. +The `mix` linter is disabled by default, as it can be too expensive to run. See `:help g:ale_linters` @@ -85,5 +85,12 @@ g:ale_elixir_credo_strict *g:ale_elixir_credo_strict* Tells credo to run in strict mode or suggest mode. Set variable to 1 to enable --strict mode. +g:ale_elixir_credo_config_file g:ale_elixir_credo_config_file + + Type: String + Default: '' + + Tells credo to use a custom configuration file. + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-elm.txt b/sources_non_forked/ale/doc/ale-elm.txt index bb7a6132..b1510241 100644 --- a/sources_non_forked/ale/doc/ale-elm.txt +++ b/sources_non_forked/ale/doc/ale-elm.txt @@ -29,23 +29,55 @@ g:ale_elm_format_options *g:ale_elm_format_options* This variable can be set to pass additional options to elm-format. =============================================================================== -elm-lsp *ale-elm-elm-lsp* +elm-ls *ale-elm-elm-ls* -g:ale_elm_lsp_executable *g:ale_elm_lsp_executable* - *b:ale_elm_lsp_executable* +g:ale_elm_ls_executable *g:ale_elm_ls_executable* + *b:ale_elm_ls_executable* Type: |String| - Default: `'elm-lsp'` + Default: `'elm-language-server'` See |ale-integrations-local-executables| -g:ale_elm_lsp_use_global *g:ale_elm_lsp_use_global* - *b:ale_elm_lsp_use_global* +g:ale_elm_ls_use_global *g:ale_elm_ls_use_global* + *b:ale_elm_ls_use_global* Type: |Number| - Default: `get(g:, 'ale_use_global_executables', 0)` + Default: `get(g:, 'ale_use_global_executables', 1)` See |ale-integrations-local-executables| + +g:ale_elm_ls_elm_path *g:ale_elm_ls_elm_path* + *b:ale_elm_ls_elm_path* + Type: |String| + Default: `''` + + See |ale-integrations-local-executables| + + +g:ale_elm_ls_elm_format_path *g:ale_elm_ls_elm_format_path* + *b:ale_elm_ls_elm_format_path* + Type: |String| + Default: `''` + + See |ale-integrations-local-executables| + + +g:ale_elm_ls_elm_test_path *g:ale_elm_ls_elm_test_path* + *b:ale_elm_ls_elm_test_path* + Type: |String| + Default: `''` + + See |ale-integrations-local-executables| + + +g:ale_elm_ls_elm_analyse_trigger *g:ale_elm_ls_elm_analyse_trigger* + *b:ale_elm_ls_elm_analyse_trigger* + Type: |String| + Default: `'change'` + + One of 'change', 'save' or 'never' + =============================================================================== elm-make *ale-elm-elm-make* diff --git a/sources_non_forked/ale/doc/ale-erlang.txt b/sources_non_forked/ale/doc/ale-erlang.txt index ad3c1e5a..ede179d1 100644 --- a/sources_non_forked/ale/doc/ale-erlang.txt +++ b/sources_non_forked/ale/doc/ale-erlang.txt @@ -3,8 +3,65 @@ ALE Erlang Integration *ale-erlang-options* =============================================================================== +dialyzer *ale-erlang-dialyzer* + +g:ale_erlang_dialyzer_executable *g:ale_erlang_dialyzer_executable* + *b:ale_erlang_dialyzer_executable* + Type: |String| + Default: `'dialyzer'` + + This variable can be changed to specify the dialyzer executable. + + +g:ale_erlang_dialyzer_options *g:ale_erlang_dialyzer_options* + *b:ale_erlang_dialyzer_options* + Type: |String| + Default: `'-Wunmatched_returns -Werror_handling -Wrace_conditions -Wunderspec'` + + This variable can be changed to specify the options to pass to the dialyzer + executable. + +g:ale_erlang_dialyzer_plt_file *g:ale_erlang_dialyzer_plt_file* + *b:ale_erlang_dialyzer_plt_file* + Type: |String| + + This variable can be changed to specify the path to the PLT file. By + default, it will search for the PLT file inside the `_build` directory. If + there isn't one, it will fallback to the path `$REBAR_PLT_DIR/dialyzer/plt`. + Otherwise, it will default to `$HOME/.dialyzer_plt`. + + +g:ale_erlang_dialyzer_rebar3_profile *g:ale_erlang_dialyzer_rebar3_profile* + *b:ale_erlang_dialyzer_rebar3_profile* + Type: |String| + Default: `'default'` + + This variable can be changed to specify the profile that is used to + run dialyzer with rebar3. + + +------------------------------------------------------------------------------- +elvis *ale-erlang-elvis* + +g:ale_erlang_elvis_executable *g:ale_erlang_elvis_executable* + *b:ale_erlang_elvis_executable* + Type: |String| + Default: `'elvis'` + + This variable can be changed to specify the elvis executable. + + +------------------------------------------------------------------------------- erlc *ale-erlang-erlc* +g:ale_erlang_erlc_executable *g:ale_erlang_erlc_executable* + *b:ale_erlang_erlc_executable* + Type: |String| + Default: `'erlc'` + + This variable can be changed to specify the erlc executable. + + g:ale_erlang_erlc_options *g:ale_erlang_erlc_options* *b:ale_erlang_erlc_options* Type: |String| @@ -14,6 +71,26 @@ g:ale_erlang_erlc_options *g:ale_erlang_erlc_options* or `-pa`. +------------------------------------------------------------------------------- +erlfmt *ale-erlang-erlfmt* + +g:ale_erlang_erlfmt_executable *g:ale_erlang_erlfmt_executable* + *b:ale_erlang_erlfmt_executable* + Type: |String| + Default: `'erlfmt'` + + This variable can be changed to specify the erlfmt executable. + + +g:ale_erlang_erlfmt_options *g:ale_erlang_erlfmt_options* + *b:ale_erlang_erlfmt_options* + Type: |String| + Default: `''` + + This variable controls additional parameters passed to `erlfmt`, such as + `--insert-pragma` or `--print-width`. + + ------------------------------------------------------------------------------- syntaxerl *ale-erlang-syntaxerl* diff --git a/sources_non_forked/ale/doc/ale-eruby.txt b/sources_non_forked/ale/doc/ale-eruby.txt index d75d3868..48a34895 100644 --- a/sources_non_forked/ale/doc/ale-eruby.txt +++ b/sources_non_forked/ale/doc/ale-eruby.txt @@ -4,6 +4,7 @@ ALE Eruby Integration *ale-eruby-options* There are four linters for `eruby` files: - `erb` +- `erblint` - `erubis` - `erubi` - `ruumba` @@ -13,6 +14,26 @@ default parser in Rails between 3.0 and 5.1. `erubi` is the default in Rails 5.1 and later. `ruumba` can extract Ruby from eruby files and run rubocop on the result. To selectively enable a subset, see |g:ale_linters|. +=============================================================================== +erblint *ale-eruby-erblint* + +g:ale_eruby_erblint_executable *g:ale_eruby_erblint_executable* + *b:ale_eruby_erblint_executable* + Type: |String| + Default: `'erblint'` + + Override the invoked erblint binary. This is useful for running erblint + from binstubs or a bundle. + + +g:ale_eruby_erblint_options *g:ale_ruby_erblint_options* + *b:ale_ruby_erblint_options* + Type: |String| + Default: `''` + + This variable can be change to modify flags given to erblint. + + =============================================================================== ruumba *ale-eruby-ruumba* diff --git a/sources_non_forked/ale/doc/ale-fish.txt b/sources_non_forked/ale/doc/ale-fish.txt index 8450b38a..7dbbc10c 100644 --- a/sources_non_forked/ale/doc/ale-fish.txt +++ b/sources_non_forked/ale/doc/ale-fish.txt @@ -10,5 +10,22 @@ displaying errors if an error message is not found. If ALE is not showing any errors but your file does not run as expected, run `fish -n ` from the command line. +=============================================================================== +fish_indent *ale-fish-fish_indent* + +g:ale_fish_fish_indent_executable *g:ale_fish_fish_indent_executable* + *b:ale_fish_fish_indent_executable* + Type: |String| + Default: `'fish_indent'` + + This variable can be changed to use a different executable for fish_indent. + +g:ale_fish_fish_indent_options *g:ale_fish_fish_indent_options* + *b:ale_fish_fish_indent_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to fish_indent. + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-go.txt b/sources_non_forked/ale/doc/ale-go.txt index 3fbc6fb9..2f1e4c1c 100644 --- a/sources_non_forked/ale/doc/ale-go.txt +++ b/sources_non_forked/ale/doc/ale-go.txt @@ -20,8 +20,8 @@ the benefit of running a number of linters, more than ALE would by default, while ensuring it doesn't run any linters known to be slow or resource intensive. -g:ale_go_go_executable *g:ale_go_go_options* - *b:ale_go_go_options* +g:ale_go_go_executable *g:ale_go_go_executable* + *b:ale_go_go_executable* Type: |String| Default: `'go'` @@ -30,6 +30,33 @@ g:ale_go_go_executable *g:ale_go_go_options* the `gomod` fixer. +g:ale_go_go111module *g:ale_go_go111module* + *b:ale_go_go111module* + Type: |String| + Default: `''` + + Override the value of the `$GO111MODULE` environment variable for + golang tools. + + + +=============================================================================== +bingo *ale-go-bingo* + +g:ale_go_bingo_executable *g:ale_go_bingo_executable* + *b:ale_go_bingo_executable* + Type: |String| + Default: `'bingo'` + + Location of the bingo binary file. + + +g:ale_go_bingo_options *g:ale_go_bingo_options* + *b:ale_go_bingo_options* + Type: |String| + Default: `''` + + =============================================================================== gobuild *ale-go-gobuild* @@ -53,6 +80,77 @@ g:ale_go_gofmt_options *g:ale_go_gofmt_options* This variable can be set to pass additional options to the gofmt fixer. +=============================================================================== +golangci-lint *ale-go-golangci-lint* + +`golangci-lint` is a `lint_file` linter, which only lints files that are +written to disk. This differs from the default behavior of linting the buffer. +See: |ale-lint-file| + +g:ale_go_golangci_lint_executable *g:ale_go_golangci_lint_executable* + *b:ale_go_golangci_lint_executable* + Type: |String| + Default: `'golangci-lint'` + + The executable that will be run for golangci-lint. + + +g:ale_go_golangci_lint_options *g:ale_go_golangci_lint_options* + *b:ale_go_golangci_lint_options* + Type: |String| + Default: `'--enable-all'` + + This variable can be changed to alter the command-line arguments to the + golangci-lint invocation. + + +g:ale_go_golangci_lint_package *g:ale_go_golangci_lint_package* + *b:ale_go_golangci_lint_package* + Type: |Number| + Default: `0` + + When set to `1`, the whole Go package will be checked instead of only the + current file. + + +=============================================================================== +golangserver *ale-go-golangserver* + +g:ale_go_langserver_executable *g:ale_go_langserver_executable* + *b:ale_go_langserver_executable* + Type: |String| + Default: `'go-langserver'` + + Location of the go-langserver binary file. + + +g:ale_go_langserver_options *g:ale_go_langserver_options* + *b:ale_go_langserver_options* + Type: |String| + Default: `''` + + Additional options passed to the go-langserver command. Note that the + `-gocodecompletion` option is ignored because it is handled automatically + by the |g:ale_completion_enabled| variable. + +=============================================================================== +golines *ale-go-golines* + +g:ale_go_golines_executable *g:ale_go_lines_executable* + *b:ale_go_lines_executable* + Type: |String| + Default: `'golines'` + + Location of the golines binary file + +g:ale_go_golines_options *g:ale_go_golines_options* + *b:ale_go_golines_options* + Type: |String| + Default: '' + + Additional options passed to the golines command. By default golines has + --max-length=100 (lines above 100 characters will be wrapped) + =============================================================================== golint *ale-go-golint* @@ -72,17 +170,6 @@ g:ale_go_golint_options *g:ale_go_golint_options* This variable can be set to pass additional options to the golint linter. -=============================================================================== -govet *ale-go-govet* - -g:ale_go_govet_options *g:ale_go_govet_options* - *b:ale_go_govet_options* - Type: |String| - Default: `''` - - This variable can be set to pass additional options to the go vet linter. - - =============================================================================== gometalinter *ale-go-gometalinter* @@ -121,9 +208,116 @@ g:ale_go_gometalinter_lint_package *g:ale_go_gometalinter_lint_package* current file. +=============================================================================== +gopls *ale-go-gopls* + +gopls is the official Go language server, and is enabled for use with ALE by +default. + +To install the latest stable version of `gopls` to your `$GOPATH`, try the +following command: > + + GO111MODULE=on go get golang.org/x/tools/gopls@latest +< +If `$GOPATH` is readable by ALE, it should probably work without you having to +do anything else. See the `gopls` README file for more information: + +https://github.com/golang/tools/blob/master/gopls/README.md + + +g:ale_go_gopls_executable *g:ale_go_gopls_executable* + *b:ale_go_gopls_executable* + Type: |String| + Default: `'gopls'` + + See |ale-integrations-local-executables| + + ALE will search for `gopls` in locally installed directories first by + default, and fall back on a globally installed `gopls` if it can't be found + otherwise. + + +g:ale_go_gopls_options *g:ale_go_gopls_options* + *b:ale_go_gopls_options* + Type: |String| + Default: `''` + + Command-line options passed to the gopls executable. See `gopls -h`. + + +g:ale_go_gopls_init_options *g:ale_go_gopls_init_options* + *b:ale_go_gopls_init_options* + Type: |Dictionary| + Default: `{}` + + LSP initialization options passed to gopls. This can be used to configure + the behaviour of gopls. + + Example: > + let g:ale_go_gopls_init_options = {'ui.diagnostic.analyses': { + \ 'composites': v:false, + \ 'unusedparams': v:true, + \ 'unusedresult': v:true, + \ }} +< + + For a full list of supported analyzers, see: + https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md + + +g:ale_go_gopls_use_global *g:ale_go_gopls_use_global* + *b:ale_go_gopls_use_global* + Type: |String| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + +=============================================================================== +govet *ale-go-govet* + +g:ale_go_govet_options *g:ale_go_govet_options* + *b:ale_go_govet_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the go vet linter. + + +=============================================================================== +revive *ale-go-revive* + +g:ale_go_revive_executable *g:ale_go_revive_executable* + *b:ale_go_revive_executable* + Type: |String| + Default: `'revive'` + + This variable can be set to change the revive executable path. + + +g:ale_go_revive_options *g:ale_go_revive_options* + *b:ale_go_revive_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the revive + + =============================================================================== staticcheck *ale-go-staticcheck* +g:ale_go_staticcheck_executable *g:ale_go_staticcheck_executable* + *b:ale_go_staticcheck_executable* + Type: |String| + Default: `'staticcheck'` + + See |ale-integrations-local-executables| + + ALE will search for `staticcheck` in locally installed directories first by + default, and fall back on a globally installed `staticcheck` if it can't be + found otherwise. + + g:ale_go_staticcheck_options *g:ale_go_staticcheck_options* *b:ale_go_staticcheck_options* Type: |String| @@ -142,73 +336,12 @@ g:ale_go_staticcheck_lint_package *g:ale_go_staticcheck_lint_package* current file. -=============================================================================== -golangserver *ale-go-golangserver* - -g:ale_go_langserver_executable *g:ale_go_langserver_executable* - *b:ale_go_langserver_executable* +g:ale_go_staticcheck_use_global *g:ale_go_staticcheck_use_global* + *b:ale_go_staticcheck_use_global* Type: |String| - Default: `'go-langserver'` + Default: `get(g:, 'ale_use_global_executables', 0)` - Location of the go-langserver binary file. - -g:ale_go_langserver_options *g:ale_go_langserver_options* - *b:ale_go_langserver_options* - Type: |String| - Default: `''` - - Additional options passed to the go-langserver command. Note that the - `-gocodecompletion` option is ignored because it is handled automatically - by the |g:ale_completion_enabled| variable. - - -=============================================================================== -golangci-lint *ale-go-golangci-lint* - -`golangci-lint` is a `lint_file` linter, which only lints files that are -written to disk. This differs from the default behavior of linting the buffer. -See: |ale-lint-file| - -g:ale_go_golangci_lint_executable *g:ale_go_golangci_lint_executable* - *b:ale_go_golangci_lint_executable* - Type: |String| - Default: `'golangci-lint'` - - The executable that will be run for golangci-lint. - - -g:ale_go_golangci_lint_options *g:ale_go_golangci_lint_options* - *b:ale_go_golangci_lint_options* - Type: |String| - Default: `'--enable-all'` - - This variable can be changed to alter the command-line arguments to the - golangci-lint invocation. - - -g:ale_go_golangci_lint_package *g:ale_go_golangci_lint_package* - *b:ale_go_golangci_lint_package* - Type: |Number| - Default: `0` - - When set to `1`, the whole Go package will be checked instead of only the - current file. - - -=============================================================================== -bingo *ale-go-bingo* - -g:ale_go_bingo_executable *g:ale_go_bingo_executable* - *b:ale_go_bingo_executable* - Type: |String| - Default: `'go-bingo'` - - Location of the go-bingo binary file. - -g:ale_go_bingo_options *g:ale_go_bingo_options* - *b:ale_go_bingo_options* - Type: |String| - Default: `''` + See |ale-integrations-local-executables| =============================================================================== diff --git a/sources_non_forked/ale/doc/ale-handlebars.txt b/sources_non_forked/ale/doc/ale-handlebars.txt index 061c5d3c..4a5a3870 100644 --- a/sources_non_forked/ale/doc/ale-handlebars.txt +++ b/sources_non_forked/ale/doc/ale-handlebars.txt @@ -2,12 +2,20 @@ ALE Handlebars Integration *ale-handlebars-options* +=============================================================================== +prettier *ale-handlebars-prettier* + +See |ale-javascript-prettier| for information about the available options. +Uses glimmer parser by default. + + =============================================================================== ember-template-lint *ale-handlebars-embertemplatelint* g:ale_handlebars_embertemplatelint_executable *g:ale_handlebars_embertemplatelint_executable* - Type: |String| *b:ale_handlebars_embertemplatelint_executable* + *b:ale_handlebars_embertemplatelint_executable* + Type: |String| Default: `'ember-template-lint'` See |ale-integrations-local-executables| @@ -15,7 +23,8 @@ g:ale_handlebars_embertemplatelint_executable g:ale_handlebars_embertemplatelint_use_global *g:ale_handlebars_embertemplatelint_use_global* - Type: |Number| *b:ale_handlebars_embertemplatelint_use_global* + *b:ale_handlebars_embertemplatelint_use_global* + Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| diff --git a/sources_non_forked/ale/doc/ale-haskell.txt b/sources_non_forked/ale/doc/ale-haskell.txt index 2247eddc..09894340 100644 --- a/sources_non_forked/ale/doc/ale-haskell.txt +++ b/sources_non_forked/ale/doc/ale-haskell.txt @@ -12,6 +12,18 @@ g:ale_haskell_brittany_executable *g:ale_haskell_brittany_executable* This variable can be changed to use a different executable for brittany. + +=============================================================================== +floskell *ale-haskell-floskell* + +g:ale_haskell_floskell_executable *g:ale_haskell_floskell_executable* + *b:ale_haskell_floskell_executable* + Type: |String| + Default: `'floskell'` + + This variable can be changed to use a different executable for floskell. + + =============================================================================== ghc *ale-haskell-ghc* @@ -22,6 +34,7 @@ g:ale_haskell_ghc_options *g:ale_haskell_ghc_options* This variable can be changed to modify flags given to ghc. + =============================================================================== ghc-mod *ale-haskell-ghc-mod* @@ -32,6 +45,7 @@ g:ale_haskell_ghc_mod_executable *g:ale_haskell_ghc_mod_executable* This variable can be changed to use a different executable for ghc-mod. + =============================================================================== cabal-ghc *ale-haskell-cabal-ghc* @@ -43,6 +57,7 @@ g:ale_haskell_cabal_ghc_options *g:ale_haskell_cabal_ghc_options* This variable can be changed to modify flags given to ghc through cabal exec. + =============================================================================== hdevtools *ale-haskell-hdevtools* @@ -77,6 +92,18 @@ g:ale_haskell_hfmt_executable *g:ale_haskell_hfmt_executable* This variable can be changed to use a different executable for hfmt. + +=============================================================================== +hindent *ale-haskell-hindent* + +g:ale_haskell_hindent_executable *g:ale_haskell_hindent_executable* + *b:ale_haskell_hindent_executable* + Type: |String| + Default: `'hindent'` + + This variable can be changed to use a different executable for hindent. + + =============================================================================== hlint *ale-haskell-hlint* @@ -96,6 +123,19 @@ g:ale_haskell_hlint_options g:ale_haskell_hlint_options This variable can be used to pass extra options to the underlying hlint executable. + +=============================================================================== +hls *ale-haskell-hls* + +g:ale_haskell_hls_executable *g:ale_haskell_hls_executable* + *b:ale_haskell_his_executable* + Type: |String| + Default: `'haskell-language-server-wrapper'` + + This variable can be changed to use a different executable for the haskell + language server. + + =============================================================================== stack-build *ale-haskell-stack-build* @@ -107,6 +147,7 @@ g:ale_haskell_stack_build_options *g:ale_haskell_stack_build_options* We default to using `'--fast'`. Since Stack generates binaries, your programs will be slower unless you separately rebuild them outside of ALE. + =============================================================================== stack-ghc *ale-haskell-stack-ghc* @@ -118,6 +159,7 @@ g:ale_haskell_stack_ghc_options *g:ale_haskell_stack_ghc_options* This variable can be changed to modify flags given to ghc through `stack ghc` + =============================================================================== stylish-haskell *ale-haskell-stylish-haskell* @@ -129,6 +171,7 @@ g:ale_haskell_stylish_haskell_executable This variable can be changed to use a different executable for stylish-haskell. + =============================================================================== hie *ale-haskell-hie* @@ -140,5 +183,26 @@ g:ale_haskell_hie_executable *g:ale_haskell_hie_executable* This variable can be changed to use a different executable for the haskell ide engine. i.e. `'hie-wrapper'` + +=============================================================================== +ormolu *ale-haskell-ormolu* + +g:ale_haskell_ormolu_executable *g:ale_haskell_ormolu_executable* + *b:ale_haskell_ormolu_executable* + Type: |String| + Default: `'ormolu'` + + This variable can be changed to use a different executable for ormolu. + + +g:ale_haskell_ormolu_options *g:ale_haskell_ormolu_options* + *b:ale_haskell_ormolu_options* + Type: String + Default: '' + + This variable can be used to pass extra options to the underlying ormolu + executable. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-hcl.txt b/sources_non_forked/ale/doc/ale-hcl.txt index 8060ac44..59b0a9da 100644 --- a/sources_non_forked/ale/doc/ale-hcl.txt +++ b/sources_non_forked/ale/doc/ale-hcl.txt @@ -5,7 +5,7 @@ ALE HCL Integration *ale-hcl-options* =============================================================================== terraform-fmt *ale-hcl-terraform-fmt* -See |ale-terraform-fmt| for information about the available options. +See |ale-terraform-fmt-fixer| for information about the available options. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-html.txt b/sources_non_forked/ale/doc/ale-html.txt index 1d30929f..2c048148 100644 --- a/sources_non_forked/ale/doc/ale-html.txt +++ b/sources_non_forked/ale/doc/ale-html.txt @@ -2,6 +2,52 @@ ALE HTML Integration *ale-html-options* +=============================================================================== +angular *ale-html-angular* + +ALE supports language server features for Angular. You can install it via `npm`: > + + $ npm install --save-dev @angular/language-server +< +Angular 11 and up are supported. + + +g:ale_html_angular_executable *g:ale_html_angular_executable* + *b:ale_html_angular_executable* + Type: |String| + Default: `'ngserver'` + + See |ale-integrations-local-executables| + + +g:ale_html_angular_use_global *g:ale_html_angular_use_global* + *b:ale_html_angular_use_global* + Type: |String| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + +=============================================================================== +fecs *ale-html-fecs* + +`fecs` options for HTML are the same as the options for JavaScript, and both +of them read `./.fecsrc` as the default configuration file. + +See: |ale-javascript-fecs|. + + +=============================================================================== +html-beautify *ale-html-beautify* + +g:ale_html_beautify_options *g:ale_html_beautify_options* + *b:ale_html_beautify_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to html-beautify. + + =============================================================================== htmlhint *ale-html-htmlhint* @@ -29,6 +75,40 @@ g:ale_html_htmlhint_use_global *g:ale_html_htmlhint_use_global* See |ale-integrations-local-executables| + +=============================================================================== +prettier *ale-html-prettier* + +See |ale-javascript-prettier| for information about the available options. + + +=============================================================================== +stylelint *ale-html-stylelint* + +g:ale_html_stylelint_executable *g:ale_html_stylelint_executable* + *b:ale_html_stylelint_executable* + Type: |String| + Default: `'stylelint'` + + See |ale-integrations-local-executables| + + +g:ale_html_stylelint_options *g:ale_html_stylelint_options* + *b:ale_html_stylelint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to stylelint. + + +g:ale_html_stylelint_use_global *g:ale_html_stylelint_use_global* + *b:ale_html_stylelint_use_global* + Type: |String| + Default: `0` + + See |ale-integrations-local-executables| + + =============================================================================== tidy *ale-html-tidy* @@ -79,39 +159,6 @@ g:ale_html_tidy_use_global *g:html_tidy_use_global* See |ale-integrations-local-executables| -=============================================================================== -prettier *ale-html-prettier* - -See |ale-javascript-prettier| for information about the available options. - - -=============================================================================== -stylelint *ale-html-stylelint* - -g:ale_html_stylelint_executable *g:ale_html_stylelint_executable* - *b:ale_html_stylelint_executable* - Type: |String| - Default: `'stylelint'` - - See |ale-integrations-local-executables| - - -g:ale_html_stylelint_options *g:ale_html_stylelint_options* - *b:ale_html_stylelint_options* - Type: |String| - Default: `''` - - This variable can be set to pass additional options to stylelint. - - -g:ale_html_stylelint_use_global *g:ale_html_stylelint_use_global* - *b:ale_html_stylelint_use_global* - Type: |String| - Default: `0` - - See |ale-integrations-local-executables| - - =============================================================================== write-good *ale-html-write-good* diff --git a/sources_non_forked/ale/doc/ale-ink.txt b/sources_non_forked/ale/doc/ale-ink.txt new file mode 100644 index 00000000..9412a09f --- /dev/null +++ b/sources_non_forked/ale/doc/ale-ink.txt @@ -0,0 +1,40 @@ +=============================================================================== +ALE Ink Integration *ale-ink-options* + + +=============================================================================== +ink-language-server *ale-ink-language-server* + +Ink Language Server + (https://github.com/ephraim/ink-language-server) + +g:ale_ink_ls_executable g:ale_ink_ls_executable + b:ale_ink_ls_executable + Type: |String| + Default: `'ink-language-server'` + + Ink language server executable. + +g:ale_ink_ls_initialization_options + g:ale_ink_ls_initialization_options + b:ale_ink_ls_initialization_options + Type: |Dictionary| + Default: `{}` + + Dictionary containing configuration settings that will be passed to the + language server at startup. For certain platforms and certain story + structures, the defaults will suffice. However, many projects will need to + change these settings - see the ink-language-server website for more + information. + + An example of setting non-default options: + { + \ 'ink': { + \ 'mainStoryPath': 'init.ink', + \ 'inklecateExecutablePath': '/usr/local/bin/inklecate', + \ 'runThroughMono': v:false + \ } + \} + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-inko.txt b/sources_non_forked/ale/doc/ale-inko.txt new file mode 100644 index 00000000..5ca14af6 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-inko.txt @@ -0,0 +1,22 @@ +=============================================================================== +ALE Inko Integration *ale-inko-options* + *ale-integration-inko* + +=============================================================================== +Integration Information + + Currently, the only supported linter for Inko is the Inko compiler itself. + +=============================================================================== +inko *ale-inko-inko* + +g:ale_inko_inko_executable *g:ale_inko_inko_executable* + *b:ale_inko_inko_executable* + Type: |String| + Default: `'inko'` + + This variable can be modified to change the executable path for `inko`. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-java.txt b/sources_non_forked/ale/doc/ale-java.txt index aa226305..6bd04ef9 100644 --- a/sources_non_forked/ale/doc/ale-java.txt +++ b/sources_non_forked/ale/doc/ale-java.txt @@ -5,21 +5,48 @@ ALE Java Integration *ale-java-options* =============================================================================== checkstyle *ale-java-checkstyle* +g:ale_java_checkstyle_config *g:ale_java_checkstyle_config* + *b:ale_java_checkstyle_config* + + Type: |String| + Default: `'/google_checks.xml'` + + A path to a checkstyle configuration file. + + If a configuration file is specified with |g:ale_java_checkstyle_options|, + it will be preferred over this setting. + + The path to the configuration file can be an absolute path or a relative + path. ALE will search for the relative path in parent directories. + + +g:ale_java_checkstyle_executable *g:ale_java_checkstyle_executable* + *b:ale_java_checkstyle_executable* + + Type: |String| + Default: 'checkstyle' + + This variable can be changed to modify the executable used for checkstyle. + + g:ale_java_checkstyle_options *g:ale_java_checkstyle_options* *b:ale_java_checkstyle_options* - Type: String - Default: '-c /google_checks.xml' + Type: |String| + Default: `''` This variable can be changed to modify flags given to checkstyle. + If a configuration file is specified with `-c`, it will be used instead of + configuration files set with |g:ale_java_checkstyle_config|. + =============================================================================== javac *ale-java-javac* g:ale_java_javac_classpath *g:ale_java_javac_classpath* *b:ale_java_javac_classpath* - Type: |String| + Type: |String| or |List| Default: `''` This variable can be set to change the global classpath for Java. @@ -40,6 +67,30 @@ g:ale_java_javac_options *g:ale_java_javac_options* This variable can be set to pass additional options to javac. +g:ale_java_javac_sourcepath *g:ale_java_javac_sourcepath* + *b:ale_java_javac_sourcepath* + Type: |String| or |List| + Default: `''` + +This variable can set multiple source code paths, the source code path is a +relative path (relative to the project root directory). + +Example: + +String type: +Note that the unix system separator is a colon(`:`) window system +is a semicolon(`;`). +> + let g:ale_java_javac_sourcepath = 'build/gen/source/xx/main:build/gen/source' +< +List type: +> + let g:ale_java_javac_sourcepath = [ + \ 'build/generated/source/querydsl/main', + \ 'target/generated-sources/source/querydsl/main' + \ ] +< + =============================================================================== google-java-format *ale-java-google-java-format* @@ -80,27 +131,141 @@ javalsp *ale-java-javalsp* To enable Java LSP linter you need to download and build the vscode-javac language server from https://github.com/georgewfraser/java-language-server. -Simply download the source code and then build a distribution: - scripts/link_mac.sh +Before building the language server you need to install pre-requisites: npm, +maven, and protobuf. You also need to have Java 13 and JAVA_HOME properly +set. -or +After downloading the source code and installing all pre-requisites you can +build the language server with the included build.sh script: - scripts/link_windows.sh + scripts/build.sh -This generates a dist/mac or dist/windows directory that contains the -language server. To let ALE use this language server you need to set the -g:ale_java_javalsp_executable variable to the absolute path of the java -executable in this directory. +This will create launch scripts for Linux, Mac, and Windows in the dist folder +within the repo: + + - lang_server_linux.sh + - lang_server_mac.sh + - lang_server_windows.sh + +To let ALE use this language server you need to set the +g:ale_java_javalsp_executable variable to the absolute path of the launcher +executable for your platform. g:ale_java_javalsp_executable *g:ale_java_javalsp_executable* *b:ale_java_javalsp_executable* Type: |String| + Default: `''` + +This variable must be set to the absolute path of the language server launcher +executable. For example: +> + let g:ale_java_javalsp_executable=/java-language-server/dist/lang_server_linux.sh +< + +g:ale_java_javalsp_config *g:ale_java_javalsp_config* + *b:ale_java_javalsp_config* + Type: |Dictionary| + Default: `{}` + +The javalsp linter automatically detects external depenencies for Maven and +Gradle projects. In case the javalsp fails to detect some of them, you can +specify them setting a dictionary to |g:ale_java_javalsp_config| variable. +> + let g:ale_java_javalsp_config = + \ { + \ 'java': { + \ 'externalDependencies': [ + \ 'junit:junit:jar:4.12:test', " Maven format + \ 'junit:junit:4.1' " Gradle format + \ ], + \ 'classPath': [ + \ 'lib/some-dependency.jar', + \ '/android-sdk/platforms/android-28.jar' + \ ] + \ } + \ } + +The Java language server will look for the dependencies you specify in +`externalDependencies` array in your Maven and Gradle caches ~/.m2 and +~/.gradle. + +=============================================================================== +eclipselsp *ale-java-eclipselsp* + +To enable Eclipse JDT LSP linter you need to clone and build the eclipse.jdt.ls +language server from https://github.com/eclipse/eclipse.jdt.ls. Simply +clone the source code repo and then build the plugin: + + ./mvnw clean verify + +Note: currently, the build can only run when launched with JDK 11. More +recent versions can be used to run the server though. + +After build completes the files required to run the language server will be +located inside the repository folder `eclipse.jdt.ls`. Please ensure to set +|g:ale_java_eclipselsp_path| to the absolute path of that folder. + +You could customize compiler options and code assists of the server. +Under your project folder, modify the file `.settings/org.eclipse.jdt.core.prefs` +with options presented at +https://help.eclipse.org/neon/topic/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/JavaCore.html. + +g:ale_java_eclipselsp_path *g:ale_java_eclipselsp_path* + *b:ale_java_eclipselsp_path* + + Type: |String| + Default: `'$HOME/eclipse.jdt.ls'` + + Absolute path to the location of the eclipse.jdt.ls repository folder. Or if + you have VSCode extension installed the absolute path to the VSCode extensions + folder (e.g. $HOME/.vscode/extensions/redhat.java-0.4x.0 in Linux). + + +g:ale_java_eclipselsp_executable *g:ale_java_eclipse_executable* + *b:ale_java_eclipse_executable* + Type: |String| Default: `'java'` -This variable can be changed to use a different executable for java. + This variable can be set to change the executable path used for java. +g:ale_java_eclipselsp_config_path *g:ale_java_eclipse_config_path* + *b:ale_java_eclipse_config_path* + Type: |String| + Default: `''` + + Set this variable to change the configuration directory path used by + eclipselsp (e.g. `$HOME/.jdtls` in Linux). + By default ALE will attempt to use the configuration within the installation + directory. + This setting is particularly useful when eclipselsp is installed in a + non-writable directory like `/usr/share/java/jdtls`, as is the case when + installed via system package. + + +g:ale_java_eclipselsp_workspace_path *g:ale_java_eclipselsp_workspace_path* + *b:ale_java_eclipselsp_workspace_path* + + Type: |String| + Default: `''` + + If you have Eclipse installed is good idea to set this variable to the + absolute path of the Eclipse workspace. If not set this value will be set to + the parent folder of the project root. + +g:ale_java_eclipselsp_javaagent *g:ale_java_eclipselsp_javaagent* + *b:ale_java_eclipselsp_javaagent* + + Type: |String| + Default: `''` + + A variable to add java agent for annotation processing such as Lombok. + If you have multiple java agent files, use space to separate them. For example: +> + let g:ale_java_eclipselsp_javaagent='/eclipse/lombok.jar /eclipse/jacoco.jar' +< + =============================================================================== uncrustify *ale-java-uncrustify* diff --git a/sources_non_forked/ale/doc/ale-javascript.txt b/sources_non_forked/ale/doc/ale-javascript.txt index 53a70fd7..acd886c9 100644 --- a/sources_non_forked/ale/doc/ale-javascript.txt +++ b/sources_non_forked/ale/doc/ale-javascript.txt @@ -23,6 +23,11 @@ To this: > /path/foo/bar/.eslintrc.js # extends: ["/path/foo/.base-eslintrc.js"] < +=============================================================================== +deno *ale-javascript-deno* + +Check the docs over at |ale-typescript-deno|. + =============================================================================== eslint *ale-javascript-eslint* @@ -73,6 +78,33 @@ g:ale_javascript_eslint_suppress_missing_config configuration files are found. +=============================================================================== +fecs *ale-javascript-fecs* + +`fecs` is a lint tool for HTML/CSS/JavaScript, can be installed via: + + `$ npm install --save-dev fecs` + +And the configuration file is located at `./fecsrc`, see http://fecs.baidu.com +for more options. + + +g:ale_javascript_fecs_executable *g:ale_javascript_fecs_executable* + *b:ale_javascript_fecs_executable* + Type: |String| + Default: `'fecs'` + + See |ale-integrations-local-executables| + + +g:ale_javascript_fecs_use_global *g:ale_javascript_fecs_use_global* + *b:ale_javascript_fecs_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== flow *ale-javascript-flow* @@ -111,7 +143,7 @@ g:ale_javascript_flow_use_respect_pragma By default, ALE will use the `--respect-pragma` option for `flow`, so only files with the `@flow` pragma are checked by ALE. This option can be set to - `0` to disable that behaviour, so all files can be checked by `flow`. + `0` to disable that behavior, so all files can be checked by `flow`. =============================================================================== diff --git a/sources_non_forked/ale/doc/ale-json.txt b/sources_non_forked/ale/doc/ale-json.txt index 96499a04..ad0a05b1 100644 --- a/sources_non_forked/ale/doc/ale-json.txt +++ b/sources_non_forked/ale/doc/ale-json.txt @@ -2,6 +2,15 @@ ALE JSON Integration *ale-json-options* +=============================================================================== +eslint *ale-json-eslint* + +The `eslint` linter for JSON uses the JavaScript options for `eslint`; see: +|ale-javascript-eslint|. + +You will need a JSON ESLint plugin installed for this to work. + + =============================================================================== fixjson *ale-json-fixjson* @@ -101,5 +110,37 @@ prettier *ale-json-prettier* See |ale-javascript-prettier| for information about the available options. +=============================================================================== +spectral *ale-json-spectral* + +Website: https://github.com/stoplightio/spectral + +Installation +------------------------------------------------------------------------------- + +Install spectral either globally or locally: > + + npm install @stoplight/spectral -g # global + npm install @stoplight/spectral # local +< + +Options +------------------------------------------------------------------------------- + +g:ale_json_spectral_executable *g:ale_json_spectral_executable* + *b:ale_json_spectral_executable* + Type: |String| + Default: `'spectral'` + + This variable can be set to change the path to spectral. + +g:ale_json_spectral_use_global *g:ale_json_spectral_use_global* + *b:ale_json_spectral_use_global* + Type: |String| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-json5.txt b/sources_non_forked/ale/doc/ale-json5.txt new file mode 100644 index 00000000..bafa60d1 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-json5.txt @@ -0,0 +1,15 @@ +=============================================================================== +ALE JSON5 Integration *ale-json5-options* + + +=============================================================================== +eslint *ale-json5-eslint* + +The `eslint` linter for JSON uses the JavaScript options for `eslint`; see: +|ale-javascript-eslint|. + +You will need a JSON5 ESLint plugin installed for this to work. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-jsonc.txt b/sources_non_forked/ale/doc/ale-jsonc.txt new file mode 100644 index 00000000..92247cd4 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-jsonc.txt @@ -0,0 +1,15 @@ +=============================================================================== +ALE JSONC Integration *ale-jsonc-options* + + +=============================================================================== +eslint *ale-jsonc-eslint* + +The `eslint` linter for JSON uses the JavaScript options for `eslint`; see: +|ale-javascript-eslint|. + +You will need a JSONC ESLint plugin installed for this to work. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-jsonnet.txt b/sources_non_forked/ale/doc/ale-jsonnet.txt new file mode 100644 index 00000000..f99d415f --- /dev/null +++ b/sources_non_forked/ale/doc/ale-jsonnet.txt @@ -0,0 +1,43 @@ +=============================================================================== +ALE Jsonnet Integration *ale-jsonnet-options* + + +=============================================================================== +jsonnetfmt *ale-jsonnet-jsonnetfmt* + +g:ale_jsonnet_jsonnetfmt_executable *g:ale_jsonnet_jsonnetfmt_executable* + *b:ale_jsonnet_jsonnetfmt_executable* + Type: |String| + Default: `'jsonnetfmt'` + + This option can be changed to change the path for `jsonnetfmt`. + + +g:ale_jsonnet_jsonnetfmt_options *g:ale_jsonnet_jsonnetfmt_options* + *b:ale_jsonnet_jsonnetfmt_options* + Type: |String| + Default: `''` + + This option can be changed to pass extra options to `jsonnetfmt`. + + +=============================================================================== +jsonnet-lint *ale-jsonnet-jsonnet-lint* + +g:ale_jsonnet_jsonnet_lint_executable *g:ale_jsonnet_jsonnet_lint_executable* + *b:ale_jsonnet_jsonnet_lint_executable* + Type: |String| + Default: `'jsonnet-lint'` + + This option can be changed to change the path for `jsonnet-lint`. + + +g:ale_jsonnet_jsonnet_lint_options *g:ale_jsonnet_jsonnet_lint_options* + *b:ale_jsonnet_jsonnet_lint_options* + Type: |String| + Default: `''` + + This option can be changed to pass extra options to `jsonnet-lint`. + + + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-lua.txt b/sources_non_forked/ale/doc/ale-lua.txt index f1286f89..ac92b9ac 100644 --- a/sources_non_forked/ale/doc/ale-lua.txt +++ b/sources_non_forked/ale/doc/ale-lua.txt @@ -1,6 +1,24 @@ =============================================================================== ALE Lua Integration *ale-lua-options* +=============================================================================== +lua-format *ale-lua-lua-format* + +g:ale_lua_lua_format_executable *g:ale_lua_lua_format_executable* + *b:ale_lua_lua_format_executable* + Type: |String| + Default: `'lua-format'` + + This variable can be changed to change the path to lua-format. + +g:ale_lua_lua_format_options *g:ale_lua_lua_format_options* + *b:ale_lua_lua_format_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to lua-format. + + =============================================================================== luac *ale-lua-luac* @@ -30,5 +48,41 @@ g:ale_lua_luacheck_options *g:ale_lua_luacheck_options* This variable can be set to pass additional options to luacheck. +=============================================================================== +luafmt *ale-lua-luafmt* + +g:ale_lua_luafmt_executable *g:ale_lua_luafmt_executable* + *b:ale_lua_luafmt_executable* + Type: |String| + Default: `'luafmt'` + + This variable can be set to use a different executable for luafmt. + +g:ale_lua_luafmt_options *g:ale_lua_luafmt_options* + *b:ale_lua_luafmt_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the luafmt fixer. + + +=============================================================================== +stylua *ale-lua-stylua* + +g:ale_lua_stylua_executable *g:ale_lua_stylua_executable* + *b:ale_lua_stylua_executable* + Type: |String| + Default: `'stylua'` + + This variable can be set to use a different executable for stylua. + +g:ale_lua_stylua_options *g:ale_lua_stylua_options* + *b:ale_lua_stylua_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the stylua fixer. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-markdown.txt b/sources_non_forked/ale/doc/ale-markdown.txt index 4e27eb91..feb37fc9 100644 --- a/sources_non_forked/ale/doc/ale-markdown.txt +++ b/sources_non_forked/ale/doc/ale-markdown.txt @@ -2,6 +2,17 @@ ALE Markdown Integration *ale-markdown-options* +=============================================================================== +markdownlint *ale-markdown-markdownlint* + +g:ale_markdown_markdownlint_options *g:ale_markdown_markdownlint_options* + *b:ale_markdown_markdownlint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to markdownlint. + + =============================================================================== mdl *ale-markdown-mdl* @@ -22,6 +33,25 @@ g:ale_markdown_mdl_options *g:ale_markdown_mdl_options* This variable can be set to pass additional options to mdl. +=============================================================================== +pandoc *ale-markdown-pandoc* + +g:ale_markdown_pandoc_executable *g:ale_markdown_pandoc_executable* + *b:ale_markdown_pandoc_executable* + Type: |String| + Default: `'pandoc'` + + This variable can be set to specify where to find the pandoc executable + + +g:ale_markdown_pandoc_options *g:ale_markdown_pandoc_options* + *b:ale_markdown_pandoc_options* + Type: |String| + Default: `'-f gfm -t gfm -s -'` + + This variable can be set to change the default options passed to pandoc + + =============================================================================== prettier *ale-markdown-prettier* diff --git a/sources_non_forked/ale/doc/ale-nim.txt b/sources_non_forked/ale/doc/ale-nim.txt new file mode 100644 index 00000000..8985aeb8 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-nim.txt @@ -0,0 +1,45 @@ +=============================================================================== +ALE Nim Integration *ale-nim-options* + + +=============================================================================== +nimcheck *ale-nim-nimcheck* + + ALE does not provide additional configuration options for `nimcheck` at this + point. + + +=============================================================================== +nimlsp *ale-nim-nimlsp* + +g:nim_nimlsp_nim_sources *g:nim_nimlsp_nim_sources* + + Type: |String| + Default: `''` + + Sets the path to Nim source repository as the first argument to `nimlsp` + command. + + +=============================================================================== +nimpretty *ale-nim-nimpretty* + + +g:ale_nim_nimpretty_executable *g:ale_nim_nimpretty_executable* + *b:ale_nim_nimpretty_executable* + Type: |String| + Default: `'nimpretty'` + + This variable can be changed to use a different executable for nimpretty. + + +g:ale_nim_nimpretty_options *g:ale_nim_nimpretty_options* + *b:ale_nim_nimpretty_options* + Type: |String| + Default: `'--maxLineLen:80'` + + This variable can be changed to modify flags given to nimpretty. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-nix.txt b/sources_non_forked/ale/doc/ale-nix.txt new file mode 100644 index 00000000..c38b93db --- /dev/null +++ b/sources_non_forked/ale/doc/ale-nix.txt @@ -0,0 +1,42 @@ +=============================================================================== +ALE Nix Integration *ale-nix-options* + + +=============================================================================== +nixfmt *ale-nix-nixfmt* + +g:ale_nix_nixfmt_executable *g:ale_nix_nixfmt_executable* + *b:ale_nix_nixfmt_executable* + Type: String + Default: 'nixfmt' + + This variable sets the executable used for nixfmt. + +g:ale_nix_nixfmt_options *g:ale_nix_nixfmt_options* + *b:ale_nix_nixfmt_options* + Type: String + Default: '' + + This variable can be set to pass additional options to the nixfmt fixer. + + +=============================================================================== +nixpkgs-fmt *ale-nix-nixpkgs-fmt* + +g:ale_nix_nixpkgsfmt_executable *g:ale_nix_nixpkgsfmt_executable* + *b:ale_nix_nixpkgsfmt_executable* + Type: |String| + Default: `'nixpkgs-fmt'` + + This variable sets executable used for nixpkgs-fmt. + +g:ale_nix_nixpkgsfmt_options *g:ale_nix_nixpkgsfmt_options* + *b:ale_nix_nixpkgsfmt_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the nixpkgs-fmt fixer. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-ocaml.txt b/sources_non_forked/ale/doc/ale-ocaml.txt index adf17716..afbc2386 100644 --- a/sources_non_forked/ale/doc/ale-ocaml.txt +++ b/sources_non_forked/ale/doc/ale-ocaml.txt @@ -10,6 +10,21 @@ merlin *ale-ocaml-merlin* detailed instructions (https://github.com/the-lambda-church/merlin/wiki/vim-from-scratch). +=============================================================================== +ocamllsp *ale-ocaml-ocamllsp* + + The `ocaml-lsp-server` is the official OCaml implementation of the Language + Server Protocol. See the installation instructions: + https://github.com/ocaml/ocaml-lsp#installation + +g:ale_ocaml_ocamllsp_use_opam *g:ale_ocaml_ocamllsp_use_opam* + *b:ale_ocaml_ocamllsp_use_opam* + Type: |Number| + Default: `get(g:, 'ale_ocaml_ocamllsp_use_opam', 1)` + + This variable can be set to change whether or not opam is used to execute + the language server. + =============================================================================== ols *ale-ocaml-ols* @@ -50,5 +65,33 @@ g:ale_ocaml_ocamlformat_options *g:ale_ocaml_ocamlformat_options* This variable can be set to pass additional options to the ocamlformat fixer. +=============================================================================== +ocp-indent *ale-ocaml-ocp-indent* + +g:ale_ocaml_ocp_indent_executable *g:ale_ocaml_ocp_indent_executable* + *b:ale_ocaml_ocp_indent_executable* + Type: |String| + Default: `ocp-indent` + + This variable can be set to pass the path of the ocp-indent. + +g:ale_ocaml_ocp_indent_options *g:ale_ocaml_ocp_indent_options* + *b:ale_ocaml_ocp_indent_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the ocp-indent. + +g:ale_ocaml_ocp_indent_config *g:ale_ocaml_ocp_indent_config* + *b:ale_ocaml_ocp_indent_config* + Type: |String| + Default: `''` + + This variable can be set to pass additional config to the ocp-indent. + Expand after "--config=". + + "ocp-indent" can also be enabled from ocamlformat config. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-openapi.txt b/sources_non_forked/ale/doc/ale-openapi.txt new file mode 100644 index 00000000..1fc41add --- /dev/null +++ b/sources_non_forked/ale/doc/ale-openapi.txt @@ -0,0 +1,74 @@ +=============================================================================== +ALE OpenApi Integration *ale-openapi-options* + +=============================================================================== +ibm_validator *ale-openapi-ibm-validator* + +Website: https://github.com/IBM/openapi-validator + + +Installation +------------------------------------------------------------------------------- + +Install ibm-openapi-validator either globally or locally: > + + npm install ibm-openapi-validator -g # global + npm install ibm-openapi-validator # local +< +Configuration +------------------------------------------------------------------------------- + +OpenAPI files can be written in YAML or JSON so in order for ALE plugins to +work with these files we must set the buffer |filetype| to either |openapi.yaml| +or |openapi.json| respectively. This causes ALE to lint the file with linters +configured for openapi and yaml files or openapi and json files respectively. + +For example setting filetype to |openapi.yaml| on a buffer and the following +|g:ale_linters| configuration will enable linting of openapi files using both +|ibm_validator| and |yamlint|: + +> + let g:ale_linters = { + \ 'yaml': ['yamllint'], + \ 'openapi': ['ibm_validator'] + \} +< + +The following plugin will detect openapi files automatically and set the +filetype to |openapi.yaml| or |openapi.json|: + + https://github.com/hsanson/vim-openapi + +Options +------------------------------------------------------------------------------- + +g:ale_openapi_ibm_validator_executable *g:ale_openapi_ibm_validator_executable* + *b:ale_openapi_ibm_validator_executable* + Type: |String| + Default: `'lint-openapi'` + + This variable can be set to change the path to lint-openapi. + + +g:ale_openapi_ibm_validator_options *g:ale_openapi_ibm_validator_options* + *b:ale_openapi_ibm_validator_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to lint-openapi. + + +=============================================================================== +prettier *ale-openapi-prettier* + +See |ale-javascript-prettier| for information about the available options. + + +=============================================================================== +yamllint *ale-openapi-yamllint* + +See |ale-yaml-yamllint| for information about the available options. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-pascal.txt b/sources_non_forked/ale/doc/ale-pascal.txt new file mode 100644 index 00000000..03d9a004 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-pascal.txt @@ -0,0 +1,24 @@ +=============================================================================== +ALE Pascal Integration *ale-pascal-options* + +=============================================================================== +ptop *ale-pascal-ptop* + +g:ale_pascal_ptop_executable *g:ale_pascal_ptop_executable* + *b:ale_pascal_ptop_executable* + Type: |String| + Default: `'ptop'` + + This variable can be changed to specify the ptop executable. + + +g:ale_pascal_ptop_options *g:ale_pascal_ptop_options* + *b:ale_pascal_ptop_options* + Type: |String| + Default: `''` + +This variable can be set to pass additional options to the ptop fixer. + + +=============================================================================== +vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-php.txt b/sources_non_forked/ale/doc/ale-php.txt index 83bc0fd5..4ee016fb 100644 --- a/sources_non_forked/ale/doc/ale-php.txt +++ b/sources_non_forked/ale/doc/ale-php.txt @@ -85,6 +85,14 @@ g:ale_php_phpcbf_use_global *g:ale_php_phpcbf_use_global* See |ale-integrations-local-executables| +g:ale_php_phpcbf_options *g:ale_php_phpcbf_options* + *b:ale_php_phpcbf_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to php-cbf + + =============================================================================== phpcs *ale-php-phpcs* @@ -154,11 +162,13 @@ g:ale_php_phpstan_executable *g:ale_php_phpstan_executable* g:ale_php_phpstan_level *g:ale_php_phpstan_level* *b:ale_php_phpstan_level* - Type: |Number| - Default: `4` + Type: |String| + Default: `''` - This variable controls the rule levels. 0 is the loosest and 4 is the - strictest. + This variable controls the rule levels. 0 is the loosest and 7 is the + strictest. If this option isn't set, the rule level will be controlled by + the configuration file. If no configuration file can be detected, `'7'` will + be used instead. g:ale_php_phpstan_configuration *g:ale_php_phpstan_configuration* @@ -169,6 +179,14 @@ g:ale_php_phpstan_configuration *g:ale_php_phpstan_configuration* This variable sets path to phpstan configuration file. +g:ale_php_phpstan_autoload *g:ale_php_phpstan_autoload* + *b:ale_php_phpstan_autoload* + Type: |String| + Default: `''` + + This variable sets path to phpstan autoload file. + + =============================================================================== psalm *ale-php-psalm* @@ -179,39 +197,124 @@ g:ale_php_psalm_executable *g:ale_php_psalm_executable* This variable sets the executable used for psalm. -=============================================================================== -php-cs-fixer *ale-php-php-cs-fixer* -g:ale_php_cs_fixer_executable *g:ale_php_cs_fixer_executable* - *b:ale_php_cs_fixer_executable* +g:ale_php_psalm_options *g:ale_php_psalm_options* + *b:ale_php_psalm_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to psalm. + + +g:ale_php_psalm_use_global *g:ale_php_psalm_use_global* + *b:ale_php_psalm_use_global* + Type: |Boolean| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + +=============================================================================== +php-cs-fixer *ale-php-php-cs-fixer* + +g:ale_php_cs_fixer_executable *g:ale_php_cs_fixer_executable* + *b:ale_php_cs_fixer_executable* Type: |String| Default: `'php-cs-fixer'` This variable sets executable used for php-cs-fixer. -g:ale_php_cs_fixer_use_global *g:ale_php_cs_fixer_use_global* - *b:ale_php_cs_fixer_use_global* - Type: |Boolean| - Default: `get(g:, 'ale_use_global_executables', 0)` - This variable force globally installed fixer. - -g:ale_php_cs_fixer_options *g:ale_php_cs_fixer_options* - *b:ale_php_cs_fixer_options* +g:ale_php_cs_fixer_options *g:ale_php_cs_fixer_options* + *b:ale_php_cs_fixer_options* Type: |String| Default: `''` This variable can be set to pass additional options to php-cs-fixer. -=============================================================================== -php *ale-php-php* -g:ale_php_php_executable *g:ale_php_php_executable* - *b:ale_php_php_executable* +g:ale_php_cs_fixer_use_global *g:ale_php_cs_fixer_use_global* + *b:ale_php_cs_fixer_use_global* + Type: |Boolean| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + +=============================================================================== +php *ale-php-php* + +g:ale_php_php_executable *g:ale_php_php_executable* + *b:ale_php_php_executable* Type: |String| Default: `'php'` This variable sets the executable used for php. + +=============================================================================== +tlint *ale-php-tlint* + +g:ale_php_tlint_executable *g:ale_php_tlint_executable* + *b:ale_php_tlint_executable* + Type: |String| + Default: `'tlint'` + + See |ale-integrations-local-executables| + + +g:ale_php_tlint_use_global *g:ale_php_tlint_use_global* + *b:ale_php_tlint_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + +g:ale_php_tlint_options *g:ale_php_tlint_options* + *b:ale_php_tlint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to tlint + + +=============================================================================== +intelephense *ale-php-intelephense* + +g:ale_php_intelephense_executable *g:ale_php_intelephense_executable* + *b:ale_php_intelephense_executable* + Type: |String| + Default: `'intelephense'` + + The variable can be set to configure the executable that will be used for + running the intelephense language server. `node_modules` directory + executable will be preferred instead of this setting if + |g:ale_php_intelephense_use_global| is `0`. + + See: |ale-integrations-local-executables| + + +g:ale_php_intelephense_use_global *g:ale_php_intelephense_use_global* + *b:ale_php_intelephense_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + This variable can be set to `1` to force the language server to be run with + the executable set for |g:ale_php_intelephense_executable|. + + See: |ale-integrations-local-executables| + + +g:ale_php_intelephense_config *g:ale_php_intelephense_config* + *b:ale_php_intelephense_config* + Type: |Dictionary| + Default: `{}` + + The initialization options config specified by Intelephense. Refer to the + installation docs provided by intelephense (github.com/bmewburn/intelephense + -docs). + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-powershell.txt b/sources_non_forked/ale/doc/ale-powershell.txt new file mode 100644 index 00000000..485c9bd0 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-powershell.txt @@ -0,0 +1,70 @@ +=============================================================================== +ALE PowerShell Integration *ale-powershell-options* + + +=============================================================================== +powershell *ale-powershell-powershell* + +g:ale_powershell_powershell_executable *g:ale_powershell_powershell_executable* + *b:ale_powershell_powershell_executable* + Type: String + Default: `'pwsh'` + + This variable can be changed to use a different executable for powershell. + +> + " Use powershell.exe rather than the default pwsh + let g:ale_powershell_powershell_executable = 'powershell.exe' +> + +=============================================================================== +psscriptanalyzer *ale-powershell-psscriptanalyzer* + +Installation +------------------------------------------------------------------------------- + +Install PSScriptAnalyzer by any means, so long as it can be automatically +imported in PowerShell. + +g:ale_powershell_psscriptanalyzer_executable +*g:ale_powershell_psscriptanalyzer_executable* + *b:ale_powershell_psscriptanalyzer_executable* + Type: |String| + Default: `'pwsh'` + + This variable sets executable used for powershell. + + For example, on Windows you could set powershell to be Windows Powershell: +> + let g:ale_powershell_psscriptanalyzer_executable = 'powershell.exe' +< + +g:ale_powershell_psscriptanalyzer_module +*g:ale_powershell_psscriptanalyzer_module* + *b:ale_powershell_psscriptanalyzer_module* + Type: |String + Default: `'psscriptanalyzer'` + + This variable sets the name of the psscriptanalyzer module. + for psscriptanalyzer invocation. + + +g:ale_powershell_psscriptanalyzer_exclusions +*g:ale_powershell_psscriptanalyzer_exclusions* + *b:ale_powershell_psscriptanalyzer_exclusions* + Type: |String| + Default: `''` + + Set this variable to exclude test(s) for psscriptanalyzer + (-ExcludeRule option). To exclude more than one option, separate them with + commas. + +> + " Suppress Write-Host and Global vars warnings + let g:ale_powershell_psscriptanalyzer_exclusions = + \ 'PSAvoidUsingWriteHost,PSAvoidGlobalVars' +< + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-proto.txt b/sources_non_forked/ale/doc/ale-proto.txt index 734e23d5..8ab56a14 100644 --- a/sources_non_forked/ale/doc/ale-proto.txt +++ b/sources_non_forked/ale/doc/ale-proto.txt @@ -5,14 +5,15 @@ ALE Proto Integration *ale-proto-options =============================================================================== Integration Information -Linting of `.proto` files requires that the `protoc` binary is installed in the -system path and that the `protoc-gen-lint` plugin for the `protoc` binary is also -installed. - To enable `.proto` file linting, update |g:ale_linters| as appropriate: > " Enable linter for .proto files - let g:ale_linters = {'proto': ['protoc-gen-lint']} + let g:ale_linters = {'proto': ['protoc-gen-lint', 'protolint']} + +To enable `.proto` file fixing, update |g:ale_fixers| as appropriate: +> + " Enable linter for .proto files + let b:ale_fixers = {'proto': ['protolint']} < =============================================================================== protoc-gen-lint *ale-proto-protoc-gen-lint* @@ -29,5 +30,31 @@ g:ale_proto_protoc_gen_lint_options *g:ale_proto_protoc_gen_lint_options* directory of the linted file is always passed as an include path with '-I' before any user-supplied options. +=============================================================================== +protolint *ale-proto-protolint* + + The linter is a pluggable tool that doesn't depend on the `protoc` binary. + This supports both linting and fixing. + Make sure the binary is available in the system path, or set + ale_proto_protolint_executable. + Note that the binary with v0.22.0 or above is supported. + +g:ale_proto_protolint_executable *g:ale_proto_protolint_executable* + + Type: |String| + Default: 'protolint' + + This variable can be changed to modify the executable used for protolint. + +g:ale_proto_protolint_config *g:ale_proto_protolint_config* + + Type: |String| + Default: `''` + + A path to a protolint configuration file. + + The path to the configuration file can be an absolute path or a relative + path. ALE will search for the relative path in parent directories. + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-purescript.txt b/sources_non_forked/ale/doc/ale-purescript.txt new file mode 100644 index 00000000..91bef558 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-purescript.txt @@ -0,0 +1,69 @@ +=============================================================================== +ALE PureScript Integration *ale-purescript-options* + + +=============================================================================== +purescript-language-server *ale-purescript-language-server* + +PureScript Language Server + (https://github.com/nwolverson/purescript-language-server) + +g:ale_purescript_ls_executable g:ale_purescript_ls_executable + b:ale_purescript_ls_executable + Type: |String| + Default: `'purescript-language-server'` + + PureScript language server executable. + +g:ale_purescript_ls_config g:ale_purescript_ls_config + b:ale_purescript_ls_config + Type: |Dictionary| + Default: `{}` + + Dictionary containing configuration settings that will be passed to the + language server. For example, with a spago project: + { + \ 'purescript': { + \ 'addSpagoSources': v:true, + \ 'addNpmPath': v:true, + \ 'buildCommand': 'spago --quiet build --purs-args --json-errors' + \ } + \} +=============================================================================== +purs-tidy *ale-purescript-tidy* + +g:ale_purescript_tidy_executable *g:ale_purescript_tidy_executable* + *b:ale_purescript_tidy_executable* + Type: |String| + Default: `'purs-tidy'` + + This variable can be changed to use a different executable for purs-tidy. + +g:ale_purescript_tidy_use_global *g:ale_purescript_tidy_use_global* + *b:ale_purescript_tidy_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + +g:ale_purescript_tidy_options *g:ale_purescript_tidy_options* + *b:ale_purescript_tidy_options* + Type: String + Default: `''` + + This variable can be set to pass in additional option to the 'purs-tidy' + executable. +> + let g:ale_purescript_options = '--indent 3' +< +=============================================================================== +purty *ale-purescript-purty* + +g:ale_purescript_purty_executable *g:ale_purescript_purty_executable* + *b:ale_purescript_purty_executable* + Type: |String| + Default: `'purty'` + + This variable can be changed to use a different executable for purty. +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-python.txt b/sources_non_forked/ale/doc/ale-python.txt index dd946ad4..10cc2897 100644 --- a/sources_non_forked/ale/doc/ale-python.txt +++ b/sources_non_forked/ale/doc/ale-python.txt @@ -10,6 +10,14 @@ g:ale_python_auto_pipenv *g:ale_python_auto_pipenv* 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_auto_poetry *g:ale_python_auto_poetry* + *b:ale_python_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. + =============================================================================== ALE Python Project Root Behavior *ale-python-root* @@ -27,20 +35,78 @@ ALE will look for configuration files with the following filenames. > setup.cfg pytest.ini tox.ini + .pyre_configuration.local mypy.ini pycodestyle.cfg - flake8.cfg + .flake8 .flake8rc pylama.ini pylintrc .pylintrc Pipfile Pipfile.lock + poetry.lock + pyproject.toml + .tool-versions < The first directory containing any of the files named above will be used. +=============================================================================== +autoflake *ale-python-autoflake* + +g:ale_python_autoflake_executable *g:ale_python_autoflake_executable* + *b:ale_python_autoflake_executable* + Type: |String| + Default: `'autoflake'` + + See |ale-integrations-local-executables| + + +g:ale_python_autoflake_options *g:ale_python_autoflake_options* + *b:ale_python_autoflake_options* + Type: |String| + Default: `''` + + This variable can be set to pass extra options to autoflake. + + +g:ale_python_autoflake_use_global *g:ale_python_autoflake_use_global* + *b:ale_python_autoflake_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + +=============================================================================== +autoimport *ale-python-autoimport* + +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* + 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* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== autopep8 *ale-python-autopep8* @@ -79,6 +145,7 @@ g:ale_python_bandit_executable *g:ale_python_bandit_executable* See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `bandit'`. + Set this to `'poetry'` to invoke `'poetry` `run` `bandit'`. g:ale_python_bandit_options *g:ale_python_bandit_options* @@ -118,6 +185,15 @@ g:ale_python_bandit_auto_pipenv *g:ale_python_bandit_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_bandit_auto_poetry *g:ale_python_bandit_auto_poetry* + *b:ale_python_bandit_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. + + =============================================================================== black *ale-python-black* @@ -145,14 +221,22 @@ g:ale_python_black_use_global *g:ale_python_black_use_global* See |ale-integrations-local-executables| -g:ale_python_black_auto_pipenv *g:ale_python_black_auto_pipenv* - *b:ale_python_black_auto_pipenv* +g:ale_python_black_auto_pipenv *g:ale_python_black_auto_pipenv* + *b:ale_python_black_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_black_auto_poetry *g:ale_python_black_auto_poetry* + *b:ale_python_black_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. + g:ale_python_black_change_directory *g:ale_python_black_change_directory* *b:ale_python_black_change_directory* Type: |Number| @@ -169,13 +253,14 @@ flake8 *ale-python-flake8* g:ale_python_flake8_change_directory *g:ale_python_flake8_change_directory* *b:ale_python_flake8_change_directory* - Type: |Number| - Default: `1` + Type: |String| + Default: `project` - If set to `1`, ALE will switch to the directory the Python file being - checked with `flake8` is in before checking it. This helps `flake8` find - configuration files more easily. This option can be turned off if you want - to control the directory Python is executed from yourself. + If set to `project`, ALE will switch to the project root before checking file. + If set to `file`, ALE will switch to directory the Python file being + checked with `flake8` is in before checking it. + You can turn it off with `off` option if you want to control the directory + Python is executed from yourself. g:ale_python_flake8_executable *g:ale_python_flake8_executable* @@ -184,7 +269,8 @@ g:ale_python_flake8_executable *g:ale_python_flake8_executable* Default: `'flake8'` This variable can be changed to modify the executable used for flake8. Set - this to `'pipenv'` to invoke `'pipenv` `run` `flake8'`. + this to `'pipenv'` to invoke `'pipenv` `run` `flake8'`. Set this to + `'poetry'` to invoke `'poetry` `run` `flake8'`. g:ale_python_flake8_options *g:ale_python_flake8_options* @@ -226,6 +312,78 @@ g:ale_python_flake8_auto_pipenv *g:ale_python_flake8_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_flake8_auto_poetry *g:ale_python_flake8_auto_poetry* + *b:ale_python_flake8_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. + +=============================================================================== +flakehell *ale-python-flakehell* + +g:ale_python_flakehell_change_directory*g:ale_python_flakehell_change_directory* + *b:ale_python_flakehell_change_directory* + Type: |String| + Default: `project` + + If set to `project`, ALE will switch to the project root before checking file. + If set to `file`, ALE will switch to directory the Python file being + checked with `flakehell` is in before checking it. + You can turn it off with `off` option if you want to control the directory + Python is executed from yourself. + + +g:ale_python_flakehell_executable *g:ale_python_flakehell_executable* + *b:ale_python_flakehell_executable* + Type: |String| + Default: `'flakehell'` + + This variable can be changed to modify the executable used for flakehell. Set + this to `'pipenv'` to invoke `'pipenv` `run` `flakehell'`. Set this to + `'poetry'` to invoke `'poetry` `run` `flakehell'`. Set this to `'python'` to + invoke `'python` `-m` `flakehell'`. + + +g:ale_python_flakehell_options *g:ale_python_flakehell_options* + *b:ale_python_flakehell_options* + Type: |String| + Default: `''` + + This variable can be changed to add command-line arguments to the flakehell + lint invocation. + + +g:ale_python_flakehell_use_global *g:ale_python_flakehell_use_global* + *b:ale_python_flakehell_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + This variable controls whether or not ALE will search for flakehell in a + virtualenv directory first. If this variable is set to `1`, then ALE will + always use |g:ale_python_flakehell_executable| for the executable path. + + Both variables can be set with `b:` buffer variables instead. + + +g:ale_python_flakehell_auto_pipenv *g:ale_python_flakehell_auto_pipenv* + *b:ale_python_flakehell_auto_pipenv* + Type: |Number| + Default: `0` + + Detect whether the file is inside a pipenv, and set the executable to `pipenv` + if true. This is overridden by a manually-set executable. + + +g:ale_python_flakehell_auto_poetry *g:ale_python_flakehell_auto_poetry* + *b:ale_python_flakehell_auto_poetry* + Type: |Number| + Default: `0` + + Detect whether the file is inside a poetry, and set the executable to `poetry` + if true. This is overridden by a manually-set executable. + =============================================================================== isort *ale-python-isort* @@ -253,6 +411,24 @@ g:ale_python_isort_use_global *g:ale_python_isort_use_global* See |ale-integrations-local-executables| +g:ale_python_isort_auto_pipenv *g:ale_python_isort_auto_pipenv* + *b:ale_python_isort_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_isort_auto_poetry *g:ale_python_isort_auto_poetry* + *b:ale_python_isort_auto_poetry* + Type: |Number| + Default: `0` + + Detect whether the file is inside a poetry, and set the executable to `poetry` + if true. This is overridden by a manually-set executable. + + =============================================================================== mypy *ale-python-mypy* @@ -263,6 +439,24 @@ to check for errors while you type. `mypy` will be run from a detected project root, per |ale-python-root|. +g:ale_python_mypy_auto_pipenv *g:ale_python_mypy_auto_pipenv* + *b:ale_python_mypy_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_mypy_auto_poetry *g:ale_python_mypy_auto_poetry* + *b:ale_python_mypy_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. + + g:ale_python_mypy_executable *g:ale_python_mypy_executable* *b:ale_python_mypy_executable* Type: |String| @@ -271,6 +465,8 @@ g:ale_python_mypy_executable *g:ale_python_mypy_executable* See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `mypy'`. + Set this to `'poetry'` to invoke `'poetry` `run` `mypy'`. + g:ale_python_mypy_ignore_invalid_syntax *g:ale_python_mypy_ignore_invalid_syntax* @@ -292,6 +488,14 @@ g:ale_python_mypy_options *g:ale_python_mypy_options* invocation. +g:ale_python_mypy_show_notes *g:ale_python_mypy_show_notes* + *b:ale_python_mypy_show_notes* + Type: |Number| + Default: `1` + + If enabled, notes on lines will be displayed as 'I' (info) messages. + + g:ale_python_mypy_use_global *g:ale_python_mypy_use_global* *b:ale_python_mypy_use_global* Type: |Number| @@ -300,14 +504,6 @@ g:ale_python_mypy_use_global *g:ale_python_mypy_use_global* See |ale-integrations-local-executables| -g:ale_python_mypy_auto_pipenv *g:ale_python_mypy_auto_pipenv* - *b:ale_python_mypy_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. - =============================================================================== prospector *ale-python-prospector* @@ -320,6 +516,7 @@ g:ale_python_prospector_executable *g:ale_python_prospector_executable* See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `prospector'`. + Set this to `'poetry'` to invoke `'poetry` `run` `prospector'`. g:ale_python_prospector_options *g:ale_python_prospector_options* @@ -360,6 +557,15 @@ g:ale_python_prospector_auto_pipenv *g:ale_python_prospector_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_prospector_auto_poetry *g:ale_python_prospector_auto_poetry* + *b:ale_python_prospector_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* @@ -372,6 +578,7 @@ g:ale_python_pycodestyle_executable *g:ale_python_pycodestyle_executable* See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pycodestyle'`. + Set this to `'poetry'` to invoke `'poetry` `run` `pycodestyle'`. g:ale_python_pycodestyle_options *g:ale_python_pycodestyle_options* @@ -400,6 +607,15 @@ g:ale_python_pycodestyle_auto_pipenv *g:ale_python_pycodestyle_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_pycodestyle_auto_poetry *g:ale_python_pycodestyle_auto_poetry* + *b:ale_python_pycodestyle_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. + + =============================================================================== pydocstyle *ale-python-pydocstyle* @@ -412,6 +628,7 @@ g:ale_python_pydocstyle_executable *g:ale_python_pydocstyle_executable* See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pydocstyle'`. + Set this to `'poetry'` to invoke `'poetry` `run` `pydocstyle'`. g:ale_python_pydocstyle_options *g:ale_python_pydocstyle_options* @@ -440,6 +657,15 @@ g:ale_python_pydocstyle_auto_pipenv *g:ale_python_pydocstyle_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_pydocstyle_auto_poetry *g:ale_python_pydocstyle_auto_poetry* + *b:ale_python_pydocstyle_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. + + =============================================================================== pyflakes *ale-python-pyflakes* @@ -452,6 +678,7 @@ g:ale_python_pyflakes_executable *g:ale_python_pyflakes_executable* See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pyflakes'`. + Set this to `'poetry'` to invoke `'poetry` `run` `pyflakes'`. g:ale_python_pyflakes_auto_pipenv *g:ale_python_pyflakes_auto_pipenv* @@ -463,6 +690,15 @@ g:ale_python_pyflakes_auto_pipenv *g:ale_python_pyflakes_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_pyflakes_auto_poetry *g:ale_python_pyflakes_auto_poetry* + *b:ale_python_pyflakes_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. + + =============================================================================== pylama *ale-python-pylama* @@ -484,7 +720,8 @@ g:ale_python_pylama_executable *g:ale_python_pylama_executable* Default: `'pylama'` This variable can be changed to modify the executable used for pylama. Set - this to `'pipenv'` to invoke `'pipenv` `run` `pylama'`. + this to `'pipenv'` to invoke `'pipenv` `run` `pylama'`. Set this to + `'poetry'` to invoke `'poetry` `run` `pylama'`. g:ale_python_pylama_options *g:ale_python_pylama_options* @@ -517,6 +754,15 @@ g:ale_python_pylama_auto_pipenv *g:ale_python_pylama_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_pylama_auto_poetry *g:ale_python_pylama_auto_poetry* + *b:ale_python_pylama_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. + + =============================================================================== pylint *ale-python-pylint* @@ -541,6 +787,7 @@ g:ale_python_pylint_executable *g:ale_python_pylint_executable* See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pylint'`. + Set this to `'poetry'` to invoke `'poetry` `run` `pylint'`. g:ale_python_pylint_options *g:ale_python_pylint_options* @@ -580,32 +827,51 @@ g:ale_python_pylint_auto_pipenv *g:ale_python_pylint_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_pylint_auto_poetry *g:ale_python_pylint_auto_poetry* + *b:ale_python_pylint_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. + + +g:ale_python_pylint_use_msg_id *g:ale_python_pylint_use_msg_id* + *b:ale_python_pylint_use_msg_id* + Type: |Number| + Default: `0` + + Use message for output (e.g. I0011) instead of symbolic name of the message + (e.g. locally-disabled). + + =============================================================================== -pyls *ale-python-pyls* +pylsp *ale-python-pylsp* -`pyls` will be run from a detected project root, per |ale-python-root|. +`pylsp` will be run from a detected project root, per |ale-python-root|. -g:ale_python_pyls_executable *g:ale_python_pyls_executable* - *b:ale_python_pyls_executable* +g:ale_python_pylsp_executable *g:ale_python_pylsp_executable* + *b:ale_python_pylsp_executable* Type: |String| - Default: `'pyls'` + Default: `'pylsp'` See |ale-integrations-local-executables| - Set this to `'pipenv'` to invoke `'pipenv` `run` `pyls'`. + Set this to `'pipenv'` to invoke `'pipenv` `run` `pylsp'`. + Set this to `'poetry'` to invoke `'poetry` `run` `pyls'`. -g:ale_python_pyls_use_global *g:ale_python_pyls_use_global* - *b:ale_python_pyls_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_pyls_auto_pipenv *g:ale_python_pyls_auto_pipenv* - *b:ale_python_pyls_auto_pipenv* +g:ale_python_pylsp_auto_pipenv *g:ale_python_pylsp_auto_pipenv* + *b:ale_python_pylsp_auto_pipenv* Type: |Number| Default: `0` @@ -613,15 +879,24 @@ g:ale_python_pyls_auto_pipenv *g:ale_python_pyls_auto_pipenv* if true. This is overridden by a manually-set executable. -g:ale_python_pyls_config *g:ale_python_pyls_config* - *b:ale_python_pyls_config* +g:ale_python_pylsp_auto_poetry *g:ale_python_pylsp_auto_poetry* + *b:ale_python_pylsp_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. + + +g:ale_python_pylsp_config *g:ale_python_pylsp_config* + *b:ale_python_pylsp_config* Type: |Dictionary| Default: `{}` - Dictionary with configuration settings for pyls. For example, to disable + Dictionary with configuration settings for pylsp. For example, to disable the pycodestyle linter: > { - \ 'pyls': { + \ 'pylsp': { \ 'plugins': { \ 'pycodestyle': { \ 'enabled': v:false @@ -631,6 +906,25 @@ g:ale_python_pyls_config *g:ale_python_pyls_config* \ } < +g:ale_python_pylsp_options *g:ale_python_pylsp_options* + *b:ale_python_pylsp_options* + Type: |String| + Default: `''` + + This variable can be changed to add command-line arguments to the pylsp + invocation. Note that this is not the same thing as ale_python_pylsp_config, + which allows configuration of how pylsp functions; this is intended to + provide flexibility in how the pylsp command is invoked. + + For example, if you had installed `pylsp` but your `pylsp` executable was not + on your `PATH` for some reason, an alternative way to run the pylsp server + would be: + let g:ale_python_pylsp_executable = 'python3' + let g:ale_python_pylsp_options = '-m pylsp' + + An example stragety for installing `pylsp`: + `python3 -m pip install --user pylsp` + =============================================================================== pyre *ale-python-pyre* @@ -645,6 +939,7 @@ g:ale_python_pyre_executable *g:ale_python_pyre_executable* See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pyre'`. + Set this to `'poetry'` to invoke `'poetry` `run` `pyre'`. g:ale_python_pyre_use_global *g:ale_python_pyre_use_global* @@ -664,6 +959,104 @@ g:ale_python_pyre_auto_pipenv *g:ale_python_pyre_auto_pipenv* if true. This is overridden by a manually-set executable. +g:ale_python_pyre_auto_poetry *g:ale_python_pyre_auto_poetry* + *b:ale_python_pyre_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. + + +=============================================================================== +pyright *ale-python-pyright* + +The `pyright` linter requires a recent version of `pyright` which includes +the `pyright-langserver` executable. You can install `pyright` on your system +through `npm` with `sudo npm install -g pyright` or similar. + +Refer to their README for installation instructions: +https://github.com/Microsoft/pyright + +`pyright` needs to know the path to your Python executable and probably a +virtualenv to run. ALE will try to detect these automatically. +See |g:ale_python_pyright_config|. + + +g:ale_python_pyright_executable *g:ale_python_pyright_executable* + *b:ale_python_pyright_executable* + Type: |String| + Default: `'pyright-langserver'` + + The executable for running `pyright`, which is typically installed globally. + + +g:ale_python_pyright_config *g:ale_python_pyright_config* + *b:ale_python_pyright_config* + Type: |Dictionary| + Default: `{}` + + Settings for configuring the `pyright` language server. + + See pyright's documentation for a full list of options: + https://github.com/microsoft/pyright/blob/master/docs/settings.md + + ALE will automatically try to set defaults for `venvPath` and `pythonPath` + so your project can automatically be checked with the right libraries. + You can override these settings with whatever you want in your ftplugin + file like so: > + + let b:ale_python_pyright_config = { + \ 'python': { + \ 'pythonPath': '/bin/python', + \ 'venvPath': '/other/dir', + \ }, + \} +< + If `venvPath` is set, but `pythonPath` is not, + ALE will use `venvPath . '/bin/python'` or similar as `pythonPath`. + + A commonly used setting for `pyright` is disabling language services + apart from type checking and "hover" (|ale-hover|), you can set this + setting like so, or use whatever other settings you want: > + + let b:ale_python_pyright_config = { + \ 'pyright': { + \ 'disableLanguageServices': v:true, + \ }, + \} +< + +=============================================================================== +reorder-python-imports *ale-python-reorder_python_imports* + +g:ale_python_reorder_python_imports_executable + *g:ale_python_reorder_python_imports_executable* + *b:ale_python_reorder_python_imports_executable* + Type: |String| + Default: `'reorder-python-imports'` + + See |ale-integrations-local-executables| + + +g:ale_python_reorder_python_imports_options + *g:ale_python_reorder_python_imports_options* + *b:ale_python_reorder_python_imports_options* + Type: |String| + Default: `''` + + This variable can be set to pass extra options to reorder-python-imports. + + +g:ale_python_reorder_python_imports_use_global + *g:ale_python_reorder_python_imports_use_global* + *b:ale_python_reorder_python_imports_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== vulture *ale-python-vulture* diff --git a/sources_non_forked/ale/doc/ale-r.txt b/sources_non_forked/ale/doc/ale-r.txt index f85f48fd..3fabf702 100644 --- a/sources_non_forked/ale/doc/ale-r.txt +++ b/sources_non_forked/ale/doc/ale-r.txt @@ -2,6 +2,29 @@ ALE R Integration *ale-r-options* +=============================================================================== +languageserver *ale-r-languageserver* + +g:ale_r_languageserver_cmd *g:ale_r_languageserver_cmd* + *b:ale_r_languageserver_cmd* + Type: |String| + Default: `'languageserver::run()'` + + This option can be configured to change the execution command for + languageserver. + + See the languageserver documentation for more options. + + +g:ale_r_languageserver_config *g:ale_r_languageserver_config* + *b:ale_r_languageserver_config* + Type: |Dictionary| + Default: `{}` + + This option can be configured to change settings for languageserver. See the + languageserver documentation for more information. + + =============================================================================== lintr *ale-r-lintr* @@ -22,8 +45,24 @@ g:ale_r_lintr_lint_package *g:ale_r_lintr_lint_package* Default: `0` When set to `1`, the file will be checked with `lintr::lint_package` instead - of `lintr::lint`. This prevents erroneous namespace warnings when linting + of `lintr::lint`. This prevents erroneous namespace warnings when linting package files. + +=============================================================================== +styler *ale-r-styler* + +g:ale_r_styler_options *g:ale_r_styler_options* + *b:ale_r_styler_options* + Type: |String| + Default: `'styler::tidyverse_style'` + + This option can be configured to change the options for styler. + + The value of this option will be used as the `style` argument for the + `styler::style_file` options. Consult the styler documentation + for more information. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-reasonml.txt b/sources_non_forked/ale/doc/ale-reasonml.txt index 426d4c46..b8729a55 100644 --- a/sources_non_forked/ale/doc/ale-reasonml.txt +++ b/sources_non_forked/ale/doc/ale-reasonml.txt @@ -5,18 +5,19 @@ ALE ReasonML Integration *ale-reasonml-options* =============================================================================== merlin *ale-reasonml-merlin* - To use merlin linter for ReasonML source code you need to make sure Merlin - for Vim is correctly configured. See the corresponding Merlin wiki page for - detailed instructions - (https://github.com/the-lambda-church/merlin/wiki/vim-from-scratch). +To use merlin linter for ReasonML source code you need to make sure Merlin for +Vim is correctly configured. See the corresponding Merlin wiki page for +detailed instructions: +https://github.com/the-lambda-church/merlin/wiki/vim-from-scratch =============================================================================== ols *ale-reasonml-ols* - The `ocaml-language-server` is the engine that powers OCaml and ReasonML - editor support using the Language Server Protocol. See the installation - instructions: - https://github.com/freebroccolo/ocaml-language-server#installation +The `ocaml-language-server` is the engine that powers OCaml and ReasonML +editor support using the Language Server Protocol. See the installation +instructions: +https://github.com/freebroccolo/ocaml-language-server#installation + g:ale_reason_ols_executable *g:ale_reason_ols_executable* *b:ale_reason_ols_executable* @@ -25,6 +26,7 @@ g:ale_reason_ols_executable *g:ale_reason_ols_executable* This variable can be set to change the executable path for `ols`. + g:ale_reason_ols_use_global *g:ale_reason_ols_use_global* *b:ale_reason_ols_use_global* Type: |String| @@ -33,6 +35,24 @@ g:ale_reason_ols_use_global *g:ale_reason_ols_use_global* This variable can be set to `1` to always use the globally installed executable. See also |ale-integrations-local-executables|. + +=============================================================================== +reason-language-server *ale-reasonml-language-server* + +Note: You must set an executable - there is no 'default' install location. +Go to https://github.com/jaredly/reason-language-server and download the +latest release. You can place it anywhere, but ensure you set the executable +path. + + +g:ale_reason_ls_executable *g:ale_reason_ls_executable* + *b:ale_reason_ls_executable* + Type: |String| + + This variable defines the standard location of the language server + executable. This must be set. + + =============================================================================== refmt *ale-reasonml-refmt* @@ -43,6 +63,7 @@ g:ale_reasonml_refmt_executable *g:ale_reasonml_refmt_executable* This variable can be set to pass the path of the refmt fixer. + g:ale_reasonml_refmt_options *g:ale_reasonml_refmt_options* *b:ale_reasonml_refmt_options* Type: |String| @@ -50,5 +71,6 @@ g:ale_reasonml_refmt_options *g:ale_reasonml_refmt_options* This variable can be set to pass additional options to the refmt fixer. + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-robot.txt b/sources_non_forked/ale/doc/ale-robot.txt new file mode 100644 index 00000000..405ae277 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-robot.txt @@ -0,0 +1,16 @@ +=============================================================================== +ALE Robot Integration *ale-robot-options* + + +=============================================================================== +rflint *ale-robot-rflint* + +g:ale_robot_rflint_executable *g:ale_robot_rflint_executable* + *b:ale_robot_rflint_executable* + Type: |String| + Default: `'rflint'` + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: + diff --git a/sources_non_forked/ale/doc/ale-ruby.txt b/sources_non_forked/ale/doc/ale-ruby.txt index bf971e7c..69c643a9 100644 --- a/sources_non_forked/ale/doc/ale-ruby.txt +++ b/sources_non_forked/ale/doc/ale-ruby.txt @@ -21,6 +21,31 @@ g:ale_ruby_brakeman_options *g:ale_ruby_brakeman_options* The contents of this variable will be passed through to brakeman. +=============================================================================== +debride *ale-ruby-debride* + +g:ale_ruby_debride_executable *g:ale_ruby_debride_executable* + *b:ale_ruby_debride_executable* + Type: String + Default: `'debride'` + + Override the invoked debride binary. Set this to `'bundle'` to invoke + `'bundle` `exec` debride'. + + +g:ale_ruby_debride_options *g:ale_ruby_debride_options* + *b:ale_ruby_debride_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to debride. + + +=============================================================================== +prettier *ale-ruby-prettier* + +See |ale-javascript-prettier| for information about the available options. + =============================================================================== rails_best_practices *ale-ruby-rails_best_practices* @@ -91,7 +116,15 @@ g:ale_ruby_rubocop_options *g:ale_ruby_rubocop_options* Type: |String| Default: `''` - This variable can be change to modify flags given to rubocop. + This variable can be changed to modify flags given to rubocop. + + +g:ale_ruby_rubocop_auto_correct_all *g:ale_ruby_rubocop_auto_correct_all* + *b:ale_ruby_rubocop_auto_correct_all* + Type: Number + Default: `0` + + This variable can be changed to make rubocop to correct all offenses (unsafe). =============================================================================== @@ -129,11 +162,41 @@ g:ale_ruby_solargraph_executable *g:ale_ruby_solargraph_executable* from binstubs or a bundle. +=============================================================================== +sorbet *ale-ruby-sorbet* + +g:ale_ruby_sorbet_executable *g:ale_ruby_sorbet_executable* + *b:ale_ruby_sorbet_executable* + Type: String + Default: `'srb'` + + Override the invoked sorbet binary. Set this to `'bundle'` to invoke + `'bundle` `exec` srb'. + + +g:ale_ruby_sorbet_options *g:ale_ruby_sorbet_options* + *b:ale_ruby_sorbet_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to sorbet. + + +g:ale_ruby_sorbet_enable_watchman *g:ale_ruby_sorbet_enable_watchman* + *b:ale_ruby_sorbet_enable_watchman* + Type: |Number| + Default: `0` + + Whether or not to use watchman to let the LSP server to know about changes + to files from outside of vim. Defaults to disable watchman because it + requires watchman to be installed separately from sorbet. + + =============================================================================== standardrb *ale-ruby-standardrb* -g:ale_ruby_standardrb_executable *g:ale_ruby_standardrb_executable* - *b:ale_ruby_standardrb_executable* +g:ale_ruby_standardrb_executable *g:ale_ruby_standardrb_executable* + *b:ale_ruby_standardrb_executable* Type: String Default: `'standardrb'` @@ -146,7 +209,7 @@ g:ale_ruby_standardrb_options *g:ale_ruby_standardrb_options* Type: |String| Default: `''` - This variable can be change to modify flags given to standardrb. + This variable can be changed to modify flags given to standardrb. =============================================================================== diff --git a/sources_non_forked/ale/doc/ale-rust.txt b/sources_non_forked/ale/doc/ale-rust.txt index 3393b9c0..3aa63673 100644 --- a/sources_non_forked/ale/doc/ale-rust.txt +++ b/sources_non_forked/ale/doc/ale-rust.txt @@ -9,7 +9,7 @@ Integration Information files for Rust distributed in Vim >=8.0.0501 or upstream: https://github.com/rust-lang/rust.vim - Note that there are three possible linters for Rust files: + Note that there are several possible linters and fixers for Rust files: 1. rustc -- The Rust compiler is used to check the currently edited file. So, if your project consists of multiple files, you will get some errors @@ -22,20 +22,45 @@ Integration Information 3. rls -- If you have `rls` installed, you might prefer using this linter over cargo. rls implements the Language Server Protocol for incremental compilation of Rust code, and can check Rust files while you type. `rls` - requires Rust files to contained in Cargo projects. - 4. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to + requires Rust files to be contained in Cargo projects. + 4. analyzer -- If you have rust-analyzer installed, you might prefer using + this linter over cargo and rls. rust-analyzer also implements the + Language Server Protocol for incremental compilation of Rust code, and is + the next iteration of rls. rust-analyzer, like rls, requires Rust files + to be contained in Cargo projects. + 5. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to consistently reformat your Rust code. - Only cargo is enabled by default. To switch to using rustc instead of cargo, - configure |g:ale_linters| appropriately: > + Only cargo and rls are enabled by default. To switch to using rustc instead + of cargo, configure |g:ale_linters| appropriately: > " See the help text for the option for more information. - let g:ale_linters = {'rust': ['rustc']} + let g:ale_linters = {'rust': ['rustc', 'rls']} < Also note that rustc 1.12. or later is needed. +=============================================================================== +analyzer *ale-rust-analyzer* + +g:ale_rust_analyzer_executable *g:ale_rust_analyzer_executable* + *b:ale_rust_analyzer_executable* + Type: |String| + Default: `'rust-analyzer'` + + This variable can be modified to change the executable path for + `rust-analyzer`. + + +g:ale_rust_analyzer_config *g:ale_rust_analyzer_config* + *b:ale_rust_analyzer_config* + Type: |Dictionary| + Default: `{}` + + Dictionary with configuration settings for rust-analyzer. + + =============================================================================== cargo *ale-rust-cargo* @@ -150,6 +175,18 @@ g:ale_rust_cargo_clippy_options only `cargo clippy` supports (e.g. `--deny`). +g:ale_rust_cargo_target_dir + *g:ale_rust_cargo_target_dir* + *b:ale_rust_cargo_target_dir* + + Type: |String| + Default: `''` + + Use a custom target directory when running the commands for ALE. This can + help to avoid "waiting for file lock on build directory" messages when + running `cargo` commands manually while ALE is performing its checks. + + =============================================================================== rls *ale-rust-rls* @@ -164,10 +201,14 @@ g:ale_rust_rls_executable *g:ale_rust_rls_executable* g:ale_rust_rls_toolchain *g:ale_rust_rls_toolchain* *b:ale_rust_rls_toolchain* Type: |String| - Default: `'nightly'` + Default: `''` This option can be set to change the toolchain used for `rls`. Possible - values include `'nightly'`, `'beta'`, and `'stable'`. + values include `'nightly'`, `'beta'`, `'stable'`, and `''`. When using + option `''`, rls will automatically find the default toolchain set by + rustup. If you want to use `rls` from a specific toolchain version, you may + also use values like `'channel-yyyy-mm-dd-arch-target'` as long as + `'rls +{toolchain_name} -V'` runs correctly in your command line. The `rls` server will only be started once per executable. @@ -212,23 +253,25 @@ g:ale_rust_ignore_error_codes *g:ale_rust_ignore_error_codes* > let g:ale_rust_ignore_error_codes = ['E0432', 'E0433'] + g:ale_rust_ignore_secondary_spans *g:ale_rust_ignore_secondary_spans* *b:ale_rust_ignore_secondary_spans* Type: Number Default: 0 - When set to 1, instructs the Rust error repporting to ignore secondary - spans. The problem with secondary spans is that they sometimes appear in - error messages before the main cause of the error, for example: > + When set to 1, instructs the Rust error reporting to ignore secondary spans. + The problem with secondary spans is that they sometimes appear in error + messages before the main cause of the error, for example: > 1 src/main.rs|98 col 5 error| this function takes 4 parameters but 5 - parameters were supplied: defined here + parameters were supplied: defined here 2 src/main.rs|430 col 32 error| this function takes 4 parameters but 5 - parameters were supplied: expected 4 parameters + parameters were supplied: expected 4 parameters < This is due to the sorting by line numbers. With this option set to 1, the 'defined here' span will not be presented. + =============================================================================== rustfmt *ale-rust-rustfmt* diff --git a/sources_non_forked/ale/doc/ale-salt.tmt b/sources_non_forked/ale/doc/ale-salt.tmt new file mode 100644 index 00000000..ac500d37 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-salt.tmt @@ -0,0 +1,43 @@ +=============================================================================== +ALE SALT Integration *ale-salt-options* + +=============================================================================== +salt-lint *ale-salt-salt-lint* + +Website: https://github.com/warpnet/salt-lint + + +Installation +------------------------------------------------------------------------------- + +Install salt-lint in your a virtualenv directory, locally, or globally: > + + pip install salt-lint # After activating virtualenv + pip install --user salt-lint # Install to ~/.local/bin + sudo pip install salt-lint # Install globally + +See |g:ale_virtualenv_dir_names| for configuring how ALE searches for +virtualenv directories. + + +Options +------------------------------------------------------------------------------- + +g:ale_salt_salt-lint_executable *g:ale_salt_salt_lint_executable* + *b:ale_salt_salt_lint_executable* + Type: |String| + Default: `'salt-lint'` + + This variable can be set to change the path to salt-lint. + + +g:ale_salt_salt-lint_options *g:ale_salt_salt-lint_options* + *b:ale_salt_salt-lint_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to salt-lint. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-scala.txt b/sources_non_forked/ale/doc/ale-scala.txt index ff43cd6c..c9638baf 100644 --- a/sources_non_forked/ale/doc/ale-scala.txt +++ b/sources_non_forked/ale/doc/ale-scala.txt @@ -2,6 +2,32 @@ ALE Scala Integration *ale-scala-options* +=============================================================================== +metals *ale-scala-metals* + +`metals` requires either an SBT project, a Mill project, or a running Bloop +server. + + +g:ale_scala_metals_executable *g:ale_scala_metals_executable* + *b:ale_scala_metals_executable* + Type: |String| + Default: `'metals-vim'` + + Override the invoked `metals` binary. + + +g:ale_scala_metals_project_root *g:ale_scala_metals_project_root* + *b:ale_scala_metals_project_root* + Type: |String| + Default: `''` + + By default the project root is found by searching upwards for `build.sbt`, + `build.sc`, `.bloop` or `.metals`. + If the project root is elsewhere, you can override the project root + directory. + + =============================================================================== sbtserver *ale-scala-sbtserver* diff --git a/sources_non_forked/ale/doc/ale-sh.txt b/sources_non_forked/ale/doc/ale-sh.txt index 64f59609..c06f737a 100644 --- a/sources_non_forked/ale/doc/ale-sh.txt +++ b/sources_non_forked/ale/doc/ale-sh.txt @@ -2,6 +2,29 @@ ALE Shell Integration *ale-sh-options* +=============================================================================== +bashate *ale-sh-bashate* + +g:ale_sh_bashate_executable *g:ale_sh_bashate_executable* + *b:ale_sh_bashate_executable* + Type: |String| + Default: `'bashate'` + + This variable sets executable used for bashate. + + +g:ale_sh_bashate_options *g:ale_sh_bashate_options* + *b:ale_sh_bashate_options* + Type: |String| + Default: `''` + + With this variable we are able to pass extra arguments for bashate. For + example to ignore the indentation rule: + +> + let g:ale_sh_bashate_options = '-i E003' +< + =============================================================================== sh-language-server *ale-sh-language-server* @@ -62,6 +85,18 @@ g:ale_sh_shellcheck_options *g:ale_sh_shellcheck_options* < +g:ale_sh_shellcheck_change_directory *g:ale_sh_shellcheck_change_directory* + *b:ale_sh_shellcheck_change_directory* + Type: |Number| + Default: `1` + + If set to `1`, ALE will switch to the directory the shell file being + checked with `shellcheck` is in before checking it. This helps `shellcheck` + determine the path to sourced files more easily. This option can be turned + off if you want to control the directory `shellcheck` is executed from + yourself. + + g:ale_sh_shellcheck_dialect *g:ale_sh_shellcheck_dialect* *b:ale_sh_shellcheck_dialect* Type: |String| diff --git a/sources_non_forked/ale/doc/ale-solidity.txt b/sources_non_forked/ale/doc/ale-solidity.txt index 4b74a27a..c4d2f02f 100644 --- a/sources_non_forked/ale/doc/ale-solidity.txt +++ b/sources_non_forked/ale/doc/ale-solidity.txt @@ -2,6 +2,24 @@ ALE Solidity Integration *ale-solidity-options* +=============================================================================== +solc *ale-solidity-solc* + +g:ale_solidity_solc_executable *g:ale_solidity_solc_executable* + *b:ale_solidity_solc_executable* + Type: |String| + Default: `'solc'` + + Override the invoked solc binary. For truffle/hardhat binaries. + +g:ale_solidity_solc_options *g:ale_solidity_solc_options* + *b:ale_solidity_solc_options* + Type: |String| + Default: `''` + + This variable can be set to pass extra options to solc. + + =============================================================================== solhint *ale-solidity-solhint* @@ -21,4 +39,3 @@ solium *ale-solidity-solium* =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: - diff --git a/sources_non_forked/ale/doc/ale-sql.txt b/sources_non_forked/ale/doc/ale-sql.txt index 75d4b0cf..398e24d3 100644 --- a/sources_non_forked/ale/doc/ale-sql.txt +++ b/sources_non_forked/ale/doc/ale-sql.txt @@ -2,6 +2,24 @@ ALE SQL Integration *ale-sql-options* +=============================================================================== +pgformatter *ale-sql-pgformatter* + +g:ale_sql_pgformatter_executable *g:ale_sql_pgformatter_executable* + *b:ale_sql_pgformatter_executable* + Type: |String| + Default: `'pg_format'` + + This variable sets executable used for pgformatter. + +g:ale_sql_pgformatter_options *g:ale_sql_pgformatter_options* + *b:ale_sql_pgformatter_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the pgformatter fixer. + + =============================================================================== sqlfmt *ale-sql-sqlfmt* @@ -21,5 +39,23 @@ g:ale_sql_sqlfmt_options *g:ale_sql_sqlfmt_options* At this time only the -u flag is available to format with upper-case. +=============================================================================== +sqlformat *ale-sql-sqlformat* + +g:ale_sql_sqlformat_executable *g:ale_sql_sqlformat_executable* + *b:ale_sql_sqlformat_executable* + Type: |String| + Default: `'sqlformat'` + + This variable sets executable used for sqlformat. + +g:ale_sql_sqlformat_options *g:ale_sql_sqlformat_options* + *b:ale_sql_sqlformat_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the sqlformat fixer. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt index 9be28f87..36ef83ea 100644 --- a/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt +++ b/sources_non_forked/ale/doc/ale-supported-languages-and-tools.txt @@ -13,13 +13,19 @@ Notes: `!!` These linters check only files on disk. See |ale-lint-file-linters| * Ada + * `ada_language_server` * `gcc` + * `gnatpp` * Ansible - * `ansible-lint` + * `ansible-lint`!! * API Blueprint * `drafter` +* APKBUILD + * `apkbuild-lint` + * `secfixes-check` * AsciiDoc * `alex`!! + * `languagetool`!! * `proselint` * `redpen` * `textlint` @@ -30,10 +36,15 @@ Notes: * Awk * `gawk` * Bash + * `bashate` * `language-server` * `shell` (-n flag) * `shellcheck` * `shfmt` +* Bats + * `shellcheck` +* Bazel + * `buildifier` * BibTeX * `bibclean` * Bourne Shell @@ -41,38 +52,44 @@ Notes: * `shellcheck` * `shfmt` * C + * `astyle` * `ccls` - * `clang` - * `clangd` + * `clang` (`cc`) * `clang-format` + * `clangd` * `clangtidy`!! * `cppcheck` * `cpplint`!! * `cquery` * `flawfinder` - * `gcc` + * `gcc` (`cc`) * `uncrustify` * C# + * `csc`!! + * `dotnet-format` * `mcs` * `mcsc`!! * `uncrustify` * C++ (filetype cpp) + * `astyle` * `ccls` - * `clang` + * `clang` (`cc`) + * `clang-format` * `clangcheck`!! * `clangd` - * `clang-format` * `clangtidy`!! * `clazy`!! * `cppcheck` * `cpplint`!! * `cquery` * `flawfinder` - * `gcc` + * `gcc` (`cc`) * `uncrustify` * Chef - * `foodcritic` + * `cookstyle` + * `foodcritic`!! * Clojure + * `clj-kondo` * `joker` * CloudFormation * `cfn-python-lint` @@ -87,49 +104,66 @@ Notes: * `crystal`!! * CSS * `csslint` + * `fecs` * `prettier` * `stylelint` * Cucumber * `cucumber` * CUDA + * `clangd` * `nvcc`!! * Cypher * `cypher-lint` * Cython (pyrex filetype) * `cython` * D + * `dfmt` * `dls` * `dmd` * `uncrustify` * Dafny * `dafny`!! * Dart + * `analysis_server` + * `dart-analyze`!! + * `dart-format`!! * `dartanalyzer`!! * `dartfmt`!! * `language_server` +* desktop + * `desktop-file-validate` +* Dhall + * `dhall-format` + * `dhall-freeze` + * `dhall-lint` * Dockerfile * `dockerfile_lint` * `hadolint` * Elixir * `credo` * `dialyxir` - * `dogma` + * `dogma`!! * `elixir-ls` * `mix`!! * Elm * `elm-format` - * `elm-lsp` + * `elm-ls` * `elm-make` * Erb * `erb` + * `erblint` * `erubi` * `erubis` * `ruumba` * Erlang - * `erlc` * `SyntaxErl` + * `dialyzer`!! + * `elvis`!! + * `erlc` + * `erlfmt` * Fish * `fish` (-n flag) + * `fish_indent` * Fortran * `gcc` * `language_server` @@ -140,21 +174,24 @@ Notes: * Git Commit Messages * `gitlint` * GLSL - * glslang + * `glslang` * `glslls` * Go * `bingo` * `go build`!! + * `go mod`!! + * `go vet`!! * `gofmt` * `goimports` * `golangci-lint`!! * `golangserver` + * `golines` * `golint` * `gometalinter`!! - * `go mod`!! + * `gopls` * `gosimple`!! * `gotype`!! - * `go vet`!! + * `revive`!! * `staticcheck`!! * GraphQL * `eslint` @@ -171,12 +208,16 @@ Notes: * Haskell * `brittany` * `cabal-ghc` + * `floskell` * `ghc` * `ghc-mod` * `hdevtools` * `hfmt` * `hie` + * `hindent` * `hlint` + * `hls` + * `ormolu` * `stack-build`!! * `stack-ghc` * `stylish-haskell` @@ -184,24 +225,34 @@ Notes: * `terraform-fmt` * HTML * `alex`!! - * `HTMLHint` + * `angular` + * `fecs` + * `html-beautify` + * `htmlhint` * `prettier` * `proselint` * `tidy` * `write-good` * Idris * `idris` +* Ink + * `ink-language-server` +* Inko + * `inko` !! * ISPC * `ispc`!! * Java - * `checkstyle` + * `PMD` + * `checkstyle`!! + * `eclipselsp` * `google-java-format` * `javac` * `javalsp` - * `PMD` * `uncrustify` * JavaScript + * `deno` * `eslint` + * `fecs` * `flow` * `jscs` * `jshint` @@ -212,15 +263,24 @@ Notes: * `tsserver` * `xo` * JSON + * `eslint` * `fixjson` * `jq` * `jsonlint` * `prettier` + * `spectral` +* JSON5 + * `eslint` +* JSONC + * `eslint` +* Jsonnet + * `jsonnet-lint` + * `jsonnetfmt` * Julia * `languageserver` * Kotlin * `kotlinc`!! - * `ktlint`!! + * `ktlint` * `languageserver` * LaTeX (tex) * `alex`!! @@ -228,6 +288,7 @@ Notes: * `lacheck` * `proselint` * `redpen` + * `texlab` * `textlint` * `vale` * `write-good` @@ -238,8 +299,11 @@ Notes: * LLVM * `llc` * Lua + * `lua-format` * `luac` * `luacheck` + * `luafmt` + * `stylua` * Mail * `alex`!! * `languagetool`!! @@ -252,6 +316,7 @@ Notes: * `languagetool`!! * `markdownlint`!! * `mdl` + * `pandoc` * `prettier` * `proselint` * `redpen` @@ -267,8 +332,13 @@ Notes: * `nasm`!! * Nim * `nim check`!! + * `nimlsp` + * `nimpretty` * nix * `nix-instantiate` + * `nixfmt` + * `nixpkgs-fmt` + * `rnix-lsp` * nroff * `alex`!! * `proselint` @@ -285,7 +355,15 @@ Notes: * OCaml * `merlin` (see |ale-ocaml-merlin|) * `ocamlformat` + * `ocamllsp` + * `ocp-indent` * `ols` +* OpenApi + * `ibm_validator` + * `prettier` + * `yamllint` +* Pascal + * `ptop` * Pawn * `uncrustify` * Perl @@ -295,15 +373,17 @@ Notes: * Perl6 * `perl6 -c` * PHP + * `intelephense` * `langserver` * `phan` + * `php -l` + * `php-cs-fixer` * `phpcbf` * `phpcs` - * `php-cs-fixer` - * `php -l` * `phpmd` * `phpstan` * `psalm`!! + * `tlint` * PO * `alex`!! * `msgfmt` @@ -315,42 +395,62 @@ Notes: * `write-good` * Pony * `ponyc` +* PowerShell + * `powershell` + * `psscriptanalyzer` * Prolog * `swipl` * proto - * `protoc-gen-lint` + * `protoc-gen-lint`!! + * `protolint`!! * Pug * `pug-lint` * Puppet * `languageserver` * `puppet` * `puppet-lint` +* PureScript + * `purescript-language-server` + * `purs-tidy` + * `purty` * Python + * `autoflake`!! + * `autoimport` * `autopep8` * `bandit` * `black` * `flake8` + * `flakehell` * `isort` * `mypy` - * `prospector` + * `prospector`!! * `pycodestyle` * `pydocstyle` + * `pyflakes` * `pylama`!! * `pylint`!! - * `pyls` + * `pylsp` * `pyre` + * `pyright` + * `reorder-python-imports` * `vulture`!! * `yapf` * QML * `qmlfmt` * `qmllint` * R + * `languageserver` * `lintr` + * `styler` * Racket + * `racket-langserver` * `raco` +* Re:VIEW + * `redpen` * ReasonML * `merlin` * `ols` + * `reason-language-server` * `refmt` * reStructuredText * `alex`!! @@ -360,29 +460,36 @@ Notes: * `textlint` * `vale` * `write-good` -* Re:VIEW - * `redpen` +* Robot + * `rflint` * RPM spec * `rpmlint` * Ruby - * `brakeman` + * `brakeman`!! + * `debride` + * `prettier` * `rails_best_practices`!! * `reek` * `rubocop` * `ruby` * `rufo` * `solargraph` + * `sorbet` * `standardrb` * Rust * `cargo`!! * `rls` + * `rust-analyzer` * `rustc` (see |ale-integration-rust|) * `rustfmt` +* Salt + * `salt-lint` * Sass * `sass-lint` * `stylelint` * Scala * `fsc` + * `metals` * `sbtserver` * `scalac` * `scalafmt` @@ -397,22 +504,36 @@ Notes: * SML * `smlnj` * Solidity + * `solc` * `solhint` * `solium` * SQL + * `pgformatter` + * `sql-lint` * `sqlfmt` + * `sqlformat` * `sqlint` * Stylus * `stylelint` * SugarSS * `stylelint` +* Svelte + * `prettier` + * `svelteserver` * Swift + * Apple `swift-format` + * `sourcekit-lsp` * `swiftformat` * `swiftlint` +* systemd + * `systemd-analyze`!! * Tcl * `nagelfar`!! * Terraform - * `fmt` + * `terraform` + * `terraform-fmt-fixer` + * `terraform-ls` + * `terraform-lsp` * `tflint` * Texinfo * `alex`!! @@ -428,24 +549,35 @@ Notes: * `write-good` * Thrift * `thrift` + * `thriftcheck` * TypeScript + * `deno` * `eslint` + * `fecs` * `prettier` + * `standard` * `tslint` * `tsserver` * `typecheck` +* V + * `v`!! + * `vfmt` * VALA * `uncrustify` + * `vala_lint`!! * Verilog + * `hdl-checker` * `iverilog` * `verilator` * `vlog` * `xvlog` + * `yosys`!! * VHDL * `ghdl` * `vcom` * `xvhdl` * Vim + * `vimls` * `vint` * Vim help^ * `alex`!! @@ -461,8 +593,18 @@ Notes: * XML * `xmllint` * YAML + * `circleci`!! * `prettier` + * `spectral` * `swaglint` + * `yamlfix` * `yamllint` * YANG * `yang-lsp` +* Zeek + * `zeek`!! +* Zig + * `zls` + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-svelte.txt b/sources_non_forked/ale/doc/ale-svelte.txt new file mode 100644 index 00000000..92f109f7 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-svelte.txt @@ -0,0 +1,31 @@ +=============================================================================== +ALE Svelte Integration *ale-svelte-options* + + +=============================================================================== +prettier *ale-svelte-prettier* + +See |ale-javascript-prettier| for information about the available options. + + +=============================================================================== +svelteserver *ale-svelte-svelteserver* + +g:ale_svelte_svelteserver_executable *g:ale_svelte_svelteserver_executable* + *b:ale_svelte_svelteserver_executable* + Type: |String| + Default: `'svelteserver'` + + See |ale-integrations-local-executables| + + +g:ale_svelte_svelteserver_use_global *g:ale_svelte_svelteserver_use_global* + *b:ale_svelte_svelteserver_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-swift.txt b/sources_non_forked/ale/doc/ale-swift.txt new file mode 100644 index 00000000..6d53ca7c --- /dev/null +++ b/sources_non_forked/ale/doc/ale-swift.txt @@ -0,0 +1,60 @@ +=============================================================================== +ALE Swift Integration *ale-swift-options* + + +=============================================================================== +apple-swift-format *ale-swift-apple-swift-format* + +There are 3 options to enable linting and fixing with Apple's swift-format: + +1. Install the local executable in your path, as described here: + https://github.com/apple/swift-format +2. Install the executable via your OS package manager, for instance via + Homebrew with `brew install swift-format` +3. Your Swift project has a dependency on the swift-format package, so it can + be run with `swift run swift-format lint ...` In this case, you need to set + a variable, see |g:ale_swift_appleswiftformat_use_swiftpm|. + +Additionally, ALE tries to locate and use the nearest existing `.swift-format` +configuration file. + + +g:ale_swift_appleswiftformat_executable *g:ale_swift_appleswiftformat_executable* + *b:ale_swift_appleswiftformat_executable* + Type: |String| + Default: `'swift-format'` + + This variable can be modified to change the executable path for + `swift-format`. + + +g:ale_swift_appleswiftformat_use_swiftpm *g:ale_swift_appleswiftformat_use_swiftpm* + *b:ale_swift_appleswiftformat_use_swiftpm* + Type: |Number| + Default: `0` + + When set to `1`, this option will cause ALE to use + `swift run swift-format lint ...` instead of the global executable. Use this + option if your Swift project has a dependency on the swift-format package. + + See |ale-integrations-local-executables| + + +=============================================================================== +sourcekitlsp *ale-swift-sourcekitlsp* + +To enable the SourceKit-LSP you need to install and build the executable as +described here: https://github.com/apple/sourcekit-lsp#building-sourcekit-lsp + + +g:ale_sourcekit_lsp_executable *g:ale_sourcekit_lsp_executable* + *b:ale_sourcekit_lsp_executable* + Type: |String| + Default: `'sourcekit-lsp'` + + See |ale-integrations-local-executables| + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: + diff --git a/sources_non_forked/ale/doc/ale-systemd.txt b/sources_non_forked/ale/doc/ale-systemd.txt new file mode 100644 index 00000000..13c7037f --- /dev/null +++ b/sources_non_forked/ale/doc/ale-systemd.txt @@ -0,0 +1,14 @@ +=============================================================================== +ALE systemd Integration *ale-systemd-options* + + +=============================================================================== +systemd-analyze *ale-systemd-analyze* + +ALE supports checking user systemd units with `systemd-analyze --user verify` +Checks will only work with user unit files in their proper location. There +aren't any options, and checks can only run after saving the file. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-terraform.txt b/sources_non_forked/ale/doc/ale-terraform.txt index 49a55028..175bdf5c 100644 --- a/sources_non_forked/ale/doc/ale-terraform.txt +++ b/sources_non_forked/ale/doc/ale-terraform.txt @@ -3,7 +3,7 @@ ALE Terraform Integration *ale-terraform-options* =============================================================================== -fmt *ale-terraform-fmt* +terraform-fmt-fixer *ale-terraform-fmt-fixer* g:ale_terraform_fmt_executable *g:ale_terraform_fmt_executable* *b:ale_terraform_fmt_executable* @@ -20,6 +20,59 @@ g:ale_terraform_fmt_options *g:ale_terraform_fmt_options* Default: `''` +=============================================================================== +terraform *ale-terraform-terraform* + +g:ale_terraform_terraform_executable *g:ale_terraform_terraform_executable* + *b:ale_terraform_terraform_executable* + + Type: |String| + Default: `'terraform'` + + This variable can be changed to use a different executable for terraform. + + +=============================================================================== +terraform-ls *ale-terraform-terraform-ls* + +Official terraform language server. More stable than *terraform-lsp* but +currently has less features. + +g:ale_terraform_ls_executable *g:ale_terraform_ls_executable* + *b:ale_terraform_ls_executable* + Type: |String| + Default: `'terraform-ls'` + + This variable can be changed to use a different executable for terraform-ls. + + +g:ale_terraform_ls_options *g:ale_terraform_ls_options* + *b:ale_terraform_ls_options* + Type: |String| + Default: `''` + + This variable can be changed to pass custom CLI flags to terraform-ls. + + +=============================================================================== +terraform-lsp *ale-terraform-terraform-lsp* + +g:ale_terraform_langserver_executable *g:ale_terraform_langserver_executable* + *b:ale_terraform_langserver_executable* + Type: |String| + Default: `'terraform-lsp'` + + This variable can be changed to use a different executable for terraform-lsp. + + +g:ale_terraform_langserver_options *g:ale_terraform_langserver_options* + *b:ale_terraform_langserver_options* + Type: |String| + Default: `''` + + This variable can be changed to pass custom CLI flags to terraform-lsp. + + =============================================================================== tflint *ale-terraform-tflint* diff --git a/sources_non_forked/ale/doc/ale-tex.txt b/sources_non_forked/ale/doc/ale-tex.txt index 24aa3112..ceb9fa81 100644 --- a/sources_non_forked/ale/doc/ale-tex.txt +++ b/sources_non_forked/ale/doc/ale-tex.txt @@ -32,5 +32,46 @@ g:ale_lacheck_executable *g:ale_lacheck_executable* This variable can be changed to change the path to lacheck. + +=============================================================================== +latexindent *ale-tex-latexindent* + +g:ale_tex_latexindent_executable *g:ale_tex_latexindent_executable* + *b:ale_tex_latexindent_executable* + Type: |String| + Default: `'latexindent'` + + This variable can be changed to change the path to latexindent. + + +g:ale_tex_latexindent_options *g:ale_tex_latexindent_options* + *b:ale_tex_latexindent_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to latexindent. + + + +=============================================================================== +texlab *ale-tex-texlab* + +g:ale_tex_texlab_executable *g:ale_tex_texlab_executable* + *b:ale_tex_texlab_executable* + Type: |String| + Default: `'texlab'` + + This variable can be changed to change the path to texlab. + + +g:ale_tex_texlab_options *g:ale_tex_texlab_options* + *b:ale_tex_texlab_options* + Type: |String| + Default: `''` + + This variable can be changed to modify flags given to texlab. + + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-thrift.txt b/sources_non_forked/ale/doc/ale-thrift.txt index bb2ec058..810127b4 100644 --- a/sources_non_forked/ale/doc/ale-thrift.txt +++ b/sources_non_forked/ale/doc/ale-thrift.txt @@ -42,5 +42,24 @@ g:ale_thrift_thrift_options *g:ale_thrift_thrift_options* This variable can be changed to customize the additional command-line arguments that are passed to the thrift compiler. +=============================================================================== +thriftcheck *ale-thrift-thriftcheck* + +g:ale_thrift_thriftcheck_executable *g:ale_thrift_thriftcheck_executable* + *b:ale_thrift_thriftcheck_executable* + Type: |String| + Default: `'thriftcheck'` + + See |ale-integrations-local-executables| + + +g:ale_thrift_thriftcheck_options *g:ale_thrift_thriftcheck_options* + *b:ale_thrift_thriftcheck_options* + Type: |String| + Default: `''` + + This variable can be changed to customize the additional command-line + arguments that are passed to thriftcheck. + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-typescript.txt b/sources_non_forked/ale/doc/ale-typescript.txt index 7dc59820..8984e183 100644 --- a/sources_non_forked/ale/doc/ale-typescript.txt +++ b/sources_non_forked/ale/doc/ale-typescript.txt @@ -2,6 +2,45 @@ ALE TypeScript Integration *ale-typescript-options* +=============================================================================== +deno *ale-typescript-deno* + +Starting from version 1.6.0, Deno comes with its own language server. Earlier +versions are not supported. + +g:ale_deno_executable *g:ale_deno_executable* + *b:ale_deno_executable* + Type: |String| + Default: `'deno'` + + +g:ale_deno_lsp_project_root *g:ale_deno_lsp_project_root* + *b:ale_deno_lsp_project_root* + Type: |String| + Default: `''` + + If this variable is left unset, ALE will try to find the project root by + executing the following steps in the given order: + + 1. Find an ancestor directory containing a tsconfig.json. + 2. Find an ancestory directory containing a .git folder. + 3. Use the directory of the current buffer (if the buffer was opened from + a file). + +g:ale_deno_unstable *g:ale_deno_unstable* + *b:ale_deno_unstable* + Type: |Number| + Default: `0` + + Enable or disable unstable Deno features and APIs. + +g:ale_deno_importMap *g:ale_deno_importMap* + *b:ale_deno_importMap* + Type: |String| + Default: `'import_map.json'` + + Specify the import map filename to load url maps in a deno project. + =============================================================================== eslint *ale-typescript-eslint* @@ -16,6 +55,33 @@ prettier *ale-typescript-prettier* See |ale-javascript-prettier| for information about the available options. +=============================================================================== +standard *ale-typescript-standard* + +g:ale_typescript_standard_executable *g:ale_typescript_standard_executable* + *b:ale_typescript_standard_executable* + Type: |String| + Default: `'standard'` + + See |ale-integrations-local-executables| + + +g:ale_typescript_standard_options *g:ale_typescript_standard_options* + *b:ale_typescript_standard_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to standard. + + +g:ale_typescript_standard_use_global *g:ale_typescript_standard_use_global* + *b:ale_typescript_standard_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== tslint *ale-typescript-tslint* @@ -111,5 +177,32 @@ g:ale_typescript_tsserver_use_global *g:ale_typescript_tsserver_use_global* tsserver in node_modules. +=============================================================================== +xo *ale-typescript-xo* + +g:ale_typescript_xo_executable *g:ale_typescript_xo_executable* + *b:ale_typescript_xo_executable* + Type: |String| + Default: `'xo'` + + See |ale-integrations-local-executables| + + +g:ale_typescript_xo_options *g:ale_typescript_xo_options* + *b:ale_typescript_xo_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to xo. + + +g:ale_typescript_xo_use_global *g:ale_typescript_xo_use_global* + *b:ale_typescript_xo_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-v.txt b/sources_non_forked/ale/doc/ale-v.txt new file mode 100644 index 00000000..8c641447 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-v.txt @@ -0,0 +1,45 @@ +=============================================================================== +ALE V Integration *ale-v-options* + + +=============================================================================== +Integration Information + +`v` is V's build tool. `vfmt` (called as `v fmt` from the same +executable that does the builds) is the autoformatter/fixer. + +g:ale_v_v_executable *g:ale_v_v_executable* + *b:ale_v_v_executable* + + Type: |String| + Default: `'v'` + + The executable that will be run for the `v` linter and the `vfmt` fixer. + + +=============================================================================== +v *ale-v-v* + +g:ale_v_v_options *g:ale_v_v_options* + *b:ale_v_v_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the v linter. + They are injected directly after "v .". + + +=============================================================================== +vfmt *ale-v-vfmt* + +g:ale_v_vfmt_options *g:ale_v_vfmt_options* + *b:ale_v_vfmt_options* + Type: |String| + Default: `''` + + This variable can be set to pass additional options to the vfmt fixer. + They are injected directly after "v fmt". + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-vala.txt b/sources_non_forked/ale/doc/ale-vala.txt index ca24bcf4..d48f68bb 100644 --- a/sources_non_forked/ale/doc/ale-vala.txt +++ b/sources_non_forked/ale/doc/ale-vala.txt @@ -8,5 +8,26 @@ uncrustify *ale-vala-uncrustify* See |ale-c-uncrustify| for information about the available options. +=============================================================================== +Vala-Lint *ale-vala-vala-lint* + +g:vala_vala_lint_executable *g:vala_vala_lint_executable* + *b:vala_vala_lint_executable* + Type: |String| + Default: `'io.elementary.vala-lint'` + + This variable can be set to specify a Vala-Lint executable file. + + +g:vala_vala_lint_config_filename *g:vala_vala_lint_config_filename* + *b:vala_vala_lint_config_filename* + Type: |String| + Default: `'vala-lint.conf'` + + This variable can be set to specify a Vala-Lint config filename. When a file + with the specified name was not found or this variable was set to empty, + Vala-Lint will be executed without specifying a config filename. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-verilog.txt b/sources_non_forked/ale/doc/ale-verilog.txt index 94b820b8..11e988bb 100644 --- a/sources_non_forked/ale/doc/ale-verilog.txt +++ b/sources_non_forked/ale/doc/ale-verilog.txt @@ -3,7 +3,10 @@ ALE Verilog/SystemVerilog Integration *ale-verilog-options* =============================================================================== -ALE can use four different linters for Verilog HDL: +ALE can use six different linters for Verilog HDL: + + HDL Checker + Using `hdl_checker --lsp` iverilog: Using `iverilog -t null -Wall` @@ -17,6 +20,9 @@ ALE can use four different linters for Verilog HDL: Vivado Using `xvlog` + Yosys + Using `ysoys -Q -T -p 'read_verilog'` + By default, both 'verilog' and 'systemverilog' filetypes are checked. You can limit 'systemverilog' files to be checked using only 'verilator' by @@ -26,6 +32,9 @@ defining 'g:ale_linters' variable: \ let g:ale_linters = {'systemverilog' : ['verilator'],} < +=============================================================================== +General notes + Linters/compilers that utilize a "work" directory for analyzing designs- such as ModelSim and Vivado- can be passed the location of these directories as part of their respective option strings listed below. This is useful for @@ -40,6 +49,16 @@ changing. This can happen in the form of hangs or crashes. To help prevent this when using these linters, it may help to run linting less frequently; for example, only when a file is saved. +HDL Checker is an alternative for some of the issues described above. It wraps +around ghdl, Vivado and ModelSim/Questa and, when using the latter, it can +handle mixed language (VHDL, Verilog, SystemVerilog) designs. + +=============================================================================== +hdl-checker *ale-verilog-hdl-checker* + +See |ale-vhdl-hdl-checker| + + =============================================================================== iverilog *ale-verilog-iverilog* @@ -98,5 +117,26 @@ g:ale_verilog_xvlog_options *g:ale_verilog_xvlog_options* This variable can be changed to modify the flags/options passed to 'xvlog'. +=============================================================================== +yosys *ale-verilog-yosys* + +g:ale_verilog_yosys_executable *g:ale_verilog_yosys_executable* + *b:ale_verilog_yosys_executable* + Type: |String| + Default: `'yosys'` + + This variable can be changed to the path to the 'yosys' executable. + + +g:ale_verilog_yosys_options *g:ale_verilog_yosys_options* + *b:ale_verilog_yosys_options* + Type: |String| + Default: `'-Q -T -p ''read_verilog %s'''` + + This variable can be changed to modify the flags/options passed to 'yosys'. + By default, Yosys is an interative program. To obtain linting functionality, + the `'read_verilog'` command is used. + + =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale-vhdl.txt b/sources_non_forked/ale/doc/ale-vhdl.txt index 3fea947d..c2870240 100644 --- a/sources_non_forked/ale/doc/ale-vhdl.txt +++ b/sources_non_forked/ale/doc/ale-vhdl.txt @@ -3,10 +3,10 @@ ALE VHDL Integration *ale-vhdl-options* =============================================================================== -ALE can use three different linters for VHDL: +ALE can use four different linters for VHDL: - iverilog: - Using `iverilog -t null -Wall` + ghdl: + Using `ghdl --std=08` ModelSim/Questa Using `vcom -2008 -quiet -lint` @@ -14,8 +14,15 @@ ALE can use three different linters for VHDL: Vivado Using `xvhdl --2008` -Note all linters default to VHDL-2008 support. This, and other options, can be -changed with each linter's respective option variable. + HDL Checker + Using `hdl_checker --lsp` + +=============================================================================== +General notes + +ghdl, ModelSim/Questa and Vivado linters default to VHDL-2008 support. This, +and other options, can be changed with each linter's respective option +variable. Linters/compilers that utilize a "work" directory for analyzing designs- such as ModelSim and Vivado- can be passed the location of these directories as @@ -31,6 +38,10 @@ changing. This can happen in the form of hangs or crashes. To help prevent this when using these linters, it may help to run linting less frequently; for example, only when a file is saved. +HDL Checker is an alternative for some of the issues described above. It wraps +around ghdl, Vivado and ModelSim/Questa and, when using the latter, it can +handle mixed language (VHDL, Verilog, SystemVerilog) designs. + =============================================================================== ghdl *ale-vhdl-ghdl* @@ -50,6 +61,60 @@ g:ale_vhdl_ghdl_options *g:ale_vhdl_ghdl_options* This variable can be changed to modify the flags/options passed to 'ghdl'. +=============================================================================== +hdl-checker *ale-vhdl-hdl-checker* + +HDL Checker is a wrapper for VHDL/Verilg/SystemVerilog tools that aims to +reduce the boilerplate code needed to set things up. It can automatically +infer libraries for VHDL sources, determine the compilation order and provide +some static checks. + +You can install it using pip: +> + $ pip install hdl-checker + +`hdl-checker` will be run from a detected project root, determined by the +following methods, in order: + +1. Find the first directory containing a configuration file (see + |g:ale_hdl_checker_config_file|) +2. If no configuration file can be found, find the first directory containing + a folder named `'.git' +3. If no such folder is found, use the directory of the current buffer + + +g:ale_hdl_checker_executable + *g:ale_hdl_checker_executable* + *b:ale_hdl_checker_executable* + Type: |String| + Default: `'hdl_checker'` + + This variable can be changed to the path to the 'hdl_checker' executable. + + +g:ale_hdl_checker_options *g:ale_hdl_checker_options* + *b:ale_hdl_checker_options* + Type: |String| + Default: `''` + + This variable can be changed to modify the flags/options passed to the + 'hdl_checker' server startup command. + + +g:ale_hdl_checker_config_file *g:ale_hdl_checker_config_file* + *b:ale_hdl_checker_config_file* + Type: |String| + Default: `'.hdl_checker.config'` (Unix), + `'_hdl_checker.config'` (Windows) + + This variable can be changed to modify the config file HDL Checker will try + to look for. It will also affect how the project's root directory is + determined (see |ale-vhdl-hdl-checker|). + + More info on the configuration file format can be found at: + https://github.com/suoto/hdl_checker/wiki/Setting-up-a-project + + =============================================================================== vcom *ale-vhdl-vcom* diff --git a/sources_non_forked/ale/doc/ale-vim.txt b/sources_non_forked/ale/doc/ale-vim.txt index 772bad23..f85b43eb 100644 --- a/sources_non_forked/ale/doc/ale-vim.txt +++ b/sources_non_forked/ale/doc/ale-vim.txt @@ -2,6 +2,61 @@ ALE Vim Integration *ale-vim-options* +=============================================================================== +vimls *ale-vim-vimls* + + The `vim-language-server` is the engine that powers VimL editor support + using the Language Server Protocol. See the installation instructions: + https://github.com/iamcco/vim-language-server#install + +g:ale_vim_vimls_executable *g:ale_vim_vimls_executable* + *b:ale_vim_vimls_executable* + Type: |String| + Default: `'vim-language-server'` + + This option can be set to change the executable path for vimls. + + +g:ale_vim_vimls_config *g:ale_vim_vimls_config* + *b:ale_vim_vimls_config* + Type: |Dictionary| + Default: `{}` + + Dictionary containing configuration settings that will be passed to the + language server. For example: > + { + \ 'vim': { + \ 'iskeyword': '@,48-57,_,192-255,-#', + \ 'vimruntime': '', + \ 'runtimepath': '', + \ 'diagnostic': { + \ 'enable': v:true + \ }, + \ 'indexes': { + \ 'runtimepath': v:true, + \ 'gap': 100, + \ 'count': 3, + \ 'projectRootPatterns' : ['.git', 'autoload', 'plugin'] + \ }, + \ 'suggest': { + \ 'fromVimruntime': v:true, + \ 'fromRuntimepath': v:false + \ }, + \ } + \} +< + Consult the vim-language-server documentation for more information about + settings. + + +g:ale_vim_vimls_use_global *g:ale_vim_vimls_use_global* + *b:ale_vim_vimls_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== vint *ale-vim-vint* diff --git a/sources_non_forked/ale/doc/ale-yaml.txt b/sources_non_forked/ale/doc/ale-yaml.txt index c9a12ea1..65e0d069 100644 --- a/sources_non_forked/ale/doc/ale-yaml.txt +++ b/sources_non_forked/ale/doc/ale-yaml.txt @@ -1,6 +1,28 @@ =============================================================================== ALE YAML Integration *ale-yaml-options* + +=============================================================================== +circleci *ale-yaml-circleci* + +Website: https://circleci.com/docs/2.0/local-cli + + +Installation +------------------------------------------------------------------------------- + +Follow the instructions on the website, and make sure to test that you can +validate configuration files with: > + + circleci config validate - < .circleci/config.yml +< + +As long as the validator runs correctly, you should be able to see errors when +you save the configuration file. The validator doesn't run as you type because +it sends network requests, and running too often would overload the circleci +servers. + + =============================================================================== prettier *ale-yaml-prettier* @@ -15,7 +37,40 @@ Install prettier either globally or locally: > npm install prettier -g # global npm install prettier # local < - + +=============================================================================== +spectral *ale-yaml-spectral* + +Website: https://github.com/stoplightio/spectral + + +Installation +------------------------------------------------------------------------------- + +Install spectral either globally or locally: > + + npm install @stoplight/spectral -g # global + npm install @stoplight/spectral # local +< + +Options +------------------------------------------------------------------------------- + +g:ale_yaml_spectral_executable *g:ale_yaml_spectral_executable* + *b:ale_yaml_spectral_executable* + Type: |String| + Default: `'spectral'` + + This variable can be set to change the path to spectral. + +g:ale_yaml_spectral_use_global *g:ale_yaml_spectral_use_global* + *b:ale_yaml_spectral_use_global* + Type: |String| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== swaglint *ale-yaml-swaglint* @@ -50,6 +105,45 @@ g:ale_yaml_swaglint_use_global *g:ale_yaml_swaglint_use_global* See |ale-integrations-local-executables| +=============================================================================== +yamlfix *ale-yaml-yamlfix* + +Website: https://lyz-code.github.io/yamlfix + + +Installation +------------------------------------------------------------------------------- + +Install yamlfix: > + + pip install yamlfix +< + +Options +------------------------------------------------------------------------------- +g:ale_yaml_yamlfix_executable *g:ale_yaml_yamlfix_executable* + *b:ale_yaml_yamlfix_executable* + Type: |String| + Default: `'yamlfix'` + + See |ale-integrations-local-executables| + + +g:ale_yaml_yamlfix_options *g:ale_yaml_yamlfix_options* + *b:ale_yaml_yamlfix_options* + Type: |String| + Default: `''` + + This variable can be set to pass extra options to yamlfix. + +g:ale_yaml_yamlfix_use_global *g:ale_yaml_yamlfix_use_global* + *b:ale_yaml_yamlfix_use_global* + Type: |Number| + Default: `get(g:, 'ale_use_global_executables', 0)` + + See |ale-integrations-local-executables| + + =============================================================================== yamllint *ale-yaml-yamllint* diff --git a/sources_non_forked/ale/doc/ale-zeek.txt b/sources_non_forked/ale/doc/ale-zeek.txt new file mode 100644 index 00000000..910bc060 --- /dev/null +++ b/sources_non_forked/ale/doc/ale-zeek.txt @@ -0,0 +1,23 @@ +=============================================================================== +ALE Zeek Integration *ale-zeek-options* + *ale-integration-zeek* + +=============================================================================== +Integration Information + + Currently, the only supported linter for Zeek is zeek. + +=============================================================================== +zeek *ale-zeek-zeek* + +g:ale_zeek_zeek_executable *g:ale_zeek_zeek_executable* + *b:ale_zeek_zeek_executable* + Type: |String| + Default: `'zeek'` + + This variable can be modified to change the executable path for `zeek`. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: + diff --git a/sources_non_forked/ale/doc/ale-zig.txt b/sources_non_forked/ale/doc/ale-zig.txt new file mode 100644 index 00000000..70a53bbb --- /dev/null +++ b/sources_non_forked/ale/doc/ale-zig.txt @@ -0,0 +1,33 @@ +=============================================================================== +ALE Zig Integration *ale-zig-options* + *ale-integration-zig* + +=============================================================================== +Integration Information + + Currently, the only supported linter for zig is zls. + +=============================================================================== +zls *ale-zig-zls* + +g:ale_zig_zls_executable *g:ale_zig_zls_executable* + *b:ale_zig_zls_executable* + Type: |String| + Default: `'zls'` + + This variable can be modified to change the executable path for `zls`. + + +g:ale_zig_zls_config *g:ale_zig_zls_config* + *b:ale_zig_zls_config* + Type: |Dictionary| + Default: `{}` + + WARNING: As of writing, zls does not support receiving configuration + from the client. This variable is a PLACEHOLDER until it does. + + Dictionary with configuration settings for zls. + + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/sources_non_forked/ale/doc/ale.txt b/sources_non_forked/ale/doc/ale.txt index f3ceacdb..6cc81784 100644 --- a/sources_non_forked/ale/doc/ale.txt +++ b/sources_non_forked/ale/doc/ale.txt @@ -1,4 +1,4 @@ -*ale.txt* For Vim version 8.0. +*ale.txt* Plugin to lint and fix files asynchronously *ale* ALE - Asynchronous Lint Engine @@ -9,7 +9,9 @@ CONTENTS *ale-contents* 1. Introduction.........................|ale-introduction| 2. Supported Languages & Tools..........|ale-support| 3. Linting..............................|ale-lint| - 3.1 Other Sources.....................|ale-lint-other-sources| + 3.1 Linting On Other Machines.........|ale-lint-other-machines| + 3.2 Adding Language Servers...........|ale-lint-language-servers| + 3.3 Other Sources.....................|ale-lint-other-sources| 4. Fixing Problems......................|ale-fix| 5. Language Server Protocol Support.....|ale-lsp| 5.1 Completion........................|ale-completion| @@ -18,6 +20,7 @@ CONTENTS *ale-contents* 5.4 Find References...................|ale-find-references| 5.5 Hovering..........................|ale-hover| 5.6 Symbol Search.....................|ale-symbol-search| + 5.7 Refactoring: Rename, Actions......|ale-refactor| 6. Global Options.......................|ale-options| 6.1 Highlights........................|ale-highlights| 7. Linter/Fixer Options.................|ale-integration-options| @@ -48,364 +51,6 @@ ALE supports the following key features for linting: 5. Setting |signs| with warnings and errors for error markers. 6. Using |echo| to show error messages when the cursor moves. 7. Setting syntax highlights for errors. - ada...................................|ale-ada-options| - gcc.................................|ale-ada-gcc| - ansible...............................|ale-ansible-options| - ansible-lint........................|ale-ansible-ansible-lint| - asciidoc..............................|ale-asciidoc-options| - write-good..........................|ale-asciidoc-write-good| - textlint............................|ale-asciidoc-textlint| - asm...................................|ale-asm-options| - gcc.................................|ale-asm-gcc| - awk...................................|ale-awk-options| - gawk................................|ale-awk-gawk| - bib...................................|ale-bib-options| - bibclean............................|ale-bib-bibclean| - c.....................................|ale-c-options| - clang...............................|ale-c-clang| - clangd..............................|ale-c-clangd| - clang-format........................|ale-c-clangformat| - clangtidy...........................|ale-c-clangtidy| - cppcheck............................|ale-c-cppcheck| - cquery..............................|ale-c-cquery| - flawfinder..........................|ale-c-flawfinder| - gcc.................................|ale-c-gcc| - uncrustify..........................|ale-c-uncrustify| - ccls................................|ale-c-ccls| - chef..................................|ale-chef-options| - foodcritic..........................|ale-chef-foodcritic| - clojure...............................|ale-clojure-options| - joker...............................|ale-clojure-joker| - cloudformation........................|ale-cloudformation-options| - cfn-python-lint.....................|ale-cloudformation-cfn-python-lint| - cmake.................................|ale-cmake-options| - cmakelint...........................|ale-cmake-cmakelint| - cmake-format........................|ale-cmake-cmakeformat| - cpp...................................|ale-cpp-options| - clang...............................|ale-cpp-clang| - clangd..............................|ale-cpp-clangd| - clangcheck..........................|ale-cpp-clangcheck| - clang-format........................|ale-cpp-clangformat| - clangtidy...........................|ale-cpp-clangtidy| - clazy...............................|ale-cpp-clazy| - cppcheck............................|ale-cpp-cppcheck| - cpplint.............................|ale-cpp-cpplint| - cquery..............................|ale-cpp-cquery| - flawfinder..........................|ale-cpp-flawfinder| - gcc.................................|ale-cpp-gcc| - uncrustify..........................|ale-cpp-uncrustify| - ccls................................|ale-cpp-ccls| - c#....................................|ale-cs-options| - mcs.................................|ale-cs-mcs| - mcsc................................|ale-cs-mcsc| - uncrustify..........................|ale-cs-uncrustify| - css...................................|ale-css-options| - prettier............................|ale-css-prettier| - stylelint...........................|ale-css-stylelint| - cuda..................................|ale-cuda-options| - nvcc................................|ale-cuda-nvcc| - clang-format........................|ale-cuda-clangformat| - d.....................................|ale-d-options| - dls.................................|ale-d-dls| - uncrustify..........................|ale-d-uncrustify| - dart..................................|ale-dart-options| - dartanalyzer........................|ale-dart-dartanalyzer| - dartfmt.............................|ale-dart-dartfmt| - dockerfile............................|ale-dockerfile-options| - dockerfile_lint.....................|ale-dockerfile-dockerfile_lint| - hadolint............................|ale-dockerfile-hadolint| - elixir................................|ale-elixir-options| - mix.................................|ale-elixir-mix| - mix_format..........................|ale-elixir-mix-format| - dialyxir............................|ale-elixir-dialyxir| - elixir-ls...........................|ale-elixir-elixir-ls| - credo...............................|ale-elixir-credo| - elm...................................|ale-elm-options| - elm-format..........................|ale-elm-elm-format| - elm-lsp.............................|ale-elm-elm-lsp| - elm-make............................|ale-elm-elm-make| - erlang................................|ale-erlang-options| - erlc................................|ale-erlang-erlc| - syntaxerl...........................|ale-erlang-syntaxerl| - eruby.................................|ale-eruby-options| - ruumba..............................|ale-eruby-ruumba| - fish..................................|ale-fish-options| - fortran...............................|ale-fortran-options| - gcc.................................|ale-fortran-gcc| - language_server.....................|ale-fortran-language-server| - fountain..............................|ale-fountain-options| - fusionscript..........................|ale-fuse-options| - fusion-lint.........................|ale-fuse-fusionlint| - git commit............................|ale-gitcommit-options| - gitlint.............................|ale-gitcommit-gitlint| - glsl..................................|ale-glsl-options| - glslang.............................|ale-glsl-glslang| - glslls..............................|ale-glsl-glslls| - go....................................|ale-go-options| - gobuild.............................|ale-go-gobuild| - gofmt...............................|ale-go-gofmt| - golint..............................|ale-go-golint| - govet...............................|ale-go-govet| - gometalinter........................|ale-go-gometalinter| - staticcheck.........................|ale-go-staticcheck| - golangserver........................|ale-go-golangserver| - golangci-lint.......................|ale-go-golangci-lint| - bingo...............................|ale-go-bingo| - graphql...............................|ale-graphql-options| - eslint..............................|ale-graphql-eslint| - gqlint..............................|ale-graphql-gqlint| - prettier............................|ale-graphql-prettier| - hack..................................|ale-hack-options| - hack................................|ale-hack-hack| - hackfmt.............................|ale-hack-hackfmt| - hhast...............................|ale-hack-hhast| - handlebars............................|ale-handlebars-options| - ember-template-lint.................|ale-handlebars-embertemplatelint| - haskell...............................|ale-haskell-options| - brittany............................|ale-haskell-brittany| - ghc.................................|ale-haskell-ghc| - ghc-mod.............................|ale-haskell-ghc-mod| - cabal-ghc...........................|ale-haskell-cabal-ghc| - hdevtools...........................|ale-haskell-hdevtools| - hfmt................................|ale-haskell-hfmt| - hlint...............................|ale-haskell-hlint| - stack-build.........................|ale-haskell-stack-build| - stack-ghc...........................|ale-haskell-stack-ghc| - stylish-haskell.....................|ale-haskell-stylish-haskell| - hie.................................|ale-haskell-hie| - hcl...................................|ale-hcl-options| - terraform-fmt.......................|ale-hcl-terraform-fmt| - html..................................|ale-html-options| - htmlhint............................|ale-html-htmlhint| - tidy................................|ale-html-tidy| - prettier............................|ale-html-prettier| - stylelint...........................|ale-html-stylelint| - write-good..........................|ale-html-write-good| - idris.................................|ale-idris-options| - idris...............................|ale-idris-idris| - ispc..................................|ale-ispc-options| - ispc................................|ale-ispc-ispc| - java..................................|ale-java-options| - checkstyle..........................|ale-java-checkstyle| - javac...............................|ale-java-javac| - google-java-format..................|ale-java-google-java-format| - pmd.................................|ale-java-pmd| - javalsp.............................|ale-java-javalsp| - uncrustify..........................|ale-java-uncrustify| - javascript............................|ale-javascript-options| - eslint..............................|ale-javascript-eslint| - flow................................|ale-javascript-flow| - importjs............................|ale-javascript-importjs| - jscs................................|ale-javascript-jscs| - jshint..............................|ale-javascript-jshint| - prettier............................|ale-javascript-prettier| - prettier-eslint.....................|ale-javascript-prettier-eslint| - prettier-standard...................|ale-javascript-prettier-standard| - standard............................|ale-javascript-standard| - xo..................................|ale-javascript-xo| - json..................................|ale-json-options| - fixjson.............................|ale-json-fixjson| - jsonlint............................|ale-json-jsonlint| - jq..................................|ale-json-jq| - prettier............................|ale-json-prettier| - julia.................................|ale-julia-options| - languageserver......................|ale-julia-languageserver| - kotlin................................|ale-kotlin-options| - kotlinc.............................|ale-kotlin-kotlinc| - ktlint..............................|ale-kotlin-ktlint| - languageserver......................|ale-kotlin-languageserver| - latex.................................|ale-latex-options| - write-good..........................|ale-latex-write-good| - textlint............................|ale-latex-textlint| - less..................................|ale-less-options| - lessc...............................|ale-less-lessc| - prettier............................|ale-less-prettier| - stylelint...........................|ale-less-stylelint| - llvm..................................|ale-llvm-options| - llc.................................|ale-llvm-llc| - lua...................................|ale-lua-options| - luac................................|ale-lua-luac| - luacheck............................|ale-lua-luacheck| - markdown..............................|ale-markdown-options| - mdl.................................|ale-markdown-mdl| - prettier............................|ale-markdown-prettier| - remark-lint.........................|ale-markdown-remark-lint| - textlint............................|ale-markdown-textlint| - write-good..........................|ale-markdown-write-good| - mercury...............................|ale-mercury-options| - mmc.................................|ale-mercury-mmc| - nasm..................................|ale-nasm-options| - nasm................................|ale-nasm-nasm| - nroff.................................|ale-nroff-options| - write-good..........................|ale-nroff-write-good| - objc..................................|ale-objc-options| - clang...............................|ale-objc-clang| - clangd..............................|ale-objc-clangd| - uncrustify..........................|ale-objc-uncrustify| - ccls................................|ale-objc-ccls| - objcpp................................|ale-objcpp-options| - clang...............................|ale-objcpp-clang| - clangd..............................|ale-objcpp-clangd| - uncrustify..........................|ale-objcpp-uncrustify| - ocaml.................................|ale-ocaml-options| - merlin..............................|ale-ocaml-merlin| - ols.................................|ale-ocaml-ols| - ocamlformat.........................|ale-ocaml-ocamlformat| - pawn..................................|ale-pawn-options| - uncrustify..........................|ale-pawn-uncrustify| - perl..................................|ale-perl-options| - perl................................|ale-perl-perl| - perlcritic..........................|ale-perl-perlcritic| - perltidy............................|ale-perl-perltidy| - perl6.................................|ale-perl6-options| - perl6...............................|ale-perl6-perl6| - php...................................|ale-php-options| - langserver..........................|ale-php-langserver| - phan................................|ale-php-phan| - phpcbf..............................|ale-php-phpcbf| - phpcs...............................|ale-php-phpcs| - phpmd...............................|ale-php-phpmd| - phpstan.............................|ale-php-phpstan| - psalm...............................|ale-php-psalm| - php-cs-fixer........................|ale-php-php-cs-fixer| - php.................................|ale-php-php| - po....................................|ale-po-options| - write-good..........................|ale-po-write-good| - pod...................................|ale-pod-options| - write-good..........................|ale-pod-write-good| - pony..................................|ale-pony-options| - ponyc...............................|ale-pony-ponyc| - prolog................................|ale-prolog-options| - swipl...............................|ale-prolog-swipl| - proto.................................|ale-proto-options| - protoc-gen-lint.....................|ale-proto-protoc-gen-lint| - pug...................................|ale-pug-options| - puglint.............................|ale-pug-puglint| - puppet................................|ale-puppet-options| - puppet..............................|ale-puppet-puppet| - puppetlint..........................|ale-puppet-puppetlint| - puppet-languageserver...............|ale-puppet-languageserver| - pyrex (cython)........................|ale-pyrex-options| - cython..............................|ale-pyrex-cython| - python................................|ale-python-options| - autopep8............................|ale-python-autopep8| - bandit..............................|ale-python-bandit| - black...............................|ale-python-black| - flake8..............................|ale-python-flake8| - isort...............................|ale-python-isort| - mypy................................|ale-python-mypy| - prospector..........................|ale-python-prospector| - pycodestyle.........................|ale-python-pycodestyle| - pydocstyle..........................|ale-python-pydocstyle| - pyflakes............................|ale-python-pyflakes| - pylama..............................|ale-python-pylama| - pylint..............................|ale-python-pylint| - pyls................................|ale-python-pyls| - pyre................................|ale-python-pyre| - vulture.............................|ale-python-vulture| - yapf................................|ale-python-yapf| - qml...................................|ale-qml-options| - qmlfmt..............................|ale-qml-qmlfmt| - r.....................................|ale-r-options| - lintr...............................|ale-r-lintr| - reasonml..............................|ale-reasonml-options| - merlin..............................|ale-reasonml-merlin| - ols.................................|ale-reasonml-ols| - refmt...............................|ale-reasonml-refmt| - restructuredtext......................|ale-restructuredtext-options| - textlint............................|ale-restructuredtext-textlint| - write-good..........................|ale-restructuredtext-write-good| - ruby..................................|ale-ruby-options| - brakeman............................|ale-ruby-brakeman| - rails_best_practices................|ale-ruby-rails_best_practices| - reek................................|ale-ruby-reek| - rubocop.............................|ale-ruby-rubocop| - ruby................................|ale-ruby-ruby| - rufo................................|ale-ruby-rufo| - solargraph..........................|ale-ruby-solargraph| - standardrb..........................|ale-ruby-standardrb| - rust..................................|ale-rust-options| - cargo...............................|ale-rust-cargo| - rls.................................|ale-rust-rls| - rustc...............................|ale-rust-rustc| - rustfmt.............................|ale-rust-rustfmt| - sass..................................|ale-sass-options| - sasslint............................|ale-sass-sasslint| - stylelint...........................|ale-sass-stylelint| - scala.................................|ale-scala-options| - sbtserver...........................|ale-scala-sbtserver| - scalafmt............................|ale-scala-scalafmt| - scalastyle..........................|ale-scala-scalastyle| - scss..................................|ale-scss-options| - prettier............................|ale-scss-prettier| - sasslint............................|ale-scss-sasslint| - stylelint...........................|ale-scss-stylelint| - sh....................................|ale-sh-options| - sh-language-server..................|ale-sh-language-server| - shell...............................|ale-sh-shell| - shellcheck..........................|ale-sh-shellcheck| - shfmt...............................|ale-sh-shfmt| - sml...................................|ale-sml-options| - smlnj...............................|ale-sml-smlnj| - solidity..............................|ale-solidity-options| - solhint.............................|ale-solidity-solhint| - solium..............................|ale-solidity-solium| - spec..................................|ale-spec-options| - rpmlint.............................|ale-spec-rpmlint| - sql...................................|ale-sql-options| - sqlfmt..............................|ale-sql-sqlfmt| - stylus................................|ale-stylus-options| - stylelint...........................|ale-stylus-stylelint| - sugarss...............................|ale-sugarss-options| - stylelint...........................|ale-sugarss-stylelint| - tcl...................................|ale-tcl-options| - nagelfar............................|ale-tcl-nagelfar| - terraform.............................|ale-terraform-options| - fmt.................................|ale-terraform-fmt| - tflint..............................|ale-terraform-tflint| - tex...................................|ale-tex-options| - chktex..............................|ale-tex-chktex| - lacheck.............................|ale-tex-lacheck| - texinfo...............................|ale-texinfo-options| - write-good..........................|ale-texinfo-write-good| - text..................................|ale-text-options| - textlint............................|ale-text-textlint| - write-good..........................|ale-text-write-good| - thrift................................|ale-thrift-options| - thrift..............................|ale-thrift-thrift| - typescript............................|ale-typescript-options| - eslint..............................|ale-typescript-eslint| - prettier............................|ale-typescript-prettier| - tslint..............................|ale-typescript-tslint| - tsserver............................|ale-typescript-tsserver| - vala..................................|ale-vala-options| - uncrustify..........................|ale-vala-uncrustify| - verilog/systemverilog.................|ale-verilog-options| - iverilog............................|ale-verilog-iverilog| - verilator...........................|ale-verilog-verilator| - vlog................................|ale-verilog-vlog| - xvlog...............................|ale-verilog-xvlog| - vhdl..................................|ale-vhdl-options| - ghdl................................|ale-vhdl-ghdl| - vcom................................|ale-vhdl-vcom| - xvhdl...............................|ale-vhdl-xvhdl| - vim...................................|ale-vim-options| - vint................................|ale-vim-vint| - vim help..............................|ale-vim-help-options| - write-good..........................|ale-vim-help-write-good| - vue...................................|ale-vue-options| - prettier............................|ale-vue-prettier| - vls.................................|ale-vue-vls| - xhtml.................................|ale-xhtml-options| - write-good..........................|ale-xhtml-write-good| - xml...................................|ale-xml-options| - xmllint.............................|ale-xml-xmllint| - yaml..................................|ale-yaml-options| - prettier............................|ale-yaml-prettier| - swaglint............................|ale-yaml-swaglint| - yamllint............................|ale-yaml-yamllint| - yang..................................|ale-yang-options| - yang-lsp............................|ale-yang-lsp| ALE can fix problems with files with the |ALEFix| command, using the same job control functionality used for checking for problems. Try using the @@ -442,7 +87,7 @@ have even saved your changes. ALE will check your code in the following circumstances, which can be configured with the associated options. * When you modify a buffer. - |g:ale_lint_on_text_changed| -* On leaving insert mode. (off by default) - |g:ale_lint_on_insert_leave| +* On leaving insert mode. - |g:ale_lint_on_insert_leave| * When you open a new or modified buffer. - |g:ale_lint_on_enter| * When you save a buffer. - |g:ale_lint_on_save| * When the filetype changes for a buffer. - |g:ale_lint_on_filetype_changed| @@ -484,7 +129,7 @@ their relevant options. * By showing balloons for your mouse cursor - |g:ale_set_balloons| Please consult the documentation for each option, which can reveal some other -ways of tweaking the behaviour of each way of displaying problems. You can +ways of tweaking the behavior of each way of displaying problems. You can disable or enable whichever options you prefer. Most settings can be configured for each buffer. (|b:| instead of |g:|), @@ -500,10 +145,112 @@ ALE offers several options for controlling which linters are run. * Selecting linters to run. - |g:ale_linters| * Aliasing filetypes for linters - |g:ale_linter_aliases| * Only running linters you asked for. - |g:ale_linters_explicit| +* Disabling only a subset of linters. - |g:ale_linters_ignore| +* Disabling LSP linters and `tsserver`. - |g:ale_disable_lsp| + +You can stop ALE any currently running linters with the |ALELintStop| command. +Any existing problems will be kept. + +------------------------------------------------------------------------------- +3.1 Linting On Other Machines *ale-lint-other-machines* + +ALE offers support for running linters or fixers on files you are editing +locally on other machines, so long as the other machine has access to the file +you are editing. This could be a linter or fixer run inside of a Docker image, +running in a virtual machine, running on a remote server, etc. + +In order to run tools on other machines, you will need to configure your tools +to run via scripts that execute commands on those machines, such as by setting +the ALE `_executable` options for those tools to a path for a script to run, +or by using |g:ale_command_wrapper| to specify a script to wrap all commands +that are run by ALE, before they are executed. For tools that ALE runs where +ALE looks for locally installed executables first, you may need to set the +`_use_global` options for those tools to `1`, or you can set +|g:ale_use_global_executables| to `1` before ALE is loaded to only use global +executables for all tools. + +In order for ALE to properly lint or fix files which are running on another +file system, you must provide ALE with |List|s of strings for mapping paths to +and from your local file system and the remote file system, such as the file +system of your Docker container. See |g:ale_filename_mappings| for all of the +different ways these filename mappings can be configured. + +For example, you might configure `pylint` to run via Docker by creating a +script like so. > + + #!/usr/bin/env bash + + exec docker run -i --rm -v "$(pwd):/data" cytopia/pylint "$@" +< + +You will run to run Docker commands with `-i` in order to read from stdin. + +With the above script in mind, you might configure ALE to lint your Python +project with `pylint` by providing the path to the script to execute, and +mappings which describe how to between the two file systems in your +`python.vim` |ftplugin| file, like so: > + + if expand('%:p') =~# '^/home/w0rp/git/test-pylint/' + let b:ale_linters = ['pylint'] + let b:ale_python_pylint_use_global = 1 + " This is the path to the script above. + let b:ale_python_pylint_executable = '/home/w0rp/git/test-pylint/pylint.sh' + " /data matches the path in Docker. + let b:ale_filename_mappings = { + \ 'pylint': [ + \ ['/home/w0rp/git/test-pylint', '/data'], + \ ], + \} + endif +< + +You might consider using a Vim plugin for loading Vim configuration files +specific to each project, if you have a lot of projects to manage. ------------------------------------------------------------------------------- -3.1 Other Sources *ale-lint-other-sources* +3.2 Adding Language Servers *ale-lint-language-servers* + +ALE comes with many default configurations for language servers, so they can +be detected and run automatically. ALE can connect to other language servers +by defining a new linter for a filetype. New linters can be defined in |vimrc|, +in plugin files, or `ale_linters` directories in |runtimepath|. + +See |ale-linter-loading-behavior| for more information on loading linters. + +A minimal configuration for a language server linter might look so. > + + call ale#linter#Define('filetype_here', { + \ 'name': 'any_name_you_want', + \ 'lsp': 'stdio', + \ 'executable': '/path/to/executable', + \ 'command': '%e run', + \ 'project_root': '/path/to/root_of_project', + \}) +< +For language servers that use a TCP or named pipe socket connection, you +should define the address to connect to instead. > + + call ale#linter#Define('filetype_here', { + \ 'name': 'any_name_you_want', + \ 'lsp': 'socket', + \ 'address': 'servername:1234', + \ 'project_root': '/path/to/root_of_project', + \}) +< + Most of the options for a language server can be replaced with a |Funcref| + for a function accepting a buffer number for dynamically computing values + such as the executable path, the project path, the server address, etc, + most of which can also be determined based on executing some other + asynchronous task. See |ale#command#Run()| for computing linter options + based on asynchronous results. + + See |ale#linter#Define()| for a detailed explanation of all of the options + for configuring linters. + + +------------------------------------------------------------------------------- +3.3 Other Sources *ale-lint-other-sources* Problems for a buffer can be taken from other sources and rendered by ALE. This allows ALE to be used in combination with other plugins which also want @@ -560,7 +307,7 @@ A plugin might integrate its own checks with ALE like so: > function! WorkDone(buffer, results) abort " Send results to ALE after they have been collected. - call ale#other_source#ShowResults(buffer, 'some-name', a:results) + call ale#other_source#ShowResults(a:buffer, 'some-name', a:results) endfunction < @@ -595,12 +342,20 @@ the buffers being checked. When a |Dictionary| is returned for an |ALEFix| callback, the following keys are supported for running the commands. + `cwd` An optional |String| for setting the working directory + for the command. + + If not set, or `v:null`, the `cwd` of the last command + that spawn this one will be used. + `command` A |String| for the command to run. This key is required. When `%t` is included in a command string, a temporary file will be created, containing the lines from the file after previous adjustment have been done. + See |ale-command-format-strings| for formatting options. + `read_temporary_file` When set to `1`, ALE will read the contents of the temporary file created for `%t`. This option can be used for commands which need to modify some file on disk in @@ -667,6 +422,13 @@ by default. |g:ale_fix_on_save| - Fix files when they are saved. +Fixers can be disabled on save with |g:ale_fix_on_save_ignore|. They will +still be run when you manually run |ALEFix|. + +Fixers can be run on another machines, just like linters, such as fixers run +from a Docker container, running in a virtual machine, running a remote +server, etc. See |ale-lint-other-machines|. + =============================================================================== 5. Language Server Protocol Support *ale-lsp* @@ -676,83 +438,197 @@ servers. LSP linters can be used in combination with any other linter, and will automatically connect to LSP servers when needed. ALE also supports `tsserver` for TypeScript, which uses a different but very similar protocol. -ALE supports the following LSP/tsserver features: - -1. Diagnostics/linting - Enabled via selecting linters as usual. -2. Completion -3. Go to definition - +If you want to use another plugin for LSP features and tsserver, you can use +the |g:ale_disable_lsp| setting to disable ALE's own LSP integrations, or +ignore particular linters with |g:ale_linters_ignore|. ------------------------------------------------------------------------------- 5.1 Completion *ale-completion* -ALE offers limited support for automatic completion of code while you type. +ALE offers support for automatic completion of code while you type. Completion is only supported while at least one LSP linter is enabled. ALE will only suggest symbols provided by the LSP servers. -Suggestions will be made while you type after completion is enabled. -Completion can be enabled by setting |g:ale_completion_enabled| to `1`. This -setting must be set to `1` before ALE is loaded. The delay for completion can -be configured with |g:ale_completion_delay|. ALE will only suggest so many -possible matches for completion. The maximum number of items can be controlled -with |g:ale_completion_max_suggestions|. + *ale-deoplete-integration* + +ALE integrates with Deoplete for offering automatic completion data. ALE's +completion source for Deoplete is named `'ale'`, and should enabled +automatically if Deoplete is enabled and configured correctly. Deoplete +integration should not be combined with ALE's own implementation. + + *ale-asyncomplete-integration* + +ALE additionally integrates with asyncomplete.vim for offering automatic +completion data. ALE's asyncomplete source requires registration and should +use the defaults provided by the |asyncomplete#sources#ale#get_source_options| function > + + " Use ALE's function for asyncomplete defaults + au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#ale#get_source_options({ + \ 'priority': 10, " Provide your own overrides here + \ })) +> +ALE also offers its own completion implementation, which does not require any +other plugins. Suggestions will be made while you type after completion is +enabled. ALE's own completion implementation can be enabled by setting +|g:ale_completion_enabled| to `1`. This setting must be set to `1` before ALE +is loaded. The delay for completion can be configured with +|g:ale_completion_delay|. This setting should not be enabled if you wish to +use ALE as a completion source for other plugins. + +ALE automatic completion will not work when 'paste' is active. Only set +'paste' when you are copy and pasting text into your buffers. + +ALE automatic completion will interfere with default insert completion with +`CTRL-N` and so on (|compl-vim|). You can write your own keybinds and a +function in your |vimrc| file to force insert completion instead, like so: > + + function! SmartInsertCompletion() abort + " Use the default CTRL-N in completion menus + if pumvisible() + return "\" + endif + + " Exit and re-enter insert mode, and use insert completion + return "\a\" + endfunction + + inoremap =SmartInsertCompletion() +< +ALE provides an 'omnifunc' function |ale#completion#OmniFunc| for triggering +completion manually with CTRL-X CTRL-O. |i_CTRL-X_CTRL-O| > + + " Use ALE's function for omnicompletion. + set omnifunc=ale#completion#OmniFunc +< + *ale-completion-fallback* + +You can write your own completion function and fallback on other methods of +completion by checking if there are no results that ALE can determine. For +example, for Python code, you could fall back on the `python3complete` +function. > + + function! TestCompletionFunc(findstart, base) abort + let l:result = ale#completion#OmniFunc(a:findstart, a:base) + + " Check if ALE couldn't find anything. + if (a:findstart && l:result is -3) + \|| (!a:findstart && empty(l:result)) + " Defer to another omnifunc if ALE couldn't find anything. + return python3complete#Complete(a:findstart, a:base) + endif + + return l:result + endfunction + + set omnifunc=TestCompletionFunc +< +See |complete-functions| for documentation on how to write completion +functions. + +ALE will only suggest so many possible matches for completion. The maximum +number of items can be controlled with |g:ale_completion_max_suggestions|. If you don't like some of the suggestions you see, you can filter them out with |g:ale_completion_excluded_words| or |b:ale_completion_excluded_words|. The |ALEComplete| command can be used to show completion suggestions manually, -even when |g:ale_completion_enabled| is set to `0`. +even when |g:ale_completion_enabled| is set to `0`. For manually requesting +completion information with Deoplete, consult Deoplete's documentation. + +ALE by can support automatic imports from external modules. This behavior can +be enabled by setting the |g:ale_completion_autoimport| variable to `1`. + +You can manually request imports for symbols at the cursor with the +|ALEImport| command. The word at the cursor must be an exact match for some +potential completion result which includes additional text to insert into the +current buffer, which ALE will assume is code for an import line. This command +can be useful when your code already contains something you need to import. + +You can execute other commands whenever ALE inserts some completion text with +the |ALECompletePost| event. + +When working with TypeScript files, ALE can remove warnings from your +completions by setting the |g:ale_completion_tsserver_remove_warnings| +variable to 1. *ale-completion-completeopt-bug* -Automatic completion replaces |completeopt| before opening the omnicomplete -menu with . In some versions of Vim, the value set for the option -will not be respected. If you experience issues with Vim automatically -inserting text while you type, set the following option in vimrc, and your -issues should go away. > +ALE Automatic completion implementation replaces |completeopt| before opening +the omnicomplete menu with . In some versions of Vim, the value set +for the option will not be respected. If you experience issues with Vim +automatically inserting text while you type, set the following option in +vimrc, and your issues should go away. > set completeopt=menu,menuone,preview,noselect,noinsert < +Or alternatively, if you want to show documentation in popups: > + set completeopt=menu,menuone,popup,noselect,noinsert +< + *ale-symbols* + +ALE provides a set of basic completion symbols. If you want to replace those +symbols with others, you can set the variable |g:ale_completion_symbols| with +a mapping of the type of completion to the symbol or other string that you +would like to use. An example here shows the available options for symbols > + + let g:ale_completion_symbols = { + \ 'text': '๎˜’', + \ 'method': '๏ƒง', + \ 'function': '๏€“', + \ 'constructor': '๏†ฒ', + \ 'field': '๏‚ญ', + \ 'variable': '๏„ก', + \ 'class': '๏ƒจ', + \ 'interface': '๏‡ ', + \ 'module': '๏†ฒ', + \ 'property': '๏‚ญ', + \ 'unit': 'unit', + \ 'value': 'val', + \ 'enum': '๏‡ ', + \ 'keyword': 'keyword', + \ 'snippet': '๎˜’', + \ 'color': 'color', + \ 'file': '๏€ญ', + \ 'reference': 'ref', + \ 'folder': '๎—ฟ', + \ 'enum member': '๏†ฒ', + \ 'constant': '๏„ก', + \ 'struct': '๎˜Ž', + \ 'event': 'event', + \ 'operator': '๏‚ญ', + \ 'type_parameter': 'type param', + \ '': 'v' + \ } +< ------------------------------------------------------------------------------- 5.2 Go To Definition *ale-go-to-definition* ALE supports jumping to the files and locations where symbols are defined through any enabled LSP linters. The locations ALE will jump to depend on the -information returned by LSP servers. The following commands are supported: +information returned by LSP servers. The |ALEGoToDefinition| command will jump +to the definition of symbols under the cursor. See the documentation for the +command for configuring how the location will be displayed. -|ALEGoToDefinition| - Open the definition of the symbol under the cursor. -|ALEGoToDefinitionInTab| - The same, but for opening the file in a new tab. -|ALEGoToDefinitionInSplit| - The same, but in a new split. -|ALEGoToDefinitionInVSplit| - The same, but in a new vertical split. +ALE will update Vim's |tagstack| automatically unless |g:ale_update_tagstack| is +set to `0`. ------------------------------------------------------------------------------- 5.3 Go To Type Definition *ale-go-to-type-definition* ALE supports jumping to the files and locations where symbols' types are defined through any enabled LSP linters. The locations ALE will jump to depend -on the information returned by LSP servers. The following commands are -supported: - -|ALEGoToTypeDefinition| - Open the definition of the symbol's type under - the cursor. -|ALEGoToTypeDefinitionInTab| - The same, but for opening the file in a new tab. -|ALEGoToTypeDefinitionInSplit| - The same, but in a new split. -|ALEGoToTypeDefinitionInVSplit| - The same, but in a new vertical split. - +on the information returned by LSP servers. The |ALEGoToTypeDefinition| +command will jump to the definition of symbols under the cursor. See the +documentation for the command for configuring how the location will be +displayed. ------------------------------------------------------------------------------- 5.4 Find References *ale-find-references* -ALE supports finding references for symbols though any enabled LSP linters. -ALE will display a preview window showing the places where a symbol is -referenced in a codebase when a command is run. The following commands are -supported: - -|ALEFindReferences| - Find references for the word under the cursor. - -Options: - `-relative` Show file paths in the results relative to the working dir +ALE supports finding references for symbols though any enabled LSP linters +with the |ALEFindReferences| command. See the documentation for the command +for a full list of options. ------------------------------------------------------------------------------- 5.5 Hovering *ale-hover* @@ -762,12 +638,23 @@ at the cursor taken from LSP linters. The following commands are supported: |ALEHover| - Print information about the symbol at the cursor. +Truncated information will be displayed when the cursor rests on a symbol by +default, as long as there are no problems on the same line. You can disable +this behavior by setting |g:ale_hover_cursor| to `0`. + If |g:ale_set_balloons| is set to `1` and your version of Vim supports the |balloon_show()| function, then "hover" information also show up when you move the mouse over a symbol in a buffer. Diagnostic information will take priority over hover information for balloons. If a line contains a problem, that problem will be displayed in a balloon instead of hover information. +Hover information can be displayed in the preview window instead by setting +|g:ale_hover_to_preview| to `1`. + +When using Neovim or Vim with |popupwin|, if |g:ale_hover_to_floating_preview| +or |g:ale_floating_preview| is set to 1, the hover information will show in a +floating window. And |g:ale_floating_window_border| for the border setting. + For Vim 8.1+ terminals, mouse hovering is disabled by default. Enabling |balloonexpr| commands in terminals can cause scrolling issues in terminals, so ALE will not attempt to show balloons unless |g:ale_set_balloons| is set to @@ -788,14 +675,38 @@ Documentation for symbols at the cursor can be retrieved using the ------------------------------------------------------------------------------- 5.6 Symbol Search *ale-symbol-search* -ALE supports searching for workspace symbols via LSP linters. The following -commands are supported: +ALE supports searching for workspace symbols via LSP linters with the +|ALESymbolSearch| command. See the documentation for the command +for a full list of options. -|ALESymbolSearch| - Search for symbols in the workspace. +------------------------------------------------------------------------------- +5.7 Refactoring: Rename, Actions *ale-refactor* -Options: - `-relative` Show file paths in the results relative to the working dir +ALE supports renaming symbols in code such as variables or class names with +the |ALERename| command. +|ALECodeAction| will execute actions on the cursor or applied to a visual +range selection, such as automatically fixing errors. + +Actions will appear in the right click mouse menu by default for GUI versions +of Vim, unless disabled by setting |g:ale_popup_menu_enabled| to `0`. + +Make sure to set your Vim to move the cursor position whenever you right +click, and enable the mouse menu: > + + set mouse=a + set mousemodel=popup_setpos +< +You may wish to remove some other menu items you don't want to see: > + + silent! aunmenu PopUp.Select\ Word + silent! aunmenu PopUp.Select\ Sentence + silent! aunmenu PopUp.Select\ Paragraph + silent! aunmenu PopUp.Select\ Line + silent! aunmenu PopUp.Select\ Block + silent! aunmenu PopUp.Select\ Blockwise + silent! aunmenu PopUp.Select\ All +< =============================================================================== 6. Global Options *ale-options* @@ -901,6 +812,7 @@ g:ale_completion_delay *g:ale_completion_delay* g:ale_completion_enabled *g:ale_completion_enabled* + *b:ale_completion_enabled* Type: |Number| Default: `0` @@ -910,9 +822,40 @@ g:ale_completion_enabled *g:ale_completion_enabled* This setting must be set to `1` before ALE is loaded for this behavior to be enabled. + This setting should not be enabled if you wish to use ALE as a completion + source for other completion plugins. + + ALE automatic completion will not work when 'paste' is active. Only set + 'paste' when you are copy and pasting text into your buffers. + + A buffer-local version of this setting `b:ale_completion_enabled` can be set + to `0` to disable ALE's automatic completion support for a single buffer. + ALE's completion support must be enabled globally to be enabled locally. + See |ale-completion| + *g:ale_completion_tsserver_remove_warnings* +g:ale_completion_tsserver_remove_warnings + + Type: Number + Default: `0` + + When this option is set to `0`, ALE will return all completion items, + including those that are a warning. Warnings can be excluded from completed + items by setting it to `1`. + + +g:ale_completion_autoimport *g:ale_completion_autoimport* + + Type: Number + Default: `0` + + When this option is set to `0`, ALE will not try to automatically import + completion results from external modules. It can be enabled by setting it + to `1`. + + g:ale_completion_excluded_words *g:ale_completion_excluded_words* *b:ale_completion_excluded_words* Type: |List| @@ -931,6 +874,47 @@ g:ale_completion_excluded_words *g:ale_completion_excluded_words* let b:ale_completion_excluded_words = ['it', 'describe'] < +g:ale_completion_symbols *g:ale_completion_symbols* + + Type: |Dictionary| + + + A mapping from completion types to symbols for completions. See + |ale-symbols| for more information. + + By default, this mapping only uses built in Vim completion kinds, but it can + be updated to use any unicode character for the completion kind. For + example: > + let g:ale_completion_symbols = { + \ 'text': '๎˜’', + \ 'method': '๏ƒง', + \ 'function': '๏€“', + \ 'constructor': '๏†ฒ', + \ 'field': '๏‚ญ', + \ 'variable': '๏„ก', + \ 'class': '๏ƒจ', + \ 'interface': '๏‡ ', + \ 'module': '๏†ฒ', + \ 'property': '๏‚ญ', + \ 'unit': 'v', + \ 'value': 'v', + \ 'enum': 't', + \ 'keyword': 'v', + \ 'snippet': 'v', + \ 'color': 'v', + \ 'file': 'v', + \ 'reference': 'v', + \ 'folder': 'v', + \ 'enum_member': 'm', + \ 'constant': 'm', + \ 'struct': 't', + \ 'event': 'v', + \ 'operator': 'f', + \ 'type_parameter': 'p', + \ '': 'v' + \ }) +< + g:ale_completion_max_suggestions *g:ale_completion_max_suggestions* Type: |Number| @@ -969,6 +953,37 @@ g:ale_cursor_detail *g:ale_cursor_detail* loaded for messages to be displayed. See |ale-lint-settings-on-startup|. +g:ale_default_navigation *g:ale_default_navigation* + *b:ale_default_navigation* + + Type: |String| + Default: `'buffer'` + + The default method for navigating away from the current buffer to another + buffer, such as for |ALEFindReferences|, or |ALEGoToDefinition|. + + +g:ale_detail_to_floating_preview *g:ale_detail_to_floating_preview* + *b:ale_detail_to_floating_preview* + Type: |Number| + Default: `0` + + When this option is set to `1`, Neovim or Vim with |popupwin| will use a + floating window for ALEDetail output. + + +g:ale_disable_lsp *g:ale_disable_lsp* + *b:ale_disable_lsp* + + Type: |Number| + Default: `0` + + When this option is set to `1`, ALE ignores all linters powered by LSP, + and also `tsserver`. + + Please see also |ale-lsp|. + + g:ale_echo_cursor *g:ale_echo_cursor* Type: |Number| @@ -1009,7 +1024,7 @@ g:ale_echo_msg_error_str *g:ale_echo_msg_error_str* g:ale_echo_msg_format *g:ale_echo_msg_format* -b:ale_echo_msg_format *b:ale_echo_msg_format* + *b:ale_echo_msg_format* Type: |String| Default: `'%code: %%s'` @@ -1020,7 +1035,7 @@ b:ale_echo_msg_format *b: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 withe severity of the problem + `%severity%` - replaced with the severity of the problem The strings for `%severity%` can be configured with the following options. @@ -1037,7 +1052,7 @@ b:ale_echo_msg_format *b:ale_echo_msg_format* |g:ale_echo_cursor| needs to be set to 1 for messages to be displayed. The echo message format can also be configured separately for each buffer, - so different formats can be used for differnt languages. (Say in ftplugin + so different formats can be used for different languages. (Say in ftplugin files.) @@ -1049,6 +1064,15 @@ g:ale_echo_msg_info_str *g:ale_echo_msg_info_str* The string used for `%severity%` for info. See |g:ale_echo_msg_format| +g:ale_echo_msg_log_str *g:ale_echo_msg_log_str* + + Type: |String| + Default: `'Log'` + + The string used for `%severity%` for log, used only for handling LSP show + message requests. See |g:ale_lsp_show_message_format| + + g:ale_echo_msg_warning_str *g:ale_echo_msg_warning_str* Type: |String| @@ -1078,6 +1102,21 @@ g:ale_enabled *g:ale_enabled* See |g:ale_pattern_options| for more information on that option. +g:ale_exclude_highlights *g:ale_exclude_highlights* + *b:ale_exclude_highlights* + + Type: |List| + Default: `[]` + + A list of regular expressions for matching against highlight messages to + remove. For example: > + + " Do not highlight messages matching strings like these. + let b:ale_exclude_highlights = ['line too long', 'foo.*bar'] +< + See also: |g:ale_set_highlights| + + g:ale_fixers *g:ale_fixers* *b:ale_fixers* @@ -1101,7 +1140,7 @@ g:ale_fixers *g:ale_fixers* < g:ale_fix_on_save *g:ale_fix_on_save* -b:ale_fix_on_save *b:ale_fix_on_save* + *b:ale_fix_on_save* Type: |Number| Default: `0` @@ -1118,6 +1157,67 @@ b:ale_fix_on_save *b:ale_fix_on_save* Fixing files can be disabled or enabled for individual buffers by setting `b:ale_fix_on_save` to `0` or `1`. + Some fixers can be excluded from being run automatically when you save files + with the |g:ale_fix_on_save_ignore| setting. + + +g:ale_fix_on_save_ignore *g:ale_fix_on_save_ignore* + *b:ale_fix_on_save_ignore* + + Type: |Dictionary| or |List| + Default: `{}` + + Given a |Dictionary| mapping filetypes to |Lists| of fixers to ignore, or + just a |List| of fixers to ignore, exclude those fixers from being run + automatically when files are saved. + + You can disable some fixers in your ftplugin file: > + + " Disable fixers 'b' and 'c' when fixing on safe for this buffer. + let b:ale_fix_on_save_ignore = ['b', 'c'] + " Alternatively, define ignore lists for different filetypes. + let b:ale_fix_on_save_ignore = {'foo': ['b'], 'bar': ['c']} +< + You can disable some fixers globally per filetype like so: > + + let g:ale_fixers = {'foo': ['a', 'b'], 'bar': ['c', 'd']} + let g:ale_fix_on_save = 1 + " For filetype `foo.bar`, only fixers 'b' and 'd' will be run on save. + let g:ale_fix_on_save_ignore = {'foo': ['a'], 'bar': ['c']} + " Alternatively, disable these fixers on save for all filetypes. + let g:ale_fix_on_save_ignore = ['a', 'c'] +< + You can ignore fixers based on matching |Funcref| values too: > + + let g:AddBar = {buffer, lines -> lines + ['bar']} + let g:ale_fixers = {'foo': g:AddBar} + " The lambda fixer will be ignored, as it will be found in the ignore list. + let g:ale_fix_on_save_ignore = [g:AddBar] +< + +g:ale_floating_preview *g:ale_floating_preview* + + Type: |Number| + Default: `0` + + When set to `1`, Neovim or Vim with |popupwin| will use a floating window + for ale's preview window. + This is equivalent to setting |g:ale_hover_to_floating_preview| and + |g:ale_detail_to_floating_preview| to `1`. + + +g:ale_floating_window_border *g:ale_floating_window_border* + + Type: |List| + Default: `['|', '-', '+', '+', '+', '+']` + + When set to `[]`, window borders are disabled. The elements in the list set + the horizontal, top, top-left, top-right, bottom-right and bottom-left + border characters, respectively. + + If the terminal supports Unicode, you might try setting the value to + ` ['โ”‚', 'โ”€', 'โ•ญ', 'โ•ฎ', 'โ•ฏ', 'โ•ฐ']`, to make it look nicer. + g:ale_history_enabled *g:ale_history_enabled* @@ -1149,6 +1249,43 @@ g:ale_history_log_output *g:ale_history_log_output* if you want to save on some memory usage. +g:ale_hover_cursor *g:ale_hover_cursor* + + Type: |Number| + Default: `1` + + If set to `1`, ALE will show truncated information in the echo line about + the symbol at the cursor automatically when the |CursorHold| event is fired. + The delay before requesting hover information is based on 'updatetime', as + with all |CursorHold| events. + + If there's a problem on the line where the cursor is resting, ALE will not + show any hover information. + + See |ale-hover| for more information on hover information. + + This setting must be set to `1` before ALE is loaded for this behavior + to be enabled. See |ale-lint-settings-on-startup|. + + +g:ale_hover_to_preview *g:ale_hover_to_preview* + *b:ale_hover_to_preview* + Type: |Number| + Default: `0` + + If set to `1`, hover messages will be displayed in the preview window, + instead of in balloons or the message line. + + +g:ale_hover_to_floating_preview *g:ale_hover_to_floating_preview* + *b:ale_hover_to_floating_preview* + Type: |Number| + Default: `0` + + If set to `1`, Neovim or Vim with |popupwin| will use floating windows for + hover messages. + + g:ale_keep_list_window_open *g:ale_keep_list_window_open* *b:ale_keep_list_window_open* Type: |Number| @@ -1176,7 +1313,7 @@ g:ale_list_window_size *g:ale_list_window_size* g:ale_lint_delay *g:ale_lint_delay* - + *b:ale_lint_delay* Type: |Number| Default: `200` @@ -1184,6 +1321,9 @@ g:ale_lint_delay *g:ale_lint_delay* be run after text is changed. This option is only meaningful with the |g:ale_lint_on_text_changed| variable set to `always`, `insert`, or `normal`. + A buffer-local option, `b:ale_lint_delay`, can be set to change the delay + for different buffers, such as in |ftplugin| files. + g:ale_lint_on_enter *g:ale_lint_on_enter* @@ -1231,7 +1371,7 @@ g:ale_lint_on_save *g:ale_lint_on_save* g:ale_lint_on_text_changed *g:ale_lint_on_text_changed* Type: |String| - Default: `'always'` + Default: `'normal'` This option controls how ALE will check your files as you make changes. The following values can be used. @@ -1256,9 +1396,10 @@ g:ale_lint_on_text_changed *g:ale_lint_on_text_changed* g:ale_lint_on_insert_leave *g:ale_lint_on_insert_leave* + *b:ale_lint_on_insert_leave* Type: |Number| - Default: `0` + Default: `1` When set to `1` in your vimrc file, this option will cause ALE to run linters when you leave insert mode. @@ -1270,6 +1411,10 @@ g:ale_lint_on_insert_leave *g:ale_lint_on_insert_leave* " Make using Ctrl+C do the same as Escape, to trigger autocmd commands inoremap < + A buffer-local version of this setting `b:ale_lint_on_insert_leave` can be + set to `0` to disable linting when leaving insert mode. The setting must + be enabled globally to be enabled locally. + You should set this setting once before ALE is loaded, and restart Vim if you want to change your preferences. See |ale-lint-settings-on-startup|. @@ -1289,11 +1434,19 @@ g:ale_linter_aliases *g:ale_linter_aliases* { \ 'Dockerfile': 'dockerfile', \ 'csh': 'sh', + \ 'javascriptreact': ['javascript', 'jsx'], \ 'plaintex': 'tex', + \ 'ps1': 'powershell', + \ 'rmarkdown': 'r', + \ 'rmd': 'r', + \ 'svelte': ['svelte', 'javascript'], \ 'systemverilog': 'verilog', + \ 'typescriptreact': ['typescript', 'tsx'], \ 'verilog_systemverilog': ['verilog_systemverilog', 'verilog'], \ 'vimwiki': 'markdown', \ 'vue': ['vue', 'javascript'], + \ 'xsd': ['xsd', 'xml'], + \ 'xslt': ['xslt', 'xml'], \ 'zsh': 'sh', \} < @@ -1329,6 +1482,90 @@ g:ale_linter_aliases *g:ale_linter_aliases* < No linters will be loaded when the buffer's filetype is empty. + +g:ale_filename_mappings *g:ale_filename_mappings* + *b:ale_filename_mappings* + + Type: |Dictionary| or |List| + Default: `{}` + + Either a |Dictionary| mapping a linter or fixer name, as displayed in + |:ALEInfo|, to a |List| of two-item |List|s for filename mappings, or just a + |List| of two-item |List|s. When given some paths to files, the value of + this setting will be used to convert filenames on a local file system to + filenames on some remote file system, such as paths in a Docker image, + virtual machine, or network drive. + + For example: > + + let g:ale_filename_mappings = { + \ 'pylint': [ + \ ['/home/john/proj', '/data'], + \ ], + \} +< + With the above configuration, a filename such as `/home/john/proj/foo.py` + will be provided to the linter/fixer as `/data/foo.py`, and paths parsed + from linter results such as `/data/foo.py` will be converted back to + `/home/john/proj/foo.py`. + + You can use `*` as to apply a |List| of filename mappings to all other + linters or fixers not otherwise matched. > + + " Use one List of paths for pylint. + " Use another List of paths for everything else. + let g:ale_filename_mappings = { + \ 'pylint': [ + \ ['/home/john/proj', '/data'], + \ ], + \ '*': [ + \ ['/home/john/proj', '/other-data'], + \ ], + \} +< + If you just want every single linter or fixer to use the same filename + mapping, you can just use a |List|. > + + " Same as above, but for ALL linters and fixers. + let g:ale_filename_mappings = [ + \ ['/home/john/proj', '/data'], + \] +< + You can provide many such filename paths for multiple projects. Paths are + matched by checking if the start of a file path matches the given strings, + in a case-sensitive manner. Earlier entries in the |List| will be tried + before later entries when mapping to a given file system. + + Buffer-local options can be set to the same values to override the global + options, such as in |ftplugin| files. + + NOTE: Only fixers registered with a short name can support filename mapping + by their fixer names. See |ale-fix|. Filename mappings set for all tools by + using only a |List| for the setting will also be applied to fixers not in + the registry. + + NOTE: In order for this filename mapping to work correctly, linters and + fixers must exclusively determine paths to files to lint or fix via ALE + command formatting as per |ale-command-format-strings|, and paths parsed + from linter files must be provided in `filename` keys if a linter returns + results for more than one file at a time, as per |ale-loclist-format|. If + you discover a linter or fixer which does not behave properly, please report + it as an issue. + + If you are running a linter or fixer through Docker or another remote file + system, you may have to mount your temporary directory, which you can + discover with the following command: > + + :echo fnamemodify(tempname(), ':h:h') +< + You should provide a mapping from this temporary directory to whatever you + mount this directory to in Docker, or whatever remote file system you are + working with. + + You can inspect the filename mappings ALE will use with the + |ale#GetFilenameMappings()| function. + + g:ale_linters *g:ale_linters* *b:ale_linters* Type: |Dictionary| @@ -1341,19 +1578,23 @@ g:ale_linters *g:ale_linters* following values: > { + \ 'apkbuild': ['apkbuild_lint', 'secfixes_check'], \ 'csh': ['shell'], - \ 'elixir': ['credo', 'dialyxir', 'dogma', 'elixir-ls'], - \ 'go': ['gofmt', 'golint', 'go vet'], + \ 'elixir': ['credo', 'dialyxir', 'dogma'], + \ 'go': ['gofmt', 'golint', 'gopls', 'govet'], \ 'hack': ['hack'], \ 'help': [], + \ 'inko': ['inko'], \ 'perl': ['perlcritic'], \ 'perl6': [], - \ 'python': ['flake8', 'mypy', 'pylint'], - \ 'rust': ['cargo'], + \ 'python': ['flake8', 'mypy', 'pylint', 'pyright'], + \ 'rust': ['cargo', 'rls'], \ 'spec': [], + \ 'svelte': ['eslint', 'svelteserver'], \ 'text': [], \ 'vue': ['eslint', 'vls'], \ 'zsh': ['shell'], + \ 'v': ['v'], \} < This option can be used to enable only a particular set of linters for a @@ -1441,7 +1682,7 @@ g:ale_list_vertical *g:ale_list_vertical* g:ale_loclist_msg_format *g:ale_loclist_msg_format* -b:ale_loclist_msg_format *b:ale_loclist_msg_format* + *b:ale_loclist_msg_format* Type: |String| Default: `g:ale_echo_msg_format` @@ -1451,22 +1692,55 @@ b:ale_loclist_msg_format *b:ale_loclist_msg_format* The strings for configuring `%severity%` are also used for this option. -g:ale_lsp_root *g:ale_lsp_root* -b:ale_lsp_root *b:ale_lsp_root* - Type: |Dictionary| or |String| - Default: {} +g:ale_lsp_show_message_format *g:ale_lsp_show_message_format* - This option is used to determine the project root for the LSP linter. If the - value is a |Dictionary|, it maps a linter to either a string containing the - project root or a |Funcref| to call to look up the root. The funcref is - provided the buffer number as its argument. + Type: |String| + Default: `'%severity%:%linter%: %s'` - The buffer-specific variable may additionally be a string containing the - project root itself. + This variable defines the format that messages received from an LSP will + have when echoed. The following sequences of characters will be replaced. + + `%s` - replaced with the message text + `%linter%` - replaced with the name of the linter + `%severity%` - replaced with the severity of the message + + The strings for `%severity%` levels "error", "info" and "warning" are shared + with |g:ale_echo_msg_format|. Severity "log" is unique to + |g:ale_lsp_show_message_format| and it can be configured via + + |g:ale_echo_msg_log_str| - Defaults to `'Log'` + + Please note that |g:ale_lsp_show_message_format| *can not* be configured + separately for each buffer like |g:ale_echo_msg_format| can. + + +g:ale_lsp_show_message_severity *g:ale_lsp_show_message_severity* + + Type: |String| + Default: `'error'` + + This variable defines the minimum severity level an LSP message needs to be + displayed. Messages below this level are discarded; please note that + messages with `Log` severity level are always discarded. + + Possible values follow the LSP spec `MessageType` definition: + + `'error'` - Displays only errors. + `'warning'` - Displays errors and warnings. + `'information'` - Displays errors, warnings and infos + `'log'` - Same as `'information'` + `'disabled'` - Doesn't display any information at all. + + +g:ale_lsp_suggestions *g:ale_lsp_suggestions* + + Type: |Number| + Default: `0` + + If set to `1`, show hints/suggestions from LSP servers or tsserver, in + addition to warnings and errors. - If neither variable yields a result, a linter-specific function is invoked to - detect a project root. If this, too, yields no result, the linter is disabled. g:ale_max_buffer_history_size *g:ale_max_buffer_history_size* @@ -1576,10 +1850,65 @@ g:ale_pattern_options_enabled *g:ale_pattern_options_enabled* will not set buffer variables per |g:ale_pattern_options|. +g:ale_popup_menu_enabled *g:ale_popup_menu_enabled* + + Type: |Number| + Default: `has('gui_running')` + + When this option is set to `1`, ALE will show code actions and rename + capabilities in the right click mouse menu when there's a LSP server or + tsserver available. See |ale-refactor|. + + This feature is only supported in GUI versions of Vim. + + This setting must be set to `1` before ALE is loaded for this behavior + to be enabled. See |ale-lint-settings-on-startup|. + + +g:ale_rename_tsserver_find_in_comments *g:ale_rename_tsserver_find_in_comments* + + Type: |Number| + Default: `0` + + If enabled, this option will tell tsserver to find and replace text in + comments when calling |ALERename|. It can be enabled by settings the value + to `1`. + + +g:ale_rename_tsserver_find_in_strings *g:ale_rename_tsserver_find_in_strings* + + + Type: |Number| + Default: `0` + + If enabled, this option will tell tsserver to find and replace text in + strings when calling |ALERename|. It can be enabled by settings the value to + `1`. + + +g:ale_root *g:ale_root* + *b:ale_root* + + Type: |Dictionary| or |String| + Default: {} + + This option is used to determine the project root for a linter. If the value + is a |Dictionary|, it maps a linter to either a |String| containing the + project root or a |Funcref| to call to look up the root. The |Funcref| is + provided the buffer number as its argument. + + The buffer-specific variable may additionally be a string containing the + project root itself. + + If neither variable yields a result, a linter-specific function is invoked to + detect a project root. If this, too, yields no result, and the linter is an + LSP linter, it will not run. + + g:ale_set_balloons *g:ale_set_balloons* *b:ale_set_balloons* - Type: |Number| + Type: |Number| or |String| Default: `has('balloon_eval') && has('gui_running')` When this option is set to `1`, balloon messages will be displayed for @@ -1590,6 +1919,13 @@ g:ale_set_balloons *g:ale_set_balloons* supporting "Hover" information, per |ale-hover|, then brief information about the symbol under the cursor will be displayed in a balloon. + This option can be set to `'hover'` to only enable balloons for hover + message, so diagnostics are never shown in balloons. You may wish to + configure use this setting only in GUI Vim like so: > + + let g:ale_set_balloons = has('gui_running') ? 'hover' : 0 +< + Balloons can be enabled for terminal versions of Vim that support balloons, but some versions of Vim will produce strange mouse behavior when balloons are enabled. To configure balloons for your terminal, you should first @@ -1644,6 +1980,8 @@ g:ale_set_highlights *g:ale_set_highlights* match highlights, whereas the line highlights when signs are enabled will run to the edge of the screen. + Highlights can be excluded with the |g:ale_exclude_highlights| option. + g:ale_set_loclist *g:ale_set_loclist* @@ -1696,6 +2034,18 @@ g:ale_set_signs *g:ale_set_signs* |ALEWarningLine| - All items with `'type': 'W'` |ALEInfoLine| - All items with `'type': 'I'` + With Neovim 0.3.2 or higher, ALE can use the `numhl` option to highlight the + 'number' column. It uses the following highlight groups. + + |ALEErrorSignLineNr| - Items with `'type': 'E'` + |ALEWarningSignLineNr| - Items with `'type': 'W'` + |ALEInfoSignLineNr| - Items with `'type': 'I'` + |ALEStyleErrorSignLineNr| - Items with `'type': 'E'` and `'sub_type': 'style'` + |ALEStyleWarningSignLineNr| - Items with `'type': 'W'` and `'sub_type': 'style'` + + To enable line number highlighting |g:ale_sign_highlight_linenrs| must be + set to `1` before ALE is loaded. + The markers for the highlights can be customized with the following options: |g:ale_sign_error| @@ -1710,6 +2060,16 @@ g:ale_set_signs *g:ale_set_signs* To limit the number of signs ALE will set, see |g:ale_max_signs|. +g:ale_sign_priority *g:ale_sign_priority* + + Type: |Number| + Default: `30` + + From Neovim 0.4.0 and Vim 8.1, ALE can set sign priority to all signs. The + larger this value is, the higher priority ALE signs have over other plugin + signs. See |sign-priority| for further details on how priority works. + + g:ale_shell *g:ale_shell* Type: |String| @@ -1802,6 +2162,24 @@ g:ale_sign_warning *g:ale_sign_warning* The sign for warnings in the sign gutter. +g:ale_sign_highlight_linenrs *g:ale_sign_highlight_linenrs* + + Type: |Number| + Default: `0` + + When set to `1`, this option enables highlighting problems on the 'number' + column in Vim versions that support `numhl` highlights. This option must be + configured before ALE is loaded. + + +g:ale_update_tagstack *g:ale_update_tagstack* + *b:ale_update_tagstack* + Type: |Number| + Default: `1` + + This option can be set to disable updating Vim's |tagstack| automatically. + + g:ale_type_map *g:ale_type_map* *b:ale_type_map* Type: |Dictionary| @@ -1868,7 +2246,8 @@ g:ale_virtualtext_cursor *g:ale_virtualtext_cursor* g:ale_virtualtext_delay *g:ale_virtualtext_delay* -b:ale_virtualtext_delay *b:ale_virtualtext_delay* + *b:ale_virtualtext_delay* + Type: |Number| Default: `10` @@ -1887,7 +2266,7 @@ g:ale_virtualtext_prefix *g:ale_virtualtext_prefix* Prefix to be used with |g:ale_virtualtext_cursor|. g:ale_virtualenv_dir_names *g:ale_virtualenv_dir_names* -b:ale_virtualenv_dir_names *b:ale_virtualenv_dir_names* + *b:ale_virtualenv_dir_names* Type: |List| Default: `['.env', '.venv', 'env', 've-py3', 've', 'virtualenv', 'venv']` @@ -1901,7 +2280,7 @@ b:ale_virtualenv_dir_names *b:ale_virtualenv_dir_names* g:ale_warn_about_trailing_blank_lines *g:ale_warn_about_trailing_blank_lines* -b:ale_warn_about_trailing_blank_lines *b:ale_warn_about_trailing_blank_lines* + *b:ale_warn_about_trailing_blank_lines* Type: |Number| Default: `1` @@ -1913,7 +2292,7 @@ b:ale_warn_about_trailing_blank_lines *b:ale_warn_about_trailing_blank_lines* g:ale_warn_about_trailing_whitespace *g:ale_warn_about_trailing_whitespace* -b:ale_warn_about_trailing_whitespace *b:ale_warn_about_trailing_whitespace* + *b:ale_warn_about_trailing_whitespace* Type: |Number| Default: `1` @@ -1972,6 +2351,15 @@ ALEErrorSign *ALEErrorSign* The highlight for error signs. See |g:ale_set_signs|. +ALEErrorSignLineNr *ALEErrorSignLineNr* + + Default: `highlight link ALEErrorSignLineNr CursorLineNr` + + The highlight for error signs. See |g:ale_set_signs|. + + NOTE: This highlight is only available on Neovim 0.3.2 or higher. + + ALEInfo *ALEInfo.* *ALEInfo-highlight* Default: `highlight link ALEInfo ALEWarning` @@ -1996,6 +2384,15 @@ ALEInfoLine *ALEInfoLine* See |g:ale_set_signs| and |g:ale_set_highlights|. +ALEInfoSignLineNr *ALEInfoSignLineNr* + + Default: `highlight link ALEInfoSignLineNr CursorLineNr` + + The highlight for error signs. See |g:ale_set_signs|. + + NOTE: This highlight is only available on Neovim 0.3.2 or higher. + + ALEStyleError *ALEStyleError* Default: `highlight link ALEStyleError ALEError` @@ -2010,6 +2407,15 @@ ALEStyleErrorSign *ALEStyleErrorSign* The highlight for style error signs. See |g:ale_set_signs|. +ALEStyleErrorSignLineNr *ALEStyleErrorSignLineNr* + + Default: `highlight link ALEStyleErrorSignLineNr CursorLineNr` + + The highlight for error signs. See |g:ale_set_signs|. + + NOTE: This highlight is only available on Neovim 0.3.2 or higher. + + ALEStyleWarning *ALEStyleWarning* Default: `highlight link ALEStyleWarning ALEError` @@ -2024,6 +2430,15 @@ ALEStyleWarningSign *ALEStyleWarningSign* The highlight for style warning signs. See |g:ale_set_signs|. +ALEStyleWarningSignLineNr *ALEStyleWarningSignLineNr* + + Default: `highlight link ALEStyleWarningSignLineNr CursorLineNr` + + The highlight for error signs. See |g:ale_set_signs|. + + NOTE: This highlight is only available on Neovim 0.3.2 or higher. + + ALEVirtualTextError *ALEVirtualTextError* Default: `highlight link ALEVirtualTextError ALEError` @@ -2083,6 +2498,15 @@ ALEWarningSign *ALEWarningSign* The highlight for warning signs. See |g:ale_set_signs|. +ALEWarningSignLineNr *ALEWarningSignLineNr* + + Default: `highlight link ALEWarningSignLineNr CursorLineNr` + + The highlight for error signs. See |g:ale_set_signs|. + + NOTE: This highlight is only available on Neovim 0.3.2 or higher. + + =============================================================================== 7. Linter/Fixer Options *ale-integration-options* @@ -2151,6 +2575,14 @@ g:ale_languagetool_executable *g:ale_languagetool_executable* The executable to run for languagetool. +g:ale_languagetool_options *g:ale_languagetool_options* + *b:ale_languagetool_options* + Type: |String| + Default: `'--autoDetect'` + + This variable can be set to pass additional options to languagetool. + + ------------------------------------------------------------------------------- 7.3. Options for write-good *ale-write-good-options* @@ -2189,8 +2621,13 @@ documented in additional help files. ada.....................................|ale-ada-options| gcc...................................|ale-ada-gcc| + gnatpp................................|ale-ada-gnatpp| + ada-language-server...................|ale-ada-language-server| ansible.................................|ale-ansible-options| ansible-lint..........................|ale-ansible-ansible-lint| + apkbuild................................|ale-apkbuild-options| + apkbuild-lint.........................|ale-apkbuild-apkbuild-lint| + secfixes-check........................|ale-apkbuild-secfixes-check| asciidoc................................|ale-asciidoc-options| write-good............................|ale-asciidoc-write-good| textlint..............................|ale-asciidoc-textlint| @@ -2198,22 +2635,28 @@ documented in additional help files. gcc...................................|ale-asm-gcc| awk.....................................|ale-awk-options| gawk..................................|ale-awk-gawk| + bats....................................|ale-bats-options| + shellcheck............................|ale-bats-shellcheck| + bazel...................................|ale-bazel-options| + buildifier............................|ale-bazel-buildifier| bib.....................................|ale-bib-options| bibclean..............................|ale-bib-bibclean| c.......................................|ale-c-options| - clang.................................|ale-c-clang| + astyle................................|ale-c-astyle| + cc....................................|ale-c-cc| + ccls..................................|ale-c-ccls| clangd................................|ale-c-clangd| clang-format..........................|ale-c-clangformat| clangtidy.............................|ale-c-clangtidy| cppcheck..............................|ale-c-cppcheck| cquery................................|ale-c-cquery| flawfinder............................|ale-c-flawfinder| - gcc...................................|ale-c-gcc| uncrustify............................|ale-c-uncrustify| - ccls..................................|ale-c-ccls| chef....................................|ale-chef-options| + cookstyle.............................|ale-chef-cookstyle| foodcritic............................|ale-chef-foodcritic| clojure.................................|ale-clojure-options| + clj-kondo.............................|ale-clojure-clj-kondo| joker.................................|ale-clojure-joker| cloudformation..........................|ale-cloudformation-options| cfn-python-lint.......................|ale-cloudformation-cfn-python-lint| @@ -2221,9 +2664,11 @@ documented in additional help files. cmakelint.............................|ale-cmake-cmakelint| cmake-format..........................|ale-cmake-cmakeformat| cpp.....................................|ale-cpp-options| - clang.................................|ale-cpp-clang| - clangd................................|ale-cpp-clangd| + astyle................................|ale-cpp-astyle| + cc....................................|ale-cpp-cc| + ccls..................................|ale-cpp-ccls| clangcheck............................|ale-cpp-clangcheck| + clangd................................|ale-cpp-clangd| clang-format..........................|ale-cpp-clangformat| clangtidy.............................|ale-cpp-clangtidy| clazy.................................|ale-cpp-clazy| @@ -2231,25 +2676,39 @@ documented in additional help files. cpplint...............................|ale-cpp-cpplint| cquery................................|ale-cpp-cquery| flawfinder............................|ale-cpp-flawfinder| - gcc...................................|ale-cpp-gcc| uncrustify............................|ale-cpp-uncrustify| - ccls..................................|ale-cpp-ccls| c#......................................|ale-cs-options| + csc...................................|ale-cs-csc| + dotnet-format.........................|ale-cs-dotnet-format| mcs...................................|ale-cs-mcs| mcsc..................................|ale-cs-mcsc| uncrustify............................|ale-cs-uncrustify| css.....................................|ale-css-options| + fecs..................................|ale-css-fecs| prettier..............................|ale-css-prettier| stylelint.............................|ale-css-stylelint| cuda....................................|ale-cuda-options| nvcc..................................|ale-cuda-nvcc| + clangd................................|ale-cuda-clangd| clang-format..........................|ale-cuda-clangformat| d.......................................|ale-d-options| + dfmt..................................|ale-d-dfmt| dls...................................|ale-d-dls| uncrustify............................|ale-d-uncrustify| + dafny...................................|ale-dafny-options| + dafny.................................|ale-dafny-dafny| dart....................................|ale-dart-options| + analysis_server.......................|ale-dart-analysis_server| + dart-analyze..........................|ale-dart-analyze| + dart-format...........................|ale-dart-format| dartanalyzer..........................|ale-dart-dartanalyzer| dartfmt...............................|ale-dart-dartfmt| + desktop.................................|ale-desktop-options| + desktop-file-validate.................|ale-desktop-desktop-file-validate| + dhall...................................|ale-dhall-options| + dhall-format..........................|ale-dhall-format| + dhall-freeze..........................|ale-dhall-freeze| + dhall-lint............................|ale-dhall-lint| dockerfile..............................|ale-dockerfile-options| dockerfile_lint.......................|ale-dockerfile-dockerfile_lint| hadolint..............................|ale-dockerfile-hadolint| @@ -2261,14 +2720,19 @@ documented in additional help files. credo.................................|ale-elixir-credo| elm.....................................|ale-elm-options| elm-format............................|ale-elm-elm-format| - elm-lsp...............................|ale-elm-elm-lsp| + elm-ls................................|ale-elm-elm-ls| elm-make..............................|ale-elm-elm-make| erlang..................................|ale-erlang-options| + dialyzer..............................|ale-erlang-dialyzer| + elvis.................................|ale-erlang-elvis| erlc..................................|ale-erlang-erlc| + erlfmt................................|ale-erlang-erlfmt| syntaxerl.............................|ale-erlang-syntaxerl| eruby...................................|ale-eruby-options| + erblint...............................|ale-eruby-erblint| ruumba................................|ale-eruby-ruumba| fish....................................|ale-fish-options| + fish_indent...........................|ale-fish-fish_indent| fortran.................................|ale-fortran-options| gcc...................................|ale-fortran-gcc| language_server.......................|ale-fortran-language-server| @@ -2281,15 +2745,18 @@ documented in additional help files. glslang...............................|ale-glsl-glslang| glslls................................|ale-glsl-glslls| go......................................|ale-go-options| + bingo.................................|ale-go-bingo| gobuild...............................|ale-go-gobuild| gofmt.................................|ale-go-gofmt| - golint................................|ale-go-golint| - govet.................................|ale-go-govet| - gometalinter..........................|ale-go-gometalinter| - staticcheck...........................|ale-go-staticcheck| - golangserver..........................|ale-go-golangserver| golangci-lint.........................|ale-go-golangci-lint| - bingo.................................|ale-go-bingo| + golangserver..........................|ale-go-golangserver| + golines...............................|ale-go-golines| + golint................................|ale-go-golint| + gometalinter..........................|ale-go-gometalinter| + gopls.................................|ale-go-gopls| + govet.................................|ale-go-govet| + revive................................|ale-go-revive| + staticcheck...........................|ale-go-staticcheck| graphql.................................|ale-graphql-options| eslint................................|ale-graphql-eslint| gqlint................................|ale-graphql-gqlint| @@ -2299,29 +2766,41 @@ documented in additional help files. hackfmt...............................|ale-hack-hackfmt| hhast.................................|ale-hack-hhast| handlebars..............................|ale-handlebars-options| + prettier..............................|ale-handlebars-prettier| ember-template-lint...................|ale-handlebars-embertemplatelint| haskell.................................|ale-haskell-options| brittany..............................|ale-haskell-brittany| + floskell..............................|ale-haskell-floskell| ghc...................................|ale-haskell-ghc| ghc-mod...............................|ale-haskell-ghc-mod| cabal-ghc.............................|ale-haskell-cabal-ghc| hdevtools.............................|ale-haskell-hdevtools| hfmt..................................|ale-haskell-hfmt| + hindent...............................|ale-haskell-hindent| hlint.................................|ale-haskell-hlint| + hls...................................|ale-haskell-hls| stack-build...........................|ale-haskell-stack-build| stack-ghc.............................|ale-haskell-stack-ghc| stylish-haskell.......................|ale-haskell-stylish-haskell| hie...................................|ale-haskell-hie| + ormolu................................|ale-haskell-ormolu| hcl.....................................|ale-hcl-options| terraform-fmt.........................|ale-hcl-terraform-fmt| html....................................|ale-html-options| + angular...............................|ale-html-angular| + fecs..................................|ale-html-fecs| + html-beautify.........................|ale-html-beautify| htmlhint..............................|ale-html-htmlhint| - tidy..................................|ale-html-tidy| prettier..............................|ale-html-prettier| stylelint.............................|ale-html-stylelint| + tidy..................................|ale-html-tidy| write-good............................|ale-html-write-good| idris...................................|ale-idris-options| idris.................................|ale-idris-idris| + ink.....................................|ale-ink-options| + ink-language-server...................|ale-ink-language-server| + inko....................................|ale-inko-options| + inko..................................|ale-inko-inko| ispc....................................|ale-ispc-options| ispc..................................|ale-ispc-ispc| java....................................|ale-java-options| @@ -2330,9 +2809,12 @@ documented in additional help files. google-java-format....................|ale-java-google-java-format| pmd...................................|ale-java-pmd| javalsp...............................|ale-java-javalsp| + eclipselsp............................|ale-java-eclipselsp| uncrustify............................|ale-java-uncrustify| javascript..............................|ale-javascript-options| + deno..................................|ale-javascript-deno| eslint................................|ale-javascript-eslint| + fecs..................................|ale-javascript-fecs| flow..................................|ale-javascript-flow| importjs..............................|ale-javascript-importjs| jscs..................................|ale-javascript-jscs| @@ -2343,10 +2825,19 @@ documented in additional help files. standard..............................|ale-javascript-standard| xo....................................|ale-javascript-xo| json....................................|ale-json-options| + eslint................................|ale-json-eslint| fixjson...............................|ale-json-fixjson| jsonlint..............................|ale-json-jsonlint| jq....................................|ale-json-jq| prettier..............................|ale-json-prettier| + spectral..............................|ale-json-spectral| + jsonc...................................|ale-jsonc-options| + eslint................................|ale-jsonc-eslint| + jsonnet.................................|ale-jsonnet-options| + jsonnetfmt............................|ale-jsonnet-jsonnetfmt| + jsonnet-lint..........................|ale-jsonnet-jsonnet-lint| + json5...................................|ale-json5-options| + eslint................................|ale-json5-eslint| julia...................................|ale-julia-options| languageserver........................|ale-julia-languageserver| kotlin..................................|ale-kotlin-options| @@ -2363,10 +2854,15 @@ documented in additional help files. llvm....................................|ale-llvm-options| llc...................................|ale-llvm-llc| lua.....................................|ale-lua-options| + lua-format............................|ale-lua-lua-format| luac..................................|ale-lua-luac| luacheck..............................|ale-lua-luacheck| + luafmt................................|ale-lua-luafmt| + stylua................................|ale-lua-stylua| markdown................................|ale-markdown-options| + markdownlint..........................|ale-markdown-markdownlint| mdl...................................|ale-markdown-mdl| + pandoc................................|ale-markdown-pandoc| prettier..............................|ale-markdown-prettier| remark-lint...........................|ale-markdown-remark-lint| textlint..............................|ale-markdown-textlint| @@ -2375,6 +2871,13 @@ documented in additional help files. mmc...................................|ale-mercury-mmc| nasm....................................|ale-nasm-options| nasm..................................|ale-nasm-nasm| + nim.....................................|ale-nim-options| + nimcheck..............................|ale-nim-nimcheck| + nimlsp................................|ale-nim-nimlsp| + nimpretty.............................|ale-nim-nimpretty| + nix.....................................|ale-nix-options| + nixfmt................................|ale-nix-nixfmt| + nixpkgs-fmt...........................|ale-nix-nixpkgs-fmt| nroff...................................|ale-nroff-options| write-good............................|ale-nroff-write-good| objc....................................|ale-objc-options| @@ -2388,8 +2891,16 @@ documented in additional help files. uncrustify............................|ale-objcpp-uncrustify| ocaml...................................|ale-ocaml-options| merlin................................|ale-ocaml-merlin| + ocamllsp..............................|ale-ocaml-ocamllsp| ols...................................|ale-ocaml-ols| ocamlformat...........................|ale-ocaml-ocamlformat| + ocp-indent............................|ale-ocaml-ocp-indent| + openapi.................................|ale-openapi-options| + ibm_validator.........................|ale-openapi-ibm-validator| + prettier..............................|ale-openapi-prettier| + yamllint..............................|ale-openapi-yamllint| + pascal..................................|ale-pascal-options| + ptop..................................|ale-pascal-ptop| pawn....................................|ale-pawn-options| uncrustify............................|ale-pawn-uncrustify| perl....................................|ale-perl-options| @@ -2408,29 +2919,42 @@ documented in additional help files. psalm.................................|ale-php-psalm| php-cs-fixer..........................|ale-php-php-cs-fixer| php...................................|ale-php-php| + tlint.................................|ale-php-tlint| + intelephense..........................|ale-php-intelephense| po......................................|ale-po-options| write-good............................|ale-po-write-good| pod.....................................|ale-pod-options| write-good............................|ale-pod-write-good| pony....................................|ale-pony-options| ponyc.................................|ale-pony-ponyc| + powershell............................|ale-powershell-options| + powershell..........................|ale-powershell-powershell| + psscriptanalyzer....................|ale-powershell-psscriptanalyzer| prolog..................................|ale-prolog-options| swipl.................................|ale-prolog-swipl| proto...................................|ale-proto-options| protoc-gen-lint.......................|ale-proto-protoc-gen-lint| + protolint.............................|ale-proto-protolint| pug.....................................|ale-pug-options| puglint...............................|ale-pug-puglint| puppet..................................|ale-puppet-options| puppet................................|ale-puppet-puppet| puppetlint............................|ale-puppet-puppetlint| puppet-languageserver.................|ale-puppet-languageserver| + purescript..............................|ale-purescript-options| + purescript-language-server............|ale-purescript-language-server| + purs-tidy.............................|ale-purescript-tidy| + purty.................................|ale-purescript-purty| pyrex (cython)..........................|ale-pyrex-options| cython................................|ale-pyrex-cython| python..................................|ale-python-options| + autoflake.............................|ale-python-autoflake| + autoimport............................|ale-python-autoimport| autopep8..............................|ale-python-autopep8| bandit................................|ale-python-bandit| black.................................|ale-python-black| flake8................................|ale-python-flake8| + flakehell.............................|ale-python-flakehell| isort.................................|ale-python-isort| mypy..................................|ale-python-mypy| prospector............................|ale-python-prospector| @@ -2439,39 +2963,53 @@ documented in additional help files. pyflakes..............................|ale-python-pyflakes| pylama................................|ale-python-pylama| pylint................................|ale-python-pylint| - pyls..................................|ale-python-pyls| + pylsp.................................|ale-python-pylsp| pyre..................................|ale-python-pyre| + pyright...............................|ale-python-pyright| + reorder-python-imports................|ale-python-reorder_python_imports| vulture...............................|ale-python-vulture| yapf..................................|ale-python-yapf| qml.....................................|ale-qml-options| qmlfmt................................|ale-qml-qmlfmt| r.......................................|ale-r-options| + languageserver........................|ale-r-languageserver| lintr.................................|ale-r-lintr| + styler................................|ale-r-styler| reasonml................................|ale-reasonml-options| merlin................................|ale-reasonml-merlin| ols...................................|ale-reasonml-ols| + reason-language-server................|ale-reasonml-language-server| refmt.................................|ale-reasonml-refmt| restructuredtext........................|ale-restructuredtext-options| textlint..............................|ale-restructuredtext-textlint| write-good............................|ale-restructuredtext-write-good| + robot...................................|ale-robot-options| + rflint................................|ale-robot-rflint| ruby....................................|ale-ruby-options| brakeman..............................|ale-ruby-brakeman| + debride...............................|ale-ruby-debride| + prettier..............................|ale-ruby-prettier| rails_best_practices..................|ale-ruby-rails_best_practices| reek..................................|ale-ruby-reek| rubocop...............................|ale-ruby-rubocop| ruby..................................|ale-ruby-ruby| rufo..................................|ale-ruby-rufo| solargraph............................|ale-ruby-solargraph| + sorbet................................|ale-ruby-sorbet| standardrb............................|ale-ruby-standardrb| rust....................................|ale-rust-options| + analyzer..............................|ale-rust-analyzer| cargo.................................|ale-rust-cargo| rls...................................|ale-rust-rls| rustc.................................|ale-rust-rustc| rustfmt...............................|ale-rust-rustfmt| + salt....................................|ale-salt-options| + salt-lint.............................|ale-salt-salt-lint| sass....................................|ale-sass-options| sasslint..............................|ale-sass-sasslint| stylelint.............................|ale-sass-stylelint| scala...................................|ale-scala-options| + metals................................|ale-scala-metals| sbtserver.............................|ale-scala-sbtserver| scalafmt..............................|ale-scala-scalafmt| scalastyle............................|ale-scala-scalastyle| @@ -2480,6 +3018,7 @@ documented in additional help files. sasslint..............................|ale-scss-sasslint| stylelint.............................|ale-scss-stylelint| sh......................................|ale-sh-options| + bashate...............................|ale-sh-bashate| sh-language-server....................|ale-sh-language-server| shell.................................|ale-sh-shell| shellcheck............................|ale-sh-shellcheck| @@ -2487,24 +3026,40 @@ documented in additional help files. sml.....................................|ale-sml-options| smlnj.................................|ale-sml-smlnj| solidity................................|ale-solidity-options| + solc..................................|ale-solidity-solc| solhint...............................|ale-solidity-solhint| solium................................|ale-solidity-solium| spec....................................|ale-spec-options| rpmlint...............................|ale-spec-rpmlint| sql.....................................|ale-sql-options| + pgformatter...........................|ale-sql-pgformatter| sqlfmt................................|ale-sql-sqlfmt| + sqlformat.............................|ale-sql-sqlformat| stylus..................................|ale-stylus-options| stylelint.............................|ale-stylus-stylelint| sugarss.................................|ale-sugarss-options| stylelint.............................|ale-sugarss-stylelint| + svelte..................................|ale-svelte-options| + prettier..............................|ale-svelte-prettier| + svelteserver..........................|ale-svelte-svelteserver| + swift...................................|ale-swift-options| + apple-swift-format....................|ale-swift-apple-swift-format| + sourcekitlsp..........................|ale-swift-sourcekitlsp| + systemd.................................|ale-systemd-options| + systemd-analyze.......................|ale-systemd-analyze| tcl.....................................|ale-tcl-options| nagelfar..............................|ale-tcl-nagelfar| terraform...............................|ale-terraform-options| - fmt...................................|ale-terraform-fmt| + terraform-fmt-fixer...................|ale-terraform-fmt-fixer| + terraform.............................|ale-terraform-terraform| + terraform-ls..........................|ale-terraform-terraform-ls| + terraform-lsp.........................|ale-terraform-terraform-lsp| tflint................................|ale-terraform-tflint| tex.....................................|ale-tex-options| chktex................................|ale-tex-chktex| lacheck...............................|ale-tex-lacheck| + latexindent...........................|ale-tex-latexindent| + texlab................................|ale-tex-texlab| texinfo.................................|ale-texinfo-options| write-good............................|ale-texinfo-write-good| text....................................|ale-text-options| @@ -2512,26 +3067,37 @@ documented in additional help files. write-good............................|ale-text-write-good| thrift..................................|ale-thrift-options| thrift................................|ale-thrift-thrift| + thriftcheck...........................|ale-thrift-thriftcheck| typescript..............................|ale-typescript-options| + deno..................................|ale-typescript-deno| eslint................................|ale-typescript-eslint| prettier..............................|ale-typescript-prettier| + standard..............................|ale-typescript-standard| tslint................................|ale-typescript-tslint| tsserver..............................|ale-typescript-tsserver| + xo....................................|ale-typescript-xo| + v.......................................|ale-v-options| + v.....................................|ale-v-v| + vfmt..................................|ale-v-vfmt| vala....................................|ale-vala-options| uncrustify............................|ale-vala-uncrustify| verilog/systemverilog...................|ale-verilog-options| + hdl-checker...........................|ale-verilog-hdl-checker| iverilog..............................|ale-verilog-iverilog| verilator.............................|ale-verilog-verilator| vlog..................................|ale-verilog-vlog| xvlog.................................|ale-verilog-xvlog| + yosys.................................|ale-verilog-yosys| vhdl....................................|ale-vhdl-options| ghdl..................................|ale-vhdl-ghdl| + hdl-checker...........................|ale-vhdl-hdl-checker| vcom..................................|ale-vhdl-vcom| xvhdl.................................|ale-vhdl-xvhdl| - vim.....................................|ale-vim-options| - vint..................................|ale-vim-vint| vim help................................|ale-vim-help-options| write-good............................|ale-vim-help-write-good| + vim.....................................|ale-vim-options| + vimls.................................|ale-vim-vimls| + vint..................................|ale-vim-vint| vue.....................................|ale-vue-options| prettier..............................|ale-vue-prettier| vls...................................|ale-vue-vls| @@ -2540,11 +3106,18 @@ documented in additional help files. xml.....................................|ale-xml-options| xmllint...............................|ale-xml-xmllint| yaml....................................|ale-yaml-options| + circleci..............................|ale-yaml-circleci| prettier..............................|ale-yaml-prettier| + spectral..............................|ale-yaml-spectral| swaglint..............................|ale-yaml-swaglint| + yamlfix...............................|ale-yaml-yamlfix| yamllint..............................|ale-yaml-yamllint| yang....................................|ale-yang-options| yang-lsp..............................|ale-yang-lsp| + zeek....................................|ale-zeek-options| + zeek..................................|ale-zeek-zeek| + zig.....................................|ale-zig-options| + zls...................................|ale-zig-zls| =============================================================================== @@ -2555,7 +3128,7 @@ ALEComplete *ALEComplete* Manually trigger LSP autocomplete and show the menu. Works only when called from insert mode. > - inoremap :AleComplete + inoremap :ALEComplete < A plug mapping `(ale_complete)` is defined for this command. > @@ -2582,15 +3155,38 @@ ALEFindReferences *ALEFindReferences* Enter key (``) can be used to jump to a referencing location, or the `t` key can be used to jump to the location in a new tab. + The locations opened in different ways using the following variations. + + `:ALEFindReferences -tab` - Open the location in a new tab. + `:ALEFindReferences -split` - Open the location in a horizontal split. + `:ALEFindReferences -vsplit` - Open the location in a vertical split. + + The default method used for navigating to a new location can be changed + by modifying |g:ale_default_navigation|. + + You can add `-relative` to the command to view results with relatives paths, + instead of absolute paths. + + The selection can be opened again with the |ALERepeatSelection| command. + You can jump back to the position you were at before going to a reference of something with jump motions like CTRL-O. See |jump-motions|. A plug mapping `(ale_find_references)` is defined for this command. + You can define additional plug mapping with any additional options you want + like so: > + + nnoremap (my_mapping) :ALEFindReferences -relative +< ALEFix *ALEFix* Fix problems with the current buffer. See |ale-fix| for more information. + If the command is run with a bang (`:ALEFix!`), all warnings will be + suppressed, including warnings about no fixers being defined, and warnings + about not being able to apply fixes to a file because it has been changed. + A plug mapping `(ale_fix)` is defined for this command. @@ -2601,40 +3197,35 @@ ALEFixSuggest *ALEFixSuggest* See |ale-fix| for more information. -ALEGoToDefinition *ALEGoToDefinition* +ALEGoToDefinition `` *ALEGoToDefinition* Jump to the definition of a symbol under the cursor using the enabled LSP linters for the buffer. ALE will jump to a definition if an LSP server provides a location to jump to. Otherwise, ALE will do nothing. + The locations opened in different ways using the following variations. + + `:ALEGoToDefinition -tab` - Open the location in a new tab. + `:ALEGoToDefinition -split` - Open the location in a horizontal split. + `:ALEGoToDefinition -vsplit` - Open the location in a vertical split. + + The default method used for navigating to a new location can be changed + by modifying |g:ale_default_navigation|. + You can jump back to the position you were at before going to the definition of something with jump motions like CTRL-O. See |jump-motions|. - A plug mapping `(ale_go_to_definition)` is defined for this command. + You should consider using the 'hidden' option in combination with this + command. Otherwise, Vim will refuse to leave the buffer you're jumping from + unless you have saved your edits. + The following Plug mappings are defined for this command, which correspond + to the following commands. -ALEGoToDefinitionInTab *ALEGoToDefinitionInTab* - - The same as |ALEGoToDefinition|, but opens results in a new tab. - - A plug mapping `(ale_go_to_definition_in_tab)` is defined for this - command. - - -ALEGoToDefinitionInSplit *ALEGoToDefinitionInSplit* - - The same as |ALEGoToDefinition|, but opens results in a new split. - - A plug mapping `(ale_go_to_definition_in_split)` is defined for this - command. - - -ALEGoToDefinitionInVSplit *ALEGoToDefinitionInVSplit* - - The same as |ALEGoToDefinition|, but opens results in a new vertical split. - - A plug mapping `(ale_go_to_definition_in_vsplit)` is defined for this - command. + `(ale_go_to_definition)` - `:ALEGoToDefinition` + `(ale_go_to_definition_in_tab)` - `:ALEGoToDefinition -tab` + `(ale_go_to_definition_in_split)` - `:ALEGoToDefinition -split` + `(ale_go_to_definition_in_vsplit)` - `:ALEGoToDefinition -vsplit` ALEGoToTypeDefinition *ALEGoToTypeDefinition* @@ -2644,36 +3235,25 @@ ALEGoToTypeDefinition *ALEGoToTypeDefinition* definition if an LSP server provides a location to jump to. Otherwise, ALE will do nothing. + The locations opened in different ways using the following variations. + + `:ALEGoToTypeDefinition -tab` - Open the location in a new tab. + `:ALEGoToTypeDefinition -split` - Open the location in a horizontal split. + `:ALEGoToTypeDefinition -vsplit` - Open the location in a vertical split. + + The default method used for navigating to a new location can be changed + by modifying |g:ale_default_navigation|. + You can jump back to the position you were at before going to the definition of something with jump motions like CTRL-O. See |jump-motions|. - A plug mapping `(ale_go_to_type_definition)` is defined for this - command. + The following Plug mappings are defined for this command, which correspond + to the following commands. - -ALEGoToTypeDefinitionInTab *ALEGoToTypeDefinitionInTab* - - The same as |ALEGoToTypeDefinition|, but opens results in a new tab. - - A plug mapping `(ale_go_to_type_definition_in_tab)` is defined for - this command. - - -ALEGoToTypeDefinitionInSplit *ALEGoToTypeDefinitionInSplit* - - The same as |ALEGoToTypeDefinition|, but opens results in a new split. - - A plug mapping `(ale_go_to_type_definition_in_split)` is defined for - this command. - - -ALEGoToTypeDefinitionInVSplit *ALEGoToTypeDefinitionInVSplit* - - The same as |ALEGoToTypeDefinition|, but opens results in a new vertical - split. - - A plug mapping `(ale_go_to_type_definition_in_vsplit)` is defined for - this command. + `(ale_go_to_type_definition)` - `:ALEGoToTypeDefinition` + `(ale_go_to_type_definition_in_tab)` - `:ALEGoToTypeDefinition -tab` + `(ale_go_to_type_definition_in_split)` - `:ALEGoToTypeDefinition -split` + `(ale_go_to_type_definition_in_vsplit)` - `:ALEGoToTypeDefinition -vsplit` ALEHover *ALEHover* @@ -2689,6 +3269,53 @@ ALEHover *ALEHover* A plug mapping `(ale_hover)` is defined for this command. +ALEImport *ALEImport* + + Try to import a symbol using `tsserver` or a Language Server. + + ALE will look for completions for the word at the cursor which contain + additional text edits that possible insert lines to import the symbol. The + first match with additional text edits will be used, and may add other code + to the current buffer other than import lines. + + If linting is enabled, and |g:ale_lint_on_text_changed| is set to ever check + buffers when text is changed, the buffer will be checked again after changes + are made. + + A Plug mapping `(ale_import)` is defined for this command. This + mapping should only be bound for normal mode. + + +ALEOrganizeImports *ALEOrganizeImports* + + Organize imports using tsserver. Currently not implemented for LSPs. + + +ALERename *ALERename* + + Rename a symbol using `tsserver` or a Language Server. + + The symbol where the cursor is resting will be the symbol renamed, and a + prompt will open to request a new name. + + +ALECodeAction *ALECodeAction* + + Apply a code action via LSP servers or `tsserver`. + + If there is an error present on a line that can be fixed, ALE will + automatically fix a line, unless there are multiple possible code fixes to + apply. + + This command can be run in visual mode apply actions, such as applicable + refactors. A menu will be shown to select code action to apply. + + +ALERepeatSelection *ALERepeatSelection* + + Repeat the last selection displayed in the preview window. + + ALESymbolSearch `` *ALESymbolSearch* Search for symbols in the workspace, taken from any available LSP linters. @@ -2696,18 +3323,28 @@ ALESymbolSearch `` *ALESymbolSearch* The arguments provided to this command will be used as a search query for finding symbols in the workspace, such as functions, types, etc. + You can add `-relative` to the command to view results with relatives paths, + instead of absolute paths. + *:ALELint* ALELint *ALELint* Run ALE once for the current buffer. This command can be used to run ALE manually, instead of automatically, if desired. - This command will also run linters where `lint_file` is set to `1`, or in - other words linters which check the file instead of the Vim buffer. + This command will also run linters where `lint_file` is evaluates to `1`, + meaning linters which check the file instead of the Vim buffer. A plug mapping `(ale_lint)` is defined for this command. +ALELintStop *ALELintStop* + + Stop any currently running jobs for checking the current buffer. + + Any problems from previous linter results will continue to be shown. + + ALEPrevious *ALEPrevious* ALEPreviousWrap *ALEPreviousWrap* ALENext *ALENext* @@ -2725,7 +3362,7 @@ ALELast *ALELast* the last or first warning or error in the file, respectively. `ALEPrevious` and `ALENext` take optional flags arguments to custom their - behaviour : + behavior : `-wrap` enable wrapping around the file `-error`, `-warning` and `-info` enable jumping to errors, warnings or infos respectively, ignoring anything else. They are mutually exclusive and if @@ -2736,7 +3373,7 @@ ALELast *ALELast* Flags can be combined to create create custom jumping. Thus you can use ":ALENext -wrap -error -nosyle" to jump to the next error which is not a - style error while going back to the begining of the file if needed. + style error while going back to the beginning of the file if needed. `ALEFirst` goes to the first error or warning in the buffer, while `ALELast` goes to the last one. @@ -2885,6 +3522,23 @@ ale#Env(variable_name, value) *ale#Env()* 'set VAR="some value" && command' # On Windows +ale#GetFilenameMappings(buffer, name) *ale#GetFilenameMappings()* + + Given a `buffer` and the `name` of either a linter for fixer, return a + |List| of two-item |List|s that describe mapping to and from the local and + foreign file systems for running a particular linter or fixer. + + See |g:ale_filename_mappings| for details on filename mapping. + + +ale#Has(feature) *ale#Has()* + + Return `1` if ALE supports a given feature, like |has()| for Vim features. + + ALE versions can be checked with version strings in the format + `ale#Has('ale-x.y.z')`, such as `ale#Has('ale-2.4.0')`. + + ale#Pad(string) *ale#Pad()* Given a string or any |empty()| value, return either the string prefixed @@ -2899,9 +3553,9 @@ ale#Queue(delay, [linting_flag, buffer_number]) *ale#Queue()* The linters will always be run in the background. Calling this function again from the same buffer - An optional `linting_flag` argument can be given. If `linting_flag` - is `'lint_file'`, then linters where the `lint_file` option is set to `1` will be - run. Linters with `lint_file` set to `1` are not run by default. + An optional `linting_flag` argument can be given. If `linting_flag` is + `'lint_file'`, then linters where the `lint_file` option evaluates to `1` + will be run. Otherwise, those linters will not be run. An optional `buffer_number` argument can be given for specifying the buffer to check. The active buffer (`bufnr('')`) will be checked by default. @@ -2989,26 +3643,44 @@ ale#command#Run(buffer, command, callback, [options]) *ale#command#Run()* 'command': {b -> ale#command#Run(b, 'foo', function('s:GetCommand'))} < - The following `options` can be provided. - `output_stream` - Either `'stdout'`, `'stderr'`, `'both'`, or `'none`' for - selecting which output streams to read lines from. + `cwd` - An optional |String| for setting the working directory + for the command, just as per |ale#linter#Define|. - The default is `'stdout'` + If not set, or `v:null`, the `cwd` of the last command + that spawned this one will be used. - `executable` - An executable for formatting into `%e` in the command. - If this option is not provided, formatting commands with - `%e` will not work. + `output_stream` - Either `'stdout'`, `'stderr'`, `'both'`, or + `'none`' for selecting which output streams to read + lines from. - `read_buffer` - If set to `1`, the buffer will be piped into the - command. + The default is `'stdout'` - The default is `0`. + `executable` - An executable for formatting into `%e` in the + command. If this option is not provided, formatting + commands with `%e` will not work. + + `read_buffer` - If set to `1`, the buffer will be piped into the + command. + + The default is `0`. + + `input` - When creating temporary files with `%t` or piping + text into a command `input` can be set to a |List| of + text to use instead of the buffer's text. + + `filename_mappings` - A |List| of two-item |List|s describing filename + mappings to apply for formatted filenames in the + command string, as per |g:ale_filename_mappings|. + + If the call to this function is being used for a + linter or fixer, the mappings should be provided with + this option, and can be retrieved easily with + |ale#GetFilenameMappings()|. + + The default is `[]`. - `input` - When creating temporary files with `%t` or piping text - into a command `input` can be set to a |List| of text to - use instead of the buffer's text. ale#command#EscapeCommandPart(command_part) *ale#command#EscapeCommandPart()* @@ -3049,6 +3721,13 @@ ale#command#ManageFile(buffer, filename) *ale#command#ManageFile()* manages directories separately with the |ale#command#ManageDirectory| function. +ale#completion#OmniFunc(findstart, base) *ale#completion#OmniFunc()* + + A completion function to use with 'omnifunc'. + + See |ale-completion|. + + ale#engine#GetLoclist(buffer) *ale#engine#GetLoclist()* Given a buffer number, this function will return the list of problems @@ -3081,6 +3760,21 @@ ale#fix#registry#Add(name, func, filetypes, desc, [aliases]) ALE will search for fixers in the registry first by `name`, then by their `aliases`. + For example to register a custom fixer for `luafmt`: > + + function! FormatLua(buffer) abort + return { + \ 'command': 'luafmt --stdin' + \} + endfunction + + execute ale#fix#registry#Add('luafmt', 'FormatLua', ['lua'], 'luafmt for lua') + + " You can now use it in g:ale_fixers + let g:ale_fixers = { + \ 'lua': ['luafmt'] + } +< ale#linter#Define(filetype, linter) *ale#linter#Define()* @@ -3197,10 +3891,33 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()* The result can be computed with |ale#command#Run()|. + The command string can be formatted with format + markers. See |ale-command-format-strings|. + This command will be fed the lines from the buffer to check, and will produce the lines of output given to the `callback`. + `cwd` An optional |String| for setting the working + directory for the command, or a |Funcref| for a + function to call for computing the command, accepting + a buffer number. The working directory can be + specified as a format string for determining the path + dynamically. See |ale-command-format-strings|. + + To set the working directory to the directory + containing the file you're checking, you should + probably use `'%s:h'` as the option value. + + If this option is absent or the string is empty, the + `command` will be run with no determined working + directory in particular. + + The directory specified with this option will be used + as the default working directory for all commands run + in a chain with |ale#command#Run()|, unless otherwise + specified. + `output_stream` A |String| for the output stream the lines of output should be read from for the command which is run. The accepted values are `'stdout'`, `'stderr'`, and @@ -3216,24 +3933,30 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()* if a command manually reads from a temporary file instead, etc. + This option behaves as if it was set to `0` when the + `lint_file` option evaluates to `1`. + *ale-lint-file* - `lint_file` A |Number| (`0` or `1`) indicating whether a command - should read the file instead of the Vim buffer. This - option can be used for linters which must check the - file on disk, and which cannot check a Vim buffer - instead. + `lint_file` A |Number| (`0` or `1`), or a |Funcref| for a function + accepting a buffer number for computing either `0` or + `1`, indicating whether a command should read the file + instead of the Vim buffer. This option can be used + for linters which must check the file on disk, and + which cannot check a Vim buffer instead. - Linters set with this option will not be run as a - user types, per |g:ale_lint_on_text_changed|. Linters - will instead be run only when events occur against - the file on disk, including |g:ale_lint_on_enter| - and |g:ale_lint_on_save|. Linters with this option - set to `1` will also be run when linters are run - manually, per |ALELintPost-autocmd|. + The result can be computed with |ale#command#Run()|. - When this option is set to `1`, `read_buffer` will - be set automatically to `0`. The two options cannot - be used together. + Linters where the eventual value of this option + evaluates to `1` will not be run as a user types, per + |g:ale_lint_on_text_changed|. Linters will instead be + run only when events occur against the file on disk, + including |g:ale_lint_on_enter| and + |g:ale_lint_on_save|. Linters where this option + evaluates to `1` will also be run when the |ALELint| + command is run. + + When this option is evaluates to `1`, ALE will behave + as if `read_buffer` was set to `0`. *ale-lsp-linters* `lsp` A |String| for defining LSP (Language Server Protocol) @@ -3250,7 +3973,7 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()* When this argument is set to `'socket'`, then the linter will be defined as an LSP linter via a TCP - socket connection. `address` must be set. + or named pipe socket connection. `address` must be set. ALE will not start a server automatically. @@ -3275,7 +3998,10 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()* `address` A |String| representing an address to connect to, or a |Funcref| accepting a buffer number and - returning the |String|. + returning the |String|. If the value contains a + colon, it is interpreted as referring to a TCP + socket; otherwise it is interpreted as the path of a + named pipe. The result can be computed with |ale#command#Run()|. @@ -3353,7 +4079,7 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()* contents of the buffer being checked. All occurrences of `%t` in command strings will reference the one temporary file. The temporary file will be created inside a temporary directory, and the entire temporary directory - will be automatically deleted, following the behaviour of + will be automatically deleted, following the behavior of |ale#command#ManageDirectory|. This option can be used for some linters which do not support reading from stdin. @@ -3372,13 +4098,22 @@ ale#linter#Define(filetype, linter) *ale#linter#Define()* command, so literal character sequences `%s` and `%t` can be escaped by using `%%s` and `%%t` instead, etc. + Some |filename-modifiers| can be applied to `%s` and `%t`. Only `:h`, `:t`, + `:r`, and `:e` may be applied, other modifiers will be ignored. Filename + modifiers can be applied to the format markers by placing them after them. + + For example: > + 'command': '%s:h %s:e %s:h:t', +< + Given a path `/foo/baz/bar.txt`, the above command string will generate + something akin to `'/foo/baz' 'txt' 'baz'` + If a callback for a command generates part of a command string which might possibly contain `%%`, `%s`, `%t`, or `%e`, where the special formatting behavior is not desired, the |ale#command#EscapeCommandPart()| function can be used to replace those characters to avoid formatting issues. *ale-linter-loading-behavior* - *ale-linter-loading-behaviour* Linters for ALE will be loaded by searching |runtimepath| in the following format: > @@ -3426,6 +4161,33 @@ ale#linter#PreventLoading(filetype) *ale#linter#PreventLoading()* |runtimepath| for that filetype. This function can be called from vimrc or similar to prevent ALE from loading linters. + +ale#lsp_linter#SendRequest(buffer, linter_name, message, [Handler]) + *ale#lsp_linter#SendRequest()* + + Send a custom request to an LSP linter. The arguments are defined as + follows: + + `buffer` A valid buffer number. + + `linter_name` A |String| identifying an LSP linter that is available and + enabled for the |filetype| of `buffer`. + + `message` A |List| in the form `[is_notification, method, parameters]`, + containing three elements: + `is_notification` - an |Integer| that has value 1 if the + request is a notification, 0 otherwise; + `method` - a |String|, identifying an LSP method supported + by `linter`; + `parameters` - a |dictionary| of LSP parameters that are + applicable to `method`. + + `Handler` Optional argument, meaningful only when `message[0]` is 0. + A |Funcref| that is called when a response to the request is + received, and takes as unique argument a dictionary + representing the response obtained from the server. + + ale#other_source#ShowResults(buffer, linter_name, loclist) *ale#other_source#ShowResults()* @@ -3463,7 +4225,7 @@ ale#statusline#Count(buffer) *ale#statusline#Count()* ale#statusline#FirstProblem(buffer, type) *ale#statusline#FirstProblem()* Returns a copy of the first entry in the `loclist` that matches the supplied - buffer number and problem type. If there is no such enty, an empty dictionary + buffer number and problem type. If there is no such entry, an empty dictionary is returned. Problem type should be one of the strings listed below: @@ -3495,6 +4257,23 @@ g:ale_want_results_buffer *g:ale_want_results_buffer* figure out which buffer other sources should lint. +ALECompletePost *ALECompletePost-autocmd* + *ALECompletePost* + + This |User| autocmd is triggered after ALE inserts an item on + |CompleteDone|. This event can be used to run commands after a buffer + is changed by ALE as the result of completion. For example, |ALEFix| can + be configured to run automatically when completion is done: > + + augroup FixAfterComplete + autocmd! + " Run ALEFix when completion items are added. + autocmd User ALECompletePost ALEFix! + " If ALE starts fixing a file, stop linters running for now. + autocmd User ALEFixPre ALELintStop + augroup END +< + ALELintPre *ALELintPre-autocmd* *ALELintPre* ALELintPost *ALELintPost-autocmd* @@ -3537,6 +4316,13 @@ ALEJobStarted *ALEJobStarted-autocmd* |ale#engine#IsCheckingBuffer()| over |ALELintPre-autocmd|, which is actually triggered before any linters are executed. +ALELSPStarted *ALELSPStarted-autocmd* + *ALELSPStarted* + + This |User| autocommand is trigged immediately after an LSP connection is + successfully initialized. This provides a way to perform any additional + initialization work, such as setting up buffer-level mappings. + ALEWantResults *ALEWantResults-autocmd* *ALEWantResults* @@ -3564,7 +4350,7 @@ snazzy looking ale glass logo. Cheers, Mark! 11. Contact *ale-contact* If you like this plugin, and wish to get in touch, check out the GitHub -page for issues and more at https://github.com/w0rp/ale +page for issues and more at https://github.com/dense-analysis/ale If you wish to contact the author of this plugin directly, please feel free to send an email to devw0rp@gmail.com. diff --git a/sources_non_forked/ale/ftplugin/ale-preview-selection.vim b/sources_non_forked/ale/ftplugin/ale-preview-selection.vim index d77b4f98..7ec84068 100644 --- a/sources_non_forked/ale/ftplugin/ale-preview-selection.vim +++ b/sources_non_forked/ale/ftplugin/ale-preview-selection.vim @@ -12,5 +12,5 @@ noremap A noremap o noremap O " Keybinds for opening selection items. -noremap :call ale#preview#OpenSelectionInBuffer() +noremap :call ale#preview#OpenSelection() noremap t :call ale#preview#OpenSelectionInTab() diff --git a/sources_non_forked/ale/plugin/ale.vim b/sources_non_forked/ale/plugin/ale.vim index ad3d3e56..d19824b1 100644 --- a/sources_non_forked/ale/plugin/ale.vim +++ b/sources_non_forked/ale/plugin/ale.vim @@ -71,12 +71,12 @@ let g:ale_linter_aliases = get(g:, 'ale_linter_aliases', {}) let g:ale_lint_delay = get(g:, 'ale_lint_delay', 200) " This flag can be set to 'never' to disable linting when text is changed. -" This flag can also be set to 'insert' or 'normal' to lint when text is -" changed only in insert or normal mode respectively. -let g:ale_lint_on_text_changed = get(g:, 'ale_lint_on_text_changed', 'always') +" This flag can also be set to 'always' or 'insert' to lint when text is +" changed in both normal and insert mode, or only in insert mode respectively. +let g:ale_lint_on_text_changed = get(g:, 'ale_lint_on_text_changed', 'normal') " This flag can be set to 1 to enable linting when leaving insert mode. -let g:ale_lint_on_insert_leave = get(g:, 'ale_lint_on_insert_leave', 0) +let g:ale_lint_on_insert_leave = get(g:, 'ale_lint_on_insert_leave', 1) " This flag can be set to 0 to disable linting when the buffer is entered. let g:ale_lint_on_enter = get(g:, 'ale_lint_on_enter', 1) @@ -87,8 +87,8 @@ let g:ale_lint_on_save = get(g:, 'ale_lint_on_save', 1) " This flag can be set to 1 to enable linting when the filetype is changed. let g:ale_lint_on_filetype_changed = get(g:, 'ale_lint_on_filetype_changed', 1) -" This Dictionary configures the default LSP roots for various linters. -let g:ale_lsp_root = get(g:, 'ale_lsp_root', {}) +" If set to 1, hints and suggestion from LSP servers and tsserver will be shown. +let g:ale_lsp_suggestions = get(g:, 'ale_lsp_suggestions', 0) " This flag can be set to 1 to enable automatically fixing files on save. let g:ale_fix_on_save = get(g:, 'ale_fix_on_save', 0) @@ -97,6 +97,13 @@ let g:ale_fix_on_save = get(g:, 'ale_fix_on_save', 0) " should be used instead. let g:ale_enabled = get(g:, 'ale_enabled', 1) +" A Dictionary mapping linter or fixer names to Arrays of two-item Arrays +" mapping filename paths from one system to another. +let g:ale_filename_mappings = get(g:, 'ale_filename_mappings', {}) + +" This Dictionary configures the default project roots for various linters. +let g:ale_root = get(g:, 'ale_root', {}) + " These flags dictates if ale uses the quickfix or the loclist (loclist is the " default, quickfix overrides loclist). let g:ale_set_loclist = get(g:, 'ale_set_loclist', 1) @@ -109,6 +116,9 @@ let g:ale_set_signs = get(g:, 'ale_set_signs', has('signs')) " This flag can be set to 0 to disable setting error highlights. let g:ale_set_highlights = get(g:, 'ale_set_highlights', has('syntax')) +" This List can be configured to exclude particular highlights. +let g:ale_exclude_highlights = get(g:, 'ale_exclude_highlights', []) + " This flag can be set to 0 to disable echoing when the cursor moves. let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1) @@ -118,6 +128,9 @@ 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 set to 1 to enable LSP hover messages at the cursor. +let g:ale_hover_cursor = get(g:, 'ale_hover_cursor', 1) + " This flag can be set to 1 to automatically close the preview window upon " entering Insert Mode. let g:ale_close_preview_on_insert = get(g:, 'ale_close_preview_on_insert', 0) @@ -125,6 +138,23 @@ let g:ale_close_preview_on_insert = get(g:, 'ale_close_preview_on_insert', 0) " This flag can be set to 0 to disable balloon support. let g:ale_set_balloons = get(g:, 'ale_set_balloons', has('balloon_eval') && has('gui_running')) +" Use preview window for hover messages. +let g:ale_hover_to_preview = get(g:, 'ale_hover_to_preview', 0) + +" Float preview windows in Neovim +let g:ale_floating_preview = get(g:, 'ale_floating_preview', 0) + +" Hovers use floating windows in Neovim +let g:ale_hover_to_floating_preview = get(g:, 'ale_hover_to_floating_preview', 0) + +" Detail uses floating windows in Neovim +let g:ale_detail_to_floating_preview = get(g:, 'ale_detail_to_floating_preview', 0) + +" Border setting for floating preview windows in Neovim +" The element in the list presents - horizontal, top, top-left, top-right, +" bottom-right and bottom-left +let g:ale_floating_window_border = get(g:, 'ale_floating_window_border', ['|', '-', '+', '+', '+', '+']) + " This flag can be set to 0 to disable warnings for trailing whitespace let g:ale_warn_about_trailing_whitespace = get(g:, 'ale_warn_about_trailing_whitespace', 1) " This flag can be set to 0 to disable warnings for trailing blank lines @@ -142,7 +172,19 @@ let g:ale_completion_enabled = get(g:, 'ale_completion_enabled', 0) " Enable automatic detection of pipenv for Python linters. let g:ale_python_auto_pipenv = get(g:, 'ale_python_auto_pipenv', 0) -if g:ale_set_balloons +" Enable automatic detection of poetry for Python linters. +let g:ale_python_auto_poetry = get(g:, 'ale_python_auto_poetry', 0) + +" This variable can be overridden to set the GO111MODULE environment variable. +let g:ale_go_go111module = get(g:, 'ale_go_go111module', '') + +" Default executable for deno, needed set before plugin start +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 g:ale_set_balloons is 1 || g:ale_set_balloons is# 'hover' call ale#balloon#Enable() endif @@ -150,6 +192,10 @@ if g:ale_completion_enabled call ale#completion#Enable() endif +if g:ale_popup_menu_enabled + call ale#code_action#EnablePopUpMenu() +endif + " Define commands for moving through warnings and errors. command! -bar -nargs=* ALEPrevious \ :call ale#loclist_jumping#WrapJump('before', ) @@ -179,6 +225,8 @@ command! -bar ALEStopAllLSPs :call ale#lsp#reset#StopAllLSPs() " A command for linting manually. command! -bar ALELint :call ale#Queue(0, 'lint_file') +" Stop current jobs when linting. +command! -bar ALELintStop :call ale#engine#Stop(bufnr('')) " Define a command to get information about current filetype. command! -bar ALEInfo :call ale#debugging#Info() @@ -188,21 +236,18 @@ command! -bar ALEInfoToClipboard :call ale#debugging#InfoToClipboard() command! -bar -nargs=1 ALEInfoToFile :call ale#debugging#InfoToFile() " Fix problems in files. -command! -bar -nargs=* -complete=customlist,ale#fix#registry#CompleteFixers ALEFix :call ale#fix#Fix(bufnr(''), '', ) +command! -bar -bang -nargs=* -complete=customlist,ale#fix#registry#CompleteFixers ALEFix :call ale#fix#Fix(bufnr(''), '', ) " Suggest registered functions to use for fixing problems. command! -bar ALEFixSuggest :call ale#fix#registry#Suggest(&filetype) " Go to definition for tsserver and LSP -command! -bar ALEGoToDefinition :call ale#definition#GoTo({}) -command! -bar ALEGoToDefinitionInTab :call ale#definition#GoTo({'open_in': 'tab'}) -command! -bar ALEGoToDefinitionInSplit :call ale#definition#GoTo({'open_in': 'horizontal-split'}) -command! -bar ALEGoToDefinitionInVSplit :call ale#definition#GoTo({'open_in': 'vertical-split'}) +command! -bar -nargs=* ALEGoToDefinition :call ale#definition#GoToCommandHandler('', ) " Go to type definition for tsserver and LSP -command! -bar ALEGoToTypeDefinition :call ale#definition#GoToType({}) -command! -bar ALEGoToTypeDefinitionInTab :call ale#definition#GoToType({'open_in': 'tab'}) -command! -bar ALEGoToTypeDefinitionInSplit :call ale#definition#GoToType({'open_in': 'horizontal-split'}) -command! -bar ALEGoToTypeDefinitionInVSplit :call ale#definition#GoToType({'open_in': 'vertical-split'}) +command! -bar -nargs=* ALEGoToTypeDefinition :call ale#definition#GoToCommandHandler('type', ) + +" Repeat a previous selection in the preview window +command! -bar ALERepeatSelection :call ale#preview#RepeatSelection() " Find references for tsserver and LSP command! -bar -nargs=* ALEFindReferences :call ale#references#Find() @@ -216,7 +261,20 @@ command! -bar ALEDocumentation :call ale#hover#ShowDocumentationAtCursor() " Search for appearances of a symbol, such as a type name or function name. command! -nargs=1 ALESymbolSearch :call ale#symbol#Search() -command! -bar ALEComplete :call ale#completion#GetCompletions(1) +" Complete text with tsserver and LSP +command! -bar ALEComplete :call ale#completion#GetCompletions('ale-manual') + +" Try to find completions for the current symbol that add additional text. +command! -bar ALEImport :call ale#completion#Import() + +" Rename symbols using tsserver and LSP +command! -bar -bang ALERename :call ale#rename#Execute() + +" Apply code actions to a range. +command! -bar -range ALECodeAction :call ale#codefix#Execute() + +" Organize import statements using tsserver +command! -bar ALEOrganizeImports :call ale#organize_imports#Execute() " mappings for commands nnoremap (ale_previous) :ALEPrevious @@ -245,17 +303,21 @@ nnoremap (ale_lint) :ALELint nnoremap (ale_detail) :ALEDetail nnoremap (ale_fix) :ALEFix nnoremap (ale_go_to_definition) :ALEGoToDefinition -nnoremap (ale_go_to_definition_in_tab) :ALEGoToDefinitionInTab -nnoremap (ale_go_to_definition_in_split) :ALEGoToDefinitionInSplit -nnoremap (ale_go_to_definition_in_vsplit) :ALEGoToDefinitionInVSplit +nnoremap (ale_go_to_definition_in_tab) :ALEGoToDefinition -tab +nnoremap (ale_go_to_definition_in_split) :ALEGoToDefinition -split +nnoremap (ale_go_to_definition_in_vsplit) :ALEGoToDefinition -vsplit nnoremap (ale_go_to_type_definition) :ALEGoToTypeDefinition -nnoremap (ale_go_to_type_definition_in_tab) :ALEGoToTypeDefinitionInTab -nnoremap (ale_go_to_type_definition_in_split) :ALEGoToTypeDefinitionInSplit -nnoremap (ale_go_to_type_definition_in_vsplit) :ALEGoToTypeDefinitionInVSplit +nnoremap (ale_go_to_type_definition_in_tab) :ALEGoToTypeDefinition -tab +nnoremap (ale_go_to_type_definition_in_split) :ALEGoToTypeDefinition -split +nnoremap (ale_go_to_type_definition_in_vsplit) :ALEGoToTypeDefinitionIn -vsplit nnoremap (ale_find_references) :ALEFindReferences nnoremap (ale_hover) :ALEHover nnoremap (ale_documentation) :ALEDocumentation inoremap (ale_complete) :ALEComplete +nnoremap (ale_import) :ALEImport +nnoremap (ale_rename) :ALERename +nnoremap (ale_code_action) :ALECodeAction +nnoremap (ale_repeat_selection) :ALERepeatSelection " Set up autocmd groups now. call ale#events#Init() diff --git a/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py b/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py new file mode 100644 index 00000000..82d9bbf2 --- /dev/null +++ b/sources_non_forked/ale/rplugin/python3/deoplete/sources/ale.py @@ -0,0 +1,61 @@ +""" +A Deoplete source for ALE completion via tsserver and LSP. +""" +__author__ = 'Joao Paulo, w0rp' + +try: + from deoplete.source.base import Base +except ImportError: + # Mock the Base class if deoplete isn't available, as mock isn't available + # in the Docker image. + class Base(object): + def __init__(self, vim): + pass + + +# Make sure this code is valid in Python 2, used for running unit tests. +class Source(Base): + + def __init__(self, vim): + super(Source, self).__init__(vim) + + self.name = 'ale' + self.mark = '[L]' + self.rank = 1000 + self.is_bytepos = True + self.min_pattern_length = 1 + self.is_volatile = True + # Do not forget to update s:trigger_character_map in completion.vim in + # updating entries in this map. + self.input_patterns = { + '_': r'\.\w*$', + 'rust': r'(\.|::)\w*$', + 'typescript': r'(\.|\'|")\w*$', + 'cpp': r'(\.|::|->)\w*$', + } + + # Returns an integer for the start position, as with omnifunc. + def get_complete_position(self, context): + return self.vim.call( + 'ale#completion#GetCompletionPositionForDeoplete', context['input'] + ) + + def gather_candidates(self, context): + # Stop early if ALE can't provide completion data for this buffer. + if not self.vim.call('ale#completion#CanProvideCompletions'): + return None + + event = context.get('event') + + if event == 'Async': + result = self.vim.call('ale#completion#GetCompletionResult') + + return result or [] + + if context.get('is_refresh'): + self.vim.command( + "call ale#completion#GetCompletions('ale-callback', " + + "{'callback': {completions -> deoplete#auto_complete() }})" + ) + + return [] diff --git a/sources_non_forked/ale/supported-tools.md b/sources_non_forked/ale/supported-tools.md index c044d9f3..b2c0ec48 100644 --- a/sources_non_forked/ale/supported-tools.md +++ b/sources_non_forked/ale/supported-tools.md @@ -14,21 +14,27 @@ formatting. **Legend** -| Key | Definition | -| ------------- | -------------------------------- | -| :floppy_disk: | Only checked when saved to disk | -| :warning: | Disabled by default | +| Key | Definition | +| ------------- | ----------------------------------------------------------------- | +| :floppy_disk: | May only run on files on disk (see: `help ale-lint-file-linters` | +| :warning: | Disabled by default | --- * Ada + * [ada_language_server](https://github.com/AdaCore/ada_language_server) * [gcc](https://gcc.gnu.org) + * [gnatpp](https://docs.adacore.com/gnat_ugn-docs/html/gnat_ugn/gnat_ugn/gnat_utility_programs.html#the-gnat-pretty-printer-gnatpp) :floppy_disk: * Ansible - * [ansible-lint](https://github.com/willthames/ansible-lint) + * [ansible-lint](https://github.com/willthames/ansible-lint) :floppy_disk: * API Blueprint * [drafter](https://github.com/apiaryio/drafter) +* APKBUILD + * [apkbuild-lint](https://gitlab.alpinelinux.org/Leo/atools) + * [secfixes-check](https://gitlab.alpinelinux.org/Leo/atools) * AsciiDoc * [alex](https://github.com/wooorm/alex) :floppy_disk: + * [languagetool](https://languagetool.org/) :floppy_disk: * [proselint](http://proselint.com/) * [redpen](http://redpen.cc/) * [textlint](https://textlint.github.io/) @@ -39,10 +45,15 @@ formatting. * Awk * [gawk](https://www.gnu.org/software/gawk/) * Bash + * [bashate](https://github.com/openstack/bashate) * [language-server](https://github.com/mads-hartmann/bash-language-server) * shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set) * [shellcheck](https://www.shellcheck.net/) * [shfmt](https://github.com/mvdan/sh) +* Bats + * [shellcheck](https://www.shellcheck.net/) +* Bazel + * [buildifier](https://github.com/bazelbuild/buildtools) * BibTeX * [bibclean](http://ftp.math.utah.edu/pub/bibclean/) * Bourne Shell @@ -50,10 +61,11 @@ formatting. * [shellcheck](https://www.shellcheck.net/) * [shfmt](https://github.com/mvdan/sh) * C + * [astyle](http://astyle.sourceforge.net/) * [ccls](https://github.com/MaskRay/ccls) * [clang](http://clang.llvm.org/) - * [clangd](https://clang.llvm.org/extra/clangd.html) * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) + * [clangd](https://clang.llvm.org/extra/clangd.html) * [clangtidy](http://clang.llvm.org/extra/clang-tidy/) :floppy_disk: * [cppcheck](http://cppcheck.sourceforge.net) * [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) @@ -62,15 +74,18 @@ formatting. * [gcc](https://gcc.gnu.org/) * [uncrustify](https://github.com/uncrustify/uncrustify) * C# + * [csc](http://www.mono-project.com/docs/about-mono/languages/csharp/) :floppy_disk: see:`help ale-cs-csc` for details and configuration + * [dotnet-format](https://github.com/dotnet/format) * [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details * [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) :floppy_disk: see:`help ale-cs-mcsc` for details and configuration * [uncrustify](https://github.com/uncrustify/uncrustify) * C++ (filetype cpp) + * [astyle](http://astyle.sourceforge.net/) * [ccls](https://github.com/MaskRay/ccls) * [clang](http://clang.llvm.org/) + * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) * [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) :floppy_disk: * [clangd](https://clang.llvm.org/extra/clangd.html) - * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) * [clangtidy](http://clang.llvm.org/extra/clang-tidy/) :floppy_disk: * [clazy](https://github.com/KDE/clazy) :floppy_disk: * [cppcheck](http://cppcheck.sourceforge.net) @@ -80,8 +95,10 @@ formatting. * [gcc](https://gcc.gnu.org/) * [uncrustify](https://github.com/uncrustify/uncrustify) * Chef - * [foodcritic](http://www.foodcritic.io/) + * [cookstyle](https://docs.chef.io/cookstyle.html) + * [foodcritic](http://www.foodcritic.io/) :floppy_disk: * Clojure + * [clj-kondo](https://github.com/borkdude/clj-kondo) * [joker](https://github.com/candid82/joker) * CloudFormation * [cfn-python-lint](https://github.com/awslabs/cfn-python-lint) @@ -96,49 +113,66 @@ formatting. * [crystal](https://crystal-lang.org/) :floppy_disk: * CSS * [csslint](http://csslint.net/) + * [fecs](http://fecs.baidu.com/) * [prettier](https://github.com/prettier/prettier) * [stylelint](https://github.com/stylelint/stylelint) * Cucumber * [cucumber](https://cucumber.io/) * CUDA - * [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) + * [clangd](https://clang.llvm.org/extra/clangd.html) + * [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) :floppy_disk: * Cypher * [cypher-lint](https://github.com/cleishm/libcypher-parser) * Cython (pyrex filetype) * [cython](http://cython.org/) * D + * [dfmt](https://github.com/dlang-community/dfmt) * [dls](https://github.com/d-language-server/dls) * [dmd](https://dlang.org/dmd-linux.html) * [uncrustify](https://github.com/uncrustify/uncrustify) * Dafny * [dafny](https://rise4fun.com/Dafny) :floppy_disk: * Dart + * [analysis_server](https://github.com/dart-lang/sdk/tree/master/pkg/analysis_server) + * [dart-analyze](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) :floppy_disk: + * [dart-format](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) :floppy_disk: * [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) :floppy_disk: - * [dartfmt](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) + * [dartfmt](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) :floppy_disk: * [language_server](https://github.com/natebosch/dart_language_server) +* desktop + * [desktop-file-validate](https://www.freedesktop.org/wiki/Software/desktop-file-utils/) +* Dhall + * [dhall-format](https://github.com/dhall-lang/dhall-lang) + * [dhall-freeze](https://github.com/dhall-lang/dhall-lang) + * [dhall-lint](https://github.com/dhall-lang/dhall-lang) * Dockerfile * [dockerfile_lint](https://github.com/projectatomic/dockerfile_lint) * [hadolint](https://github.com/hadolint/hadolint) * Elixir * [credo](https://github.com/rrrene/credo) * [dialyxir](https://github.com/jeremyjh/dialyxir) - * [dogma](https://github.com/lpil/dogma) - * [elixir-ls](https://github.com/JakeBecker/elixir-ls) + * [dogma](https://github.com/lpil/dogma) :floppy_disk: + * [elixir-ls](https://github.com/elixir-lsp/elixir-ls) :warning: * [mix](https://hexdocs.pm/mix/Mix.html) :warning: :floppy_disk: * Elm * [elm-format](https://github.com/avh4/elm-format) - * [elm-lsp](https://github.com/antew/elm-lsp) - * [elm-make](https://github.com/elm-lang/elm-make) + * [elm-ls](https://github.com/elm-tooling/elm-language-server) + * [elm-make](https://github.com/elm/compiler) * Erb * [erb](https://apidock.com/ruby/ERB) + * [erblint](https://github.com/Shopify/erb-lint) * [erubi](https://github.com/jeremyevans/erubi) * [erubis](https://github.com/kwatch/erubis) * [ruumba](https://github.com/ericqweinstein/ruumba) * Erlang - * [erlc](http://erlang.org/doc/man/erlc.html) * [SyntaxErl](https://github.com/ten0s/syntaxerl) + * [dialyzer](http://erlang.org/doc/man/dialyzer.html) :floppy_disk: + * [elvis](https://github.com/inaka/elvis) :floppy_disk: + * [erlc](http://erlang.org/doc/man/erlc.html) + * [erlfmt](https://github.com/WhatsApp/erlfmt) * Fish * fish [-n flag](https://linux.die.net/man/1/fish) + * [fish_indent](https://fishshell.com/docs/current/cmds/fish_indent.html) * Fortran * [gcc](https://gcc.gnu.org/) * [language_server](https://github.com/hansec/fortran-language-server) @@ -154,16 +188,19 @@ formatting. * Go * [bingo](https://github.com/saibing/bingo) :warning: * [go build](https://golang.org/cmd/go/) :warning: :floppy_disk: + * [go mod](https://golang.org/cmd/go/) :warning: :floppy_disk: + * [go vet](https://golang.org/cmd/vet/) :floppy_disk: * [gofmt](https://golang.org/cmd/gofmt/) * [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports) :warning: * [golangci-lint](https://github.com/golangci/golangci-lint) :warning: :floppy_disk: * [golangserver](https://github.com/sourcegraph/go-langserver) :warning: + * [golines](https://github.com/segmentio/golines) * [golint](https://godoc.org/github.com/golang/lint) * [gometalinter](https://github.com/alecthomas/gometalinter) :warning: :floppy_disk: - * [go mod](https://golang.org/cmd/go/) :warning: :floppy_disk: + * [gopls](https://github.com/golang/go/wiki/gopls) * [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) :warning: :floppy_disk: * [gotype](https://godoc.org/golang.org/x/tools/cmd/gotype) :warning: :floppy_disk: - * [go vet](https://golang.org/cmd/vet/) :floppy_disk: + * [revive](https://github.com/mgechev/revive) :warning: :floppy_disk: * [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) :warning: :floppy_disk: * GraphQL * [eslint](http://eslint.org/) @@ -180,12 +217,16 @@ formatting. * Haskell * [brittany](https://github.com/lspitzner/brittany) * [cabal-ghc](https://www.haskell.org/cabal/) + * [floskell](https://github.com/ennocramer/floskell) * [ghc](https://www.haskell.org/ghc/) * [ghc-mod](https://github.com/DanielG/ghc-mod) * [hdevtools](https://hackage.haskell.org/package/hdevtools) * [hfmt](https://github.com/danstiner/hfmt) * [hie](https://github.com/haskell/haskell-ide-engine) + * [hindent](https://hackage.haskell.org/package/hindent) * [hlint](https://hackage.haskell.org/package/hlint) + * [hls](https://github.com/haskell/haskell-language-server) + * [ormolu](https://github.com/tweag/ormolu) * [stack-build](https://haskellstack.org/) :floppy_disk: * [stack-ghc](https://haskellstack.org/) * [stylish-haskell](https://github.com/jaspervdj/stylish-haskell) @@ -193,26 +234,36 @@ formatting. * [terraform-fmt](https://github.com/hashicorp/terraform) * HTML * [alex](https://github.com/wooorm/alex) :floppy_disk: - * [HTMLHint](http://htmlhint.com/) + * [angular](https://www.npmjs.com/package/@angular/language-server) + * [fecs](http://fecs.baidu.com/) + * [html-beautify](https://beautifier.io/) + * [htmlhint](http://htmlhint.com/) * [prettier](https://github.com/prettier/prettier) * [proselint](http://proselint.com/) * [tidy](http://www.html-tidy.org/) * [write-good](https://github.com/btford/write-good) * Idris * [idris](http://www.idris-lang.org/) +* Ink + * [ink-language-server](https://github.com/ephread/ink-language-server) +* Inko + * [inko](https://inko-lang.org/) :floppy_disk: * ISPC * [ispc](https://ispc.github.io/) :floppy_disk: * Java - * [checkstyle](http://checkstyle.sourceforge.net) + * [PMD](https://pmd.github.io/) + * [checkstyle](http://checkstyle.sourceforge.net) :floppy_disk: + * [eclipselsp](https://github.com/eclipse/eclipse.jdt.ls) * [google-java-format](https://github.com/google/google-java-format) * [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html) * [javalsp](https://github.com/georgewfraser/vscode-javac) - * [PMD](https://pmd.github.io/) * [uncrustify](https://github.com/uncrustify/uncrustify) * JavaScript + * [deno](https://deno.land/) * [eslint](http://eslint.org/) + * [fecs](http://fecs.baidu.com/) * [flow](https://flowtype.org/) - * [jscs](http://jscs.info/) + * [jscs](https://jscs-dev.github.io/) * [jshint](http://jshint.com/) * [prettier](https://github.com/prettier/prettier) * [prettier-eslint](https://github.com/prettier/prettier-eslint-cli) @@ -221,15 +272,24 @@ formatting. * [tsserver](https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29) * [xo](https://github.com/sindresorhus/xo) * JSON + * [eslint](http://eslint.org/) * [fixjson](https://github.com/rhysd/fixjson) * [jq](https://stedolan.github.io/jq/) - * [jsonlint](http://zaa.ch/jsonlint/) + * [jsonlint](https://github.com/zaach/jsonlint) * [prettier](https://github.com/prettier/prettier) + * [spectral](https://github.com/stoplightio/spectral) +* JSON5 + * [eslint](http://eslint.org/) +* JSONC + * [eslint](http://eslint.org/) +* Jsonnet + * [jsonnet-lint](https://jsonnet.org/learning/tools.html) + * [jsonnetfmt](https://jsonnet.org/learning/tools.html) * Julia * [languageserver](https://github.com/JuliaEditorSupport/LanguageServer.jl) * Kotlin * [kotlinc](https://kotlinlang.org) :floppy_disk: - * [ktlint](https://ktlint.github.io) :floppy_disk: + * [ktlint](https://ktlint.github.io) * [languageserver](https://github.com/fwcd/KotlinLanguageServer) see `:help ale-integration-kotlin` for configuration instructions * LaTeX * [alex](https://github.com/wooorm/alex) :floppy_disk: @@ -237,6 +297,7 @@ formatting. * [lacheck](https://www.ctan.org/pkg/lacheck) * [proselint](http://proselint.com/) * [redpen](http://redpen.cc/) + * [texlab](https://texlab.netlify.com) * [textlint](https://textlint.github.io/) * [vale](https://github.com/ValeLint/vale) * [write-good](https://github.com/btford/write-good) @@ -247,8 +308,11 @@ formatting. * LLVM * [llc](https://llvm.org/docs/CommandGuide/llc.html) * Lua + * [lua-format](https://github.com/Koihik/LuaFormatter) * [luac](https://www.lua.org/manual/5.1/luac.html) * [luacheck](https://github.com/mpeterv/luacheck) + * [luafmt](https://github.com/trixnz/lua-fmt) + * [stylua](https://github.com/johnnymorganz/stylua) * Mail * [alex](https://github.com/wooorm/alex) :floppy_disk: * [languagetool](https://languagetool.org/) :floppy_disk: @@ -261,6 +325,7 @@ formatting. * [languagetool](https://languagetool.org/) :floppy_disk: * [markdownlint](https://github.com/DavidAnson/markdownlint) :floppy_disk: * [mdl](https://github.com/mivok/markdownlint) + * [pandoc](https://pandoc.org) * [prettier](https://github.com/prettier/prettier) * [proselint](http://proselint.com/) * [redpen](http://redpen.cc/) @@ -276,8 +341,13 @@ formatting. * [nasm](https://www.nasm.us/) :floppy_disk: * Nim * [nim check](https://nim-lang.org/docs/nimc.html) :floppy_disk: + * [nimlsp](https://github.com/PMunch/nimlsp) + * nimpretty * nix * [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) + * [rnix-lsp](https://github.com/nix-community/rnix-lsp) * nroff * [alex](https://github.com/wooorm/alex) :floppy_disk: * [proselint](http://proselint.com/) @@ -294,7 +364,15 @@ formatting. * OCaml * [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions * [ocamlformat](https://github.com/ocaml-ppx/ocamlformat) + * [ocamllsp](https://github.com/ocaml/ocaml-lsp) + * [ocp-indent](https://github.com/OCamlPro/ocp-indent) * [ols](https://github.com/freebroccolo/ocaml-language-server) +* OpenApi + * [ibm_validator](https://github.com/IBM/openapi-validator) + * [prettier](https://github.com/prettier/prettier) + * [yamllint](https://yamllint.readthedocs.io/) +* Pascal + * [ptop](https://www.freepascal.org/tools/ptop.var) * Pawn * [uncrustify](https://github.com/uncrustify/uncrustify) * Perl @@ -304,15 +382,17 @@ formatting. * Perl6 * [perl6 -c](https://perl6.org) :warning: * PHP + * [intelephense](https://github.com/bmewburn/intelephense-docs) * [langserver](https://github.com/felixfbecker/php-language-server) * [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions + * [php -l](https://secure.php.net/) + * [php-cs-fixer](http://cs.sensiolabs.org/) * [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer) * [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) - * [php-cs-fixer](http://cs.sensiolabs.org/) - * [php -l](https://secure.php.net/) * [phpmd](https://phpmd.org) * [phpstan](https://github.com/phpstan/phpstan) * [psalm](https://getpsalm.org) :floppy_disk: + * [tlint](https://github.com/tightenco/tlint) * PO * [alex](https://github.com/wooorm/alex) :floppy_disk: * [msgfmt](https://www.gnu.org/software/gettext/manual/html_node/msgfmt-Invocation.html) @@ -324,42 +404,62 @@ formatting. * [write-good](https://github.com/btford/write-good) * Pony * [ponyc](https://github.com/ponylang/ponyc) +* PowerShell + * [powershell](https://github.com/PowerShell/PowerShell) + * [psscriptanalyzer](https://github.com/PowerShell/PSScriptAnalyzer) * Prolog * [swipl](https://github.com/SWI-Prolog/swipl-devel) * proto - * [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) + * [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) :floppy_disk: + * [protolint](https://github.com/yoheimuta/protolint) :floppy_disk: * Pug * [pug-lint](https://github.com/pugjs/pug-lint) * Puppet * [languageserver](https://github.com/lingua-pupuli/puppet-editor-services) * [puppet](https://puppet.com) * [puppet-lint](https://puppet-lint.com) +* PureScript + * [purescript-language-server](https://github.com/nwolverson/purescript-language-server) + * [purs-tidy](https://github.com/natefaubion/purescript-tidy) + * [purty](https://gitlab.com/joneshf/purty) * Python + * [autoflake](https://github.com/myint/autoflake) :floppy_disk: + * [autoimport](https://lyz-code.github.io/autoimport/) * [autopep8](https://github.com/hhatto/autopep8) * [bandit](https://github.com/PyCQA/bandit) :warning: * [black](https://github.com/ambv/black) * [flake8](http://flake8.pycqa.org/en/latest/) + * [flakehell](https://github.com/flakehell/flakehell) * [isort](https://github.com/timothycrosley/isort) * [mypy](http://mypy-lang.org/) - * [prospector](https://github.com/PyCQA/prospector) :warning: + * [prospector](https://github.com/PyCQA/prospector) :warning: :floppy_disk: * [pycodestyle](https://github.com/PyCQA/pycodestyle) :warning: * [pydocstyle](https://www.pydocstyle.org/) :warning: + * [pyflakes](https://github.com/PyCQA/pyflakes) * [pylama](https://github.com/klen/pylama) :floppy_disk: * [pylint](https://www.pylint.org/) :floppy_disk: - * [pyls](https://github.com/palantir/python-language-server) :warning: + * [pylsp](https://github.com/python-lsp/python-lsp-server) :warning: * [pyre](https://github.com/facebook/pyre-check) :warning: + * [pyright](https://github.com/microsoft/pyright) + * [reorder-python-imports](https://github.com/asottile/reorder_python_imports) * [vulture](https://github.com/jendrikseipp/vulture) :warning: :floppy_disk: * [yapf](https://github.com/google/yapf) * QML * [qmlfmt](https://github.com/jesperhh/qmlfmt) * [qmllint](https://github.com/qt/qtdeclarative/tree/5.11/tools/qmllint) * R + * [languageserver](https://github.com/REditorSupport/languageserver) * [lintr](https://github.com/jimhester/lintr) + * [styler](https://github.com/r-lib/styler) * Racket + * [racket-langserver](https://github.com/jeapostrophe/racket-langserver/tree/master) * [raco](https://docs.racket-lang.org/raco/) +* Re:VIEW + * [redpen](http://redpen.cc/) * ReasonML * [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-reasonml-ols` for configuration instructions * [ols](https://github.com/freebroccolo/ocaml-language-server) + * [reason-language-server](https://github.com/jaredly/reason-language-server) * [refmt](https://github.com/reasonml/reason-cli) * reStructuredText * [alex](https://github.com/wooorm/alex) :floppy_disk: @@ -369,29 +469,36 @@ formatting. * [textlint](https://textlint.github.io/) * [vale](https://github.com/ValeLint/vale) * [write-good](https://github.com/btford/write-good) -* Re:VIEW - * [redpen](http://redpen.cc/) +* Robot + * [rflint](https://github.com/boakley/robotframework-lint) * RPM spec * [rpmlint](https://github.com/rpm-software-management/rpmlint) :warning: (see `:help ale-integration-spec`) * Ruby * [brakeman](http://brakemanscanner.org/) :floppy_disk: + * [debride](https://github.com/seattlerb/debride) + * [prettier](https://github.com/prettier/plugin-ruby) * [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) :floppy_disk: * [reek](https://github.com/troessner/reek) * [rubocop](https://github.com/bbatsov/rubocop) * [ruby](https://www.ruby-lang.org) * [rufo](https://github.com/ruby-formatter/rufo) * [solargraph](https://solargraph.org) + * [sorbet](https://github.com/sorbet/sorbet) * [standardrb](https://github.com/testdouble/standard) * Rust * [cargo](https://github.com/rust-lang/cargo) :floppy_disk: (see `:help ale-integration-rust` for configuration instructions) * [rls](https://github.com/rust-lang-nursery/rls) :warning: + * [rust-analyzer](https://github.com/rust-analyzer/rust-analyzer) :warning: * [rustc](https://www.rust-lang.org/) :warning: * [rustfmt](https://github.com/rust-lang-nursery/rustfmt) +* Salt + * [salt-lint](https://github.com/warpnet/salt-lint) * Sass * [sass-lint](https://www.npmjs.com/package/sass-lint) * [stylelint](https://github.com/stylelint/stylelint) * Scala * [fsc](https://www.scala-lang.org/old/sites/default/files/linuxsoft_archives/docu/files/tools/fsc.html) + * [metals](https://scalameta.org/metals/) * [sbtserver](https://www.scala-sbt.org/1.x/docs/sbt-server.html) * [scalac](http://scala-lang.org) * [scalafmt](https://scalameta.org/scalafmt/) @@ -406,22 +513,36 @@ formatting. * SML * [smlnj](http://www.smlnj.org/) * Solidity + * [solc](https://solidity.readthedocs.io/) * [solhint](https://github.com/protofire/solhint) * [solium](https://github.com/duaraghav8/Solium) * SQL + * [pgformatter](https://github.com/darold/pgFormatter) + * [sql-lint](https://github.com/joereynolds/sql-lint) * [sqlfmt](https://github.com/jackc/sqlfmt) + * [sqlformat](https://github.com/andialbrecht/sqlparse) * [sqlint](https://github.com/purcell/sqlint) * Stylus * [stylelint](https://github.com/stylelint/stylelint) * SugarSS * [stylelint](https://github.com/stylelint/stylelint) +* Svelte + * [prettier](https://github.com/prettier/prettier) + * [svelteserver](https://github.com/sveltejs/language-tools/tree/master/packages/language-server) * Swift + * [Apple swift-format](https://github.com/apple/swift-format) + * [sourcekit-lsp](https://github.com/apple/sourcekit-lsp) * [swiftformat](https://github.com/nicklockwood/SwiftFormat) * [swiftlint](https://github.com/realm/SwiftLint) +* systemd + * [systemd-analyze](https://www.freedesktop.org/software/systemd/man/systemd-analyze.html) :floppy_disk: * Tcl * [nagelfar](http://nagelfar.sourceforge.net) :floppy_disk: * Terraform - * [fmt](https://github.com/hashicorp/terraform) + * [terraform](https://github.com/hashicorp/terraform) + * [terraform-fmt-fixer](https://github.com/hashicorp/terraform) + * [terraform-ls](https://github.com/hashicorp/terraform-ls) + * [terraform-lsp](https://github.com/juliosueiras/terraform-lsp) * [tflint](https://github.com/wata727/tflint) * Texinfo * [alex](https://github.com/wooorm/alex) :floppy_disk: @@ -437,24 +558,35 @@ formatting. * [write-good](https://github.com/btford/write-good) :warning: * Thrift * [thrift](http://thrift.apache.org/) + * [thriftcheck](https://github.com/pinterest/thriftcheck) * TypeScript + * [deno](https://deno.land/) * [eslint](http://eslint.org/) + * [fecs](http://fecs.baidu.com/) * [prettier](https://github.com/prettier/prettier) + * [standard](http://standardjs.com/) * [tslint](https://github.com/palantir/tslint) * [tsserver](https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29) * typecheck +* V + * [v](https://github.com/vlang/v/) :floppy_disk: + * [vfmt](https://github.com/vlang/v/) * VALA * [uncrustify](https://github.com/uncrustify/uncrustify) + * [vala_lint](https://github.com/vala-lang/vala-lint) :floppy_disk: * Verilog + * [hdl-checker](https://pypi.org/project/hdl-checker) * [iverilog](https://github.com/steveicarus/iverilog) * [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) * [vlog](https://www.mentor.com/products/fv/questa/) * [xvlog](https://www.xilinx.com/products/design-tools/vivado.html) + * [yosys](http://www.clifford.at/yosys/) :floppy_disk: * VHDL * [ghdl](https://github.com/ghdl/ghdl) * [vcom](https://www.mentor.com/products/fv/questa/) * [xvhdl](https://www.xilinx.com/products/design-tools/vivado.html) * Vim + * [vimls](https://github.com/iamcco/vim-language-server) * [vint](https://github.com/Kuniwak/vint) * Vim help * [alex](https://github.com/wooorm/alex) :warning: :floppy_disk: @@ -470,8 +602,15 @@ formatting. * XML * [xmllint](http://xmlsoft.org/xmllint.html) * YAML + * [circleci](https://circleci.com/docs/2.0/local-cli) :floppy_disk: * [prettier](https://github.com/prettier/prettier) + * [spectral](https://github.com/stoplightio/spectral) * [swaglint](https://github.com/byCedric/swaglint) + * [yamlfix](https://lyz-code.github.io/yamlfix) * [yamllint](https://yamllint.readthedocs.io/) * YANG * [yang-lsp](https://github.com/theia-ide/yang-lsp) +* Zeek + * [zeek](http://zeek.org) :floppy_disk: +* Zig + * [zls](https://github.com/zigtools/zls) diff --git a/sources_non_forked/bufexplorer/.gitignore b/sources_non_forked/bufexplorer/.gitignore new file mode 100644 index 00000000..42d5d592 --- /dev/null +++ b/sources_non_forked/bufexplorer/.gitignore @@ -0,0 +1,6 @@ +# Ignore generated tags +/doc/tags +dist.bat +*.zip +tags +*.sw[a-p] diff --git a/sources_non_forked/bufexplorer/LICENSE b/sources_non_forked/bufexplorer/LICENSE new file mode 100644 index 00000000..28d7bc4b --- /dev/null +++ b/sources_non_forked/bufexplorer/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2001-2013, Jeff Lanzarotta +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +* Neither the name of the {organization} nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/sources_non_forked/bufexplorer/README.md b/sources_non_forked/bufexplorer/README.md new file mode 100644 index 00000000..6faed6bc --- /dev/null +++ b/sources_non_forked/bufexplorer/README.md @@ -0,0 +1,99 @@ +bufexplorer +=========== + +BufExplorer Plugin for Vim + +With bufexplorer, you can quickly and easily switch between buffers by using the one of the default public interfaces: + +`\be` normal open + +`\bt` toggle open / close + +`\bs` force horizontal split open + +`\bv` force vertical split open + + +Once the bufexplorer window is open you can use the normal movement keys (hjkl) to move around and then use or to select the buffer you would like to open. If you would like to have the selected buffer opened in a new tab, simply press either or 't'. Please note that when opening a buffer in a tab, that if the buffer is already in another tab, bufexplorer can switch to that tab automatically for you if you would like. More about that in the supplied VIM help. + +Bufexplorer also offers various options including: +- Display the list of buffers in various sort orders including: + - Most Recently Used (MRU) which is the default + - Buffer number + - File name + - File extension + - Full file path name +- Delete buffer from list + +For more about options, sort orders, configuration options, etc. please see the supplied VIM help. + +## vim.org +This plugin can also be found at http://www.vim.org/scripts/script.php?script_id=42. + +## Installation +### Manually +1. If you do not want to use one of the the bundle handlers, you can take the + zip file from vim.org and unzip it and copy the plugin to your vimfiles\plugin + directory and the txt file to your vimfiles\doc directory. If you do that, + make sure you generate the help by executing + + `:helptag /doc` + + Once help tags have been generated, you can view the manual with + `:help bufexplorer`. + +### Vundle (https://github.com/gmarik/Vundle.vim) +1. Add the following configuration to your `.vimrc`. + + Plugin 'jlanzarotta/bufexplorer' + +2. Install with `:BundleInstall`. + +### NeoBundle (https://github.com/Shougo/neobundle.vim) +1. Add the following configuration to your `.vimrc`. + + NeoBundle 'jlanzarotta/bufexplorer' + +2. Install with `:NeoBundleInstall`. + +### Plug (https://github.com/junegunn/vim-plug) +1. Add the following configuration to your `.vimrc`. + + Plug 'jlanzarotta/bufexplorer' + +2. Install with `:PlugInstall`. + +### Pathogen +1. Install with the following command. + + git clone https://github.com/jlanzarotta/bufexplorer.git ~/.vim/bundle/bufexplorer.vim + +## License +Copyright (c) 2001-2021, Jeff Lanzarotta + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +* Neither the name of the {organization} nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/sources_non_forked/bufexplorer/doc/bufexplorer.txt b/sources_non_forked/bufexplorer/doc/bufexplorer.txt new file mode 100644 index 00000000..fd52fb58 --- /dev/null +++ b/sources_non_forked/bufexplorer/doc/bufexplorer.txt @@ -0,0 +1,806 @@ +*bufexplorer.txt* Buffer Explorer Last Change: 08 Dec 2018 + +Buffer Explorer *buffer-explorer* *bufexplorer* + Version 7.4.21 + +Plugin for easily exploring (or browsing) Vim|:buffers|. + +|bufexplorer-installation| Installation +|bufexplorer-usage| Usage +|bufexplorer-windowlayout| Window Layout +|bufexplorer-customization| Customization +|bufexplorer-changelog| Change Log +|bufexplorer-todo| Todo +|bufexplorer-credits| Credits +|bufexplorer-copyright| Copyright + +For Vim version 7.0 and above. +This plugin is only available if 'compatible' is not set. + +{Vi does not have any of this} + +============================================================================== +INSTALLATION *bufexplorer-installation* + +To install: + - Download the bufexplorer.zip from one of the following places: + https://github.com/jlanzarotta/bufexplorer + http://www.vim.org/scripts/script.php?script_id=42 + or use a package manager like Vundle. + - Extract the zip archive into your runtime directory. + The archive contains plugin/bufexplorer.vim, and doc/bufexplorer.txt. + - Start Vim or goto an existing instance of Vim. + - Execute the following command: +> + :helptag /doc +< + This will generate all the help tags for any file located in the doc + directory. + +============================================================================== +USAGE *bufexplorer-usage* + +To start exploring in the current window, use: > + be or :BufExplorer or Your custom key mapping +To toggle bufexplorer on or off in the current window, use: > + bt or :ToggleBufExplorer or Your custom key mapping +To start exploring in a newly split horizontal window, use: > + bs or :BufExplorerHorizontalSplit or Your custom key mapping +To start exploring in a newly split vertical window, use: > + bv or :BufExplorerVerticalSplit or Your custom key mapping + +If you would like to use something other than the default leader key - '\' - +you may simply change the leader (see |mapleader|). + +When bs or bv is issued, bufexplorer opens in either a +horizontally or vertically split window. By issuing either of these commands, +the user is telling bufexplorer that they want to split the window and have +bufexplorer show the buffer they are about to select (from the bufexplorer +windows) in the newly split window. When be is issued, bufexplorer +opens the bufexplorer contents in the current window and the buffer the user +selects is opened in the current window. + +Note: If the current buffer is modified when bufexplorer started, the current + window is always split and the new bufexplorer is displayed in that new + window. + +Commands to use once exploring: + + Toggle help information. + Opens the buffer that is under the cursor into the current + window. + Opens the buffer that is under the cursor into the current + window. + Opens the buffer that is under the cursor in another tab. + a Toggles whether you are taken to the active window when + selecting a buffer or not. + b Fast buffer switching with b. + B Works in association with the |ShowTabBuffer| option. If + |ShowTabBuffer| is set to 1, this toggles if BufExplorer is to + only store the most recent tab for this buffer or not. + d |:delete| the buffer under the cursor from the list. The + buffer's 'buflisted' is cleared. This allows for the buffer to + be displayed again using the 'show unlisted' command. + D |:wipeout| the buffer under the cursor from the list. When a + buffer is wiped, it will not be shown when unlisted buffers are + displayed. + F Open selected buffer in another window above the current. + f Open selected buffer in another window below the current. + o Opens the buffer that is under the cursor into the current + window. + p Toggles the showing of a split filename/pathname. + q Exit/Close bufexplorer. + r Reverses the order the buffers are listed in. + R Toggles relative path/absolute path. + s Cycle thru how the buffers are listed. Either by buffer + number, file name, file extension, most recently used (MRU), or + full path. + S Cycle thru how the buffers are listed, in reverse order. + Either by buffer number, file name, file extension, most + recently used (MRU), or full path. + t Opens the buffer that is under the cursor in another tab. + T Toggles to show only buffers for this tab or not. + u Toggles the showing of "unlisted" buffers. + V Open the selected buffer in another window on the left of the current. + v Open the selected buffer in another window on the right of the current. + +Once invoked, Buffer Explorer displays a sorted list (MRU is the default +sort method) of all the buffers that are currently opened. You are then +able to move the cursor to the line containing the buffer's name you are +wanting to act upon. Once you have selected the buffer you would like, +you can then either open it, close it (delete), resort the list, reverse +the sort, quit exploring and so on... + +=============================================================================== +WINDOW LAYOUT *bufexplorer-windowlayout* + +------------------------------------------------------------------------------- +" Press for Help +" Sorted by mru | Locate buffer | Absolute Split path +"= + 1 %a bufexplorer.txt C:\Vim\vimfiles\doc line 87 + 2 # bufexplorer.vim c:\Vim\vimfiles\plugin line 1 +------------------------------------------------------------------------------- + | | | | | + | | | | +-- Current Line #. + | | | +-- Relative/Full Path + | | +-- Buffer Name. + | +-- Buffer Attributes. See |:buffers| for more information. + +-- Buffer Number. See |:buffers| for more information. + +=============================================================================== +CUSTOMIZATION *bufexplorer-customization* + +If you do not like the default key mappings of be, bs, and +bv, you can override bufexplorer's default mappings by setting up +something like the following in your vimrc file: + + nnoremap :BufExplorer + nnoremap :ToggleBufExplorer + nnoremap :BufExplorerHorizontalSplit + nnoremap :BufExplorerVerticalSplit + + *g:bufExplorerChgWin* +If set, bufexplorer will bring up the selected buffer in the window specified +by g:bufExplorerChgWin. + + *g:bufExplorerDefaultHelp* +To control whether the default help is displayed or not, use: > + let g:bufExplorerDefaultHelp=0 " Do not show default help. + let g:bufExplorerDefaultHelp=1 " Show default help. +The default is to show the default help. + + *g:bufExplorerDisableDefaultKeyMapping* +To control whether the default key mappings are enabled or not, use: > + let g:bufExplorerDisableDefaultKeyMapping=0 " Do not disable mapping. + let g:bufExplorerDisableDefaultKeyMapping=1 " Disable mapping. +The default is NOT to disable the default key mapping. + + *g:bufExplorerDetailedHelp* +To control whether detailed help is display by, use: > + let g:bufExplorerDetailedHelp=0 " Do not show detailed help. + let g:bufExplorerDetailedHelp=1 " Show detailed help. +The default is NOT to show detailed help. + + *g:bufExplorerFindActive* +To control whether you are taken to the active window when selecting a buffer, +use: > + let g:bufExplorerFindActive=0 " Do not go to active window. + let g:bufExplorerFindActive=1 " Go to active window. +The default is to be taken to the active window. + + *g:bufExplorerFuncRef* +When a buffer is selected, the functions specified either singly or as a list +will be called. + + *g:bufExplorerReverseSort* +To control whether to sort the buffer in reverse order or not, use: > + let g:bufExplorerReverseSort=0 " Do not sort in reverse order. + let g:bufExplorerReverseSort=1 " Sort in reverse order. +The default is NOT to sort in reverse order. + + *g:bufExplorerShowDirectories* +Directories usually show up in the list from using a command like ":e .". +To control whether to show directories in the buffer list or not, use: > + let g:bufExplorerShowDirectories=0 " Do not show directories. + let g:bufExplorerShowDirectories=1 " Show directories. +The default is to show directories. + + *g:bufExplorerShowNoName* +To control whether to show "No Name" buffers or not, use: > + let g:bufExplorerShowNoName=0 " Do not "No Name" buffers. + let g:bufExplorerShowNoName=1 " Show "No Name" buffers. +The default is to NOT show "No Name buffers. + + *g:bufExplorerShowRelativePath* +To control whether to show absolute paths or relative to the current +directory, use: > + let g:bufExplorerShowRelativePath=0 " Show absolute paths. + let g:bufExplorerShowRelativePath=1 " Show relative paths. +The default is to show absolute paths. + + *g:bufExplorerShowTabBuffer* +To control whether or not to show buffers on for the specific tab or not, use: > + let g:bufExplorerShowTabBuffer=0 " No. + let g:bufExplorerShowTabBuffer=1 " Yes. +The default is not to show. + + *g:bufExplorerShowUnlisted* +To control whether to show unlisted buffers or not, use: > + let g:bufExplorerShowUnlisted=0 " Do not show unlisted buffers. + let g:bufExplorerShowUnlisted=1 " Show unlisted buffers. +The default is to NOT show unlisted buffers. + + *g:bufExplorerSortBy* +To control what field the buffers are sorted by, use: > + let g:bufExplorerSortBy='extension' " Sort by file extension. + let g:bufExplorerSortBy='fullpath' " Sort by full file path name. + let g:bufExplorerSortBy='mru' " Sort by most recently used. + let g:bufExplorerSortBy='name' " Sort by the buffer's name. + let g:bufExplorerSortBy='number' " Sort by the buffer's number. +The default is to sort by mru. + + *g:bufExplorerSplitBelow* +To control where the new split window will be placed above or below the +current window, use: > + let g:bufExplorerSplitBelow=1 " Split new window below current. + let g:bufExplorerSplitBelow=0 " Split new window above current. +The default is to use whatever is set by the global &splitbelow +variable. + + *g:bufExplorerSplitHorzSize* +To control the size of the new horizontal split window. use: > + let g:bufExplorerSplitHorzSize=n " New split window is n rows high. + let g:bufExplorerSplitHorzSize=0 " New split window size set by Vim. +The default is 0, so that the size is set by Vim. + + *g:bufExplorerSplitOutPathName* +To control whether to split out the path and file name or not, use: > + let g:bufExplorerSplitOutPathName=1 " Split the path and file name. + let g:bufExplorerSplitOutPathName=0 " Don't split the path and file + " name. +The default is to split the path and file name. + + *g:bufExplorerSplitRight* +To control where the new vsplit window will be placed to the left or right of +current window, use: > + let g:bufExplorerSplitRight=0 " Split left. + let g:bufExplorerSplitRight=1 " Split right. +The default is to use the global &splitright. + + *g:bufExplorerSplitVertSize* +To control the size of the new vertical split window, use: > + let g:bufExplorerSplitVertSize=n " New split window is n columns wide. + let g:bufExplorerSplitVertSize=0 " New split windows size set by Vim. +The default is 0, so that the size is set by Vim. + + *g:bufExplorerVersionWarn* +To control whether to warning about Vim version or not, use: > + let g:bufExplorerVersionWarn=1 " Warn if version conflict. + let g:bufExplorerVersionWarn=0 " Do not warn if version conflict. +The default is 1. + +=============================================================================== +CHANGE LOG *bufexplorer-changelog* + +7.4.21 December 8, 2018 + - Merged in changes from adelarsq that introduced ryanoasis/vim-devicons + support. If the global g:loaded_webdevicons has been set, bufexplorer + will now load the associated dev icons for each buffer. +7.4.20 January 18, 2017 + - Thanks to jpflouret for supplying code that can remove the warning + messages if you using this plugin on an older version of Vim. The + global variable is g:bufExplorerVersionWarn. +7.4.19 September 18, 2017 + - Merged all changes from github back into this version and tried to sync + to the correct version number. +7.4.18 - Github. +7.4.17 - Github. +7.4.16 August 14, 2017 + - Thanks to Yubo Su for the patch that adds 'f, F, V, and v' commands. + With this change, the original 'f' command was remapped to 'a'. + + The set of commands that can be used during exploring are: + F - Open selected buffer in another window above the current. + f - Open selected buffer in another window below the current. + V - Open the selected buffer in another window on the left of the + current. + v - Open the selected buffer in another window on the right of the + current. +7.4.15 May 01, 2017 + - Finally applied the patch submitted by justfalter. This patch is a + backward-compatible fix for the "invalid tab range" bug. +7.4.14 April 10, 2017 + - As suggested by adelarsq way back on January 5th, 2016, a filetype has + been added. There is now 'filetype=bufexplorer'. +7.4.13 March 08, 2017 + - Thanks to devakivamsi for pointing out that even though bufexplorer + turns off line numbers by default within its own window, this did not + work correctly when using WinManager. This has now been corrected. +7.4.12 September 30, 2016 + - Thanks again to Martin Vuille for several more fixes related to making + bufexplorer more tab-friendly. +7.4.11 September, 20, 2016 + - Thanks to Martin Vuille for reworking the per-tab buffer listing code. + Fix for g:bufExplorerShowTabBuffer is not working correctly and other + "gliches" when the ShotTabBuffer option is enabled. For example old + code would not correctly handle adding/deleting a tab that wasn't the + highest-numbered tab. +7.4.10 August 26, 2016 + - Thanks to buddylindsey for fixing a misspelling in the docs. +7.4.9 April 01, 2016 + - Thanks to ivegotasthma for supplying a patch to fix a major issue with + plugin performance when lots of buffers are open. + - Thanks to ershov for the patch to fix grouping of files in ambiguous + sort modes. + - Thanks to PhilRunninger for changing documentation to use , in + place of '\'. +7.4.8 January 27, 2015 + - Thanks to Marius Gedminas for fixing up the documentation and correcting + various typos. +7.4.7 January 20, 2015 + - Thanks goes out to Phil Runninger for added the ability to toggle the + bufexplorer list on and off using the :ToggleBufExplorer command, the + map bt, and the function ToggleBufExplorer(). +7.4.6 November 03, 2014 + - Not sure how, but the file format was converted to Dos instead of Unix. + I converted the file back to Unix. +7.4.5 October 24, 2014 + - Dr Michael Henry suggested to change all noremap commands to nnoremap. + Using noremap is unnecessarily broad and can cause problems, especially + for select mode. +7.4.4 August 19, 2014 + - Revert change where bufexplorer windows was closed even if the target + buffer has not been loaded yet. +7.4.3 August 13, 2014 + - Ivan Ukhov fixed issue with deleting the last window. This update also + fixes as well as another. If you have say, NERDtree open on the left + side and bufexplorer on the right, that bufexplorer would close NERDtree + erroneously thinking that it is closing itself. + - Radoslaw Burny fixed a few bugs that surfaced when bufexplorer is used + within winmanager. +7.4.2 October 22, 2013 + - Added global option g:bufExplorerDisableDefaultKeyMapping. This option + controls weather the default key mappings (\be, \bs, and \bv) are + enabled or not. See documentation for more information. +7.4.1 October 11, 2013 + - First update related to Vim 7.4. + - Changed license text. + - Fixed issue with 'hidden'. If 'hidden' is set, make sure that + g:bufExplorerFindActive is set to 0. Otherwise, when using \bs or \bv, + and selecting a buffer, the original buffer will be switched to instead + of being opened in the newly created windows. + - Added new 'b' mapping when the bufExplorer window is opened. When 'b' + is pressed, the user is prompted for the buffer number to switch to, and + is is then switched to when is pressed. This allows for somewhat + faster buffer switching instead of using the j and k keys or the mouse + to select the buffer to switch to. + - Removed 'set nolist' from the Initialize() function as well as the + restore of the 'list' setting in the CleanUp() function. These were + causing issues when multiple new files were opened from the command + line. Furthermore, there was really no reason, that I can remember, to + why the 'list' setting was saved, modified, and restored anyways. + - Fixed issue with WinManager integration code not working correctly + anymore. + - Brought back the xnoremap setup for the 'd' and 'D' keys. These were + removed for some reason after version 7.2.8. + - Thanks to all the contributors and testers. +7.3.6 May 06, 2013 + - Removed the 'drop' window command that was causing issue with the + argument-list being modified after the BufExplorer windows was + displayed. +7.3.5 February 08, 2013 + - Michael Henry added the ability to view "No Name" buffers. This + functionality was lost since version 7.3.0. He also did some removal of + "dead" code and cleaned up the code to handle filenames with embedded + '"'. +7.3.4 January 28, 2013 + - Thanks go out to John Szakmeister for finding and fixing a bug in the + RebuildBufferList method. The keepjumps line that clears the list could + potentially reference a backwards range. +7.3.3 January 14, 2013 + - Major cleanup and reorganization of the change log. + - We welcome the return of g:bufExplorerSplitHorzSize and + g:bufExplorerSplitVertSize. When setting these values, anything less + than or equal to 0 causes the split windows size to be determined by + Vim. If for example you want your new horizontal split window 10 rows + high, set g:bufExplorerSplitHorzSize = 10 in your .vimrc. Similar would + be done if wanting a vertical split except you would use the + g:bufExplorerSplitVertSize variable instead. +7.3.2 December 24, 2012 + - Thanks go out to Michael Henry for pointing out that I completely + missed yet another function, ReverseSortSelect(), during the + refactoring. This function has now returned. +7.3.1 December 06, 2012 + - Thanks go out to Brett Rasmussen for pointing out that the feature + added way back in version 7.2.3 by Yuriy Ershov to automatically + reposition the cursor to the line containing the active buffer, was + no longer in the plugin. That bit of code has been re-added and + all is well. +7.3.0 October 09, 2012 + - It has been quite a while since I published a new version and this + is the first version since Vim 7.3 was released. I have put some + time into reworking and cleaning up the code as well as various bug + fixes. Overall, I am hopeful that I not forgotten or lost a feature. + - Thanks to Tim Johnson for testing out this new version. + - I have hopefully allowed for better mapping of the main public + methods as is explained in the |bufexplorer-customization| section + of the documentation. + - Add new 'B', 'o', and 'S' key mappings. +7.2.8 November 08, 2010 + - Thanks to Charles Campbell for integrating bufexplorer with GDBMGR. + http://mysite.verizon.net/astronaut/vim/index.html#GDBMGR +7.2.7 April 26, 2010 + - My 1st attempt to fix the "cache" issue where buffers information + has changed but the cache/display does not reflect those changes. + More work still needs to be done. +7.2.6 February 12, 2010 + - Thanks to Michael Henry for pointing out that I totally forgot to + update the inline help to reflect the previous change to the 'd' + and 'D' keys. Opps! +7.2.5 February 10, 2010 + - Philip Morant suggested switching the command (bwipe) associated + with the 'd' key with the command (bdelete) associated with the 'D' + key. This made sense since the 'd' key is more likely to be used + compared to the 'D' key. +7.2.4 January 14, 2010 + - I did not implement the patch provided by Godefroid Chapelle + correctly. I missed one line which happened to be the most important + one :) +7.2.3 December 15, 2009 + - Hopefully I have not left anyone or anything out :) + - Thanks to David Fishburn for helping me out with a much needed + code overhaul as well as some awesome performance enhancements. + - David also reworked the handling of tabs. + - Thanks to Vladimir Dobriakov for making the suggestions on + enhancing the documentation to include a better explaination of + what is contained in the main bufexplorer window. + - Thanks to Yuriy Ershov for added code that when the bufexplorer + window is opened, the cursor is now positioned at the line with the + active buffer (useful in non-MRU sort modes). + - Yuriy also added the abiltiy to cycle through the sort fields in + reverse order. + - Thanks to Michael Henry for supplying a patch that allows + bufexplorer to be opened even when there is one buffer or less. + - Thanks to Godefroid Chapelle for supplying a patch that fixed + MRU sort order after loading a session. +7.2.2 November 19, 2008 + - Thanks to David L. Dight for spotting and fixing an issue when using + ctrl^. bufexplorer would incorrectly handle the previous buffer so + that when ctrl^ was pressed the incorrect file was opened. +7.2.1 September 03, 2008 + - Thanks to Dimitar for spotting and fixing a feature that was + inadvertently left out of the previous version. The feature was when + bufexplorer was used together with WinManager, you could use the tab + key to open a buffer in a split window. +7.2.0 August 15, 2008 + - For all those missing the \bs and \bv commands, these have now + returned. Thanks to Phil O'Connell for asking for the return of + these missing features and helping test out this version. + - Fixed problem with the bufExplorerFindActive code not working + correctly. + - Fixed an incompatibility between bufexplorer and netrw that caused + buffers to be incorrectly removed from the MRU list. +7.1.7 December 21, 2007 + - TaCahiroy fixed several issues related to opening a buffer in a tab. +7.1.6 December 01, 2007 + - Removed ff=unix from modeline in bufexplorer.txt. Found by Bill + McCarthy. +7.1.5 November 30, 2007 + - Could not open unnamed buffers. Fixed by TaCahiroy. +7.1.4 November 16, 2007 + - Sometimes when a file's path has 'white space' in it, extra buffers + would be created containing each piece of the path. i.e: + opening c:\document and settings\test.txt would create a buffer + named "and" and a buffer named "Documents". This was reported and + fixed by TaCa Yoss. +7.1.3 November 15, 2007 + - Added code to allow only one instance of the plugin to run at a time. + Thanks Dennis Hostetler. +7.1.2 November 07, 2007 + - Dave Larson added handling of tabs. + - Dave Larson removed \bs and \bv commands because these are easier for + the used to create horizontal and vertical windows. + - Fixed a jumplist issue spotted by JiangJun. I overlooked the + 'jumplist' and with a couple calls to 'keepjumps', everything is fine + again. + - Went back to using just a plugin file, instead of both an autoload + and plugin file. The splitting of the file caused issues with other + plugins. So if you have a prior version of bufexplorer that has an + autoload file, please remove autoload\bufexplorer and + plugin\bufexplorer before installing this new version. + - Fixed E493 error spotted by Thomas Arendsen Hein. + - Minor cosmetic changes. + - Minor help file changes. +7.1.1 August 02, 2007 + - A problem spotted by Thomas Arendsen Hein. When running Vim + (7.1.94), error E493 was being thrown. + * Added 'D' for 'delete' buffer as the 'd' command was a 'wipe' buffer. +7.1.0 August 01, 2007 + - Another 'major' update, some by Dave Larson, some by me. + - Making use of 'autoload' now to make the plugin load quicker. + - Removed '\bs' and '\bv'. These are now controlled by the user. The + user can issue a ':sp' or ':vs' to create a horizontal or vertical + split window and then issue a '\be' + - Added handling of tabs. +7.0.17 July 24, 2007 + - Fixed issue with 'drop' command. + - Various enhancements and improvements. +7.0.16 May 15, 2007 + - Fixed issue reported by Liu Jiaping on non Windows systems, which was + ... + Open file1, open file2, modify file1, open bufexplorer, you get the + following error: + + --------8<-------- + Error detected while processing function + 14_StartBufExplorer..14_SplitOpen: + line 4: + E37: No write since last change (add ! to override) + + But the worse thing is, when I want to save the current buffer and + type ':w', I get another error message: + E382: Cannot write, 'buftype' option is set + --------8<-------- + +7.0.15 April 27, 2007 + - Thanks to Mark Smithfield for suggesting bufexplorer needed to handle + the ':args' command. +7.0.14 March 23, 2007 + - Thanks to Randall Hansen for removing the requirement of terminal + versions to be recompiled with 'gui' support so the 'drop' command + would work. The 'drop' command is really not needed in terminal + versions. +7.0.13 February 23, 2007 + - Fixed integration with WinManager. + - Thanks to Dave Eggum for another update. + * Fix: The detailed help didn't display the mapping for toggling + the split type, even though the split type is displayed. + * Fixed incorrect description in the detailed help for toggling + relative or full paths. + * Deprecated s:ExtractBufferNbr(). Vim's str2nr() does the same + thing. + * Created a s:Set() function that sets a variable only if it hasn't + already been defined. It's useful for initializing all those + default settings. + * Removed checks for repetitive command definitions. They were + unnecessary. + * Made the help highlighting a little more fancy. + * Minor reverse compatibility issue: Changed ambiguous setting + names to be more descriptive of what they do (also makes the code + easier to follow): + Changed bufExplorerSortDirection to bufExplorerReverseSort + Changed bufExplorerSplitType to bufExplorerSplitVertical + Changed bufExplorerOpenMode to bufExplorerUseCurrentWindow + * When the BufExplorer window closes, all the file-local marks are + now deleted. This may have the benefit of cleaning up some of the + jumplist. + * Changed the name of the parameter for StartBufExplorer from + "split" to "open". The parameter is a string which specifies how + the buffer will be open, not if it is split or not. + * Deprecated DoAnyMoreBuffersExist() - it is a one line function + only used in one spot. + * Created four functions (SplitOpen(), RebuildBufferList(), + UpdateHelpStatus() and ReSortListing()) all with one purpose - to + reduce repeated code. + * Changed the name of AddHeader() to CreateHelp() to be more + descriptive of what it does. It now returns an array instead of + updating the window directly. This has the benefit of making the + code more efficient since the text the function returns is used a + little differently in the two places the function is called. + * Other minor simplifications. +7.0.12 November 30, 2006 + - MAJOR Update. This version will ONLY run with Vim version 7.0 or + greater. + - Dave Eggum has made some 'significant' updates to this latest + version: + * Added BufExplorerGetAltBuf() global function to be used in the + user's rulerformat. + * Added g:bufExplorerSplitRight option. + * Added g:bufExplorerShowRelativePath option with mapping. + * Added current line highlighting. + * The split type can now be changed whether bufexplorer is opened + in split mode or not. + * Various major and minor bug fixes and speed improvements. + * Sort by extension. + - Other improvements/changes: + * Changed the help key from '?' to to be more 'standard'. + * Fixed splitting of vertical bufexplorer window. + - Hopefully I have not forgot something :) +7.0.11 March 10, 2006 + - Fixed a couple of highlighting bugs, reported by David Eggum. + - Dave Eggum also changed passive voice to active on a couple of + warning messages. +7.0.10 March 02, 2006 + - Fixed bug report by Xiangjiang Ma. If the 'ssl' option is set, + the slash character used when displaying the path was incorrect. +7.0.9 February 28, 2006 + - Martin Grenfell found and eliminated an annoying bug in the + bufexplorer/winmanager integration. The bug was were an + annoying message would be displayed when a window was split or + a new file was opened in a new window. Thanks Martin! +7.0.8 January 18, 2006 + - Thanks to Mike Li for catching a bug in the WinManager integration. + The bug was related to the incorrect displaying of the buffer + explorer's window title. +7.0.7 December 19, 2005 + - Thanks to Jeremy Cowgar for adding a new enhancement. This + enhancement allows the user to press 'S', that is capital S, which + will open the buffer under the cursor in a newly created split + window. +7.0.6 November 18, 2005 + - Thanks to Larry Zhang for finding a bug in the "split" buffer code. + If you force set g:bufExplorerSplitType='v' in your vimrc, and if you + tried to do a \bs to split the bufexplorer window, it would always + split horizontal, not vertical. + - Larry Zhang also found that I had a typeo in that the variable + g:bufExplorerSplitVertSize was all lower case in the documentation + which was incorrect. +7.0.5 October 18, 2005 + - Thanks to Mun Johl for pointing out a bug that if a buffer was + modified, the '+' was not showing up correctly. +7.0.4 October 03, 2005 + - Fixed a problem discovered first by Xiangjiang Ma. Well since I've + been using vim 7.0 and not 6.3, I started using a function (getftype) + that is not in 6.3. So for backward compatibility, I conditionaly use + this function now. Thus, the g:bufExplorerShowDirectories feature is + only available when using vim 7.0 and above. +7.0.3 September 30, 2005 + - Thanks to Erwin Waterlander for finding a problem when the last + buffer was deleted. This issue got me to rewrite the buffer display + logic (which I've wanted to do for sometime now). + - Also great thanks to Dave Eggum for coming up with idea for + g:bufExplorerShowDirectories. Read the above information about this + feature. +7.0.2 March 25, 2005 + - Thanks to Thomas Arendsen Hein for finding a problem when a user + has the default help turned off and then brought up the explorer. An + E493 would be displayed. +7.0.1 March 10, 2005 + - Thanks to Erwin Waterlander for finding a couple problems. + The first problem allowed a modified buffer to be deleted. Opps! The + second problem occurred when several files were opened, BufExplorer + was started, the current buffer was deleted using the 'd' option, and + then BufExplorer was exited. The deleted buffer was still visible + while it is not in the buffers list. Opps again! +7.0.0 March 10, 205 + - Thanks to Shankar R. for suggesting to add the ability to set + the fixed width (g:bufExplorerSplitVertSize) of a new window + when opening bufexplorer vertically and fixed height + (g:bufExplorerSplitHorzSize) of a new window when opening + bufexplorer horizontally. By default, the windows are normally + split to use half the existing width or height. +6.3.0 July 23, 2004 + - Added keepjumps so that the jumps list would not get cluttered with + bufexplorer related stuff. +6.2.3 April 15, 2004 + - Thanks to Jay Logan for finding a bug in the vertical split position + of the code. When selecting that the window was to be split + vertically by doing a '\bv', from then on, all splits, i.e. '\bs', + were split vertically, even though g:bufExplorerSplitType was not set + to 'v'. +6.2.2 January 09, 2004 + - Thanks to Patrik Modesto for adding a small improvement. For some + reason his bufexplorer window was always showing up folded. He added + 'setlocal nofoldenable' and it was fixed. +6.2.1 October 09, 2003 + - Thanks goes out to Takashi Matsuo for added the 'fullPath' sorting + logic and option. +6.2.0 June 13, 2003 + - Thanks goes out to Simon Johann-Ganter for spotting and fixing a + problem in that the last search pattern is overridden by the search + pattern for blank lines. +6.1.6 May 05, 2003 + - Thanks to Artem Chuprina for finding a pesky bug that has been around + for sometime now. The key mapping was causing the buffer + explored to close prematurely when vim was run in an xterm. The + key mapping is now removed. +6.1.5 April 28, 2003 + - Thanks to Khorev Sergey. Added option to show default help or not. +6.1.4 March 18, 2003 + - Thanks goes out to Valery Kondakoff for suggesting the addition of + setlocal nonumber and foldcolumn=0. This allows for line numbering + and folding to be turned off temporarily while in the explorer. +6.1.3 March 11, 2003 + - Added folding. + - Did some code cleanup. + - Added the ability to force the newly split window to be temporarily + vertical, which was suggested by Thomas Glanzmann. +6.1.2 November 05, 2002 + - Now pressing the key will quit, just like 'q'. + - Added folds to hide winmanager configuration. + - If anyone had the 'C' option in their cpoptions they would receive + a E10 error on startup of BufExplorer. cpo is now saved, updated and + restored. Thanks to Charles E Campbell, Jr. + - Attempted to make sure there can only be one BufExplorer window open + at a time. +6.1.1 March 28, 2002 + - Thanks to Brian D. Goodwin for adding toupper to FileNameCmp. This + way buffers sorted by name will be in the correct order regardless of + case. +6.0.16 March 14, 2002 + - Thanks to Andre Pang for the original patch/idea to get bufexplorer + to work in insertmode/modeless mode (evim). + - Added Initialize and Cleanup autocommands to handle commands that + need to be performed when starting or leaving bufexplorer. +6.0.15 February 20, 2002 + - Srinath Avadhanulax added a patch for winmanager.vim. +6.0.14 February 19, 2002 + - Fix a few more bug that I thought I already had fixed. + - Thanks to Eric Bloodworth for adding 'Open Mode/Edit in Place'. + - Added vertical splitting. +6.0.13 February 05, 2002 + - Thanks to Charles E Campbell, Jr. for pointing out some embarrassing + typos that I had in the documentation. I guess I need to run the + spell checker more :o) +6.0.12 February 04, 2002 + - Thanks to Madoka Machitani, for the tip on adding the augroup command + around the MRUList autocommands. +6.0.11 January 26, 2002 + - Fixed bug report by Xiangjiang Ma. '"=' was being added to the search + history which messed up hlsearch. +6.0.10 January 14, 2002 + - Added the necessary hooks so that the Srinath Avadhanula's + winmanager.vim script could more easily integrate with this script. + - Tried to improve performance. +6.0.9 December 17, 2001 + - Added MRU (Most Recently Used) sort ordering. +6.0.8 December 03, 2001 + - Was not resetting the showcmd command correctly. + - Added nifty help file. +6.0.7 November 19, 2001 + - Thanks to Brett Carlane for some great enhancements. Some are added, + some are not, yet. Added highlighting of current and alternate + filenames. Added splitting of path/filename toggle. Reworked + ShowBuffers(). + - Changed my email address. +6.0.6 September 05, 2001 + - Copyright notice added. Needed this so that it could be distributed + with Debian Linux. + - Fixed problem with the SortListing() function failing when there was + only one buffer to display. +6.0.5 August 10, 2001 + - Fixed problems reported by David Pascoe, in that you where unable to + hit 'd' on a buffer that belonged to a files that no longer existed + and that the 'yank' buffer was being overridden by the help text when + the bufexplorer was opened. +6.0.4 July, 31, 2001 + - Thanks to Charles Campbell, Jr. for making this plugin more plugin + *compliant*, adding default keymappings of be and bs + as well as fixing the 'w:sortDirLabel not being defined' bug. +6.0.3 July 30, 2001 + - Added sorting capabilities. Sort taken from explorer.vim. +6.0.2 July 25, 2001 + - Can't remember. +6.0.1 Sometime before July 25, 2001 + - Initial release. + +=============================================================================== +TODO *bufexplorer-todo* + +- Add ability to open a buffer in a horizontal or vertical split after the + initial bufexplorer window is opened. + +=============================================================================== +CREDITS *bufexplorer-credits* + +Author: Jeff Lanzarotta + +Credit must go out to Bram Moolenaar and all the Vim developers for +making the world's best editor (IMHO). I also want to thank everyone who +helped and gave me suggestions. I wouldn't want to leave anyone out so I +won't list names. + +=============================================================================== +COPYRIGHT *bufexplorer-copyright* + +Copyright (c) 2001-2017, Jeff Lanzarotta +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the {organization} nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================== +vim:tw=78:noet:wrap:ts=4:ft=help:norl: diff --git a/sources_non_forked/bufexplorer/plugin/bufexplorer.vim b/sources_non_forked/bufexplorer/plugin/bufexplorer.vim new file mode 100644 index 00000000..6a7ef4f0 --- /dev/null +++ b/sources_non_forked/bufexplorer/plugin/bufexplorer.vim @@ -0,0 +1,1366 @@ +"============================================================================ +" Copyright: Copyright (c) 2001-2018, Jeff Lanzarotta +" All rights reserved. +" +" Redistribution and use in source and binary forms, with or +" without modification, are permitted provided that the +" following conditions are met: +" +" * Redistributions of source code must retain the above +" copyright notice, this list of conditions and the following +" disclaimer. +" +" * Redistributions in binary form must reproduce the above +" copyright notice, this list of conditions and the following +" disclaimer in the documentation and/or other materials +" provided with the distribution. +" +" * Neither the name of the {organization} nor the names of its +" contributors may be used to endorse or promote products +" derived from this software without specific prior written +" permission. +" +" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +" CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +" Name Of File: bufexplorer.vim +" Description: Buffer Explorer Vim Plugin +" Maintainer: Jeff Lanzarotta (delux256-vim at outlook dot com) +" Last Changed: Saturday, 08 December 2018 +" Version: See g:bufexplorer_version for version number. +" Usage: This file should reside in the plugin directory and be +" automatically sourced. +" +" You may use the default keymappings of +" +" be - Opens BufExplorer +" bt - Toggles BufExplorer open or closed +" bs - Opens horizontally split window BufExplorer +" bv - Opens vertically split window BufExplorer +" +" Or you can override the defaults and define your own mapping +" in your vimrc file, for example: +" +" nnoremap :BufExplorer +" nnoremap :ToggleBufExplorer +" nnoremap :BufExplorerHorizontalSplit +" nnoremap :BufExplorerVerticalSplit +" +" Or you can use +" +" ":BufExplorer" - Opens BufExplorer +" ":ToggleBufExplorer" - Opens/Closes BufExplorer +" ":BufExplorerHorizontalSplit" - Opens horizontally window BufExplorer +" ":BufExplorerVerticalSplit" - Opens vertically split window BufExplorer +" +" For more help see supplied documentation. +" History: See supplied documentation. +"============================================================================= + +" Exit quickly if already running or when 'compatible' is set. {{{1 +if exists("g:bufexplorer_version") || &cp + finish +endif +"1}}} + +" Version number +let g:bufexplorer_version = "7.4.21" + +" Plugin Code {{{1 +" Check for Vim version {{{2 +if !exists("g:bufExplorerVersionWarn") + let g:bufExplorerVersionWarn = 1 +endif + +if v:version < 700 + if g:bufExplorerVersionWarn + echohl WarningMsg + echo "Sorry, bufexplorer ".g:bufexplorer_version." required Vim 7.0 or greater." + echohl None + endif + finish +endif +" Check to see if the version of Vim has the correct patch applied, if not, do +" not used . +if v:version > 703 || v:version == 703 && has('patch1261') && has('patch1264') + " We are good to go. +else + if g:bufExplorerVersionWarn + echohl WarningMsg + echo "Sorry, bufexplorer ".g:bufexplorer_version." required Vim 7.3 or greater with patch1261 and patch1264." + echohl None + endif + finish +endif + +" Create commands {{{2 +command! BufExplorer :call BufExplorer() +command! ToggleBufExplorer :call ToggleBufExplorer() +command! BufExplorerHorizontalSplit :call BufExplorerHorizontalSplit() +command! BufExplorerVerticalSplit :call BufExplorerVerticalSplit() + +" Set {{{2 +function! s:Set(var, default) + if !exists(a:var) + if type(a:default) + execute "let" a:var "=" string(a:default) + else + execute "let" a:var "=" a:default + endif + + return 1 + endif + + return 0 +endfunction + +" Script variables {{{2 +let s:MRU_Exclude_List = ["[BufExplorer]","__MRU_Files__","[Buf\ List]"] +let s:MRUList = [] +let s:name = '[BufExplorer]' +let s:originBuffer = 0 +let s:running = 0 +let s:sort_by = ["number", "name", "fullpath", "mru", "extension"] +let s:splitMode = "" +let s:types = {"fullname": ':p', "path": ':p:h', "relativename": ':~:.', "relativepath": ':~:.:h', "shortname": ':t'} + +" Setup the autocommands that handle the MRUList and other stuff. {{{2 +autocmd VimEnter * call s:Setup() + +" Setup {{{2 +function! s:Setup() + call s:Reset() + + " Now that the MRUList is created, add the other autocmds. + augroup BufExplorer + autocmd! + autocmd BufEnter,BufNew * call s:ActivateBuffer() + autocmd BufWipeOut * call s:DeactivateBuffer(1) + autocmd BufDelete * call s:DeactivateBuffer(0) + autocmd BufWinEnter \[BufExplorer\] call s:Initialize() + autocmd BufWinLeave \[BufExplorer\] call s:Cleanup() + augroup END +endfunction + +" Reset {{{2 +function! s:Reset() + " Build initial MRUList. This makes sure all the files specified on the + " command line are picked up correctly. + let s:MRUList = range(1, bufnr('$')) + + " Initialize the association of buffers to tabs for any buffers + " that have been created prior to now, e.g., files specified as + " vim command line arguments + call s:CatalogBuffers() +endfunction + +" CatalogBuffers {{{2 +" Create tab associations for any existing buffers +function! s:CatalogBuffers() + let ct = tabpagenr() + + for tab in range(1, tabpagenr('$')) + silent execute 'normal! ' . tab . 'gt' + for buf in tabpagebuflist() + call s:UpdateTabBufData(buf) + endfor + endfor + + silent execute 'normal! ' . ct . 'gt' +endfunction + +" AssociatedTab {{{2 +" Return the number of the tab associated with the specified buffer. +" If the buffer is associated with more than one tab, the first one +" found is returned. If the buffer is not associated with any tabs, +" -1 is returned. +function! s:AssociatedTab(bufnr) + for tab in range(1, tabpagenr('$')) + let list = gettabvar(tab, 'bufexp_buf_list', []) + let idx = index(list, a:bufnr) + if idx != -1 + return tab + endif + endfor + + return -1 +endfunction + +" RemoveBufFromOtherTabs {{{2 +" Remove the specified buffer from the buffer lists of all tabs +" except the current tab. +function! s:RemoveBufFromOtherTabs(bufnr) + for tab in range(1, tabpagenr('$')) + if tab == tabpagenr() + continue + endif + + let list = gettabvar(tab, 'bufexp_buf_list', []) + let idx = index(list, a:bufnr) + if idx == -1 + continue + endif + + call remove(list, idx) + call settabvar(tab, 'bufexp_buf_list', list) + endfor +endfunction + +" AddBufToCurrentTab {{{2 +" Add the specified buffer to the list of buffers associated +" with the current tab +function! s:AddBufToCurrentTab(bufnr) + if index(t:bufexp_buf_list, a:bufnr) == -1 + call add(t:bufexp_buf_list, a:bufnr) + endif +endfunction + +" IsInCurrentTab {{{2 +" Returns whether the specified buffer is associated +" with the current tab +function! s:IsInCurrentTab(bufnr) + " It shouldn't happen that the list of buffers is + " not defined but if it does, play it safe and + " include the buffer + if !exists('t:bufexp_buf_list') + return 1 + endif + + return (index(t:bufexp_buf_list, a:bufnr) != -1) +endfunction + +" UpdateTabBufData {{{2 +" Update the tab buffer data for the specified buffer +" +" The current tab's list is updated. If a buffer is only +" allowed to be associated with one tab, it is removed +" from the lists of any other tabs with which it may have +" been associated. +" +" The associations between tabs and buffers are maintained +" in separate lists for each tab, which are stored in tab- +" specific variables 't:bufexp_buf_list'. +function! s:UpdateTabBufData(bufnr) + " The first time we add a tab, Vim uses the current buffer + " as its starting page even though we are about to edit a + " new page, and another BufEnter for the new page is triggered + " later. Use this first BufEnter to initialize the list of + " buffers, but don't add the buffer number to the list if + " it is already associated with another tab + " + " Unfortunately, this doesn't work right when the first + " buffer opened in the tab should be associated with it, + " such as when 'tab split +buffer N' is used + if !exists("t:bufexp_buf_list") + let t:bufexp_buf_list = [] + + if s:AssociatedTab(a:bufnr) != -1 + return + endif + endif + + call s:AddBufToCurrentTab(a:bufnr) + + if g:bufExplorerOnlyOneTab + call s:RemoveBufFromOtherTabs(a:bufnr) + endif +endfunction + +" ActivateBuffer {{{2 +function! s:ActivateBuffer() + let _bufnr = bufnr("%") + call s:UpdateTabBufData(_bufnr) + call s:MRUPush(_bufnr) +endfunction + +" DeactivateBuffer {{{2 +function! s:DeactivateBuffer(remove) + let _bufnr = str2nr(expand("")) + call s:MRUPop(_bufnr) +endfunction + +" MRUPop {{{2 +function! s:MRUPop(bufnr) + call filter(s:MRUList, 'v:val != '.a:bufnr) +endfunction + +" MRUPush {{{2 +function! s:MRUPush(buf) + " Skip temporary buffer with buftype set. Don't add the BufExplorer window + " to the list. + if s:ShouldIgnore(a:buf) == 1 + return + endif + + " Remove the buffer number from the list if it already exists. + call s:MRUPop(a:buf) + + " Add the buffer number to the head of the list. + call insert(s:MRUList, a:buf) +endfunction + +" ShouldIgnore {{{2 +function! s:ShouldIgnore(buf) + " Ignore temporary buffers with buftype set. + if empty(getbufvar(a:buf, "&buftype") == 0) + return 1 + endif + + " Ignore buffers with no name. + if empty(bufname(a:buf)) == 1 + return 1 + endif + + " Ignore the BufExplorer buffer. + if fnamemodify(bufname(a:buf), ":t") == s:name + return 1 + endif + + " Ignore any buffers in the exclude list. + if index(s:MRU_Exclude_List, bufname(a:buf)) >= 0 + return 1 + endif + + " Else return 0 to indicate that the buffer was not ignored. + return 0 +endfunction + +" Initialize {{{2 +function! s:Initialize() + call s:SetLocalSettings() + let s:running = 1 +endfunction + +" Cleanup {{{2 +function! s:Cleanup() + if exists("s:_insertmode") + let &insertmode = s:_insertmode + endif + + if exists("s:_showcmd") + let &showcmd = s:_showcmd + endif + + if exists("s:_cpo") + let &cpo = s:_cpo + endif + + if exists("s:_report") + let &report = s:_report + endif + + let s:running = 0 + let s:splitMode = "" + + delmarks! +endfunction + +" SetLocalSettings {{{2 +function! s:SetLocalSettings() + let s:_insertmode = &insertmode + set noinsertmode + + let s:_showcmd = &showcmd + set noshowcmd + + let s:_cpo = &cpo + set cpo&vim + + let s:_report = &report + let &report = 10000 + + setlocal nonumber + setlocal foldcolumn=0 + setlocal nofoldenable + setlocal cursorline + setlocal nospell + setlocal nobuflisted + setlocal filetype=bufexplorer +endfunction + +" BufExplorerHorizontalSplit {{{2 +function! BufExplorerHorizontalSplit() + let s:splitMode = "sp" + execute "BufExplorer" +endfunction + +" BufExplorerVerticalSplit {{{2 +function! BufExplorerVerticalSplit() + let s:splitMode = "vsp" + execute "BufExplorer" +endfunction + +" ToggleBufExplorer {{{2 +function! ToggleBufExplorer() + if exists("s:running") && s:running == 1 && bufname(winbufnr(0)) == s:name + call s:Close() + else + call BufExplorer() + endif +endfunction + +" BufExplorer {{{2 +function! BufExplorer() + let name = s:name + + if !has("win32") + " On non-Windows boxes, escape the name so that is shows up correctly. + let name = escape(name, "[]") + endif + + " Make sure there is only one explorer open at a time. + if s:running == 1 + " Go to the open buffer. + if has("gui") + execute "drop" name + endif + + return + endif + + " Add zero to ensure the variable is treated as a number. + let s:originBuffer = bufnr("%") + 0 + + silent let s:raw_buffer_listing = s:GetBufferInfo(0) + + " We may have to split the current window. + if s:splitMode != "" + " Save off the original settings. + let [_splitbelow, _splitright] = [&splitbelow, &splitright] + + " Set the setting to ours. + let [&splitbelow, &splitright] = [g:bufExplorerSplitBelow, g:bufExplorerSplitRight] + let _size = (s:splitMode == "sp") ? g:bufExplorerSplitHorzSize : g:bufExplorerSplitVertSize + + " Split the window either horizontally or vertically. + if _size <= 0 + execute 'keepalt ' . s:splitMode + else + execute 'keepalt ' . _size . s:splitMode + endif + + " Restore the original settings. + let [&splitbelow, &splitright] = [_splitbelow, _splitright] + endif + + if !exists("b:displayMode") || b:displayMode != "winmanager" + " Do not use keepalt when opening bufexplorer to allow the buffer that + " we are leaving to become the new alternate buffer + execute "silent keepjumps hide edit".name + endif + + call s:DisplayBufferList() + + " Position the cursor in the newly displayed list on the line representing + " the active buffer. The active buffer is the line with the '%' character + " in it. + execute search("%") +endfunction + +" DisplayBufferList {{{2 +function! s:DisplayBufferList() + " Do not set bufhidden since it wipes out the data if we switch away from + " the buffer using CTRL-^. + setlocal buftype=nofile + setlocal modifiable + setlocal noswapfile + setlocal nowrap + + call s:SetupSyntax() + call s:MapKeys() + + " Wipe out any existing lines in case BufExplorer buffer exists and the + " user had changed any global settings that might reduce the number of + " lines needed in the buffer. + silent keepjumps 1,$d _ + + call setline(1, s:CreateHelp()) + call s:BuildBufferList() + call cursor(s:firstBufferLine, 1) + + if !g:bufExplorerResize + normal! zz + endif + + setlocal nomodifiable +endfunction + +" MapKeys {{{2 +function! s:MapKeys() + if exists("b:displayMode") && b:displayMode == "winmanager" + nnoremap :call SelectBuffer() + endif + + nnoremap ${2} diff --git a/sources_non_forked/snipmate-snippets/html/script/inline_script.snippet b/sources_non_forked/snipmate-snippets/html/script/inline_script.snippet deleted file mode 100644 index 35e078b3..00000000 --- a/sources_non_forked/snipmate-snippets/html/script/inline_script.snippet +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/html/select.snippet b/sources_non_forked/snipmate-snippets/html/select.snippet deleted file mode 100644 index 252e3f77..00000000 --- a/sources_non_forked/snipmate-snippets/html/select.snippet +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/html/skel/basic.snippet b/sources_non_forked/snipmate-snippets/html/skel/basic.snippet deleted file mode 100644 index 61ec2444..00000000 --- a/sources_non_forked/snipmate-snippets/html/skel/basic.snippet +++ /dev/null @@ -1,13 +0,0 @@ - - - - - ${1:Page Title} - - - - - ${2} - - diff --git a/sources_non_forked/snipmate-snippets/html/skel/basic_with_meta.snippet b/sources_non_forked/snipmate-snippets/html/skel/basic_with_meta.snippet deleted file mode 100644 index b6de9f8d..00000000 --- a/sources_non_forked/snipmate-snippets/html/skel/basic_with_meta.snippet +++ /dev/null @@ -1,15 +0,0 @@ - - - - - ${1:Page Title} - - - - - - - ${2} - - diff --git a/sources_non_forked/snipmate-snippets/html/style.snippet b/sources_non_forked/snipmate-snippets/html/style.snippet deleted file mode 100644 index 26ae0fe9..00000000 --- a/sources_non_forked/snipmate-snippets/html/style.snippet +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/html/t.snippet b/sources_non_forked/snipmate-snippets/html/t.snippet deleted file mode 100644 index ef504276..00000000 --- a/sources_non_forked/snipmate-snippets/html/t.snippet +++ /dev/null @@ -1,3 +0,0 @@ -<${1:div}${2}> - ${3} -${4} diff --git a/sources_non_forked/snipmate-snippets/html/table/basic.snippet b/sources_non_forked/snipmate-snippets/html/table/basic.snippet deleted file mode 100644 index 2100d13d..00000000 --- a/sources_non_forked/snipmate-snippets/html/table/basic.snippet +++ /dev/null @@ -1,3 +0,0 @@ - - ${2} -
diff --git a/sources_non_forked/snipmate-snippets/html/table/hardcore.snippet b/sources_non_forked/snipmate-snippets/html/table/hardcore.snippet deleted file mode 100644 index 35fa01ae..00000000 --- a/sources_non_forked/snipmate-snippets/html/table/hardcore.snippet +++ /dev/null @@ -1,9 +0,0 @@ -+>> - - <++> - - - - - - diff --git a/sources_non_forked/snipmate-snippets/html/textarea.snippet b/sources_non_forked/snipmate-snippets/html/textarea.snippet deleted file mode 100644 index 0b3fb84b..00000000 --- a/sources_non_forked/snipmate-snippets/html/textarea.snippet +++ /dev/null @@ -1 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/java/class/basic+constructor+main.snippet b/sources_non_forked/snipmate-snippets/java/class/basic+constructor+main.snippet deleted file mode 100644 index 3bd770e2..00000000 --- a/sources_non_forked/snipmate-snippets/java/class/basic+constructor+main.snippet +++ /dev/null @@ -1,17 +0,0 @@ -/** - * class $2 - * @author ${4:`g:snips_author`} - */ -${1:public} class ${2:`Snippet_JavaClassNameFromFilename()`}${3} { - - /** - * Constructor for $2 - */ - public $2(${4}) { - ${5} - } - - public static void main(String args[]) { - } - -} diff --git a/sources_non_forked/snipmate-snippets/java/class/basic+constructor.snippet b/sources_non_forked/snipmate-snippets/java/class/basic+constructor.snippet deleted file mode 100644 index 05eabefa..00000000 --- a/sources_non_forked/snipmate-snippets/java/class/basic+constructor.snippet +++ /dev/null @@ -1,14 +0,0 @@ -/** - * class $2 - * @author ${4:`g:snips_author`} - */ -${1:public} class ${2:`Snippet_JavaClassNameFromFilename()`}${3} { - - /** - * Constructor for $2 - */ - public $2(${5}){ - ${6} - } - -} diff --git a/sources_non_forked/snipmate-snippets/java/class/basic.snippet b/sources_non_forked/snipmate-snippets/java/class/basic.snippet deleted file mode 100644 index 05eabefa..00000000 --- a/sources_non_forked/snipmate-snippets/java/class/basic.snippet +++ /dev/null @@ -1,14 +0,0 @@ -/** - * class $2 - * @author ${4:`g:snips_author`} - */ -${1:public} class ${2:`Snippet_JavaClassNameFromFilename()`}${3} { - - /** - * Constructor for $2 - */ - public $2(${5}){ - ${6} - } - -} diff --git a/sources_non_forked/snipmate-snippets/java/for.snippet b/sources_non_forked/snipmate-snippets/java/for.snippet deleted file mode 100644 index 70a41086..00000000 --- a/sources_non_forked/snipmate-snippets/java/for.snippet +++ /dev/null @@ -1,3 +0,0 @@ -for(${1:int i=0}; ${2:condition}; ${3:i++}){ - ${4} -} diff --git a/sources_non_forked/snipmate-snippets/java/gs.snippet b/sources_non_forked/snipmate-snippets/java/gs.snippet deleted file mode 100644 index 954a9a09..00000000 --- a/sources_non_forked/snipmate-snippets/java/gs.snippet +++ /dev/null @@ -1,9 +0,0 @@ -//getter for $3 -public ${2:variable_type} get${1:VariableName}() { - return ${3:variableName}; -} - -//setter for $3 -public void set$1($2 $3) { - this.$3 = $3; -}${4} diff --git a/sources_non_forked/snipmate-snippets/java/if.snippet b/sources_non_forked/snipmate-snippets/java/if.snippet deleted file mode 100644 index b9d1c5c3..00000000 --- a/sources_non_forked/snipmate-snippets/java/if.snippet +++ /dev/null @@ -1,3 +0,0 @@ -if(${1}){ - ${2} -} diff --git a/sources_non_forked/snipmate-snippets/java/ife.snippet b/sources_non_forked/snipmate-snippets/java/ife.snippet deleted file mode 100644 index a7e43d09..00000000 --- a/sources_non_forked/snipmate-snippets/java/ife.snippet +++ /dev/null @@ -1,4 +0,0 @@ -if(${1}){ - ${2} -}else{ -} diff --git a/sources_non_forked/snipmate-snippets/java/log.snippet b/sources_non_forked/snipmate-snippets/java/log.snippet deleted file mode 100644 index abb7c7d6..00000000 --- a/sources_non_forked/snipmate-snippets/java/log.snippet +++ /dev/null @@ -1 +0,0 @@ -System.${1:out}.println(${2}); diff --git a/sources_non_forked/snipmate-snippets/java/m.snippet b/sources_non_forked/snipmate-snippets/java/m.snippet deleted file mode 100644 index 67bf3fb0..00000000 --- a/sources_non_forked/snipmate-snippets/java/m.snippet +++ /dev/null @@ -1,8 +0,0 @@ -/** - * ${7:Method Description} - * ${5} - * @return ${6} - */ -${1:public} ${2:void} ${3:methodName}(${4}) { - ${8} -} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/add.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/add.snippet deleted file mode 100644 index 3bf9756d..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/add.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.add('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/addClass.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/addClass.snippet deleted file mode 100644 index 68007744..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/addClass.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.addClass('${2:class name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/after.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/after.snippet deleted file mode 100644 index 34d1956d..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/after.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.after('${2:Some text and bold!}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajax.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajax.snippet deleted file mode 100644 index 5453a257..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajax.snippet +++ /dev/null @@ -1,18 +0,0 @@ -$.ajax({ - url: "${1:mydomain.com/url}", - type: "${2:POST}", - dataType: "${3:xml/html/script/json}", - data: $.param( $("${4:Element or Expression}") ), - - complete: function() { - ${5://called when complete} - }, - - success: function() { - ${6://called when successful} - }, - - error: function() { - ${7://called when there is an error} - }, -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxerror.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxerror.snippet deleted file mode 100644 index 0f8ccdaf..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxerror.snippet +++ /dev/null @@ -1,4 +0,0 @@ -.ajaxError(function(${1:request, settings}) { - ${2://stuff to do when an AJAX call returns an error}; -}); -${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxget.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxget.snippet deleted file mode 100644 index 1489859a..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxget.snippet +++ /dev/null @@ -1,3 +0,0 @@ -$.get('${1:/test/ajax-test.xml}', function(xml){ - ${2:alert( ("title",xml).text() ) //optional stuff to do after get;} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxgetif.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxgetif.snippet deleted file mode 100644 index 0f4d1ef0..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxgetif.snippet +++ /dev/null @@ -1,3 +0,0 @@ -$.getIfModified('${1:/test/test.cgi}', function(data){ - ${2:alert( "Data loaded: " + data ) //optional stuff to do after get;} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxpost.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxpost.snippet deleted file mode 100644 index f62bf102..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxpost.snippet +++ /dev/null @@ -1,5 +0,0 @@ -$.post('<+/path/to/file.cgi+>',{ - <+<+param1+>: "<+value1+>", <+param2+>: "<+value2+>"+>}, - function(){ - <+//stuff to do after event occurs;+> -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsend.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsend.snippet deleted file mode 100644 index 4b74cd98..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsend.snippet +++ /dev/null @@ -1,4 +0,0 @@ -.ajaxSend(function(${1:request, settings}) { - ${2://stuff to do when an AJAX call returns an error}; -}); -${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsetup.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsetup.snippet deleted file mode 100644 index c5b4ad02..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsetup.snippet +++ /dev/null @@ -1,18 +0,0 @@ -$.ajaxSetup({ - url: "${1:mydomain.com/url}", - type: "${2:POST}", - dataType: "${3:xml/html/script/json}", - data: $.param( $("${4:Element or Expression}") ), - - complete: function() { - ${5://called when complete} - }, - - success: function() { - ${6://called when successful} - }, - - error: function() { - ${7://called when there is an error} - }, -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstart.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstart.snippet deleted file mode 100644 index 3caafd58..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstart.snippet +++ /dev/null @@ -1,4 +0,0 @@ -$.ajaxStart(function() { - ${1://stuff to do when an AJAX call is started and no other AJAX calls are in progress}; -}); -${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstop.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstop.snippet deleted file mode 100644 index 6088a9f5..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxstop.snippet +++ /dev/null @@ -1,4 +0,0 @@ -$.ajaxStop(function() { - ${1://stuff to do when an AJAX call is started and no other AJAX calls are in progress}; -}); -${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsuccess.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsuccess.snippet deleted file mode 100644 index ba2247dc..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ajaxsuccess.snippet +++ /dev/null @@ -1,4 +0,0 @@ -$.ajaxSuccess(function() { - ${1://stuff to do when an AJAX call is started and no other AJAX calls are in progress}; -}); -${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/animate.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/animate.snippet deleted file mode 100644 index 19135327..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/animate.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.animate({${2:param1: value1, param2: value2}}, ${3:speed})${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/append.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/append.snippet deleted file mode 100644 index bc4ff4d3..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/append.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.append('${2:Some text and bold!}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/appendTo.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/appendTo.snippet deleted file mode 100644 index 97883710..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/appendTo.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.appendTo('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/attr.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/attr.snippet deleted file mode 100644 index fb7e2f42..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/attr.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.attr('${2:attribute}', '${3:value}')${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/attrm.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/attrm.snippet deleted file mode 100644 index 15685512..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/attrm.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.attr({'${2:attr1}': '${3:value1}', '${4:attr2}': '${5:value2}'})${6} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/before.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/before.snippet deleted file mode 100644 index e12c4aed..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/before.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.before('${2:Some text and bold!}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/bind.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/bind.snippet deleted file mode 100644 index dda284d9..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/bind.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.bind('${2:event name}', function(${3:event}) { - ${4:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/blur.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/blur.snippet deleted file mode 100644 index 674623db..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/blur.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.blur(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/change.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/change.snippet deleted file mode 100644 index 184f8a99..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/change.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.change(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/children.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/children.snippet deleted file mode 100644 index 2db688b1..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/children.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.children('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/click.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/click.snippet deleted file mode 100644 index d17a047e..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/click.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.click(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/clone.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/clone.snippet deleted file mode 100644 index 83b0b421..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/clone.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.clone()${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/contains.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/contains.snippet deleted file mode 100644 index 2a073948..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/contains.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.contains('${2:text to find}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/css.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/css.snippet deleted file mode 100644 index 408199eb..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/css.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.css('${2:attribute}', '${3:value}')${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/cssm.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/cssm.snippet deleted file mode 100644 index 7eebe1e4..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/cssm.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.css({${2:attribute1}: '${3:value1}', ${4:attribute2}: '${5:value2}'})${6} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/dblclick.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/dblclick.snippet deleted file mode 100644 index 4b2d6b2a..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/dblclick.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.dblclick(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/each.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/each.snippet deleted file mode 100644 index 05beed2e..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/each.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.each(function(index) { - ${2:this.innerHTML = this + " is the element, " + index + " is the position";} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/el.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/el.snippet deleted file mode 100644 index d2065238..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/el.snippet +++ /dev/null @@ -1 +0,0 @@ -$('${1}')${2:} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/eltrim.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/eltrim.snippet deleted file mode 100644 index 9cc0d692..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/eltrim.snippet +++ /dev/null @@ -1 +0,0 @@ -$.trim('${1:string}')${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/end.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/end.snippet deleted file mode 100644 index 293102c4..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/end.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.end()${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/error.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/error.snippet deleted file mode 100644 index 23b0e650..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/error.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.error(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadein.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadein.snippet deleted file mode 100644 index 549d8464..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/fadein.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.fadeIn('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeinc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadeinc.snippet deleted file mode 100644 index 9090853e..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeinc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.fadeIn('slow/400/fast', function() { - ${2://Stuff to do *after* the animation takes place}; -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeout.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadeout.snippet deleted file mode 100644 index 24d6c763..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeout.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.fadeOut('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeoutc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadeoutc.snippet deleted file mode 100644 index 76d54571..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeoutc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.fadeOut('slow/400/fast', function() { - ${2://Stuff to do *after* the animation takes place}; -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeto.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadeto.snippet deleted file mode 100644 index b0e584aa..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/fadeto.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.fadeTo('${2:slow/400/fast}', ${3:0.5})${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/fadetoc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/fadetoc.snippet deleted file mode 100644 index 17243b4c..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/fadetoc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.fadeTo('slow/400/fast', ${2:0.5}, function() { - ${3://Stuff to do *after* the animation takes place}; -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/filter.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/filter.snippet deleted file mode 100644 index d33fdf2b..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/filter.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.filter('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/find.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/find.snippet deleted file mode 100644 index 1791e912..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/find.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.find('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/focus.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/focus.snippet deleted file mode 100644 index 3b1b5719..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/focus.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.focus(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/get.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/get.snippet deleted file mode 100644 index 4374c183..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/get.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.get(${2:element index})${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/getjson.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/getjson.snippet deleted file mode 100644 index 518d676d..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/getjson.snippet +++ /dev/null @@ -1,5 +0,0 @@ -$.getJSON('<+/path/to/file.cgi+>',{ - <+<+param1+>: "<+value1+>", <+param2+>: "<+value2+>"+>}, - function(json){ - <+//stuff to do after event occurs;+> -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/getscript.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/getscript.snippet deleted file mode 100644 index 0b62d90b..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/getscript.snippet +++ /dev/null @@ -1,3 +0,0 @@ -$.getScript('${1:somescript.js}', function(){ - ${2://optional stuff to do after getScript;} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/height.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/height.snippet deleted file mode 100644 index 1515d5c6..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/height.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.height(${2:integer})${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/hide.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/hide.snippet deleted file mode 100644 index c8071cbc..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/hide.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.hide('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/hidec.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/hidec.snippet deleted file mode 100644 index 62f2280a..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/hidec.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.hide('${2:slow/400/fast}', function() { - ${3://Stuff to do *after* the animation takes place} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/hover.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/hover.snippet deleted file mode 100644 index d8468c1a..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/hover.snippet +++ /dev/null @@ -1,5 +0,0 @@ -${1:obj}.hover(function() { - ${2:// Stuff to do when the mouse enters the element;} -}, function() { - ${3:// Stuff to do when the mouse leaves the element;} -});${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/html.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/html.snippet deleted file mode 100644 index 0c5a25e1..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/html.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.html('${2:Some text and bold!}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/insertAfter.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/insertAfter.snippet deleted file mode 100644 index 66c389eb..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/insertAfter.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.insertAfter('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/insertBefore.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/insertBefore.snippet deleted file mode 100644 index e7090d4d..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/insertBefore.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.insertBefore('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/is.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/is.snippet deleted file mode 100644 index 28eefb02..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/is.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.is('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/load.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/load.snippet deleted file mode 100644 index 1f09fbc9..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/load.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.load(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/loadf.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/loadf.snippet deleted file mode 100644 index 2e7d9c8b..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/loadf.snippet +++ /dev/null @@ -1,3 +0,0 @@ -<+obj+>.load('<+/path/to/file.htm+>', { <+<+param1+>: "<+value1+>", <+param2+>: "<+value2+>"+> }, function() { - <+// Stuff to do after the page is loaded+> -}); \ No newline at end of file diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/loadif.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/loadif.snippet deleted file mode 100644 index fe45d05a..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/loadif.snippet +++ /dev/null @@ -1,3 +0,0 @@ -<+obj+>.loadIfModified('<+/path/to/file.htm+>', { <+<+param1+>: "<+value1+>", <+param2+>: "<+value2+>"+> }, function() { - <+// Stuff to do after the page is loaded+> -}); \ No newline at end of file diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/mdown.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/mdown.snippet deleted file mode 100644 index 3be70e1b..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/mdown.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.mousedown(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/mmove.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/mmove.snippet deleted file mode 100644 index eb7ac052..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/mmove.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.mousemove(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/mout.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/mout.snippet deleted file mode 100644 index f2142756..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/mout.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.mouseout(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/mover.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/mover.snippet deleted file mode 100644 index f1eb19cc..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/mover.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.mouseover(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/mup.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/mup.snippet deleted file mode 100644 index 04fb36a3..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/mup.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.mouseup(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/next.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/next.snippet deleted file mode 100644 index b6a65281..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/next.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.next('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/not.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/not.snippet deleted file mode 100644 index c6a217f6..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/not.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.not('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/one.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/one.snippet deleted file mode 100644 index cacdbfb5..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/one.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.one('${2:event name}', function(${3:event}) { - ${4:// Act on the event once} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/parent.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/parent.snippet deleted file mode 100644 index 0490f05a..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/parent.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.parent('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/parents.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/parents.snippet deleted file mode 100644 index fb0bd131..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/parents.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.parents('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/prepend.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/prepend.snippet deleted file mode 100644 index bc41d48f..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/prepend.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.prepend('${2:Some text and bold!}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/prependto.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/prependto.snippet deleted file mode 100644 index e4406957..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/prependto.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.prependTo('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/prev.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/prev.snippet deleted file mode 100644 index b7aba645..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/prev.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.prev('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/ready.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/ready.snippet deleted file mode 100644 index d0005318..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/ready.snippet +++ /dev/null @@ -1,3 +0,0 @@ -$(document).ready(function() { - ${1:// Stuff to do as soon as the DOM is ready;} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/remove.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/remove.snippet deleted file mode 100644 index 4c976a17..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/remove.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.remove()${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/removeattr.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/removeattr.snippet deleted file mode 100644 index 267d584a..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/removeattr.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.removeAttr('${2:attribute name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/removeclass.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/removeclass.snippet deleted file mode 100644 index f5538030..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/removeclass.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.removeClass('${2:class name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/reset.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/reset.snippet deleted file mode 100644 index 777af958..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/reset.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.reset(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/resize.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/resize.snippet deleted file mode 100644 index b46ac0a0..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/resize.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.resize(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/scroll.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/scroll.snippet deleted file mode 100644 index 7a512442..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/scroll.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.scroll(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/sdown.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/sdown.snippet deleted file mode 100644 index b39840e9..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/sdown.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.slideDown('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/sdownc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/sdownc.snippet deleted file mode 100644 index 3404b783..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/sdownc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.slideDown('${2:slow/400/fast}', function() { - ${3://Stuff to do *after* the animation takes place}; -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/sdupc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/sdupc.snippet deleted file mode 100644 index 873c6657..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/sdupc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.slideUp('${2:slow/400/fast}', function() { - ${3://Stuff to do *after* the animation takes place}; -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/select.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/select.snippet deleted file mode 100644 index 986437ed..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/select.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.select(function() { - ${2:// Act on the event} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/show.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/show.snippet deleted file mode 100644 index 31819b1e..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/show.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.show('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/showc.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/showc.snippet deleted file mode 100644 index 6dc5bacc..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/showc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.show('${2:slow/400/fast}', function() { - ${3://Stuff to do *after* the animation takes place} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/sib.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/sib.snippet deleted file mode 100644 index 014f1f79..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/sib.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.siblings('${2:selector expression}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/size.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/size.snippet deleted file mode 100644 index 1ba15439..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/size.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.size()${2} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/stoggle.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/stoggle.snippet deleted file mode 100644 index daba37d2..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/stoggle.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.slideToggle('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/submit.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/submit.snippet deleted file mode 100644 index ae98d83e..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/submit.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:obj}.submit(function() { - ${2:// Act on the event once} -}); diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/sup.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/sup.snippet deleted file mode 100644 index d844a68e..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/sup.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.slideUp('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/text.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/text.snippet deleted file mode 100644 index 5f667c07..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/text.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.text(${2:'some text'})${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/this.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/this.snippet deleted file mode 100644 index b3cee8d3..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/this.snippet +++ /dev/null @@ -1 +0,0 @@ -$(this)${1} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/tog.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/tog.snippet deleted file mode 100644 index 54f5f17a..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/tog.snippet +++ /dev/null @@ -1,6 +0,0 @@ -${1:obj}.toggle(function() { - ${2:// Stuff to do every *odd* time the element is clicked;} -}, function() { - ${3:// Stuff to do every *even* time the element is clicked;} -}); -${4} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/togclass.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/togclass.snippet deleted file mode 100644 index 023a4b7d..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/togclass.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.toggleClass('${2:class name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/togsh.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/togsh.snippet deleted file mode 100644 index 265a62d0..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/togsh.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.toggle('${2:slow/400/fast}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/trig.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/trig.snippet deleted file mode 100644 index f7105e08..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/trig.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.trigger('${2:event name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/unbind.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/unbind.snippet deleted file mode 100644 index 0fe423d5..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/unbind.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.unbind('${2:event name}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/val.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/val.snippet deleted file mode 100644 index cafe0b0b..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/val.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.val('${2:text}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/width.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/width.snippet deleted file mode 100644 index 415631c6..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/width.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.width(${2:integer})${3} diff --git a/sources_non_forked/snipmate-snippets/javascript-jquery/wrap.snippet b/sources_non_forked/snipmate-snippets/javascript-jquery/wrap.snippet deleted file mode 100644 index 55df53ff..00000000 --- a/sources_non_forked/snipmate-snippets/javascript-jquery/wrap.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:obj}.wrap('${2:<div class="extra-wrapper"></div>}')${3} diff --git a/sources_non_forked/snipmate-snippets/javascript/anon.snippet b/sources_non_forked/snipmate-snippets/javascript/anon.snippet deleted file mode 100644 index d486c430..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/anon.snippet +++ /dev/null @@ -1 +0,0 @@ -function(${1}) { ${2} }; diff --git a/sources_non_forked/snipmate-snippets/javascript/for.snippet b/sources_non_forked/snipmate-snippets/javascript/for.snippet deleted file mode 100644 index 3933153f..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/for.snippet +++ /dev/null @@ -1,3 +0,0 @@ -for (var <+i+>=0; <+i+> < <+<+Things+>.length+>; <+i+>++) { -<+<+Things+>[<+i+>]+> -}; diff --git a/sources_non_forked/snipmate-snippets/javascript/fun.snippet b/sources_non_forked/snipmate-snippets/javascript/fun.snippet deleted file mode 100644 index 064b9593..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/fun.snippet +++ /dev/null @@ -1,3 +0,0 @@ -function ${1:function_name} (${2:argument}) { - ${3:// body} -} diff --git a/sources_non_forked/snipmate-snippets/javascript/if.snippet b/sources_non_forked/snipmate-snippets/javascript/if.snippet deleted file mode 100644 index 931b9f17..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/if.snippet +++ /dev/null @@ -1 +0,0 @@ -if (${1:true}) { ${2} }; diff --git a/sources_non_forked/snipmate-snippets/javascript/ife.snippet b/sources_non_forked/snipmate-snippets/javascript/ife.snippet deleted file mode 100644 index 6b172d07..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/ife.snippet +++ /dev/null @@ -1,4 +0,0 @@ -if (${1:true}) { - ${2} -} else { -}; diff --git a/sources_non_forked/snipmate-snippets/javascript/log.snippet b/sources_non_forked/snipmate-snippets/javascript/log.snippet deleted file mode 100644 index b4cf84fe..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/log.snippet +++ /dev/null @@ -1 +0,0 @@ -console.log(${1}); diff --git a/sources_non_forked/snipmate-snippets/javascript/met.snippet b/sources_non_forked/snipmate-snippets/javascript/met.snippet deleted file mode 100644 index 1c30d617..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/met.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:method_name}: function(${2:attribute}){ - ${3} -}${4:, } diff --git a/sources_non_forked/snipmate-snippets/javascript/proto.snippet b/sources_non_forked/snipmate-snippets/javascript/proto.snippet deleted file mode 100644 index 37cd6d49..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/proto.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) { - ${4:// body} -}; diff --git a/sources_non_forked/snipmate-snippets/javascript/timeout.snippet b/sources_non_forked/snipmate-snippets/javascript/timeout.snippet deleted file mode 100644 index 6ea2842c..00000000 --- a/sources_non_forked/snipmate-snippets/javascript/timeout.snippet +++ /dev/null @@ -1 +0,0 @@ -setTimeout(function() { ${1} }, ${2:10}); diff --git a/sources_non_forked/snipmate-snippets/objc/I.snippet b/sources_non_forked/snipmate-snippets/objc/I.snippet deleted file mode 100644 index 0032f65f..00000000 --- a/sources_non_forked/snipmate-snippets/objc/I.snippet +++ /dev/null @@ -1,6 +0,0 @@ -+ (void) initialize -{ - [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWIthObjectsAndKeys: - ${1}@"value", @"key", - nil]]; -} diff --git a/sources_non_forked/snipmate-snippets/objc/Imp.snippet b/sources_non_forked/snipmate-snippets/objc/Imp.snippet deleted file mode 100644 index 91724d3f..00000000 --- a/sources_non_forked/snipmate-snippets/objc/Imp.snippet +++ /dev/null @@ -1 +0,0 @@ -#import "${1:`Filename()`.h}"${2} diff --git a/sources_non_forked/snipmate-snippets/objc/alloc.snippet b/sources_non_forked/snipmate-snippets/objc/alloc.snippet deleted file mode 100644 index e4d15993..00000000 --- a/sources_non_forked/snipmate-snippets/objc/alloc.snippet +++ /dev/null @@ -1 +0,0 @@ -[[${1:foo} alloc] init]${2};${3} diff --git a/sources_non_forked/snipmate-snippets/objc/array.snippet b/sources_non_forked/snipmate-snippets/objc/array.snippet deleted file mode 100644 index 45d3ef01..00000000 --- a/sources_non_forked/snipmate-snippets/objc/array.snippet +++ /dev/null @@ -1 +0,0 @@ -NSMutableArray *${1:array} = [NSMutable array];${2} diff --git a/sources_non_forked/snipmate-snippets/objc/bez.snippet b/sources_non_forked/snipmate-snippets/objc/bez.snippet deleted file mode 100644 index 493aff69..00000000 --- a/sources_non_forked/snipmate-snippets/objc/bez.snippet +++ /dev/null @@ -1 +0,0 @@ -NSBezierPath *${1:path} = [NSBezierPath bezierPath];${2} diff --git a/sources_non_forked/snipmate-snippets/objc/cat.snippet b/sources_non_forked/snipmate-snippets/objc/cat.snippet deleted file mode 100644 index fd57aae3..00000000 --- a/sources_non_forked/snipmate-snippets/objc/cat.snippet +++ /dev/null @@ -1,6 +0,0 @@ -@interface ${1:NSObject} (${2:Category}) -@end - -@implementation $1 ($2) -${3} -@end diff --git a/sources_non_forked/snipmate-snippets/objc/cati.snippet b/sources_non_forked/snipmate-snippets/objc/cati.snippet deleted file mode 100644 index d2852600..00000000 --- a/sources_non_forked/snipmate-snippets/objc/cati.snippet +++ /dev/null @@ -1,3 +0,0 @@ -@interface ${1:NSObject} (${2:Category}) -${3} -@end diff --git a/sources_non_forked/snipmate-snippets/objc/cli.snippet b/sources_non_forked/snipmate-snippets/objc/cli.snippet deleted file mode 100644 index fa896224..00000000 --- a/sources_non_forked/snipmate-snippets/objc/cli.snippet +++ /dev/null @@ -1,5 +0,0 @@ -@interface ${1:ClassName} : ${2:NSObject} -{${3} -} -${4} -@end diff --git a/sources_non_forked/snipmate-snippets/objc/dict.snippet b/sources_non_forked/snipmate-snippets/objc/dict.snippet deleted file mode 100644 index 8b2d7e90..00000000 --- a/sources_non_forked/snipmate-snippets/objc/dict.snippet +++ /dev/null @@ -1 +0,0 @@ -NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];${2} diff --git a/sources_non_forked/snipmate-snippets/objc/forarray.snippet b/sources_non_forked/snipmate-snippets/objc/forarray.snippet deleted file mode 100644 index d32215d0..00000000 --- a/sources_non_forked/snipmate-snippets/objc/forarray.snippet +++ /dev/null @@ -1,7 +0,0 @@ -unsigned int ${1:object}Count = [${2:array} count]; - -for (unsigned int index = 0; index < $1Count; index++) -{ - ${3:id} $1 = [$2 $1AtIndex:index]; - ${4} -} diff --git a/sources_non_forked/snipmate-snippets/objc/log.snippet b/sources_non_forked/snipmate-snippets/objc/log.snippet deleted file mode 100644 index 69f9c067..00000000 --- a/sources_non_forked/snipmate-snippets/objc/log.snippet +++ /dev/null @@ -1 +0,0 @@ -NSLog(@"${1}"${2});${3} diff --git a/sources_non_forked/snipmate-snippets/objc/m/class method.snippet b/sources_non_forked/snipmate-snippets/objc/m/class method.snippet deleted file mode 100644 index 191ee160..00000000 --- a/sources_non_forked/snipmate-snippets/objc/m/class method.snippet +++ /dev/null @@ -1,4 +0,0 @@ -+ (${1:id}) ${2:method} -{${3} - return nil; -} diff --git a/sources_non_forked/snipmate-snippets/objc/m/method.snippet b/sources_non_forked/snipmate-snippets/objc/m/method.snippet deleted file mode 100644 index 9f7390e2..00000000 --- a/sources_non_forked/snipmate-snippets/objc/m/method.snippet +++ /dev/null @@ -1,4 +0,0 @@ -- (${1:id}) ${2:method} -{${3} - ${4:return nil;} -} diff --git a/sources_non_forked/snipmate-snippets/objc/objacc.snippet b/sources_non_forked/snipmate-snippets/objc/objacc.snippet deleted file mode 100644 index 840ebfd0..00000000 --- a/sources_non_forked/snipmate-snippets/objc/objacc.snippet +++ /dev/null @@ -1,11 +0,0 @@ -- (${1:id})${2:thing} -{ - return $2; -} - -- (void) set$2:($1) -{ - $1 old$2 = $2; - $2 = [aValue retain]; - [old$2 release]; -} diff --git a/sources_non_forked/snipmate-snippets/objc/objc.snippet b/sources_non_forked/snipmate-snippets/objc/objc.snippet deleted file mode 100644 index d6671487..00000000 --- a/sources_non_forked/snipmate-snippets/objc/objc.snippet +++ /dev/null @@ -1,14 +0,0 @@ -@interface ${1:`Filename('', 'object')`} : ${2:NSObject} -{ -} -@end - -@implementation $1 -- (id) init -{ - if (self = [super init]) - {${3} - } - return self -} -@end diff --git a/sources_non_forked/snipmate-snippets/objc/prop.snippet b/sources_non_forked/snipmate-snippets/objc/prop.snippet deleted file mode 100644 index d77495a6..00000000 --- a/sources_non_forked/snipmate-snippets/objc/prop.snippet +++ /dev/null @@ -1 +0,0 @@ -@property (${1:retain}) ${2:NSSomeClass} *${3:$2};${4} diff --git a/sources_non_forked/snipmate-snippets/objc/rel.snippet b/sources_non_forked/snipmate-snippets/objc/rel.snippet deleted file mode 100644 index 5dea04dd..00000000 --- a/sources_non_forked/snipmate-snippets/objc/rel.snippet +++ /dev/null @@ -1 +0,0 @@ -[${1:foo} release];${2} diff --git a/sources_non_forked/snipmate-snippets/objc/ret.snippet b/sources_non_forked/snipmate-snippets/objc/ret.snippet deleted file mode 100644 index ee8eba46..00000000 --- a/sources_non_forked/snipmate-snippets/objc/ret.snippet +++ /dev/null @@ -1 +0,0 @@ -[${1:foo} retain];${2} diff --git a/sources_non_forked/snipmate-snippets/objc/sel.snippet b/sources_non_forked/snipmate-snippets/objc/sel.snippet deleted file mode 100644 index 4d4996d1..00000000 --- a/sources_non_forked/snipmate-snippets/objc/sel.snippet +++ /dev/null @@ -1 +0,0 @@ -@selector(${1:method}:)${2} diff --git a/sources_non_forked/snipmate-snippets/objc/sm.snippet b/sources_non_forked/snipmate-snippets/objc/sm.snippet deleted file mode 100644 index af139a90..00000000 --- a/sources_non_forked/snipmate-snippets/objc/sm.snippet +++ /dev/null @@ -1,5 +0,0 @@ -- (${1:id}) ${2:method}:(${3:id})${4:anArgument} -{ - $1 res = [super $2:$4];${5} - return res; -} diff --git a/sources_non_forked/snipmate-snippets/objc/syn.snippet b/sources_non_forked/snipmate-snippets/objc/syn.snippet deleted file mode 100644 index eef7581c..00000000 --- a/sources_non_forked/snipmate-snippets/objc/syn.snippet +++ /dev/null @@ -1 +0,0 @@ -@synthesize ${1:NSSomeClass};${2} diff --git a/sources_non_forked/snipmate-snippets/php/array.snippet b/sources_non_forked/snipmate-snippets/php/array.snippet deleted file mode 100644 index 922542e0..00000000 --- a/sources_non_forked/snipmate-snippets/php/array.snippet +++ /dev/null @@ -1 +0,0 @@ -$${1:arrayName} = array('${2}' => ${3});${4} diff --git a/sources_non_forked/snipmate-snippets/php/case.snippet b/sources_non_forked/snipmate-snippets/php/case.snippet deleted file mode 100644 index 8f9e4daf..00000000 --- a/sources_non_forked/snipmate-snippets/php/case.snippet +++ /dev/null @@ -1,3 +0,0 @@ -case '${1:value}': - ${2:// code...} - break;${3} diff --git a/sources_non_forked/snipmate-snippets/php/class.snippet b/sources_non_forked/snipmate-snippets/php/class.snippet deleted file mode 100644 index 4929a955..00000000 --- a/sources_non_forked/snipmate-snippets/php/class.snippet +++ /dev/null @@ -1,11 +0,0 @@ -/** - * ${1} - */ -class ${2:ClassName} -{ - ${3} - function ${4:__construct}(${5:argument}) - { - ${6:// code...} - } -} diff --git a/sources_non_forked/snipmate-snippets/php/classe.snippet b/sources_non_forked/snipmate-snippets/php/classe.snippet deleted file mode 100644 index 2f2b0bc3..00000000 --- a/sources_non_forked/snipmate-snippets/php/classe.snippet +++ /dev/null @@ -1,12 +0,0 @@ -/** - * ${1} - */ -class ${2:ClassName} extends ${3:AnotherClass} -{ - ${4} - function ${5:__construct}(${6:argument}) - { - ${7:// code...} - } -} - diff --git a/sources_non_forked/snipmate-snippets/php/def.snippet b/sources_non_forked/snipmate-snippets/php/def.snippet deleted file mode 100644 index df0f5ebd..00000000 --- a/sources_non_forked/snipmate-snippets/php/def.snippet +++ /dev/null @@ -1 +0,0 @@ -define('${1}'${2});${3} diff --git a/sources_non_forked/snipmate-snippets/php/defd.snippet b/sources_non_forked/snipmate-snippets/php/defd.snippet deleted file mode 100644 index 6758cdad..00000000 --- a/sources_non_forked/snipmate-snippets/php/defd.snippet +++ /dev/null @@ -1 +0,0 @@ -${1}defined('${2}')${3} diff --git a/sources_non_forked/snipmate-snippets/php/do.snippet b/sources_non_forked/snipmate-snippets/php/do.snippet deleted file mode 100644 index e7dd5b06..00000000 --- a/sources_non_forked/snipmate-snippets/php/do.snippet +++ /dev/null @@ -1,3 +0,0 @@ -do { - ${2:// code... } -} while (${1:/* condition */});" diff --git a/sources_non_forked/snipmate-snippets/php/doc_cp.snippet b/sources_non_forked/snipmate-snippets/php/doc_cp.snippet deleted file mode 100644 index d6d1b3fc..00000000 --- a/sources_non_forked/snipmate-snippets/php/doc_cp.snippet +++ /dev/null @@ -1,6 +0,0 @@ -/** - * ${1:undocumented class} - * - * @package ${2:default} - * @author ${3:`g:snips_author`} - **/${4} diff --git a/sources_non_forked/snipmate-snippets/php/doc_f.snippet b/sources_non_forked/snipmate-snippets/php/doc_f.snippet deleted file mode 100644 index a9adbb07..00000000 --- a/sources_non_forked/snipmate-snippets/php/doc_f.snippet +++ /dev/null @@ -1,8 +0,0 @@ -/** - * $2 - * @return ${4:void} - * @author ${5:`g:snips_author`} - **/ -${1:public }function ${2:someFunc}(${3}) -{${6} -} diff --git a/sources_non_forked/snipmate-snippets/php/doc_h.snippet b/sources_non_forked/snipmate-snippets/php/doc_h.snippet deleted file mode 100644 index a0c12e01..00000000 --- a/sources_non_forked/snipmate-snippets/php/doc_h.snippet +++ /dev/null @@ -1,10 +0,0 @@ -/** - * ${1} - * - * @author ${2:`g:snips_author`} - * @version ${3:$Id$} - * @copyright ${4:$2}, `strftime('%d %B, %Y')` - * @package ${5:default} - **/ -/** - * Define DocBlock *// diff --git a/sources_non_forked/snipmate-snippets/php/doc_i.snippet b/sources_non_forked/snipmate-snippets/php/doc_i.snippet deleted file mode 100644 index e62eab72..00000000 --- a/sources_non_forked/snipmate-snippets/php/doc_i.snippet +++ /dev/null @@ -1,8 +0,0 @@ -/** - * $1 - * @package ${2:default} - * @author ${3:`g:snips_author`} - **/ -interface ${1:someClass} -{${4} -} // END interface $1" diff --git a/sources_non_forked/snipmate-snippets/php/ec.snippet b/sources_non_forked/snipmate-snippets/php/ec.snippet deleted file mode 100644 index 489d759b..00000000 --- a/sources_non_forked/snipmate-snippets/php/ec.snippet +++ /dev/null @@ -1 +0,0 @@ -echo "${1:string}"${2}; diff --git a/sources_non_forked/snipmate-snippets/php/else.snippet b/sources_non_forked/snipmate-snippets/php/else.snippet deleted file mode 100644 index b910e982..00000000 --- a/sources_non_forked/snipmate-snippets/php/else.snippet +++ /dev/null @@ -1,3 +0,0 @@ -else { - ${1:// code...} -} diff --git a/sources_non_forked/snipmate-snippets/php/elseif.snippet b/sources_non_forked/snipmate-snippets/php/elseif.snippet deleted file mode 100644 index a57dec80..00000000 --- a/sources_non_forked/snipmate-snippets/php/elseif.snippet +++ /dev/null @@ -1,3 +0,0 @@ -elseif (${1:/* condition */}) { - ${2:// code...} -} diff --git a/sources_non_forked/snipmate-snippets/php/for.snippet b/sources_non_forked/snipmate-snippets/php/for.snippet deleted file mode 100644 index e9bc52aa..00000000 --- a/sources_non_forked/snipmate-snippets/php/for.snippet +++ /dev/null @@ -1,3 +0,0 @@ -for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { - ${4:// code...} -} diff --git a/sources_non_forked/snipmate-snippets/php/foreach.snippet b/sources_non_forked/snipmate-snippets/php/foreach.snippet deleted file mode 100644 index 5fe47e5b..00000000 --- a/sources_non_forked/snipmate-snippets/php/foreach.snippet +++ /dev/null @@ -1,3 +0,0 @@ -foreach ($${1:variable} as $${2:key}){ - ${3:// code...} -} diff --git a/sources_non_forked/snipmate-snippets/php/foreachk.snippet b/sources_non_forked/snipmate-snippets/php/foreachk.snippet deleted file mode 100644 index f78d57ae..00000000 --- a/sources_non_forked/snipmate-snippets/php/foreachk.snippet +++ /dev/null @@ -1,3 +0,0 @@ -foreach ($${1:variable} as $${2:key} => $${3:value}){ - ${4:// code...} -} diff --git a/sources_non_forked/snipmate-snippets/php/fun.snippet b/sources_non_forked/snipmate-snippets/php/fun.snippet deleted file mode 100644 index 0f5d3534..00000000 --- a/sources_non_forked/snipmate-snippets/php/fun.snippet +++ /dev/null @@ -1,4 +0,0 @@ -${1:public }function ${2:FunctionName}(${3}) -{ - ${4:// code...} -} diff --git a/sources_non_forked/snipmate-snippets/php/get.snippet b/sources_non_forked/snipmate-snippets/php/get.snippet deleted file mode 100644 index af32e0a5..00000000 --- a/sources_non_forked/snipmate-snippets/php/get.snippet +++ /dev/null @@ -1 +0,0 @@ -$_GET['${1}']${2} diff --git a/sources_non_forked/snipmate-snippets/php/globals.snippet b/sources_non_forked/snipmate-snippets/php/globals.snippet deleted file mode 100644 index 6f5b04f3..00000000 --- a/sources_non_forked/snipmate-snippets/php/globals.snippet +++ /dev/null @@ -1 +0,0 @@ -$GLOBALS['${1:variable}']${2: = }${3:something}${4:;}${5} diff --git a/sources_non_forked/snipmate-snippets/php/if.snippet b/sources_non_forked/snipmate-snippets/php/if.snippet deleted file mode 100644 index 69ac0bd6..00000000 --- a/sources_non_forked/snipmate-snippets/php/if.snippet +++ /dev/null @@ -1,3 +0,0 @@ -if (${1:/* condition */}) { - ${2:// code...} -} diff --git a/sources_non_forked/snipmate-snippets/php/ife.snippet b/sources_non_forked/snipmate-snippets/php/ife.snippet deleted file mode 100644 index b8621c1b..00000000 --- a/sources_non_forked/snipmate-snippets/php/ife.snippet +++ /dev/null @@ -1,4 +0,0 @@ -if (${1:/* condition */}) { - ${2:// code...} -} else { -} diff --git a/sources_non_forked/snipmate-snippets/php/inc.snippet b/sources_non_forked/snipmate-snippets/php/inc.snippet deleted file mode 100644 index 8df3966c..00000000 --- a/sources_non_forked/snipmate-snippets/php/inc.snippet +++ /dev/null @@ -1 +0,0 @@ -include '${1:file}';${2} diff --git a/sources_non_forked/snipmate-snippets/php/inc1.snippet b/sources_non_forked/snipmate-snippets/php/inc1.snippet deleted file mode 100644 index ba262818..00000000 --- a/sources_non_forked/snipmate-snippets/php/inc1.snippet +++ /dev/null @@ -1 +0,0 @@ -include_once '${1:file}';${2} diff --git a/sources_non_forked/snipmate-snippets/php/log.snippet b/sources_non_forked/snipmate-snippets/php/log.snippet deleted file mode 100644 index 2b8dcc4b..00000000 --- a/sources_non_forked/snipmate-snippets/php/log.snippet +++ /dev/null @@ -1 +0,0 @@ -error_log(var_export(${1}, true));${2} diff --git a/sources_non_forked/snipmate-snippets/php/php.snippet b/sources_non_forked/snipmate-snippets/php/php.snippet deleted file mode 100644 index ed2ed1ce..00000000 --- a/sources_non_forked/snipmate-snippets/php/php.snippet +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/php/post.snippet b/sources_non_forked/snipmate-snippets/php/post.snippet deleted file mode 100644 index 2de7aa5f..00000000 --- a/sources_non_forked/snipmate-snippets/php/post.snippet +++ /dev/null @@ -1 +0,0 @@ -$_POST['${1}']${2} diff --git a/sources_non_forked/snipmate-snippets/php/req.snippet b/sources_non_forked/snipmate-snippets/php/req.snippet deleted file mode 100644 index c03ea36f..00000000 --- a/sources_non_forked/snipmate-snippets/php/req.snippet +++ /dev/null @@ -1 +0,0 @@ -require '${1:file}';${2} diff --git a/sources_non_forked/snipmate-snippets/php/req1.snippet b/sources_non_forked/snipmate-snippets/php/req1.snippet deleted file mode 100644 index e909c3bc..00000000 --- a/sources_non_forked/snipmate-snippets/php/req1.snippet +++ /dev/null @@ -1 +0,0 @@ -require_once '${1:file}';${2} diff --git a/sources_non_forked/snipmate-snippets/php/request.snippet b/sources_non_forked/snipmate-snippets/php/request.snippet deleted file mode 100644 index 9a839b1b..00000000 --- a/sources_non_forked/snipmate-snippets/php/request.snippet +++ /dev/null @@ -1 +0,0 @@ -$_REQUEST['${1}']${2} diff --git a/sources_non_forked/snipmate-snippets/php/session.snippet b/sources_non_forked/snipmate-snippets/php/session.snippet deleted file mode 100644 index 5e3e11b9..00000000 --- a/sources_non_forked/snipmate-snippets/php/session.snippet +++ /dev/null @@ -1 +0,0 @@ -$_SESSION['${1}']${2} diff --git a/sources_non_forked/snipmate-snippets/php/switch.snippet b/sources_non_forked/snipmate-snippets/php/switch.snippet deleted file mode 100644 index 7fc47c63..00000000 --- a/sources_non_forked/snipmate-snippets/php/switch.snippet +++ /dev/null @@ -1,9 +0,0 @@ -switch ($${1:variable}) { - case '${2:value}': - ${3:// code...} - break; - ${5} - default: - ${4:// code...} - break; -} diff --git a/sources_non_forked/snipmate-snippets/php/t.snippet b/sources_non_forked/snipmate-snippets/php/t.snippet deleted file mode 100644 index e8deae52..00000000 --- a/sources_non_forked/snipmate-snippets/php/t.snippet +++ /dev/null @@ -1 +0,0 @@ -$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5} diff --git a/sources_non_forked/snipmate-snippets/php/try.snippet b/sources_non_forked/snipmate-snippets/php/try.snippet deleted file mode 100644 index 66a7f651..00000000 --- a/sources_non_forked/snipmate-snippets/php/try.snippet +++ /dev/null @@ -1,6 +0,0 @@ -try { - ${1:// code...} -} catch (${2:Exception} $e) { - ${3:// code...} -} - diff --git a/sources_non_forked/snipmate-snippets/php/var.snippet b/sources_non_forked/snipmate-snippets/php/var.snippet deleted file mode 100644 index 1f8cd08e..00000000 --- a/sources_non_forked/snipmate-snippets/php/var.snippet +++ /dev/null @@ -1 +0,0 @@ -var_export(${1});${2} diff --git a/sources_non_forked/snipmate-snippets/php/wh.snippet b/sources_non_forked/snipmate-snippets/php/wh.snippet deleted file mode 100644 index 36ae0ffc..00000000 --- a/sources_non_forked/snipmate-snippets/php/wh.snippet +++ /dev/null @@ -1,3 +0,0 @@ -while (${1:/* condition */}) { - ${2:// code...} -} diff --git a/sources_non_forked/snipmate-snippets/po/msg.snippet b/sources_non_forked/snipmate-snippets/po/msg.snippet deleted file mode 100644 index 2ad6638a..00000000 --- a/sources_non_forked/snipmate-snippets/po/msg.snippet +++ /dev/null @@ -1,2 +0,0 @@ -msgid "${1}" -msgstr "${2}"${3} diff --git a/sources_non_forked/snipmate-snippets/python/class.snippet b/sources_non_forked/snipmate-snippets/python/class.snippet deleted file mode 100644 index d9e2b8e8..00000000 --- a/sources_non_forked/snipmate-snippets/python/class.snippet +++ /dev/null @@ -1,2 +0,0 @@ -class ${1:``Snippet_PythonClassNameFromFilename()``}(${2:data}): -${3} diff --git a/sources_non_forked/snipmate-snippets/python/def.snippet b/sources_non_forked/snipmate-snippets/python/def.snippet deleted file mode 100644 index c7cc9d38..00000000 --- a/sources_non_forked/snipmate-snippets/python/def.snippet +++ /dev/null @@ -1,2 +0,0 @@ -def ${1:name}(${2:data}): -${3} diff --git a/sources_non_forked/snipmate-snippets/python/for.snippet b/sources_non_forked/snipmate-snippets/python/for.snippet deleted file mode 100644 index fb69c05f..00000000 --- a/sources_non_forked/snipmate-snippets/python/for.snippet +++ /dev/null @@ -1,3 +0,0 @@ -for ${1:var} in ${2:type}: -${3:pass} -${4} diff --git a/sources_non_forked/snipmate-snippets/python/from.snippet b/sources_non_forked/snipmate-snippets/python/from.snippet deleted file mode 100644 index 98d0d825..00000000 --- a/sources_non_forked/snipmate-snippets/python/from.snippet +++ /dev/null @@ -1,2 +0,0 @@ -from ${1:module} import ${2:name} -${3} diff --git a/sources_non_forked/snipmate-snippets/python/get.snippet b/sources_non_forked/snipmate-snippets/python/get.snippet deleted file mode 100644 index bc0bf63d..00000000 --- a/sources_non_forked/snipmate-snippets/python/get.snippet +++ /dev/null @@ -1,3 +0,0 @@ -def get_${1:name}(self): -return self._$1 -${2} diff --git a/sources_non_forked/snipmate-snippets/python/ifmain.snippet b/sources_non_forked/snipmate-snippets/python/ifmain.snippet deleted file mode 100644 index f6e7a262..00000000 --- a/sources_non_forked/snipmate-snippets/python/ifmain.snippet +++ /dev/null @@ -1,2 +0,0 @@ -if __name__ == '__main__': -${1} diff --git a/sources_non_forked/snipmate-snippets/python/import.snippet b/sources_non_forked/snipmate-snippets/python/import.snippet deleted file mode 100644 index 58c9acdc..00000000 --- a/sources_non_forked/snipmate-snippets/python/import.snippet +++ /dev/null @@ -1,2 +0,0 @@ -import ${1:module} -${2} diff --git a/sources_non_forked/snipmate-snippets/python/init.snippet b/sources_non_forked/snipmate-snippets/python/init.snippet deleted file mode 100644 index c1a4f0fa..00000000 --- a/sources_non_forked/snipmate-snippets/python/init.snippet +++ /dev/null @@ -1,2 +0,0 @@ -def __init__(self, ${1:args}): -${2} diff --git a/sources_non_forked/snipmate-snippets/python/set.snippet b/sources_non_forked/snipmate-snippets/python/set.snippet deleted file mode 100644 index 6ab0b5aa..00000000 --- a/sources_non_forked/snipmate-snippets/python/set.snippet +++ /dev/null @@ -1 +0,0 @@ -def set_${1:name}(self, ${2:value}): diff --git a/sources_non_forked/snipmate-snippets/python/try.snippet b/sources_non_forked/snipmate-snippets/python/try.snippet deleted file mode 100644 index fd5f6e59..00000000 --- a/sources_non_forked/snipmate-snippets/python/try.snippet +++ /dev/null @@ -1,4 +0,0 @@ -try: -${1} -except ${2:Exception} -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-factorygirl/fac.snippet b/sources_non_forked/snipmate-snippets/ruby-factorygirl/fac.snippet deleted file mode 100644 index 05cc3e8e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-factorygirl/fac.snippet +++ /dev/null @@ -1 +0,0 @@ -Factory(:${1}, ${2})${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facb.snippet b/sources_non_forked/snipmate-snippets/ruby-factorygirl/facb.snippet deleted file mode 100644 index 299c0335..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facb.snippet +++ /dev/null @@ -1 +0,0 @@ -Factory.build(:${1}, ${2})${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facd.snippet b/sources_non_forked/snipmate-snippets/ruby-factorygirl/facd.snippet deleted file mode 100644 index 41d1503c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facd.snippet +++ /dev/null @@ -1,4 +0,0 @@ -Factory.define(:${1:model}) do |${2:f}| - ${3} -end -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facn.snippet b/sources_non_forked/snipmate-snippets/ruby-factorygirl/facn.snippet deleted file mode 100644 index 7232308c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facn.snippet +++ /dev/null @@ -1 +0,0 @@ -Factory.next(:${1:sequence-name})${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facs.snippet b/sources_non_forked/snipmate-snippets/ruby-factorygirl/facs.snippet deleted file mode 100644 index 13fd5b9d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-factorygirl/facs.snippet +++ /dev/null @@ -1,4 +0,0 @@ -Factory.sequence :${1:sequence-name} do |${2:m}| - ${3} -end -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/art.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/art.snippet deleted file mode 100644 index a5a7d34e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/art.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_redirected_to ${1::action => "${2:index}"} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/artnp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/artnp.snippet deleted file mode 100644 index 2c9bfef0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/artnp.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_redirected_to <+<+parent+>_<+child+>_path(<+@<+parent+>+>, <+@<+child+>+>)+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/artnpp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/artnpp.snippet deleted file mode 100644 index becd79b5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/artnpp.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_redirected_to <+<+parent+>_<+child+>_path(<+@<+parent+>+>)+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/artp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/artp.snippet deleted file mode 100644 index 55b9204a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/artp.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_redirected_to <+<+model+>_path(<+@<+model+>+>)+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/artpp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/artpp.snippet deleted file mode 100644 index 1d1d203d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/artpp.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_redirected_to <+<+model+>s_path+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/asd.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/asd.snippet deleted file mode 100644 index 35ab7301..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/asd.snippet +++ /dev/null @@ -1,3 +0,0 @@ -assert_difference "${1:Model}.${2:count}", $1 do - ${3} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/asnd.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/asnd.snippet deleted file mode 100644 index c5124e04..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/asnd.snippet +++ /dev/null @@ -1,3 +0,0 @@ -assert_no_difference "${1:Model}.${2:count}" do - ${3} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/asre.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/asre.snippet deleted file mode 100644 index d0ac6b26..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/asre.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_response :${1:success}, @response.body${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/asrj.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/asrj.snippet deleted file mode 100644 index 6ee13f2d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/asrj.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_rjs :<+replace+>, <+"<+dom id+>"+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ass.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ass.snippet deleted file mode 100644 index 4cc696f6..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ass.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_select '<+path+>'<+, :<+text+> => <+'<+inner_html+>'+>+> <+do<++>+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/bf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/bf.snippet deleted file mode 100644 index ad25cc90..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/bf.snippet +++ /dev/null @@ -1 +0,0 @@ -before_filter :${1:method} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/bt.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/bt.snippet deleted file mode 100644 index b28e1e62..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/bt.snippet +++ /dev/null @@ -1 +0,0 @@ -belongs_to :${1:association} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/crw.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/crw.snippet deleted file mode 100644 index 3b1ab619..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/crw.snippet +++ /dev/null @@ -1 +0,0 @@ -cattr_accessor :${1:attr_names} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defcreate.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defcreate.snippet deleted file mode 100644 index e878d3a6..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/defcreate.snippet +++ /dev/null @@ -1,14 +0,0 @@ -def create - @${1:model_class_name} = ${2:ModelClassName}.new(params[:$1]) - - respond_to do |wants| - if @$1.save - flash[:notice] = '$2 was successfully created.' - wants.html { redirect_to(@$1) } - wants.xml { render :xml => @$1, :status => :created, :location => @$1 } - else - wants.html { render :action => "new" } - wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity } - end - end -end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defdestroy.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defdestroy.snippet deleted file mode 100644 index 9c340808..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/defdestroy.snippet +++ /dev/null @@ -1,9 +0,0 @@ -def destroy - @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) - @$1.destroy - - respond_to do |wants| - wants.html { redirect_to($1s_url) } - wants.xml { head :ok } - end -end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defedit.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defedit.snippet deleted file mode 100644 index 0e80dcb8..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/defedit.snippet +++ /dev/null @@ -1,3 +0,0 @@ -def edit - @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defindex.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defindex.snippet deleted file mode 100644 index aa776f9a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/defindex.snippet +++ /dev/null @@ -1,8 +0,0 @@ -def index - @${1:model_class_name} = ${2:ModelClassName}.all - - respond_to do |wants| - wants.html # index.html.erb - wants.xml { render :xml => @$1s } - end -end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defnew.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defnew.snippet deleted file mode 100644 index 0a4762b9..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/defnew.snippet +++ /dev/null @@ -1,8 +0,0 @@ -def new - @${1:model_class_name} = ${2:ModelClassName}.new - - respond_to do |wants| - wants.html # new.html.erb - wants.xml { render :xml => @$1 } - end -end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defshow.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defshow.snippet deleted file mode 100644 index ba745d52..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/defshow.snippet +++ /dev/null @@ -1,8 +0,0 @@ -def show - @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) - - respond_to do |wants| - wants.html # show.html.erb - wants.xml { render :xml => @$1 } - end -end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/defupdate.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/defupdate.snippet deleted file mode 100644 index 0556895c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/defupdate.snippet +++ /dev/null @@ -1,14 +0,0 @@ -def update - @${1:model_class_name} = ${2:ModelClassName}.find(params[:id]) - - respond_to do |wants| - if @$1.update_attributes(params[:$1]) - flash[:notice] = '$2 was successfully updated.' - wants.html { redirect_to(@$1) } - wants.xml { head :ok } - else - wants.html { render :action => "edit" } - wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity } - end - end -end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/fina.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/fina.snippet deleted file mode 100644 index af5ec413..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/fina.snippet +++ /dev/null @@ -1 +0,0 @@ -find(:all<+, :conditions => ['<+<+field+> = ?+>', <+true+>]+>) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/finf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/finf.snippet deleted file mode 100644 index 24ba2da3..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/finf.snippet +++ /dev/null @@ -1 +0,0 @@ -find(:first<+, :conditions => ['<+<+field+> = ?+>', <+true+>]+>) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/fini.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/fini.snippet deleted file mode 100644 index 96d68a5f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/fini.snippet +++ /dev/null @@ -1 +0,0 @@ -find(<+id+>) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/finl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/finl.snippet deleted file mode 100644 index 7ee6efec..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/finl.snippet +++ /dev/null @@ -1 +0,0 @@ -find(:last<+, :conditions => ['<+<+field+> = ?+>', <+true+>]+>) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/flash.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/flash.snippet deleted file mode 100644 index 2a069307..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/flash.snippet +++ /dev/null @@ -1 +0,0 @@ -flash[:${1:notice}] = "${2}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/habtm.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/habtm.snippet deleted file mode 100644 index 1b27396a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/habtm.snippet +++ /dev/null @@ -1 +0,0 @@ -has_and_belongs_to_many :${1:object}, :join_table => "${2:table_name}", :foreign_key => "${3}_id"${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/hm.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/hm.snippet deleted file mode 100644 index 9204df56..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/hm.snippet +++ /dev/null @@ -1 +0,0 @@ -has_many :${1:object} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/hmd.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/hmd.snippet deleted file mode 100644 index 6aadd73b..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/hmd.snippet +++ /dev/null @@ -1 +0,0 @@ -has_many :<+object+>s<+, :class_name => "<+object+>", :foreign_key => "<+reference+>_id"+>, :dependent => :destroy<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/hmt.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/hmt.snippet deleted file mode 100644 index 4128e037..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/hmt.snippet +++ /dev/null @@ -1 +0,0 @@ -has_many :${1:object}, :through => :${2:object} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ho.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ho.snippet deleted file mode 100644 index 77e14e7a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ho.snippet +++ /dev/null @@ -1 +0,0 @@ -has_one :${1:object} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/i18.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/i18.snippet deleted file mode 100644 index 2a30fae0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/i18.snippet +++ /dev/null @@ -1 +0,0 @@ -I18n.t('${1:type.key}')${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ist.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ist.snippet deleted file mode 100644 index d97d4829..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ist.snippet +++ /dev/null @@ -1 +0,0 @@ -<%= image_submit_tag("<+agree.png+>"<+<+, :id => "<+id+>"+><+, :name => "<+name+>"+><+, :class => "<+class+>"+><+, :disabled => <+false+>+>+>) %> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/log.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/log.snippet deleted file mode 100644 index 53360dd5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/log.snippet +++ /dev/null @@ -1 +0,0 @@ -RAILS_DEFAULT_LOGGER.${1:debug} ${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/logd.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/logd.snippet deleted file mode 100644 index 36236a31..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/logd.snippet +++ /dev/null @@ -1 +0,0 @@ -logger.debug { "${1:message}" }${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/loge.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/loge.snippet deleted file mode 100644 index 4417ad2e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/loge.snippet +++ /dev/null @@ -1 +0,0 @@ -logger.error { "${1:message}" }${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/logf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/logf.snippet deleted file mode 100644 index 1bd419c8..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/logf.snippet +++ /dev/null @@ -1 +0,0 @@ -logger.fatal { "${1:message}" }${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/logi.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/logi.snippet deleted file mode 100644 index bf508dc1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/logi.snippet +++ /dev/null @@ -1 +0,0 @@ -logger.info { "${1:message}" }${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/logw.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/logw.snippet deleted file mode 100644 index 447f6886..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/logw.snippet +++ /dev/null @@ -1 +0,0 @@ -logger.warn { "${1:message}" }${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mac.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mac.snippet deleted file mode 100644 index 548d4af0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mac.snippet +++ /dev/null @@ -1 +0,0 @@ -add_column :${1:table}, :${2:column}, :${3:type} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mapc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mapc.snippet deleted file mode 100644 index b14ec4ca..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mapc.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:map}.${2:connect} '${3:controller/:action/:id}' diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mapca.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mapca.snippet deleted file mode 100644 index 9292ffe9..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mapca.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:map}.catch_all "*${2:anything}", :controller => "${3:default}", :action => "${4:error}"${5} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mapr.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mapr.snippet deleted file mode 100644 index 424805b7..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mapr.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:map}.resource :${2:resource} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/maprs.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/maprs.snippet deleted file mode 100644 index a18c4df3..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/maprs.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:map}.resources :${2:resource} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mapwo.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mapwo.snippet deleted file mode 100644 index b3cf7911..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mapwo.snippet +++ /dev/null @@ -1,3 +0,0 @@ -${1:map}.with_options :${2:controller} => '${3:thing}' do |$3| - ${4} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mbs.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mbs.snippet deleted file mode 100644 index a3b34bb3..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mbs.snippet +++ /dev/null @@ -1 +0,0 @@ -before_save :${1:method} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mcc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mcc.snippet deleted file mode 100644 index 74dc7af0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mcc.snippet +++ /dev/null @@ -1 +0,0 @@ -change_column :${1:table}, :${2:column}, :${3:type} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mccc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mccc.snippet deleted file mode 100644 index 2915a37f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mccc.snippet +++ /dev/null @@ -1 +0,0 @@ -t.column :${1:title}, :${2:string} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mcht.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mcht.snippet deleted file mode 100644 index a71b4731..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mcht.snippet +++ /dev/null @@ -1,3 +0,0 @@ -change_table :${1:table_name} do |t| - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mcol.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mcol.snippet deleted file mode 100644 index 8a5bd1ff..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mcol.snippet +++ /dev/null @@ -1 +0,0 @@ -remove_column :${1:table}, :${2:column} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mct.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mct.snippet deleted file mode 100644 index 8dbe1eab..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mct.snippet +++ /dev/null @@ -1,3 +0,0 @@ -create_table :${1:table_name} do |t| - t.column :${2:name}, :${3:type} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/migration.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/migration.snippet deleted file mode 100644 index 9f54e0b9..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/migration.snippet +++ /dev/null @@ -1,8 +0,0 @@ -class ${1:`Snippet_MigrationNameFromFilename()`} < ActiveRecord::Migration - def self.up - ${2} - end - - def self.down - end -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mp.snippet deleted file mode 100644 index 1264a595..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mp.snippet +++ /dev/null @@ -1 +0,0 @@ -map(&:${1:id}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mrc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mrc.snippet deleted file mode 100644 index aaeba258..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mrc.snippet +++ /dev/null @@ -1 +0,0 @@ -remove_column :${1:column} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mrmc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mrmc.snippet deleted file mode 100644 index 8a5bd1ff..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mrmc.snippet +++ /dev/null @@ -1 +0,0 @@ -remove_column :${1:table}, :${2:column} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mrnc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mrnc.snippet deleted file mode 100644 index 6e167210..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mrnc.snippet +++ /dev/null @@ -1 +0,0 @@ -rename_column :${1:table}, :${2:old}, :${3:new} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/mrw.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/mrw.snippet deleted file mode 100644 index 9ef0f8fe..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/mrw.snippet +++ /dev/null @@ -1 +0,0 @@ -mattr_accessor :${1:attr_names} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/nc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/nc.snippet deleted file mode 100644 index cfc42ca4..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/nc.snippet +++ /dev/null @@ -1 +0,0 @@ -named_scope :<+name+><+, :joins => :<+table+>+>, :conditions => <+['<+<+field+> = ?+>', <+true+>]+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ncl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ncl.snippet deleted file mode 100644 index c420ef2f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ncl.snippet +++ /dev/null @@ -1 +0,0 @@ -named_scope :<+name+>, lambda { |<+param+>| { :conditions => <+['<+<+field+> = ?+>', <+param+>]+> } } diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/pa.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/pa.snippet deleted file mode 100644 index 14fa54fb..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/pa.snippet +++ /dev/null @@ -1 +0,0 @@ -params[:${1:id}]${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ra.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ra.snippet deleted file mode 100644 index 56a9bbf6..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ra.snippet +++ /dev/null @@ -1 +0,0 @@ -render :action => "${1:action}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ral.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ral.snippet deleted file mode 100644 index 0a0b202d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ral.snippet +++ /dev/null @@ -1 +0,0 @@ -render :action => "${1:action}", :layout => "${2:layoutname}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rest.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rest.snippet deleted file mode 100644 index 7938f9d6..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rest.snippet +++ /dev/null @@ -1,3 +0,0 @@ -respond_to do |wants| - wants.${1:html} <+{ <++> }+> -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rf.snippet deleted file mode 100644 index 76fcdb1d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rf.snippet +++ /dev/null @@ -1 +0,0 @@ -render :file => "${1:filepath}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rfu.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rfu.snippet deleted file mode 100644 index c0bb72bf..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rfu.snippet +++ /dev/null @@ -1 +0,0 @@ -render :file => "${1:filepath}", :use_full_path => ${2:false} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ri.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ri.snippet deleted file mode 100644 index 17a04048..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ri.snippet +++ /dev/null @@ -1 +0,0 @@ -render :inline => "<+<%= 'hello' %>+>" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ril.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ril.snippet deleted file mode 100644 index b1801aa4..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ril.snippet +++ /dev/null @@ -1 +0,0 @@ -render :inline => "${1:<%= 'hello' %>}", :locals => { ${2::name} => "${3:value}"${4} } diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rit.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rit.snippet deleted file mode 100644 index b3cd8343..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rit.snippet +++ /dev/null @@ -1 +0,0 @@ -render :inline => "${1:<%= 'hello' %>}", :type => ${2::rxml} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rjson.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rjson.snippet deleted file mode 100644 index fece1fcc..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rjson.snippet +++ /dev/null @@ -1 +0,0 @@ -render :json => ${1:text to render} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rl.snippet deleted file mode 100644 index 53e8340a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rl.snippet +++ /dev/null @@ -1 +0,0 @@ -render :layout => "${1:layoutname}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rn.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rn.snippet deleted file mode 100644 index 6c6b0fec..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rn.snippet +++ /dev/null @@ -1 +0,0 @@ -render :nothing => ${1:true} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rns.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rns.snippet deleted file mode 100644 index d1a581f8..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rns.snippet +++ /dev/null @@ -1 +0,0 @@ -render :nothing => ${1:true}, :status => ${2:401} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rp.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rp.snippet deleted file mode 100644 index 0c5daa25..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rp.snippet +++ /dev/null @@ -1 +0,0 @@ -render :partial => "${1:item}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rpc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rpc.snippet deleted file mode 100644 index 570644b5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rpc.snippet +++ /dev/null @@ -1 +0,0 @@ -render :partial => "<+item+>", :collection => <+@<+item+>s+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rpl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rpl.snippet deleted file mode 100644 index 6981fbc3..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rpl.snippet +++ /dev/null @@ -1 +0,0 @@ -render :partial => "<+item+>", :locals => { :<+item+> => <+@<+item+>+><++> } diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rpo.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rpo.snippet deleted file mode 100644 index bab9da96..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rpo.snippet +++ /dev/null @@ -1 +0,0 @@ -render :partial => "<+item+>", :object => <+@<+item+>+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rps.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rps.snippet deleted file mode 100644 index aef4c494..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rps.snippet +++ /dev/null @@ -1 +0,0 @@ -render :partial => "${1:item}", :status => ${2:500} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rt.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rt.snippet deleted file mode 100644 index c464879c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rt.snippet +++ /dev/null @@ -1 +0,0 @@ -render :text => "${1:text to render}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rtl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rtl.snippet deleted file mode 100644 index fc78bf14..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rtl.snippet +++ /dev/null @@ -1 +0,0 @@ -render :text => "${1:text to render}", :layout => "${2:layoutname}" diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rtlt.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rtlt.snippet deleted file mode 100644 index 69618be0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rtlt.snippet +++ /dev/null @@ -1 +0,0 @@ -render :text => "${1:text to render}", :layout => ${2:true} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rts.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rts.snippet deleted file mode 100644 index 04fe409d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rts.snippet +++ /dev/null @@ -1 +0,0 @@ -render :text => "${1:text to render}", :status => ${2:401} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ru.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ru.snippet deleted file mode 100644 index 3a2d1ed0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ru.snippet +++ /dev/null @@ -1,3 +0,0 @@ -render :update do |${1:page}| - $1.${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/rxml.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/rxml.snippet deleted file mode 100644 index e4e721a0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/rxml.snippet +++ /dev/null @@ -1 +0,0 @@ -render :xml => ${1:text to render} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/sha1.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/sha1.snippet deleted file mode 100644 index 19847471..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/sha1.snippet +++ /dev/null @@ -1 +0,0 @@ -Digest::SHA1.hexdigest(${1:string}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/sweeper.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/sweeper.snippet deleted file mode 100644 index 659aeb0d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/sweeper.snippet +++ /dev/null @@ -1,15 +0,0 @@ -class ${1:ModelClassName}Sweeper < ActionController::Caching::Sweeper - observe $1 - - def after_save(${2:model_class_name}) - expire_cache($2) - end - - def after_destroy($2) - expire_cache($2) - end - - def expire_cache($2) - expire_page - end -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcb.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcb.snippet deleted file mode 100644 index 021740df..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcb.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.boolean :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcbi.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcbi.snippet deleted file mode 100644 index 3e6d3c9c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcbi.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.binary :<+title+><+, :limit => <+2+>.megabytes+> -<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcd.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcd.snippet deleted file mode 100644 index 0932f2c1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcd.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.decimal :<+title+><+<+, :precision => <+10+>+><+, :scale => <+2+>+>+> -<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcda.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcda.snippet deleted file mode 100644 index b716e8b0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcda.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.date :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcdt.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcdt.snippet deleted file mode 100644 index d060532e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcdt.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.datetime :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcf.snippet deleted file mode 100644 index f09f7904..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcf.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.float :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tch.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tch.snippet deleted file mode 100644 index bcce7271..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tch.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.change :<+name+><+, :<+string+><+, :<+limit+> => <+80+>+>+> -<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tci.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tci.snippet deleted file mode 100644 index 7cb011ca..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tci.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.integer :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcl.snippet deleted file mode 100644 index ffa359f5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcl.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.integer :lock_version, :null => false, :default => 0 -${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcr.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcr.snippet deleted file mode 100644 index 2b421dd7..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcr.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.references :<+taggable+><+, :polymorphic => <+{ :default => '<+Photo+>' }+>+> -<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcs.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcs.snippet deleted file mode 100644 index a7b8473b..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcs.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.string :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tct.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tct.snippet deleted file mode 100644 index f28518f4..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tct.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.text :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcti.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcti.snippet deleted file mode 100644 index 0006c819..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcti.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.time :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tcts.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tcts.snippet deleted file mode 100644 index e46e844c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tcts.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.timestamp :${1:title} -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tctss.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tctss.snippet deleted file mode 100644 index f009ee62..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tctss.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.timestamps -${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/trc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/trc.snippet deleted file mode 100644 index 2d6250ab..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/trc.snippet +++ /dev/null @@ -1 +0,0 @@ -t.remove :${1:column} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tre.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tre.snippet deleted file mode 100644 index 8f70788c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tre.snippet +++ /dev/null @@ -1,2 +0,0 @@ -t.rename :<+old_column_name+>, :<+new_column_name+> -<++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/tref.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/tref.snippet deleted file mode 100644 index 12867868..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/tref.snippet +++ /dev/null @@ -1 +0,0 @@ -t.references :${1:model} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/va.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/va.snippet deleted file mode 100644 index 064bb7b2..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/va.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_associated :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vao.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vao.snippet deleted file mode 100644 index 4c6c98b6..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/vao.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_acceptance_of :${1:terms} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vc.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vc.snippet deleted file mode 100644 index 0aa1a75d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/vc.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_confirmation_of :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/ve.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/ve.snippet deleted file mode 100644 index b6a4c4d5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/ve.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_exclusion_of :${1:attribute}, :in => ${2:%w( mov avi )} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vf.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vf.snippet deleted file mode 100644 index adc142c7..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/vf.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_format_of :${1:attribute}, :with => /${2:regex}/ diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vi.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vi.snippet deleted file mode 100644 index 8ba16d2e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/vi.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_inclusion_of :${1:attribute}, :in => %w(${2: mov avi }) diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vl.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vl.snippet deleted file mode 100644 index 71d802bd..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/vl.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_length_of :${1:attribute}, :within => ${2:3}..${3:20} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vn.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vn.snippet deleted file mode 100644 index 34bfaa72..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/vn.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_numericality_of :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vpo.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vpo.snippet deleted file mode 100644 index c8fdff9c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/vpo.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_presence_of :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/vu.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/vu.snippet deleted file mode 100644 index 0c06e655..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/vu.snippet +++ /dev/null @@ -1 +0,0 @@ -validates_uniqueness_of :${1:attribute} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/wants.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/wants.snippet deleted file mode 100644 index 909c8d59..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/wants.snippet +++ /dev/null @@ -1 +0,0 @@ -wants.<+js|xml|html+> <+{ <++> }+> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/xdelete.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/xdelete.snippet deleted file mode 100644 index 41184e9e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/xdelete.snippet +++ /dev/null @@ -1 +0,0 @@ -xhr :delete, :${1:destroy}, :id => ${2:1}${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/xget.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/xget.snippet deleted file mode 100644 index 1ae7834e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/xget.snippet +++ /dev/null @@ -1 +0,0 @@ -xhr :get, :<+show+><+, :id => <+1+>+><++> diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/xpost.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/xpost.snippet deleted file mode 100644 index 3681a95f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/xpost.snippet +++ /dev/null @@ -1 +0,0 @@ -xhr :post, :${1:create}, :${2:object} => { ${3} } diff --git a/sources_non_forked/snipmate-snippets/ruby-rails/xput.snippet b/sources_non_forked/snipmate-snippets/ruby-rails/xput.snippet deleted file mode 100644 index f046f2ea..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rails/xput.snippet +++ /dev/null @@ -1 +0,0 @@ -xhr :put, :${1:update}, :id => ${2:1}, :${3:object} => { ${4} }${5} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/aft.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/aft.snippet deleted file mode 100644 index 528f1b30..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/aft.snippet +++ /dev/null @@ -1,3 +0,0 @@ -after(${1::each}) do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/annot.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/annot.snippet deleted file mode 100644 index 7199170c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/annot.snippet +++ /dev/null @@ -1 +0,0 @@ -any_number_of_times diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/anr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/anr.snippet deleted file mode 100644 index 573addd5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/anr.snippet +++ /dev/null @@ -1 +0,0 @@ -and_return(${1:value}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/anra.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/anra.snippet deleted file mode 100644 index ab03deb4..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/anra.snippet +++ /dev/null @@ -1 +0,0 @@ -and_raise(${1:exception}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/anrb.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/anrb.snippet deleted file mode 100644 index e313a512..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/anrb.snippet +++ /dev/null @@ -1 +0,0 @@ -and_return { ${1} } diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/ant.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/ant.snippet deleted file mode 100644 index d230e92c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/ant.snippet +++ /dev/null @@ -1 +0,0 @@ -and_throw(${1:sym}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/any.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/any.snippet deleted file mode 100644 index 34c08d69..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/any.snippet +++ /dev/null @@ -1 +0,0 @@ -and_yield(${1:values}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/atl.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/atl.snippet deleted file mode 100644 index b95128bb..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/atl.snippet +++ /dev/null @@ -1 +0,0 @@ -at_least(${1:n}).times diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/atm.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/atm.snippet deleted file mode 100644 index fa5c6060..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/atm.snippet +++ /dev/null @@ -1 +0,0 @@ -at_most(${1:n}).times diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/bef.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/bef.snippet deleted file mode 100644 index f96608c5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/bef.snippet +++ /dev/null @@ -1,3 +0,0 @@ -before(${1::each}) do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/conn.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/conn.snippet deleted file mode 100644 index 4bd9d239..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/conn.snippet +++ /dev/null @@ -1 +0,0 @@ -controller_name :${1:controller} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/des.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/des.snippet deleted file mode 100644 index 44c75845..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/des.snippet +++ /dev/null @@ -1,3 +0,0 @@ -describe "${1:subject}" do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/desc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/desc.snippet deleted file mode 100644 index 6311aa1d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/desc.snippet +++ /dev/null @@ -1,5 +0,0 @@ -require 'spec_helper' - -describe ${1:`Snippet_RubyClassNameFromFilename()`} do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/desrc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/desrc.snippet deleted file mode 100644 index a9c8ac2b..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/desrc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -describe ${1:controller}, "${2:GET|POST|PUT|DELETE} ${3:/some/path}${4}" do - ${5} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/dest.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/dest.snippet deleted file mode 100644 index b3b3e01a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/dest.snippet +++ /dev/null @@ -1,3 +0,0 @@ -describe ${1:Type} do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/dests.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/dests.snippet deleted file mode 100644 index 89e9372c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/dests.snippet +++ /dev/null @@ -1,3 +0,0 @@ -describe ${1:Type}, "${2:description}" do - ${3} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/ex.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/ex.snippet deleted file mode 100644 index 2e5a4a01..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/ex.snippet +++ /dev/null @@ -1 +0,0 @@ -exactly(${1:n}).times diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/isbl.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/isbl.snippet deleted file mode 100644 index 728223f0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/isbl.snippet +++ /dev/null @@ -1 +0,0 @@ -it_should_behave_like '${1:do something}' diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/it.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/it.snippet deleted file mode 100644 index 8af38db4..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/it.snippet +++ /dev/null @@ -1,3 +0,0 @@ -it "${1}" do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/its.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/its.snippet deleted file mode 100644 index 963f4041..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/its.snippet +++ /dev/null @@ -1 +0,0 @@ -it "should ${1:do something}" do${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/mat.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/mat.snippet deleted file mode 100644 index 2f047710..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/mat.snippet +++ /dev/null @@ -1,24 +0,0 @@ -class ${1:ReverseTo} - def initialize(${2:param}) - @$2 = $2 - end - - def matches?(actual) - @actual = actual - # Satisfy expectation here. Return false or raise an error if it's not met. - ${3:@actual.reverse.should == @$2} - true - end - - def failure_message - "expected #{@actual.inspect} to ${4} #{@$2.inspect}, but it didn't" - end - - def negative_failure_message - "expected #{@actual.inspect} not to ${5} #{@$2.inspect}, but it did" - end -end - -def ${6:reverse_to}(${7:expected}) - ${8}.new($7) -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/mm.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/mm.snippet deleted file mode 100644 index b10aa1d5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/mm.snippet +++ /dev/null @@ -1 +0,0 @@ -mock_model(${1:model})${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/moc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/moc.snippet deleted file mode 100644 index 4ff954f1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/moc.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:var} = mock("${2:mock_name}"${3:, :null_object => true}) -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/mocw.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/mocw.snippet deleted file mode 100644 index 09f93e07..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/mocw.snippet +++ /dev/null @@ -1,3 +0,0 @@ -Spec::Runner.configure do |config| - config.mock_with :${1:mocha|flexmock|rr} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/on.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/on.snippet deleted file mode 100644 index b2d1a776..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/on.snippet +++ /dev/null @@ -1 +0,0 @@ -once diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/resh.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/resh.snippet deleted file mode 100644 index 91cd5b06..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/resh.snippet +++ /dev/null @@ -1 +0,0 @@ -require File.dirname(__FILE__) + '/../spec_helper' diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/sef.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/sef.snippet deleted file mode 100644 index 89d34116..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/sef.snippet +++ /dev/null @@ -1,3 +0,0 @@ -shared_examples_for "${1:do something}" do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/sh.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/sh.snippet deleted file mode 100644 index 67530e9d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/sh.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should == ${2:value} -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shb.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shb.snippet deleted file mode 100644 index b909d9c0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shb.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should be(${2:result}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shbc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shbc.snippet deleted file mode 100644 index 9080a3c2..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shbc.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should be_close(${2:result}, ${3:tolerance}) -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shbio.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shbio.snippet deleted file mode 100644 index 98a73893..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shbio.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should be_instance_of(${2:class}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shbko.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shbko.snippet deleted file mode 100644 index 74bf8520..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shbko.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should be_a_kind_of(${2:class}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shbr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shbr.snippet deleted file mode 100644 index 887ef800..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shbr.snippet +++ /dev/null @@ -1,2 +0,0 @@ -response.should be_redirect -${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shbs.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shbs.snippet deleted file mode 100644 index 602074b5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shbs.snippet +++ /dev/null @@ -1,2 +0,0 @@ -response.should be_success -${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shc.snippet deleted file mode 100644 index 16206fa1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -lambda do - ${1} -end.should change(${2:target}, :${3:method}).from(${4:old_value}).to(${5:new_value}).by(${6:change}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shdm.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shdm.snippet deleted file mode 100644 index e82d82e7..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shdm.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should match(/${2:regexp}/) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/she.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/she.snippet deleted file mode 100644 index f896a26e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/she.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should eql(${2:value}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/sheq.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/sheq.snippet deleted file mode 100644 index e3c389e6..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/sheq.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should equal(${2:value}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shh.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shh.snippet deleted file mode 100644 index 93189cb8..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shh.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should have(${2:num}).${3:things} -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shhal.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shhal.snippet deleted file mode 100644 index dabe237a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shhal.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should have_at_least(${2:num}).${3:things} -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shham.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shham.snippet deleted file mode 100644 index 7072add1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shham.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should have_at_most(${2:num}).${3:things} -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shhr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shhr.snippet deleted file mode 100644 index b8a8997f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shhr.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should have(${2:n}).records -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shn.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shn.snippet deleted file mode 100644 index b19cbb67..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shn.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not == ${2:value} -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnb.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnb.snippet deleted file mode 100644 index a34d62e5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnb.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not be(${2:result}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbc.snippet deleted file mode 100644 index 55ac6d3a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbc.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not be_close(${2:result}, ${3:tolerance}) -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbio.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbio.snippet deleted file mode 100644 index b6f15267..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbio.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not be_instance_of(${2:klass}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbko.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbko.snippet deleted file mode 100644 index 0b0cfc7f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbko.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not be_a_kind_of(${2:klass}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbr.snippet deleted file mode 100644 index 25519b08..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbr.snippet +++ /dev/null @@ -1,2 +0,0 @@ -response.should_not be_redirect -${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbs.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnbs.snippet deleted file mode 100644 index 7d35ab20..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnbs.snippet +++ /dev/null @@ -1,2 +0,0 @@ -response.should_not be_success -${1} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnc.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnc.snippet deleted file mode 100644 index 7baead27..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnc.snippet +++ /dev/null @@ -1,3 +0,0 @@ -lambda do - ${1} -end.should_not change(${2:target}, :${3:method}) diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shne.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shne.snippet deleted file mode 100644 index 68a7451c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shne.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not eql(${2:value}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shneq.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shneq.snippet deleted file mode 100644 index da4f59b9..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shneq.snippet +++ /dev/null @@ -1,2 +0,0 @@ - ${1:target}.should_not equal(${2:value}) - ${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnm.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnm.snippet deleted file mode 100644 index ee7b6043..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnm.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not match(/${2:regexp}/) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnp.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnp.snippet deleted file mode 100644 index 9f1298b7..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnp.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:target}.should_not be_${2:predicate} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnr.snippet deleted file mode 100644 index 98c0fc08..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnr.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:mock}.should_not_receive(:${2:message})${3} -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnre.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnre.snippet deleted file mode 100644 index fbf9604e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnre.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not raise_error(${2:error}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnredt.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnredt.snippet deleted file mode 100644 index 2afb69cc..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnredt.snippet +++ /dev/null @@ -1,2 +0,0 @@ -response.should_not redirect_to(${1:url}) -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnrt.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnrt.snippet deleted file mode 100644 index c2c5f2cb..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnrt.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not respond_to(:${2:sym}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shns.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shns.snippet deleted file mode 100644 index b73a71c8..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shns.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should_not satisfy { |${2:obj}| ${3} } -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shnt.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shnt.snippet deleted file mode 100644 index 0353376b..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shnt.snippet +++ /dev/null @@ -1,2 +0,0 @@ -lambda { ${1} }.should_not throw_symbol(:${2:symbol}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shp.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shp.snippet deleted file mode 100644 index 9267b612..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shp.snippet +++ /dev/null @@ -1 +0,0 @@ -${1:target}.should be_${2:predicate} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shr.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shr.snippet deleted file mode 100644 index 4effa2c1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shr.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:mock}.should_receive(:${2:message})${3} -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shre.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shre.snippet deleted file mode 100644 index 420bbe80..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shre.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should raise_error(${2:error}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shredt.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shredt.snippet deleted file mode 100644 index 979c1d6e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shredt.snippet +++ /dev/null @@ -1,2 +0,0 @@ -response.should redirect_to(${1:url}) -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shrt.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shrt.snippet deleted file mode 100644 index a796ebd2..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shrt.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should respond_to(:${2:sym}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shs.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shs.snippet deleted file mode 100644 index 08eb9419..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shs.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should satisfy { |${2:obj}| ${3} } -${4} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/sht.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/sht.snippet deleted file mode 100644 index 86f55fa3..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/sht.snippet +++ /dev/null @@ -1,2 +0,0 @@ -${1:target}.should throw_symble(:${2:symbol}) -${3} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/shtemp.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/shtemp.snippet deleted file mode 100644 index 9b08c10e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/shtemp.snippet +++ /dev/null @@ -1,2 +0,0 @@ -response.should render_template(:${1:template}) -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/tw.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/tw.snippet deleted file mode 100644 index 6ebb6d4a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/tw.snippet +++ /dev/null @@ -1 +0,0 @@ -twice diff --git a/sources_non_forked/snipmate-snippets/ruby-rspec/wia.snippet b/sources_non_forked/snipmate-snippets/ruby-rspec/wia.snippet deleted file mode 100644 index 21eda197..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-rspec/wia.snippet +++ /dev/null @@ -1,2 +0,0 @@ -with(${1:args}) -${2} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/context.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/context.snippet deleted file mode 100644 index 0e5a7fd2..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/context.snippet +++ /dev/null @@ -1,5 +0,0 @@ -context "${1:context}" do - - ${2} - -end diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/samao.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/samao.snippet deleted file mode 100644 index cfd4e59f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/samao.snippet +++ /dev/null @@ -1 +0,0 @@ -should_allow_mass_assignment_of :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/savf.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/savf.snippet deleted file mode 100644 index 39cfd6f1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/savf.snippet +++ /dev/null @@ -1 +0,0 @@ -should_allow_values_for :${1:field}, "${2:value}" diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/sbt.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/sbt.snippet deleted file mode 100644 index 90d25c84..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/sbt.snippet +++ /dev/null @@ -1 +0,0 @@ -should_belong_to :${1:association} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/selal.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/selal.snippet deleted file mode 100644 index 2fc48b4a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/selal.snippet +++ /dev/null @@ -1 +0,0 @@ -should_ensure_length_at_least :${1:field}, ${2:min_length} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/seli.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/seli.snippet deleted file mode 100644 index 8bc2bf87..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/seli.snippet +++ /dev/null @@ -1 +0,0 @@ -should_ensure_length_is :${1:field}, ${2:length} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/selir.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/selir.snippet deleted file mode 100644 index 1f0bdc98..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/selir.snippet +++ /dev/null @@ -1 +0,0 @@ -should_ensure_length_in_range :${1:field}, ${2:start}..${3:end} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/setup.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/setup.snippet deleted file mode 100644 index 68b895c1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/setup.snippet +++ /dev/null @@ -1,3 +0,0 @@ -setup do - ${1} -end diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/sevir.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/sevir.snippet deleted file mode 100644 index 195f7484..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/sevir.snippet +++ /dev/null @@ -1 +0,0 @@ -should_ensure_value_in_range :${1:field}, ${2:start}..${3:end} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shabtm.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shabtm.snippet deleted file mode 100644 index 03c70e24..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/shabtm.snippet +++ /dev/null @@ -1 +0,0 @@ -should_have_and_belong_to_many :${1:association} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shcm.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shcm.snippet deleted file mode 100644 index 6948aea9..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/shcm.snippet +++ /dev/null @@ -1 +0,0 @@ -should_have_class_methods :${1:method} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shdc.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shdc.snippet deleted file mode 100644 index d841d650..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/shdc.snippet +++ /dev/null @@ -1 +0,0 @@ -should_have_db_columns :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shi.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shi.snippet deleted file mode 100644 index d6d2b389..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/shi.snippet +++ /dev/null @@ -1 +0,0 @@ -should_have_indices :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shim.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shim.snippet deleted file mode 100644 index 1f442528..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/shim.snippet +++ /dev/null @@ -1 +0,0 @@ -should_have_instance_methods :${1:method} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shm.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shm.snippet deleted file mode 100644 index 8c98c17e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/shm.snippet +++ /dev/null @@ -1 +0,0 @@ -should_have_many :${1:association} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/sho.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/sho.snippet deleted file mode 100644 index a652b4f5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/sho.snippet +++ /dev/null @@ -1 +0,0 @@ -should_have_one :${1:association} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/shroa.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/shroa.snippet deleted file mode 100644 index 022015df..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/shroa.snippet +++ /dev/null @@ -1 +0,0 @@ -should_have_read_only_attributes :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/snamao.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/snamao.snippet deleted file mode 100644 index 236190b5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/snamao.snippet +++ /dev/null @@ -1 +0,0 @@ -should_not_allow_mass_assignment_of :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/snavf.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/snavf.snippet deleted file mode 100644 index 029c5bab..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/snavf.snippet +++ /dev/null @@ -1 +0,0 @@ -should_not_allow_values_for :${1:field}, "${2:value}" diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/svao.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/svao.snippet deleted file mode 100644 index 8eccb887..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/svao.snippet +++ /dev/null @@ -1 +0,0 @@ -should_validate_acceptance_of :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/svno.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/svno.snippet deleted file mode 100644 index a90c1cab..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/svno.snippet +++ /dev/null @@ -1 +0,0 @@ -should_validate_numericality_of :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/svpo.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/svpo.snippet deleted file mode 100644 index 13598f86..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/svpo.snippet +++ /dev/null @@ -1 +0,0 @@ -should_validate_presence_of :${1:field} diff --git a/sources_non_forked/snipmate-snippets/ruby-shoulda/svuo.snippet b/sources_non_forked/snipmate-snippets/ruby-shoulda/svuo.snippet deleted file mode 100644 index 6e26912d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby-shoulda/svuo.snippet +++ /dev/null @@ -1 +0,0 @@ -should_validate_uniqueness_of :${1:field}, :scoped_to => ${2:arrayofnames} diff --git a/sources_non_forked/snipmate-snippets/ruby/Md.snippet b/sources_non_forked/snipmate-snippets/ruby/Md.snippet deleted file mode 100644 index 1c2c9f10..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/Md.snippet +++ /dev/null @@ -1 +0,0 @@ -File.open(${1:dump_path}, "wb") { |${2:file}| Marshal.dump(${3:obj}, ${4:$2}) } diff --git a/sources_non_forked/snipmate-snippets/ruby/Ml.snippet b/sources_non_forked/snipmate-snippets/ruby/Ml.snippet deleted file mode 100644 index 33c3200c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/Ml.snippet +++ /dev/null @@ -1 +0,0 @@ -File.open(${1:dump_path}, "rb") { |${2:file}| Marshal.load(${3:$2}) } diff --git a/sources_non_forked/snipmate-snippets/ruby/Pn.snippet b/sources_non_forked/snipmate-snippets/ruby/Pn.snippet deleted file mode 100644 index e2136913..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/Pn.snippet +++ /dev/null @@ -1 +0,0 @@ -PStore.new(${1}) diff --git a/sources_non_forked/snipmate-snippets/ruby/Yd.snippet b/sources_non_forked/snipmate-snippets/ruby/Yd.snippet deleted file mode 100644 index e667a081..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/Yd.snippet +++ /dev/null @@ -1 +0,0 @@ -File.open(${1:path_to_yml}, "w") { |${2:file}| YAML.dump(${3:obj}, ${4:$2}) } diff --git a/sources_non_forked/snipmate-snippets/ruby/Yl.snippet b/sources_non_forked/snipmate-snippets/ruby/Yl.snippet deleted file mode 100644 index b37d1bb5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/Yl.snippet +++ /dev/null @@ -1 +0,0 @@ -File.open(${1:path_to_yml}) { |${2:file}| YAML.load(${3:$2}) } diff --git a/sources_non_forked/snipmate-snippets/ruby/am.snippet b/sources_non_forked/snipmate-snippets/ruby/am.snippet deleted file mode 100644 index 91209b9b..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/am.snippet +++ /dev/null @@ -1 +0,0 @@ -alias_method :${1:new_name}, :${2:old_name} diff --git a/sources_non_forked/snipmate-snippets/ruby/as.snippet b/sources_non_forked/snipmate-snippets/ruby/as.snippet deleted file mode 100644 index a8c7f5cb..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/as.snippet +++ /dev/null @@ -1 +0,0 @@ -assert ${1:test}, "${2:failure_message}" diff --git a/sources_non_forked/snipmate-snippets/ruby/asam.snippet b/sources_non_forked/snipmate-snippets/ruby/asam.snippet deleted file mode 100644 index 3c95b31c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asam.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_alias_method ${1:object}, ${2:alias_name}, ${3:original_name} diff --git a/sources_non_forked/snipmate-snippets/ruby/asb.snippet b/sources_non_forked/snipmate-snippets/ruby/asb.snippet deleted file mode 100644 index ab1eff71..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asb.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_boolean ${1:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/asc.snippet b/sources_non_forked/snipmate-snippets/ruby/asc.snippet deleted file mode 100644 index c6badc3e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asc.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_compare ${1:expected}, ${2:operator}, ${3:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/ascd.snippet b/sources_non_forked/snipmate-snippets/ruby/ascd.snippet deleted file mode 100644 index bc77908f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/ascd.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_const_defined ${1:object}, ${2:constant_name} diff --git a/sources_non_forked/snipmate-snippets/ruby/ase.snippet b/sources_non_forked/snipmate-snippets/ruby/ase.snippet deleted file mode 100644 index 5f650990..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/ase.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_equal ${1:expected}, ${2:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/asem.snippet b/sources_non_forked/snipmate-snippets/ruby/asem.snippet deleted file mode 100644 index 46428325..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asem.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_empty ${1:object} diff --git a/sources_non_forked/snipmate-snippets/ruby/asf.snippet b/sources_non_forked/snipmate-snippets/ruby/asf.snippet deleted file mode 100644 index 27ff6da5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asf.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_false ${1:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/asfa.snippet b/sources_non_forked/snipmate-snippets/ruby/asfa.snippet deleted file mode 100644 index f45fa53f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asfa.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_fail_assertion { ${1:block} } diff --git a/sources_non_forked/snipmate-snippets/ruby/asi.snippet b/sources_non_forked/snipmate-snippets/ruby/asi.snippet deleted file mode 100644 index dedf94d2..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asi.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_include ${1:collection}, ${2:object} diff --git a/sources_non_forked/snipmate-snippets/ruby/asid.snippet b/sources_non_forked/snipmate-snippets/ruby/asid.snippet deleted file mode 100644 index 683fb06c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asid.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_in_delta ${1:expected_float}, ${2:actual_float}, ${3:delta_float} diff --git a/sources_non_forked/snipmate-snippets/ruby/asie.snippet b/sources_non_forked/snipmate-snippets/ruby/asie.snippet deleted file mode 100644 index f13d0a36..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asie.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_in_epsilon ${1:expected_float}, ${2:actual_float} diff --git a/sources_non_forked/snipmate-snippets/ruby/asio.snippet b/sources_non_forked/snipmate-snippets/ruby/asio.snippet deleted file mode 100644 index 56f0ab7e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asio.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_instance_of ${1:ExpectedClass}, ${2:actual_instance} diff --git a/sources_non_forked/snipmate-snippets/ruby/asko.snippet b/sources_non_forked/snipmate-snippets/ruby/asko.snippet deleted file mode 100644 index 555bf138..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asko.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_kind_of ${1:ExpectedKind}, ${2:actual_instance} diff --git a/sources_non_forked/snipmate-snippets/ruby/asm.snippet b/sources_non_forked/snipmate-snippets/ruby/asm.snippet deleted file mode 100644 index 9860b4cf..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asm.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_match /${1:expected_pattern}/, ${2:actual_string} diff --git a/sources_non_forked/snipmate-snippets/ruby/asn.snippet b/sources_non_forked/snipmate-snippets/ruby/asn.snippet deleted file mode 100644 index 36a2898e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asn.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_nil ${1:instance} diff --git a/sources_non_forked/snipmate-snippets/ruby/asncd.snippet b/sources_non_forked/snipmate-snippets/ruby/asncd.snippet deleted file mode 100644 index b4dcd735..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asncd.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_const_defined ${1:object}, ${2:constant_name} diff --git a/sources_non_forked/snipmate-snippets/ruby/asne.snippet b/sources_non_forked/snipmate-snippets/ruby/asne.snippet deleted file mode 100644 index 91db286a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asne.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_equal ${1:unexpected}, ${2:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnem.snippet b/sources_non_forked/snipmate-snippets/ruby/asnem.snippet deleted file mode 100644 index 43d07728..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnem.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_empty ${1:object} diff --git a/sources_non_forked/snipmate-snippets/ruby/asni.snippet b/sources_non_forked/snipmate-snippets/ruby/asni.snippet deleted file mode 100644 index d450d9ea..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asni.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_include ${1:collection}, ${2:object} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnid.snippet b/sources_non_forked/snipmate-snippets/ruby/asnid.snippet deleted file mode 100644 index 23e039ad..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnid.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_in_delta ${1:expected_float}, ${2:actual_float} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnie.snippet b/sources_non_forked/snipmate-snippets/ruby/asnie.snippet deleted file mode 100644 index 25eb7515..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnie.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_in_epsilon ${1:expected_float}, ${2:actual_float} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnm.snippet b/sources_non_forked/snipmate-snippets/ruby/asnm.snippet deleted file mode 100644 index 95dbf247..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnm.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_no_match /${1:unexpected_pattern}/, ${2:actual_string} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnn.snippet b/sources_non_forked/snipmate-snippets/ruby/asnn.snippet deleted file mode 100644 index 9227bc8a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnn.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_nil ${1:instance} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnp.snippet b/sources_non_forked/snipmate-snippets/ruby/asnp.snippet deleted file mode 100644 index a540f84d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnp.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_predicate ${1:object}, ${2:predicate} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnr.snippet b/sources_non_forked/snipmate-snippets/ruby/asnr.snippet deleted file mode 100644 index fc9a8204..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnr.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_nothing_raised { ${1:block} } diff --git a/sources_non_forked/snipmate-snippets/ruby/asnrt.snippet b/sources_non_forked/snipmate-snippets/ruby/asnrt.snippet deleted file mode 100644 index fb063d28..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnrt.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_respond_to ${1:object}, ${2:method} diff --git a/sources_non_forked/snipmate-snippets/ruby/asns.snippet b/sources_non_forked/snipmate-snippets/ruby/asns.snippet deleted file mode 100644 index 509e467a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asns.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_same ${1:unexpected}, ${2:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnse.snippet b/sources_non_forked/snipmate-snippets/ruby/asnse.snippet deleted file mode 100644 index befde129..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnse.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_not_send ${1:send_array} diff --git a/sources_non_forked/snipmate-snippets/ruby/asnt.snippet b/sources_non_forked/snipmate-snippets/ruby/asnt.snippet deleted file mode 100644 index cb633c22..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asnt.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_nothing_thrown { ${1} } diff --git a/sources_non_forked/snipmate-snippets/ruby/aso.snippet b/sources_non_forked/snipmate-snippets/ruby/aso.snippet deleted file mode 100644 index 5b7faf64..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/aso.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_operator ${1:left}, :${2:operator}, ${3:right} diff --git a/sources_non_forked/snipmate-snippets/ruby/asp.snippet b/sources_non_forked/snipmate-snippets/ruby/asp.snippet deleted file mode 100644 index c23fd3f6..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asp.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_predicate ${1:object}, ${2:predicate} diff --git a/sources_non_forked/snipmate-snippets/ruby/aspe.snippet b/sources_non_forked/snipmate-snippets/ruby/aspe.snippet deleted file mode 100644 index 3a3eed4f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/aspe.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_path_exist ${1:path} diff --git a/sources_non_forked/snipmate-snippets/ruby/aspne.snippet b/sources_non_forked/snipmate-snippets/ruby/aspne.snippet deleted file mode 100644 index f7a8873a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/aspne.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_path_not_exist ${1:path} diff --git a/sources_non_forked/snipmate-snippets/ruby/asr.snippet b/sources_non_forked/snipmate-snippets/ruby/asr.snippet deleted file mode 100644 index 834038d5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asr.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_raise(${1:Exception}) { ${2} } diff --git a/sources_non_forked/snipmate-snippets/ruby/asrko.snippet b/sources_non_forked/snipmate-snippets/ruby/asrko.snippet deleted file mode 100644 index f82820ed..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asrko.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_raise_kind_of(${1:kinds...}) { ${2:block} } diff --git a/sources_non_forked/snipmate-snippets/ruby/asrm.snippet b/sources_non_forked/snipmate-snippets/ruby/asrm.snippet deleted file mode 100644 index f62f208b..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asrm.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_raise_message ${1:expected_message} diff --git a/sources_non_forked/snipmate-snippets/ruby/asrt.snippet b/sources_non_forked/snipmate-snippets/ruby/asrt.snippet deleted file mode 100644 index ca8e84b7..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asrt.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_respond_to ${1:object}, :${2:method} diff --git a/sources_non_forked/snipmate-snippets/ruby/asse.snippet b/sources_non_forked/snipmate-snippets/ruby/asse.snippet deleted file mode 100644 index 4fb9ef9a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/asse.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_send ${1:send_array} diff --git a/sources_non_forked/snipmate-snippets/ruby/ast.snippet b/sources_non_forked/snipmate-snippets/ruby/ast.snippet deleted file mode 100644 index 8962cfb7..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/ast.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_throws(:${1:expected}) { ${2} } diff --git a/sources_non_forked/snipmate-snippets/ruby/astr.snippet b/sources_non_forked/snipmate-snippets/ruby/astr.snippet deleted file mode 100644 index b9d14f6e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/astr.snippet +++ /dev/null @@ -1 +0,0 @@ -assert_true ${1:actual} diff --git a/sources_non_forked/snipmate-snippets/ruby/bm.snippet b/sources_non_forked/snipmate-snippets/ruby/bm.snippet deleted file mode 100644 index 681c5621..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/bm.snippet +++ /dev/null @@ -1,4 +0,0 @@ -TESTS = ${1:10_000} -Benchmark.bmbm do |results| - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/case.snippet b/sources_non_forked/snipmate-snippets/ruby/case.snippet deleted file mode 100644 index 085a45db..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/case.snippet +++ /dev/null @@ -1,5 +0,0 @@ -case ${1} -when ${2} -else - ${3} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/class.snippet b/sources_non_forked/snipmate-snippets/ruby/class.snippet deleted file mode 100644 index cb396704..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/class.snippet +++ /dev/null @@ -1,3 +0,0 @@ -class ${1:`Snippet_RubyClassNameFromFilename()`}${2} - ${3} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/classe.snippet b/sources_non_forked/snipmate-snippets/ruby/classe.snippet deleted file mode 100644 index f683c688..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/classe.snippet +++ /dev/null @@ -1 +0,0 @@ -class ${1:ErrorClassName} < ${2:StandardError}; end${3} diff --git a/sources_non_forked/snipmate-snippets/ruby/def.snippet b/sources_non_forked/snipmate-snippets/ruby/def.snippet deleted file mode 100644 index ad9bc8cf..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/def.snippet +++ /dev/null @@ -1,3 +0,0 @@ -def ${1:name} - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/defi.snippet b/sources_non_forked/snipmate-snippets/ruby/defi.snippet deleted file mode 100644 index 12c354c8..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/defi.snippet +++ /dev/null @@ -1,3 +0,0 @@ -def initialize${1} - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/defmm.snippet b/sources_non_forked/snipmate-snippets/ruby/defmm.snippet deleted file mode 100644 index e3b263a8..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/defmm.snippet +++ /dev/null @@ -1,3 +0,0 @@ -def method_missing(meth, *args, &blk) - ${1} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/defs.snippet b/sources_non_forked/snipmate-snippets/ruby/defs.snippet deleted file mode 100644 index 837733f2..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/defs.snippet +++ /dev/null @@ -1,3 +0,0 @@ -def self.${1:class_method_name} - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/deft.snippet b/sources_non_forked/snipmate-snippets/ruby/deft.snippet deleted file mode 100644 index 9c2adbff..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/deft.snippet +++ /dev/null @@ -1,3 +0,0 @@ -def test_${1:case_name} - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/detect.snippet b/sources_non_forked/snipmate-snippets/ruby/detect.snippet deleted file mode 100644 index 5fc24aaa..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/detect.snippet +++ /dev/null @@ -1 +0,0 @@ -detect { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/detecto.snippet b/sources_non_forked/snipmate-snippets/ruby/detecto.snippet deleted file mode 100644 index 904b2a67..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/detecto.snippet +++ /dev/null @@ -1,3 +0,0 @@ -detect do |${1:element}| - ${2:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/dglob.snippet b/sources_non_forked/snipmate-snippets/ruby/dglob.snippet deleted file mode 100644 index ca326ade..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/dglob.snippet +++ /dev/null @@ -1 +0,0 @@ -Dir.glob(${1:"<+dir}"+>) { |${2:file}| ${3} } diff --git a/sources_non_forked/snipmate-snippets/ruby/do.snippet b/sources_non_forked/snipmate-snippets/ruby/do.snippet deleted file mode 100644 index 596c11a9..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/do.snippet +++ /dev/null @@ -1,3 +0,0 @@ -do - ${1} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/dop.snippet b/sources_non_forked/snipmate-snippets/ruby/dop.snippet deleted file mode 100644 index 9bf1898a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/dop.snippet +++ /dev/null @@ -1,3 +0,0 @@ -do |${1:param}| - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/ea.snippet b/sources_non_forked/snipmate-snippets/ruby/ea.snippet deleted file mode 100644 index 5f7edec0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/ea.snippet +++ /dev/null @@ -1 +0,0 @@ -each { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/each.snippet b/sources_non_forked/snipmate-snippets/ruby/each.snippet deleted file mode 100644 index 5f7edec0..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/each.snippet +++ /dev/null @@ -1 +0,0 @@ -each { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/each_with_index.snippet b/sources_non_forked/snipmate-snippets/ruby/each_with_index.snippet deleted file mode 100644 index f4d3ef11..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/each_with_index.snippet +++ /dev/null @@ -1 +0,0 @@ -each_with_index { |${1:element},${2:i}| ${3:} } diff --git a/sources_non_forked/snipmate-snippets/ruby/each_with_indexo.snippet b/sources_non_forked/snipmate-snippets/ruby/each_with_indexo.snippet deleted file mode 100644 index e4fb7080..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/each_with_indexo.snippet +++ /dev/null @@ -1,4 +0,0 @@ -each_with_index do |${1:element},${2:i}| - ${3:body} -end - diff --git a/sources_non_forked/snipmate-snippets/ruby/eacho.snippet b/sources_non_forked/snipmate-snippets/ruby/eacho.snippet deleted file mode 100644 index 7c133426..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/eacho.snippet +++ /dev/null @@ -1,3 +0,0 @@ -each do |${1:element}| - ${2:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/eado.snippet b/sources_non_forked/snipmate-snippets/ruby/eado.snippet deleted file mode 100644 index 7c133426..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/eado.snippet +++ /dev/null @@ -1,3 +0,0 @@ -each do |${1:element}| - ${2:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/eawi.snippet b/sources_non_forked/snipmate-snippets/ruby/eawi.snippet deleted file mode 100644 index f4d3ef11..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/eawi.snippet +++ /dev/null @@ -1 +0,0 @@ -each_with_index { |${1:element},${2:i}| ${3:} } diff --git a/sources_non_forked/snipmate-snippets/ruby/eawido.snippet b/sources_non_forked/snipmate-snippets/ruby/eawido.snippet deleted file mode 100644 index e4fb7080..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/eawido.snippet +++ /dev/null @@ -1,4 +0,0 @@ -each_with_index do |${1:element},${2:i}| - ${3:body} -end - diff --git a/sources_non_forked/snipmate-snippets/ruby/elsif.snippet b/sources_non_forked/snipmate-snippets/ruby/elsif.snippet deleted file mode 100644 index 84d8134e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/elsif.snippet +++ /dev/null @@ -1,2 +0,0 @@ -elsif ${1:condition} - ${2} diff --git a/sources_non_forked/snipmate-snippets/ruby/fileeach.snippet b/sources_non_forked/snipmate-snippets/ruby/fileeach.snippet deleted file mode 100644 index 5076ef1a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/fileeach.snippet +++ /dev/null @@ -1 +0,0 @@ -File.foreach(${1:"<+path}"+>) { |${2:line}| ${3} } diff --git a/sources_non_forked/snipmate-snippets/ruby/fopen.snippet b/sources_non_forked/snipmate-snippets/ruby/fopen.snippet deleted file mode 100644 index b630bfeb..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/fopen.snippet +++ /dev/null @@ -1 +0,0 @@ -File.open(${1:path}, "${2:rwab}") { |${3:file}| ${4} } diff --git a/sources_non_forked/snipmate-snippets/ruby/fread.snippet b/sources_non_forked/snipmate-snippets/ruby/fread.snippet deleted file mode 100644 index d9e6074c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/fread.snippet +++ /dev/null @@ -1 +0,0 @@ -File.read(${1}) diff --git a/sources_non_forked/snipmate-snippets/ruby/http_get.snippet b/sources_non_forked/snipmate-snippets/ruby/http_get.snippet deleted file mode 100644 index cba6d589..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/http_get.snippet +++ /dev/null @@ -1,2 +0,0 @@ -require 'net/http' -res = Net::HTTP.get URI.parse('${1:url}') diff --git a/sources_non_forked/snipmate-snippets/ruby/http_post.snippet b/sources_non_forked/snipmate-snippets/ruby/http_post.snippet deleted file mode 100644 index 3b2036ad..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/http_post.snippet +++ /dev/null @@ -1,2 +0,0 @@ -require 'net/http' -res = Net::HTTP.post_form URI.parse('${1:url}')${2:, params} diff --git a/sources_non_forked/snipmate-snippets/ruby/if.snippet b/sources_non_forked/snipmate-snippets/ruby/if.snippet deleted file mode 100644 index b2d1e39e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/if.snippet +++ /dev/null @@ -1,3 +0,0 @@ -if ${1:condition} - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/ife.snippet b/sources_non_forked/snipmate-snippets/ruby/ife.snippet deleted file mode 100644 index 2a7468df..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/ife.snippet +++ /dev/null @@ -1,4 +0,0 @@ -if ${1:condition} - ${2} -else -end diff --git a/sources_non_forked/snipmate-snippets/ruby/inj.snippet b/sources_non_forked/snipmate-snippets/ruby/inj.snippet deleted file mode 100644 index 90dea0d8..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/inj.snippet +++ /dev/null @@ -1 +0,0 @@ -inject(${1:init}) { |${2:total}, ${3:next}| ${4:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/injdo.snippet b/sources_non_forked/snipmate-snippets/ruby/injdo.snippet deleted file mode 100644 index d3235e90..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/injdo.snippet +++ /dev/null @@ -1,3 +0,0 @@ -inject(${1:init}) do |${2:total}, ${3:next}| - ${4:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/inject.snippet b/sources_non_forked/snipmate-snippets/ruby/inject.snippet deleted file mode 100644 index 78ad721d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/inject.snippet +++ /dev/null @@ -1 +0,0 @@ -inject { |${1:total},${2:next}| ${3:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/injecto.snippet b/sources_non_forked/snipmate-snippets/ruby/injecto.snippet deleted file mode 100644 index 1631033d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/injecto.snippet +++ /dev/null @@ -1,3 +0,0 @@ -inject do |${1:total},${2:next}| - ${3:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/ip.snippet b/sources_non_forked/snipmate-snippets/ruby/ip.snippet deleted file mode 100644 index 91769768..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/ip.snippet +++ /dev/null @@ -1 +0,0 @@ -ip_addr = request.env['REMOTE_ADDR'] diff --git a/sources_non_forked/snipmate-snippets/ruby/map.snippet b/sources_non_forked/snipmate-snippets/ruby/map.snippet deleted file mode 100644 index b3e7719f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/map.snippet +++ /dev/null @@ -1 +0,0 @@ -map { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/mapdo.snippet b/sources_non_forked/snipmate-snippets/ruby/mapdo.snippet deleted file mode 100644 index 316e7c7c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/mapdo.snippet +++ /dev/null @@ -1,3 +0,0 @@ -map do |${1:element}| - ${2:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/mapo.snippet b/sources_non_forked/snipmate-snippets/ruby/mapo.snippet deleted file mode 100644 index 316e7c7c..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/mapo.snippet +++ /dev/null @@ -1,3 +0,0 @@ -map do |${1:element}| - ${2:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/mod.snippet b/sources_non_forked/snipmate-snippets/ruby/mod.snippet deleted file mode 100644 index 457fd615..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/mod.snippet +++ /dev/null @@ -1,3 +0,0 @@ -module ${1:`Snippet_RubyClassNameFromFilename()`} - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/module.snippet b/sources_non_forked/snipmate-snippets/ruby/module.snippet deleted file mode 100644 index 78e025a1..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/module.snippet +++ /dev/null @@ -1,14 +0,0 @@ -module ${1:`Snippet_RubyClassNameFromFilename()`} - module ClassMethods - ${2} - end - - module InstanceMethods - - end - - def self.included(receiver) - receiver.extend ClassMethods - receiver.send :include, InstanceMethods - end -end diff --git a/sources_non_forked/snipmate-snippets/ruby/nam.snippet b/sources_non_forked/snipmate-snippets/ruby/nam.snippet deleted file mode 100644 index 19b90a76..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/nam.snippet +++ /dev/null @@ -1,3 +0,0 @@ -namespace :${1:namespace} do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/ope.snippet b/sources_non_forked/snipmate-snippets/ruby/ope.snippet deleted file mode 100644 index cfe92471..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/ope.snippet +++ /dev/null @@ -1 +0,0 @@ -open(${1:path}, "${2:rwab}") { |${3:io}| ${4} } diff --git a/sources_non_forked/snipmate-snippets/ruby/pathhere.snippet b/sources_non_forked/snipmate-snippets/ruby/pathhere.snippet deleted file mode 100644 index f4ed9440..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/pathhere.snippet +++ /dev/null @@ -1 +0,0 @@ -File.join(File.dirname(__FILE__), *%w[${1:rel_path_here}]) diff --git a/sources_non_forked/snipmate-snippets/ruby/r.snippet b/sources_non_forked/snipmate-snippets/ruby/r.snippet deleted file mode 100644 index f232fc94..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/r.snippet +++ /dev/null @@ -1 +0,0 @@ -attr_reader :${1:attr_names} diff --git a/sources_non_forked/snipmate-snippets/ruby/reject.snippet b/sources_non_forked/snipmate-snippets/ruby/reject.snippet deleted file mode 100644 index 07d2787f..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/reject.snippet +++ /dev/null @@ -1 +0,0 @@ -reject { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/rejecto.snippet b/sources_non_forked/snipmate-snippets/ruby/rejecto.snippet deleted file mode 100644 index e906bd7e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/rejecto.snippet +++ /dev/null @@ -1,3 +0,0 @@ -reject do |${1:element}| - ${2:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/rep.snippet b/sources_non_forked/snipmate-snippets/ruby/rep.snippet deleted file mode 100644 index 04b77b0d..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/rep.snippet +++ /dev/null @@ -1 +0,0 @@ -results.report("${1:name}:") { TESTS.times { ${2} } } diff --git a/sources_non_forked/snipmate-snippets/ruby/rw.snippet b/sources_non_forked/snipmate-snippets/ruby/rw.snippet deleted file mode 100644 index 1862da33..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/rw.snippet +++ /dev/null @@ -1 +0,0 @@ -attr_accessor :${1:attr_names} diff --git a/sources_non_forked/snipmate-snippets/ruby/select.snippet b/sources_non_forked/snipmate-snippets/ruby/select.snippet deleted file mode 100644 index 8ab228cc..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/select.snippet +++ /dev/null @@ -1 +0,0 @@ -select { |${1:element}| ${2:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/selecto.snippet b/sources_non_forked/snipmate-snippets/ruby/selecto.snippet deleted file mode 100644 index a22a6505..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/selecto.snippet +++ /dev/null @@ -1,3 +0,0 @@ -select do |${1:element}| - ${2:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/sinc.snippet b/sources_non_forked/snipmate-snippets/ruby/sinc.snippet deleted file mode 100644 index 20e2c4c9..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/sinc.snippet +++ /dev/null @@ -1 +0,0 @@ -class << self; self end diff --git a/sources_non_forked/snipmate-snippets/ruby/sort.snippet b/sources_non_forked/snipmate-snippets/ruby/sort.snippet deleted file mode 100644 index 08a67c1a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/sort.snippet +++ /dev/null @@ -1 +0,0 @@ -sort { |${1:x},${2:y}| ${3:body} } diff --git a/sources_non_forked/snipmate-snippets/ruby/sorto.snippet b/sources_non_forked/snipmate-snippets/ruby/sorto.snippet deleted file mode 100644 index 76c38e40..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/sorto.snippet +++ /dev/null @@ -1,3 +0,0 @@ -sort do |${1:x},${2:y}| - ${3:body} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/tas.snippet b/sources_non_forked/snipmate-snippets/ruby/tas.snippet deleted file mode 100644 index d949a6b5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/tas.snippet +++ /dev/null @@ -1,4 +0,0 @@ -desc "${1:Task description}" -task :${2:task_name}${3: => [:dependent, :tasks]} do - ${4} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/task.snippet b/sources_non_forked/snipmate-snippets/ruby/task.snippet deleted file mode 100644 index d949a6b5..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/task.snippet +++ /dev/null @@ -1,4 +0,0 @@ -desc "${1:Task description}" -task :${2:task_name}${3: => [:dependent, :tasks]} do - ${4} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/tc.snippet b/sources_non_forked/snipmate-snippets/ruby/tc.snippet deleted file mode 100644 index 3e28f61a..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/tc.snippet +++ /dev/null @@ -1,9 +0,0 @@ -require "test/unit" - -require "${1:library_file_name}" - -class Test${2:`Snippet_RubyClassNameFromFilename()`} < Test::Unit::TestCase - def test_${3:case_name} - ${4} - end -end diff --git a/sources_non_forked/snipmate-snippets/ruby/unless.snippet b/sources_non_forked/snipmate-snippets/ruby/unless.snippet deleted file mode 100644 index 3495d2ba..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/unless.snippet +++ /dev/null @@ -1,3 +0,0 @@ -unless ${1:condition} - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/unlesse.snippet b/sources_non_forked/snipmate-snippets/ruby/unlesse.snippet deleted file mode 100644 index d190b45e..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/unlesse.snippet +++ /dev/null @@ -1,4 +0,0 @@ -unless ${1:condition} - ${2} -else -end diff --git a/sources_non_forked/snipmate-snippets/ruby/w.snippet b/sources_non_forked/snipmate-snippets/ruby/w.snippet deleted file mode 100644 index 0650e955..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/w.snippet +++ /dev/null @@ -1 +0,0 @@ -attr_writer :${1:attr_names} diff --git a/sources_non_forked/snipmate-snippets/ruby/while.snippet b/sources_non_forked/snipmate-snippets/ruby/while.snippet deleted file mode 100644 index 6e878fa3..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/while.snippet +++ /dev/null @@ -1,3 +0,0 @@ -while ${1:condition} - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/xmlr.snippet b/sources_non_forked/snipmate-snippets/ruby/xmlr.snippet deleted file mode 100644 index eeb35802..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/xmlr.snippet +++ /dev/null @@ -1 +0,0 @@ -REXML::Document.new(File.read(${1:path})) diff --git a/sources_non_forked/snipmate-snippets/ruby/xpa.snippet b/sources_non_forked/snipmate-snippets/ruby/xpa.snippet deleted file mode 100644 index 5bff9508..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/xpa.snippet +++ /dev/null @@ -1,3 +0,0 @@ -elements.each(${1}) do |${2:node}| - ${3} -end diff --git a/sources_non_forked/snipmate-snippets/ruby/zip.snippet b/sources_non_forked/snipmate-snippets/ruby/zip.snippet deleted file mode 100644 index b2c831ab..00000000 --- a/sources_non_forked/snipmate-snippets/ruby/zip.snippet +++ /dev/null @@ -1 +0,0 @@ -zip(${1:enums}) { |${2:row}| ${3} } diff --git a/sources_non_forked/snipmate-snippets/sinatra/get.snippet b/sources_non_forked/snipmate-snippets/sinatra/get.snippet deleted file mode 100644 index 08f3fd5a..00000000 --- a/sources_non_forked/snipmate-snippets/sinatra/get.snippet +++ /dev/null @@ -1,3 +0,0 @@ -get '${1:/}' do - ${2} -end diff --git a/sources_non_forked/snipmate-snippets/sshconfig/host.snippet b/sources_non_forked/snipmate-snippets/sshconfig/host.snippet deleted file mode 100644 index 5992a2d0..00000000 --- a/sources_non_forked/snipmate-snippets/sshconfig/host.snippet +++ /dev/null @@ -1,3 +0,0 @@ -Host ${1:name} - Hostname ${2:example.com} - User ${3:username} diff --git a/sources_non_forked/snipmate-snippets/support_functions.vim b/sources_non_forked/snipmate-snippets/support_functions.vim deleted file mode 100644 index a09e81da..00000000 --- a/sources_non_forked/snipmate-snippets/support_functions.vim +++ /dev/null @@ -1,115 +0,0 @@ -"ruby {{{1 -function! Snippet_RubyClassNameFromFilename(...) - let name = expand("%:t:r") - if len(name) == 0 - if a:0 == 0 - let name = 'MyClass' - else - let name = a:1 - endif - endif - return Snippet_Camelcase(substitute(name, '_spec$', '', '')) -endfunction - -function! Snippet_MigrationNameFromFilename(...) - let name = substitute(expand("%:t:r"), '^.\{-}_', '', '') - if len(name) == 0 - if a:0 == 0 - let name = 'MyClass' - else - let name = a:1 - endif - endif - return Snippet_Camelcase(name) -endfunction - - -"python {{{1 -function! Snippet_PythonClassNameFromFilename(...) - let name = expand("%:t:r") - if len(name) == 0 - if a:0 == 0 - let name = 'MyClass' - else - let name = a:1 - endif - endif - return Snippet_Camelcase(name) -endfunction - -"php {{{1 -function! Snippet_PHPClassNameFromFilename(...) - let name = expand("%:t:r:r") - if len(name) == 0 - if a:0 == 0 - let name = 'MyClass' - else - let name = a:1 - endif - endif - return name -endfunction - -"java {{{1 -function! Snippet_JavaClassNameFromFilename(...) - let name = expand("%:t:r") - if len(name) == 0 - if a:0 == 0 - let name = 'MyClass' - else - let name = a:1 - endif - endif - return name -endfunction - -function! Snippet_JavaInstanceVarType(name) - let oldview = winsaveview() - if searchdecl(a:name) == 0 - normal! B - let old_reg = @" - normal! yaW - let type = @" - let @" = old_reg - call winrestview(oldview) - let type = substitute(type, '\s\+$', '', '') - - "searchdecl treats 'return foo;' as a declaration of foo - if type != 'return' - return type - endif - endif - return "<+type+>" -endfunction - - -"global {{{1 -function! s:start_comment() - return substitute(&commentstring, '^\([^ ]*\)\s*%s\(.*\)$', '\1', '') -endfunction - -function! s:end_comment() - return substitute(&commentstring, '^.*%s\(.*\)$', '\1', '') -endfunction - -function! Snippet_Modeline() - return s:start_comment() . " vim: set ${1:settings}:" . s:end_comment() -endfunction - -function! Snippet_Camelcase(s) - "upcase the first letter - let toReturn = substitute(a:s, '^\(.\)', '\=toupper(submatch(1))', '') - "turn all '_x' into 'X' - return substitute(toReturn, '_\(.\)', '\=toupper(submatch(1))', 'g') -endfunction - -function! Snippet_Underscore(s) - "down the first letter - let toReturn = substitute(a:s, '^\(.\)', '\=tolower(submatch(1))', '') - "turn all 'X' into '_x' - return substitute(toReturn, '\([A-Z]\)', '\=tolower("_".submatch(1))', 'g') -endfunction - - -" modeline {{{1 -" vim: set fdm=marker: diff --git a/sources_non_forked/snipmate-snippets/vim/au.snippet b/sources_non_forked/snipmate-snippets/vim/au.snippet deleted file mode 100644 index d59720a5..00000000 --- a/sources_non_forked/snipmate-snippets/vim/au.snippet +++ /dev/null @@ -1 +0,0 @@ -autocmd ${1:events} ${2:pattern} ${3:command} diff --git a/sources_non_forked/snipmate-snippets/vim/com.snippet b/sources_non_forked/snipmate-snippets/vim/com.snippet deleted file mode 100644 index b8eeb5b4..00000000 --- a/sources_non_forked/snipmate-snippets/vim/com.snippet +++ /dev/null @@ -1 +0,0 @@ -command! -nargs=${1:number_of_args} ${2:other_params} ${2:name} ${2:command} diff --git a/sources_non_forked/snipmate-snippets/vim/func.snippet b/sources_non_forked/snipmate-snippets/vim/func.snippet deleted file mode 100644 index 8591a835..00000000 --- a/sources_non_forked/snipmate-snippets/vim/func.snippet +++ /dev/null @@ -1,8 +0,0 @@ -"Function: $1 -"Desc: ${3:description} -" -"Arguments: -"${4} -function! ${1:name}(${2}) - ${5} -endfunction diff --git a/sources_non_forked/snipmate-snippets/vim/if.snippet b/sources_non_forked/snipmate-snippets/vim/if.snippet deleted file mode 100644 index 336e7a00..00000000 --- a/sources_non_forked/snipmate-snippets/vim/if.snippet +++ /dev/null @@ -1,3 +0,0 @@ -if ${1} - ${2} -endif diff --git a/sources_non_forked/snipmate-snippets/vim/ife.snippet b/sources_non_forked/snipmate-snippets/vim/ife.snippet deleted file mode 100644 index c5d16939..00000000 --- a/sources_non_forked/snipmate-snippets/vim/ife.snippet +++ /dev/null @@ -1,4 +0,0 @@ -if ${1} - ${2} -else -endif diff --git a/sources_non_forked/snipmate-snippets/vim/log.snippet b/sources_non_forked/snipmate-snippets/vim/log.snippet deleted file mode 100644 index 5a867549..00000000 --- a/sources_non_forked/snipmate-snippets/vim/log.snippet +++ /dev/null @@ -1 +0,0 @@ -echomsg ${1} diff --git a/sources_non_forked/snipmate-snippets/vim/try.snippet b/sources_non_forked/snipmate-snippets/vim/try.snippet deleted file mode 100644 index cd4c0e72..00000000 --- a/sources_non_forked/snipmate-snippets/vim/try.snippet +++ /dev/null @@ -1,4 +0,0 @@ -try - ${2} -catch /${1}/ -endtry diff --git a/sources_non_forked/snipmate-snippets/xslt/call.snippet b/sources_non_forked/snipmate-snippets/xslt/call.snippet deleted file mode 100644 index 2fe4f9d1..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/call.snippet +++ /dev/null @@ -1,3 +0,0 @@ - - ${2} - diff --git a/sources_non_forked/snipmate-snippets/xslt/choose.snippet b/sources_non_forked/snipmate-snippets/xslt/choose.snippet deleted file mode 100644 index 1a877543..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/choose.snippet +++ /dev/null @@ -1,7 +0,0 @@ - - - ${2} - - - - diff --git a/sources_non_forked/snipmate-snippets/xslt/mat.snippet b/sources_non_forked/snipmate-snippets/xslt/mat.snippet deleted file mode 100644 index a566e0ec..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/mat.snippet +++ /dev/null @@ -1,3 +0,0 @@ - - ${2} - diff --git a/sources_non_forked/snipmate-snippets/xslt/out.snippet b/sources_non_forked/snipmate-snippets/xslt/out.snippet deleted file mode 100644 index 88e70c21..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/out.snippet +++ /dev/null @@ -1 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/xslt/param.snippet b/sources_non_forked/snipmate-snippets/xslt/param.snippet deleted file mode 100644 index f4f9a504..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/param.snippet +++ /dev/null @@ -1 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/xslt/sty.snippet b/sources_non_forked/snipmate-snippets/xslt/sty.snippet deleted file mode 100644 index f6751c74..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/sty.snippet +++ /dev/null @@ -1,3 +0,0 @@ - - ${1} - diff --git a/sources_non_forked/snipmate-snippets/xslt/tem.snippet b/sources_non_forked/snipmate-snippets/xslt/tem.snippet deleted file mode 100644 index bcd86d6d..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/tem.snippet +++ /dev/null @@ -1,3 +0,0 @@ - - ${2} - diff --git a/sources_non_forked/snipmate-snippets/xslt/value.snippet b/sources_non_forked/snipmate-snippets/xslt/value.snippet deleted file mode 100644 index 9128cc6d..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/value.snippet +++ /dev/null @@ -1 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/xslt/var.snippet b/sources_non_forked/snipmate-snippets/xslt/var.snippet deleted file mode 100644 index d21b77c8..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/var.snippet +++ /dev/null @@ -1,3 +0,0 @@ - - ${2} - diff --git a/sources_non_forked/snipmate-snippets/xslt/wparam.snippet b/sources_non_forked/snipmate-snippets/xslt/wparam.snippet deleted file mode 100644 index 2284b71c..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/wparam.snippet +++ /dev/null @@ -1 +0,0 @@ - diff --git a/sources_non_forked/snipmate-snippets/xslt/xdec.snippet b/sources_non_forked/snipmate-snippets/xslt/xdec.snippet deleted file mode 100644 index f1e44209..00000000 --- a/sources_non_forked/snipmate-snippets/xslt/xdec.snippet +++ /dev/null @@ -1,2 +0,0 @@ - - ${2} diff --git a/sources_non_forked/snipmate-snippets/zend/assert.snippet b/sources_non_forked/snipmate-snippets/zend/assert.snippet deleted file mode 100644 index ca928f25..00000000 --- a/sources_non_forked/snipmate-snippets/zend/assert.snippet +++ /dev/null @@ -1 +0,0 @@ -$this->assertTrue(${1:somevar}, '${2:sometext}'); diff --git a/sources_non_forked/snipmate-snippets/zend/boolcol.snippet b/sources_non_forked/snipmate-snippets/zend/boolcol.snippet deleted file mode 100644 index 715fe19c..00000000 --- a/sources_non_forked/snipmate-snippets/zend/boolcol.snippet +++ /dev/null @@ -1 +0,0 @@ -$this->hasColumn('${1:active}', '${2:boolean}', ${3:1}, array('default' => '${4:1}','notnull' => true)); diff --git a/sources_non_forked/snipmate-snippets/zend/clac.snippet b/sources_non_forked/snipmate-snippets/zend/clac.snippet deleted file mode 100644 index 80972a11..00000000 --- a/sources_non_forked/snipmate-snippets/zend/clac.snippet +++ /dev/null @@ -1,20 +0,0 @@ -_flashMessenger->addMessage("${1}", '${2:error}'); diff --git a/sources_non_forked/snipmate-snippets/zend/getconf.snippet b/sources_non_forked/snipmate-snippets/zend/getconf.snippet deleted file mode 100644 index 10f2b202..00000000 --- a/sources_non_forked/snipmate-snippets/zend/getconf.snippet +++ /dev/null @@ -1 +0,0 @@ -$${1:conf} = Zend_Registry::get('${2:config}')->${3:general}; diff --git a/sources_non_forked/snipmate-snippets/zend/input.snippet b/sources_non_forked/snipmate-snippets/zend/input.snippet deleted file mode 100644 index 3c4ed27e..00000000 --- a/sources_non_forked/snipmate-snippets/zend/input.snippet +++ /dev/null @@ -1,4 +0,0 @@ -formInput(array( 'type' => '${1:hidden}', - 'name' => '${2}', - 'value' => ${3:}, - 'id' => '${4:}' )); ?> diff --git a/sources_non_forked/snipmate-snippets/zend/inputarr.snippet b/sources_non_forked/snipmate-snippets/zend/inputarr.snippet deleted file mode 100644 index 8e97bee5..00000000 --- a/sources_non_forked/snipmate-snippets/zend/inputarr.snippet +++ /dev/null @@ -1,6 +0,0 @@ -formInput(array( 'type' => '${1:dropdown}', - 'name' => '${2}', - 'label' => '${3:}', - 'errors' => ${4:}, - 'value' => ${5:}, - 'valueList' => ${6:} )); ?> diff --git a/sources_non_forked/snipmate-snippets/zend/intcol.snippet b/sources_non_forked/snipmate-snippets/zend/intcol.snippet deleted file mode 100644 index caacaa61..00000000 --- a/sources_non_forked/snipmate-snippets/zend/intcol.snippet +++ /dev/null @@ -1 +0,0 @@ -$this->hasColumn('${1:id}', '${2:integer}', ${3:11}, array(${4:'notnull' => true)}); diff --git a/sources_non_forked/snipmate-snippets/zend/lib.snippet b/sources_non_forked/snipmate-snippets/zend/lib.snippet deleted file mode 100644 index 683e22ef..00000000 --- a/sources_non_forked/snipmate-snippets/zend/lib.snippet +++ /dev/null @@ -1,5 +0,0 @@ -hasColumn('id', 'integer', 4, array('notnull' => true, - 'primary' => true, - 'autoincrement' => true)); - ${3} - } - -} diff --git a/sources_non_forked/snipmate-snippets/zend/navi.snippet b/sources_non_forked/snipmate-snippets/zend/navi.snippet deleted file mode 100644 index 2724ff9f..00000000 --- a/sources_non_forked/snipmate-snippets/zend/navi.snippet +++ /dev/null @@ -1 +0,0 @@ -$this->view->navigationActive = array('topnavi' => '${1:home}','subnavi' => '${2:index}'); diff --git a/sources_non_forked/snipmate-snippets/zend/route.snippet b/sources_non_forked/snipmate-snippets/zend/route.snippet deleted file mode 100644 index cdf834b2..00000000 --- a/sources_non_forked/snipmate-snippets/zend/route.snippet +++ /dev/null @@ -1 +0,0 @@ -$this->_redirector->gotoRoute(array('controller' => '${1}', 'action' => '${2:index}', 'id' => '${3:}'), '${4:admin_action}'); diff --git a/sources_non_forked/snipmate-snippets/zend/rp.snippet b/sources_non_forked/snipmate-snippets/zend/rp.snippet deleted file mode 100644 index b5dcd1ff..00000000 --- a/sources_non_forked/snipmate-snippets/zend/rp.snippet +++ /dev/null @@ -1,2 +0,0 @@ -partial('${1:somefile}.phtml', - array(${2}))?> diff --git a/sources_non_forked/snipmate-snippets/zend/strcol.snippet b/sources_non_forked/snipmate-snippets/zend/strcol.snippet deleted file mode 100644 index 98d3cf34..00000000 --- a/sources_non_forked/snipmate-snippets/zend/strcol.snippet +++ /dev/null @@ -1 +0,0 @@ -$this->hasColumn('${1:title}', '${2:string}', ${3:255}, array(${4:'notnull' => true})); diff --git a/sources_non_forked/tlib/.gitignore b/sources_non_forked/tlib/.gitignore new file mode 100644 index 00000000..e626a86d --- /dev/null +++ b/sources_non_forked/tlib/.gitignore @@ -0,0 +1,13 @@ +tags +!doc/tags +Makefile +TODO.TXT +TODO_archived.viki +*.vba +*.vmb +*.zip +.last_* +test +test_* +tmp +var diff --git a/sources_non_forked/tlib/CHANGES.TXT b/sources_non_forked/tlib/CHANGES.TXT new file mode 100644 index 00000000..767ae5e4 --- /dev/null +++ b/sources_non_forked/tlib/CHANGES.TXT @@ -0,0 +1,909 @@ +0.1 +Initial release + +0.2 +- More list convenience functions +- tlib#EditList() +- tlib#InputList(): properly handle duplicate items; it type contains +'i', the list index + 1 is returned, not the element + +0.3 +- tlib#InputList(): Show feedback in statusline instead of the echo area +- tlib#GetVar(), tlib#GetValue() + +0.4 +- tlib#InputList(): Up/Down keys wrap around list +- tlib#InputList(): FIX: Problem when reducing the filter & using AND +- tlib#InputList(): Made work (can be configured via +- tlib#InputList(): special display_format: "filename" +- tlib#Object: experimental support for some kind of OOP +- tlib#World: Extracted some functions from tlib.vim to tlib/World.vim +- tlib#FileJoin(), tlib#FileSplit(), tlib#RelativeFilename() +- tlib#Let() +- tlib#EnsureDirectoryExists(dir) +- tlib#DirName(dir) +- tlib#DecodeURL(url), tlib#EncodeChar(char), tlib#EncodeURL(url) +- FIX: Problem when using shift-up/down with filtered lists + +0.5 +- tlib#InputList(): FIX: Selecting items in filtered view +- tlib#InputList(): : Remove last AND pattern from filter + +0.6 +- tlib#InputList(): Disabled map +- tlib#InputList(): try to be smart about user itentions only if a +list's length is < g:tlib_sortprefs_threshold (default: 200) +- tlib#Object: Super() method +- tlib#MyRuntimeDir() +- tlib#GetCacheName(), tlib#CacheSave(), tlib#CacheGet() +- tlib#Args(), tlib#GetArg() +- FIX: tlib#InputList(): Display problem with first item + +0.7 +- tlib#InputList(): ... Suspend/Resume input +- tlib#InputList(): ... Input text on the command line (useful on +slow systems when working with very large lists) +- tlib#InputList(): AND-pattern starting with '!' will work as 'exclude +matches' +- tlib#InputList(): FIX pop OR-patterns properly +- tlib#InputList(): display_format == filename: don't add '/' to +directory names (avoid filesystem access) + +0.8 +- FIX: Return empty cache name for buffers that have no files attached to it +- Some re-arranging + +0.9 +- Re-arrangements & modularization (this means many function names have +changed, on the other hand only those functions are loaded that are +actually needed) +- tlib#input#List(): Added maps with m-modifiers for , , +- tlib#input#List(): Make sure &fdm is manual +- tlib#input#List(): When exiting the list view, consume the next 5 +characters in the queue (if any) +- tlib#input#EditList(): Now has cut, copy, paste functionality. +- Added documentation and examples + +0.10 +- tlib#input#List(): (v)split type of commands leave the original window +untouched (you may use to replace its contents) +- tlib#file#With(): Check whether an existing buffer is loaded. +- Scratch related functions went to tlib/scratch.vim so that they are +accessible from other scripts. +- Configure the list window height via g:tlib_inputlist_pct (1..100%) + +0.11 +NEW: + - The :TLet command replaces :TLLet (which was removed) + - :TScratch[!] command (with ! don't split but use the whole window) + - tlib#rx#Escape(text, ?magic='m') + - tlib#buffer#GetList(?show_hidden=0) + - tlib#dir#CD(), tlib#dir#Push(), tlib#dir#Pop() + - tlib#input#ListW: A slightly remodeled version of tlib#input#List + that takes a World as second argument. + - Added some documentation doc/tlib.txt (most of it is automatically + compiled from the source files) +CHANGES: + - tlib#input#List(): The default keys for AND, NOT have changed to + be more Google-like (space, minus); the keys can be configured via + global variables. +IMPROVEMENTS: + - In file listings, indicate if a file is loaded, listed, modified + etc. + - tlib#input#List(): Highlight the filter pattern + - tlib#input#List(): scrolls g:tlib_scroll_lines + (default=10) lines +FIXES: + - tlib#input#List(): Centering line, clear match, clear & restore + the search register + - tlib#input#List(): Ensure the window layout doesn't change (if the + number of windows hasn't changed) + - tlib#arg#Ex(): Don't escape backslashes by default + +0.12 +NEW: + - tlib/tab.vim +CHANGES: + - Renamed tlib#win#SetWin() to tlib#win#Set() +IMPROVEMENTS: + - tlib#input#List(): , keys work in some lists + - tlib#input#List(): If an index_table is provided this will be used + instead of the item's list index. +FIXES: + - tlib#input#List(): Problem with scrolling, when the list was + shorter than the window (eg when using a vertical window). + - tlib#cache#Filename(): Don't rewrite name as relative filename if + explicitly given as argument. Avoid double (back)slashes. + - TLet: simplified + +0.13 +CHANGES: + - Scratch: Set &fdc=0. + - The cache directory can be configured via g:tlib_cache + - Renamed tlib#buffer#SetBuffer() to tlib#buffer#Set(). +FIXES: + - tlib#input#List(): Select the active item per mouse. + - TLet: simplified + +0.14 +NEW: + - tlib#buffer#InsertText() +CHANGES: + - tlib#win#[SG]etLayout(): Use a dictionnary, set &cmdheight. +FIXES: + - Wrong order with pre-defined filters. + +0.15 +NEW: + - tlib#string#TrimLeft(), tlib#string#TrimRight(), tlib#string#Strip() + - Progress bar + +0.16 +NEW: + - tlib#string#Printf1() + +0.17 +NEW: + - TBrowseOutput +- Some minor changes + +0.18 +NEW: + - tlib/time.vim + - g:tlib_inputlist_livesearch_threshold +CHANGES: + - tlib#input#ListD(), World: Don't redisplay the list while typing + new letters; calculate filter regexps only once before filtering the + list. + - World.vim: Minor changes to how filenames are handled. + +0.19 +NEW: + - tag.vim +FIX: + - dir.vim: Use plain dir name in tlib#dir#Ensure() + - tlib#input#List(): An initial filter argument creates [[filter]] + and not as before [[''], [filter]]. + - tlib#input#List(): When type was "si" and the item was picked by + filter, the wrong index was returned. + - tlib#input#List(): Don't check if chars are typed when displaying + the list for the first time. + +0.20 +- The arguments of tlib#tag#Collect() have changed. +- tlib#input#List(): The view can be "suspended" on initial display. +- tlib#input#List(): Follow/trace cursor functionality + +0.21 +- tlib#buffer#InsertText(): Respect tabs and (experimental) formatoptions+=or +- tlib/syntax.vim: Syntax-related functions + +0.22 +- FIX: very magic mode for tlib#rx#Escape() (thanks A Politz) +- FIX: tlib#arg#Ex: escape "!" + +0.23 +- Respect the setting of g:tlib_inputlist_filename_indicators +- tlib#input#List(): Reset syntax on resume; option to make list window "sticky" +- tlib#agent#ToggleStickyList() +- Simplified tlib#url#Decode() +- tlib#arg#Ex(): use fnameescape() if available + +0.24 +- s:prototype.SetInitialFilter: accept list as argument +- Maintain buffer MRU if required + +0.25 +- NEW: tlib#notify#TrimMessage(): trim message to prevent "Press ENTER" +messages (contributed by Erik Falor) +- NEW: tlib#notify#Echo() +- FIX: World.CloseScratch(): Set window +- FIX: tlib#input#ListW(): Set initial_display = 1 on reset + +0.26 +- NEW: tlib#normal#WithRegister() +- FIX: Try not to change numbered registers + +0.27 +- FIX: Cosmetic bug, wrong packaging (thanks Nathan Neff) +- Meaning of World#filter_format changed; new World#filter_options +- Filtering didn't work as advertised +- tlib#string#Count() + +0.28 +- tlib#input#List(): +-- Improved handling of sticky lists; and resume a +suspended list and immediately selects the item under the cursor +-- Experimental "seq" matching style: the conjunctions are sequentially +ordered, they are combined with "OR" (disjunctions), the regexp is +'magic', and "." is expanded to '.\{-}' +-- Experimental "cnfd" matching style: Same as cnf but with an "elastic" +dot "." that matches '\.\{-}' +-- Filtering acts as if &ic=1 && $sc=1 +-- Weighting is done by the filter +- tlib#agent#Input(): Consume when aborting input() +- INCOMPATIBLE CHANGE: Changed eligible values of g:tlib_inputlist_match +to "cnf", "cnfd", "seq" and "fuzzy" +- NEW: tlib#buffer#KeepCursorPosition() +- tlib#buffer#InsertText(): Take care of the extra line when appending +text to an empty buffer. + +0.29 +- tlib#string#Strip(): Strip also control characters (newlines etc.) +- tlib#rx#Suffixes(): 'suffixes' as Regexp +- World#RestoreOrigin(): Don't assume &splitbelow + +0.30 +- World#RestoreOrigin(): Don't assume &splitright + +0.31 +- :TRequire command +-tlib#input#List: For i-type list views, make sure agents are called +with the base indices. + +0.32 +- tlib#agent#Exit: explicitly return empty value (as a consequence, +pressing when browsing an index-list, returns 0 and not "") +- tlib#signs +- tlib#input#List: set local statusline + +0.33 +- Don't reset statusline +- Don't use fnamemodify() to split filenames (for performance reasons) +- scratch: Set ft after setting up scratch options +- tlib#map#PumAccept(key) + +0.34 +- tlib#buffer#HighlightLine(line): call tlib#autocmdgroup#Init() +(reported by Sergey Khorev) + +0.35 +- tlib#input#EditList(): return the list if the user presses esc + +0.36 +- Display a message when the filter is for whatever reason invalid +- Removed tlib#paragraph#Delete() +- New: tlib#paragraph#Define(), tlib#textobjects#StandardParagraph() +- Try to speed up list display (a rewrite of World.DisplayList() etc. is +required) + +0.37 +- g:tlib_inputlist_livesearch_threshold defaults to 1000 +- tlib#World: optional scratch_pos field +- tlib#input#List: By default selects by number but NUMBER is +interpreted as string +- tlib#date +- TTimeCommand + +0.38 +- tlib#World#Resize: set winfix{height|width} + +0.39 +- g:tlib#cache#dont_purge +- tlib#vim#RestoreWindow() +- tlib#ballon#...() + +0.40 +- tlib#agent#ViewFile: Use split/sbuffer if nohidden && modified +- tlib#buffer#GetList(): order by "basename" + +version: "0.41" + - World.UseScratch(): keepalt + - Really include balloon.vim + MD5 checksum: 3fcbc4f7556f5378d39622e62ab8f379 + +version: "0.42" + - tlib#input#List: inserts a *-like wildcard (represented as "__") + - Check if a cache file cannot be created because a directory of the same name exists (display a message if so) + - tlib#cache#Filename: Removed check if a directory of the same name exists (due to inconsistent use) + - Minor improvements related to buffer handling (scratch_split) + - .gitignore + - docs (thanks to blueyed) + - There is no "edit" answer possibility. + - Fix first purge: do nothing if no timestamp file. + - g:tlib_pick_single_item + - Removed pick_single_item. Changed the default behavour when a list has only 1 item. See doc for g:tlib_pick_last_item. + - Updated help for tlib#input#List(); help_extra attribute + - EXPERIMENTAL: cache_var, restore_from_cache, on_leave properties; #Initialize(), #Leave() + - added tlib#cmd#BrowseOutputWithCallback function and :TBrowseScriptnames command + - tlib#cmd#BrowseOutputWithCallback function and :TBrowseScriptnames command documentation + - s:prototype.Initialize(): unlet self.cache_var after restoring values + - tlib#input#List: filter-specific help + - Removed the seq filter (use cnfd or fuzzy instead) + - tlib#input#List: temp_prompt (for help message) + MD5 checksum: aa8b5a4602235cc1a5bc9ee45d801b81 + +version: "0.42" + - g:tlib#cache#silent: don't display messages when purging the cache (fixes #9) + - Changed message when deleting directories in the cache. + - g:tlib#input#use_popup: Don't rely on has('menu') but also check for gtk & win gui (fixes #10) + - debug + - tlib#input#ListW(): Didn't return a list when type == "m" + - docs (solves #11) + MD5 checksum: aa8b5a4602235cc1a5bc9ee45d801b81 + +version: "0.45" + - fuzzy mode: prototype.highlight defaults to g:tlib_inputlist_higroup + - tlib#scratch: Use noautocmd + - tlib#input#ListW(): Use world.RestoreOrigin() instead of tlib#win#SetLayout(world.winview) + - tlib#input#ListW(): Revert to tlib#win#SetLayout(world.winview) + - tlib#cmd#OutputAsList(): Also save output in g:tlib#cmd#last_output + - tlib#agent#Suspend(): Resume on BufEnter + - tlib#input#Resume(): Make sure we are in the right buffer + - tlib#agent#Suspend(): Use only BufEnter event to trigger a Resume + - tlib#input#ListW(): When redisplaying a list, make sure prefix > 0 + - tlib#vcs: Access vcs (initially only git is supported) + - tlib#vcs: improved + - tlib#persistent: Persistent data file names + - tlib#file#With(): Trigger BufRead autocommands + - Duplicate help tags (fixes #13) + - Make sure scrolloff is 0 while viewing the list (fixes https://github.com/tomtom/vikitasks_vim/issues/2) + MD5 checksum: 0af19ebc0e424727a598a988fdc90f4e + + - Support for tinykeymap (move paragraph) + - Moved para_move to autoload/tinykeymap/map + - tlib#vcs: some "diff" commands were defined as "ls"; updated hg def; %s is optional + MD5 checksum: f2f2fe0893e75bb9423c1ddcd01f38f6 +version: "0.46" + + - tlib#input#List: optimizations + - Prepare for multi-mode maps + - tlib#input#List: cnfx is new default filter + - Filters: minor changes to how the pattern is displayed + - g:tlib#input#format_filename: alternative method for formatting filenames + - tlib#input#List: allow multiple keymaps / modes + - Handle rezise events + - Don't initialize the same window twice + - Minor optimizations to how help is displayed + - Handle VimResize event per buffer + - Improve display of filenames & highlighting + - Filename highlighter: set Highlight_filename() + - RunStateHandlers(): set world variable + - Optimize help display + MD5 checksum: e3652927722bdc51935eb1a04238546b +version: "1.00" + + - Set g:tlib_inputlist_and to ' ' again + - g:tlib#input#filename_max_width: maximum display width of filenames + - tlib#input#List: , : run command by name + MD5 checksum: a42f90275cdbe9f7d92cac61b884a2d1 +version: "1.01" + + - #UseInputListScratch(): Make sure the TLib autogroup was created (fixes #14) + MD5 checksum: 5a6da7fc99c7fc7584e8fc2f7bf86fe4 +version: "1.02" + + - tlib#cache#Value(cfile, generator, ftime, ...): cache value & check timestamp + - Replaced g:tlib#cache#silent with g:tlib#cache#verbosity + - FormatFilenames: improved handling of utf8 characters + - tlib#persistent#Value() + - tlib#input#List: Allow filename indiactors defined by the caller + - Custom filename_indicators are displayed after (and clearly separted from) the standard indicators + - Check the return value of an unknown_key agent + - Format filename = "l": Allow ".." as start of a directory name + - Format filename = "l": If the filename is just a filename's tail, display it on both sides + - Set g:tlib_filename_sep to "\" on Windows (again) + - g:tlib#cache#max_filename: If the cache filename is longer than N characters, use |pathshorten()|. + MD5 checksum: b64ce6764f39f40bfc95f3916bbb0057 +version: "1.04" + +version: "1.05" + - tlib#hash: Adler32 & CRC32 (using zlib via ruby) algorithms + - tlib#cache#Filename(): If the cache filename is too long, add the Adler32 checksum to the shortened path + - tlib#cache#Filename(): Use tlib#hash#Adler32() only if the or() function exists + - tlib#hash#Adler32(): Raise error, if or() doesn't exist + - tlib#hash#CRC32(): Alternative implementation of crc32 (doesn't work yet, thus currently disabled) + - tlib#bitwise: Bitwise operations for older versions of vim + - tlib#number: Base conversion + - tlib#input#ListW(): Handle mouse clicks more correctly + - tlib#bitwise#Num2Bits(): Supports returning floats + - tlib#hash#CRC32(): Alternative implementation of crc32 (doesn't work yet) + - tlib#hash#CRC32(): Re-enable ruby version + - tlib#hash#CRC32B(): Implementation of CRC32B checksum in vimscript (used only if +ruby isn't available) + - tlib#hash#CRC32B(): vim version: cache the crc table + - tlib#cache#Filename(): Use tlib#hash#CRC32B(file) instead of not Adler32 for filenames too long + - tlib#hash#CRC32B(): ruby version: return upper case hex value + - g:tlib#hash#use_crc32: define which crc32b version should be used + - Moved spec files from vimtlib to tlib_vim + - tlib#bitwise#Add() and tlib#bitwise#Sub() + - tlib#file#Relative(): Wrong results for filenames that don't exist + - Implementation of hash#Adler32 for earlier vim versions; g:tlib#hash#use_adler32 + - tlib#cache#Filename(): Use adler32 again + - addon-info + - tlib#file#Absolute(): remove redundant "." parts in full filename + - win32: Fix moving window when using :vertical for tlib#inpu#List() + - tlib#cache#Filename(): Don't create wrong directory if the cache filename is too long + - tlib#file#Join(): if strip_slashes, also strip redundant (back)slashes + - tlib#input#ListW(): Always set post_keys variable + - tlib#file#With(): escape backslashes + - tlib#cmd#OutputAsList(): Support for nesting + - tlib#dir#NativeName(dirname) + MD5 checksum: 493f9beca44374de386f20d1613155e3 + + - Rename g:tlib_debug to g:tlib#debug + - Renamed g:tlib_sortprefs_threshold to g:tlib#input#sortprefs_threshold + - Renamed g:tlib#input#livesearch_threshold + - Renamed g:tlib_inputlist_match to g:tlib#input#filter_mode + - Renamed g:tlib_inputlist_higroup to g:tlib#input#higroup + - Renamed g:tlib#debug + - Moved g:tlib_pick_last_item + - Renamed g:tlib#input#and, g:tlib#input#or, g:tlib#input#not + - Moved g:tlib_numeric_chars to autoload/tlib/input.vim + - Renamed g:tlib#input#keyagents_InputList_s, g:tlib#input#keyagents_InputList_m, g:tlib#input#handlers_EditList + - Moved g:tlib_inputlist_pct, g:tlib_inputlist_width_filename, g:tlib_inputlist_filename_indicators, g:tlib_inputlist_shortmessage to autoload/tlib/World.vim + - Renamed tlib#input#pick_last_item (2) + - prototype.SelectItemsByNames() + - filtered_items: Restricted view + - prototype.PrintLines() + - Restricted view (2) + - Moved g:tlib_scroll_lines to autoload/tlib/agent.vim + - prototype.PrintLines() (2) + - tlib#input: Improved handling of popup menu (allows submenu) + - tlib#input: Allow mods in keys + - Moved g:tlib_scratch_pos to autoload/tlib/scratch.vim + - Moved g:tlib_tags_extra, g:tlib_tag_substitute to autoload/tlib/tag.vim + - tlib#agent#CompleteAgentNames(): Respect Arglead + - Move g:tlib_viewline_position to autoload/tlib/buffer.vim + - Move g:tlib_cache to autoload/tlib/cache.vim + - Renamed g:tlib_filename_sep to g:tlib#dir#sep + - prototype.UseScratch(): Set b:tlib_world + - tlib#input: f9 toggles resticted view + - tlib#input: next_agent, next_eval + - tlib#input: Revised use of the popup menu + - tlib#input: Disable popup menu for gui_gtk + - tlib#input: Re-enabled the popup menu for gtk gui + - tlib#input: FIX popup menu on Windows + - Renamed g:tlib_numeric_chars to g:tlib#input#numeric_chars (disabled per-buffer values) (fixes #35) + - Improve scratch list + - New: tlib#grep + - Merge branch 'master' of https://github.com/bruno-/tlib_vim into pull16 + - g:tlib_scratch_hidden: Configure how to "hide" the scratch buffer + - tlib#grep#Do: don't escape "*" in patterns + - Optimize use of visible scratch buffers + - World.scratch_hidden parameter + - scratch: Always use keepalt & keepjumps + MD5 checksum: 2e40449c47dc606ccef57aa0b1e22e8e +version: "1.06" + +version: "1.07" + - Help template + - prototype.Highlight_filename(): Use matchstr() instead of fnamemodify() + - Display buffer-related filename indicators only if g:tlib_inputlist_filename_indicators is true + - tlib#file#Join(): strip_slashes defaults to 1 + MD5 checksum: 6c8fa96fd3747be05df848ee93dd789b + +version: "1.08" + - list#input: Improved support for file indicators (closes #17) + - tlib#char#Get(): Optionally, also return mod + - tlib#input#ListW: Use #DisplayFormat(world.list) + - Renamed cnfx filter to glob & minor filter-related enhancements + - list#input: Make help available as command; help cannot be called via ? + - list#input: Improved help message + - list#input: Support Home & End keys + - list#input: Added glob filter + - tlib#agent#ShowInfo: Show full filename + - tlib#cmd#BrowseOutputWithCallback: Support calling callback with multiple results + - tlib#cmd#ParseScriptname: Properly parse results from :scriptnames + - tlib#tab#Set() + - Prepare for proper handling of scratch_split == -1 + - tlib#vim#CopyFunction() + - tlib#cache#Value(): If generator is empty, use the optional argument as start value + - tlib#persistent#Get() refers to tlib#cache#Get() + MD5 checksum: 459ec620168d1ae9b18c69eb3f991832 + + - tlib#cache#Filename(): Use sha256() for VIM >= 7.4 + - tlib#cache#Value(): Undo previous hack + - tlib#list#Uniq(): option to remove empty values + - tlib#cache#MTime(); tlib#persistent#Save() calls tlib#cache#Save() + - tlib#input#ListW: Temporarily set noshowmode + - tlib#list#Uniq(): Fix handling of empty items + - lis picker: Remove from help + - tlib#list#Uniq(): Implementation based on syntastic#util#unique(list) by scrooloose + MD5 checksum: b5fb4107d63930c2c8b1f0f6b3a7ff07 +version: "1.09" + + - tlib#cache#Filename(): Use sha256() for VIM >= 7.4 + - tlib#cache#Value(): Undo previous hack + - tlib#list#Uniq(): option to remove empty values + - tlib#cache#MTime(); tlib#persistent#Save() calls tlib#cache#Save() + - tlib#input#ListW: Temporarily set noshowmode + - tlib#list#Uniq(): Fix handling of empty items + - lis picker: Remove from help + - tlib#list#Uniq(): Implementation based on syntastic#util#unique(list) by scrooloose + MD5 checksum: b5fb4107d63930c2c8b1f0f6b3a7ff07 +version: "1.09" + + - tlib#string#Chomp: Optional argument: max number of chars that should be removed + MD5 checksum: 8c1b94e25045580874e2f892d509291b +version: "1.10" + + - tlib#vcs#FindVCS(filename): Wrong parameters to fnamemodifiy if filename is a directory + - Some system-related functions (e.g. facilitate use of cygwin tools) + - tlib#arg#StringAsKeyArgsEqual(), tlib#arg#StringAsKeyArgs(): Support "key=val" type argument lists + - tlib#vcs#Executable() + - scripts/create_crc_table.rb + - tlib#var#Get(): For namespaces other than global, replace "#" with "_" + MD5 checksum: 4a33f2f23e1fc6600b32e7f8323e001e +version: "1.11" + + - tlib#list#ToDictionary() + - tlib#dir#CanonicName(): Use tlib#file#Canonic() + - tlib#file#Canonic() + MD5 checksum: 7995ab58f31eb6673d20deab8761838e +version: "1.12" + + - SetInitialFilter(): Use deepcopy() + - tlib#var#List(): use keys(namespace) for newer versions of vim + - g:tlib#input#user_shortcuts (not functional yet) + - tlib#input#List: state "picked" + - UseInputListScratch(): Allow customization via self.index_next_syntax + - tlib#cmd#Capture() + - Facilitate customization of key agents via g:tlib_extend_keyagents_InputList_s, g:tlib_extend_keyagents_InputList_m + MD5 checksum: 7dd8b17a1a5b555df979381dcbd4c9aa +version: "1.13" + + - SetInitialFilter(): Use deepcopy() + - tlib#var#List(): use keys(namespace) for newer versions of vim + - g:tlib#input#user_shortcuts (not functional yet) + - tlib#input#List: state "picked" + - UseInputListScratch(): Allow customization via self.index_next_syntax + - tlib#cmd#Capture() + - Facilitate customization of key agents via g:tlib_extend_keyagents_InputList_s, g:tlib_extend_keyagents_InputList_m + MD5 checksum: 7dd8b17a1a5b555df979381dcbd4c9aa +version: "1.13" + +version: "1.14" + - FIX #18: Make sure the scratch isn't readonly + - FIX: display filter (properly handle backslashes) + - Remove loaded_* guard from autoload files + - tlib#notify#Echo(): minor changes + - tlib#file#Edit() (used by tlib#agent#ViewFile) + - tlib#buffer#GetList(): Buffer numbers are converted to numbers + - tlib#sys: Change order of functions (move tlib#sys#IsCygwinBin to the (possibly FIX #19) + - g:tlib#sys#check_cygpath: Call tlib#sys#IsExecutable('cygpath', 1) (possibly FIX #19) + MD5 checksum: 2cf6386218736a2d09db43c8e751e5a4 + +version: "1.15" + - tlib#file#Join(): New optional argument: maybe_absolute Drop preceding parts if a part looks like an absolute filename + - tlib#sys#Open(), tlib#sys#IsSpecial() (moved from viki) + - tlib#list#Uniq(): Handle hetergenous lists + - FIX #21: duplicate help tag + - NEW tlib#dictionary#Rev() + - tlib#input#List(): Use to complete current word + - NEW tlib#arg#GetOpts(); ENH tlib#arg#StringAsKeyArgsEqual() + - cache: Allow for in memory cache + - NEW tlib#eval#Extend() + - Move qfl/loclist browser from trag to tlib + - FIX tlib#eval#Extend() + - Simplify tlib#eval#Extend() + - World.index_next_syntax may be a dict + - tlib#qfl#QflList: Use copy() + - tlib#arg#GetOpts: Handle exit code + MD5 checksum: 13fd8b0e4ba9cd932c57fc40ac3f641f + +version: "1.15" + - tlib#file#Join(): New optional argument: maybe_absolute Drop preceding parts if a part looks like an absolute filename + - tlib#sys#Open(), tlib#sys#IsSpecial() (moved from viki) + - tlib#list#Uniq(): Handle hetergenous lists + - FIX #21: duplicate help tag + - NEW tlib#dictionary#Rev() + - tlib#input#List(): Use to complete current word + - NEW tlib#arg#GetOpts(); ENH tlib#arg#StringAsKeyArgsEqual() + - cache: Allow for in memory cache + - NEW tlib#eval#Extend() + - Move qfl/loclist browser from trag to tlib + - FIX tlib#eval#Extend() + - Simplify tlib#eval#Extend() + - World.index_next_syntax may be a dict + - tlib#qfl#QflList: Use copy() + - tlib#arg#GetOpts: Handle exit code + MD5 checksum: 13fd8b0e4ba9cd932c57fc40ac3f641f + + - tlib#arg#GetOpts: Handle short options + - tlib#arg: support short flags & facilitate completion + - NEW :TLibTrace + - tlib#sys#system_browser: FIX XDG string + - NEW tlib#sys#SystemInDir() (used by tlib#vcs#Ls) + - tlib#agent#Complete: improve fltrx + - Remove tlib#arg#Key(), :TKeyArg + - Move :TRequire, :TTimeCommand to macros/tlib.vim + - NEW tlib#cmd#TBrowseScriptnames() + - TScratch: use empty('') + - NEW :TLibTrace + - tlib#qfl: FIX TTagedFilesFilename regexp + - Remove tlib#arg#Key() + - tlib#buffer#InsertText(): Don't use TKeyArg + - tlib#eval#Extend: don't assign value + - NEW :TLibTrace, tlib#trace (was tlib#debug) + - NEW tlib#string#SplitCommaList() + - NEW tlib#time#FormatNow() + - tlib#arg#GetOpts: selectively disable "long", "short" flags + - tlib#arg#CComplete(): Support values completion (complete_customlist field) + - NEW tlib#date#Shift() + - tlib#qfl#Balloon(): Handle items with no bufnr + - NEW tlib#file#Glob, tlib#file#Globpath + - tlib#progressbar#Display(): optional "always" argument + - tlib#vcs#GitLsPostprocess(): Try to handle encoded filenames from git ls-files + - tlib#vcs#GitLsPostprocess: Eval only \ddd substrings + - FIX #22: duplicate tag + - tlib#buffer: Use 2match instead of 3match (incompatibility with matchparen) + - FIX #23: duplicate help tag + - tlib#string#SplitCommaList: optional "sep" argument + - Rename TLibTrace -> Tlibtrace; NEW Tlibtraceset command + - Rename s:SetSyntax -> tlib#qfl#SetSyntax + - mv tlib#rx#Convert to incubator + MD5 checksum: f3656fb35b7b3033084d6c5e504aca61 +version: "1.16" + + - tlib#input#List: #ReduceFilter: make sure the regexp is valid + - TTimeCommand -> Ttimecommand + - tlib#eval#Extend: mode argument for expand() compatibility + - tlib#input#List: Key handlers can have additional arguments + - tlib#qfl#AgentWithSelected: Set world + - prototype.UseInputListScratch: Run tlib_UseInputListScratch hook earlier + - tlib#qfl#AgentWithSelected: typo + - tlib#arg#GetOpts: type conversion (comma-separated lists etc.) + - tlib#arg: validators + - NEW tlib#date#IsDate() + - tlib#balloon#Remove: Unset &ballooneval, &balloonexpr + - NEW tlib#balloon#Expand() + - NEW tlib#date#Format() + - FIX tlib#date#Shift(..., "+Xm") for months + - NEW tlib#trace#Backtrace() + - NEW tlib#type#Is(), tlib#type#Are(), tlib#type#Has(), tlib#type#Have() + - NEW :Tlibassert + MD5 checksum: 3c4125a28ff1860accd254846651c251 +version: "1.17" + + - tlib#input#List: #ReduceFilter: make sure the regexp is valid + - TTimeCommand -> Ttimecommand + - tlib#eval#Extend: mode argument for expand() compatibility + - tlib#input#List: Key handlers can have additional arguments + - tlib#qfl#AgentWithSelected: Set world + - prototype.UseInputListScratch: Run tlib_UseInputListScratch hook earlier + - tlib#qfl#AgentWithSelected: typo + - tlib#arg#GetOpts: type conversion (comma-separated lists etc.) + - tlib#arg: validators + - NEW tlib#date#IsDate() + - tlib#balloon#Remove: Unset &ballooneval, &balloonexpr + - NEW tlib#balloon#Expand() + - NEW tlib#date#Format() + - FIX tlib#date#Shift(..., "+Xm") for months + - NEW tlib#trace#Backtrace() + - NEW tlib#type#Is(), tlib#type#Are(), tlib#type#Has(), tlib#type#Have() + - NEW :Tlibassert + MD5 checksum: 3c4125a28ff1860accd254846651c251 +version: "1.17" + + - tlib#input#List: #ReduceFilter: make sure the regexp is valid + - TTimeCommand -> Ttimecommand + - tlib#eval#Extend: mode argument for expand() compatibility + - tlib#input#List: Key handlers can have additional arguments + - tlib#qfl#AgentWithSelected: Set world + - prototype.UseInputListScratch: Run tlib_UseInputListScratch hook earlier + - tlib#qfl#AgentWithSelected: typo + - tlib#arg#GetOpts: type conversion (comma-separated lists etc.) + - tlib#arg: validators + - NEW tlib#date#IsDate() + - tlib#balloon#Remove: Unset &ballooneval, &balloonexpr + - NEW tlib#balloon#Expand() + - NEW tlib#date#Format() + - FIX tlib#date#Shift(..., "+Xm") for months + - NEW tlib#trace#Backtrace() + - NEW tlib#type#Is(), tlib#type#Are(), tlib#type#Has(), tlib#type#Have() + - NEW :Tlibassert + MD5 checksum: 3c4125a28ff1860accd254846651c251 +version: "1.17" + + - tlib#input#List: #ReduceFilter: make sure the regexp is valid + - TTimeCommand -> Ttimecommand + - tlib#eval#Extend: mode argument for expand() compatibility + - tlib#input#List: Key handlers can have additional arguments + - tlib#qfl#AgentWithSelected: Set world + - prototype.UseInputListScratch: Run tlib_UseInputListScratch hook earlier + - tlib#qfl#AgentWithSelected: typo + - tlib#arg#GetOpts: type conversion (comma-separated lists etc.) + - tlib#arg: validators + - NEW tlib#date#IsDate() + - tlib#balloon#Remove: Unset &ballooneval, &balloonexpr + - NEW tlib#balloon#Expand() + - NEW tlib#date#Format() + - FIX tlib#date#Shift(..., "+Xm") for months + - NEW tlib#trace#Backtrace() + - NEW tlib#type#Is(), tlib#type#Are(), tlib#type#Has(), tlib#type#Have() + - NEW :Tlibassert + MD5 checksum: 3c4125a28ff1860accd254846651c251 +version: "1.17" + + - tlib#arg: Completion for comma-separated lists + - Use "silent cd" + - NEW tlib#type#DefSchema(); FIX tlib#type#Has() + - tlib#cache#Value(): minor change + - tlib#date#IsDate() also checks whether the date is valid + - ! tlib#sys#Open(): escape special chars only once + - tlib#trace#Print: Allow for strings + - :Tlibtrace, :Tlibtraceset, :Tlibassert remove `-bar` + - NEW :Tlibtype (type/schema assertions); tlib#type#Is() also accepts schemas as "types" + - tlib#dir#CD(): Use haslocaldir() + - tlib#qfl#AgentGotoQFE: Don't use wincmd w + - NEW tlib#string#Input() + - FIX g:tlib#sys#system_rx; add OpenOffice exensions to g:tlib#sys#special_suffixes + - NEW tlib#selection#GetSelection() + - tlib#date#Shift(): Fix "Xm", ++specs + - tlib#trace#Set: FIX Properly handly "-label" + MD5 checksum: c3a1fe7d3cd86becbd3f7b0ba7ae9cd8 +version: "1.19" + +version: "1.20" + - tlib#arg: Completion for comma-separated lists + - Use "silent cd" + - NEW tlib#type#DefSchema(); FIX tlib#type#Has() + - tlib#cache#Value(): minor change + - tlib#date#IsDate() also checks whether the date is valid + - ! tlib#sys#Open(): escape special chars only once + - tlib#trace#Print: Allow for strings + - :Tlibtrace, :Tlibtraceset, :Tlibassert remove `-bar` + - NEW :Tlibtype (type/schema assertions); tlib#type#Is() also accepts schemas as "types" + - tlib#dir#CD(): Use haslocaldir() + - tlib#qfl#AgentGotoQFE: Don't use wincmd w + - NEW tlib#string#Input() + - FIX g:tlib#sys#system_rx; add OpenOffice exensions to g:tlib#sys#special_suffixes + - NEW tlib#selection#GetSelection() + - tlib#date#Shift(): Fix "Xm", ++specs + - tlib#trace#Set: FIX Properly handly "-label" + MD5 checksum: c919e0782931a8c628c6996903f989d3 + + - tlib#date#Shift(): Support for business days 'Nb' + - tlib#list#Uniq: Properly handle empty strings + - tlib#trace: Use g:tlib#trace#printer and tlib#trace#Printer_{printer} + - tlib#dictionary#Rev: Optional argument `opts = {}`; properly handle empty values etc. + - NEW g:tlib#trace#hl + - NEW spec/dictionary.vim + - tlib#agent#CompleteAgentNames: case insensitive + - tlib#arg#CComplete: --[no-]debug option + - tlib#date#Format: use localtime() if no arg is provided + - NEW tlib#file#IsAbsolute + - NEW tlib#notify#PrintError() + - tlib#trace#Print: FIX s/exec/call/ + - tlib#type#Is() match full type name + - NEW tlib#string#MatchAll() + - Tlibtraceset, tlib#trace#Set(): If no `+` or `-` is prepended, assume `+`. + - tlib#list#Input: fix highlighting for filenames + - tlib#input#ListW: use world.CloseScratch(1) + - tlib#agent#ViewFile: Ignore errors in :exec back + - NEW tlib#agent#EditFileInWindow() + - :Tlibtraceset uses tlib#arg#GetOpts(), i.e. you can set the log file more easily + MD5 checksum: 20a48e225f32b9f58808096a5377af04 +version: "1.22" + + - tlib#date#Shift(): Support for business days 'Nb' + - tlib#list#Uniq: Properly handle empty strings + - tlib#trace: Use g:tlib#trace#printer and tlib#trace#Printer_{printer} + - tlib#dictionary#Rev: Optional argument `opts = {}`; properly handle empty values etc. + - NEW g:tlib#trace#hl + - NEW spec/dictionary.vim + - tlib#agent#CompleteAgentNames: case insensitive + - tlib#arg#CComplete: --[no-]debug option + - tlib#date#Format: use localtime() if no arg is provided + - NEW tlib#file#IsAbsolute + - NEW tlib#notify#PrintError() + - tlib#trace#Print: FIX s/exec/call/ + - tlib#type#Is() match full type name + - NEW tlib#string#MatchAll() + - Tlibtraceset, tlib#trace#Set(): If no `+` or `-` is prepended, assume `+`. + - tlib#list#Input: fix highlighting for filenames + - tlib#input#ListW: use world.CloseScratch(1) + - tlib#agent#ViewFile: Ignore errors in :exec back + - NEW tlib#agent#EditFileInWindow() + - :Tlibtraceset uses tlib#arg#GetOpts(), i.e. you can set the log file more easily + MD5 checksum: 20a48e225f32b9f58808096a5377af04 +version: "1.22" + + - bump version 1.23 + misc changes + - FIX #24: avoid vim8 features + - tlib#win#GetID(): Alternative implementation sets a window variable to identify the window + - tlib#arg#GetOpts(): If args is a dict, return it + - tlib#file#FilterFiles(): FIX typo + - tlib#trace#Set: Experimental support for log levels + - tlib#input#ListW: make sure to close scratch when <= 1 items are in the list + - FIX #25: set win_nr again; fix some lint warnings + - tlib#progressbar#Init(): returns a statusline definition that can be used for restor + MD5 checksum: c4d6e018cbbd3b286a9b1648b748c1f3 +version: "1.23" + + - bump version 1.23 + misc changes + - FIX #24: avoid vim8 features + - tlib#win#GetID(): Alternative implementation sets a window variable to identify the window + - tlib#arg#GetOpts(): If args is a dict, return it + - tlib#file#FilterFiles(): FIX typo + - tlib#trace#Set: Experimental support for log levels + - tlib#input#ListW: make sure to close scratch when <= 1 items are in the list + - FIX #25: set win_nr again; fix some lint warnings + - tlib#progressbar#Init(): returns a statusline definition that can be used for restor + MD5 checksum: c4d6e018cbbd3b286a9b1648b748c1f3 +version: "1.23" + + - bump version 1.23 + misc changes + - FIX #24: avoid vim8 features + - tlib#win#GetID(): Alternative implementation sets a window variable to identify the window + - tlib#arg#GetOpts(): If args is a dict, return it + - tlib#file#FilterFiles(): FIX typo + - tlib#trace#Set: Experimental support for log levels + - tlib#input#ListW: make sure to close scratch when <= 1 items are in the list + - FIX #25: set win_nr again; fix some lint warnings + - tlib#progressbar#Init(): returns a statusline definition that can be used for restor + MD5 checksum: c4d6e018cbbd3b286a9b1648b748c1f3 +version: "1.23" + + - bump version 1.23 + misc changes + - FIX #24: avoid vim8 features + - tlib#win#GetID(): Alternative implementation sets a window variable to identify the window + - tlib#arg#GetOpts(): If args is a dict, return it + - tlib#file#FilterFiles(): FIX typo + - tlib#trace#Set: Experimental support for log levels + - tlib#input#ListW: make sure to close scratch when <= 1 items are in the list + - FIX #25: set win_nr again; fix some lint warnings + - tlib#progressbar#Init(): returns a statusline definition that can be used for restor + MD5 checksum: c4d6e018cbbd3b286a9b1648b748c1f3 +version: "1.23" + + - bump version 1.23 + misc changes + - FIX #24: avoid vim8 features + - tlib#win#GetID(): Alternative implementation sets a window variable to identify the window + - tlib#arg#GetOpts(): If args is a dict, return it + - tlib#file#FilterFiles(): FIX typo + - tlib#trace#Set: Experimental support for log levels + - tlib#input#ListW: make sure to close scratch when <= 1 items are in the list + - FIX #25: set win_nr again; fix some lint warnings + - tlib#progressbar#Init(): returns a statusline definition that can be used for restor + MD5 checksum: c4d6e018cbbd3b286a9b1648b748c1f3 +version: "1.23" + + - bump version 1.23 + misc changes + - FIX #24: avoid vim8 features + - tlib#win#GetID(): Alternative implementation sets a window variable to identify the window + - tlib#arg#GetOpts(): If args is a dict, return it + - tlib#file#FilterFiles(): FIX typo + - tlib#trace#Set: Experimental support for log levels + - tlib#input#ListW: make sure to close scratch when <= 1 items are in the list + - FIX #25: set win_nr again; fix some lint warnings + - tlib#progressbar#Init(): returns a statusline definition that can be used for restor + MD5 checksum: c4d6e018cbbd3b286a9b1648b748c1f3 +version: "1.23" + + - bump version 1.23 + misc changes + - FIX #24: avoid vim8 features + - tlib#win#GetID(): Alternative implementation sets a window variable to identify the window + - tlib#arg#GetOpts(): If args is a dict, return it + - tlib#file#FilterFiles(): FIX typo + - tlib#trace#Set: Experimental support for log levels + - tlib#input#ListW: make sure to close scratch when <= 1 items are in the list + - FIX #25: set win_nr again; fix some lint warnings + - tlib#progressbar#Init(): returns a statusline definition that can be used for restor + MD5 checksum: c4d6e018cbbd3b286a9b1648b748c1f3 +version: "1.23" + + - bump version 1.23 + misc changes + - FIX #24: avoid vim8 features + - tlib#win#GetID(): Alternative implementation sets a window variable to identify the window + - tlib#arg#GetOpts(): If args is a dict, return it + - tlib#file#FilterFiles(): FIX typo + - tlib#trace#Set: Experimental support for log levels + - tlib#input#ListW: make sure to close scratch when <= 1 items are in the list + - FIX #25: set win_nr again; fix some lint warnings + - tlib#progressbar#Init(): returns a statusline definition that can be used for restor + MD5 checksum: c4d6e018cbbd3b286a9b1648b748c1f3 +version: "1.23" + + - bump version 1.23 + misc changes + - FIX #24: avoid vim8 features + - tlib#win#GetID(): Alternative implementation sets a window variable to identify the window + - tlib#arg#GetOpts(): If args is a dict, return it + - tlib#file#FilterFiles(): FIX typo + - tlib#trace#Set: Experimental support for log levels + - tlib#input#ListW: make sure to close scratch when <= 1 items are in the list + - FIX #25: set win_nr again; fix some lint warnings + - tlib#progressbar#Init(): returns a statusline definition that can be used for restor + MD5 checksum: c4d6e018cbbd3b286a9b1648b748c1f3 +version: "1.23" + diff --git a/sources_non_forked/nginx.vim/LICENSE b/sources_non_forked/tlib/LICENSE.TXT similarity index 99% rename from sources_non_forked/nginx.vim/LICENSE rename to sources_non_forked/tlib/LICENSE.TXT index 536790d3..94a9ed02 100644 --- a/sources_non_forked/nginx.vim/LICENSE +++ b/sources_non_forked/tlib/LICENSE.TXT @@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - Vim plugin that highlights insecure SSL/TLS cipher suites and protocols. - Copyright (C) 2017 Chris Aumann + + Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - nginx.vim Copyright (C) 2017 Chris Aumann + Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @@ -672,4 +672,3 @@ may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . - diff --git a/sources_non_forked/tlib/README b/sources_non_forked/tlib/README index f5a6792e..98a20bb6 100644 --- a/sources_non_forked/tlib/README +++ b/sources_non_forked/tlib/README @@ -1,72 +1,32 @@ -This is a mirror of http://www.vim.org/scripts/script.php?script_id=1863 - This library provides some utility functions. There isn't much need to install it unless another plugin requires you to do so. -The most useful functions provided by this library probably are: +Most of the library is included in autoload files. No autocommands are +created. With the exception of loading ../plugin/02tlib.vim at startup +the library has no impact on startup time or anything else. -tlib#input#List(), tlib#input#ListW() - - Display a list - - Dynamically filter items matching a pattern (somethat like google) - - E.g. you filter for "foo -bar": show all entries containing foo but not bar. - - Select items from a list - - Do stuff - - Developers can define keys that trigger some action with the - selected items - - Demo: http://vimsomnia.blogspot.com/2010/11/selecting-items-from-list-with-tlibs.html +The change-log is included at the bottom of ../plugin/02tlib.vim +(move the cursor over the file name and type gfG) -tlib#input#EditList - + Edit a list (copy, cut, paste, delete, edit ...) - -:TLet VAR = VALUE - Set a variable only if it doesn't already exist. - -:TScratch - Open a scratch buffer (a buffer without a file). - -:TVarArg VAR1, [VAR2, DEFAULT2] ... - Handle "rest" (variable) arguments in functions. - EXAMPLES: - function! Foo(...) - TVarArg ['a', 1], 'b' - echo 'a='. a - echo 'b='. b - endf - -TBrowseOutput COMMAND - Every wondered how to effciently browse the output of a command - without redirecting it to a file? This command takes a command as - argument and presents the output via |tlib#input#List()| so that you - can easily search for a keyword (e.g. the name of a variable or - function) and the like. - - If you press enter, the selected line will be copied to the command - line. Press ESC to cancel browsing. - - EXAMPLES: - TBrowseOutput 20verb TeaseTheCulprit - TBrowseOutput let - TBrowseOutput map +Demo of |tlib#input#List()|: +http://vimsomnia.blogspot.com/2010/11/selecting-items-from-list-with-tlibs.html -Related (small) plugins that utilize tlib and thus provide some degree of uniform user experience: - tbibtools (vimscript #1915): bibtex-related utilities (sort, reformat, list contents ...) - tmarks (vimscript #2594): Browse, place, & delete marks - tmboxbrowser (vimscript #1906): A mbox browser -- Read your e-mails with vim - tmru (vimscript #1864): Most Recently Used Files - trag (vimscript #2033): A slightly language-aware alternative to grep - tregisters (vimscript #2017): List, edit, and run/execute registers/clipboards - tselectbuffer (vimscript #1866): A quick buffer selector/switcher - tselectfiles (vimscript #1865): A quick file selector/browser/explorer (sort of) - ttagecho (vimscript #2055): Show current tag information - ttagcomplete (vimscript #2069): Context-sensitive tags-based completion and code skeletons - ttags (vimscript #2018): Tag list browser (List, filter, preview, jump to tags) - ttoc (vimscript #2014): A regexp-based table of contents of the current buffer - vikitasks (vimscript #2894): Search viki files for tasks and display them in a list +----------------------------------------------------------------------- +Install~ + +Edit the vba file and type: > + + :so % + +See :help vimball for details. If you have difficulties, please make +sure, you have the current version of vimball (vimscript #1502) +installed. -For full details, please see: -http://github.com/tomtom/tlib_vim/blob/master/doc/tlib.txt -Also available via git -http://github.com/tomtom/tlib_vim + + +License: GPLv3 or later + + diff --git a/sources_non_forked/tlib/addon-info.json b/sources_non_forked/tlib/addon-info.json new file mode 100644 index 00000000..35855310 --- /dev/null +++ b/sources_non_forked/tlib/addon-info.json @@ -0,0 +1,9 @@ +{ + "name" : "tlib", + "version" : "dev", + "author" : "Tom Link ", + "maintainer" : "Tom Link ", + "repository" : {"type": "git", "url": "git://github.com/tomtom/tlib_vim.git"}, + "dependencies" : {}, + "description" : "tlib -- A library of vim functions" +} diff --git a/sources_non_forked/tlib/autoload/tinykeymap/map/para_move.vim b/sources_non_forked/tlib/autoload/tinykeymap/map/para_move.vim new file mode 100644 index 00000000..908f5f7d --- /dev/null +++ b/sources_non_forked/tlib/autoload/tinykeymap/map/para_move.vim @@ -0,0 +1,12 @@ +" para_move.vim +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 2012-08-28. +" @Last Change: 2012-08-29. +" @Revision: 3 + +" Move paragraphs +call tinykeymap#EnterMap("para_move", "gp", {'name': 'move paragraph'}) +call tinykeymap#Map("para_move", "j", "silent call tlib#paragraph#Move('Down', '')") +call tinykeymap#Map("para_move", "k", "silent call tlib#paragraph#Move('Up', '')") + diff --git a/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim b/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim index 0bcb6c0e..bfdbda38 100644 --- a/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim +++ b/sources_non_forked/tlib/autoload/tlib/Filter_cnf.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2008-11-25. -" @Last Change: 2014-11-18. -" @Revision: 0.0.114 +" @Last Change: 2017-09-28. +" @Revision: 11.0.114 let s:prototype = tlib#Object#New({'_class': ['Filter_cnf'], 'name': 'cnf'}) "{{{2 let s:prototype.highlight = g:tlib#input#higroup @@ -47,7 +47,8 @@ function! s:prototype.AssessName(world, name) dict "{{{3 " if flt =~# '\u' && a:name =~# flt " let xa += 5 " endif - + let rel = 1.0 + 5.0 * len(flt) / len(a:name) + let xa += float2nr(rel) if a:name =~ '\^'. flt let xa += 4 elseif a:name =~ '\<'. flt @@ -131,7 +132,7 @@ function! s:prototype.ReduceFrontFilter(world) dict "{{{3 if empty(str) let filter = filter[0 : -2] else - let filter = strpart(filter, 0, len(filter) - len(str)) + let filter = tlib#string#Strcharpart(filter, 0, len(filter) - len(str)) endif " TLogVAR str, filter let a:world.filter[0][0] = filter diff --git a/sources_non_forked/tlib/autoload/tlib/World.vim b/sources_non_forked/tlib/autoload/tlib/World.vim index fddf7b2f..0d0094ab 100644 --- a/sources_non_forked/tlib/autoload/tlib/World.vim +++ b/sources_non_forked/tlib/autoload/tlib/World.vim @@ -1,7 +1,8 @@ " @Author: Tom Link (micathom AT gmail com?subject=[vim]) " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 1432 +" @Revision: 1482 + " :filedoc: " A prototype used by |tlib#input#List|. @@ -12,9 +13,15 @@ " See |tlib#input#List()|. TLet g:tlib_inputlist_pct = 50 +" Max height for a horizontal list. +TLet g:tlib_inputlist_max_lines = -1 + +" Max width for a vertical list. +TLet g:tlib_inputlist_max_cols = -1 + " Size of filename columns when listing filenames. " See |tlib#input#List()|. -TLet g:tlib_inputlist_width_filename = '&co / 3' +TLet g:tlib_inputlist_width_filename = '&columns / 3' " TLet g:tlib_inputlist_width_filename = 25 " If true, |tlib#input#List()| will show some indicators about the @@ -92,7 +99,7 @@ let s:prototype = tlib#Object#New({ \ 'timeout_resolution': 2, \ 'tabpagenr': -1, \ 'type': '', - \ 'win_wnr': -1, + \ 'win_id': g:tlib#win#null_id, \ 'win_height': -1, \ 'win_width': -1, \ 'win_pct': 25, @@ -100,7 +107,7 @@ let s:prototype = tlib#Object#New({ " \ 'handlers': [], " \ 'filter_options': '\c', -function! tlib#World#New(...) +function! tlib#World#New(...) abort let object = s:prototype.New(a:0 >= 1 ? a:1 : {}) call object.SetMatchMode(tlib#var#Get('tlib#input#filter_mode', 'g', 'cnf')) return object @@ -108,8 +115,8 @@ endf " :nodoc: -function! s:prototype.Set_display_format(value) dict "{{{3 - if a:value == 'filename' +function! s:prototype.Set_display_format(value) dict abort "{{{3 + if a:value ==# 'filename' call self.Set_highlight_filename() let self.display_format = 'world.FormatFilename(%s)' else @@ -119,14 +126,14 @@ endf " :nodoc: -function! s:prototype.DisplayFormat(list) dict "{{{3 +function! s:prototype.DisplayFormat(list) dict abort "{{{3 let display_format = self.display_format if !empty(display_format) if has_key(self, 'InitFormatName') call self.InitFormatName() endif let cache = self.fmt_display - " TLogVAR display_format, fmt_entries + Tlibtrace 'tlib', display_format return map(copy(a:list), 'self.FormatName(cache, display_format, v:val)') else return a:list @@ -135,15 +142,15 @@ endf " :nodoc: -function! s:prototype.Set_highlight_filename() dict "{{{3 +function! s:prototype.Set_highlight_filename() dict abort "{{{3 let self.tlib_UseInputListScratch = 'call world.Highlight_filename()' endf -if g:tlib#input#format_filename == 'r' +if g:tlib#input#format_filename ==# 'r' " :nodoc: - function! s:prototype.Highlight_filename() dict "{{{3 + function! s:prototype.Highlight_filename() dict abort "{{{3 syntax match TLibDir /\s\+\zs.\{-}[\/]\ze[^\/]\+$/ hi def link TLibDir Directory syntax match TLibFilename /[^\/]\+$/ @@ -151,16 +158,16 @@ if g:tlib#input#format_filename == 'r' endf " :nodoc: - function! s:prototype.FormatFilename(file) dict "{{{3 + function! s:prototype.FormatFilename(file) dict abort "{{{3 if !has_key(self.fmt_options, 'maxlen') - let maxco = &co - len(len(self.base)) - eval(g:tlib#input#filename_padding_r) + let maxco = &columns - len(len(self.base)) - eval(g:tlib#input#filename_padding_r) let maxfi = max(map(copy(self.base), 'strwidth(v:val)')) let self.fmt_options.maxlen = min([maxco, maxfi]) - " TLogVAR maxco, maxfi, self.fmt_options.maxlen + Tlibtrace 'tlib', maxco, maxfi, self.fmt_options.maxlen endif let max = self.fmt_options.maxlen if len(a:file) > max - let filename = '...' . strpart(a:file, len(a:file) - max + 3) + let filename = '...' . tlib#string#Strcharpart(a:file, len(a:file) - max + 3) else let filename = printf('% '. max .'s', a:file) endif @@ -170,16 +177,17 @@ if g:tlib#input#format_filename == 'r' else " :nodoc: - function! s:prototype.Highlight_filename() dict "{{{3 + function! s:prototype.Highlight_filename() dict abort "{{{3 " let self.width_filename = 1 + eval(g:tlib_inputlist_width_filename) - " TLogVAR self.base + Tlibtrace 'tlib', self.base let self.width_filename = min([ - \ get(self, 'width_filename', &co), - \ empty(g:tlib#input#filename_max_width) ? &co : eval(g:tlib#input#filename_max_width), + \ get(self, 'width_filename', &columns), + \ empty(g:tlib#input#filename_max_width) ? &columns : eval(g:tlib#input#filename_max_width), \ max(map(copy(self.base), 'strwidth(matchstr(v:val, "[^\\/]*$"))')) \ ]) " TLogVAR self.width_filename - exec 'syntax match TLibDir /\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) \zs\(\(\a:\|\.\.\|\.\.\..\{-}\)\?[\/][^&<>*|]\{-}\)\?[^\/]\+$/ contained containedin=TLibMarker contains=TLibFilename' + " exec 'syntax match TLibDir /\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) \zs\(\(\a:\|\.\.\|\.\.\..\{-}\)\?[\/][^&<>*|]\{-}\)\?[^\/]\+$/ contained containedin=TLibMarker contains=TLibFilename' + exec 'syntax match TLibDir /\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) \zs[^&<>*|]*$/ contained containedin=TLibMarker contains=TLibFilename' exec 'syntax match TLibMarker /\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) \S.*$/ contains=TLibDir' " exec 'syntax match TLibDir /\(|\|\[.\{-}\]\) \zs\(\(\a:\|\.\.\|\.\.\..\{-}\)\?[\/][^&<>*|]\{-}\)\?[^\/]\+$/ contained containedin=TLibMarker contains=TLibFilename' " exec 'syntax match TLibMarker /\(|\|\[.\{-}\]\) \S.*$/ contains=TLibDir' @@ -188,7 +196,7 @@ else hi def link TLibDir Directory hi def link TLibFilename NonText " :nodoc: - function! self.Highlighter(rx) dict + function! self.Highlighter(rx) dict abort let rx = '/\c\%>'. (1 + self.width_filename) .'c \(|\|\[[^]]*\]\) .\{-}\zs'. escape(a:rx, '/') .'/' exec 'match' self.matcher.highlight rx endf @@ -196,18 +204,18 @@ else " :nodoc: - function! s:prototype.UseFilenameIndicators() dict "{{{3 + function! s:prototype.UseFilenameIndicators() dict abort "{{{3 return g:tlib_inputlist_filename_indicators || has_key(self, 'filename_indicators') endf " :nodoc: - function! s:prototype.InitFormatName() dict "{{{3 + function! s:prototype.InitFormatName() dict abort "{{{3 if self.UseFilenameIndicators() let self._buffers = {} for bufnr in range(1, bufnr('$')) let filename = fnamemodify(bufname(bufnr), ':p') - " TLogVAR filename + Tlibtrace 'tlib', filename let bufdef = { \ 'bufnr': bufnr, \ } @@ -222,8 +230,8 @@ else " :nodoc: - function! s:prototype.FormatFilename(file) dict "{{{3 - " TLogVAR a:file + function! s:prototype.FormatFilename(file) dict abort "{{{3 + Tlibtrace 'tlib', a:file let width = self.width_filename let split = match(a:file, '[/\\]\zs[^/\\]\+$') if split == -1 @@ -231,15 +239,15 @@ else let dname = a:file else let fname = strpart(a:file, split) - " let dname = strpart(a:file, 0, split - 1) + " let dname = tlib#string#Strcharpart(a:file, 0, split - 1) let dname = a:file endif if strwidth(fname) > width - let fname = strpart(fname, 0, width - 3) .'...' + let fname = tlib#string#Strcharpart(fname, 0, width - 3) .'...' endif - let dnmax = &co - max([width, strwidth(fname)]) - 8 - self.index_width - &fdc + let dnmax = &columns - max([width, strwidth(fname)]) - 8 - self.index_width - &foldcolumn let use_indicators = self.UseFilenameIndicators() - " TLogVAR use_indicators + Tlibtrace 'tlib', use_indicators let marker = [] if use_indicators call insert(marker, '[') @@ -247,7 +255,7 @@ else let bufdef = get(self._buffers, a:file, {}) " let bnr = bufnr(a:file) let bnr = get(bufdef, 'bufnr', -1) - " TLogVAR a:file, bnr, self.bufnr + Tlibtrace 'tlib', a:file, bnr, self.bufnr if bnr != -1 if bnr == self.bufnr call add(marker, '%') @@ -257,7 +265,7 @@ else if get(bufdef, '&modified', 0) call add(marker, '+') endif - if get(bufdef, '&bufhidden', '') == 'hide' + if get(bufdef, '&bufhidden', '') ==# 'hide' call add(marker, 'h') endif " if !get(bufdef, '&buflisted', 1) @@ -284,9 +292,9 @@ else let dnmax -= len(markers) endif if strwidth(dname) > dnmax - let dname = '...'. strpart(dname, len(dname) - dnmax) + let dname = '...'. tlib#string#Strcharpart(dname, len(dname) - dnmax) endif - return printf("%-*s %s %s", + return printf('%-*s %s %s', \ self.width_filename + len(fname) - strwidth(fname), \ fname, markers, dname) endf @@ -295,15 +303,15 @@ endif " :nodoc: -function! s:prototype.GetSelectedItems(current) dict "{{{3 - " TLogVAR a:current +function! s:prototype.GetSelectedItems(current) dict abort "{{{3 + Tlibtrace 'tlib', a:current if stridx(self.type, 'i') != -1 let rv = copy(self.sel_idx) else let rv = map(copy(self.sel_idx), 'self.GetBaseItem(v:val)') endif if !empty(a:current) - " TLogVAR a:current, rv, type(a:current) + Tlibtrace 'tlib', a:current, rv, type(a:current) if tlib#type#IsNumber(a:current) || tlib#type#IsString(a:current) call s:InsertSelectedItems(rv, a:current) elseif tlib#type#IsList(a:current) @@ -319,16 +327,16 @@ function! s:prototype.GetSelectedItems(current) dict "{{{3 " TAssert empty(rv) || rv[0] == a:current if stridx(self.type, 'i') != -1 if !empty(self.index_table) - " TLogVAR rv, self.index_table + Tlibtrace 'tlib', rv, self.index_table call map(rv, 'self.index_table[v:val - 1]') - " TLogVAR rv + Tlibtrace 'tlib', rv endif endif return rv endf -function! s:InsertSelectedItems(rv, current) "{{{3 +function! s:InsertSelectedItems(rv, current) abort "{{{3 let ci = index(a:rv, a:current) if ci != -1 call remove(a:rv, ci) @@ -338,17 +346,17 @@ endf " :nodoc: -function! s:prototype.SelectItemsByNames(mode, items) dict "{{{3 +function! s:prototype.SelectItemsByNames(mode, items) dict abort "{{{3 for item in a:items let bi = index(self.base, item) + 1 - " TLogVAR item, bi + Tlibtrace 'tlib', item, bi if bi > 0 let si = index(self.sel_idx, bi) - " TLogVAR self.sel_idx - " TLogVAR si + Tlibtrace 'tlib', self.sel_idx + Tlibtrace 'tlib', si if si == -1 call add(self.sel_idx, bi) - elseif a:mode == 'toggle' + elseif a:mode ==# 'toggle' call remove(self.sel_idx, si) endif endif @@ -358,21 +366,21 @@ endf " :nodoc: -function! s:prototype.SelectItem(mode, index) dict "{{{3 - " TLogVAR a:mode, a:index +function! s:prototype.SelectItem(mode, index) dict abort "{{{3 + Tlibtrace 'tlib', a:mode, a:index let bi = self.GetBaseIdx(a:index) " if self.RespondTo('MaySelectItem') " if !self.MaySelectItem(bi) " return 0 " endif " endif - " TLogVAR bi + Tlibtrace 'tlib', bi let si = index(self.sel_idx, bi) - " TLogVAR self.sel_idx - " TLogVAR si + Tlibtrace 'tlib', self.sel_idx + Tlibtrace 'tlib', si if si == -1 call add(self.sel_idx, bi) - elseif a:mode == 'toggle' + elseif a:mode ==# 'toggle' call remove(self.sel_idx, si) endif return 1 @@ -388,26 +396,26 @@ endf " :nodoc: -function! s:prototype.FormatArgs(format_string, arg) dict "{{{3 +function! s:prototype.FormatArgs(format_string, arg) dict abort "{{{3 let nargs = len(substitute(a:format_string, '%%\|[^%]', '', 'g')) return [a:format_string] + repeat([string(a:arg)], nargs) endf " :nodoc: -function! s:prototype.GetRx(filter) dict "{{{3 - return '\('. join(filter(copy(a:filter), 'v:val[0] != "!"'), '\|') .'\)' +function! s:prototype.GetRx(filter) dict abort "{{{3 + return '\('. join(filter(copy(a:filter), 'v:val[0] !=# "!"'), '\|') .'\)' endf " :nodoc: -function! s:prototype.GetRx0(...) dict "{{{3 +function! s:prototype.GetRx0(...) dict abort "{{{3 exec tlib#arg#Let(['negative']) let rx0 = [] for filter in self.filter - " TLogVAR filter + Tlibtrace 'tlib', filter let rx = join(reverse(filter(copy(filter), '!empty(v:val)')), '\|') - " TLogVAR rx + Tlibtrace 'tlib', rx if !empty(rx) && (negative ? rx[0] == g:tlib#input#not : rx[0] != g:tlib#input#not) call add(rx0, rx) endif @@ -422,18 +430,16 @@ endf " :nodoc: -function! s:prototype.FormatName(cache, format, value) dict "{{{3 - " TLogVAR a:format, a:value - " TLogDBG has_key(self.fmt_display, a:value) +function! s:prototype.FormatName(cache, format, value) dict abort "{{{3 + Tlibtrace 'tlib', a:format, a:value if has_key(a:cache, a:value) - " TLogDBG "cached" return a:cache[a:value] else let world = self let ftpl = self.FormatArgs(a:format, a:value) - let fn = call(function("printf"), ftpl) + let fn = call(function('printf'), ftpl) let fmt = eval(fn) - " TLogVAR ftpl, fn, fmt + Tlibtrace 'tlib', ftpl, fn, fmt let a:cache[a:value] = fmt return fmt endif @@ -441,29 +447,29 @@ endf " :nodoc: -function! s:prototype.GetItem(idx) dict "{{{3 +function! s:prototype.GetItem(idx) dict abort "{{{3 return self.list[a:idx - 1] endf " :nodoc: -function! s:prototype.GetListIdx(baseidx) dict "{{{3 +function! s:prototype.GetListIdx(baseidx) dict abort "{{{3 " if empty(self.index_table) let baseidx = a:baseidx " else " let baseidx = 0 + self.index_table[a:baseidx - 1] - " " TLogVAR a:baseidx, baseidx, self.index_table + " Tlibtrace 'tlib', a:baseidx, baseidx, self.index_table " endif let rv = index(self.table, baseidx) - " TLogVAR rv, self.table + Tlibtrace 'tlib', rv, self.table return rv endf " :nodoc: " The first index is 1. -function! s:prototype.GetBaseIdx(idx) dict "{{{3 - " TLogVAR a:idx, self.table, self.index_table +function! s:prototype.GetBaseIdx(idx) dict abort "{{{3 + Tlibtrace 'tlib', a:idx, self.table, self.index_table if !empty(self.table) && a:idx > 0 && a:idx <= len(self.table) return self.table[a:idx - 1] else @@ -473,7 +479,7 @@ endf " :nodoc: -function! s:prototype.GetBaseIdx0(idx) dict "{{{3 +function! s:prototype.GetBaseIdx0(idx) dict abort "{{{3 let idx0 = self.GetBaseIdx(a:idx) - 1 if idx0 < 0 call tlib#notify#Echo('TLIB: Internal Error: GetBaseIdx0: idx0 < 0', 'WarningMsg') @@ -483,19 +489,19 @@ endf " :nodoc: -function! s:prototype.GetBaseItem(idx) dict "{{{3 +function! s:prototype.GetBaseItem(idx) dict abort "{{{3 return self.base[a:idx - 1] endf " :nodoc: -function! s:prototype.SetBaseItem(idx, item) dict "{{{3 +function! s:prototype.SetBaseItem(idx, item) dict abort "{{{3 let self.base[a:idx - 1] = a:item endf " :nodoc: -function! s:prototype.GetLineIdx(lnum) dict "{{{3 +function! s:prototype.GetLineIdx(lnum) dict abort "{{{3 let line = getline(a:lnum) let prefidx = substitute(matchstr(line, '^\d\+\ze[*:]'), '^0\+', '', '') return prefidx @@ -503,25 +509,24 @@ endf " :nodoc: -function! s:prototype.SetPrefIdx() dict "{{{3 +function! s:prototype.SetPrefIdx() dict abort "{{{3 " let pref = sort(range(1, self.llen), 'self.SortPrefs') " let self.prefidx = get(pref, 0, self.initial_index) let pref_idx = -1 let pref_weight = -1 - " TLogVAR self.filter_pos, self.filter_neg - " let t0 = localtime() " DBG + Tlibtrace 'tlib', self.filter_pos, self.filter_neg + let t0 = localtime() for idx in range(1, self.llen) let item = self.GetItem(idx) let weight = self.matcher.AssessName(self, item) - " TLogVAR item, weight + Tlibtrace 'tlib', item, weight if weight > pref_weight let pref_idx = idx let pref_weight = weight endif endfor - " TLogVAR localtime() - t0 - " TLogVAR pref_idx - " TLogDBG self.GetItem(pref_idx) + Tlibtrace 'tlib', localtime() - t0 + Tlibtrace 'tlib', pref_idx if pref_idx == -1 let self.prefidx = self.initial_index else @@ -531,16 +536,16 @@ endf " " :nodoc: -" function! s:prototype.GetCurrentItem() dict "{{{3 +" function! s:prototype.GetCurrentItem() dict abort "{{{3 " let idx = self.prefidx -" " TLogVAR idx +" Tlibtrace 'tlib', idx " if stridx(self.type, 'i') != -1 " return idx " elseif !empty(self.list) " if len(self.list) >= idx " let idx1 = idx - 1 " let rv = self.list[idx - 1] -" " TLogVAR idx, idx1, rv, self.list +" Tlibtrace 'tlib', idx, idx1, rv, self.list " return rv " endif " else @@ -550,19 +555,19 @@ endf " :nodoc: -function! s:prototype.CurrentItem() dict "{{{3 +function! s:prototype.CurrentItem() dict abort "{{{3 if stridx(self.type, 'i') != -1 return self.GetBaseIdx(self.llen == 1 ? 1 : self.prefidx) else if self.llen == 1 - " TLogVAR self.llen + Tlibtrace 'tlib', self.llen return self.list[0] elseif self.prefidx > 0 - " TLogVAR self.prefidx + Tlibtrace 'tlib', self.prefidx " return self.GetCurrentItem() if len(self.list) >= self.prefidx let rv = self.list[self.prefidx - 1] - " TLogVAR idx, rv, self.list + Tlibtrace 'tlib', self.prefidx, len(self.list), rv return rv endif else @@ -573,29 +578,29 @@ endf " :nodoc: -function! s:prototype.FilterRxPrefix() dict "{{{3 +function! s:prototype.FilterRxPrefix() dict abort "{{{3 return self.matcher.FilterRxPrefix() endf " :nodoc: -function! s:prototype.SetFilter() dict "{{{3 +function! s:prototype.SetFilter() dict abort "{{{3 " let mrx = '\V'. (a:0 >= 1 && a:1 ? '\C' : '') let mrx = self.FilterRxPrefix() . self.filter_options let self.filter_pos = [] let self.filter_neg = [] - " TLogVAR mrx, self.filter + Tlibtrace 'tlib', mrx, self.filter for filter in self.filter - " TLogVAR filter + Tlibtrace 'tlib', filter let rx = join(reverse(filter(copy(filter), '!empty(v:val)')), '\|') - " TLogVAR rx + Tlibtrace 'tlib', rx if !empty(rx) - if rx =~ '\u' + if rx =~# '\u' let mrx1 = mrx .'\C' else let mrx1 = mrx endif - " TLogVAR rx + Tlibtrace 'tlib', rx if rx[0] == g:tlib#input#not if len(rx) > 1 call add(self.filter_neg, mrx1 .'\('. rx[1:-1] .'\)') @@ -605,17 +610,17 @@ function! s:prototype.SetFilter() dict "{{{3 endif endif endfor - " TLogVAR self.filter_pos, self.filter_neg + Tlibtrace 'tlib', self.filter_pos, self.filter_neg endf " :nodoc: -function! s:prototype.IsValidFilter() dict "{{{3 +function! s:prototype.IsValidFilter() dict abort "{{{3 let last = self.FilterRxPrefix() .'\('. self.filter[0][0] .'\)' Tlibtrace 'tlib', last - " TLogVAR last + Tlibtrace 'tlib', last try - let a = match("", last) + let a = match('', last) return 1 catch Tlibtrace 'tlib', v:exception @@ -625,8 +630,8 @@ endf " :nodoc: -function! s:prototype.SetMatchMode(match_mode) dict "{{{3 - " TLogVAR a:match_mode +function! s:prototype.SetMatchMode(match_mode) dict abort "{{{3 + Tlibtrace 'tlib', a:match_mode if !empty(a:match_mode) unlet self.matcher try @@ -639,31 +644,31 @@ function! s:prototype.SetMatchMode(match_mode) dict "{{{3 endf -" function! s:prototype.Match(text) dict "{{{3 +" function! s:prototype.Match(text) dict abort "{{{3 " return self.matcher.Match(self, text) " endf " :nodoc: -function! s:prototype.MatchBaseIdx(idx) dict "{{{3 +function! s:prototype.MatchBaseIdx(idx) dict abort "{{{3 let text = self.GetBaseItem(a:idx) if !empty(self.filter_format) let text = self.FormatName(self.fmt_filter, self.filter_format, text) endif - " TLogVAR text + Tlibtrace 'tlib', text " return self.Match(text) return self.matcher.Match(self, text) endf " :nodoc: -function! s:prototype.BuildTableList() dict "{{{3 - " let time0 = str2float(reltimestr(reltime())) " DBG - " TLogVAR time0 +function! s:prototype.BuildTableList() dict abort "{{{3 + let time0 = str2float(reltimestr(reltime())) + Tlibtrace 'tlib', time0 call self.SetFilter() - " TLogVAR self.filter_neg, self.filter_pos + Tlibtrace 'tlib', self.filter_neg, self.filter_pos let self.table = range(1, len(self.base)) - " TLogVAR self.filtered_items + Tlibtrace 'tlib', self.filtered_items let copy_base = 1 if !empty(self.filtered_items) let self.table = filter(self.table, 'index(self.filtered_items, v:val) != -1') @@ -682,8 +687,8 @@ endf " :nodoc: -function! s:prototype.ReduceFilter() dict "{{{3 - " TLogVAR self.filter +function! s:prototype.ReduceFilter() dict abort "{{{3 + Tlibtrace 'tlib', self.filter let reduced = 0 while !reduced if self.filter[0] == [''] && len(self.filter) > 1 @@ -702,7 +707,7 @@ endf " :nodoc: " filter is either a string or a list of list of strings. -function! s:prototype.SetInitialFilter(filter) dict "{{{3 +function! s:prototype.SetInitialFilter(filter) dict abort "{{{3 " let self.initial_filter = [[''], [a:filter]] Tlibtrace 'tlib', a:filter if type(a:filter) == 3 @@ -714,8 +719,8 @@ endf " :nodoc: -function! s:prototype.PopFilter() dict "{{{3 - " TLogVAR self.filter +function! s:prototype.PopFilter() dict abort "{{{3 + Tlibtrace 'tlib', self.filter if len(self.filter[0]) > 1 call remove(self.filter[0], 0) elseif len(self.filter) > 1 @@ -727,17 +732,17 @@ endf " :nodoc: -function! s:prototype.FilterIsEmpty() dict "{{{3 - " TLogVAR self.filter +function! s:prototype.FilterIsEmpty() dict abort "{{{3 + Tlibtrace 'tlib', self.filter return self.filter == copy(self.initial_filter) endf " :nodoc: -function! s:prototype.DisplayFilter() dict "{{{3 +function! s:prototype.DisplayFilter() dict abort "{{{3 let filter1 = copy(self.filter) call filter(filter1, 'v:val != [""]') - " TLogVAR self.matcher['_class'] + Tlibtrace 'tlib', self.matcher['_class'] let rv = self.matcher.DisplayFilter(filter1) let rv = self.CleanFilter(rv) return rv @@ -745,29 +750,29 @@ endf " :nodoc: -function! s:prototype.SetFrontFilter(pattern) dict "{{{3 +function! s:prototype.SetFrontFilter(pattern) dict abort "{{{3 call self.matcher.SetFrontFilter(self, a:pattern) endf " :nodoc: -function! s:prototype.PushFrontFilter(char) dict "{{{3 +function! s:prototype.PushFrontFilter(char) dict abort "{{{3 call self.matcher.PushFrontFilter(self, a:char) endf " :nodoc: -function! s:prototype.CleanFilter(filter) dict "{{{3 +function! s:prototype.CleanFilter(filter) dict abort "{{{3 return self.matcher.CleanFilter(a:filter) endf " :nodoc: -function! s:prototype.UseScratch() dict "{{{3 +function! s:prototype.UseScratch() dict abort "{{{3 " if type(self.scratch) != 0 && get(self, 'buffer_local', 1) " if self.scratch != fnamemodify(self.scratch, ':p') " let self.scratch = tlib#file#Join([expand('%:p:h'), self.scratch]) - " " TLogVAR self.scratch + " Tlibtrace 'tlib', self.scratch " endif " " let self.scratch_hidden = 'wipe' " endif @@ -780,15 +785,15 @@ endf " :nodoc: -function! s:prototype.CloseScratch(...) dict "{{{3 +function! s:prototype.CloseScratch(...) dict abort "{{{3 TVarArg ['reset_scratch', 0] " TVarArg ['reset_scratch', 1] - " TLogVAR reset_scratch + Tlibtrace 'tlib', reset_scratch if self.sticky return 0 else let rv = tlib#scratch#CloseScratch(self, reset_scratch) - " TLogVAR rv + Tlibtrace 'tlib', rv if rv call self.SwitchWindow('win') endif @@ -798,7 +803,7 @@ endf " :nodoc: -function! s:prototype.Initialize() dict "{{{3 +function! s:prototype.Initialize() dict abort "{{{3 let self.initialized = 1 call self.SetOrigin(1) call self.Reset(1) @@ -812,7 +817,7 @@ endf " :nodoc: -function! s:prototype.Leave() dict "{{{3 +function! s:prototype.Leave() dict abort "{{{3 if !empty(self.cache_var) exec 'let '. self.cache_var .' = self' endif @@ -823,7 +828,7 @@ endf " :nodoc: -function! s:prototype.UseInputListScratch() dict "{{{3 +function! s:prototype.UseInputListScratch() dict abort "{{{3 let scratch = self.UseScratch() if !exists('b:tlib_list_init') call tlib#autocmdgroup#Init() @@ -832,7 +837,7 @@ function! s:prototype.UseInputListScratch() dict "{{{3 let b:tlib_list_init = 1 endif if !exists('w:tlib_list_init') - " TLogVAR scratch + Tlibtrace 'tlib', scratch if has_key(self, 'index_next_syntax') if type(self.index_next_syntax) == 1 exec 'syntax match InputlListIndex /^\d\+:\s/ nextgroup='. self.index_next_syntax @@ -864,9 +869,9 @@ endf " s:prototype.Reset(?initial=0) " :nodoc: -function! s:prototype.Reset(...) dict "{{{3 +function! s:prototype.Reset(...) dict abort "{{{3 TVarArg ['initial', 0] - " TLogVAR initial + Tlibtrace 'tlib', initial Tlibtrace 'tlib', initial, self.initial_filter let self.state = 'display' let self.offset = 1 @@ -885,23 +890,22 @@ endf " :nodoc: -function! s:prototype.ResetSelected() dict "{{{3 +function! s:prototype.ResetSelected() dict abort "{{{3 let self.sel_idx = [] endf " :nodoc: -function! s:prototype.Retrieve(anyway) dict "{{{3 - " TLogVAR a:anyway, self.base - " TLogDBG (a:anyway || empty(self.base)) +function! s:prototype.Retrieve(anyway) dict abort "{{{3 + Tlibtrace 'tlib', a:anyway, self.base if (a:anyway || empty(self.base)) let ra = self.retrieve_eval - " TLogVAR ra + Tlibtrace 'tlib', ra if !empty(ra) let back = self.SwitchWindow('win') let world = self let self.base = eval(ra) - " TLogVAR self.base + Tlibtrace 'tlib', self.base exec back return 1 endif @@ -910,25 +914,25 @@ function! s:prototype.Retrieve(anyway) dict "{{{3 endf -function! s:FormatHelp(help) "{{{3 - " TLogVAR a:help +function! s:FormatHelp(help) abort "{{{3 + Tlibtrace 'tlib', a:help let max = [0, 0] for item in a:help - " TLogVAR item + Tlibtrace 'tlib', item if type(item) == 3 let itemlen = map(copy(item), 'strwidth(v:val)') - " TLogVAR itemlen + Tlibtrace 'tlib', itemlen let max = map(range(2), 'max[v:val] >= itemlen[v:val] ? max[v:val] : itemlen[v:val]') endif unlet item endfor - " TLogVAR max + Tlibtrace 'tlib', max let cols = float2nr((winwidth(0) - &foldcolumn - 1) / (max[0] + max[1] + 2)) if cols < 1 let cols = 1 endif let fmt = printf('%%%ds: %%-%ds', max[0], max[1]) - " TLogVAR cols, fmt + Tlibtrace 'tlib', cols, fmt let help = [] let idx = -1 let maxidx = len(a:help) @@ -956,31 +960,31 @@ function! s:FormatHelp(help) "{{{3 call add(help, a:help[idx]) endif endwh - " TLogVAR help + Tlibtrace 'tlib', help return help endf -function! s:FormatHelpItem(item, fmt) "{{{3 +function! s:FormatHelpItem(item, fmt) abort "{{{3 let args = [join(repeat([a:fmt], len(a:item)), ' ')] for item in a:item - " TLogVAR item + Tlibtrace 'tlib', item let args += item endfor - " TLogVAR args + Tlibtrace 'tlib', args return call('printf', args) endf " :nodoc: -function! s:prototype.InitHelp() dict "{{{3 +function! s:prototype.InitHelp() dict abort "{{{3 return [] endf " :nodoc: -function! s:prototype.PushHelp(...) dict "{{{3 - " TLogVAR a:000 +function! s:prototype.PushHelp(...) dict abort "{{{3 + Tlibtrace 'tlib', a:000 if a:0 == 1 if type(a:1) == 3 let self.temp_lines += a:1 @@ -990,14 +994,14 @@ function! s:prototype.PushHelp(...) dict "{{{3 elseif a:0 == 2 call add(self.temp_lines, a:000) else - throw "TLIB: PushHelp: Wrong number of arguments: ". string(a:000) + throw 'TLIB: PushHelp: Wrong number of arguments: '. string(a:000) endif - " TLogVAR helpstring + Tlibtrace 'tlib', helpstring endf " :nodoc: -function! s:prototype.DisplayHelp() dict "{{{3 +function! s:prototype.DisplayHelp() dict abort "{{{3 let self.temp_lines = self.InitHelp() call self.PushHelp('', self.key_mode == 'default' ? 'Abort' : 'Reset keymap') call self.PushHelp('Enter, ', 'Pick the current item') @@ -1026,14 +1030,14 @@ function! s:prototype.DisplayHelp() dict "{{{3 endif endif - " TLogVAR len(self.temp_lines) + Tlibtrace 'tlib', len(self.temp_lines) call self.matcher.Help(self) - " TLogVAR self.key_mode + Tlibtrace 'tlib', self.key_mode for handler in values(self.key_map[self.key_mode]) - " TLogVAR handler + Tlibtrace 'tlib', handler let key = get(handler, 'key_name', '') - " TLogVAR key + Tlibtrace 'tlib', key if !empty(key) let desc = get(handler, 'help', '') if empty(desc) @@ -1051,7 +1055,7 @@ function! s:prototype.DisplayHelp() dict "{{{3 call self.PushHelp(self.help_extra) endif - " TLogVAR len(self.temp_lines) + Tlibtrace 'tlib', len(self.temp_lines) call self.PushHelp([ \ '', \ 'Matches at word boundaries are prioritized.', @@ -1061,7 +1065,7 @@ function! s:prototype.DisplayHelp() dict "{{{3 endf -function! s:prototype.PrintLines() dict "{{{3 +function! s:prototype.PrintLines() dict abort "{{{3 let self.temp_prompt = ['Press any key to continue.', 'Question'] call tlib#buffer#DeleteRange('1', '$') call append(0, self.temp_lines) @@ -1073,31 +1077,35 @@ endf " :nodoc: -function! s:prototype.Resize(hsize, vsize) dict "{{{3 - " TLogVAR self.scratch_vertical, a:hsize, a:vsize +function! s:prototype.Resize(hsize, vsize) dict abort "{{{3 + Tlibtrace 'tlib', self.scratch_vertical, a:hsize, a:vsize let world_resize = '' let winpos = '' let scratch_split = get(self, 'scratch_split', 1) - " TLogVAR scratch_split + Tlibtrace 'tlib', scratch_split if scratch_split > 0 if self.scratch_vertical if a:vsize let world_resize = 'vert resize '. a:vsize let winpos = tlib#fixes#Winpos() " let w:winresize = {'v': a:vsize} - setlocal winfixwidth + " setlocal winfixwidth endif else if a:hsize let world_resize = 'resize '. a:hsize " let w:winresize = {'h': a:hsize} - setlocal winfixheight + " setlocal winfixheight endif endif endif if !empty(world_resize) - " TLogVAR world_resize, winpos + Tlibtrace 'tlib', world_resize, winpos + setlocal nowinfixheight + setlocal nowinfixwidth exec world_resize + setlocal winfixheight + setlocal winfixwidth if !empty(winpos) exec winpos endif @@ -1107,31 +1115,36 @@ endf " :nodoc: -function! s:prototype.GetResize(size) dict "{{{3 +function! s:prototype.GetResize(size) dict abort "{{{3 let resize0 = get(self, 'resize', 0) let resize = empty(resize0) ? 0 : eval(resize0) - " TLogVAR resize0, resize + Tlibtrace 'tlib', resize0, resize let resize = resize == 0 ? a:size : min([a:size, resize]) " let min = self.scratch_vertical ? &cols : &lines let min1 = (self.scratch_vertical ? self.win_width : self.win_height) * g:tlib_inputlist_pct let min2 = (self.scratch_vertical ? &columns : &lines) * self.win_pct + let min3 = &previewheight let min = max([min1, min2]) - let resize = min([resize, (min / 100)]) - " TLogVAR resize, a:size, min, min1, min2 + let ns = [resize, (min / 100)] + let maxn = self.scratch_vertical ? g:tlib_inputlist_max_cols : g:tlib_inputlist_max_lines + if maxn > 0 + call add(ns, maxn) + endif + let resize = min(ns) + Tlibtrace 'tlib', resize, a:size, min, min1, min2 return resize endf " function! s:prototype.DisplayList(?query=self.Query(), ?list=[]) " :nodoc: -function! s:prototype.DisplayList(...) dict "{{{3 - " TLogVAR self.state +function! s:prototype.DisplayList(...) dict abort "{{{3 + Tlibtrace 'tlib', self.state let query = a:0 >= 1 ? a:1 : self.Query() let list = a:0 >= 2 ? a:2 : [] - " TLogVAR query, len(list) - " TLogDBG 'len(list) = '. len(list) + Tlibtrace 'tlib', query, len(list) call self.UseScratch() - " TLogVAR self.scratch + Tlibtrace 'tlib', self.scratch " TAssert IsNotEmpty(self.scratch) if self.state == 'scroll' call self.ScrollToOffset() @@ -1142,12 +1155,12 @@ function! s:prototype.DisplayList(...) dict "{{{3 call self.PrintLines() call self.SetStatusline(query) else - " TLogVAR query + Tlibtrace 'tlib', query " let ll = len(list) let ll = self.llen " let x = len(ll) + 1 let x = self.index_width + 1 - " TLogVAR ll + Tlibtrace 'tlib', ll if self.state =~ '\' call self.Resize(self.GetResize(ll), eval(get(self, 'resize_vertical', 0))) call tlib#normal#WithRegister('gg"tdG', 't') @@ -1155,17 +1168,17 @@ function! s:prototype.DisplayList(...) dict "{{{3 let lines = map(lines, 'substitute(v:val, ''[[:cntrl:][:space:]]'', " ", "g")') let w = winwidth(0) - &fdc " let w = winwidth(0) - &fdc - 1 - let lines = map(lines, 'printf("%-'. w .'.'. w .'s", v:val)') - " TLogVAR lines + let lines = map(lines, 'printf("%-'. w .'.'. w .'S", v:val)') + Tlibtrace 'tlib', lines call append(0, lines) call tlib#normal#WithRegister('G"tddgg', 't') endif - " TLogVAR self.prefidx + Tlibtrace 'tlib', self.prefidx let base_pref = self.GetBaseIdx(self.prefidx) - " TLogVAR base_pref + Tlibtrace 'tlib', base_pref if self.state =~ '\' call filter(b:tlibDisplayListMarks, 'index(self.sel_idx, v:val) == -1 && v:val != base_pref') - " TLogVAR b:tlibDisplayListMarks + Tlibtrace 'tlib', b:tlibDisplayListMarks call map(b:tlibDisplayListMarks, 'self.DisplayListMark(x, v:val, ":")') " let b:tlibDisplayListMarks = map(copy(self.sel_idx), 'self.DisplayListMark(x, v:val, "#")') " call add(b:tlibDisplayListMarks, self.prefidx) @@ -1176,10 +1189,10 @@ function! s:prototype.DisplayList(...) dict "{{{3 call self.DisplayListMark(x, base_pref, '*') call self.SetOffset() call self.SetStatusline(query) - " TLogVAR self.offset + Tlibtrace 'tlib', self.offset call self.ScrollToOffset() let rx0 = self.GetRx0() - " TLogVAR rx0 + Tlibtrace 'tlib', rx0 if !empty(self.matcher.highlight) if empty(rx0) match none @@ -1197,8 +1210,8 @@ endf " :nodoc: -function! s:prototype.SetStatusline(query) dict "{{{3 - " TLogVAR a:query +function! s:prototype.SetStatusline(query) dict abort "{{{3 + Tlibtrace 'tlib', a:query if !empty(self.temp_prompt) let echo = get(self.temp_prompt, 0, '') let hl = get(self.temp_prompt, 1, 'Normal') @@ -1226,7 +1239,7 @@ function! s:prototype.SetStatusline(query) dict "{{{3 let echo = query . ' ' . sopts " let query .= '%%='. sopts .' ' endif - " TLogVAR &l:statusline, query + Tlibtrace 'tlib', &l:statusline, query " let &l:statusline = query endif echo @@ -1241,7 +1254,7 @@ endf " :nodoc: -function! s:prototype.Query() dict "{{{3 +function! s:prototype.Query() dict abort "{{{3 let flt = self.DisplayFilter() if g:tlib_inputlist_shortmessage let query = 'Filter: '. flt @@ -1253,17 +1266,15 @@ endf " :nodoc: -function! s:prototype.ScrollToOffset() dict "{{{3 - " TLogVAR self.scratch_vertical, self.llen, winheight(0) +function! s:prototype.ScrollToOffset() dict abort "{{{3 + Tlibtrace 'tlib', self.scratch_vertical, self.llen, winheight(0) exec 'norm! '. self.offset .'zt' endf " :nodoc: -function! s:prototype.SetOffset() dict "{{{3 - " TLogVAR self.prefidx, self.offset - " TLogDBG winheight(0) - " TLogDBG self.prefidx > self.offset + winheight(0) - 1 +function! s:prototype.SetOffset() dict abort "{{{3 + Tlibtrace 'tlib', self.prefidx, self.offset let listtop = len(self.list) - winheight(0) + 1 if listtop < 1 let listtop = 1 @@ -1274,37 +1285,34 @@ function! s:prototype.SetOffset() dict "{{{3 let listoff = self.prefidx - winheight(0) + 1 let self.offset = min([listtop, listoff]) " TLogVAR self.prefidx - " TLogDBG len(self.list) - " TLogDBG winheight(0) " TLogVAR listtop, listoff, self.offset elseif self.prefidx < self.offset let self.offset = self.prefidx endif - " TLogVAR self.offset + Tlibtrace 'tlib', self.offset endf " :nodoc: -function! s:prototype.ClearAllMarks() dict "{{{3 +function! s:prototype.ClearAllMarks() dict abort "{{{3 let x = self.index_width + 1 call map(range(1, line('$')), 'self.DisplayListMark(x, v:val, ":")') endf " :nodoc: -function! s:prototype.MarkCurrent(y) dict "{{{3 +function! s:prototype.MarkCurrent(y) dict abort "{{{3 let x = self.index_width + 1 call self.DisplayListMark(x, a:y, '*') endf " :nodoc: -function! s:prototype.DisplayListMark(x, y, mark) dict "{{{3 - " TLogVAR a:y, a:mark +function! s:prototype.DisplayListMark(x, y, mark) dict abort "{{{3 + Tlibtrace 'tlib', a:y, a:mark if a:x > 0 && a:y >= 0 - " TLogDBG a:x .'x'. a:y .' '. a:mark let sy = self.GetListIdx(a:y) + 1 - " TLogVAR sy + Tlibtrace 'tlib', sy if sy >= 1 call setpos('.', [0, sy, a:x, 0]) exec 'norm! r'. a:mark @@ -1316,23 +1324,22 @@ endf " :nodoc: -function! s:prototype.SwitchWindow(where) dict "{{{3 - " TLogDBG string(tlib#win#List()) - if self.tabpagenr != tabpagenr() - call tlib#tab#Set(self.tabpagenr) - endif - let wnr = get(self, a:where.'_wnr') - " TLogVAR self, wnr - return tlib#win#Set(wnr) +function! s:prototype.SwitchWindow(where) dict abort "{{{3 + " if self.tabpagenr != tabpagenr() + " call tlib#tab#Set(self.tabpagenr) + " endif + " let wnr = get(self, a:where.'_wnr') + " Tlibtrace 'tlib', self, wnr + " return tlib#win#Set(wnr) + return tlib#win#SetById(self[a:where .'_id']) endf " :nodoc: -function! s:prototype.FollowCursor() dict "{{{3 +function! s:prototype.FollowCursor() dict abort "{{{3 if !empty(self.follow_cursor) let back = self.SwitchWindow('win') - " TLogVAR back - " TLogDBG winnr() + Tlibtrace 'tlib', back try call call(self.follow_cursor, [self, [self.CurrentItem()]]) finally @@ -1343,62 +1350,47 @@ endf " :nodoc: -function! s:prototype.SetOrigin(...) dict "{{{3 +function! s:prototype.SetOrigin(...) dict abort "{{{3 TVarArg ['winview', 0] - " TLogVAR self.win_wnr, self.bufnr - " TLogDBG bufname('%') - " TLogDBG winnr() - " TLogDBG winnr('$') + Tlibtrace 'tlib', 'SetOrigin', self.win_id, self.bufnr, bufnr('%'), winnr() let self.win_wnr = winnr() + let self.win_id = tlib#win#GetID() let self.win_height = winheight(self.win_wnr) let self.win_width = winwidth(self.win_wnr) - " TLogVAR self.win_wnr, self.win_height, self.win_width + Tlibtrace 'tlib', 'SetOrigin', self.win_id, self.win_height, self.win_width, bufnr('%'), winnr() let self.bufnr = bufnr('%') let self.tabpagenr = tabpagenr() let self.cursor = getpos('.') if winview let self.winview = tlib#win#GetLayout() endif - " TLogVAR self.win_wnr, self.bufnr, self.winview + Tlibtrace 'tlib', 'SetOrigin', self.win_id, self.bufnr, get(self,'winview','') return self endf " :nodoc: -function! s:prototype.RestoreOrigin(...) dict "{{{3 +function! s:prototype.RestoreWindow(...) dict abort "{{{3 TVarArg ['winview', 0] if winview - " TLogVAR winview + Tlibtrace 'tlib', winview call tlib#win#SetLayout(self.winview) endif - " TLogVAR self.win_wnr, self.bufnr, self.cursor, &splitbelow - " TLogDBG "RestoreOrigin0 ". string(tlib#win#List()) - " If &splitbelow or &splitright is false, we cannot rely on - " self.win_wnr to be our source buffer since, e.g, opening a buffer - " in a split window changes the whole layout. - " Possible solutions: - " - Restrict buffer switching to cases when the number of windows - " hasn't changed. - " - Guess the right window, which we try to do here. - if &splitbelow == 0 || &splitright == 0 - let wn = bufwinnr(self.bufnr) - " TLogVAR wn - if wn == -1 - let wn = 1 - end - else - let wn = self.win_wnr - endif - if wn != winnr() - exec wn .'wincmd w' - endif - exec 'buffer! '. self.bufnr - call setpos('.', self.cursor) - " TLogDBG "RestoreOrigin1 ". string(tlib#win#List()) + call tlib#win#GotoID(self.win_id) endf -function! s:prototype.Suspend() dict "{{{3 +" :nodoc: +function! s:prototype.RestoreOrigin(...) dict abort "{{{3 + call call(self.RestoreWindow, a:000) + if bufnr('%') != self.bufnr + exec 'buffer! '. self.bufnr + call setpos('.', self.cursor) + endif +endf + + +function! s:prototype.Suspend() dict abort "{{{3 call tlib#agent#Suspend(self, self.rv) endf diff --git a/sources_non_forked/tlib/autoload/tlib/agent.vim b/sources_non_forked/tlib/autoload/tlib/agent.vim index 98275f12..96f75274 100644 --- a/sources_non_forked/tlib/autoload/tlib/agent.vim +++ b/sources_non_forked/tlib/autoload/tlib/agent.vim @@ -1,8 +1,7 @@ " @Author: Tom Link (micathom AT gmail com?subject=[vim]) " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 328 - +" @Revision: 362 " :filedoc: " Various agents for use as key handlers in tlib#input#List() @@ -14,7 +13,8 @@ TLet g:tlib_scroll_lines = 10 " General {{{1 function! tlib#agent#Exit(world, selected) "{{{3 - if a:world.key_mode == 'default' + Tlibtrace 'tlib', a:selected + if a:world.key_mode ==# 'default' call a:world.CloseScratch() let a:world.state = 'exit empty escape' let a:world.list = [] @@ -29,6 +29,7 @@ endf function! tlib#agent#CopyItems(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let @* = join(a:selected, "\n") let a:world.state = 'redisplay' return a:world @@ -39,6 +40,7 @@ endf " InputList related {{{1 function! tlib#agent#PageUp(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let a:world.offset -= (winheight(0) / 2) let a:world.state = 'scroll' return a:world @@ -46,6 +48,7 @@ endf function! tlib#agent#PageDown(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let a:world.offset += (winheight(0) / 2) let a:world.state = 'scroll' return a:world @@ -53,6 +56,7 @@ endf function! tlib#agent#Home(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let a:world.prefidx = 1 let a:world.state = 'redisplay' return a:world @@ -60,6 +64,7 @@ endf function! tlib#agent#End(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let a:world.prefidx = len(a:world.list) let a:world.state = 'redisplay' return a:world @@ -68,6 +73,7 @@ endf function! tlib#agent#Up(world, selected, ...) "{{{3 TVarArg ['lines', 1] + Tlibtrace 'tlib', a:selected, lines let a:world.idx = '' if a:world.prefidx > lines let a:world.prefidx -= lines @@ -81,6 +87,7 @@ endf function! tlib#agent#Down(world, selected, ...) "{{{3 TVarArg ['lines', 1] + Tlibtrace 'tlib', a:selected, lines let a:world.idx = '' if a:world.prefidx <= (len(a:world.list) - lines) let a:world.prefidx += lines @@ -93,16 +100,19 @@ endf function! tlib#agent#UpN(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected return tlib#agent#Up(a:world, a:selected, g:tlib_scroll_lines) endf function! tlib#agent#DownN(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected return tlib#agent#Down(a:world, a:selected, g:tlib_scroll_lines) endf function! tlib#agent#ShiftLeft(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let a:world.offset_horizontal -= (winwidth(0) / 2) if a:world.offset_horizontal < 0 let a:world.offset_horizontal = 0 @@ -113,6 +123,7 @@ endf function! tlib#agent#ShiftRight(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let a:world.offset_horizontal += (winwidth(0) / 2) let a:world.state = 'display shift' return a:world @@ -120,12 +131,14 @@ endf function! tlib#agent#Reset(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let a:world.state = 'reset' return a:world endf function! tlib#agent#ToggleRestrictView(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected if empty(a:world.filtered_items) return tlib#agent#RestrictView(a:world, a:selected) else @@ -135,11 +148,11 @@ endf function! tlib#agent#RestrictView(world, selected) "{{{3 - " TLogVAR a:selected + Tlibtrace 'tlib', a:selected let filtered_items = map(copy(a:selected), 'index(a:world.base, v:val) + 1') - " TLogVAR 1, filtered_items + Tlibtrace 'tlib', 1, filtered_items let filtered_items = filter(filtered_items, 'v:val > 0') - " TLogVAR 2, filtered_items + Tlibtrace 'tlib', 2, filtered_items if !empty(filtered_items) let a:world.filtered_items = filtered_items endif @@ -149,6 +162,7 @@ endf function! tlib#agent#UnrestrictView(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let a:world.filtered_items = [] let a:world.state = 'display' return a:world @@ -156,6 +170,7 @@ endf function! tlib#agent#Input(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let flt0 = a:world.CleanFilter(a:world.filter[0][0]) let flt1 = input('Filter: ', flt0) echo @@ -174,15 +189,16 @@ endf " Suspend (see |tlib#agent#Suspend|) the input loop and jump back to the " original position in the parent window. function! tlib#agent#SuspendToParentWindow(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let world = a:world - let winnr = world.win_wnr - " TLogVAR winnr - if winnr != -1 + let wid = world.win_id + Tlibtrace 'tlib', wid + if wid != -1 let world = tlib#agent#Suspend(world, a:selected) - if world.state =~ '\' + if world.state =~# '\' call world.SwitchWindow('win') " let pos = world.cursor - " " TLogVAR pos + " Tlibtrace 'tlib', pos " if !empty(pos) " call setpos('.', pos) " endif @@ -200,17 +216,18 @@ endf " and will immediatly select the item under the cursor. " < will select the item but the window will remain opened. function! tlib#agent#Suspend(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected if a:world.allow_suspend " TAssert IsNotEmpty(a:world.scratch) " TLogDBG bufnr('%') let br = tlib#buffer#Set(a:world.scratch) - " TLogVAR br, a:world.bufnr, a:world.scratch + Tlibtrace 'tlib', br, a:world.bufnr, a:world.scratch if bufnr('%') != a:world.scratch echohl WarningMsg echom "tlib#agent#Suspend: Internal error: Not a scratch buffer:" bufname('%') echohl NONE endif - " TLogVAR bufnr('%'), bufname('%'), a:world.scratch + Tlibtrace 'tlib', bufnr('%'), bufname('%'), a:world.scratch call tlib#autocmdgroup#Init() exec 'autocmd TLib BufEnter call tlib#input#Resume("world", 0, '. a:world.scratch .')' let b:tlib_world = a:world @@ -225,12 +242,14 @@ endf function! tlib#agent#Help(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let a:world.state = 'help' return a:world endf function! tlib#agent#OR(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected if !empty(a:world.filter[0]) call insert(a:world.filter[0], '') endif @@ -240,6 +259,7 @@ endf function! tlib#agent#AND(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected if !empty(a:world.filter[0]) call insert(a:world.filter, ['']) endif @@ -249,6 +269,7 @@ endf function! tlib#agent#ReduceFilter(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected call a:world.ReduceFilter() let a:world.offset = 1 let a:world.state = 'display' @@ -257,6 +278,7 @@ endf function! tlib#agent#PopFilter(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected call a:world.PopFilter() let a:world.offset = 1 let a:world.state = 'display' @@ -265,6 +287,7 @@ endf function! tlib#agent#Debug(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected " echo string(world.state) echo string(a:world.filter) echo string(a:world.idx) @@ -277,6 +300,7 @@ endf function! tlib#agent#Select(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected call a:world.SelectItem('toggle', a:world.prefidx) " let a:world.state = 'display keepcursor' let a:world.state = 'redisplay' @@ -285,6 +309,7 @@ endf function! tlib#agent#SelectUp(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected call a:world.SelectItem('toggle', a:world.prefidx) if a:world.prefidx > 1 let a:world.prefidx -= 1 @@ -295,6 +320,7 @@ endf function! tlib#agent#SelectDown(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected call a:world.SelectItem('toggle', a:world.prefidx) if a:world.prefidx < len(a:world.list) let a:world.prefidx += 1 @@ -305,6 +331,7 @@ endf function! tlib#agent#SelectAll(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let listrange = range(1, len(a:world.list)) let mode = empty(filter(copy(listrange), 'index(a:world.sel_idx, a:world.GetBaseIdx(v:val)) == -1')) \ ? 'toggle' : 'set' @@ -317,6 +344,7 @@ endf function! tlib#agent#ToggleStickyList(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let a:world.sticky = !a:world.sticky let a:world.state = 'display keepcursor' return a:world @@ -327,11 +355,11 @@ endf " EditList related {{{1 function! tlib#agent#EditItem(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let lidx = a:world.prefidx - " TLogVAR lidx - " TLogVAR a:world.table + Tlibtrace 'tlib', lidx let bidx = a:world.GetBaseIdx(lidx) - " TLogVAR bidx + Tlibtrace 'tlib', bidx let item = a:world.GetBaseItem(bidx) let item = input(lidx .'@'. bidx .': ', item) if item != '' @@ -344,6 +372,7 @@ endf " Insert a new item below the current one. function! tlib#agent#NewItem(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let basepi = a:world.GetBaseIdx(a:world.prefidx) let item = input('New item: ') call insert(a:world.base, item, basepi) @@ -353,6 +382,7 @@ endf function! tlib#agent#DeleteItems(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let remove = copy(a:world.sel_idx) let basepi = a:world.GetBaseIdx(a:world.prefidx) if index(remove, basepi) == -1 @@ -370,12 +400,14 @@ endf function! tlib#agent#Cut(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let world = tlib#agent#Copy(a:world, a:selected) return tlib#agent#DeleteItems(world, a:selected) endf function! tlib#agent#Copy(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let a:world.clipboard = [] let bidxs = copy(a:world.sel_idx) call add(bidxs, a:world.GetBaseIdx(a:world.prefidx)) @@ -388,6 +420,7 @@ endf function! tlib#agent#Paste(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected if has_key(a:world, 'clipboard') for e in reverse(copy(a:world.clipboard)) call insert(a:world.base, e, a:world.prefidx) @@ -400,6 +433,7 @@ endf function! tlib#agent#EditReturnValue(world, rv) "{{{3 + Tlibtrace 'tlib', a:rv return [a:world.state !~ '\', a:world.base] endf @@ -408,22 +442,15 @@ endf " Files related {{{1 function! tlib#agent#ViewFile(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected if !empty(a:selected) let back = a:world.SwitchWindow('win') - " TLogVAR back + Tlibtrace 'tlib', back for filename in a:selected call tlib#file#Edit(filename) endfor - " if !&hidden && &l:modified - " let cmd0 = 'split' - " let cmd1 = 'sbuffer' - " else - " let cmd0 = 'edit' - " let cmd1 = 'buffer' - " endif - " call tlib#file#With(cmd0, cmd1, a:selected, a:world) - " TLogVAR &filetype - exec back + call a:world.SetOrigin(1) + silent! exec back let a:world.state = 'display' endif return a:world @@ -431,41 +458,53 @@ endf function! tlib#agent#EditFile(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected return tlib#agent#Exit(tlib#agent#ViewFile(a:world, a:selected), a:selected) endf function! tlib#agent#EditFileInSplit(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected call a:world.CloseScratch() - " call tlib#file#With('edit', 'buffer', a:selected[0:0], a:world) - " call tlib#file#With('split', 'sbuffer', a:selected[1:-1], a:world) - call tlib#file#With('split', 'sbuffer', a:selected, a:world) + call tlib#file#With('split', 'sbuffer', a:selected, a:world, 1) + call a:world.SetOrigin(1) return tlib#agent#Exit(a:world, a:selected) endf function! tlib#agent#EditFileInVSplit(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected call a:world.CloseScratch() - " call tlib#file#With('edit', 'buffer', a:selected[0:0], a:world) - " call tlib#file#With('vertical split', 'vertical sbuffer', a:selected[1:-1], a:world) let winpos = tlib#fixes#Winpos() - call tlib#file#With('vertical split', 'vertical sbuffer', a:selected, a:world) + call tlib#file#With('vertical split', 'vertical sbuffer', a:selected, a:world, 1) if !empty(winpos) exec winpos endif + call a:world.SetOrigin(1) return tlib#agent#Exit(a:world, a:selected) endf function! tlib#agent#EditFileInTab(world, selected) "{{{3 - " TLogVAR a:selected + Tlibtrace 'tlib', a:selected call a:world.CloseScratch() - call tlib#file#With('tabedit', 'tab sbuffer', a:selected, a:world) + call tlib#file#With('tabedit', 'tab sbuffer', a:selected, a:world, 1) + call a:world.SetOrigin(1) + return tlib#agent#Exit(a:world, a:selected) +endf + + +function! tlib#agent#EditFileInWindow(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected + call a:world.CloseScratch() + call tlib#file#With('hide edit', 'hide buffer', a:selected, a:world, 1) + call a:world.SetOrigin(1) return tlib#agent#Exit(a:world, a:selected) endf function! tlib#agent#ToggleScrollbind(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let a:world.scrollbind = get(a:world, 'scrollbind') ? 0 : 1 let a:world.state = 'redisplay' return a:world @@ -473,6 +512,7 @@ endf function! tlib#agent#ShowInfo(world, selected) + Tlibtrace 'tlib', a:selected let lines = [] for f in a:selected if filereadable(f) @@ -490,12 +530,30 @@ endf " Buffer related {{{1 +function! tlib#agent#ViewBufferInWindow(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected + if !empty(a:selected) + let back = a:world.SwitchWindow('win') + Tlibtrace 'tlib', back + for bufname in a:selected + let cmd = &modified && !&hidden ? 'sbuffer' : 'buffer' + exec cmd fnameescape(bufname) + endfor + " exec back + endif + return tlib#agent#Exit(a:world, a:selected) +endf + + function! tlib#agent#PreviewLine(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let l = a:selected[0] - let ww = winnr() - exec a:world.win_wnr .'wincmd w' + " let ww = winnr() + let wid = tlib#win#GetID() + call tlib#agent#SuspendToParentWindow(a:world, a:selected) call tlib#buffer#ViewLine(l, 1) - exec ww .'wincmd w' + call tlib#win#GotoID(wid) + " exec ww .'wincmd w' let a:world.state = 'redisplay' return a:world endf @@ -504,24 +562,12 @@ endf " If not called from the scratch, we assume/guess that we don't have to " suspend the input-evaluation loop. function! tlib#agent#GotoLine(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected if !empty(a:selected) - - " let l = a:selected[0] - " " TLogVAR l - " let back = a:world.SwitchWindow('win') - " " TLogVAR back - " " if a:world.win_wnr != winnr() - " " let world = tlib#agent#Suspend(a:world, a:selected) - " " exec a:world.win_wnr .'wincmd w' - " " endif - " call tlib#buffer#ViewLine(l) - " exec back - " let a:world.state = 'display' - let l = a:selected[0] - if a:world.win_wnr != winnr() + if a:world.win_id != tlib#win#GetID() let world = tlib#agent#Suspend(a:world, a:selected) - exec a:world.win_wnr .'wincmd w' + call tlib#win#GotoID(a:world.win_id) endif call tlib#buffer#ViewLine(l, 1) @@ -531,6 +577,7 @@ endf function! tlib#agent#DoAtLine(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected if !empty(a:selected) let cmd = input('Command: ', '', 'command') if !empty(cmd) @@ -552,6 +599,7 @@ endf function! tlib#agent#Wildcard(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected if !empty(a:world.filter[0]) let rx_type = a:world.matcher.FilterRxPrefix() let flt0 = a:world.CleanFilter(a:world.filter[0][0]) @@ -568,12 +616,14 @@ endf function! tlib#agent#Null(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let a:world.state = 'redisplay' return a:world endf function! tlib#agent#ExecAgentByName(world, selected) "{{{3 + Tlibtrace 'tlib', a:selected let s:agent_names_world = a:world let agent_names = {'Help': 'tlib#agent#Help'} for def in values(a:world.key_map[a:world.key_mode]) @@ -583,11 +633,11 @@ function! tlib#agent#ExecAgentByName(world, selected) "{{{3 endfor let s:agent_names = sort(keys(agent_names)) let command = input('Command: ', '', 'customlist,tlib#agent#CompleteAgentNames') - " TLogVAR command + Tlibtrace 'tlib', command if !has_key(agent_names, command) - " TLogVAR command + Tlibtrace 'tlib', command silent! let matches = filter(keys(agent_names), 'v:val =~ command') - " TLogVAR matches + Tlibtrace 'tlib', matches if len(matches) == 1 let command = matches[0] endif @@ -609,43 +659,45 @@ endf function! tlib#agent#CompleteAgentNames(ArgLead, CmdLine, CursorPos) - return filter(copy(s:agent_names), 'stridx(v:val, a:ArgLead) != -1') + let arglead = tolower(a:Arglead) + return filter(copy(s:agent_names), 'stridx(tolower(v:val), arglead) != -1') endf function! tlib#agent#Complete(world, selected) abort "{{{3 + Tlibtrace 'tlib', a:selected let rxprefix = a:world.matcher.FilterRxPrefix() let flt = a:world.filter[0][0] - " TLogVAR flt + Tlibtrace 'tlib', flt let fltrx = rxprefix . flt . '\m[^[:space:][:cntrl:][:punct:]<>*+?&~{}()\[\]\\/]\+' let fltrx0 = '\m^' . fltrx - " TLogVAR fltrx, fltrx0 + Tlibtrace 'tlib', fltrx, fltrx0 let words = {} for item in a:world.list let parts = split(item, '\ze'. fltrx) - " TLogVAR item, parts + Tlibtrace 'tlib', item, parts for part in parts let word = matchstr(part, fltrx0) - " TLogVAR part, word + Tlibtrace 'tlib', part, word if !empty(word) let words[word] = 1 endif endfor endfor - " TLogVAR keys(words) + Tlibtrace 'tlib', keys(words) let completions = keys(words) " let completions = filter(keys(words), 'matchstr(v:val, fltrx0)') let completions = sort(completions, 's:SortCompletions') let completions = tlib#list#Uniq(completions) - " TLogVAR 0, completions + Tlibtrace 'tlib', 0, completions while len(completions) > 1 let nchar = strwidth(completions[0]) - 1 - let completions = map(completions, 'strpart(v:val, 0, nchar)') - " TLogVAR 'reduce', completions + let completions = map(completions, 'tlib#string#Strcharpart(v:val, 0, nchar)') + Tlibtrace 'tlib', 'reduce', completions let completions = tlib#list#Uniq(completions) - " TLogVAR 'unique', len(completions), completions + Tlibtrace 'tlib', 'unique', len(completions), completions endwh - " TLogVAR 9, completions + Tlibtrace 'tlib', 9, completions if empty(completions) let a:world.state = 'redisplay update' else diff --git a/sources_non_forked/tlib/autoload/tlib/arg.vim b/sources_non_forked/tlib/autoload/tlib/arg.vim index 2e995146..498e6c73 100644 --- a/sources_non_forked/tlib/autoload/tlib/arg.vim +++ b/sources_non_forked/tlib/autoload/tlib/arg.vim @@ -1,8 +1,8 @@ " @Author: Tom Link (micathom AT gmail com?subject=[vim]) " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Last Change: 2015-11-19. -" @Revision: 251 +" @Last Change: 2017-09-28. +" @Revision: 273 " :def: function! tlib#arg#Get(n, var, ?default="", ?test='') @@ -92,30 +92,34 @@ endf " ['-ab', '--', '--foo', '--bar=BAR'] " => {'a': 1, 'b': 1, '__rest__': ['--foo', '--bar=BAR']} function! tlib#arg#GetOpts(args, ...) abort "{{{3 - let throw = a:0 == 0 - TVarArg ['def', {}] - " TLogVAR def - let opts = {'__exit__': 0} - for [key, vdef] in items(get(def, 'values', {})) - if has_key(vdef, 'default') - let opts[key] = vdef.default - endif - endfor - let idx = 0 - for o in a:args - let [break, idx] = s:SetOpt(def, opts, idx, o) - if break == 1 - break - elseif break == 2 - if throw - throw 'tlib#arg#GetOpts: Show help' - else - let opts.__exit__ = 5 + if type(a:args) == 4 + reutrn a:args + else + let throw = a:0 == 0 + TVarArg ['def', {}] + " TLogVAR def + let opts = {'__exit__': 0} + for [key, vdef] in items(get(def, 'values', {})) + if has_key(vdef, 'default') + let opts[key] = vdef.default endif - endif - endfor - let opts.__rest__ = a:args[idx : -1] - return opts + endfor + let idx = 0 + for o in a:args + let [break, idx] = s:SetOpt(def, opts, idx, o) + if break == 1 + break + elseif break == 2 + if throw + throw 'tlib#arg#GetOpts: Show help' + else + let opts.__exit__ = 5 + endif + endif + endfor + let opts.__rest__ = a:args[idx : -1] + return opts + endif endf @@ -147,7 +151,7 @@ function! s:SetOpt(def, opts, idx, opt) abort "{{{3 let default = get(vdef, 'default', '') let type = s:GetValueType(vdef) if default =~ '^-\?\d\+\%(\.\d\+\)$' - if type == -1 + if type == -1 || type == 6 let opt .= ' (flag)' elseif type == 1 let opt .= '=INT' @@ -171,6 +175,11 @@ function! s:SetOpt(def, opts, idx, opt) abort "{{{3 endif endif let break = 2 + elseif long && a:opt =~# '^--\%(no-\)\?debug$' + if has_key(a:def, 'trace') + let mod = a:opt =~# '--no-' ? '-' : '+' + exec 'Tlibtraceset' mod . a:def.trace + endif elseif long && a:opt =~# '^--no-.\+' let key = matchstr(a:opt, '^--no-\zs.\+$') let a:opts[key] = s:Validate(a:def, key, 0) @@ -267,12 +276,14 @@ function! tlib#arg#CComplete(def, ArgLead) abort "{{{3 " endif endif if !empty(words) - let lead = substitute(a:ArgLead, '^--\w\+=', '', '') + let prefix = matchstr(a:ArgLead, '^--\w\+=\%([^,]\+,\s*\)*') + let lead = substitute(a:ArgLead, '^--\w\+=\%([^,]\+,\s*\)*', '', '') + " TLogVAR a:ArgLead, lead if !empty(lead) let nchar = len(lead) - call filter(words, 'strpart(v:val, 0, nchar) ==# lead') + call filter(words, 'tlib#string#Strcharpart(v:val, 0, nchar) ==# lead') endif - let words = map(words, '"--". opt ."=". v:val') + let words = map(words, 'prefix . v:val') return sort(words) endif endif @@ -294,9 +305,12 @@ function! tlib#arg#CComplete(def, ArgLead) abort "{{{3 endif let cs['-'. name] = 1 endfor + if has_key(a:def, 'trace') + let cs['--debug'] = 1 + endif let nchar = len(a:ArgLead) if nchar > 0 - call filter(cs, 'strpart(v:key, 0, nchar) ==# a:ArgLead') + call filter(cs, 'tlib#string#Strcharpart(v:key, 0, nchar) ==# a:ArgLead') endif return sort(keys(cs)) endf diff --git a/sources_non_forked/tlib/autoload/tlib/assert.vim b/sources_non_forked/tlib/autoload/tlib/assert.vim index dbf48369..3d58f59d 100644 --- a/sources_non_forked/tlib/autoload/tlib/assert.vim +++ b/sources_non_forked/tlib/autoload/tlib/assert.vim @@ -1,21 +1,21 @@ " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @Website: https://github.com/tomtom " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Last Change: 2015-11-23 -" @Revision: 38 +" @Last Change: 2017-02-22 +" @Revision: 42 " Enable tracing via |:Tlibassert|. function! tlib#assert#Enable() abort "{{{3 " :nodoc: - command! -nargs=+ -bar Tlibassert call tlib#assert#Assert(expand(''), , []) + command! -nargs=+ -bang Tlibassert call tlib#assert#Assert(expand(''), , []) endf " Disable tracing via |:Tlibassert|. function! tlib#assert#Disable() abort "{{{3 " :nodoc: - command! -nargs=+ -bang -bar Tlibassert : + command! -nargs=+ -bang Tlibassert : endf diff --git a/sources_non_forked/tlib/autoload/tlib/buffer.vim b/sources_non_forked/tlib/autoload/tlib/buffer.vim index 24e4e0a7..1cbcdb74 100644 --- a/sources_non_forked/tlib/autoload/tlib/buffer.vim +++ b/sources_non_forked/tlib/autoload/tlib/buffer.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-06-30. -" @Last Change: 2015-11-06. -" @Revision: 7.1.352 +" @Last Change: 2017-09-28. +" @Revision: 12.1.352 " Where to display the line when using |tlib#buffer#ViewLine|. @@ -15,19 +15,19 @@ TLet g:tlib_viewline_position = 'zz' let s:bmru = [] -function! tlib#buffer#EnableMRU() "{{{3 +function! tlib#buffer#EnableMRU() abort "{{{3 call tlib#autocmdgroup#Init() autocmd TLib BufEnter * call s:BMRU_Push(bufnr('%')) endf -function! tlib#buffer#DisableMRU() "{{{3 +function! tlib#buffer#DisableMRU() abort "{{{3 call tlib#autocmdgroup#Init() autocmd! TLib BufEnter endf -function! s:BMRU_Push(bnr) "{{{3 +function! s:BMRU_Push(bnr) abort "{{{3 let i = index(s:bmru, a:bnr) if i >= 0 call remove(s:bmru, i) @@ -36,7 +36,7 @@ function! s:BMRU_Push(bnr) "{{{3 endf -function! s:CompareBuffernameByBasename(a, b) "{{{3 +function! s:CompareBuffernameByBasename(a, b) abort "{{{3 let rx = '"\zs.\{-}\ze" \+\S\+ \+\d\+$' let an = matchstr(a:a, rx) let an = fnamemodify(an, ':t') @@ -47,7 +47,7 @@ function! s:CompareBuffernameByBasename(a, b) "{{{3 endf -function! s:CompareBufferNrByMRU(a, b) "{{{3 +function! s:CompareBufferNrByMRU(a, b) abort "{{{3 let an = matchstr(a:a, '\s*\zs\d\+\ze') let bn = matchstr(a:b, '\s*\zs\d\+\ze') let ai = index(s:bmru, 0 + an) @@ -66,7 +66,7 @@ endf " Set the buffer to buffer and return a command as string that can be " evaluated by |:execute| in order to restore the original view. -function! tlib#buffer#Set(buffer) "{{{3 +function! tlib#buffer#Set(buffer) abort "{{{3 let lazyredraw = &lazyredraw set lazyredraw try @@ -91,12 +91,12 @@ function! tlib#buffer#Set(buffer) "{{{3 endf -" :def: function! tlib#buffer#Eval(buffer, code) +" :def: function! tlib#buffer#Eval(buffer, code) abort " Evaluate CODE in BUFFER. " " EXAMPLES: > " call tlib#buffer#Eval('foo.txt', 'echo b:bar') -function! tlib#buffer#Eval(buffer, code) "{{{3 +function! tlib#buffer#Eval(buffer, code) abort "{{{3 " let cb = bufnr('%') " let wb = bufwinnr('%') " " TLogVAR cb @@ -134,7 +134,7 @@ function! tlib#buffer#Eval(buffer, code) "{{{3 endf -" :def: function! tlib#buffer#GetList(?show_hidden=0, ?show_number=0, " ?order='bufnr') +" :def: function! tlib#buffer#GetList(?show_hidden=0, ?show_number=0, " ?order='bufnr') abort " Possible values for the "order" argument: " bufnr :: Default behaviour " mru :: Sort buffers according to most recent use @@ -142,7 +142,7 @@ endf " " NOTE: MRU order works on second invocation only. If you want to always " use MRU order, call tlib#buffer#EnableMRU() in your ~/.vimrc file. -function! tlib#buffer#GetList(...) +function! tlib#buffer#GetList(...) abort TVarArg ['show_hidden', 0], ['show_number', 0], ['order', ''] " TLogVAR show_hidden, show_number, order let ls_bang = show_hidden ? '!' : '' @@ -150,14 +150,14 @@ function! tlib#buffer#GetList(...) exec 'silent ls'. ls_bang redir END let buffer_list = split(bfs, '\n') - if order == 'mru' + if order ==# 'mru' if empty(s:bmru) call tlib#buffer#EnableMRU() echom 'tlib: Installed Buffer MRU logger; disable with: call tlib#buffer#DisableMRU()' else call sort(buffer_list, function('s:CompareBufferNrByMRU')) endif - elseif order == 'basename' + elseif order ==# 'basename' call sort(buffer_list, function('s:CompareBuffernameByBasename')) endif let buffer_nr = map(copy(buffer_list), 'str2nr(matchstr(v:val, ''\s*\zs\d\+\ze''))') @@ -176,11 +176,11 @@ function! tlib#buffer#GetList(...) endf -" :def: function! tlib#buffer#ViewLine(line, ?position='z') +" :def: function! tlib#buffer#ViewLine(line, ?position='z') abort " line is either a number or a string that begins with a number. " For possible values for position see |scroll-cursor|. " See also |g:tlib_viewline_position|. -function! tlib#buffer#ViewLine(line, ...) "{{{3 +function! tlib#buffer#ViewLine(line, ...) abort "{{{3 if a:line TVarArg 'pos' let ln = matchstr(a:line, '^\d\+') @@ -200,7 +200,7 @@ function! tlib#buffer#ViewLine(line, ...) "{{{3 endf -function! s:UndoHighlightLine() "{{{3 +function! s:UndoHighlightLine() abort "{{{3 2match none autocmd! TLib CursorMoved,CursorMovedI autocmd! TLib CursorHold,CursorHoldI @@ -209,7 +209,7 @@ function! s:UndoHighlightLine() "{{{3 endf -function! tlib#buffer#HighlightLine(...) "{{{3 +function! tlib#buffer#HighlightLine(...) abort "{{{3 TVarArg ['line', line('.')] " exec '2match MatchParen /^\%'. a:line .'l.*/' exec '2match Search /^\%'. line .'l.*/' @@ -222,7 +222,7 @@ endf " Delete the lines in the current buffer. Wrapper for |:delete|. -function! tlib#buffer#DeleteRange(line1, line2) "{{{3 +function! tlib#buffer#DeleteRange(line1, line2) abort "{{{3 let r = @t try exec a:line1.','.a:line2.'delete t' @@ -233,14 +233,14 @@ endf " Replace a range of lines. -function! tlib#buffer#ReplaceRange(line1, line2, lines) +function! tlib#buffer#ReplaceRange(line1, line2, lines) abort call tlib#buffer#DeleteRange(a:line1, a:line2) call append(a:line1 - 1, a:lines) endf " Initialize some scratch area at the bottom of the current buffer. -function! tlib#buffer#ScratchStart() "{{{3 +function! tlib#buffer#ScratchStart() abort "{{{3 norm! Go let b:tlib_inbuffer_scratch = line('$') return b:tlib_inbuffer_scratch @@ -248,7 +248,7 @@ endf " Remove the in-buffer scratch area. -function! tlib#buffer#ScratchEnd() "{{{3 +function! tlib#buffer#ScratchEnd() abort "{{{3 if !exists('b:tlib_inbuffer_scratch') echoerr 'tlib: In-buffer scratch not initalized' endif @@ -258,14 +258,14 @@ endf " Run exec on all buffers via bufdo and return to the original buffer. -function! tlib#buffer#BufDo(exec) "{{{3 +function! tlib#buffer#BufDo(exec) abort "{{{3 let bn = bufnr('%') exec 'bufdo '. a:exec exec 'buffer! '. bn endf -" :def: function! tlib#buffer#InsertText(text, keyargs) +" :def: function! tlib#buffer#InsertText(text, keyargs) abort " Keyargs: " 'shift': 0|N " 'col': col('.')|N @@ -273,7 +273,7 @@ endf " 'indent': 0|1 " 'pos': 'e'|'s' ... Where to locate the cursor (somewhat like s and e in {offset}) " Insert text (a string) in the buffer. -function! tlib#buffer#InsertText(text, ...) "{{{3 +function! tlib#buffer#InsertText(text, ...) abort "{{{3 TVarArg ['keyargs', {}] " TLogVAR a:text, keyargs let keyargs = extend({ @@ -298,16 +298,16 @@ function! tlib#buffer#InsertText(text, ...) "{{{3 " exec 'norm! '. keyargs.lineno .'G' call cursor(keyargs.lineno, keyargs.col) if keyargs.indent && keyargs.col > 1 - if &fo =~# '[or]' + if &formatoptions =~# '[or]' " FIXME: Is the simple version sufficient? " VERSION 1 " " This doesn't work because it's not guaranteed that the " " cursor is set. " let cline = getline('.') - " norm! a + " norm! a " "norm! o " " TAssertExec redraw | sleep 3 - " let idt = strpart(getline('.'), 0, keyargs.col('.') + keyargs.shift) + " let idt = tlib#string#Strcharpart(getline('.'), 0, keyargs.col('.') + keyargs.shift) " " TLogVAR idt " let idtl = len(idt) " -1,.delete @@ -346,10 +346,10 @@ function! tlib#buffer#InsertText(text, ...) "{{{3 let tlen = len(text) let posshift = matchstr(keyargs.pos, '\d\+') " TLogVAR keyargs.pos - if keyargs.pos =~ '^e' + if keyargs.pos =~# '^e' exec keyargs.lineno + tlen - 1 exec 'norm! 0'. (len(text[-1]) - len(post) + posshift - 1) .'l' - elseif keyargs.pos =~ '^s' + elseif keyargs.pos =~# '^s' " TLogVAR keyargs.lineno, pre, posshift exec keyargs.lineno exec 'norm! '. len(pre) .'|' @@ -363,7 +363,7 @@ function! tlib#buffer#InsertText(text, ...) "{{{3 endf -function! tlib#buffer#InsertText0(text, ...) "{{{3 +function! tlib#buffer#InsertText0(text, ...) abort "{{{3 TVarArg ['keyargs', {}] let mode = get(keyargs, 'mode', 'i') " TLogVAR mode @@ -382,13 +382,13 @@ function! tlib#buffer#InsertText0(text, ...) "{{{3 endf -function! tlib#buffer#CurrentByte() "{{{3 +function! tlib#buffer#CurrentByte() abort "{{{3 return line2byte(line('.')) + col('.') endf " Evaluate cmd while maintaining the cursor position and jump registers. -function! tlib#buffer#KeepCursorPosition(cmd) "{{{3 +function! tlib#buffer#KeepCursorPosition(cmd) abort "{{{3 " let pos = getpos('.') let view = winsaveview() try diff --git a/sources_non_forked/tlib/autoload/tlib/cache.vim b/sources_non_forked/tlib/autoload/tlib/cache.vim index 7d2266fd..5363ebd0 100644 --- a/sources_non_forked/tlib/autoload/tlib/cache.vim +++ b/sources_non_forked/tlib/autoload/tlib/cache.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-06-30. -" @Last Change: 2015-10-24. -" @Revision: 31.1.243 +" @Last Change: 2019-01-02. +" @Revision: 125.1.243 " The cache directory. If empty, use |tlib#dir#MyRuntime|.'/cache'. @@ -45,21 +45,37 @@ TLet g:tlib#cache#dont_purge = ['[\/]\.last_purge$'] " |pathshorten()|. TLet g:tlib#cache#max_filename = 200 +TLet g:tlib#cache#use_json = 0 + +TLet g:tlib#cache#use_encoding = '' + + let s:cache = {} -" :display: tlib#cache#Dir(?mode = 'bg') +" :display: tlib#cache#Dir(?mode = 'bg', ?ensure_dir = true) " The default cache directory. function! tlib#cache#Dir(...) "{{{3 - TVarArg ['mode', 'bg'] + TVarArg ['mode', 'bg'], ['ensure_dir', 1] let dir = tlib#var#Get('tlib_cache', mode) if empty(dir) let dir = tlib#file#Join([tlib#dir#MyRuntime(), 'cache']) endif + if ensure_dir + call tlib#dir#Ensure(dir) + endif return dir endf +" :display: tlib#cache#EncodedFilename(type, file, ?mkdir=0, ?dir='') +" Encode `file` and call |tlib#cache#Filename()|. +function! tlib#cache#EncodedFilename(type, file, ...) "{{{3 + let file = tlib#url#Encode(a:file) + return call(function('tlib#cache#Filename'), [a:type, file] + a:000) +endf + + " :def: function! tlib#cache#Filename(type, ?file=%, ?mkdir=0, ?dir='') function! tlib#cache#Filename(type, ...) "{{{3 " TLogDBG 'bufname='. bufname('.') @@ -90,12 +106,15 @@ function! tlib#cache#Filename(type, ...) "{{{3 " TLogVAR file, dir, mkdir let cache_file = tlib#file#Join([dir, file]) if len(cache_file) > g:tlib#cache#max_filename + " echom "DBG long filename" cache_file + " echom "DBG long filename" dir if v:version >= 704 - let shortfilename = pathshorten(file) .'_'. sha256(file) + let shortfilename = sha256(file) else - let shortfilename = pathshorten(file) .'_'. tlib#hash#Adler32(file) + let shortfilename = tlib#hash#Adler32(file) endif - let cache_file = tlib#cache#Filename(a:type, shortfilename, mkdir, dir0) + " let cache_file = tlib#cache#Filename(a:type, shortfilename, mkdir, dir0) + let cache_file = tlib#file#Join([dir, shortfilename]) else if mkdir && !isdirectory(dir) try @@ -126,15 +145,45 @@ function! s:SetTimestamp(cfile, type) "{{{3 endf -function! tlib#cache#Save(cfile, dictionary, ...) "{{{3 +function! s:PutValue(cfile, value) abort "{{{3 + let s:cache[a:cfile] = {'mtime': localtime(), 'data': a:value} +endf + + +function! s:GetValue(cfile, default) abort "{{{3 + return get(get(s:cache, a:cfile, {}), 'data', a:default) +endf + + +function! s:GetCacheTime(cfile) abort "{{{3 + let not_found = !has_key(s:cache, a:cfile) + let cftime = not_found ? -1 : s:cache[a:cfile].mtime + return cftime +endf + + +function! tlib#cache#Save(cfile, value, ...) "{{{3 TVarArg ['options', {}] let in_memory = get(options, 'in_memory', 0) if in_memory " TLogVAR in_memory, a:cfile, localtime() - let s:cache[a:cfile] = {'mtime': localtime(), 'data': a:dictionary} + call s:PutValue(a:cfile, a:value) elseif !empty(a:cfile) - " TLogVAR a:dictionary - call writefile([string(a:dictionary)], a:cfile, 'b') + " TLogVAR a:value + let cfile = a:cfile + if g:tlib#cache#use_json && exists('*json_encode') + try + let value = json_encode(a:value) + let cfile .= '.json' + catch + echoerr v:exception + let value = string(a:value) + endtry + else + let value = string(a:value) + endif + Tlibtrace 'tlib', cfile, value + call writefile([value], cfile, 'b') call s:SetTimestamp(a:cfile, 'write') endif endf @@ -152,16 +201,57 @@ function! tlib#cache#Get(cfile, ...) "{{{3 let in_memory = get(options, 'in_memory', 0) if in_memory " TLogVAR in_memory, a:cfile - return get(get(s:cache, a:cfile, {}), 'data', default) + return s:GetValue(a:cfile, default) else call tlib#cache#MaybePurge() - if !empty(a:cfile) && filereadable(a:cfile) - let val = readfile(a:cfile, 'b') - call s:SetTimestamp(a:cfile, 'read') - return eval(join(val, "\n")) - else - return default + if !empty(a:cfile) + let jsonfile = a:cfile .'.json' + let use_json = g:tlib#cache#use_json && exists('*json_decode') && exists('v:none') && filereadable(jsonfile) + if use_json + let use_json = 1 + let cfile = jsonfile + else + let cfile = a:cfile + endif + let mt = s:GetCacheTime(cfile) + let ft = getftime(cfile) + if mt != -1 && mt >= ft + return s:GetValue(cfile, default) + elseif ft != -1 + call s:SetTimestamp(cfile, 'read') + let val = join(readfile(cfile, 'b'), '\n') + try + if use_json + " NOTE: Copy result of json_decode() in order to + " avoid "E741: value is locked" error in vim8. + let value = json_decode(val) + if value is v:none + let value = default + else + let value = copy(value) + endif + else + let value = eval(val) + endif + call s:PutValue(cfile, value) + return value + catch + echohl ErrorMsg + echom v:exception + echom 'tlib#cache#Get: Invalid value in:' cfile + echom 'Value:' string(val) + echom 'Please review the file and delete it if necessary' + echom 'Will use default value:' string(default) + echohl NONE + if g:tlib#debug + let @* = string(val) + endif + " call s:PutValue(cfile, default) + return default + endtry + endif endif + return default endif endf @@ -172,10 +262,14 @@ endf function! tlib#cache#Value(cfile, generator, ftime, ...) "{{{3 TVarArg ['args', []], ['options', {}] let in_memory = get(options, 'in_memory', 0) - let not_found = in_memory ? !has_key(s:cache, a:cfile) : !filereadable(a:cfile) - " TLogVAR in_memory, not_found - let cftime = in_memory ? (not_found ? 0 : s:cache[a:cfile].mtime) : getftime(a:cfile) - if not_found || (a:ftime != 0 && cftime < a:ftime) + if in_memory + let cftime = s:GetCacheTime(a:cfile) + else + let cftime = getftime(a:cfile) + endif + let ftime = a:ftime + " TLogVAR in_memory, cftime + if cftime == -1 || ftime == -1 || (ftime != 0 && cftime < ftime) " TLogVAR a:generator, args let val = call(a:generator, args) " TLogVAR val @@ -194,6 +288,12 @@ function! tlib#cache#Value(cfile, generator, ftime, ...) "{{{3 endf +function! tlib#cache#ValueFromName(type, name, ...) abort "{{{3 + let cfile = tlib#cache#Filename(a:type, tlib#url#Encode(a:name), 1) + return call(function('tlib#cache#Value'), [cfile] + a:000) +endf + + " Call |tlib#cache#Purge()| if the last purge was done before " |g:tlib#cache#purge_every_days|. function! tlib#cache#MaybePurge() "{{{3 @@ -251,16 +351,12 @@ function! tlib#cache#Purge() "{{{3 try for file in files if isdirectory(file) - if empty(filter(copy(newer), 'strpart(v:val, 0, len(file)) ==# file')) + if empty(filter(copy(newer), 'tlib#string#Strcharpart(v:val, 0, len(file)) ==# file')) call add(deldir, file) endif else if getftime(file) < threshold - if delete(file) - call add(msg, "TLib: Could not delete cache file: ". file) - elseif g:tlib#cache#verbosity >= 2 - call add(msg, "TLib: Delete cache file: ". file) - endif + call s:Delete(msg, file, '') else call add(newer, file) endif @@ -273,56 +369,68 @@ function! tlib#cache#Purge() "{{{3 echo join(msg, "\n") endif if !empty(deldir) - if &shell =~ 'sh\(\.exe\)\?$' - let scriptfile = 'deldir.sh' - let rmdir = 'rm -rf %s' - else - let scriptfile = 'deldir.bat' - let rmdir = 'rmdir /S /Q %s' - endif - let enc = g:tlib#cache#script_encoding - if has('multi_byte') && enc != &enc - call map(deldir, 'iconv(v:val, &enc, enc)') - endif - let scriptfile = tlib#file#Join([dir, scriptfile]) - if filereadable(scriptfile) - let script = readfile(scriptfile) - else - let script = [] - endif - let script += map(copy(deldir), 'printf(rmdir, shellescape(v:val, 1))') - let script = tlib#list#Uniq(script) - call writefile(script, scriptfile) - call inputsave() - if g:tlib#cache#run_script == 0 - if g:tlib#cache#verbosity >= 1 - echohl WarningMsg - if g:tlib#cache#verbosity >= 2 - echom "TLib: Purged cache. Need to run script to delete directories" - endif - echom "TLib: Please review and execute: ". scriptfile - echohl NONE + let deldir = filter(reverse(sort(deldir)), 's:Delete(msg, v:val, "d")') + if !empty(deldir) + if &shell =~ 'sh\(\.exe\)\?$' + let scriptfile = 'deldir.sh' + let rmdir = 'rm -rf %s' + else + let scriptfile = 'deldir.bat' + let rmdir = 'rmdir /S /Q %s' endif - else - try - let yn = g:tlib#cache#run_script == 2 ? 'y' : tlib#input#Dialog("TLib: About to delete directories by means of a shell script.\nDirectory removal script: ". scriptfile ."\nRun script to delete directories now?", ['yes', 'no', 'edit'], 'no') - if yn =~ '^y\%[es]$' - exec 'cd '. fnameescape(dir) - exec '! ' &shell shellescape(scriptfile, 1) - exec 'cd -' - call delete(scriptfile) - elseif yn =~ '^e\%[dit]$' - exec 'edit '. fnameescape(scriptfile) + let enc = g:tlib#cache#script_encoding + if has('multi_byte') && enc != &enc + call map(deldir, 'iconv(v:val, &enc, enc)') + endif + let scriptfile = tlib#file#Join([dir, scriptfile]) + if filereadable(scriptfile) + let script = readfile(scriptfile) + else + let script = [] + endif + let script += map(copy(deldir), 'printf(rmdir, shellescape(v:val, 1))') + let script = tlib#list#Uniq(script) + call writefile(script, scriptfile) + call inputsave() + if g:tlib#cache#run_script == 0 + if g:tlib#cache#verbosity >= 1 + echohl WarningMsg + if g:tlib#cache#verbosity >= 2 + echom "TLib: Purged cache. Need to run script to delete directories" + endif + echom "TLib: Please review and execute: ". scriptfile + echohl NONE endif - finally - call inputrestore() - endtry + else + try + let yn = g:tlib#cache#run_script == 2 ? 'y' : tlib#input#Dialog("TLib: About to delete directories by means of a shell script.\nDirectory removal script: ". scriptfile ."\nRun script to delete directories now?", ['yes', 'no', 'edit'], 'no') + if yn =~ '^y\%[es]$' + exec 'silent cd '. fnameescape(dir) + exec '! ' &shell shellescape(scriptfile, 1) + exec 'silent cd -' + call delete(scriptfile) + elseif yn =~ '^e\%[dit]$' + exec 'edit '. fnameescape(scriptfile) + endif + finally + call inputrestore() + endtry + endif endif endif call s:PurgeTimestamp(dir) endf +function! s:Delete(msg, file, flags) abort "{{{3 + let rv = delete(a:file, a:flags) + if !rv && g:tlib#cache#verbosity >= 2 + call add(a:msg, "TLib#cache: Delete ". file) + endif + return rv +endf + + function! s:PurgeTimestamp(dir) "{{{3 let last_purge = tlib#file#Join([a:dir, '.last_purge']) " TLogVAR last_purge @@ -338,7 +446,7 @@ function! tlib#cache#ListFilesInCache(...) "{{{3 endif let files = reverse(split(filess, '\n')) let pos0 = len(tlib#dir#CanonicName(dir)) - call filter(files, 's:ShouldPurge(strpart(v:val, pos0))') + call filter(files, 's:ShouldPurge(tlib#string#Strcharpart(v:val, pos0))') return files endf diff --git a/sources_non_forked/tlib/autoload/tlib/date.vim b/sources_non_forked/tlib/autoload/tlib/date.vim index 7be5e9fb..1b7559c8 100644 --- a/sources_non_forked/tlib/autoload/tlib/date.vim +++ b/sources_non_forked/tlib/autoload/tlib/date.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2010-03-25. -" @Last Change: 2015-11-23. -" @Revision: 21.0.34 +" @Last Change: 2017-09-06. +" @Revision: 44.0.34 if !exists('g:tlib#date#ShortDatePrefix') | let g:tlib#date#ShortDatePrefix = '20' | endif "{{{2 @@ -17,12 +17,14 @@ let g:tlib#date#date_format = '%Y-%m-%d' function! tlib#date#IsDate(text) abort "{{{3 - return a:text =~# '^'. g:tlib#date#date_rx .'$' + return a:text =~# '^'. g:tlib#date#date_rx .'$' && + \ !empty(tlib#date#Parse(a:text, 0, 1)) endf -function! tlib#date#Format(secs1970) abort "{{{3 - return strftime(g:tlib#date#date_format, a:secs1970) +function! tlib#date#Format(...) abort "{{{3 + let secs1970 = a:0 >= 1 ? a:1 : localtime() + return strftime(g:tlib#date#date_format, secs1970) endf @@ -37,11 +39,16 @@ function! tlib#date#DiffInDays(date, ...) endf -" :display: tlib#date#Parse(date, ?allow_zero=0) "{{{3 +" :display: tlib#date#Parse(date, ?allow_zero=0, ?silent=0) "{{{3 function! tlib#date#Parse(date, ...) "{{{3 let min = a:0 >= 1 && a:1 ? 0 : 1 - " TLogVAR a:date, min + let silent = a:0 >= 2 ? a:2 : 0 + Tlibtype 'tlib', a:date, min, silent let m = matchlist(a:date, '^\(\d\{2}\|\d\{4}\)-\(\d\{1,2}\)-\(\d\{1,2}\)$') + Tlibtype 'tlib', m + let year = '' + let month = '' + let days = '' if !empty(m) let year = m[1] let month = m[2] @@ -61,13 +68,17 @@ function! tlib#date#Parse(date, ...) "{{{3 endif endif endif + Tlibtype 'tlib', year, month, days if empty(m) || year == '' || month == '' || days == '' || \ month < min || month > 12 || days < min || days > 31 - echoerr 'TLib: Invalid date: '. a:date + if !silent + echoerr 'TLib: Invalid date: '. a:date + endif return [] endif if strlen(year) == 2 let year = g:tlib#date#ShortDatePrefix . year + Tlibtype 'tlib', year endif return [0 + year, 0 + month, 0 + days] endf @@ -137,22 +148,35 @@ function! tlib#date#Shift(date, shift) abort "{{{3 let ml = matchlist(a:date, g:tlib#date#date_rx) " TLogVAR a:date, a:shift, n, ml if a:shift =~ 'd$' - let secs = tlib#date#SecondsSince1970(a:date) + g:tlib#date#dayshift * n - " TLogVAR secs + let date = tlib#date#AddDays(a:date, n) + elseif a:shift =~ 'b$' + let n1 = n + let secs = tlib#date#SecondsSince1970(a:date) + while n1 > 0 + let n1 -= 1 + let secs += g:tlib#date#dayshift + let uday = strftime('%u', secs) + if uday == 6 + let secs += g:tlib#date#dayshift * 2 + elseif uday == 7 + let secs += g:tlib#date#dayshift + endif + endwh let date = tlib#date#Format(secs) elseif a:shift =~ 'w$' - let secs = tlib#date#SecondsSince1970(a:date) + g:tlib#date#dayshift * n * 7 - let date = tlib#date#Format(secs) + let date = tlib#date#AddDays(a:date, n * 7) elseif a:shift =~ 'm$' let d = str2nr(ml[3]) let ms = str2nr(ml[2]) + n let m = (ms - 1) % 12 + 1 - let yr = str2nr(ml[1]) + ms / 12 + let yr = str2nr(ml[1]) + (ms - 1) / 12 let date = printf('%04d-%02d-%02d', yr, m, d) " TLogVAR d, ms, m, yr, date elseif a:shift =~ 'y$' let yr = str2nr(ml[1]) + n let date = substitute(a:date, '^\d\{4}', yr, '') + else + throw 'tlib#date#Shift: Unsupported arguments: '. string(a:shift) endif " if !empty(ml[4]) && date !~ '\s'. ml[4] .'$' " let date .= ' '. ml[4] @@ -161,3 +185,11 @@ function! tlib#date#Shift(date, shift) abort "{{{3 return date endf + +function! tlib#date#AddDays(date, n) abort "{{{3 + let secs = tlib#date#SecondsSince1970(a:date) + g:tlib#date#dayshift * a:n + " TLogVAR secs + let date = tlib#date#Format(secs) + return date +endf + diff --git a/sources_non_forked/tlib/autoload/tlib/dictionary.vim b/sources_non_forked/tlib/autoload/tlib/dictionary.vim index 77712b03..a7785196 100644 --- a/sources_non_forked/tlib/autoload/tlib/dictionary.vim +++ b/sources_non_forked/tlib/autoload/tlib/dictionary.vim @@ -1,14 +1,44 @@ " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @Website: https://github.com/tomtom " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Last Change: 2015-10-14 -" @Revision: 2 +" @Last Change: 2016-04-06 +" @Revision: 22 -function! tlib#dictionary#Rev(dict) abort "{{{3 +" :display: tlib#dictionary#Rev(dict, ?opts = {}) abort "{{{3 +function! tlib#dictionary#Rev(dict, ...) abort "{{{3 + let opts = a:0 >= 1 ? a:1 : {} + Tlibtype a:dict, 'dict', opts, 'dict' let rev = {} + let use_string = get(opts, 'use_string', 0) + let use_eval = get(opts, 'use_eval', 0) + let values_as_list = get(opts, 'values_as_list', 0) for [m, f] in items(a:dict) - let rev[f] = m + if use_string + let k = string(f) + else + let k = type(f) == 1 ? f : string(f) + if k ==# '' + let k = get(opts, 'empty', '') + if empty(k) + continue + endif + endif + endif + if use_eval + let v = eval(m) + else + let v = m + endif + if values_as_list + if has_key(rev, k) + call add(rev[k], v) + else + let rev[k] = [v] + endif + else + let rev[k] = v + endif endfor return rev endf diff --git a/sources_non_forked/tlib/autoload/tlib/dir.vim b/sources_non_forked/tlib/autoload/tlib/dir.vim index f6f3e4e9..02081079 100644 --- a/sources_non_forked/tlib/autoload/tlib/dir.vim +++ b/sources_non_forked/tlib/autoload/tlib/dir.vim @@ -1,7 +1,7 @@ " @Author: Tom Link (micathom AT gmail com?subject=[vim]) " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 40 +" @Revision: 43 " TLet g:tlib#dir#sep = '/' TLet g:tlib#dir#sep = exists('+shellslash') && !&shellslash ? '\' : '/' @@ -65,12 +65,12 @@ endf " :def: function! tlib#dir#CD(dir, ?locally=0) => CWD function! tlib#dir#CD(dir, ...) "{{{3 - TVarArg ['locally', 0] + TVarArg ['locally', haslocaldir()] let cmd = locally ? 'lcd! ' : 'cd! ' " let cwd = getcwd() let cmd .= tlib#arg#Ex(a:dir) " TLogVAR a:dir, locally, cmd - exec cmd + exec 'silent' cmd " return cwd return getcwd() endf @@ -78,7 +78,7 @@ endf " :def: function! tlib#dir#Push(dir, ?locally=0) => CWD function! tlib#dir#Push(dir, ...) "{{{3 - TVarArg ['locally', 0] + TVarArg ['locally', haslocaldir()] call add(s:dir_stack, [getcwd(), locally]) return tlib#dir#CD(a:dir, locally) endf diff --git a/sources_non_forked/tlib/autoload/tlib/file.vim b/sources_non_forked/tlib/autoload/tlib/file.vim index d0f89b96..a52c1be3 100644 --- a/sources_non_forked/tlib/autoload/tlib/file.vim +++ b/sources_non_forked/tlib/autoload/tlib/file.vim @@ -1,7 +1,7 @@ " @Author: Tom Link (micathom AT gmail com?subject=[vim]) " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 168 +" @Revision: 225 if !exists('g:tlib#file#drop') @@ -24,6 +24,12 @@ if !exists('g:tlib#file#absolute_filename_rx') let g:tlib#file#absolute_filename_rx = '^\~\?[\/]' "{{{2 endif + +if !exists('g:tlib#file#reject_rx') + let g:tlib#file#reject_rx = '\%(^\|[\/]\)\%(tags\|Thumbs\.db\)$' "{{{2 +endif + + """ File related {{{1 " For the following functions please see ../../test/tlib.vim for examples. @@ -31,9 +37,9 @@ endif " EXAMPLES: > " tlib#file#Split('foo/bar/filename.txt') " => ['foo', 'bar', 'filename.txt'] -function! tlib#file#Split(filename) "{{{3 +function! tlib#file#Split(filename) abort "{{{3 let prefix = matchstr(a:filename, '^\(\w\+:\)\?/\+') - " TLogVAR prefix + Tlibtrace 'tlib', prefix if !empty(prefix) let filename = a:filename[len(prefix) : -1] else @@ -52,9 +58,9 @@ endf " EXAMPLES: > " tlib#file#Join(['foo', 'bar', 'filename.txt']) " => 'foo/bar/filename.txt' -function! tlib#file#Join(filename_parts, ...) "{{{3 +function! tlib#file#Join(filename_parts, ...) abort "{{{3 TVarArg ['strip_slashes', 1], 'maybe_absolute' - " TLogVAR a:filename_parts, strip_slashes + Tlibtrace 'tlib', a:filename_parts, strip_slashes if maybe_absolute let filename_parts = [] for part in a:filename_parts @@ -70,7 +76,7 @@ function! tlib#file#Join(filename_parts, ...) "{{{3 " let rx = tlib#rx#Escape(g:tlib#dir#sep) .'$' let rx = '[/\\]\+$' let parts = map(copy(filename_parts), 'substitute(v:val, rx, "", "")') - " TLogVAR parts + Tlibtrace 'tlib', parts return join(parts, g:tlib#dir#sep) else return join(filename_parts, g:tlib#dir#sep) @@ -81,18 +87,18 @@ endf " EXAMPLES: > " tlib#file#Relative('foo/bar/filename.txt', 'foo') " => 'bar/filename.txt' -function! tlib#file#Relative(filename, basedir) "{{{3 - " TLogVAR a:filename, a:basedir +function! tlib#file#Relative(filename, basedir) abort "{{{3 + Tlibtrace 'tlib', a:filename, a:basedir " TLogDBG getcwd() " TLogDBG expand('%:p') let b0 = tlib#file#Absolute(a:basedir) let b = tlib#file#Split(b0) - " TLogVAR b + Tlibtrace 'tlib', b let f0 = tlib#file#Absolute(a:filename) let fn = fnamemodify(f0, ':t') let fd = fnamemodify(f0, ':h') let f = tlib#file#Split(fd) - " TLogVAR f0, fn, fd, f + Tlibtrace 'tlib', f0, fn, fd, f if f[0] != b[0] let rv = f0 else @@ -103,18 +109,23 @@ function! tlib#file#Relative(filename, basedir) "{{{3 call remove(f, 0) call remove(b, 0) endwh - " TLogVAR f, b + Tlibtrace 'tlib', f, b let rv = tlib#file#Join(repeat(['..'], len(b)) + f + [fn]) endif - " TLogVAR rv + Tlibtrace 'tlib', rv return rv endf -function! tlib#file#Absolute(filename, ...) "{{{3 +function! tlib#file#IsAbsolute(filename) abort "{{{3 + return a:filename =~? '^\%(/\|\w\+:/\)' +endf + + +function! tlib#file#Absolute(filename, ...) abort "{{{3 if filereadable(a:filename) let filename = fnamemodify(a:filename, ':p') - elseif a:filename =~ '^\(/\|[^\/]\+:\)' + elseif a:filename =~# '^\(/\|[^\/]\+:\)' let filename = a:filename else let cwd = a:0 >= 1 ? a:1 : getcwd() @@ -126,17 +137,19 @@ function! tlib#file#Absolute(filename, ...) "{{{3 endf -function! tlib#file#Canonic(filename, ...) "{{{3 +function! tlib#file#Canonic(filename, ...) abort "{{{3 TVarArg ['mode', ''] - if a:filename =~ '^\\\\' - let mode = 'windows' - elseif a:filename =~ '^\(file\|ftp\|http\)s\?:' - let mode = 'url' - elseif (empty(mode) && g:tlib#sys#windows) - let mode = 'windows' + if empty(mode) + if a:filename =~# '^\\\\' + let mode = 'windows' + elseif a:filename =~# '^\(file\|ftp\|http\)s\?:' + let mode = 'url' + elseif (empty(mode) && g:tlib#sys#windows) + let mode = 'windows' + endif endif let filename = a:filename - if mode == 'windows' + if mode ==# 'windows' let filename = substitute(filename, '/', '\\', 'g') else let filename = substitute(filename, '\\', '/', 'g') @@ -145,7 +158,7 @@ function! tlib#file#Canonic(filename, ...) "{{{3 endf -function! s:SetScrollBind(world) "{{{3 +function! s:SetScrollBind(world) abort "{{{3 let sb = get(a:world, 'scrollbind', &scrollbind) if sb != &scrollbind let &scrollbind = sb @@ -153,60 +166,81 @@ function! s:SetScrollBind(world) "{{{3 endf -" :def: function! tlib#file#With(fcmd, bcmd, files, ?world={}) -function! tlib#file#With(fcmd, bcmd, files, ...) "{{{3 - " TLogVAR a:fcmd, a:bcmd, a:files +" :def: function! tlib#file#With(fcmd, bcmd, files, ?world={}) abort +function! tlib#file#With(fcmd, bcmd, files, ...) abort "{{{3 + Tlibtrace 'tlib', a:fcmd, a:bcmd, a:files + let world = a:0 >= 1 ? a:1 : {} + let unset_switchbuf = a:0 >= 2 ? a:2 : 0 exec tlib#arg#Let([['world', {}]]) call tlib#autocmdgroup#Init() augroup TLibFileRead autocmd! augroup END - for f in a:files - let bn = bufnr('^'.f.'$') - " TLogVAR f, bn - let bufloaded = bufloaded(bn) - let ok = 0 - let s:bufread = "" - if bn != -1 && buflisted(bn) - if !empty(a:bcmd) - " TLogDBG a:bcmd .' '. bn - exec a:bcmd .' '. bn - let ok = 1 - call s:SetScrollBind(world) - endif - else - if filereadable(f) - if !empty(a:fcmd) - " TLogDBG a:fcmd .' '. tlib#arg#Ex(f) - exec 'autocmd TLibFileRead BufRead' escape(f, '\ ') 'let s:bufread=expand(":p")' - try - exec a:fcmd .' '. tlib#arg#Ex(f) - finally - exec 'autocmd! TLibFileRead BufRead' - endtry - let ok = 1 - call s:SetScrollBind(world) + if unset_switchbuf + let switchbuf = &switchbuf + set switchbuf& + endif + try + for f in a:files + try + let bn = bufnr('^'.f.'$') + Tlibtrace 'tlib', f, bn + let bufloaded = bufloaded(bn) + let ok = 0 + let s:bufread = "" + if bn != -1 && buflisted(bn) + if !empty(a:bcmd) + let bcmd = a:bcmd .' '. bn + Tlibtrace 'tlib', bcmd + exec bcmd + let ok = 1 + call s:SetScrollBind(world) + endif + else + if filereadable(f) + if !empty(a:fcmd) + " TLogDBG a:fcmd .' '. tlib#arg#Ex(f) + exec 'autocmd TLibFileRead BufRead' escape(f, '\ ') 'let s:bufread=expand(":p")' + try + let fcmd = a:fcmd .' '. tlib#arg#Ex(f) + Tlibtrace 'tlib', fcmd + exec fcmd + finally + exec 'autocmd! TLibFileRead BufRead' + endtry + let ok = 1 + call s:SetScrollBind(world) + endif + else + echohl error + echom 'File not readable: '. f + echohl NONE + endif endif - else - echohl error - echom 'File not readable: '. f + Tlibtrace 'tlib', ok, bufloaded, &filetype + if empty(s:bufread) && ok && !bufloaded && empty(&filetype) + doautocmd BufRead + endif + catch /^Vim\%((\a\+)\)\=:E325/ + echohl ErrorMsg + echom v:exception echohl NONE - endif + endtry + endfor + finally + augroup! TLibFileRead + if unset_switchbuf + let &switchbuf = switchbuf endif - " TLogVAR ok, bufloaded, &filetype - if empty(s:bufread) && ok && !bufloaded && empty(&filetype) - doautocmd BufRead - endif - endfor - augroup! TLibFileRead - unlet! s:bufread + unlet! s:bufread + endtry " TLogDBG "done" endf " Return 0 if the file isn't readable/doesn't exist. " Otherwise return 1. -function! tlib#file#Edit(fileid) "{{{3 +function! tlib#file#Edit(fileid) abort "{{{3 if type(a:fileid) == 0 let bn = a:fileid let filename = fnamemodify(bufname(bn), ':p') @@ -217,20 +251,26 @@ function! tlib#file#Edit(fileid) "{{{3 if filename == expand('%:p') return 1 else - " TLogVAR a:fileid, bn, filename, g:tlib#file#drop, filereadable(filename) + Tlibtrace 'tlib', a:fileid, bn, filename, g:tlib#file#drop, filereadable(filename), bufnr('%') if bn != -1 && buflisted(bn) if g:tlib#file#drop " echom "DBG" get(g:tlib#file#edit_cmds, 'drop', 'drop') fnameescape(filename) exec get(g:tlib#file#edit_cmds, 'drop', 'drop') fnameescape(filename) + " echom "DBG" bufnr('%') else " echom "DBG" get(g:tlib#file#edit_cmds, 'buffer', 'buffer') bn exec get(g:tlib#file#edit_cmds, 'buffer', 'buffer') bn + " echom "DBG" bufnr('%') endif return 1 - elseif filereadable(filename) + endif + if !filereadable(filename) && exists('#TLibPrepareFile#User') + exec 'doautocmd TLibPrepareFile User' filename + endif + if filereadable(filename) try " let file = tlib#arg#Ex(filename) - " " TLogVAR file + " Tlibtrace 'tlib', file " echom "DBG" get(g:tlib#file#edit_cmds, 'edit', 'edit') fnameescape(filename) exec get(g:tlib#file#edit_cmds, 'edit', 'edit') fnameescape(filename) catch /E325/ @@ -252,27 +292,65 @@ function! tlib#file#Edit(fileid) "{{{3 endf +function! tlib#file#FilterFiles(files, options) abort "{{{3 + Tlibtrace 'tlib', a:files, a:options, g:tlib#file#reject_rx + if !get(a:options, 'all', 0) + call filter(a:files, 'v:val !~# g:tlib#file#reject_rx') + endif + Tlibtrace 'tlib', a:files + let type = get(a:options, 'type', 'fd') + Tlibtrace 'tlib', type + if type !~# 'd' || type !~# 'f' + call filter(a:files, 'isdirectory(v:val) ? type =~# "d" : type =~# "f"') + endif + Tlibtrace 'tlib', a:files + return a:files +endf + + if v:version > 704 || (v:version == 704 && has('patch279')) - function! tlib#file#Glob(pattern) abort "{{{3 - return glob(a:pattern, 0, 1) + function! tlib#file#Glob(pattern, ...) abort "{{{3 + let all = a:0 >= 1 ? a:1 : 0 + let nosuf = a:0 >= 2 ? a:2 : 0 + return tlib#file#FilterFiles(glob(a:pattern, nosuf, 1), {'all': all}) endf - function! tlib#file#Globpath(path, pattern) abort "{{{3 - return globpath(a:path, a:pattern, 0, 1) + function! tlib#file#Globpath(path, pattern, ...) abort "{{{3 + let all = a:0 >= 1 ? a:1 : 0 + let nosuf = a:0 >= 2 ? a:2 : 0 + return tlib#file#FilterFiles(globpath(a:path, a:pattern, nosuf, 1), {'all': all}) endf else " :nodoc: - function! tlib#file#Glob(pattern) abort "{{{3 - return split(glob(a:pattern), '\n') + function! tlib#file#Glob(pattern, ...) abort "{{{3 + let all = a:0 >= 1 ? a:1 : 0 + let nosuf = a:0 >= 2 ? a:2 : 0 + return tlib#file#FilterFiles(split(glob(a:pattern, nosuf), '\n'), {'all': all}) endf " :nodoc: - function! tlib#file#Globpath(path, pattern) abort "{{{3 - return split(globpath(a:path, a:pattern), '\n') + function! tlib#file#Globpath(path, pattern, ...) abort "{{{3 + let all = a:0 >= 1 ? a:1 : 0 + let nosuf = a:0 >= 2 ? a:2 : 0 + return tlib#file#FilterFiles(split(globpath(a:path, a:pattern), '\n'), {'all': all}) endf endif + +let s:filereadable = {} + +augroup TLib + autocmd BufWritePost,FileWritePost,FocusLost * let s:filereadable = {} +augroup end + +function! tlib#file#Filereadable(filename) abort "{{{3 + if !has_key(s:filereadable, a:filename) + let s:filereadable[a:filename] = filereadable(a:filename) + endif + return s:filereadable[a:filename] +endf + diff --git a/sources_non_forked/tlib/autoload/tlib/input.vim b/sources_non_forked/tlib/autoload/tlib/input.vim index e8f892b0..e294e2ac 100644 --- a/sources_non_forked/tlib/autoload/tlib/input.vim +++ b/sources_non_forked/tlib/autoload/tlib/input.vim @@ -1,8 +1,7 @@ " @Author: Tom Link (micathom AT gmail com?subject=[vim]) " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 1366 - +" @Revision: 1430 " :filedoc: " Input-related, select from a list etc. @@ -312,7 +311,7 @@ function! tlib#input#List(type, ...) "{{{3 if !empty(filter) " let world.initial_filter = [[''], [filter]] " let world.initial_filter = [[filter]] - " TLogVAR world.initial_filter + Tlibtrace 'tlib', world.initial_filter, filter call world.SetInitialFilter(filter) endif endif @@ -333,10 +332,11 @@ endf " (an instance of tlib#World as returned by |tlib#World#New|). function! tlib#input#ListW(world, ...) "{{{3 TVarArg 'cmd' - " let time0 = str2float(reltimestr(reltime())) " DBG - " TLogVAR time0 + let time0 = str2float(reltimestr(reltime())) + Tlibtrace 'tlib', time0 let world = a:world if world.pick_last_item >= 1 && stridx(world.type, 'e') == -1 && len(world.base) <= 1 + call world.CloseScratch(1) let rv = get(world.base, 0, world.rv) if stridx(world.type, 'm') != -1 return [rv] @@ -345,7 +345,7 @@ function! tlib#input#ListW(world, ...) "{{{3 endif endif call s:Init(world, cmd) - " TLogVAR world.state, world.sticky, world.initial_index + Tlibtrace 'tlib', world.state, world.sticky, world.initial_index " let statusline = &l:statusline " let laststatus = &laststatus let showmode = &showmode @@ -361,38 +361,24 @@ function! tlib#input#ListW(world, ...) "{{{3 try while !empty(world.state) && world.state !~ '^exit' && (world.show_empty || !empty(world.base)) let post_keys = '' - " TLogDBG 'while' - " TLogVAR world.state - " let time01 = str2float(reltimestr(reltime())) " DBG - " TLogVAR time01, time01 - time0 + Tlibtrace 'tlib', 'while', world.state + let time01 = str2float(reltimestr(reltime())) + Tlibtrace 'tlib', time01, time01 - time0 try let world = s:RunStateHandlers(world) - " if exists('b:tlib_world_event') - " let event = b:tlib_world_event - " unlet! b:tlib_world_event - " if event == 'WinLeave' - " " let world.resume_state = world.state - " let world = tlib#agent#Suspend(world, world.rv) - " break - " endif - " endif - - " let time02 = str2float(reltimestr(reltime())) " DBG - " TLogVAR time02, time02 - time0 + let time02 = str2float(reltimestr(reltime())) + Tlibtrace 'tlib', time02, time02 - time0 if world.state =~ '\' - " TLogDBG 'reset' - " call world.Reset(world.state =~ '\') call world.Reset() continue endif call s:SetOffset(world) - " let time02 = str2float(reltimestr(reltime())) " DBG - " TLogVAR time02, time02 - time0 - " TLogDBG 1 - " TLogVAR world.state + let time02 = str2float(reltimestr(reltime())) + Tlibtrace 'tlib', time02, time02 - time0 + Tlibtrace 'tlib', world.state if world.state == 'scroll' let world.prefidx = world.offset let world.state = 'redisplay' @@ -402,33 +388,26 @@ function! tlib#input#ListW(world, ...) "{{{3 let world.sticky = 1 endif - " TLogVAR world.filter - " TLogVAR world.sticky + Tlibtrace 'tlib', world.filter + Tlibtrace 'tlib', world.sticky if world.state =~ '\' - " TLogVAR world.rv + Tlibtrace 'tlib', world.rv throw 'picked' elseif world.state =~ '\' let world.rv = world.CurrentItem() - " TLogVAR world.rv + Tlibtrace 'tlib', world.rv throw 'picked' elseif world.state =~ 'display' if world.state =~ '^display' - " let time03 = str2float(reltimestr(reltime())) " DBG - " TLogVAR time03, time03 - time0 + let time03 = str2float(reltimestr(reltime())) + Tlibtrace 'tlib', time03, time03 - time0 if world.IsValidFilter() - - " let time1 = str2float(reltimestr(reltime())) " DBG - " TLogVAR time1, time1 - time0 + let time1 = str2float(reltimestr(reltime())) + Tlibtrace 'tlib', time1, time1 - time0 call world.BuildTableList() - " let time2 = str2float(reltimestr(reltime())) " DBG - " TLogVAR time2, time2 - time0 - " TLogDBG 2 - " TLogDBG len(world.table) - " TLogVAR world.table - " let world.list = map(copy(world.table), 'world.GetBaseItem(v:val)') - " TLogDBG 3 + let time2 = str2float(reltimestr(reltime())) + Tlibtrace 'tlib', time2, time2 - time0 let world.llen = len(world.list) - " TLogVAR world.index_table if empty(world.index_table) let dindex = range(1, world.llen) let world.index_width = len(world.llen) @@ -436,12 +415,11 @@ function! tlib#input#ListW(world, ...) "{{{3 let dindex = world.index_table let world.index_width = len(max(dindex)) endif - " let time3 = str2float(reltimestr(reltime())) " DBG - " TLogVAR time3, time3 - time0 + let time3 = str2float(reltimestr(reltime())) + Tlibtrace 'tlib', time3, time3 - time0 if world.llen == 0 && !world.show_empty call world.ReduceFilter() let world.offset = 1 - " TLogDBG 'ReduceFilter' continue else if world.llen == 1 @@ -449,18 +427,15 @@ function! tlib#input#ListW(world, ...) "{{{3 if world.pick_last_item >= 2 " echom 'Pick last item: '. world.list[0] let world.prefidx = '1' - " TLogDBG 'pick last item' throw 'pick' endif else let world.last_item = '' endif endif - " let time4 = str2float(reltimestr(reltime())) " DBG - " TLogVAR time4, time4 - time0 - " TLogDBG 4 - " TLogVAR world.idx, world.llen, world.state - " TLogDBG world.FilterIsEmpty() + let time4 = str2float(reltimestr(reltime())) + Tlibtrace 'tlib', time4, time4 - time0 + Tlibtrace 'tlib', world.idx, world.llen, world.state if world.state == 'display' if world.idx == '' && world.llen < g:tlib#input#sortprefs_threshold && !world.FilterIsEmpty() call world.SetPrefIdx() @@ -473,27 +448,22 @@ function! tlib#input#ListW(world, ...) "{{{3 let world.prefidx = 1 endif endif - " let time5 = str2float(reltimestr(reltime())) " DBG - " TLogVAR time5, time5 - time0 - " TLogVAR world.initial_index, world.prefidx - " TLogDBG 5 - " TLogDBG len(world.list) - " TLogVAR world.list + let time5 = str2float(reltimestr(reltime())) + Tlibtrace 'tlib', time5, time5 - time0 + Tlibtrace 'tlib', world.initial_index, world.prefidx + Tlibtrace 'tlib', len(world.list) let dlist = world.DisplayFormat(world.list) - " TLogVAR world.prefidx - " TLogDBG 6 - " let time6 = str2float(reltimestr(reltime())) " DBG - " TLogVAR time6, time6 - time0 + Tlibtrace 'tlib', world.prefidx + let time6 = str2float(reltimestr(reltime())) + Tlibtrace 'tlib', time6, time6 - time0 if world.offset_horizontal > 0 - call map(dlist, 'v:val[world.offset_horizontal:-1]') + call map(dlist, 'tlib#string#Strcharpart(v:val, world.offset_horizontal)') endif - " let time7 = str2float(reltimestr(reltime())) " DBG - " TLogVAR time7, time7 - time0 - " TLogVAR dindex + let time7 = str2float(reltimestr(reltime())) + Tlibtrace 'tlib', time7, time7 - time0 let dlist = map(range(0, world.llen - 1), 'printf("%0'. world.index_width .'d", dindex[v:val]) .": ". dlist[v:val]') - " TLogVAR dlist - " let time8 = str2float(reltimestr(reltime())) " DBG - " TLogVAR time8, time8 - time0 + let time8 = str2float(reltimestr(reltime())) + Tlibtrace 'tlib', time8, time8 - time0 else @@ -505,30 +475,14 @@ function! tlib#input#ListW(world, ...) "{{{3 let world.prefidx = 1 endif endif - " TLogVAR world.idx, world.prefidx + Tlibtrace 'tlib', world.idx, world.prefidx - " TLogDBG 7 - " TLogVAR world.prefidx, world.offset - " TLogDBG (world.prefidx > world.offset + winheight(0) - 1) - " if world.prefidx > world.offset + winheight(0) - 1 - " let listtop = world.llen - winheight(0) + 1 - " let listoff = world.prefidx - winheight(0) + 1 - " let world.offset = min([listtop, listoff]) - " TLogVAR world.prefidx - " TLogDBG len(list) - " TLogDBG winheight(0) - " TLogVAR listtop, listoff, world.offset - " elseif world.prefidx < world.offset - " let world.offset = world.prefidx - " endif - " TLogDBG 8 - " TLogVAR world.initial_display, !tlib#char#IsAvailable() + Tlibtrace 'tlib', world.prefidx, world.offset + Tlibtrace 'tlib', world.initial_display, !tlib#char#IsAvailable() if world.state =~ '\' || world.initial_display || !tlib#char#IsAvailable() - " TLogDBG len(dlist) call world.DisplayList(world.Query(), dlist) call world.FollowCursor() let world.initial_display = 0 - " TLogDBG 9 endif if world.state =~ '\' let world.state = 'suspend' @@ -548,9 +502,10 @@ function! tlib#input#ListW(world, ...) "{{{3 endif endif " TAssert IsNotEmpty(world.scratch) + let world.list_wid = tlib#win#GetID() let world.list_wnr = winnr() - " TLogVAR world.state, world.next_state + Tlibtrace 'tlib', world.state, world.next_state if !empty(world.next_state) let world.state = world.next_state let world.next_state = '' @@ -568,7 +523,7 @@ function! tlib#input#ListW(world, ...) "{{{3 endif if has('gui_win32') let exec_cmd = input(query, '') - " TLogVAR exec_cmd + Tlibtrace 'tlib', exec_cmd if exec_cmd == '' let world.state = 'redisplay' else @@ -576,17 +531,15 @@ function! tlib#input#ListW(world, ...) "{{{3 endif elseif has('gui_gtk') || has('gui_gtk2') let c = s:GetModdedChar(world) - " TLogVAR c + Tlibtrace 'tlib', c endif else - " TLogVAR world.timeout + Tlibtrace 'tlib', world.timeout let c = s:GetModdedChar(world) - " TLogVAR c, has_key(world.key_map[world.key_mode],c) + Tlibtrace 'tlib', c, has_key(world.key_map[world.key_mode],c) endif - " TLogVAR c - " TLogDBG string(sort(keys(world.key_map[world.key_mode]))) - - " TLogVAR world.next_agent, world.next_eval + Tlibtrace 'tlib', c + Tlibtrace 'tlib', world.next_agent, world.next_eval if !empty(world.next_agent) let nagent = world.next_agent let world.next_agent = '' @@ -604,19 +557,17 @@ function! tlib#input#ListW(world, ...) "{{{3 elseif has_key(world.key_map[world.key_mode], c) let sr = @/ silent! let @/ = lastsearch - " TLogVAR c, world.key_map[world.key_mode][c] + Tlibtrace 'tlib', c, world.key_map[world.key_mode][c] " TLog "Agent: ". string(world.key_map[world.key_mode][c]) let handler = world.key_map[world.key_mode][c] - " " TLogVAR handler - " let world = call(handler.agent, [world, world.GetSelectedItems(world.CurrentItem())]) - " call s:CheckAgentReturnValue(c, world) + Tlibtrace 'tlib', handler let world = s:CallAgent(handler, world, world.GetSelectedItems(world.CurrentItem())) silent! let @/ = sr " continue elseif c == 13 throw 'pick' elseif c == 27 - " TLogVAR c, world.key_mode + Tlibtrace 'tlib', c, world.key_mode if world.key_mode != 'default' let world.key_mode = 'default' let world.state = 'redisplay' @@ -666,7 +617,7 @@ function! tlib#input#ListW(world, ...) "{{{3 let world.state = 'exit empty' endif endif - " TLogVAR world.prefidx, world.state + Tlibtrace 'tlib', world.prefidx, world.state elseif has_key(world.key_map[world.key_mode], 'unknown_key') let agent = world.key_map[world.key_mode].unknown_key.agent " let world = call(agent, [world, c]) @@ -675,17 +626,17 @@ function! tlib#input#ListW(world, ...) "{{{3 elseif c >= 32 let world.state = 'display' let numbase = get(world.numeric_chars, c, -99999) - " TLogVAR numbase, world.numeric_chars, c + Tlibtrace 'tlib', numbase, world.numeric_chars, c if numbase != -99999 let world.idx .= (c - numbase) if len(world.idx) == world.index_width let world.prefidx = world.idx - " TLogVAR world.prefidx + Tlibtrace 'tlib', world.prefidx throw 'pick' endif else let world.idx = '' - " TLogVAR world.filter + Tlibtrace 'tlib', world.filter if world.llen > g:tlib#input#livesearch_threshold let pattern = input('Filter: ', world.CleanFilter(world.filter[0][0]) . nr2char(c)) if empty(pattern) @@ -718,61 +669,50 @@ function! tlib#input#ListW(world, ...) "{{{3 call world.ClearAllMarks() call world.MarkCurrent(world.prefidx) let world.state = '' - " TLogDBG 'Pick item #'. world.prefidx finally - " TLogDBG 'finally 1', world.state if world.state =~ '\' " if !world.allow_suspend " echom "Cannot be suspended" " let world.state = 'redisplay' " endif elseif !empty(world.list) && !empty(world.base) - " TLogVAR world.list if empty(world.state) let world.rv = world.CurrentItem() - " TLogVAR world.state, world.rv + Tlibtrace 'tlib', world.state, world.rv endif - " TLogVAR "postprocess" for handler in world.post_handlers let state = get(handler, 'postprocess', '') - " TLogVAR handler - " TLogVAR state - " TLogVAR world.state + Tlibtrace 'tlib', handler + Tlibtrace 'tlib', state + Tlibtrace 'tlib', world.state if state == world.state let agent = handler.agent let [world, world.rv] = call(agent, [world, world.rv]) - " TLogVAR world.state, world.rv + Tlibtrace 'tlib', world.state, world.rv call s:CheckAgentReturnValue(agent, world) endif endfor endif - " TLogDBG 'state0='. world.state endtry - " TLogDBG 'state1='. world.state endwh - " TLogVAR world.state - " TLogDBG string(tlib#win#List()) - " TLogDBG 'exit while loop' - " TLogVAR world.list - " TLogVAR world.sel_idx - " TLogVAR world.idx - " TLogVAR world.prefidx - " TLogVAR world.rv - " TLogVAR world.type, world.state, world.return_agent, world.index_table, world.rv + Tlibtrace 'tlib', world.state + Tlibtrace 'tlib', len(world.list) + Tlibtrace 'tlib', world.sel_idx + Tlibtrace 'tlib', world.idx + Tlibtrace 'tlib', world.prefidx + Tlibtrace 'tlib', world.rv if world.state =~ '\<\(empty\|escape\)\>' let world.sticky = 0 endif if world.state =~ '\' - " TLogDBG 'return suspended' - " TLogVAR world.prefidx + Tlibtrace 'tlib', world.prefidx " exec world.prefidx return elseif world.state =~ '\' " TLog "empty" - " TLogDBG 'return empty' - " TLogVAR world.type + Tlibtrace 'tlib', world.type if stridx(world.type, 'm') != -1 return [] elseif stridx(world.type, 'i') != -1 @@ -781,23 +721,18 @@ function! tlib#input#ListW(world, ...) "{{{3 return '' endif elseif !empty(world.return_agent) - " TLogDBG 'return agent' - " TLogVAR world.return_agent - call world.CloseScratch() - " TLogDBG "return_agent ". string(tlib#win#List()) + Tlibtrace 'tlib', world.return_agent + call world.CloseScratch(1) " TAssert IsNotEmpty(world.scratch) return call(world.return_agent, [world, world.GetSelectedItems(world.rv)]) elseif stridx(world.type, 'w') != -1 " TLog "return_world" - " TLogDBG 'return world' return world elseif stridx(world.type, 'm') != -1 " TLog "return_multi" - " TLogDBG 'return multi' return world.GetSelectedItems(world.rv) elseif stridx(world.type, 'i') != -1 " TLog "return_index" - " TLogDBG 'return index' if empty(world.index_table) return world.rv else @@ -805,14 +740,13 @@ function! tlib#input#ListW(world, ...) "{{{3 endif else " TLog "return_else" - " TLogDBG 'return normal' return world.rv endif finally call world.Leave() - " TLogVAR statusline + " Tlibtrace 'tlib', statusline " let &l:statusline = statusline " let &laststatus = laststatus if &showmode != showmode @@ -824,42 +758,39 @@ function! tlib#input#ListW(world, ...) "{{{3 silent! aunmenu ]TLibInputListPopupMenu endif - " TLogDBG 'finally 2' - " TLogDBG string(world.Methods()) - " TLogVAR world.state - " TLogDBG string(tlib#win#List()) + Tlibtrace 'tlib', world.state if world.state !~ '\' " redraw - " TLogVAR world.sticky, bufnr("%") + Tlibtrace 'tlib', world.sticky, bufnr("%") if world.sticky - " TLogDBG "sticky" - " TLogVAR world.bufnr - " TLogDBG bufwinnr(world.bufnr) + Tlibtrace 'tlib', world.bufnr if world.scratch_split > 0 if bufwinnr(world.bufnr) == -1 - " TLogDBG "UseScratch" call world.UseScratch() endif let world = tlib#agent#SuspendToParentWindow(world, world.GetSelectedItems(world.rv)) endif else - " TLogDBG "non sticky" - " TLogVAR world.state, world.win_wnr, world.bufnr - if world.CloseScratch() - " TLogVAR world.winview + Tlibtrace 'tlib', world.state, world.win_id, world.bufnr + if world.CloseScratch(1) + Tlibtrace 'tlib', get(world,'winview','') call tlib#win#SetLayout(world.winview) endif endif endif + if world.state !~ '\' + call world.RestoreWindow() + endif " for i in range(0,5) " call getchar(0) " endfor echo redraw! if !empty(post_keys) - " TLogVAR post_keys + Tlibtrace 'tlib', post_keys call feedkeys(post_keys) endif + let world.state = '' endtry endf @@ -871,7 +802,7 @@ function! s:CallAgent(handler, world, list) abort "{{{3 let args += a:handler.args endif let world = call(agent, args) - " TLogVAR world.state, world.rv + Tlibtrace 'tlib', world.state, world.rv call s:CheckAgentReturnValue(agent, world) return world endf @@ -887,7 +818,7 @@ endf function! s:Init(world, cmd) "{{{3 - " TLogVAR a:cmd + Tlibtrace 'tlib', a:cmd let a:world.initial_display = 1 if a:cmd =~ '\' let a:world.sticky = 1 @@ -905,7 +836,7 @@ function! s:Init(world, cmd) "{{{3 " let a:world.state = a:world.resume_state " endif elseif !a:world.initialized - " TLogVAR a:world.initialized, a:world.win_wnr, a:world.bufnr + Tlibtrace 'tlib', a:world.initialized, a:world.win_id, a:world.bufnr let a:world.filetype = &filetype let a:world.fileencoding = &fileencoding call a:world.SetMatchMode(tlib#var#Get('tlib#input#filter_mode', 'wb')) @@ -913,9 +844,9 @@ function! s:Init(world, cmd) "{{{3 if !has_key(a:world, 'key_mode') let a:world.key_mode = 'default' endif - " TLogVAR has_key(a:world,'key_map') + Tlibtrace 'tlib', has_key(a:world,'key_map') if has_key(a:world, 'key_map') - " TLogVAR has_key(a:world.key_map,a:world.key_mode) + Tlibtrace 'tlib', has_key(a:world.key_map,a:world.key_mode) if has_key(a:world.key_map, a:world.key_mode) let a:world.key_map[a:world.key_mode] = extend( \ a:world.key_map[a:world.key_mode], @@ -929,14 +860,14 @@ function! s:Init(world, cmd) "{{{3 \ a:world.key_mode : copy(g:tlib#input#keyagents_InputList_s) \ } endif - " TLogVAR a:world.type + Tlibtrace 'tlib', a:world.type if stridx(a:world.type, 'm') != -1 call extend(a:world.key_map[a:world.key_mode], g:tlib#input#keyagents_InputList_m, 'force') endif for key_mode in keys(a:world.key_map) let a:world.key_map[key_mode] = map(a:world.key_map[key_mode], 'type(v:val) == 4 ? v:val : {"agent": v:val}') endfor - " TLogVAR a:world.key_mode + Tlibtrace 'tlib', a:world.key_mode if type(a:world.key_handlers) == 3 call s:ExtendKeyMap(a:world, a:world.key_mode, a:world.key_handlers) elseif type(a:world.key_handlers) == 4 @@ -946,12 +877,12 @@ function! s:Init(world, cmd) "{{{3 else throw "tlib#input#ListW: key_handlers must be either a list or a dictionary" endif - " TLogVAR a:world.type, a:world.key_map + Tlibtrace 'tlib', a:world.type, a:world.key_map if !empty(a:cmd) let a:world.state .= ' '. a:cmd endif endif - " TLogVAR a:world.state, a:world.sticky + Tlibtrace 'tlib', a:world.state, a:world.sticky endf @@ -979,7 +910,7 @@ function! s:PopupmenuExists() let rv = 0 endtry endif - " TLogVAR rv + Tlibtrace 'tlib', rv return rv endf @@ -1144,9 +1075,9 @@ function! tlib#input#EditList(query, list, ...) "{{{3 let handlers = a:0 >= 1 && !empty(a:1) ? a:1 : g:tlib#input#handlers_EditList let default = a:0 >= 2 ? a:2 : [] let timeout = a:0 >= 3 ? a:3 : 0 - " TLogVAR handlers + Tlibtrace 'tlib', handlers let rv = tlib#input#List('me', a:query, copy(a:list), handlers, default, timeout) - " TLogVAR rv + Tlibtrace 'tlib', rv if empty(rv) return a:list else @@ -1157,7 +1088,7 @@ endf function! tlib#input#Resume(name, pick, bufnr) "{{{3 - " TLogVAR a:name, a:pick + Tlibtrace 'tlib', a:name, a:pick echo if bufnr('%') != a:bufnr if g:tlib#debug @@ -1182,10 +1113,8 @@ function! tlib#input#Resume(name, pick, bufnr) "{{{3 else call tlib#autocmdgroup#Init() autocmd! TLib BufEnter - if b:tlib_{a:name}.state =~ '\' + if b:tlib_{a:name}.state !~# 'display\>' let b:tlib_{a:name}.state = 'redisplay' - else - let b:tlib_{a:name}.state .= ' redisplay' endif " call tlib#input#List('resume '. a:name) let cmd = 'resume '. a:name @@ -1245,24 +1174,25 @@ endf " endif " endf " call tlib#input#Edit('foo', b:var, 'FooContinue') -function! tlib#input#Edit(name, value, callback, ...) "{{{3 - " TLogVAR a:value +function! tlib#input#EditW(world, name, value, callback, ...) "{{{3 + Tlibtrace 'tlib', a:value TVarArg ['args', []] - let sargs = {'scratch': '__EDIT__'. a:name .'__', 'win_wnr': winnr()} + let sargs = {'scratch': '__EDIT__'. a:name .'__', 'win_id': tlib#win#GetID()} let scr = tlib#scratch#UseScratch(sargs) + let b:tlib_world = a:world " :nodoc: - map c :call EditCallback(0) + map c :call tlib#input#EditCallback(0) " :nodoc: - imap c call EditCallback(0) + imap c call tlib#input#EditCallback(0) " :nodoc: - map :call EditCallback(1) + map :call tlib#input#EditCallback(1) " :nodoc: - imap call EditCallback(1) + imap call tlib#input#EditCallback(1) " :nodoc: - map :call EditCallback(1) + map :call tlib#input#EditCallback(1) " :nodoc: - imap call EditCallback(1) + imap call tlib#input#EditCallback(1) call tlib#normal#WithRegister('gg"tdG', 't') call append(1, split(a:value, "\", 1)) @@ -1285,14 +1215,17 @@ function! tlib#input#Edit(name, value, callback, ...) "{{{3 endif let b:tlib_scratch_edit_args = args let b:tlib_scratch_edit_scratch = sargs - " exec 'autocmd BufDelete,BufHidden,BufUnload call s:EditCallback('. string(a:name) .')' + " exec 'autocmd BufDelete,BufHidden,BufUnload call tlib#input#EditCallback('. string(a:name) .')' " echohl MoreMsg " echom 'Press to enter, c to cancel editing.' " echohl NONE + let world = getbufvar(scr, 'tlib_world', a:world) + let world.state .= ' norestore' + return world endf -function! s:EditCallback(...) "{{{3 +function! tlib#input#EditCallback(...) "{{{3 TVarArg ['ok', -1] " , ['bufnr', -1] " autocmd! BufDelete,BufHidden,BufUnload @@ -1304,10 +1237,11 @@ function! s:EditCallback(...) "{{{3 let cb = b:tlib_scratch_edit_callback let args = b:tlib_scratch_edit_args let sargs = b:tlib_scratch_edit_scratch - " TLogVAR cb, args, sargs + let world = b:tlib_world + Tlibtrace 'tlib', cb, args, sargs + call call(cb, args + [ok, text, world]) call tlib#scratch#CloseScratch(b:tlib_scratch_edit_scratch) - call tlib#win#Set(sargs.win_wnr) - call call(cb, args + [ok, text]) + call tlib#win#SetById(sargs.win_id) endf diff --git a/sources_non_forked/tlib/autoload/tlib/list.vim b/sources_non_forked/tlib/autoload/tlib/list.vim index dbbc702f..e3f681eb 100644 --- a/sources_non_forked/tlib/autoload/tlib/list.vim +++ b/sources_non_forked/tlib/autoload/tlib/list.vim @@ -3,18 +3,18 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-06-30. -" @Last Change: 2015-10-21. -" @Revision: 61 +" @Last Change: 2017-03-26. +" @Revision: 71 """ List related functions {{{1 " For the following functions please see ../../test/tlib.vim for examples. -" :def: function! tlib#list#Inject(list, initial_value, funcref) +" :def: function! tlib#list#Inject(list, initial_value, funcref) abort " EXAMPLES: > " echo tlib#list#Inject([1,2,3], 0, function('Add') " => 6 -function! tlib#list#Inject(list, value, Function) "{{{3 +function! tlib#list#Inject(list, value, Function) abort "{{{3 if empty(a:list) return a:value else @@ -29,7 +29,7 @@ endf " EXAMPLES: > " tlib#list#Compact([0,1,2,3,[], {}, ""]) " => [1,2,3] -function! tlib#list#Compact(list) "{{{3 +function! tlib#list#Compact(list) abort "{{{3 return filter(copy(a:list), '!empty(v:val)') endf @@ -37,7 +37,7 @@ endf " EXAMPLES: > " tlib#list#Flatten([0,[1,2,[3,""]]]) " => [0,1,2,3,""] -function! tlib#list#Flatten(list) "{{{3 +function! tlib#list#Flatten(list) abort "{{{3 let acc = [] for e in a:list if type(e) == 3 @@ -51,27 +51,27 @@ function! tlib#list#Flatten(list) "{{{3 endf -" :def: function! tlib#list#FindAll(list, filter, ?process_expr="") +" :def: function! tlib#list#FindAll(list, filter, ?process_expr="") abort " Basically the same as filter() " " EXAMPLES: > " tlib#list#FindAll([1,2,3], 'v:val >= 2') " => [2, 3] -function! tlib#list#FindAll(list, filter, ...) "{{{3 +function! tlib#list#FindAll(list, filter, ...) abort "{{{3 let rv = filter(copy(a:list), a:filter) - if a:0 >= 1 && a:1 != '' + if a:0 >= 1 && !empty(a:1) let rv = map(rv, a:1) endif return rv endf -" :def: function! tlib#list#Find(list, filter, ?default="", ?process_expr="") +" :def: function! tlib#list#Find(list, filter, ?default="", ?process_expr="") abort " " EXAMPLES: > " tlib#list#Find([1,2,3], 'v:val >= 2') " => 2 -function! tlib#list#Find(list, filter, ...) "{{{3 +function! tlib#list#Find(list, filter, ...) abort "{{{3 let default = a:0 >= 1 ? a:1 : '' let expr = a:0 >= 2 ? a:2 : '' return get(tlib#list#FindAll(a:list, a:filter, expr), 0, default) @@ -81,7 +81,7 @@ endf " EXAMPLES: > " tlib#list#Any([1,2,3], 'v:val >= 2') " => 1 -function! tlib#list#Any(list, expr) "{{{3 +function! tlib#list#Any(list, expr) abort "{{{3 return !empty(tlib#list#FindAll(a:list, a:expr)) endf @@ -89,7 +89,7 @@ endf " EXAMPLES: > " tlib#list#All([1,2,3], 'v:val >= 2') " => 0 -function! tlib#list#All(list, expr) "{{{3 +function! tlib#list#All(list, expr) abort "{{{3 return len(tlib#list#FindAll(a:list, a:expr)) == len(a:list) endf @@ -97,7 +97,7 @@ endf " EXAMPLES: > " tlib#list#Remove([1,2,1,2], 2) " => [1,1,2] -function! tlib#list#Remove(list, element) "{{{3 +function! tlib#list#Remove(list, element) abort "{{{3 let idx = index(a:list, a:element) if idx != -1 call remove(a:list, idx) @@ -109,17 +109,17 @@ endf " EXAMPLES: > " tlib#list#RemoveAll([1,2,1,2], 2) " => [1,1] -function! tlib#list#RemoveAll(list, element) "{{{3 +function! tlib#list#RemoveAll(list, element) abort "{{{3 call filter(a:list, 'v:val != a:element') return a:list endf -" :def: function! tlib#list#Zip(lists, ?default='') +" :def: function! tlib#list#Zip(lists, ?default='') abort " EXAMPLES: > " tlib#list#Zip([[1,2,3], [4,5,6]]) " => [[1,4], [2,5], [3,6]] -function! tlib#list#Zip(lists, ...) "{{{3 +function! tlib#list#Zip(lists, ...) abort "{{{3 TVarArg 'default' let lists = copy(a:lists) let max = 0 @@ -133,24 +133,30 @@ function! tlib#list#Zip(lists, ...) "{{{3 return map(range(0, max - 1), 's:GetNthElement(v:val, lists, default)') endf -function! s:GetNthElement(n, lists, default) "{{{3 +function! s:GetNthElement(n, lists, default) abort "{{{3 " TLogVAR a:n, a:lists, a:default return map(copy(a:lists), 'get(v:val, a:n, a:default)') endf -function! tlib#list#Uniq(list, ...) "{{{3 +function! tlib#list#Uniq(list, ...) abort "{{{3 " TLogVAR a:list TVarArg ['get_value', ''], ['remove_empty', 0] if remove_empty call filter(a:list, 'type(v:val) == 0 || !empty(v:val)') endif " CREDITS: Based on syntastic#util#unique(list) by scrooloose + let emptystring = 0 let seen = {} let uniques = [] if empty(get_value) for e in a:list - if !has_key(seen, e) + if empty(e) + if !emptystring + let emptystring = 1 + call add(uniques, e) + endif + elseif !has_key(seen, e) let seen[e] = 1 call add(uniques, e) endif @@ -159,18 +165,23 @@ function! tlib#list#Uniq(list, ...) "{{{3 else for e in a:list let v = eval(printf(get_value, string(e))) - if !has_key(seen, v) + if empty(v) + if !emptystring + let emptystring = 1 + call add(uniques, v) + endif + elseif !has_key(seen, v) let seen[v] = 1 - call add(uniques, e) + call add(uniques, v) endif - unlet e + unlet e v endfor endif return uniques endf -function! tlib#list#ToDictionary(list, default, ...) "{{{3 +function! tlib#list#ToDictionary(list, default, ...) abort "{{{3 TVarArg ['generator', ''] let dict = {} for item in a:list diff --git a/sources_non_forked/tlib/autoload/tlib/notify.vim b/sources_non_forked/tlib/autoload/tlib/notify.vim index 2f45bdb8..d12d1099 100644 --- a/sources_non_forked/tlib/autoload/tlib/notify.vim +++ b/sources_non_forked/tlib/autoload/tlib/notify.vim @@ -3,8 +3,8 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2008-09-19. -" @Last Change: 2015-04-07. -" @Revision: 0.3.19 +" @Last Change: 2017-09-28. +" @Revision: 3.3.19 let s:save_cpo = &cpo set cpo&vim @@ -24,7 +24,7 @@ function! tlib#notify#Echo(text, ...) if !empty(style) exec 'echohl' style endif - echo strpart(text, 0, &columns - 1) + echo tlib#string#Strcharpart(text, 0, &columns - 1) finally if !empty(style) echohl None @@ -93,13 +93,21 @@ function! tlib#notify#TrimMessage(message) "{{{3 let front = to_fill / 2 - 1 let back = front if to_fill % 2 == 0 | let back -= 1 | endif - return strpart(a:message, 0, front) . filler . - \strpart(a:message, strlen(a:message) - back) + return tlib#string#Strcharpart(a:message, 0, front) . filler . + \ tlib#string#Strcharpart(a:message, strlen(a:message) - back) else return a:message endif endfunction +function! tlib#notify#PrintError() abort "{{{3 + echohl ErrorMsg + echom v:exception + echom v:throwpoint + echohl NONE +endf + + let &cpo = s:save_cpo unlet s:save_cpo diff --git a/sources_non_forked/tlib/autoload/tlib/number.vim b/sources_non_forked/tlib/autoload/tlib/number.vim index 94fde02f..54cddc57 100644 --- a/sources_non_forked/tlib/autoload/tlib/number.vim +++ b/sources_non_forked/tlib/autoload/tlib/number.vim @@ -1,22 +1,21 @@ " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 14 +" @Revision: 18 function! tlib#number#ConvertBase(num, base, ...) "{{{3 let rtype = a:0 >= 1 ? a:1 : 'string' + if a:base > 36 + throw 'tlib#number#ConvertBase: base > 36 is not supported' + endif " TLogVAR a:num, a:base, rtype let rv = [] let num = 0.0 + a:num + let chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" while floor(num) > 0.0 let div = floor(num / a:base) let num1 = float2nr(num - a:base * div) - if a:base <= 10 - call insert(rv, num1) - elseif a:base == 16 - let char = "0123456789ABCDEF"[num1] - call insert(rv, char) - endif + call insert(rv, chars[num1]) let num = num / a:base endwh " TLogVAR rv diff --git a/sources_non_forked/tlib/autoload/tlib/persistent.vim b/sources_non_forked/tlib/autoload/tlib/persistent.vim index de3d4878..8e633a6c 100644 --- a/sources_non_forked/tlib/autoload/tlib/persistent.vim +++ b/sources_non_forked/tlib/autoload/tlib/persistent.vim @@ -2,8 +2,8 @@ " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2012-05-11. -" @Last Change: 2012-05-11. -" @Revision: 12 +" @Last Change: 2017-03-29. +" @Revision: 15 " The directory for persistent data files. If empty, use " |tlib#dir#MyRuntime|.'/share'. @@ -21,6 +21,13 @@ function! tlib#persistent#Dir() "{{{3 return dir endf +" :display: tlib#persistent#EncodedFilename(type, file, ?mkdir=0, ?dir='') +" Encode `file` and call |tlib#persistent#Filename()|. +function! tlib#persistent#EncodedFilename(type, file, ...) "{{{3 + let file = tlib#url#Encode(a:file) + return call(function('tlib#persistent#Filename'), [a:type, file] + a:000) +endf + " :def: function! tlib#persistent#Filename(type, ?file=%, ?mkdir=0) function! tlib#persistent#Filename(type, ...) "{{{3 " TLogDBG 'bufname='. bufname('.') @@ -41,7 +48,7 @@ function! tlib#persistent#Value(...) "{{{3 return call('tlib#cache#Value', a:000) endf -function! tlib#persistent#Save(cfile, dictionary) "{{{3 - call tlib#cache#Save(a:cfile, a:dictionary) +function! tlib#persistent#Save(...) "{{{3 + call call(function('tlib#cache#Save'), a:000) endf diff --git a/sources_non_forked/tlib/autoload/tlib/progressbar.vim b/sources_non_forked/tlib/autoload/tlib/progressbar.vim index e739eb3c..c7e1f866 100644 --- a/sources_non_forked/tlib/autoload/tlib/progressbar.vim +++ b/sources_non_forked/tlib/autoload/tlib/progressbar.vim @@ -1,8 +1,10 @@ " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 72 +" @Revision: 86 +let s:id = 0 +let s:ids = [] let s:statusline = [] let s:laststatus = [] let s:max = [] @@ -23,14 +25,48 @@ let s:timestamp = -1 " endtry function! tlib#progressbar#Init(max, ...) "{{{3 TVarArg ['format', '%s'], ['width', 10] + let s:id += 1 + call insert(s:ids, s:id) call insert(s:statusline, &statusline) call insert(s:laststatus, &laststatus) call insert(s:max, a:max) call insert(s:format, format) call insert(s:width, width) call insert(s:value, -1) + let sl = { + \ 'id': s:id, + \ 'statusline': &statusline, + \ 'laststatus': &laststatus, + \ 'max': a:max, + \ 'format': format, + \ 'width': width, + \ 'value': -1 + \ } let &laststatus = 2 let s:timestamp = localtime() + return sl +endf + + +function! tlib#progressbar#Restore(...) "{{{3 + if a:0 >= 1 + let sl = a:1 + let idx = index(s:ids, sl.id) + let &statusline = sl.statusline + let &laststatus = sl.laststatus + else + let idx = 0 + let &statusline = remove(s:statusline, idx) + let &laststatus = remove(s:laststatus, idx) + endif + call remove(s:ids, idx) + call remove(s:max, idx) + call remove(s:format, idx) + call remove(s:width, idx) + call remove(s:value, idx) + redrawstatus + " redraw + " echo endf @@ -48,7 +84,7 @@ function! tlib#progressbar#Display(value, ...) "{{{3 let pbl = repeat('#', val) let pbr = repeat('.', s:width[0] - val) let txt = printf(s:format[0], '['.pbl.pbr.']') . extra - let &l:statusline = txt + let &statusline = txt " TLogDBG txt redrawstatus " redraw @@ -57,16 +93,3 @@ function! tlib#progressbar#Display(value, ...) "{{{3 endf -function! tlib#progressbar#Restore() "{{{3 - let &l:statusline = remove(s:statusline, 0) - let &laststatus = remove(s:laststatus, 0) - redrawstatus - " redraw - " echo - call remove(s:max, 0) - call remove(s:format, 0) - call remove(s:width, 0) - call remove(s:value, 0) -endf - - diff --git a/sources_non_forked/tlib/autoload/tlib/qfl.vim b/sources_non_forked/tlib/autoload/tlib/qfl.vim index 7d4b442d..07eb9416 100644 --- a/sources_non_forked/tlib/autoload/tlib/qfl.vim +++ b/sources_non_forked/tlib/autoload/tlib/qfl.vim @@ -1,8 +1,8 @@ " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @Website: https://github.com/tomtom " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Last Change: 2015-11-13 -" @Revision: 59 +" @Last Change: 2018-02-08 +" @Revision: 69 " :nodoc: TLet g:tlib#qfl#world = { @@ -29,7 +29,10 @@ TLet g:tlib#qfl#world = { function! tlib#qfl#FormatQFLE(qfe) dict abort "{{{3 let filename = tlib#qfl#QfeFilename(a:qfe) - if get(self, 'qfl_short_filename', '') + let short_filename = get(self, 'qfl_short_filename', '') + if short_filename ==# 'basename' + let filename = matchstr(filename, '[^\\/]\+$') + elseif !empty(short_filename) let filename = pathshorten(filename) endif return printf("%s|%d| %s", filename, a:qfe.lnum, get(a:qfe, "text")) @@ -119,11 +122,11 @@ endf function! tlib#qfl#AgentEditQFE(world, selected, ...) "{{{3 - TVarArg ['cmd_edit', ''], ['cmd_buffer', ''] + TVarArg ['cmd_edit', ''], ['cmd_buffer', ''], ['set_origin', 1] " TVarArg ['cmd_edit', 'edit'], ['cmd_buffer', 'buffer'] " TLogVAR a:selected if empty(a:selected) - call a:world.RestoreOrigin() + " call a:world.RestoreOrigin() " call a:world.ResetSelected() else call a:world.RestoreOrigin() @@ -148,11 +151,13 @@ function! tlib#qfl#AgentEditQFE(world, selected, ...) "{{{3 " TLogDBG bufname('%') " TLogVAR &filetype call tlib#buffer#ViewLine(qfe.lnum) - " call a:world.SetOrigin() " exec back endif endif endfor + if set_origin + call a:world.SetOrigin() + endif endif return a:world endf @@ -161,7 +166,7 @@ endf function! tlib#qfl#AgentPreviewQFE(world, selected) "{{{3 " TLogVAR a:selected let back = a:world.SwitchWindow('win') - call tlib#qfl#AgentEditQFE(a:world, a:selected[0:0]) + call tlib#qfl#AgentEditQFE(a:world, a:selected[0:0], '', '', 0) exec back redraw let a:world.state = 'redisplay' @@ -170,14 +175,12 @@ endf function! tlib#qfl#AgentGotoQFE(world, selected) "{{{3 + let world = a:world if !empty(a:selected) - if a:world.win_wnr != winnr() - let world = tlib#agent#Suspend(a:world, a:selected) - exec a:world.win_wnr .'wincmd w' - endif - call tlib#qfl#AgentEditQFE(a:world, a:selected[0:0]) + let world = tlib#agent#Suspend(world, a:selected) + call tlib#qfl#AgentEditQFE(world, a:selected[0:0]) endif - return a:world + return world endf @@ -201,7 +204,7 @@ function! tlib#qfl#RunCmdOnSelected(world, selected, cmd, ...) "{{{3 " TLogVAR a:cmd for entry in a:selected " TLogVAR entry, a:world.GetBaseItem(entry) - call tlib#qfl#AgentEditQFE(a:world, [entry]) + call tlib#qfl#AgentEditQFE(a:world, [entry], '', '', 0) " TLogDBG bufname('%') exec a:cmd " let item = a:world.data[a:world.GetBaseIdx(entry - 1)] diff --git a/sources_non_forked/tlib/autoload/tlib/rx.vim b/sources_non_forked/tlib/autoload/tlib/rx.vim index 83899838..08e6ae42 100644 --- a/sources_non_forked/tlib/autoload/tlib/rx.vim +++ b/sources_non_forked/tlib/autoload/tlib/rx.vim @@ -1,7 +1,7 @@ " @Author: Tom Link (micathom AT gmail com?subject=[vim]) " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 113 +" @Revision: 114 " :def: function! tlib#rx#Escape(text, ?magic='m') @@ -30,13 +30,7 @@ endf " Escape return |sub-replace-special|. function! tlib#rx#EscapeReplace(text, ...) "{{{3 TVarArg ['magic', 'm'] - if magic ==# 'm' || magic ==# 'v' - return escape(a:text, '\&~') - elseif magic ==# 'M' || magic ==# 'V' - return escape(a:text, '\') - else - echoerr 'magic must be one of: m, v, M, V' - endif + return escape(a:text, '\&~') endf diff --git a/sources_non_forked/tlib/autoload/tlib/selection.vim b/sources_non_forked/tlib/autoload/tlib/selection.vim new file mode 100644 index 00000000..e705f27e --- /dev/null +++ b/sources_non_forked/tlib/autoload/tlib/selection.vim @@ -0,0 +1,40 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @Website: http://www.vim.org/account/profile.php?user_id=4037 +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Last Change: 2017-09-28 +" @Revision: 4 + + +" :display: tlib#selection#GetSelection(mode, ?mbeg="'<", ?mend="'>", ?opmode='selection') +" mode can be one of: selection, lines, block +function! tlib#selection#GetSelection(mode, ...) range "{{{3 + if a:0 >= 2 + let mbeg = a:1 + let mend = a:2 + else + let mbeg = "'<" + let mend = "'>" + endif + let opmode = a:0 >= 3 ? a:3 : 'selection' + let l0 = line(mbeg) + let l1 = line(mend) + let text = getline(l0, l1) + let c0 = col(mbeg) + let c1 = col(mend) + " TLogVAR mbeg, mend, opmode, l0, l1, c0, c1 + " TLogVAR text[-1] + " TLogVAR len(text[-1]) + if opmode == 'block' + let clen = c1 - c0 + call map(text, 'tlib#string#Strcharpart(v:val, c0, clen)') + elseif opmode == 'selection' + if c1 > 1 + let text[-1] = tlib#string#Strcharpart(text[-1], 0, c1 - (a:mode == 'o' || c1 > len(text[-1]) ? 0 : 1)) + endif + if c0 > 1 + let text[0] = tlib#string#Strcharpart(text[0], c0 - 1) + endif + endif + return text +endf + diff --git a/sources_non_forked/tlib/autoload/tlib/string.vim b/sources_non_forked/tlib/autoload/tlib/string.vim index e5f8943a..c15420ef 100644 --- a/sources_non_forked/tlib/autoload/tlib/string.vim +++ b/sources_non_forked/tlib/autoload/tlib/string.vim @@ -1,7 +1,7 @@ " @Author: Tom Link (micathom AT gmail com?subject=[vim]) " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 121 +" @Revision: 148 " :def: function! tlib#string#RemoveBackslashes(text, ?chars=' ') @@ -22,11 +22,21 @@ function! tlib#string#Chomp(string, ...) "{{{3 endf -function! tlib#string#Format(template, dict) "{{{3 - let parts = split(a:template, '\ze%\({.\{-}}\|.\)') +" Format a template string. Placeholders have the format "%{NAME}". A +" "%" can be inserted as "%%". +" +" Examples: +" echo tlib#string#Format("foo %{bar} foo", {'bar': 123}, ?prefix='%') +" => foo 123 foo +function! tlib#string#Format(template, dict, ...) "{{{3 + let prefix = a:0 >= 1 ? a:1 : '%' + let pesc = prefix . prefix + let prx = tlib#rx#Escape(prefix) + let parts = split(a:template, '\ze'. prx .'\({.\{-}}\|.\)') + let partrx = '^'. prx .'\({\(.\{-}\)}\|\(.\)\)\(.*\)$' let out = [] for part in parts - let ml = matchlist(part, '^%\({\(.\{-}\)}\|\(.\)\)\(.*\)$') + let ml = matchlist(part, partrx) if empty(ml) let rest = part else @@ -34,8 +44,8 @@ function! tlib#string#Format(template, dict) "{{{3 let rest = ml[4] if has_key(a:dict, var) call add(out, a:dict[var]) - elseif var == '%%' - call add(out, '%') + elseif var ==# pesc + call add(out, prefix) else call add(out, ml[1]) endif @@ -156,3 +166,43 @@ function! tlib#string#SplitCommaList(text, ...) abort "{{{3 return parts endf + +function! tlib#string#Input(...) abort "{{{3 + TVarArg ['text', ''], ['completion', ''] + call inputsave() + let rv = call(function('input'), a:000) + call inputrestore() + return rv +endf + + +" :display: tlib#string#MatchAll(string, sep_regexp, ?item_regexp='') abort +function! tlib#string#MatchAll(string, regexp, ...) abort "{{{3 + let eregexp = a:0 >= 1 ? a:1 : '' + Tlibtrace 'tlib', a:string, a:regexp, eregexp + let ms = [] + if a:regexp =~ '\\ze' + let regexp1 = substitute(a:regexp, '\\ze.*$', '', '') + else + let regexp1 = a:regexp + endif + for m in split(a:string, '\ze'. regexp1) + let m1 = matchstr(m, !empty(eregexp) ? eregexp : a:regexp) + Tlibtrace 'tlib', m, m1 + if !empty(m1) + call add(ms, m1) + endif + endfor + return ms +endf + +if exists('*strcharpart') + function! tlib#string#Strcharpart(...) abort "{{{3 + return call(function('strcharpart'), a:000) + endf +else + function! tlib#string#Strcharpart(...) abort "{{{3 + return call(function('strpart'), a:000) + endf +endif + diff --git a/sources_non_forked/tlib/autoload/tlib/sys.vim b/sources_non_forked/tlib/autoload/tlib/sys.vim index affb86d1..667ecdc2 100644 --- a/sources_non_forked/tlib/autoload/tlib/sys.vim +++ b/sources_non_forked/tlib/autoload/tlib/sys.vim @@ -1,7 +1,7 @@ " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Last Change: 2015-11-07. -" @Revision: 51 +" @Last Change: 2017-04-12. +" @Revision: 62 if !exists('g:tlib#sys#special_protocols') @@ -16,14 +16,14 @@ if !exists('g:tlib#sys#special_suffixes') " A list of |regexp|s matching suffixes that should be handled by " |g:tlib#sys#system_browser|. " CAVEAT: Must be a |\V| |regexp|. - let g:tlib#sys#special_suffixes = ['xlsx\?', 'docx\?', 'pptx\?', 'accdb', 'mdb', 'sqlite', 'pdf', 'jpg', 'png', 'gif'] "{{{2 + let g:tlib#sys#special_suffixes = ['xlsx\?', 'docx\?', 'pptx\?', 'accdb', 'mdb', 'sqlite', 'pdf', 'jpg', 'png', 'gif', 'od\[tspg]'] "{{{2 endif if !exists('g:tlib#sys#system_rx') " Open links matching this |regexp| with |g:tlib#sys#system_browser|. " CAVEAT: Must be a |\V| |regexp|. - let g:tlib#sys#system_rx = printf('\V\%(\^\%(%s\):\|.\%(%s\)\)', join(g:tlib#sys#special_protocols, '\|'), join(g:tlib#sys#special_suffixes, '\|')) "{{{2 + let g:tlib#sys#system_rx = printf('\V\%(\^\%(%s\):\|.\%(%s\)\$\)', join(g:tlib#sys#special_protocols, '\|'), join(g:tlib#sys#special_suffixes, '\|')) "{{{2 endif @@ -39,7 +39,7 @@ if !exists("g:tlib#sys#system_browser") let g:tlib#sys#system_browser = "exec 'silent !open' shellescape('%s')" elseif exists('$XDG_CURRENT_DESKTOP') && !empty($XDG_CURRENT_DESKTOP) let g:tlib#sys#system_browser = "exec 'silent !xdg-open' shellescape('%s') '&'" - elseif $GNOME_DESKTOP_SESSION_ID != "" || $DESKTOP_SESSION == 'gnome' + elseif !empty($GNOME_DESKTOP_SESSION_ID) || $DESKTOP_SESSION ==# 'gnome' let g:tlib#sys#system_browser = "exec 'silent !gnome-open' shellescape('%s')" elseif exists("$KDEDIR") && !empty($KDEDIR) let g:tlib#sys#system_browser = "exec 'silent !kfmclient exec' shellescape('%s')" @@ -185,9 +185,7 @@ function! tlib#sys#Open(filename) abort "{{{3 Tlibtrace 'tlib', a:filename if !empty(g:tlib#sys#system_browser) && tlib#sys#IsSpecial(a:filename) try - let cmd = printf(g:tlib#sys#system_browser, escape(a:filename, ' %#!')) - Tlibtrace 'tlib', cmd - exec cmd + call tlib#sys#OpenWithSystemViewer(a:filename) return 1 catch echohl ErrorMsg @@ -199,13 +197,22 @@ function! tlib#sys#Open(filename) abort "{{{3 endf +" Open filename with the default system viewer. +function! tlib#sys#OpenWithSystemViewer(filename) abort "{{{3 + let cmd = printf(g:tlib#sys#system_browser, a:filename) + " let cmd = printf(g:tlib#sys#system_browser, escape(a:filename, ' %#!')) + Tlibtrace 'tlib', cmd + exec cmd +endf + + " :def: function! tlib#sys#SystemInDir(dir, expr, ?input='') function! tlib#sys#SystemInDir(dir, ...) abort "{{{3 call tlib#dir#CD(a:dir) try return call(function('system'), a:000) finally - cd! - + silent cd! - endtry endf diff --git a/sources_non_forked/tlib/autoload/tlib/tag.vim b/sources_non_forked/tlib/autoload/tlib/tag.vim index e4239d37..b82643d1 100644 --- a/sources_non_forked/tlib/autoload/tlib/tag.vim +++ b/sources_non_forked/tlib/autoload/tlib/tag.vim @@ -1,7 +1,7 @@ " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 59 +" @Revision: 64 " Extra tags for |tlib#tag#Retrieve()| (see there). Can also be buffer-local. @@ -47,7 +47,7 @@ TLet g:tlib_tag_substitute = { " < tags from the JDK will be included. function! tlib#tag#Retrieve(rx, ...) "{{{3 TVarArg ['extra_tags', 0] - " TLogVAR a:rx, extra_tags + Tlibtrace 'tlib', a:rx, extra_tags if extra_tags let tags_orig = &l:tags if empty(tags_orig) @@ -65,7 +65,8 @@ function! tlib#tag#Retrieve(rx, ...) "{{{3 else let taglist = taglist(a:rx) endif - return taglist + Tlibtrace 'tlib', len(taglist) + return copy(taglist) endf @@ -76,7 +77,7 @@ endf " :def: function! tlib#tag#Collect(constraints, ?use_extra=1, ?match_front=1) function! tlib#tag#Collect(constraints, ...) "{{{3 TVarArg ['use_extra', 0], ['match_end', 1], ['match_front', 1] - " TLogVAR a:constraints, use_extra + Tlibtrace 'tlib', a:constraints, use_extra, match_end, match_front let rx = get(a:constraints, 'name', '') if empty(rx) || rx == '*' let rx = '.' @@ -92,9 +93,9 @@ function! tlib#tag#Collect(constraints, ...) "{{{3 endif let rx = join(rxl, '') endif - " TLogVAR rx, use_extra + Tlibtrace 'tlib', rx, use_extra let tags = tlib#tag#Retrieve(rx, use_extra) - " TLogDBG len(tags) + Tlibtrace 'tlib', len(tags) for [field, rx] in items(a:constraints) if !empty(rx) && rx != '*' " TLogVAR field, rx @@ -105,7 +106,7 @@ function! tlib#tag#Collect(constraints, ...) "{{{3 endif endif endfor - " TLogVAR tags + Tlibtrace 'tlib', len(tags) return tags endf diff --git a/sources_non_forked/tlib/autoload/tlib/time.vim b/sources_non_forked/tlib/autoload/tlib/time.vim index 2273d555..130ef5bc 100644 --- a/sources_non_forked/tlib/autoload/tlib/time.vim +++ b/sources_non_forked/tlib/autoload/tlib/time.vim @@ -1,7 +1,7 @@ " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 36 +" @Revision: 42 function! tlib#time#MSecs() "{{{3 @@ -65,3 +65,20 @@ function! tlib#time#DiffMSecs(a, b, ...) "{{{3 endf +function! tlib#time#Command(cmd, ...) abort "{{{3 + let loops = a:0 >= 1 ? a:1 : 1 + let silent = a:0 >= 1 ? a:1 : 0 + let start = tlib#time#Now() + for loop in range(loops) + if silent + silent! exec a:cmd + else + exec a:cmd + endif + endfor + let end = tlib#time#Now() + let diff = tlib#time#Diff(end, start) + echom 'Time:' diff + return diff +endf + diff --git a/sources_non_forked/tlib/autoload/tlib/trace.vim b/sources_non_forked/tlib/autoload/tlib/trace.vim index 0a98d1e9..25a00a23 100644 --- a/sources_non_forked/tlib/autoload/tlib/trace.vim +++ b/sources_non_forked/tlib/autoload/tlib/trace.vim @@ -1,8 +1,8 @@ " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @Website: https://github.com/tomtom " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Last Change: 2015-11-23 -" @Revision: 134 +" @Last Change: 2017-03-09 +" @Revision: 205 if !exists('g:tlib#trace#backtrace') @@ -12,19 +12,42 @@ if !exists('g:tlib#trace#backtrace') endif -if !exists('g:tlib#trace#printf') - " The command used for printing traces from |tlib#trace#Print()|. - let g:tlib#trace#printf = 'echom %s' "{{{2 +if !exists('g:tlib#trace#printer') + " Possible values: + " - 'echom' + " - ['file', FILENAME] + let g:tlib#trace#printer = 'echom' "{{{2 endif -let s:trace_hl = {'error': 'ErrorMsg', 'fatal': 'ErrorMsg', 'warning': 'WarningMsg'} +if !exists('g:tlib#trace#hl') + let g:tlib#trace#hl = {'error': 'ErrorMsg', 'fatal': 'ErrorMsg', 'warn': 'WarningMsg'} "{{{2 +endif -" Set |g:tlib#trace#printf| to make |tlib#trace#Print()| print to -" `filename`. -function! tlib#trace#PrintToFile(filename) abort "{{{3 - let g:tlib#trace#printf = 'call writefile([%s], '. string(a:filename) .', "a")' +" Print traces from |tlib#trace#Print()|. +function! tlib#trace#Printer_echom(type, text, args) abort "{{{3 + let hl = get(g:tlib#trace#hl, a:type, '') + try + if !empty(hl) + exec 'echohl' hl + endif + echom a:text + finally + if !empty(hl) + echohl NONE + endif + endtry +endf + + +function! tlib#trace#Printer_file(type, text, args) abort "{{{3 + let filename = get(a:args, 0, '') + if exists(filename) && !filewritable(filename) + throw 'tlib#trace#Printer_file: Cannot write to file: '. filename + else + call writefile([a:text], filename, 'a') + endif endf @@ -34,26 +57,58 @@ endf " Examples: " call tlib#trace#Set(["+foo", "-bar"]) " call tlib#trace#Set("+foo,-bar") -function! tlib#trace#Set(vars) abort "{{{3 +function! tlib#trace#Set(vars, ...) abort "{{{3 + let reset = a:0 >= 1 ? a:1 : 0 + if reset + call tlib#trace#Reset() + endif + if empty(a:vars) + return + endif call tlib#trace#Enable() - if type(a:vars) == 1 + if type(a:vars) == v:t_string let vars = tlib#string#SplitCommaList(a:vars, '[,[:space:]]\+') + let opts = {} + elseif type(a:vars) == v:t_dict + let vars = a:vars.__rest__ + if has_key(a:vars, 'file') + let g:tlib#trace#printer = ['file', a:vars.file] + endif + if has_key(a:vars, 'echo') + let g:tlib#trace#printer = 'echom' + endif else let vars = a:vars + let opts = {} endif + " TLogVAR vars for rx in vars let rx1 = substitute(rx, '^[+-]', '', 'g') - if rx1 !~# '^\%(error\|fatal\)$' && s:trace_rx !~# '[(|]'. tlib#rx#Escape(rx1) .'\\' + if rx1 !~# '^\%(error\|warn\|fatal\)$' + let erx1 = tlib#rx#Escape(rx1) " TLogVAR rx, rx1 - if rx =~ '^+' - let s:trace_rx = substitute(s:trace_rx, '\ze\\)\$', '\\|'. tlib#rx#EscapeReplace(rx1), '') - elseif rx =~ '^-' - let s:trace_rx = substitute(s:trace_rx, '\\|'. tlib#rx#Escape(rx1), '', '') + " echom "DBG" s:trace_rx + if rx =~ '^-' + let erx1 .= '\[0-\d\]\\?' + if s:trace_rx =~# '[(|]'. erx1 .'\\' + let s:trace_rx = substitute(s:trace_rx, '\\|'. erx1, '', '') + endif + " elseif rx =~ '^+' else - echohl WarningMsg - echom 'tlib#trace#Print: Unsupported syntax:' rx - echohl NONE + if erx1 =~ '\d$' + let erx1 = substitute(erx1, '\d$', '[0-\0]\\?', '') + else + let erx1 .= '[0-9]\?' + endif + if s:trace_rx !~# '[(|]'. erx1 .'\\' + let s:trace_rx = substitute(s:trace_rx, '\ze\\)\$', '\\|'. escape(erx1, '\'), '') + endif + " else + " echohl WarningMsg + " echom 'tlib#trace#Print: Unsupported syntax:' rx + " echohl NONE endif + " echom "DBG" s:trace_rx endif endfor echom "SetTrace:" s:trace_rx @@ -71,6 +126,7 @@ endf " Print the values of vars. The first value is a "guard" (see " |:Tlibtrace|). function! tlib#trace#Print(caller, vars, values) abort "{{{3 + " echom "DBG tlib#trace#Print" string(a:vars) string(a:values) let msg = ['TRACE'] let guard = a:values[0] if type(guard) == 0 @@ -88,22 +144,47 @@ function! tlib#trace#Print(caller, vars, values) abort "{{{3 call add(msg, bt .':') endif endif - for i in range(1, len(a:vars) - 1) - let v = substitute(a:vars[i], ',$', '', '') - let r = string(a:values[i]) - call add(msg, v .'='. r .';') - endfor - exec printf(g:tlib#trace#printf, string(join(msg))) + if len(a:vars) == len(a:values) + for i in range(1, len(a:vars) - 1) + let v = substitute(a:vars[i], ',$', '', '') + if type(a:values[i]) == v:t_func + let r = string(a:values[i]) + else + let r = a:values[i] + endif + if v =~# '^\([''"]\).\{-}\1$' + call add(msg, r .';') + else + call add(msg, v .'='. string(r) .';') + endif + unlet r + endfor + else + call add(msg, join(a:values[1:-1])) + endif + if type(g:tlib#trace#printer) == v:t_string + let printer = g:tlib#trace#printer + let args = [] + else + let [printer; args] = g:tlib#trace#printer + endif + call tlib#trace#Printer_{printer}(guard, join(msg), args) endif endf +function! tlib#trace#Reset() abort "{{{3 + let s:trace_rx = '^\%(error\|fatal\|warn\|info\)$' + let g:tlib#trace#printer = 'echom' +endf + + " Enable tracing via |:Tlibtrace|. function! tlib#trace#Enable() abort "{{{3 if !exists('s:trace_rx') - let s:trace_rx = '^\%(error\)$' + call tlib#trace#Reset() " :nodoc: - command! -nargs=+ -bar Tlibtrace call tlib#trace#Print(expand(''), [], []) + command! -nargs=+ -bang Tlibtrace call tlib#trace#Print(expand(''), [], []) endif endf @@ -111,7 +192,7 @@ endf " Disable tracing via |:Tlibtrace|. function! tlib#trace#Disable() abort "{{{3 " :nodoc: - command! -nargs=+ -bang -bar Tlibtrace : + command! -nargs=+ -bang Tlibtrace : unlet! s:trace_rx endf diff --git a/sources_non_forked/tlib/autoload/tlib/type.vim b/sources_non_forked/tlib/autoload/tlib/type.vim index 455343f9..6bac9228 100644 --- a/sources_non_forked/tlib/autoload/tlib/type.vim +++ b/sources_non_forked/tlib/autoload/tlib/type.vim @@ -2,8 +2,30 @@ " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-09-30. -" @Last Change: 2015-11-23. -" @Revision: 6 +" @Last Change: 2017-02-22. +" @Revision: 57 + + +let g:tlib#type#nil = [] + + +" Enable type assertiona via |:Tlibtype|. +function! tlib#type#Enable() abort "{{{3 + " :nodoc: + command! -nargs=+ Tlibtype call tlib#type#Check(expand(''), [], []) +endf + + +" Disable type assertiona via |:Tlibtype|. +function! tlib#type#Disable() abort "{{{3 + " :nodoc: + command! -nargs=+ Tlibtype : +endf + + +function! tlib#type#IsNil(expr) abort "{{{3 + return tlib#type#Is(a:expr, v:t_none) || a:expr is g:tlib#type#nil +endf function! tlib#type#IsNumber(expr) @@ -32,25 +54,37 @@ endf function! tlib#type#Is(val, type) abort "{{{3 - if type(a:type) == 0 - let type = a:type - elseif a:type =~? '^n\%[umber]' - let type = 0 - elseif a:type =~? '^s\%[tring]' - let type = 1 - elseif a:type =~? '^fu\%[ncref]' - let type = 2 - elseif a:type =~? '^l\%[ist]' - let type = 3 - elseif a:type =~? '^d\%[ictionary]' - let type = 4 - elseif a:type =~? '^fl\%[oat]' - let type = 5 + if has_key(s:schemas, a:type) + return tlib#type#Has(a:val, a:type) else - throw 'tlib#type#Is: Unknown type: ' a:type + if type(a:type) == 0 + let type = a:type + elseif a:type =~? '^b\%[oolean]$' + let type = v:t_bool + elseif a:type =~? '^c\%[hannel]$' + let type = v:t_channel + elseif a:type =~? '^d\%[ictionary]$' + let type = v:t_dict + elseif a:type =~? '^fl\%[oat]$' + let type = v:t_float + elseif a:type =~? '^fu\%[ncref]$' + let type = v:t_func + elseif a:type =~? '^j\%[ob]$' + let type = v:t_job + elseif a:type =~? '^l\%[ist]$' + let type = v:t_list + elseif a:type =~? '^\%(nil\|null\|none\)$' + let type = v:t_none + elseif a:type =~? '^n\%[umber]$' + let type = v:t_number + elseif a:type =~? '^s\%[tring]$' + let type = v:t_string + else + throw 'tlib#type#Is: Unknown type: ' a:type + endif + Tlibtrace 'tlib', a:val, a:type, type, type(a:val), type(a:val) == a:type + return type(a:val) == type endif - " TLogVAR a:val, a:type, type, type(a:val), type(a:val) == a:type - return type(a:val) == type endf @@ -59,13 +93,50 @@ function! tlib#type#Are(vals, type) abort "{{{3 endf -function! tlib#type#Has(val, lst) abort "{{{3 - return tlib#assert#All(map(a:lst, 'has_key(a:val, v:val)')) +let s:schemas = {} + + +function! tlib#type#Define(name, schema) abort "{{{3 + let s:schemas[a:name] = deepcopy(a:schema) endf -function! tlib#type#Have(vals, lst) abort "{{{3 - return tlib#assert#Map(a:vals, 'tlib#type#Has(v:val,'. string(a:lst) .')') +function! tlib#type#Has(val, schema) abort "{{{3 + Tlibtrace 'tlib', type(a:val), type(a:schema) + if !tlib#type#IsDictionary(a:val) + Tlibtrace 'tlib', 'not a dictionary', a:val + return 0 + endif + if tlib#type#IsString(a:schema) + Tlibtrace 'tlib', a:schema + let schema = copy(s:schemas[a:schema]) + else + let schema = copy(a:schema) + endif + if tlib#type#IsDictionary(schema) + return tlib#assert#All(map(schema, 'has_key(a:val, v:key) && tlib#type#Is(a:val[v:key], v:val)')) + else + Tlibtrace 'tlib', keys(a:val), schema + return tlib#assert#All(map(schema, 'has_key(a:val, v:val)')) + endif endf +function! tlib#type#Have(vals, schema) abort "{{{3 + return tlib#assert#Map(a:vals, 'tlib#type#Has(v:val,'. string(a:schema) .')') +endf + + +function! tlib#type#Check(caller, names, vals) abort "{{{3 + Tlibtrace 'tlib', a:names, a:vals, len(a:names) + for i in range(0, len(a:names) - 1, 2) + let val = a:vals[i] + let type = a:vals[i + 1] + Tlibtrace 'tlib', i, val, type + if !tlib#type#Is(val, type) + let name = matchstr(a:names[i], '^''\zs.\{-}\ze'',\?$') + throw 'tlib#type#Check: Type mismatch: '. name .':'. a:vals[i + 1] + endif + endfor +endf + diff --git a/sources_non_forked/tlib/autoload/tlib/var.vim b/sources_non_forked/tlib/autoload/tlib/var.vim index dcd9264b..cf0d2946 100644 --- a/sources_non_forked/tlib/autoload/tlib/var.vim +++ b/sources_non_forked/tlib/autoload/tlib/var.vim @@ -1,7 +1,7 @@ " @Author: Tom Link (micathom AT gmail com?subject=[vim]) " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 30 +" @Revision: 34 " Define a variable called NAME if yet undefined. @@ -52,10 +52,17 @@ endf function! tlib#var#Get(var, namespace, ...) "{{{3 let var_ = substitute(a:var, '#', '_', 'g') for namespace in split(a:namespace, '\zs') - let vname = namespace == 'g' ? a:var : var_ + let vname = namespace ==# 'g' ? a:var : var_ let var = namespace .':'. vname if exists(var) return {var} + elseif namespace ==# 'g' + try + let val = {var} + catch /^Vim\%((\a\+)\)\=:E\(121\|15\)/ + continue + endtry + return val endif endfor return a:0 >= 1 ? a:1 : '' diff --git a/sources_non_forked/tlib/autoload/tlib/vcs.vim b/sources_non_forked/tlib/autoload/tlib/vcs.vim index 15d051fa..e551be22 100644 --- a/sources_non_forked/tlib/autoload/tlib/vcs.vim +++ b/sources_non_forked/tlib/autoload/tlib/vcs.vim @@ -1,8 +1,8 @@ " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2012-03-08. -" @Last Change: 2015-11-07. -" @Revision: 190 +" @Last Change: 2017-04-10. +" @Revision: 224 scriptencoding utf-8 @@ -14,21 +14,19 @@ TLet g:tlib#vcs#def = { \ 'dir': '.git', \ 'ls': 'git ls-files --full-name', \ 'ls.postprocess': '*tlib#vcs#GitLsPostprocess', - \ 'diff': 'git diff --no-ext-diff -U0 %s' - \ }, + \ 'diff': 'git diff --no-ext-diff -U0 %s', + \ 'status': 'git status -s', + \ 'status.filterrx': '^\C[ MADRCU!?]\{2}\s'}, \ 'hg': { \ 'dir': '.hg', \ 'diff': 'hg diff -U0 %s', - \ 'ls': 'hg manifest' - \ }, + \ 'ls': 'hg manifest'}, \ 'svn': { \ 'dir': '.svn', - \ 'diff': 'svn diff --diff-cmd diff --extensions -U0 %s', - \ }, + \ 'diff': 'svn diff --diff-cmd diff --extensions -U0 %s'}, \ 'bzr': { \ 'dir': '.bzr', - \ 'diff': 'bzr diff --diff-options=-U0 %s', - \ } + \ 'diff': 'bzr diff --diff-options=-U0 %s'} \ } @@ -36,7 +34,7 @@ TLet g:tlib#vcs#def = { " empty, support for that VCS will be removed. If no key is present, it " is assumed that the VCS "type" is the name of the executable. " :display: g:tlib#vcs#executables {...} -TLet g:tlib#vcs#executables = {} +TLet g:tlib#vcs#executables = {} " If non-empty, use it as a format string to check whether a VCS is @@ -60,36 +58,44 @@ function! tlib#vcs#Executable(type) "{{{3 endf +let s:vcs_cache = {} +autocmd TLib FocusGained * let s:vcs_cache = {} + + function! tlib#vcs#FindVCS(filename) "{{{3 let type = '' let dir = '' - let dirname = fnamemodify(a:filename, isdirectory(a:filename) ? ':p' : ':p:h') - let path = escape(dirname, ';') .';' - " TLogVAR a:filename, dirname, path - Tlibtrace 'tlib', a:filename, path - let depth = -1 - for vcs in keys(g:tlib#vcs#def) - let subdir = g:tlib#vcs#def[vcs].dir - let vcsdir = finddir(subdir, path) - " TLogVAR vcs, subdir, vcsdir - Tlibtrace 'tlib', vcs, subdir, vcsdir - if !empty(vcsdir) - let vcsdir_depth = len(split(fnamemodify(vcsdir, ':p'), '\/')) - if vcsdir_depth > depth - let depth = vcsdir_depth - let type = vcs - let dir = vcsdir - " TLogVAR type, depth + let filename = fnamemodify(a:filename, ':p') + let dirname = isdirectory(filename) ? filename : fnamemodify(filename, ':h') + if !has_key(s:vcs_cache, dirname) + let path = escape(dirname, ';') .';' + " TLogVAR filename, dirname, path + Tlibtrace 'tlib', filename, path + let depth = -1 + for vcs in keys(g:tlib#vcs#def) + let subdir = g:tlib#vcs#def[vcs].dir + let vcsdir = finddir(subdir, path) + " TLogVAR vcs, subdir, vcsdir + Tlibtrace 'tlib', vcs, subdir, vcsdir + if !empty(vcsdir) + let vcsdir_depth = len(split(fnamemodify(vcsdir, ':p'), '\/')) + if vcsdir_depth > depth + let depth = vcsdir_depth + let type = vcs + let dir = vcsdir + " TLogVAR type, depth + endif endif + endfor + Tlibtrace 'tlib', type, dir + " TLogVAR type, dir + if empty(type) + let s:vcs_cache[dirname] = ['', ''] + else + let s:vcs_cache[dirname] = [type, dir] endif - endfor - Tlibtrace 'tlib', type, dir - " TLogVAR type, dir - if empty(type) - return ['', ''] - else - return [type, dir] endif + return s:vcs_cache[dirname] endf @@ -97,7 +103,7 @@ function! s:GetCmd(vcstype, cmd) let vcsdef = get(g:tlib#vcs#def, a:vcstype, {}) if has_key(vcsdef, a:cmd) let cmd = vcsdef[a:cmd] - if cmd =~ '^\*' + if cmd =~# '^\*' let cmd = substitute(cmd, '^\*', '', '') else let bin = get(g:tlib#vcs#executables, a:vcstype, '') @@ -134,7 +140,7 @@ function! tlib#vcs#Ls(...) "{{{3 if !empty(ls) let rootdir = fnamemodify(vcsdir, ':p:h:h') " TLogVAR vcsdir, rootdir - if ls =~ '%s' + if ls =~# '%s' let cmd = printf(ls, shellescape(rootdir)) else let cmd = ls @@ -176,7 +182,7 @@ endf function! tlib#vcs#GitLsPostprocess(filename) abort "{{{3 - if a:filename =~ '^".\{-}"$' + if a:filename =~# '^".\{-}"$' let filename = matchstr(a:filename, '^"\zs.\{-}\ze"$') let filename = substitute(filename, '\%(\\\@= 1 ? a:1 : '%' + let vcs = a:0 >= 2 ? a:2 : tlib#vcs#FindVCS(filename) + if !empty(vcs) + let [vcstype, vcsdir] = vcs + let cstatus = s:GetCmd(vcstype, 'status') + if !empty(cstatus) + let status = exists('*systemlist') ? systemlist(cstatus) : split(system(cstatus), '\n') + let sfilter = s:GetCmd(vcstype, 'status.filterrx') + if !empty(sfilter) + let status = filter(status, 'v:val =~# sfilter') + endif + return status + endif + endif +endf + + +function! tlib#vcs#IsDirty(...) abort "{{{3 + let filename = a:0 >= 1 ? a:1 : '%' + let vcs = a:0 >= 2 ? a:2 : tlib#vcs#FindVCS(filename) + let status = tlib#vcs#Status(filename, vcs) + return empty(status) ? '' : vcs[0] .'!' +endf + + +" function! tlib#vcs#EnableTStatus() abort "{{{3 +" if has('vim_starting') +" autocmd VimEnter * TStatusregister1 --event=FocusGained,BufRead,BufWritePost %s tlib#vcs#IsDirty() +" else +" TStatusregister1 --event=FocusGained,BufRead,BufWritePost %s tlib#vcs#IsDirty() +" endif +" endf + diff --git a/sources_non_forked/tlib/autoload/tlib/win.vim b/sources_non_forked/tlib/autoload/tlib/win.vim index 4963af15..ee2ca00c 100644 --- a/sources_non_forked/tlib/autoload/tlib/win.vim +++ b/sources_non_forked/tlib/autoload/tlib/win.vim @@ -1,7 +1,12 @@ " @Author: Tom Link (micathom AT gmail com?subject=[vim]) " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 55 +" @Revision: 84 + + +if !exists('g:tlib#win#use_winid') + let g:tlib#win#use_winid = exists('*win_gotoid') && exists('*win_getid') "{{{2 +endif " Return vim code to jump back to the original window. @@ -20,6 +25,70 @@ function! tlib#win#Set(winnr) "{{{3 endif return '' endf + + +if g:tlib#win#use_winid + let g:tlib#win#null_id = -1 + function! tlib#win#GetID() abort "{{{3 + return win_getid() + endf + function! tlib#win#GotoID(win_id) abort "{{{3 + call win_gotoid(a:win_id) + endf +else + let s:win_id = 0 + let g:tlib#win#null_id = {} + function! tlib#win#GetID() abort "{{{3 + if !exists('w:tlib_win_id') + let s:win_id += 1 + let w:tlib_win_id = s:win_id + endif + return {'tabpagenr': tabpagenr(), 'bufnr': bufnr('%'), 'winnr': winnr(), 'win_id': w:tlib_win_id} + endf + function! tlib#win#GotoID(win_id) abort "{{{3 + Tlibtrace 'tlib', a:win_id + if tabpagenr() != a:win_id.tabpagenr + exec 'tabnext' a:win_id.tabpagenr + endif + for wnr in range(1, winnr('$')) + let win_id = getwinvar(wnr, 'tlib_win_id', -1) + Tlibtrace 'tlib', wnr, win_id + if win_id == a:win_id.win_id + Tlibtrace 'tlib', wnr + exec wnr 'wincmd w' + return + endif + endfor + " Was the window closed? What should we do now? + if winnr() != a:win_id.winnr + exec a:win_id.winnr 'wincmd w' + endif + if bufnr('%') != a:win_id.bufnr + exec 'hide buffer' a:win_id.bufnr + endif + endf +endif + + +" Return vim code to jump back to the original window. +function! tlib#win#SetById(win_id) "{{{3 + if a:win_id != g:tlib#win#null_id + let win_id = tlib#win#GetID() + call tlib#win#GotoID(a:win_id) + return printf('call tlib#win#GotoID(%s)', win_id) + " " TLogVAR a:winnr + " " TLogDBG winnr() + " " TLogDBG string(tlib#win#List()) + " if winnr() != a:winnr && winbufnr(a:winnr) != -1 + " let rv = winnr().'wincmd w' + " exec a:winnr .'wincmd w' + " " TLogVAR rv + " " TLogDBG string(tlib#win#List()) + " return rv + " endif + endif + return '' +endf " :def: function! tlib#win#GetLayout(?save_view=0) diff --git a/sources_non_forked/tlib/doc/tags b/sources_non_forked/tlib/doc/tags new file mode 100644 index 00000000..26ad4085 --- /dev/null +++ b/sources_non_forked/tlib/doc/tags @@ -0,0 +1,223 @@ +:TBrowseOutput tlib.txt /*:TBrowseOutput* +:TBrowseScriptnames tlib.txt /*:TBrowseScriptnames* +:TLet tlib.txt /*:TLet* +:TScratch tlib.txt /*:TScratch* +:TVarArg tlib.txt /*:TVarArg* +:Tbrowseloc tlib.txt /*:Tbrowseloc* +:Tbrowseqfl tlib.txt /*:Tbrowseqfl* +:Texecloc tlib.txt /*:Texecloc* +:Texecqfl tlib.txt /*:Texecqfl* +:Tlibtrace tlib.txt /*:Tlibtrace* +:Tlibtraceset tlib.txt /*:Tlibtraceset* +autoload/tlib/Filter_cnf.vim tlib.txt /*autoload\/tlib\/Filter_cnf.vim* +autoload/tlib/Filter_cnfd.vim tlib.txt /*autoload\/tlib\/Filter_cnfd.vim* +autoload/tlib/Filter_fuzzy.vim tlib.txt /*autoload\/tlib\/Filter_fuzzy.vim* +autoload/tlib/Filter_glob.vim tlib.txt /*autoload\/tlib\/Filter_glob.vim* +autoload/tlib/Object.vim tlib.txt /*autoload\/tlib\/Object.vim* +autoload/tlib/World.vim tlib.txt /*autoload\/tlib\/World.vim* +autoload/tlib/agent.vim tlib.txt /*autoload\/tlib\/agent.vim* +autoload/tlib/arg.vim tlib.txt /*autoload\/tlib\/arg.vim* +autoload/tlib/assert.vim tlib.txt /*autoload\/tlib\/assert.vim* +autoload/tlib/buffer.vim tlib.txt /*autoload\/tlib\/buffer.vim* +autoload/tlib/cache.vim tlib.txt /*autoload\/tlib\/cache.vim* +autoload/tlib/char.vim tlib.txt /*autoload\/tlib\/char.vim* +autoload/tlib/cmd.vim tlib.txt /*autoload\/tlib\/cmd.vim* +autoload/tlib/comments.vim tlib.txt /*autoload\/tlib\/comments.vim* +autoload/tlib/date.vim tlib.txt /*autoload\/tlib\/date.vim* +autoload/tlib/dir.vim tlib.txt /*autoload\/tlib\/dir.vim* +autoload/tlib/file.vim tlib.txt /*autoload\/tlib\/file.vim* +autoload/tlib/hook.vim tlib.txt /*autoload\/tlib\/hook.vim* +autoload/tlib/input.vim tlib.txt /*autoload\/tlib\/input.vim* +autoload/tlib/list.vim tlib.txt /*autoload\/tlib\/list.vim* +autoload/tlib/map.vim tlib.txt /*autoload\/tlib\/map.vim* +autoload/tlib/normal.vim tlib.txt /*autoload\/tlib\/normal.vim* +autoload/tlib/notify.vim tlib.txt /*autoload\/tlib\/notify.vim* +autoload/tlib/paragraph.vim tlib.txt /*autoload\/tlib\/paragraph.vim* +autoload/tlib/persistent.vim tlib.txt /*autoload\/tlib\/persistent.vim* +autoload/tlib/progressbar.vim tlib.txt /*autoload\/tlib\/progressbar.vim* +autoload/tlib/rx.vim tlib.txt /*autoload\/tlib\/rx.vim* +autoload/tlib/scratch.vim tlib.txt /*autoload\/tlib\/scratch.vim* +autoload/tlib/selection.vim tlib.txt /*autoload\/tlib\/selection.vim* +autoload/tlib/signs.vim tlib.txt /*autoload\/tlib\/signs.vim* +autoload/tlib/string.vim tlib.txt /*autoload\/tlib\/string.vim* +autoload/tlib/sys.vim tlib.txt /*autoload\/tlib\/sys.vim* +autoload/tlib/tab.vim tlib.txt /*autoload\/tlib\/tab.vim* +autoload/tlib/tag.vim tlib.txt /*autoload\/tlib\/tag.vim* +autoload/tlib/textobjects.vim tlib.txt /*autoload\/tlib\/textobjects.vim* +autoload/tlib/trace.vim tlib.txt /*autoload\/tlib\/trace.vim* +autoload/tlib/type.vim tlib.txt /*autoload\/tlib\/type.vim* +autoload/tlib/url.vim tlib.txt /*autoload\/tlib\/url.vim* +autoload/tlib/var.vim tlib.txt /*autoload\/tlib\/var.vim* +autoload/tlib/vcs.vim tlib.txt /*autoload\/tlib\/vcs.vim* +autoload/tlib/vim.vim tlib.txt /*autoload\/tlib\/vim.vim* +autoload/tlib/win.vim tlib.txt /*autoload\/tlib\/win.vim* +g:tlib#Filter_glob#char tlib.txt /*g:tlib#Filter_glob#char* +g:tlib#Filter_glob#seq tlib.txt /*g:tlib#Filter_glob#seq* +g:tlib#cache#dont_purge tlib.txt /*g:tlib#cache#dont_purge* +g:tlib#cache#max_filename tlib.txt /*g:tlib#cache#max_filename* +g:tlib#cache#purge_days tlib.txt /*g:tlib#cache#purge_days* +g:tlib#cache#purge_every_days tlib.txt /*g:tlib#cache#purge_every_days* +g:tlib#cache#run_script tlib.txt /*g:tlib#cache#run_script* +g:tlib#cache#script_encoding tlib.txt /*g:tlib#cache#script_encoding* +g:tlib#cache#verbosity tlib.txt /*g:tlib#cache#verbosity* +g:tlib#dir#sep tlib.txt /*g:tlib#dir#sep* +g:tlib#file#drop tlib.txt /*g:tlib#file#drop* +g:tlib#input#filename_max_width tlib.txt /*g:tlib#input#filename_max_width* +g:tlib#input#filename_padding_r tlib.txt /*g:tlib#input#filename_padding_r* +g:tlib#input#filter_mode tlib.txt /*g:tlib#input#filter_mode* +g:tlib#input#format_filename tlib.txt /*g:tlib#input#format_filename* +g:tlib#input#higroup tlib.txt /*g:tlib#input#higroup* +g:tlib#input#keyagents_InputList_s tlib.txt /*g:tlib#input#keyagents_InputList_s* +g:tlib#input#livesearch_threshold tlib.txt /*g:tlib#input#livesearch_threshold* +g:tlib#input#numeric_chars tlib.txt /*g:tlib#input#numeric_chars* +g:tlib#input#sortprefs_threshold tlib.txt /*g:tlib#input#sortprefs_threshold* +g:tlib#input#use_popup tlib.txt /*g:tlib#input#use_popup* +g:tlib#input#user_shortcuts tlib.txt /*g:tlib#input#user_shortcuts* +g:tlib#scratch#hidden tlib.txt /*g:tlib#scratch#hidden* +g:tlib#sys#check_cygpath tlib.txt /*g:tlib#sys#check_cygpath* +g:tlib#sys#cygwin_expr tlib.txt /*g:tlib#sys#cygwin_expr* +g:tlib#sys#cygwin_path_rx tlib.txt /*g:tlib#sys#cygwin_path_rx* +g:tlib#sys#special_protocols tlib.txt /*g:tlib#sys#special_protocols* +g:tlib#sys#special_suffixes tlib.txt /*g:tlib#sys#special_suffixes* +g:tlib#sys#system_browser tlib.txt /*g:tlib#sys#system_browser* +g:tlib#sys#system_rx tlib.txt /*g:tlib#sys#system_rx* +g:tlib#trace#backtrace tlib.txt /*g:tlib#trace#backtrace* +g:tlib#trace#printer tlib.txt /*g:tlib#trace#printer* +g:tlib#vcs#check tlib.txt /*g:tlib#vcs#check* +g:tlib#vcs#def tlib.txt /*g:tlib#vcs#def* +g:tlib#vcs#executables tlib.txt /*g:tlib#vcs#executables* +g:tlib#vim#simalt_maximize tlib.txt /*g:tlib#vim#simalt_maximize* +g:tlib#vim#simalt_restore tlib.txt /*g:tlib#vim#simalt_restore* +g:tlib#vim#use_vimtweak tlib.txt /*g:tlib#vim#use_vimtweak* +g:tlib#vim#use_wmctrl tlib.txt /*g:tlib#vim#use_wmctrl* +g:tlib_cache tlib.txt /*g:tlib_cache* +g:tlib_inputlist_filename_indicators tlib.txt /*g:tlib_inputlist_filename_indicators* +g:tlib_inputlist_max_cols tlib.txt /*g:tlib_inputlist_max_cols* +g:tlib_inputlist_max_lines tlib.txt /*g:tlib_inputlist_max_lines* +g:tlib_inputlist_pct tlib.txt /*g:tlib_inputlist_pct* +g:tlib_inputlist_shortmessage tlib.txt /*g:tlib_inputlist_shortmessage* +g:tlib_inputlist_width_filename tlib.txt /*g:tlib_inputlist_width_filename* +g:tlib_persistent tlib.txt /*g:tlib_persistent* +g:tlib_pick_last_item tlib.txt /*g:tlib_pick_last_item* +g:tlib_scratch_pos tlib.txt /*g:tlib_scratch_pos* +g:tlib_scroll_lines tlib.txt /*g:tlib_scroll_lines* +g:tlib_tag_substitute tlib.txt /*g:tlib_tag_substitute* +g:tlib_tags_extra tlib.txt /*g:tlib_tags_extra* +g:tlib_viewline_position tlib.txt /*g:tlib_viewline_position* +plugin/02tlib.vim tlib.txt /*plugin\/02tlib.vim* +standard-paragraph tlib.txt /*standard-paragraph* +tlib#Filter_cnf#New() tlib.txt /*tlib#Filter_cnf#New()* +tlib#Filter_cnfd#New() tlib.txt /*tlib#Filter_cnfd#New()* +tlib#Filter_fuzzy#New() tlib.txt /*tlib#Filter_fuzzy#New()* +tlib#Filter_glob#New() tlib.txt /*tlib#Filter_glob#New()* +tlib#Object#New() tlib.txt /*tlib#Object#New()* +tlib#agent#GotoLine() tlib.txt /*tlib#agent#GotoLine()* +tlib#agent#NewItem() tlib.txt /*tlib#agent#NewItem()* +tlib#agent#Suspend() tlib.txt /*tlib#agent#Suspend()* +tlib#agent#SuspendToParentWindow() tlib.txt /*tlib#agent#SuspendToParentWindow()* +tlib#arg#Ex() tlib.txt /*tlib#arg#Ex()* +tlib#arg#Get() tlib.txt /*tlib#arg#Get()* +tlib#arg#GetOpts() tlib.txt /*tlib#arg#GetOpts()* +tlib#arg#Let() tlib.txt /*tlib#arg#Let()* +tlib#assert#Disable() tlib.txt /*tlib#assert#Disable()* +tlib#assert#Enable() tlib.txt /*tlib#assert#Enable()* +tlib#buffer#BufDo() tlib.txt /*tlib#buffer#BufDo()* +tlib#buffer#DeleteRange() tlib.txt /*tlib#buffer#DeleteRange()* +tlib#buffer#Eval() tlib.txt /*tlib#buffer#Eval()* +tlib#buffer#GetList() tlib.txt /*tlib#buffer#GetList()* +tlib#buffer#InsertText() tlib.txt /*tlib#buffer#InsertText()* +tlib#buffer#KeepCursorPosition() tlib.txt /*tlib#buffer#KeepCursorPosition()* +tlib#buffer#ReplaceRange() tlib.txt /*tlib#buffer#ReplaceRange()* +tlib#buffer#ScratchEnd() tlib.txt /*tlib#buffer#ScratchEnd()* +tlib#buffer#ScratchStart() tlib.txt /*tlib#buffer#ScratchStart()* +tlib#buffer#Set() tlib.txt /*tlib#buffer#Set()* +tlib#buffer#ViewLine() tlib.txt /*tlib#buffer#ViewLine()* +tlib#cache#Dir() tlib.txt /*tlib#cache#Dir()* +tlib#cache#EncodedFilename() tlib.txt /*tlib#cache#EncodedFilename()* +tlib#cache#MaybePurge() tlib.txt /*tlib#cache#MaybePurge()* +tlib#cache#Purge() tlib.txt /*tlib#cache#Purge()* +tlib#cache#Value() tlib.txt /*tlib#cache#Value()* +tlib#char#Get() tlib.txt /*tlib#char#Get()* +tlib#cmd#BrowseOutput() tlib.txt /*tlib#cmd#BrowseOutput()* +tlib#cmd#BrowseOutputWithCallback() tlib.txt /*tlib#cmd#BrowseOutputWithCallback()* +tlib#cmd#Time() tlib.txt /*tlib#cmd#Time()* +tlib#cmd#UseVertical() tlib.txt /*tlib#cmd#UseVertical()* +tlib#comments#Comments() tlib.txt /*tlib#comments#Comments()* +tlib#date#SecondsSince1970() tlib.txt /*tlib#date#SecondsSince1970()* +tlib#dir#CanonicName() tlib.txt /*tlib#dir#CanonicName()* +tlib#dir#Ensure() tlib.txt /*tlib#dir#Ensure()* +tlib#dir#MyRuntime() tlib.txt /*tlib#dir#MyRuntime()* +tlib#dir#NativeName() tlib.txt /*tlib#dir#NativeName()* +tlib#dir#PlainName() tlib.txt /*tlib#dir#PlainName()* +tlib#file#Edit() tlib.txt /*tlib#file#Edit()* +tlib#file#Join() tlib.txt /*tlib#file#Join()* +tlib#file#Relative() tlib.txt /*tlib#file#Relative()* +tlib#file#Split() tlib.txt /*tlib#file#Split()* +tlib#hook#Run() tlib.txt /*tlib#hook#Run()* +tlib#input#CommandSelect() tlib.txt /*tlib#input#CommandSelect()* +tlib#input#Edit() tlib.txt /*tlib#input#Edit()* +tlib#input#EditList() tlib.txt /*tlib#input#EditList()* +tlib#input#List() tlib.txt /*tlib#input#List()* +tlib#input#ListD() tlib.txt /*tlib#input#ListD()* +tlib#input#ListW() tlib.txt /*tlib#input#ListW()* +tlib#list#All() tlib.txt /*tlib#list#All()* +tlib#list#Any() tlib.txt /*tlib#list#Any()* +tlib#list#Compact() tlib.txt /*tlib#list#Compact()* +tlib#list#Find() tlib.txt /*tlib#list#Find()* +tlib#list#FindAll() tlib.txt /*tlib#list#FindAll()* +tlib#list#Flatten() tlib.txt /*tlib#list#Flatten()* +tlib#list#Inject() tlib.txt /*tlib#list#Inject()* +tlib#list#Remove() tlib.txt /*tlib#list#Remove()* +tlib#list#RemoveAll() tlib.txt /*tlib#list#RemoveAll()* +tlib#list#Zip() tlib.txt /*tlib#list#Zip()* +tlib#map#PumAccept() tlib.txt /*tlib#map#PumAccept()* +tlib#normal#WithRegister() tlib.txt /*tlib#normal#WithRegister()* +tlib#notify#Echo() tlib.txt /*tlib#notify#Echo()* +tlib#notify#TrimMessage() tlib.txt /*tlib#notify#TrimMessage()* +tlib#paragraph#GetMetric() tlib.txt /*tlib#paragraph#GetMetric()* +tlib#paragraph#Move() tlib.txt /*tlib#paragraph#Move()* +tlib#persistent#Dir() tlib.txt /*tlib#persistent#Dir()* +tlib#persistent#EncodedFilename() tlib.txt /*tlib#persistent#EncodedFilename()* +tlib#progressbar#Init() tlib.txt /*tlib#progressbar#Init()* +tlib#rx#Escape() tlib.txt /*tlib#rx#Escape()* +tlib#rx#EscapeReplace() tlib.txt /*tlib#rx#EscapeReplace()* +tlib#scratch#CloseScratch() tlib.txt /*tlib#scratch#CloseScratch()* +tlib#scratch#UseScratch() tlib.txt /*tlib#scratch#UseScratch()* +tlib#selection#GetSelection() tlib.txt /*tlib#selection#GetSelection()* +tlib#signs#ClearAll() tlib.txt /*tlib#signs#ClearAll()* +tlib#signs#ClearBuffer() tlib.txt /*tlib#signs#ClearBuffer()* +tlib#signs#Mark() tlib.txt /*tlib#signs#Mark()* +tlib#string#Format() tlib.txt /*tlib#string#Format()* +tlib#string#Printf1() tlib.txt /*tlib#string#Printf1()* +tlib#string#RemoveBackslashes() tlib.txt /*tlib#string#RemoveBackslashes()* +tlib#sys#IsSpecial() tlib.txt /*tlib#sys#IsSpecial()* +tlib#sys#MaybeUseCygpath() tlib.txt /*tlib#sys#MaybeUseCygpath()* +tlib#sys#Open() tlib.txt /*tlib#sys#Open()* +tlib#sys#OpenWithSystemViewer() tlib.txt /*tlib#sys#OpenWithSystemViewer()* +tlib#tab#BufMap() tlib.txt /*tlib#tab#BufMap()* +tlib#tab#TabWinNr() tlib.txt /*tlib#tab#TabWinNr()* +tlib#tag#Collect() tlib.txt /*tlib#tag#Collect()* +tlib#tag#Retrieve() tlib.txt /*tlib#tag#Retrieve()* +tlib#trace#Disable() tlib.txt /*tlib#trace#Disable()* +tlib#trace#Enable() tlib.txt /*tlib#trace#Enable()* +tlib#trace#Print() tlib.txt /*tlib#trace#Print()* +tlib#trace#Printer_echom() tlib.txt /*tlib#trace#Printer_echom()* +tlib#trace#Set() tlib.txt /*tlib#trace#Set()* +tlib#type#Disable() tlib.txt /*tlib#type#Disable()* +tlib#type#Enable() tlib.txt /*tlib#type#Enable()* +tlib#url#Decode() tlib.txt /*tlib#url#Decode()* +tlib#url#DecodeChar() tlib.txt /*tlib#url#DecodeChar()* +tlib#url#Encode() tlib.txt /*tlib#url#Encode()* +tlib#url#EncodeChar() tlib.txt /*tlib#url#EncodeChar()* +tlib#var#EGet() tlib.txt /*tlib#var#EGet()* +tlib#var#Get() tlib.txt /*tlib#var#Get()* +tlib#var#Let() tlib.txt /*tlib#var#Let()* +tlib#var#List() tlib.txt /*tlib#var#List()* +tlib#vcs#Diff() tlib.txt /*tlib#vcs#Diff()* +tlib#vcs#Ls() tlib.txt /*tlib#vcs#Ls()* +tlib#vim#Maximize() tlib.txt /*tlib#vim#Maximize()* +tlib#vim#RestoreWindow() tlib.txt /*tlib#vim#RestoreWindow()* +tlib#win#Set() tlib.txt /*tlib#win#Set()* +tlib#win#SetById() tlib.txt /*tlib#win#SetById()* +tlib.txt tlib.txt /*tlib.txt* +v_sp tlib.txt /*v_sp* diff --git a/sources_non_forked/tlib/doc/tags.bak b/sources_non_forked/tlib/doc/tags.bak new file mode 100644 index 00000000..ddfdf409 --- /dev/null +++ b/sources_non_forked/tlib/doc/tags.bak @@ -0,0 +1,376 @@ +:TBrowseOutput tlib.txt /*:TBrowseOutput* +:TBrowseScriptnames tlib.txt /*:TBrowseScriptnames* +:TLet tlib.txt /*:TLet* +:TScratch tlib.txt /*:TScratch* +:TVarArg tlib.txt /*:TVarArg* +:Tlibassert tlib.txt /*:Tlibassert* +:Tlibtrace tlib.txt /*:Tlibtrace* +:Tlibtraceset tlib.txt /*:Tlibtraceset* +Add() tlib.txt /*Add()* +TestArgs() tlib.txt /*TestArgs()* +TestArgs1() tlib.txt /*TestArgs1()* +TestArgs2() tlib.txt /*TestArgs2()* +TestArgs3() tlib.txt /*TestArgs3()* +TestGetArg() tlib.txt /*TestGetArg()* +TestGetArg1() tlib.txt /*TestGetArg1()* +g:tlib#Filter_glob#char tlib.txt /*g:tlib#Filter_glob#char* +g:tlib#Filter_glob#seq tlib.txt /*g:tlib#Filter_glob#seq* +g:tlib#cache#dont_purge tlib.txt /*g:tlib#cache#dont_purge* +g:tlib#cache#max_filename tlib.txt /*g:tlib#cache#max_filename* +g:tlib#cache#purge_days tlib.txt /*g:tlib#cache#purge_days* +g:tlib#cache#purge_every_days tlib.txt /*g:tlib#cache#purge_every_days* +g:tlib#cache#run_script tlib.txt /*g:tlib#cache#run_script* +g:tlib#cache#script_encoding tlib.txt /*g:tlib#cache#script_encoding* +g:tlib#cache#verbosity tlib.txt /*g:tlib#cache#verbosity* +g:tlib#debug tlib.txt /*g:tlib#debug* +g:tlib#dir#sep tlib.txt /*g:tlib#dir#sep* +g:tlib#file#absolute_filename_rx tlib.txt /*g:tlib#file#absolute_filename_rx* +g:tlib#file#drop tlib.txt /*g:tlib#file#drop* +g:tlib#file#edit_cmds tlib.txt /*g:tlib#file#edit_cmds* +g:tlib#file#use_tabs tlib.txt /*g:tlib#file#use_tabs* +g:tlib#hash#use_adler32 tlib.txt /*g:tlib#hash#use_adler32* +g:tlib#hash#use_crc32 tlib.txt /*g:tlib#hash#use_crc32* +g:tlib#input#and tlib.txt /*g:tlib#input#and* +g:tlib#input#filename_max_width tlib.txt /*g:tlib#input#filename_max_width* +g:tlib#input#filename_padding_r tlib.txt /*g:tlib#input#filename_padding_r* +g:tlib#input#filter_mode tlib.txt /*g:tlib#input#filter_mode* +g:tlib#input#format_filename tlib.txt /*g:tlib#input#format_filename* +g:tlib#input#handlers_EditList tlib.txt /*g:tlib#input#handlers_EditList* +g:tlib#input#higroup tlib.txt /*g:tlib#input#higroup* +g:tlib#input#keyagents_InputList_m tlib.txt /*g:tlib#input#keyagents_InputList_m* +g:tlib#input#keyagents_InputList_s tlib.txt /*g:tlib#input#keyagents_InputList_s* +g:tlib#input#livesearch_threshold tlib.txt /*g:tlib#input#livesearch_threshold* +g:tlib#input#not tlib.txt /*g:tlib#input#not* +g:tlib#input#numeric_chars tlib.txt /*g:tlib#input#numeric_chars* +g:tlib#input#or tlib.txt /*g:tlib#input#or* +g:tlib#input#sortprefs_threshold tlib.txt /*g:tlib#input#sortprefs_threshold* +g:tlib#input#use_popup tlib.txt /*g:tlib#input#use_popup* +g:tlib#input#user_shortcuts tlib.txt /*g:tlib#input#user_shortcuts* +g:tlib#scratch#hidden tlib.txt /*g:tlib#scratch#hidden* +g:tlib#sys#check_cygpath tlib.txt /*g:tlib#sys#check_cygpath* +g:tlib#sys#cygwin_expr tlib.txt /*g:tlib#sys#cygwin_expr* +g:tlib#sys#cygwin_path_rx tlib.txt /*g:tlib#sys#cygwin_path_rx* +g:tlib#sys#null tlib.txt /*g:tlib#sys#null* +g:tlib#sys#special_protocols tlib.txt /*g:tlib#sys#special_protocols* +g:tlib#sys#special_suffixes tlib.txt /*g:tlib#sys#special_suffixes* +g:tlib#sys#system_browser tlib.txt /*g:tlib#sys#system_browser* +g:tlib#sys#system_rx tlib.txt /*g:tlib#sys#system_rx* +g:tlib#sys#windows tlib.txt /*g:tlib#sys#windows* +g:tlib#trace#backtrace tlib.txt /*g:tlib#trace#backtrace* +g:tlib#trace#printf tlib.txt /*g:tlib#trace#printf* +g:tlib#vcs#check tlib.txt /*g:tlib#vcs#check* +g:tlib#vcs#def tlib.txt /*g:tlib#vcs#def* +g:tlib#vcs#executables tlib.txt /*g:tlib#vcs#executables* +g:tlib#vim#simalt_maximize tlib.txt /*g:tlib#vim#simalt_maximize* +g:tlib#vim#simalt_restore tlib.txt /*g:tlib#vim#simalt_restore* +g:tlib#vim#use_vimtweak tlib.txt /*g:tlib#vim#use_vimtweak* +g:tlib#vim#use_wmctrl tlib.txt /*g:tlib#vim#use_wmctrl* +g:tlib_cache tlib.txt /*g:tlib_cache* +g:tlib_inputlist_filename_indicators tlib.txt /*g:tlib_inputlist_filename_indicators* +g:tlib_inputlist_pct tlib.txt /*g:tlib_inputlist_pct* +g:tlib_inputlist_shortmessage tlib.txt /*g:tlib_inputlist_shortmessage* +g:tlib_inputlist_width_filename tlib.txt /*g:tlib_inputlist_width_filename* +g:tlib_persistent tlib.txt /*g:tlib_persistent* +g:tlib_pick_last_item tlib.txt /*g:tlib_pick_last_item* +g:tlib_scratch_pos tlib.txt /*g:tlib_scratch_pos* +g:tlib_scroll_lines tlib.txt /*g:tlib_scroll_lines* +g:tlib_tag_substitute tlib.txt /*g:tlib_tag_substitute* +g:tlib_tags_extra tlib.txt /*g:tlib_tags_extra* +g:tlib_viewline_position tlib.txt /*g:tlib_viewline_position* +o_sp tlib.txt /*o_sp* +standard-paragraph tlib.txt /*standard-paragraph* +tlib#Filter_cnf#New() tlib.txt /*tlib#Filter_cnf#New()* +tlib#Filter_cnfd#New() tlib.txt /*tlib#Filter_cnfd#New()* +tlib#Filter_fuzzy#New() tlib.txt /*tlib#Filter_fuzzy#New()* +tlib#Filter_glob#New() tlib.txt /*tlib#Filter_glob#New()* +tlib#Object#Methods() tlib.txt /*tlib#Object#Methods()* +tlib#Object#New() tlib.txt /*tlib#Object#New()* +tlib#World#New() tlib.txt /*tlib#World#New()* +tlib#agent#AND() tlib.txt /*tlib#agent#AND()* +tlib#agent#Complete() tlib.txt /*tlib#agent#Complete()* +tlib#agent#CompleteAgentNames() tlib.txt /*tlib#agent#CompleteAgentNames()* +tlib#agent#Copy() tlib.txt /*tlib#agent#Copy()* +tlib#agent#CopyItems() tlib.txt /*tlib#agent#CopyItems()* +tlib#agent#Cut() tlib.txt /*tlib#agent#Cut()* +tlib#agent#Debug() tlib.txt /*tlib#agent#Debug()* +tlib#agent#DeleteItems() tlib.txt /*tlib#agent#DeleteItems()* +tlib#agent#DoAtLine() tlib.txt /*tlib#agent#DoAtLine()* +tlib#agent#Down() tlib.txt /*tlib#agent#Down()* +tlib#agent#DownN() tlib.txt /*tlib#agent#DownN()* +tlib#agent#EditFile() tlib.txt /*tlib#agent#EditFile()* +tlib#agent#EditFileInSplit() tlib.txt /*tlib#agent#EditFileInSplit()* +tlib#agent#EditFileInTab() tlib.txt /*tlib#agent#EditFileInTab()* +tlib#agent#EditFileInVSplit() tlib.txt /*tlib#agent#EditFileInVSplit()* +tlib#agent#EditItem() tlib.txt /*tlib#agent#EditItem()* +tlib#agent#EditReturnValue() tlib.txt /*tlib#agent#EditReturnValue()* +tlib#agent#End() tlib.txt /*tlib#agent#End()* +tlib#agent#ExecAgentByName() tlib.txt /*tlib#agent#ExecAgentByName()* +tlib#agent#Exit() tlib.txt /*tlib#agent#Exit()* +tlib#agent#GotoLine() tlib.txt /*tlib#agent#GotoLine()* +tlib#agent#Help() tlib.txt /*tlib#agent#Help()* +tlib#agent#Home() tlib.txt /*tlib#agent#Home()* +tlib#agent#Input() tlib.txt /*tlib#agent#Input()* +tlib#agent#NewItem() tlib.txt /*tlib#agent#NewItem()* +tlib#agent#Null() tlib.txt /*tlib#agent#Null()* +tlib#agent#OR() tlib.txt /*tlib#agent#OR()* +tlib#agent#PageDown() tlib.txt /*tlib#agent#PageDown()* +tlib#agent#PageUp() tlib.txt /*tlib#agent#PageUp()* +tlib#agent#Paste() tlib.txt /*tlib#agent#Paste()* +tlib#agent#PopFilter() tlib.txt /*tlib#agent#PopFilter()* +tlib#agent#PreviewLine() tlib.txt /*tlib#agent#PreviewLine()* +tlib#agent#ReduceFilter() tlib.txt /*tlib#agent#ReduceFilter()* +tlib#agent#Reset() tlib.txt /*tlib#agent#Reset()* +tlib#agent#RestrictView() tlib.txt /*tlib#agent#RestrictView()* +tlib#agent#Select() tlib.txt /*tlib#agent#Select()* +tlib#agent#SelectAll() tlib.txt /*tlib#agent#SelectAll()* +tlib#agent#SelectDown() tlib.txt /*tlib#agent#SelectDown()* +tlib#agent#SelectUp() tlib.txt /*tlib#agent#SelectUp()* +tlib#agent#ShiftLeft() tlib.txt /*tlib#agent#ShiftLeft()* +tlib#agent#ShiftRight() tlib.txt /*tlib#agent#ShiftRight()* +tlib#agent#ShowInfo() tlib.txt /*tlib#agent#ShowInfo()* +tlib#agent#Suspend() tlib.txt /*tlib#agent#Suspend()* +tlib#agent#SuspendToParentWindow() tlib.txt /*tlib#agent#SuspendToParentWindow()* +tlib#agent#ToggleRestrictView() tlib.txt /*tlib#agent#ToggleRestrictView()* +tlib#agent#ToggleScrollbind() tlib.txt /*tlib#agent#ToggleScrollbind()* +tlib#agent#ToggleStickyList() tlib.txt /*tlib#agent#ToggleStickyList()* +tlib#agent#UnrestrictView() tlib.txt /*tlib#agent#UnrestrictView()* +tlib#agent#Up() tlib.txt /*tlib#agent#Up()* +tlib#agent#UpN() tlib.txt /*tlib#agent#UpN()* +tlib#agent#ViewFile() tlib.txt /*tlib#agent#ViewFile()* +tlib#agent#Wildcard() tlib.txt /*tlib#agent#Wildcard()* +tlib#arg#Ex() tlib.txt /*tlib#arg#Ex()* +tlib#arg#Get() tlib.txt /*tlib#arg#Get()* +tlib#arg#GetOpts() tlib.txt /*tlib#arg#GetOpts()* +tlib#arg#Let() tlib.txt /*tlib#arg#Let()* +tlib#arg#StringAsKeyArgs() tlib.txt /*tlib#arg#StringAsKeyArgs()* +tlib#arg#StringAsKeyArgsEqual() tlib.txt /*tlib#arg#StringAsKeyArgsEqual()* +tlib#assert#All() tlib.txt /*tlib#assert#All()* +tlib#assert#Assert() tlib.txt /*tlib#assert#Assert()* +tlib#assert#Disable() tlib.txt /*tlib#assert#Disable()* +tlib#assert#Enable() tlib.txt /*tlib#assert#Enable()* +tlib#assert#Map() tlib.txt /*tlib#assert#Map()* +tlib#autocmdgroup#Init() tlib.txt /*tlib#autocmdgroup#Init()* +tlib#balloon#Expand() tlib.txt /*tlib#balloon#Expand()* +tlib#balloon#Expr() tlib.txt /*tlib#balloon#Expr()* +tlib#balloon#Register() tlib.txt /*tlib#balloon#Register()* +tlib#balloon#Remove() tlib.txt /*tlib#balloon#Remove()* +tlib#bitwise#AND() tlib.txt /*tlib#bitwise#AND()* +tlib#bitwise#Add() tlib.txt /*tlib#bitwise#Add()* +tlib#bitwise#Bits2Num() tlib.txt /*tlib#bitwise#Bits2Num()* +tlib#bitwise#Num2Bits() tlib.txt /*tlib#bitwise#Num2Bits()* +tlib#bitwise#OR() tlib.txt /*tlib#bitwise#OR()* +tlib#bitwise#ShiftLeft() tlib.txt /*tlib#bitwise#ShiftLeft()* +tlib#bitwise#ShiftRight() tlib.txt /*tlib#bitwise#ShiftRight()* +tlib#bitwise#Sub() tlib.txt /*tlib#bitwise#Sub()* +tlib#bitwise#XOR() tlib.txt /*tlib#bitwise#XOR()* +tlib#buffer#BufDo() tlib.txt /*tlib#buffer#BufDo()* +tlib#buffer#CurrentByte() tlib.txt /*tlib#buffer#CurrentByte()* +tlib#buffer#DeleteRange() tlib.txt /*tlib#buffer#DeleteRange()* +tlib#buffer#DisableMRU() tlib.txt /*tlib#buffer#DisableMRU()* +tlib#buffer#EnableMRU() tlib.txt /*tlib#buffer#EnableMRU()* +tlib#buffer#Eval() tlib.txt /*tlib#buffer#Eval()* +tlib#buffer#GetList() tlib.txt /*tlib#buffer#GetList()* +tlib#buffer#HighlightLine() tlib.txt /*tlib#buffer#HighlightLine()* +tlib#buffer#InsertText() tlib.txt /*tlib#buffer#InsertText()* +tlib#buffer#InsertText0() tlib.txt /*tlib#buffer#InsertText0()* +tlib#buffer#KeepCursorPosition() tlib.txt /*tlib#buffer#KeepCursorPosition()* +tlib#buffer#ReplaceRange() tlib.txt /*tlib#buffer#ReplaceRange()* +tlib#buffer#ScratchEnd() tlib.txt /*tlib#buffer#ScratchEnd()* +tlib#buffer#ScratchStart() tlib.txt /*tlib#buffer#ScratchStart()* +tlib#buffer#Set() tlib.txt /*tlib#buffer#Set()* +tlib#buffer#ViewLine() tlib.txt /*tlib#buffer#ViewLine()* +tlib#cache#Dir() tlib.txt /*tlib#cache#Dir()* +tlib#cache#Filename() tlib.txt /*tlib#cache#Filename()* +tlib#cache#Get() tlib.txt /*tlib#cache#Get()* +tlib#cache#ListFilesInCache() tlib.txt /*tlib#cache#ListFilesInCache()* +tlib#cache#MTime() tlib.txt /*tlib#cache#MTime()* +tlib#cache#MaybePurge() tlib.txt /*tlib#cache#MaybePurge()* +tlib#cache#Purge() tlib.txt /*tlib#cache#Purge()* +tlib#cache#Save() tlib.txt /*tlib#cache#Save()* +tlib#cache#Value() tlib.txt /*tlib#cache#Value()* +tlib#char#Get() tlib.txt /*tlib#char#Get()* +tlib#char#GetWithTimeout() tlib.txt /*tlib#char#GetWithTimeout()* +tlib#char#IsAvailable() tlib.txt /*tlib#char#IsAvailable()* +tlib#cmd#BrowseOutput() tlib.txt /*tlib#cmd#BrowseOutput()* +tlib#cmd#BrowseOutputWithCallback() tlib.txt /*tlib#cmd#BrowseOutputWithCallback()* +tlib#cmd#Capture() tlib.txt /*tlib#cmd#Capture()* +tlib#cmd#DefaultBrowseOutput() tlib.txt /*tlib#cmd#DefaultBrowseOutput()* +tlib#cmd#OutputAsList() tlib.txt /*tlib#cmd#OutputAsList()* +tlib#cmd#ParseScriptname() tlib.txt /*tlib#cmd#ParseScriptname()* +tlib#cmd#TBrowseScriptnames() tlib.txt /*tlib#cmd#TBrowseScriptnames()* +tlib#cmd#Time() tlib.txt /*tlib#cmd#Time()* +tlib#cmd#UseVertical() tlib.txt /*tlib#cmd#UseVertical()* +tlib#comments#Comments() tlib.txt /*tlib#comments#Comments()* +tlib#date#DiffInDays() tlib.txt /*tlib#date#DiffInDays()* +tlib#date#Format() tlib.txt /*tlib#date#Format()* +tlib#date#IsDate() tlib.txt /*tlib#date#IsDate()* +tlib#date#Parse() tlib.txt /*tlib#date#Parse()* +tlib#date#SecondsSince1970() tlib.txt /*tlib#date#SecondsSince1970()* +tlib#date#Shift() tlib.txt /*tlib#date#Shift()* +tlib#dictionary#Rev() tlib.txt /*tlib#dictionary#Rev()* +tlib#dir#CD() tlib.txt /*tlib#dir#CD()* +tlib#dir#CanonicName() tlib.txt /*tlib#dir#CanonicName()* +tlib#dir#Ensure() tlib.txt /*tlib#dir#Ensure()* +tlib#dir#MyRuntime() tlib.txt /*tlib#dir#MyRuntime()* +tlib#dir#NativeName() tlib.txt /*tlib#dir#NativeName()* +tlib#dir#PlainName() tlib.txt /*tlib#dir#PlainName()* +tlib#dir#Pop() tlib.txt /*tlib#dir#Pop()* +tlib#dir#Push() tlib.txt /*tlib#dir#Push()* +tlib#eval#Extend() tlib.txt /*tlib#eval#Extend()* +tlib#eval#FormatValue() tlib.txt /*tlib#eval#FormatValue()* +tlib#file#Absolute() tlib.txt /*tlib#file#Absolute()* +tlib#file#Canonic() tlib.txt /*tlib#file#Canonic()* +tlib#file#Edit() tlib.txt /*tlib#file#Edit()* +tlib#file#Glob() tlib.txt /*tlib#file#Glob()* +tlib#file#Globpath() tlib.txt /*tlib#file#Globpath()* +tlib#file#Join() tlib.txt /*tlib#file#Join()* +tlib#file#Relative() tlib.txt /*tlib#file#Relative()* +tlib#file#Split() tlib.txt /*tlib#file#Split()* +tlib#file#With() tlib.txt /*tlib#file#With()* +tlib#fixes#Winpos() tlib.txt /*tlib#fixes#Winpos()* +tlib#grep#Do() tlib.txt /*tlib#grep#Do()* +tlib#grep#List() tlib.txt /*tlib#grep#List()* +tlib#grep#LocList() tlib.txt /*tlib#grep#LocList()* +tlib#grep#QuickFixList() tlib.txt /*tlib#grep#QuickFixList()* +tlib#hash#Adler32() tlib.txt /*tlib#hash#Adler32()* +tlib#hash#Adler32_tlib() tlib.txt /*tlib#hash#Adler32_tlib()* +tlib#hash#Adler32_vim() tlib.txt /*tlib#hash#Adler32_vim()* +tlib#hash#CRC32B() tlib.txt /*tlib#hash#CRC32B()* +tlib#hash#CRC32B_ruby() tlib.txt /*tlib#hash#CRC32B_ruby()* +tlib#hash#CRC32B_vim() tlib.txt /*tlib#hash#CRC32B_vim()* +tlib#hook#Run() tlib.txt /*tlib#hook#Run()* +tlib#input#CommandSelect() tlib.txt /*tlib#input#CommandSelect()* +tlib#input#Dialog() tlib.txt /*tlib#input#Dialog()* +tlib#input#Edit() tlib.txt /*tlib#input#Edit()* +tlib#input#EditList() tlib.txt /*tlib#input#EditList()* +tlib#input#List() tlib.txt /*tlib#input#List()* +tlib#input#ListD() tlib.txt /*tlib#input#ListD()* +tlib#input#ListW() tlib.txt /*tlib#input#ListW()* +tlib#input#Resume() tlib.txt /*tlib#input#Resume()* +tlib#list#All() tlib.txt /*tlib#list#All()* +tlib#list#Any() tlib.txt /*tlib#list#Any()* +tlib#list#Compact() tlib.txt /*tlib#list#Compact()* +tlib#list#Find() tlib.txt /*tlib#list#Find()* +tlib#list#FindAll() tlib.txt /*tlib#list#FindAll()* +tlib#list#Flatten() tlib.txt /*tlib#list#Flatten()* +tlib#list#Inject() tlib.txt /*tlib#list#Inject()* +tlib#list#Remove() tlib.txt /*tlib#list#Remove()* +tlib#list#RemoveAll() tlib.txt /*tlib#list#RemoveAll()* +tlib#list#ToDictionary() tlib.txt /*tlib#list#ToDictionary()* +tlib#list#Uniq() tlib.txt /*tlib#list#Uniq()* +tlib#list#Zip() tlib.txt /*tlib#list#Zip()* +tlib#loclist#Browse() tlib.txt /*tlib#loclist#Browse()* +tlib#map#PumAccept() tlib.txt /*tlib#map#PumAccept()* +tlib#normal#WithRegister() tlib.txt /*tlib#normal#WithRegister()* +tlib#notify#Echo() tlib.txt /*tlib#notify#Echo()* +tlib#notify#TrimMessage() tlib.txt /*tlib#notify#TrimMessage()* +tlib#number#ConvertBase() tlib.txt /*tlib#number#ConvertBase()* +tlib#paragraph#GetMetric() tlib.txt /*tlib#paragraph#GetMetric()* +tlib#paragraph#Move() tlib.txt /*tlib#paragraph#Move()* +tlib#persistent#Dir() tlib.txt /*tlib#persistent#Dir()* +tlib#persistent#Filename() tlib.txt /*tlib#persistent#Filename()* +tlib#persistent#Get() tlib.txt /*tlib#persistent#Get()* +tlib#persistent#MTime() tlib.txt /*tlib#persistent#MTime()* +tlib#persistent#Save() tlib.txt /*tlib#persistent#Save()* +tlib#persistent#Value() tlib.txt /*tlib#persistent#Value()* +tlib#progressbar#Display() tlib.txt /*tlib#progressbar#Display()* +tlib#progressbar#Init() tlib.txt /*tlib#progressbar#Init()* +tlib#progressbar#Restore() tlib.txt /*tlib#progressbar#Restore()* +tlib#qfl#AgentEditLine() tlib.txt /*tlib#qfl#AgentEditLine()* +tlib#qfl#AgentEditQFE() tlib.txt /*tlib#qfl#AgentEditQFE()* +tlib#qfl#AgentGotoQFE() tlib.txt /*tlib#qfl#AgentGotoQFE()* +tlib#qfl#AgentPreviewQFE() tlib.txt /*tlib#qfl#AgentPreviewQFE()* +tlib#qfl#AgentSplitBuffer() tlib.txt /*tlib#qfl#AgentSplitBuffer()* +tlib#qfl#AgentTabBuffer() tlib.txt /*tlib#qfl#AgentTabBuffer()* +tlib#qfl#AgentVSplitBuffer() tlib.txt /*tlib#qfl#AgentVSplitBuffer()* +tlib#qfl#AgentWithSelected() tlib.txt /*tlib#qfl#AgentWithSelected()* +tlib#qfl#Balloon() tlib.txt /*tlib#qfl#Balloon()* +tlib#qfl#Browse() tlib.txt /*tlib#qfl#Browse()* +tlib#qfl#EditLine() tlib.txt /*tlib#qfl#EditLine()* +tlib#qfl#FormatQFLE() tlib.txt /*tlib#qfl#FormatQFLE()* +tlib#qfl#InitListBuffer() tlib.txt /*tlib#qfl#InitListBuffer()* +tlib#qfl#QfeFilename() tlib.txt /*tlib#qfl#QfeFilename()* +tlib#qfl#QflList() tlib.txt /*tlib#qfl#QflList()* +tlib#qfl#RunCmdOnSelected() tlib.txt /*tlib#qfl#RunCmdOnSelected()* +tlib#qfl#SetFollowCursor() tlib.txt /*tlib#qfl#SetFollowCursor()* +tlib#qfl#SetSyntax() tlib.txt /*tlib#qfl#SetSyntax()* +tlib#rx#Escape() tlib.txt /*tlib#rx#Escape()* +tlib#rx#EscapeReplace() tlib.txt /*tlib#rx#EscapeReplace()* +tlib#rx#LooksLikeRegexp() tlib.txt /*tlib#rx#LooksLikeRegexp()* +tlib#rx#Suffixes() tlib.txt /*tlib#rx#Suffixes()* +tlib#scratch#CloseScratch() tlib.txt /*tlib#scratch#CloseScratch()* +tlib#scratch#UseScratch() tlib.txt /*tlib#scratch#UseScratch()* +tlib#signs#ClearAll() tlib.txt /*tlib#signs#ClearAll()* +tlib#signs#ClearBuffer() tlib.txt /*tlib#signs#ClearBuffer()* +tlib#signs#Mark() tlib.txt /*tlib#signs#Mark()* +tlib#string#Chomp() tlib.txt /*tlib#string#Chomp()* +tlib#string#Count() tlib.txt /*tlib#string#Count()* +tlib#string#Format() tlib.txt /*tlib#string#Format()* +tlib#string#Printf1() tlib.txt /*tlib#string#Printf1()* +tlib#string#RemoveBackslashes() tlib.txt /*tlib#string#RemoveBackslashes()* +tlib#string#SplitCommaList() tlib.txt /*tlib#string#SplitCommaList()* +tlib#string#Strip() tlib.txt /*tlib#string#Strip()* +tlib#string#TrimLeft() tlib.txt /*tlib#string#TrimLeft()* +tlib#string#TrimRight() tlib.txt /*tlib#string#TrimRight()* +tlib#syntax#Collect() tlib.txt /*tlib#syntax#Collect()* +tlib#syntax#Names() tlib.txt /*tlib#syntax#Names()* +tlib#sys#ConvertPath() tlib.txt /*tlib#sys#ConvertPath()* +tlib#sys#FileArgs() tlib.txt /*tlib#sys#FileArgs()* +tlib#sys#GetCmd() tlib.txt /*tlib#sys#GetCmd()* +tlib#sys#IsCygwinBin() tlib.txt /*tlib#sys#IsCygwinBin()* +tlib#sys#IsExecutable() tlib.txt /*tlib#sys#IsExecutable()* +tlib#sys#IsSpecial() tlib.txt /*tlib#sys#IsSpecial()* +tlib#sys#MaybeUseCygpath() tlib.txt /*tlib#sys#MaybeUseCygpath()* +tlib#sys#Open() tlib.txt /*tlib#sys#Open()* +tlib#sys#SystemInDir() tlib.txt /*tlib#sys#SystemInDir()* +tlib#tab#BufMap() tlib.txt /*tlib#tab#BufMap()* +tlib#tab#Set() tlib.txt /*tlib#tab#Set()* +tlib#tab#TabWinNr() tlib.txt /*tlib#tab#TabWinNr()* +tlib#tag#Collect() tlib.txt /*tlib#tag#Collect()* +tlib#tag#Format() tlib.txt /*tlib#tag#Format()* +tlib#tag#Retrieve() tlib.txt /*tlib#tag#Retrieve()* +tlib#textobjects#Init() tlib.txt /*tlib#textobjects#Init()* +tlib#time#Diff() tlib.txt /*tlib#time#Diff()* +tlib#time#DiffMSecs() tlib.txt /*tlib#time#DiffMSecs()* +tlib#time#FormatNow() tlib.txt /*tlib#time#FormatNow()* +tlib#time#MSecs() tlib.txt /*tlib#time#MSecs()* +tlib#time#Now() tlib.txt /*tlib#time#Now()* +tlib#trace#Backtrace() tlib.txt /*tlib#trace#Backtrace()* +tlib#trace#Disable() tlib.txt /*tlib#trace#Disable()* +tlib#trace#Enable() tlib.txt /*tlib#trace#Enable()* +tlib#trace#Print() tlib.txt /*tlib#trace#Print()* +tlib#trace#PrintToFile() tlib.txt /*tlib#trace#PrintToFile()* +tlib#trace#Set() tlib.txt /*tlib#trace#Set()* +tlib#type#Are() tlib.txt /*tlib#type#Are()* +tlib#type#Has() tlib.txt /*tlib#type#Has()* +tlib#type#Have() tlib.txt /*tlib#type#Have()* +tlib#type#Is() tlib.txt /*tlib#type#Is()* +tlib#type#IsDictionary() tlib.txt /*tlib#type#IsDictionary()* +tlib#type#IsFuncref() tlib.txt /*tlib#type#IsFuncref()* +tlib#type#IsList() tlib.txt /*tlib#type#IsList()* +tlib#type#IsNumber() tlib.txt /*tlib#type#IsNumber()* +tlib#type#IsString() tlib.txt /*tlib#type#IsString()* +tlib#url#Decode() tlib.txt /*tlib#url#Decode()* +tlib#url#DecodeChar() tlib.txt /*tlib#url#DecodeChar()* +tlib#url#Encode() tlib.txt /*tlib#url#Encode()* +tlib#url#EncodeChar() tlib.txt /*tlib#url#EncodeChar()* +tlib#var#EGet() tlib.txt /*tlib#var#EGet()* +tlib#var#Get() tlib.txt /*tlib#var#Get()* +tlib#var#Let() tlib.txt /*tlib#var#Let()* +tlib#var#List() tlib.txt /*tlib#var#List()* +tlib#vcs#Diff() tlib.txt /*tlib#vcs#Diff()* +tlib#vcs#Executable() tlib.txt /*tlib#vcs#Executable()* +tlib#vcs#FindVCS() tlib.txt /*tlib#vcs#FindVCS()* +tlib#vcs#GitLsPostprocess() tlib.txt /*tlib#vcs#GitLsPostprocess()* +tlib#vcs#Ls() tlib.txt /*tlib#vcs#Ls()* +tlib#vim#CopyFunction() tlib.txt /*tlib#vim#CopyFunction()* +tlib#vim#Maximize() tlib.txt /*tlib#vim#Maximize()* +tlib#vim#RestoreWindow() tlib.txt /*tlib#vim#RestoreWindow()* +tlib#win#GetLayout() tlib.txt /*tlib#win#GetLayout()* +tlib#win#List() tlib.txt /*tlib#win#List()* +tlib#win#Set() tlib.txt /*tlib#win#Set()* +tlib#win#SetLayout() tlib.txt /*tlib#win#SetLayout()* +tlib#win#Width() tlib.txt /*tlib#win#Width()* +tlib#win#WinDo() tlib.txt /*tlib#win#WinDo()* +tlib.txt tlib.txt /*tlib.txt* +v_sp tlib.txt /*v_sp* diff --git a/sources_non_forked/tlib/doc/tlib.txt b/sources_non_forked/tlib/doc/tlib.txt index 379dc549..648181d9 100644 --- a/sources_non_forked/tlib/doc/tlib.txt +++ b/sources_non_forked/tlib/doc/tlib.txt @@ -30,396 +30,189 @@ installed. ======================================================================== Contents~ - :TLet .................................. |:TLet| - :TScratch .............................. |:TScratch| - :TVarArg ............................... |:TVarArg| - :TBrowseOutput ......................... |:TBrowseOutput| - :TBrowseScriptnames .................... |:TBrowseScriptnames| - :Tlibtrace ............................. |:Tlibtrace| - :Tlibtraceset .......................... |:Tlibtraceset| - :Tlibassert ............................ |:Tlibassert| - Add .................................... |Add()| - TestGetArg ............................. |TestGetArg()| - TestGetArg1 ............................ |TestGetArg1()| - TestArgs ............................... |TestArgs()| - TestArgs1 .............................. |TestArgs1()| - TestArgs2 .............................. |TestArgs2()| - TestArgs3 .............................. |TestArgs3()| - g:tlib#debug ........................... |g:tlib#debug| - tlib#notify#Echo ....................... |tlib#notify#Echo()| - tlib#notify#TrimMessage ................ |tlib#notify#TrimMessage()| - g:tlib#trace#backtrace ................. |g:tlib#trace#backtrace| - g:tlib#trace#printf .................... |g:tlib#trace#printf| - tlib#trace#PrintToFile ................. |tlib#trace#PrintToFile()| - tlib#trace#Set ......................... |tlib#trace#Set()| - tlib#trace#Backtrace ................... |tlib#trace#Backtrace()| - tlib#trace#Print ....................... |tlib#trace#Print()| - tlib#trace#Enable ...................... |tlib#trace#Enable()| - tlib#trace#Disable ..................... |tlib#trace#Disable()| - tlib#dictionary#Rev .................... |tlib#dictionary#Rev()| - g:tlib_persistent ...................... |g:tlib_persistent| - tlib#persistent#Dir .................... |tlib#persistent#Dir()| - tlib#persistent#Filename ............... |tlib#persistent#Filename()| - tlib#persistent#Get .................... |tlib#persistent#Get()| - tlib#persistent#MTime .................. |tlib#persistent#MTime()| - tlib#persistent#Value .................. |tlib#persistent#Value()| - tlib#persistent#Save ................... |tlib#persistent#Save()| - g:tlib#vim#simalt_maximize ............. |g:tlib#vim#simalt_maximize| - g:tlib#vim#simalt_restore .............. |g:tlib#vim#simalt_restore| - g:tlib#vim#use_vimtweak ................ |g:tlib#vim#use_vimtweak| - tlib#vim#Maximize ...................... |tlib#vim#Maximize()| - tlib#vim#RestoreWindow ................. |tlib#vim#RestoreWindow()| - g:tlib#vim#use_wmctrl .................. |g:tlib#vim#use_wmctrl| - tlib#vim#CopyFunction .................. |tlib#vim#CopyFunction()| - tlib#progressbar#Init .................. |tlib#progressbar#Init()| - tlib#progressbar#Display ............... |tlib#progressbar#Display()| - tlib#progressbar#Restore ............... |tlib#progressbar#Restore()| - tlib#eval#FormatValue .................. |tlib#eval#FormatValue()| - tlib#eval#Extend ....................... |tlib#eval#Extend()| - tlib#list#Inject ....................... |tlib#list#Inject()| - tlib#list#Compact ...................... |tlib#list#Compact()| - tlib#list#Flatten ...................... |tlib#list#Flatten()| - tlib#list#FindAll ...................... |tlib#list#FindAll()| - tlib#list#Find ......................... |tlib#list#Find()| - tlib#list#Any .......................... |tlib#list#Any()| - tlib#list#All .......................... |tlib#list#All()| - tlib#list#Remove ....................... |tlib#list#Remove()| - tlib#list#RemoveAll .................... |tlib#list#RemoveAll()| - tlib#list#Zip .......................... |tlib#list#Zip()| - tlib#list#Uniq ......................... |tlib#list#Uniq()| - tlib#list#ToDictionary ................. |tlib#list#ToDictionary()| - tlib#cmd#OutputAsList .................. |tlib#cmd#OutputAsList()| - tlib#cmd#BrowseOutput .................. |tlib#cmd#BrowseOutput()| - tlib#cmd#BrowseOutputWithCallback ...... |tlib#cmd#BrowseOutputWithCallback()| - tlib#cmd#DefaultBrowseOutput ........... |tlib#cmd#DefaultBrowseOutput()| - tlib#cmd#ParseScriptname ............... |tlib#cmd#ParseScriptname()| - tlib#cmd#TBrowseScriptnames ............ |tlib#cmd#TBrowseScriptnames()| - tlib#cmd#UseVertical ................... |tlib#cmd#UseVertical()| - tlib#cmd#Time .......................... |tlib#cmd#Time()| - tlib#cmd#Capture ....................... |tlib#cmd#Capture()| - tlib#syntax#Collect .................... |tlib#syntax#Collect()| - tlib#syntax#Names ...................... |tlib#syntax#Names()| - tlib#balloon#Register .................. |tlib#balloon#Register()| - tlib#balloon#Remove .................... |tlib#balloon#Remove()| - tlib#balloon#Expr ...................... |tlib#balloon#Expr()| - tlib#balloon#Expand .................... |tlib#balloon#Expand()| - g:tlib#vcs#def ......................... |g:tlib#vcs#def| - g:tlib#vcs#executables ................. |g:tlib#vcs#executables| - g:tlib#vcs#check ....................... |g:tlib#vcs#check| - tlib#vcs#Executable .................... |tlib#vcs#Executable()| - tlib#vcs#FindVCS ....................... |tlib#vcs#FindVCS()| - tlib#vcs#Ls ............................ |tlib#vcs#Ls()| - tlib#vcs#Diff .......................... |tlib#vcs#Diff()| - tlib#vcs#GitLsPostprocess .............. |tlib#vcs#GitLsPostprocess()| - tlib#char#Get .......................... |tlib#char#Get()| - tlib#char#IsAvailable .................. |tlib#char#IsAvailable()| - tlib#char#GetWithTimeout ............... |tlib#char#GetWithTimeout()| - g:tlib#Filter_glob#seq ................. |g:tlib#Filter_glob#seq| - g:tlib#Filter_glob#char ................ |g:tlib#Filter_glob#char| - tlib#Filter_glob#New ................... |tlib#Filter_glob#New()| - g:tlib_scratch_pos ..................... |g:tlib_scratch_pos| - g:tlib#scratch#hidden .................. |g:tlib#scratch#hidden| - tlib#scratch#UseScratch ................ |tlib#scratch#UseScratch()| - tlib#scratch#CloseScratch .............. |tlib#scratch#CloseScratch()| - tlib#autocmdgroup#Init ................. |tlib#autocmdgroup#Init()| - g:tlib_cache ........................... |g:tlib_cache| - g:tlib#cache#purge_days ................ |g:tlib#cache#purge_days| - g:tlib#cache#purge_every_days .......... |g:tlib#cache#purge_every_days| - g:tlib#cache#script_encoding ........... |g:tlib#cache#script_encoding| - g:tlib#cache#run_script ................ |g:tlib#cache#run_script| - g:tlib#cache#verbosity ................. |g:tlib#cache#verbosity| - g:tlib#cache#dont_purge ................ |g:tlib#cache#dont_purge| - g:tlib#cache#max_filename .............. |g:tlib#cache#max_filename| - tlib#cache#Dir ......................... |tlib#cache#Dir()| - tlib#cache#Filename .................... |tlib#cache#Filename()| - tlib#cache#Save ........................ |tlib#cache#Save()| - tlib#cache#MTime ....................... |tlib#cache#MTime()| - tlib#cache#Get ......................... |tlib#cache#Get()| - tlib#cache#Value ....................... |tlib#cache#Value()| - tlib#cache#MaybePurge .................. |tlib#cache#MaybePurge()| - tlib#cache#Purge ....................... |tlib#cache#Purge()| - tlib#cache#ListFilesInCache ............ |tlib#cache#ListFilesInCache()| - tlib#normal#WithRegister ............... |tlib#normal#WithRegister()| - tlib#time#MSecs ........................ |tlib#time#MSecs()| - tlib#time#Now .......................... |tlib#time#Now()| - tlib#time#FormatNow .................... |tlib#time#FormatNow()| - tlib#time#Diff ......................... |tlib#time#Diff()| - tlib#time#DiffMSecs .................... |tlib#time#DiffMSecs()| - tlib#var#Let ........................... |tlib#var#Let()| - tlib#var#EGet .......................... |tlib#var#EGet()| - tlib#var#Get ........................... |tlib#var#Get()| - tlib#var#List .......................... |tlib#var#List()| - g:tlib_scroll_lines .................... |g:tlib_scroll_lines| - tlib#agent#Exit ........................ |tlib#agent#Exit()| - tlib#agent#CopyItems ................... |tlib#agent#CopyItems()| - tlib#agent#PageUp ...................... |tlib#agent#PageUp()| - tlib#agent#PageDown .................... |tlib#agent#PageDown()| - tlib#agent#Home ........................ |tlib#agent#Home()| - tlib#agent#End ......................... |tlib#agent#End()| - tlib#agent#Up .......................... |tlib#agent#Up()| - tlib#agent#Down ........................ |tlib#agent#Down()| - tlib#agent#UpN ......................... |tlib#agent#UpN()| - tlib#agent#DownN ....................... |tlib#agent#DownN()| - tlib#agent#ShiftLeft ................... |tlib#agent#ShiftLeft()| - tlib#agent#ShiftRight .................. |tlib#agent#ShiftRight()| - tlib#agent#Reset ....................... |tlib#agent#Reset()| - tlib#agent#ToggleRestrictView .......... |tlib#agent#ToggleRestrictView()| - tlib#agent#RestrictView ................ |tlib#agent#RestrictView()| - tlib#agent#UnrestrictView .............. |tlib#agent#UnrestrictView()| - tlib#agent#Input ....................... |tlib#agent#Input()| - tlib#agent#SuspendToParentWindow ....... |tlib#agent#SuspendToParentWindow()| - tlib#agent#Suspend ..................... |tlib#agent#Suspend()| - tlib#agent#Help ........................ |tlib#agent#Help()| - tlib#agent#OR .......................... |tlib#agent#OR()| - tlib#agent#AND ......................... |tlib#agent#AND()| - tlib#agent#ReduceFilter ................ |tlib#agent#ReduceFilter()| - tlib#agent#PopFilter ................... |tlib#agent#PopFilter()| - tlib#agent#Debug ....................... |tlib#agent#Debug()| - tlib#agent#Select ...................... |tlib#agent#Select()| - tlib#agent#SelectUp .................... |tlib#agent#SelectUp()| - tlib#agent#SelectDown .................. |tlib#agent#SelectDown()| - tlib#agent#SelectAll ................... |tlib#agent#SelectAll()| - tlib#agent#ToggleStickyList ............ |tlib#agent#ToggleStickyList()| - tlib#agent#EditItem .................... |tlib#agent#EditItem()| - tlib#agent#NewItem ..................... |tlib#agent#NewItem()| - tlib#agent#DeleteItems ................. |tlib#agent#DeleteItems()| - tlib#agent#Cut ......................... |tlib#agent#Cut()| - tlib#agent#Copy ........................ |tlib#agent#Copy()| - tlib#agent#Paste ....................... |tlib#agent#Paste()| - tlib#agent#EditReturnValue ............. |tlib#agent#EditReturnValue()| - tlib#agent#ViewFile .................... |tlib#agent#ViewFile()| - tlib#agent#EditFile .................... |tlib#agent#EditFile()| - tlib#agent#EditFileInSplit ............. |tlib#agent#EditFileInSplit()| - tlib#agent#EditFileInVSplit ............ |tlib#agent#EditFileInVSplit()| - tlib#agent#EditFileInTab ............... |tlib#agent#EditFileInTab()| - tlib#agent#ToggleScrollbind ............ |tlib#agent#ToggleScrollbind()| - tlib#agent#ShowInfo .................... |tlib#agent#ShowInfo()| - tlib#agent#PreviewLine ................. |tlib#agent#PreviewLine()| - tlib#agent#GotoLine .................... |tlib#agent#GotoLine()| - tlib#agent#DoAtLine .................... |tlib#agent#DoAtLine()| - tlib#agent#Wildcard .................... |tlib#agent#Wildcard()| - tlib#agent#Null ........................ |tlib#agent#Null()| - tlib#agent#ExecAgentByName ............. |tlib#agent#ExecAgentByName()| - tlib#agent#CompleteAgentNames .......... |tlib#agent#CompleteAgentNames()| - tlib#agent#Complete .................... |tlib#agent#Complete()| - tlib#bitwise#Num2Bits .................. |tlib#bitwise#Num2Bits()| - tlib#bitwise#Bits2Num .................. |tlib#bitwise#Bits2Num()| - tlib#bitwise#AND ....................... |tlib#bitwise#AND()| - tlib#bitwise#OR ........................ |tlib#bitwise#OR()| - tlib#bitwise#XOR ....................... |tlib#bitwise#XOR()| - tlib#bitwise#ShiftRight ................ |tlib#bitwise#ShiftRight()| - tlib#bitwise#ShiftLeft ................. |tlib#bitwise#ShiftLeft()| - tlib#bitwise#Add ....................... |tlib#bitwise#Add()| - tlib#bitwise#Sub ....................... |tlib#bitwise#Sub()| - tlib#url#Decode ........................ |tlib#url#Decode()| - tlib#url#DecodeChar .................... |tlib#url#DecodeChar()| - tlib#url#EncodeChar .................... |tlib#url#EncodeChar()| - tlib#url#Encode ........................ |tlib#url#Encode()| - tlib#signs#ClearAll .................... |tlib#signs#ClearAll()| - tlib#signs#ClearBuffer ................. |tlib#signs#ClearBuffer()| - tlib#signs#Mark ........................ |tlib#signs#Mark()| - tlib#rx#Escape ......................... |tlib#rx#Escape()| - tlib#rx#EscapeReplace .................. |tlib#rx#EscapeReplace()| - tlib#rx#Suffixes ....................... |tlib#rx#Suffixes()| - tlib#rx#LooksLikeRegexp ................ |tlib#rx#LooksLikeRegexp()| - g:tlib_tags_extra ...................... |g:tlib_tags_extra| - g:tlib_tag_substitute .................. |g:tlib_tag_substitute| - tlib#tag#Retrieve ...................... |tlib#tag#Retrieve()| - tlib#tag#Collect ....................... |tlib#tag#Collect()| - tlib#tag#Format ........................ |tlib#tag#Format()| - tlib#map#PumAccept ..................... |tlib#map#PumAccept()| - tlib#Filter_cnfd#New ................... |tlib#Filter_cnfd#New()| - g:tlib#input#sortprefs_threshold ....... |g:tlib#input#sortprefs_threshold| - g:tlib#input#livesearch_threshold ...... |g:tlib#input#livesearch_threshold| - g:tlib#input#filter_mode ............... |g:tlib#input#filter_mode| - g:tlib#input#higroup ................... |g:tlib#input#higroup| - g:tlib_pick_last_item .................. |g:tlib_pick_last_item| - g:tlib#input#and ....................... |g:tlib#input#and| - g:tlib#input#or ........................ |g:tlib#input#or| - g:tlib#input#not ....................... |g:tlib#input#not| - g:tlib#input#numeric_chars ............. |g:tlib#input#numeric_chars| - g:tlib#input#keyagents_InputList_s ..... |g:tlib#input#keyagents_InputList_s| - g:tlib#input#keyagents_InputList_m ..... |g:tlib#input#keyagents_InputList_m| - g:tlib#input#handlers_EditList ......... |g:tlib#input#handlers_EditList| - g:tlib#input#user_shortcuts ............ |g:tlib#input#user_shortcuts| - g:tlib#input#use_popup ................. |g:tlib#input#use_popup| - g:tlib#input#format_filename ........... |g:tlib#input#format_filename| - g:tlib#input#filename_padding_r ........ |g:tlib#input#filename_padding_r| - g:tlib#input#filename_max_width ........ |g:tlib#input#filename_max_width| - tlib#input#List ........................ |tlib#input#List()| - tlib#input#ListD ....................... |tlib#input#ListD()| - tlib#input#ListW ....................... |tlib#input#ListW()| - tlib#input#EditList .................... |tlib#input#EditList()| - tlib#input#Resume ...................... |tlib#input#Resume()| - tlib#input#CommandSelect ............... |tlib#input#CommandSelect()| - tlib#input#Edit ........................ |tlib#input#Edit()| - tlib#input#Dialog ...................... |tlib#input#Dialog()| - tlib#number#ConvertBase ................ |tlib#number#ConvertBase()| - g:tlib#file#drop ....................... |g:tlib#file#drop| - g:tlib#file#use_tabs ................... |g:tlib#file#use_tabs| - g:tlib#file#edit_cmds .................. |g:tlib#file#edit_cmds| - g:tlib#file#absolute_filename_rx ....... |g:tlib#file#absolute_filename_rx| - tlib#file#Split ........................ |tlib#file#Split()| - tlib#file#Join ......................... |tlib#file#Join()| - tlib#file#Relative ..................... |tlib#file#Relative()| - tlib#file#Absolute ..................... |tlib#file#Absolute()| - tlib#file#Canonic ...................... |tlib#file#Canonic()| - tlib#file#With ......................... |tlib#file#With()| - tlib#file#Edit ......................... |tlib#file#Edit()| - tlib#file#Glob ......................... |tlib#file#Glob()| - tlib#file#Globpath ..................... |tlib#file#Globpath()| - g:tlib#sys#special_protocols ........... |g:tlib#sys#special_protocols| - g:tlib#sys#special_suffixes ............ |g:tlib#sys#special_suffixes| - g:tlib#sys#system_rx ................... |g:tlib#sys#system_rx| - g:tlib#sys#system_browser .............. |g:tlib#sys#system_browser| - g:tlib#sys#windows ..................... |g:tlib#sys#windows| - g:tlib#sys#null ........................ |g:tlib#sys#null| - tlib#sys#IsCygwinBin ................... |tlib#sys#IsCygwinBin()| - tlib#sys#IsExecutable .................. |tlib#sys#IsExecutable()| - g:tlib#sys#check_cygpath ............... |g:tlib#sys#check_cygpath| - g:tlib#sys#cygwin_path_rx .............. |g:tlib#sys#cygwin_path_rx| - g:tlib#sys#cygwin_expr ................. |g:tlib#sys#cygwin_expr| - tlib#sys#GetCmd ........................ |tlib#sys#GetCmd()| - tlib#sys#MaybeUseCygpath ............... |tlib#sys#MaybeUseCygpath()| - tlib#sys#ConvertPath ................... |tlib#sys#ConvertPath()| - tlib#sys#FileArgs ...................... |tlib#sys#FileArgs()| - tlib#sys#IsSpecial ..................... |tlib#sys#IsSpecial()| - tlib#sys#Open .......................... |tlib#sys#Open()| - tlib#sys#SystemInDir ................... |tlib#sys#SystemInDir()| - tlib#paragraph#GetMetric ............... |tlib#paragraph#GetMetric()| - tlib#paragraph#Move .................... |tlib#paragraph#Move()| - g:tlib_inputlist_pct ................... |g:tlib_inputlist_pct| - g:tlib_inputlist_width_filename ........ |g:tlib_inputlist_width_filename| - g:tlib_inputlist_filename_indicators ... |g:tlib_inputlist_filename_indicators| - g:tlib_inputlist_shortmessage .......... |g:tlib_inputlist_shortmessage| - tlib#World#New ......................... |tlib#World#New()| - prototype.PrintLines - prototype.Suspend - tlib#loclist#Browse .................... |tlib#loclist#Browse()| - tlib#tab#BufMap ........................ |tlib#tab#BufMap()| - tlib#tab#TabWinNr ...................... |tlib#tab#TabWinNr()| - tlib#tab#Set ........................... |tlib#tab#Set()| - tlib#date#IsDate ....................... |tlib#date#IsDate()| - tlib#date#Format ....................... |tlib#date#Format()| - tlib#date#DiffInDays ................... |tlib#date#DiffInDays()| - tlib#date#Parse ........................ |tlib#date#Parse()| - tlib#date#SecondsSince1970 ............. |tlib#date#SecondsSince1970()| - tlib#date#Shift ........................ |tlib#date#Shift()| - tlib#type#IsNumber ..................... |tlib#type#IsNumber()| - tlib#type#IsString ..................... |tlib#type#IsString()| - tlib#type#IsFuncref .................... |tlib#type#IsFuncref()| - tlib#type#IsList ....................... |tlib#type#IsList()| - tlib#type#IsDictionary ................. |tlib#type#IsDictionary()| - tlib#type#Is ........................... |tlib#type#Is()| - tlib#type#Are .......................... |tlib#type#Are()| - tlib#type#Has .......................... |tlib#type#Has()| - tlib#type#Have ......................... |tlib#type#Have()| - tlib#Filter_fuzzy#New .................. |tlib#Filter_fuzzy#New()| - tlib#assert#Enable ..................... |tlib#assert#Enable()| - tlib#assert#Disable .................... |tlib#assert#Disable()| - tlib#assert#Assert ..................... |tlib#assert#Assert()| - tlib#assert#Map ........................ |tlib#assert#Map()| - tlib#assert#All ........................ |tlib#assert#All()| - tlib#textobjects#StandardParagraph ..... |standard-paragraph| - tlib#textobjects#Init .................. |tlib#textobjects#Init()| - v_sp ................................... |v_sp| - o_sp ................................... |o_sp| - tlib#arg#Get ........................... |tlib#arg#Get()| - tlib#arg#Let ........................... |tlib#arg#Let()| - tlib#arg#StringAsKeyArgs ............... |tlib#arg#StringAsKeyArgs()| - tlib#arg#StringAsKeyArgsEqual .......... |tlib#arg#StringAsKeyArgsEqual()| - tlib#arg#GetOpts ....................... |tlib#arg#GetOpts()| - tlib#arg#Ex ............................ |tlib#arg#Ex()| - tlib#fixes#Winpos ...................... |tlib#fixes#Winpos()| - g:tlib#dir#sep ......................... |g:tlib#dir#sep| - tlib#dir#CanonicName ................... |tlib#dir#CanonicName()| - tlib#dir#NativeName .................... |tlib#dir#NativeName()| - tlib#dir#PlainName ..................... |tlib#dir#PlainName()| - tlib#dir#Ensure ........................ |tlib#dir#Ensure()| - tlib#dir#MyRuntime ..................... |tlib#dir#MyRuntime()| - tlib#dir#CD ............................ |tlib#dir#CD()| - tlib#dir#Push .......................... |tlib#dir#Push()| - tlib#dir#Pop ........................... |tlib#dir#Pop()| - g:tlib#hash#use_crc32 .................. |g:tlib#hash#use_crc32| - g:tlib#hash#use_adler32 ................ |g:tlib#hash#use_adler32| - tlib#hash#CRC32B ....................... |tlib#hash#CRC32B()| - tlib#hash#CRC32B_ruby .................. |tlib#hash#CRC32B_ruby()| - tlib#hash#CRC32B_vim ................... |tlib#hash#CRC32B_vim()| - tlib#hash#Adler32 ...................... |tlib#hash#Adler32()| - tlib#hash#Adler32_vim .................. |tlib#hash#Adler32_vim()| - tlib#hash#Adler32_tlib ................. |tlib#hash#Adler32_tlib()| - tlib#win#Set ........................... |tlib#win#Set()| - tlib#win#GetLayout ..................... |tlib#win#GetLayout()| - tlib#win#SetLayout ..................... |tlib#win#SetLayout()| - tlib#win#List .......................... |tlib#win#List()| - tlib#win#Width ......................... |tlib#win#Width()| - tlib#win#WinDo ......................... |tlib#win#WinDo()| - tlib#comments#Comments ................. |tlib#comments#Comments()| - tlib#grep#Do ........................... |tlib#grep#Do()| - tlib#grep#LocList ...................... |tlib#grep#LocList()| - tlib#grep#QuickFixList ................. |tlib#grep#QuickFixList()| - tlib#grep#List ......................... |tlib#grep#List()| - tlib#qfl#FormatQFLE .................... |tlib#qfl#FormatQFLE()| - tlib#qfl#QfeFilename ................... |tlib#qfl#QfeFilename()| - tlib#qfl#InitListBuffer ................ |tlib#qfl#InitListBuffer()| - tlib#qfl#SetSyntax ..................... |tlib#qfl#SetSyntax()| - tlib#qfl#Balloon ....................... |tlib#qfl#Balloon()| - tlib#qfl#AgentEditQFE .................. |tlib#qfl#AgentEditQFE()| - tlib#qfl#AgentPreviewQFE ............... |tlib#qfl#AgentPreviewQFE()| - tlib#qfl#AgentGotoQFE .................. |tlib#qfl#AgentGotoQFE()| - tlib#qfl#AgentWithSelected ............. |tlib#qfl#AgentWithSelected()| - tlib#qfl#RunCmdOnSelected .............. |tlib#qfl#RunCmdOnSelected()| - tlib#qfl#AgentSplitBuffer .............. |tlib#qfl#AgentSplitBuffer()| - tlib#qfl#AgentTabBuffer ................ |tlib#qfl#AgentTabBuffer()| - tlib#qfl#AgentVSplitBuffer ............. |tlib#qfl#AgentVSplitBuffer()| - tlib#qfl#AgentEditLine ................. |tlib#qfl#AgentEditLine()| - tlib#qfl#EditLine ...................... |tlib#qfl#EditLine()| - tlib#qfl#SetFollowCursor ............... |tlib#qfl#SetFollowCursor()| - tlib#qfl#QflList ....................... |tlib#qfl#QflList()| - tlib#qfl#Browse ........................ |tlib#qfl#Browse()| - tlib#Filter_cnf#New .................... |tlib#Filter_cnf#New()| - prototype.Pretty - tlib#Object#New ........................ |tlib#Object#New()| - prototype.New - prototype.Inherit - prototype.Extend - prototype.IsA - prototype.IsRelated - prototype.RespondTo - prototype.Super - tlib#Object#Methods .................... |tlib#Object#Methods()| - g:tlib_viewline_position ............... |g:tlib_viewline_position| - tlib#buffer#EnableMRU .................. |tlib#buffer#EnableMRU()| - tlib#buffer#DisableMRU ................. |tlib#buffer#DisableMRU()| - tlib#buffer#Set ........................ |tlib#buffer#Set()| - tlib#buffer#Eval ....................... |tlib#buffer#Eval()| - tlib#buffer#GetList .................... |tlib#buffer#GetList()| - tlib#buffer#ViewLine ................... |tlib#buffer#ViewLine()| - tlib#buffer#HighlightLine .............. |tlib#buffer#HighlightLine()| - tlib#buffer#DeleteRange ................ |tlib#buffer#DeleteRange()| - tlib#buffer#ReplaceRange ............... |tlib#buffer#ReplaceRange()| - tlib#buffer#ScratchStart ............... |tlib#buffer#ScratchStart()| - tlib#buffer#ScratchEnd ................. |tlib#buffer#ScratchEnd()| - tlib#buffer#BufDo ...................... |tlib#buffer#BufDo()| - tlib#buffer#InsertText ................. |tlib#buffer#InsertText()| - tlib#buffer#InsertText0 ................ |tlib#buffer#InsertText0()| - tlib#buffer#CurrentByte ................ |tlib#buffer#CurrentByte()| - tlib#buffer#KeepCursorPosition ......... |tlib#buffer#KeepCursorPosition()| - tlib#hook#Run .......................... |tlib#hook#Run()| - tlib#string#RemoveBackslashes .......... |tlib#string#RemoveBackslashes()| - tlib#string#Chomp ...................... |tlib#string#Chomp()| - tlib#string#Format ..................... |tlib#string#Format()| - tlib#string#Printf1 .................... |tlib#string#Printf1()| - tlib#string#TrimLeft ................... |tlib#string#TrimLeft()| - tlib#string#TrimRight .................. |tlib#string#TrimRight()| - tlib#string#Strip ...................... |tlib#string#Strip()| - tlib#string#Count ...................... |tlib#string#Count()| - tlib#string#SplitCommaList ............. |tlib#string#SplitCommaList()| + :TLet ................................... |:TLet| + :TScratch ............................... |:TScratch| + :TVarArg ................................ |:TVarArg| + :TBrowseOutput .......................... |:TBrowseOutput| + :TBrowseScriptnames ..................... |:TBrowseScriptnames| + :Texecqfl ............................... |:Texecqfl| + :Texecloc ............................... |:Texecloc| + :Tlibtrace .............................. |:Tlibtrace| + :Tlibtraceset ........................... |:Tlibtraceset| + :Tbrowseqfl ............................. |:Tbrowseqfl| + :Tbrowseloc ............................. |:Tbrowseloc| + tlib#Filter_cnf#New ..................... |tlib#Filter_cnf#New()| + tlib#Filter_cnfd#New .................... |tlib#Filter_cnfd#New()| + tlib#Filter_fuzzy#New ................... |tlib#Filter_fuzzy#New()| + g:tlib#Filter_glob#seq .................. |g:tlib#Filter_glob#seq| + g:tlib#Filter_glob#char ................. |g:tlib#Filter_glob#char| + tlib#Filter_glob#New .................... |tlib#Filter_glob#New()| + tlib#Object#New ......................... |tlib#Object#New()| + g:tlib_inputlist_pct .................... |g:tlib_inputlist_pct| + g:tlib_inputlist_max_lines .............. |g:tlib_inputlist_max_lines| + g:tlib_inputlist_max_cols ............... |g:tlib_inputlist_max_cols| + g:tlib_inputlist_width_filename ......... |g:tlib_inputlist_width_filename| + g:tlib_inputlist_filename_indicators .... |g:tlib_inputlist_filename_indicators| + g:tlib_inputlist_shortmessage ........... |g:tlib_inputlist_shortmessage| + g:tlib_scroll_lines ..................... |g:tlib_scroll_lines| + tlib#agent#SuspendToParentWindow ........ |tlib#agent#SuspendToParentWindow()| + tlib#agent#Suspend ...................... |tlib#agent#Suspend()| + tlib#agent#NewItem ...................... |tlib#agent#NewItem()| + tlib#agent#GotoLine ..................... |tlib#agent#GotoLine()| + tlib#arg#Get ............................ |tlib#arg#Get()| + tlib#arg#Let ............................ |tlib#arg#Let()| + tlib#arg#GetOpts ........................ |tlib#arg#GetOpts()| + tlib#arg#Ex ............................. |tlib#arg#Ex()| + tlib#assert#Enable ...................... |tlib#assert#Enable()| + tlib#assert#Disable ..................... |tlib#assert#Disable()| + g:tlib_viewline_position ................ |g:tlib_viewline_position| + tlib#buffer#Set ......................... |tlib#buffer#Set()| + tlib#buffer#Eval ........................ |tlib#buffer#Eval()| + tlib#buffer#GetList ..................... |tlib#buffer#GetList()| + tlib#buffer#ViewLine .................... |tlib#buffer#ViewLine()| + tlib#buffer#DeleteRange ................. |tlib#buffer#DeleteRange()| + tlib#buffer#ReplaceRange ................ |tlib#buffer#ReplaceRange()| + tlib#buffer#ScratchStart ................ |tlib#buffer#ScratchStart()| + tlib#buffer#ScratchEnd .................. |tlib#buffer#ScratchEnd()| + tlib#buffer#BufDo ....................... |tlib#buffer#BufDo()| + tlib#buffer#InsertText .................. |tlib#buffer#InsertText()| + tlib#buffer#KeepCursorPosition .......... |tlib#buffer#KeepCursorPosition()| + g:tlib_cache ............................ |g:tlib_cache| + g:tlib#cache#purge_days ................. |g:tlib#cache#purge_days| + g:tlib#cache#purge_every_days ........... |g:tlib#cache#purge_every_days| + g:tlib#cache#script_encoding ............ |g:tlib#cache#script_encoding| + g:tlib#cache#run_script ................. |g:tlib#cache#run_script| + g:tlib#cache#verbosity .................. |g:tlib#cache#verbosity| + g:tlib#cache#dont_purge ................. |g:tlib#cache#dont_purge| + g:tlib#cache#max_filename ............... |g:tlib#cache#max_filename| + tlib#cache#Dir .......................... |tlib#cache#Dir()| + tlib#cache#EncodedFilename .............. |tlib#cache#EncodedFilename()| + tlib#cache#Value ........................ |tlib#cache#Value()| + tlib#cache#MaybePurge ................... |tlib#cache#MaybePurge()| + tlib#cache#Purge ........................ |tlib#cache#Purge()| + tlib#char#Get ........................... |tlib#char#Get()| + tlib#cmd#BrowseOutput ................... |tlib#cmd#BrowseOutput()| + tlib#cmd#BrowseOutputWithCallback ....... |tlib#cmd#BrowseOutputWithCallback()| + tlib#cmd#UseVertical .................... |tlib#cmd#UseVertical()| + tlib#cmd#Time ........................... |tlib#cmd#Time()| + tlib#comments#Comments .................. |tlib#comments#Comments()| + tlib#date#SecondsSince1970 .............. |tlib#date#SecondsSince1970()| + g:tlib#dir#sep .......................... |g:tlib#dir#sep| + tlib#dir#CanonicName .................... |tlib#dir#CanonicName()| + tlib#dir#NativeName ..................... |tlib#dir#NativeName()| + tlib#dir#PlainName ...................... |tlib#dir#PlainName()| + tlib#dir#Ensure ......................... |tlib#dir#Ensure()| + tlib#dir#MyRuntime ...................... |tlib#dir#MyRuntime()| + g:tlib#file#drop ........................ |g:tlib#file#drop| + tlib#file#Split ......................... |tlib#file#Split()| + tlib#file#Join .......................... |tlib#file#Join()| + tlib#file#Relative ...................... |tlib#file#Relative()| + tlib#file#Edit .......................... |tlib#file#Edit()| + tlib#hook#Run ........................... |tlib#hook#Run()| + g:tlib#input#sortprefs_threshold ........ |g:tlib#input#sortprefs_threshold| + g:tlib#input#livesearch_threshold ....... |g:tlib#input#livesearch_threshold| + g:tlib#input#filter_mode ................ |g:tlib#input#filter_mode| + g:tlib#input#higroup .................... |g:tlib#input#higroup| + g:tlib_pick_last_item ................... |g:tlib_pick_last_item| + g:tlib#input#numeric_chars .............. |g:tlib#input#numeric_chars| + g:tlib#input#keyagents_InputList_s ...... |g:tlib#input#keyagents_InputList_s| + g:tlib#input#user_shortcuts ............. |g:tlib#input#user_shortcuts| + g:tlib#input#use_popup .................. |g:tlib#input#use_popup| + g:tlib#input#format_filename ............ |g:tlib#input#format_filename| + g:tlib#input#filename_padding_r ......... |g:tlib#input#filename_padding_r| + g:tlib#input#filename_max_width ......... |g:tlib#input#filename_max_width| + tlib#input#List ......................... |tlib#input#List()| + tlib#input#ListD ........................ |tlib#input#ListD()| + tlib#input#ListW ........................ |tlib#input#ListW()| + tlib#input#EditList ..................... |tlib#input#EditList()| + tlib#input#CommandSelect ................ |tlib#input#CommandSelect()| + tlib#input#Edit ......................... |tlib#input#Edit()| + tlib#list#Inject ........................ |tlib#list#Inject()| + tlib#list#Compact ....................... |tlib#list#Compact()| + tlib#list#Flatten ....................... |tlib#list#Flatten()| + tlib#list#FindAll ....................... |tlib#list#FindAll()| + tlib#list#Find .......................... |tlib#list#Find()| + tlib#list#Any ........................... |tlib#list#Any()| + tlib#list#All ........................... |tlib#list#All()| + tlib#list#Remove ........................ |tlib#list#Remove()| + tlib#list#RemoveAll ..................... |tlib#list#RemoveAll()| + tlib#list#Zip ........................... |tlib#list#Zip()| + tlib#map#PumAccept ...................... |tlib#map#PumAccept()| + tlib#normal#WithRegister ................ |tlib#normal#WithRegister()| + tlib#notify#Echo ........................ |tlib#notify#Echo()| + tlib#notify#TrimMessage ................. |tlib#notify#TrimMessage()| + tlib#paragraph#GetMetric ................ |tlib#paragraph#GetMetric()| + tlib#paragraph#Move ..................... |tlib#paragraph#Move()| + g:tlib_persistent ....................... |g:tlib_persistent| + tlib#persistent#Dir ..................... |tlib#persistent#Dir()| + tlib#persistent#EncodedFilename ......... |tlib#persistent#EncodedFilename()| + tlib#progressbar#Init ................... |tlib#progressbar#Init()| + tlib#rx#Escape .......................... |tlib#rx#Escape()| + tlib#rx#EscapeReplace ................... |tlib#rx#EscapeReplace()| + g:tlib_scratch_pos ...................... |g:tlib_scratch_pos| + g:tlib#scratch#hidden ................... |g:tlib#scratch#hidden| + tlib#scratch#UseScratch ................. |tlib#scratch#UseScratch()| + tlib#scratch#CloseScratch ............... |tlib#scratch#CloseScratch()| + tlib#selection#GetSelection ............. |tlib#selection#GetSelection()| + tlib#signs#ClearAll ..................... |tlib#signs#ClearAll()| + tlib#signs#ClearBuffer .................. |tlib#signs#ClearBuffer()| + tlib#signs#Mark ......................... |tlib#signs#Mark()| + tlib#string#RemoveBackslashes ........... |tlib#string#RemoveBackslashes()| + tlib#string#Format ...................... |tlib#string#Format()| + tlib#string#Printf1 ..................... |tlib#string#Printf1()| + g:tlib#sys#special_protocols ............ |g:tlib#sys#special_protocols| + g:tlib#sys#special_suffixes ............. |g:tlib#sys#special_suffixes| + g:tlib#sys#system_rx .................... |g:tlib#sys#system_rx| + g:tlib#sys#system_browser ............... |g:tlib#sys#system_browser| + g:tlib#sys#check_cygpath ................ |g:tlib#sys#check_cygpath| + g:tlib#sys#cygwin_path_rx ............... |g:tlib#sys#cygwin_path_rx| + g:tlib#sys#cygwin_expr .................. |g:tlib#sys#cygwin_expr| + tlib#sys#MaybeUseCygpath ................ |tlib#sys#MaybeUseCygpath()| + tlib#sys#IsSpecial ...................... |tlib#sys#IsSpecial()| + tlib#sys#Open ........................... |tlib#sys#Open()| + tlib#sys#OpenWithSystemViewer ........... |tlib#sys#OpenWithSystemViewer()| + tlib#tab#BufMap ......................... |tlib#tab#BufMap()| + tlib#tab#TabWinNr ....................... |tlib#tab#TabWinNr()| + g:tlib_tags_extra ....................... |g:tlib_tags_extra| + g:tlib_tag_substitute ................... |g:tlib_tag_substitute| + tlib#tag#Retrieve ....................... |tlib#tag#Retrieve()| + tlib#tag#Collect ........................ |tlib#tag#Collect()| + tlib#textobjects#StandardParagraph ...... |standard-paragraph| + v_sp .................................... |v_sp| + g:tlib#trace#backtrace .................. |g:tlib#trace#backtrace| + g:tlib#trace#printer .................... |g:tlib#trace#printer| + tlib#trace#Printer_echom ................ |tlib#trace#Printer_echom()| + tlib#trace#Set .......................... |tlib#trace#Set()| + tlib#trace#Print ........................ |tlib#trace#Print()| + tlib#trace#Enable ....................... |tlib#trace#Enable()| + tlib#trace#Disable ...................... |tlib#trace#Disable()| + tlib#type#Enable ........................ |tlib#type#Enable()| + tlib#type#Disable ....................... |tlib#type#Disable()| + tlib#url#Decode ......................... |tlib#url#Decode()| + tlib#url#DecodeChar ..................... |tlib#url#DecodeChar()| + tlib#url#EncodeChar ..................... |tlib#url#EncodeChar()| + tlib#url#Encode ......................... |tlib#url#Encode()| + tlib#var#Let ............................ |tlib#var#Let()| + tlib#var#EGet ........................... |tlib#var#EGet()| + tlib#var#Get ............................ |tlib#var#Get()| + tlib#var#List ........................... |tlib#var#List()| + g:tlib#vcs#def .......................... |g:tlib#vcs#def| + g:tlib#vcs#executables .................. |g:tlib#vcs#executables| + g:tlib#vcs#check ........................ |g:tlib#vcs#check| + tlib#vcs#Ls ............................. |tlib#vcs#Ls()| + tlib#vcs#Diff ........................... |tlib#vcs#Diff()| + g:tlib#vim#simalt_maximize .............. |g:tlib#vim#simalt_maximize| + g:tlib#vim#simalt_restore ............... |g:tlib#vim#simalt_restore| + g:tlib#vim#use_vimtweak ................. |g:tlib#vim#use_vimtweak| + tlib#vim#Maximize ....................... |tlib#vim#Maximize()| + tlib#vim#RestoreWindow .................. |tlib#vim#RestoreWindow()| + g:tlib#vim#use_wmctrl ................... |g:tlib#vim#use_wmctrl| + tlib#win#Set ............................ |tlib#win#Set()| + tlib#win#SetById ........................ |tlib#win#SetById()| -======================================================================== -plugin/02tlib.vim~ - +------------------------------------------------------------------------ + *plugin/02tlib.vim* *:TLet* :TLet VAR = VALUE Set a variable only if it doesn't already exist. @@ -478,6 +271,14 @@ plugin/02tlib.vim~ TBrowseScriptnames < + *:Texecqfl* +:Texecqfl CMD + Run CMD and display the quickfix list. + + *:Texecloc* +:Texecloc CMD + Run CMD and display the quickfix list. + *:Tlibtrace* :Tlibtrace GUARD, VAR1, VAR2... Do nothing unless |tlib#trace#Enable()| was called. @@ -490,443 +291,60 @@ plugin/02tlib.vim~ *:Tlibtraceset* :Tlibtraceset - :Tlibtraceset +RX1, -RX2... + :Tlibtraceset[!] [--file=FILE] +RX1 -RX2... If |tlib#trace#Enable()| was called: With the optional , users can add and remove GUARDs (actually a |regexp|) that should be traced. - *:Tlibassert* -:Tlibtrace ASSERTION + If no `+` or `-` is prepended, assume `+`. + With the optional bang '!', reset any options. -======================================================================== -test/tlib.vim~ + *:Tbrowseqfl* +:Tlibtype val, 'type', ... + Browse the current |quickfix| list. - *Add()* -Add(a,b) - List + *:Tbrowseloc* +:Tbrowseloc + Browse the current |location-list|. - *TestGetArg()* -TestGetArg(...) - Optional arguments - *TestGetArg1()* -TestGetArg1(...) +------------------------------------------------------------------------ + *autoload/tlib/Filter_cnf.vim* + *tlib#Filter_cnf#New()* +tlib#Filter_cnf#New(...) + The search pattern for |tlib#input#List()| is in conjunctive normal + form: (P1 OR P2 ...) AND (P3 OR P4 ...) ... + The pattern is a '/\V' very no-'/magic' regexp pattern. - *TestArgs()* -TestArgs(...) + Pressing joins two patterns with AND. + Pressing | joins two patterns with OR. + I.e. In order to get "lala AND (foo OR bar)", you type + "lala foo|bar". - *TestArgs1()* -TestArgs1(...) + This is also the base class for other filters. - *TestArgs2()* -TestArgs2(...) - *TestArgs3()* -TestArgs3(...) +------------------------------------------------------------------------ + *autoload/tlib/Filter_cnfd.vim* + *tlib#Filter_cnfd#New()* +tlib#Filter_cnfd#New(...) + The same as |tlib#Filter_cnf#New()| but a dot is expanded to '\.\{-}'. + As a consequence, patterns cannot match dots. + The pattern is a '/\V' very no-'/magic' regexp pattern. -======================================================================== -autoload/tlib.vim~ +------------------------------------------------------------------------ + *autoload/tlib/Filter_fuzzy.vim* + *tlib#Filter_fuzzy#New()* +tlib#Filter_fuzzy#New(...) + Support for "fuzzy" pattern matching in |tlib#input#List()|. + Patterns are interpreted as if characters were connected with '.\{-}'. - *g:tlib#debug* -g:tlib#debug + In "fuzzy" mode, the pretty printing of filenames is disabled. -======================================================================== -autoload/tlib/notify.vim~ - - *tlib#notify#Echo()* -tlib#notify#Echo(text, ?style='') - Print text in the echo area. Temporarily disable 'ruler' and 'showcmd' - in order to prevent |press-enter| messages. - - *tlib#notify#TrimMessage()* -tlib#notify#TrimMessage(message) - Contributed by Erik Falor: - If the line containing the message is too long, echoing it will cause - a 'Hit ENTER' prompt to appear. This function cleans up the line so - that does not happen. - The echoed line is too long if it is wider than the width of the - window, minus cmdline space taken up by the ruler and showcmd - features. - - -======================================================================== -autoload/tlib/trace.vim~ - - *g:tlib#trace#backtrace* -g:tlib#trace#backtrace (default: 2) - The length of the backtrace that should be included in - |tlib#trace#Print()|. - - *g:tlib#trace#printf* -g:tlib#trace#printf (default: 'echom %s') - The command used for printing traces from |tlib#trace#Print()|. - - *tlib#trace#PrintToFile()* -tlib#trace#PrintToFile(filename) - Set |g:tlib#trace#printf| to make |tlib#trace#Print()| print to - `filename`. - - *tlib#trace#Set()* -tlib#trace#Set(vars) - Set the tracing |regexp|. See |:Tlibtrace|. - This will also call |tlib#trace#Enable()|. - - Examples: - call tlib#trace#Set(["+foo", "-bar"]) - call tlib#trace#Set("+foo,-bar") - - *tlib#trace#Backtrace()* -tlib#trace#Backtrace(caller) - - *tlib#trace#Print()* -tlib#trace#Print(caller, vars, values) - Print the values of vars. The first value is a "guard" (see - |:Tlibtrace|). - - *tlib#trace#Enable()* -tlib#trace#Enable() - Enable tracing via |:Tlibtrace|. - - *tlib#trace#Disable()* -tlib#trace#Disable() - Disable tracing via |:Tlibtrace|. - - -======================================================================== -autoload/tlib/dictionary.vim~ - - *tlib#dictionary#Rev()* -tlib#dictionary#Rev(dict) - - -======================================================================== -autoload/tlib/persistent.vim~ - - *g:tlib_persistent* -g:tlib_persistent (default: '') - The directory for persistent data files. If empty, use - |tlib#dir#MyRuntime|.'/share'. - - *tlib#persistent#Dir()* -tlib#persistent#Dir(?mode = 'bg') - Return the full directory name for persistent data files. - - *tlib#persistent#Filename()* -tlib#persistent#Filename(type, ?file=%, ?mkdir=0) - - *tlib#persistent#Get()* -tlib#persistent#Get(...) - - *tlib#persistent#MTime()* -tlib#persistent#MTime(cfile) - - *tlib#persistent#Value()* -tlib#persistent#Value(...) - - *tlib#persistent#Save()* -tlib#persistent#Save(cfile, dictionary) - - -======================================================================== -autoload/tlib/vim.vim~ - - *g:tlib#vim#simalt_maximize* -g:tlib#vim#simalt_maximize (default: 'x') - The alt-key for maximizing the window. - CAUTION: The value of this paramter depends on your locale and - maybe the windows version you are running. - - *g:tlib#vim#simalt_restore* -g:tlib#vim#simalt_restore (default: 'r') - The alt-key for restoring the window. - CAUTION: The value of this paramter depends on your locale and - maybe the windows version you are running. - - *g:tlib#vim#use_vimtweak* -g:tlib#vim#use_vimtweak (default: 0) - If true, use the vimtweak.dll for windows. This will enable - tlib to remove the caption for fullscreen windows. - - *tlib#vim#Maximize()* -tlib#vim#Maximize(fullscreen) - Maximize the window. - You might need to redefine |g:tlib#vim#simalt_maximize| if it doesn't - work for you. - - *tlib#vim#RestoreWindow()* -tlib#vim#RestoreWindow() - Restore the original vimsize after having called |tlib#vim#Maximize()|. - - *g:tlib#vim#use_wmctrl* -g:tlib#vim#use_wmctrl (default: executable('wmctrl')) - If true, use wmctrl for X windows to make a window - maximized/fullscreen. - - This is the preferred method for maximizing windows under X - windows. Some window managers have problem coping with the - default method of setting 'lines' and 'columns' to a large - value. - - *tlib#vim#CopyFunction()* -tlib#vim##CopyFunction(old, new, overwrite=0) - - -======================================================================== -autoload/tlib/progressbar.vim~ - - *tlib#progressbar#Init()* -tlib#progressbar#Init(max, ...) - EXAMPLE: > - call tlib#progressbar#Init(20) - try - for i in range(20) - call tlib#progressbar#Display(i) - call DoSomethingThatTakesSomeTime(i) - endfor - finally - call tlib#progressbar#Restore() - endtry -< - - *tlib#progressbar#Display()* -tlib#progressbar#Display(value, ...) - - *tlib#progressbar#Restore()* -tlib#progressbar#Restore() - - -======================================================================== -autoload/tlib/eval.vim~ - - *tlib#eval#FormatValue()* -tlib#eval#FormatValue(value, ...) - - *tlib#eval#Extend()* -tlib#eval#Extend(a, b, ...) - - -======================================================================== -autoload/tlib/list.vim~ - - *tlib#list#Inject()* -tlib#list#Inject(list, initial_value, funcref) - EXAMPLES: > - echo tlib#list#Inject([1,2,3], 0, function('Add') - => 6 -< - - *tlib#list#Compact()* -tlib#list#Compact(list) - EXAMPLES: > - tlib#list#Compact([0,1,2,3,[], {}, ""]) - => [1,2,3] -< - - *tlib#list#Flatten()* -tlib#list#Flatten(list) - EXAMPLES: > - tlib#list#Flatten([0,[1,2,[3,""]]]) - => [0,1,2,3,""] -< - - *tlib#list#FindAll()* -tlib#list#FindAll(list, filter, ?process_expr="") - Basically the same as filter() - - EXAMPLES: > - tlib#list#FindAll([1,2,3], 'v:val >= 2') - => [2, 3] -< - - *tlib#list#Find()* -tlib#list#Find(list, filter, ?default="", ?process_expr="") - - EXAMPLES: > - tlib#list#Find([1,2,3], 'v:val >= 2') - => 2 -< - - *tlib#list#Any()* -tlib#list#Any(list, expr) - EXAMPLES: > - tlib#list#Any([1,2,3], 'v:val >= 2') - => 1 -< - - *tlib#list#All()* -tlib#list#All(list, expr) - EXAMPLES: > - tlib#list#All([1,2,3], 'v:val >= 2') - => 0 -< - - *tlib#list#Remove()* -tlib#list#Remove(list, element) - EXAMPLES: > - tlib#list#Remove([1,2,1,2], 2) - => [1,1,2] -< - - *tlib#list#RemoveAll()* -tlib#list#RemoveAll(list, element) - EXAMPLES: > - tlib#list#RemoveAll([1,2,1,2], 2) - => [1,1] -< - - *tlib#list#Zip()* -tlib#list#Zip(lists, ?default='') - EXAMPLES: > - tlib#list#Zip([[1,2,3], [4,5,6]]) - => [[1,4], [2,5], [3,6]] -< - - *tlib#list#Uniq()* -tlib#list#Uniq(list, ...) - - *tlib#list#ToDictionary()* -tlib#list#ToDictionary(list, default, ...) - - -======================================================================== -autoload/tlib/cmd.vim~ - - *tlib#cmd#OutputAsList()* -tlib#cmd#OutputAsList(command) - - *tlib#cmd#BrowseOutput()* -tlib#cmd#BrowseOutput(command) - See |:TBrowseOutput|. - - *tlib#cmd#BrowseOutputWithCallback()* -tlib#cmd#BrowseOutputWithCallback(callback, command) - Execute COMMAND and present its output in a |tlib#input#List()|; - when a line is selected, execute the function named as the CALLBACK - and pass in that line as an argument. - - The CALLBACK function gives you an opportunity to massage the COMMAND output - and possibly act on it in a meaningful way. For example, if COMMAND listed - all URIs found in the current buffer, CALLBACK could validate and then open - the selected URI in the system's default browser. - - This function is meant to be a tool to help compose the implementations of - powerful commands that use |tlib#input#List()| as a common interface. See - |TBrowseScriptnames| as an example. - - EXAMPLES: > - call tlib#cmd#BrowseOutputWithCallback('tlib#cmd#ParseScriptname', 'scriptnames') -< - - *tlib#cmd#DefaultBrowseOutput()* -tlib#cmd#DefaultBrowseOutput(cmd) - - *tlib#cmd#ParseScriptname()* -tlib#cmd#ParseScriptname(line) - - *tlib#cmd#TBrowseScriptnames()* -tlib#cmd#TBrowseScriptnames() - - *tlib#cmd#UseVertical()* -tlib#cmd#UseVertical(?rx='') - Look at the history whether the command was called with vertical. If - an rx is provided check first if the last entry in the history matches - this rx. - - *tlib#cmd#Time()* -tlib#cmd#Time(cmd) - Print the time in seconds or milliseconds (if your version of VIM - has |+reltime|) a command takes. - - *tlib#cmd#Capture()* -tlib#cmd#Capture(cmd) - - -======================================================================== -autoload/tlib/syntax.vim~ - - *tlib#syntax#Collect()* -tlib#syntax#Collect() - - *tlib#syntax#Names()* -tlib#syntax#Names(?rx='') - - -======================================================================== -autoload/tlib/balloon.vim~ - - *tlib#balloon#Register()* -tlib#balloon#Register(expr) - - *tlib#balloon#Remove()* -tlib#balloon#Remove(expr) - - *tlib#balloon#Expr()* -tlib#balloon#Expr() - - *tlib#balloon#Expand()* -tlib#balloon#Expand(expr) - - -======================================================================== -autoload/tlib/vcs.vim~ - - *g:tlib#vcs#def* -g:tlib#vcs#def {...} - A dictionarie of supported VCS (currently: git, hg, svn, bzr). - - *g:tlib#vcs#executables* -g:tlib#vcs#executables {...} - A dictionary of custom executables for VCS commands. If the value is - empty, support for that VCS will be removed. If no key is present, it - is assumed that the VCS "type" is the name of the executable. - - *g:tlib#vcs#check* -g:tlib#vcs#check (default: has('win16') || has('win32') || has('win64') ? '%s.exe' : '%s') - If non-empty, use it as a format string to check whether a VCS is - installed on your computer. - - *tlib#vcs#Executable()* -tlib#vcs#Executable(type) - - *tlib#vcs#FindVCS()* -tlib#vcs#FindVCS(filename) - - *tlib#vcs#Ls()* -tlib#vcs#Ls(?filename=bufname('%'), ?vcs=[type, dir]) - Return the files under VCS. - - *tlib#vcs#Diff()* -tlib#vcs#Diff(filename, ?vcs=[type, dir]) - Return the diff for "filename" - - *tlib#vcs#GitLsPostprocess()* -tlib#vcs#GitLsPostprocess(filename) - - -======================================================================== -autoload/tlib/char.vim~ - - *tlib#char#Get()* -tlib#char#Get(?timeout=0) - Get a character. - - EXAMPLES: > - echo tlib#char#Get() - echo tlib#char#Get(5) -< - - *tlib#char#IsAvailable()* -tlib#char#IsAvailable() - - *tlib#char#GetWithTimeout()* -tlib#char#GetWithTimeout(timeout, ...) - - -======================================================================== -autoload/tlib/Filter_glob.vim~ - +------------------------------------------------------------------------ + *autoload/tlib/Filter_glob.vim* *g:tlib#Filter_glob#seq* g:tlib#Filter_glob#seq (default: '*') A character that should be expanded to '\.\{-}'. @@ -943,46 +361,245 @@ tlib#Filter_glob#New(...) The pattern is a '/\V' very no-'/magic' regexp pattern. -======================================================================== -autoload/tlib/scratch.vim~ +------------------------------------------------------------------------ + *autoload/tlib/Object.vim* +Provides a prototype plus some OO-like methods. - *g:tlib_scratch_pos* -g:tlib_scratch_pos (default: 'botright') - Scratch window position. By default the list window is opened on the - bottom. Set this variable to 'topleft' or '' to change this behaviour. + *tlib#Object#New()* +tlib#Object#New(?fields={}) + This function creates a prototype that provides some kind of + inheritance mechanism and a way to call parent/super methods. + + The usage demonstrated in the following example works best when every + class/prototype is defined in a file of its own. + + The reason for why there is a dedicated constructor function is that + this layout facilitates the use of templates and that methods are + hidden from the user. Other solutions are possible. + + EXAMPLES: > + let s:prototype = tlib#Object#New({ + \ '_class': ['FooBar'], + \ 'foo': 1, + \ 'bar': 2, + \ }) + " Constructor + function! FooBar(...) + let object = s:prototype.New(a:0 >= 1 ? a:1 : {}) + return object + endf + function! s:prototype.babble() { + echo "I think, therefore I am ". (self.foo * self.bar) ." months old." + } + +< This could now be used like this: > + let myfoo = FooBar({'foo': 3}) + call myfoo.babble() + => I think, therefore I am 6 months old. + echo myfoo.IsA('FooBar') + => 1 + echo myfoo.IsA('object') + => 1 + echo myfoo.IsA('Foo') + => 0 + echo myfoo.RespondTo('babble') + => 1 + echo myfoo.RespondTo('speak') + => 0 +< + + +------------------------------------------------------------------------ + *autoload/tlib/World.vim* +A prototype used by |tlib#input#List|. +Inherits from |tlib#Object#New|. + + *g:tlib_inputlist_pct* +g:tlib_inputlist_pct (default: 50) + Size of the input list window (in percent) from the main size (of &lines). See |tlib#input#List()|. - *g:tlib#scratch#hidden* -g:tlib#scratch#hidden (default: 'hide') - If you want the scratch buffer to be fully removed, you might want to - set this variable to 'wipe'. - See also https://github.com/tomtom/tlib_vim/pull/16 + *g:tlib_inputlist_max_lines* +g:tlib_inputlist_max_lines (default: -1) + Max height for a horizontal list. - *tlib#scratch#UseScratch()* -tlib#scratch#UseScratch(?keyargs={}) - Display a scratch buffer (a buffer with no file). See :TScratch for an - example. - Return the scratch buffer's number. - Values for keyargs: - scratch_split ... 1: split, 0: window, -1: tab + *g:tlib_inputlist_max_cols* +g:tlib_inputlist_max_cols (default: -1) + Max width for a vertical list. - *tlib#scratch#CloseScratch()* -tlib#scratch#CloseScratch(keyargs, ...) - Close a scratch buffer as defined in keyargs (usually a World). - Return 1 if the scratch buffer is closed (or if it already was - closed). + *g:tlib_inputlist_width_filename* +g:tlib_inputlist_width_filename (default: '&columns / 3') + Size of filename columns when listing filenames. + See |tlib#input#List()|. + + *g:tlib_inputlist_filename_indicators* +g:tlib_inputlist_filename_indicators (default: 0) + If true, |tlib#input#List()| will show some indicators about the + status of a filename (e.g. buflisted(), bufloaded() etc.). + This is disabled by default because vim checks also for the file on + disk when doing this. + + *g:tlib_inputlist_shortmessage* +g:tlib_inputlist_shortmessage (default: 0) + If not null, display only a short info about the filter. -======================================================================== -autoload/tlib/autocmdgroup.vim~ +------------------------------------------------------------------------ + *autoload/tlib/agent.vim* +Various agents for use as key handlers in tlib#input#List() - *tlib#autocmdgroup#Init()* -tlib#autocmdgroup#Init() + *g:tlib_scroll_lines* +g:tlib_scroll_lines (default: 10) + Number of items to move when pressing in the input list window. + + *tlib#agent#SuspendToParentWindow()* +tlib#agent#SuspendToParentWindow(world, selected) + Suspend (see |tlib#agent#Suspend|) the input loop and jump back to the + original position in the parent window. + + *tlib#agent#Suspend()* +tlib#agent#Suspend(world, selected) + Suspend lets you temporarily leave the input loop of + |tlib#input#List|. You can resume editing the list by pressing , + . , or in the suspended window. + and will immediatly select the item under the cursor. + < will select the item but the window will remain opened. + + *tlib#agent#NewItem()* +tlib#agent#NewItem(world, selected) + Insert a new item below the current one. + + *tlib#agent#GotoLine()* +tlib#agent#GotoLine(world, selected) + If not called from the scratch, we assume/guess that we don't have to + suspend the input-evaluation loop. -======================================================================== -autoload/tlib/cache.vim~ +------------------------------------------------------------------------ + *autoload/tlib/arg.vim* + *tlib#arg#Get()* +tlib#arg#Get(n, var, ?default="", ?test='') + Set a positional argument from a variable argument list. + See tlib#string#RemoveBackslashes() for an example. + *tlib#arg#Let()* +tlib#arg#Let(list, ?default='') + Set a positional arguments from a variable argument list. + See tlib#input#List() for an example. + + *tlib#arg#GetOpts()* +tlib#arg#GetOpts(args, ?def={}) + Convert a list of strings of command-line arguments into a dictonary. + + The main use case is to pass [], i.e. the command-line + arguments of a command as list, from a command definition to this + function. + + Example: + ['-h'] + => If def contains a 'help' key, invoke |:help| on its value. + + ['-ab', '--foo', '--bar=BAR', 'bla', bla'] + => {'a': 1, 'b': 1, 'foo': 1, 'bar': 'BAR', '__rest__': ['bla', 'bla']} + + ['-ab', '--', '--foo', '--bar=BAR'] + => {'a': 1, 'b': 1, '__rest__': ['--foo', '--bar=BAR']} + + *tlib#arg#Ex()* +tlib#arg#Ex(arg, ?chars='%#! ') + Escape some characters in a string. + + Use |fnamescape()| if available. + + EXAMPLES: > + exec 'edit '. tlib#arg#Ex('foo%#bar.txt') +< + + +------------------------------------------------------------------------ + *autoload/tlib/assert.vim* + *tlib#assert#Enable()* +tlib#assert#Enable() + Enable tracing via |:Tlibassert|. + + *tlib#assert#Disable()* +tlib#assert#Disable() + Disable tracing via |:Tlibassert|. + + +------------------------------------------------------------------------ + *autoload/tlib/buffer.vim* + *g:tlib_viewline_position* +g:tlib_viewline_position (default: 'zz') + Where to display the line when using |tlib#buffer#ViewLine|. + For possible values for position see |scroll-cursor|. + + *tlib#buffer#Set()* +tlib#buffer#Set(buffer) + Set the buffer to buffer and return a command as string that can be + evaluated by |:execute| in order to restore the original view. + + *tlib#buffer#Eval()* +tlib#buffer#Eval(buffer, code) + Evaluate CODE in BUFFER. + + EXAMPLES: > + call tlib#buffer#Eval('foo.txt', 'echo b:bar') +< + + *tlib#buffer#GetList()* +tlib#buffer#GetList(?show_hidden=0, ?show_number=0, " ?order='bufnr') + Possible values for the "order" argument: + bufnr :: Default behaviour + mru :: Sort buffers according to most recent use + basename :: Sort by the file's basename (last component) + + NOTE: MRU order works on second invocation only. If you want to always + use MRU order, call tlib#buffer#EnableMRU() in your ~/.vimrc file. + + *tlib#buffer#ViewLine()* +tlib#buffer#ViewLine(line, ?position='z') + line is either a number or a string that begins with a number. + For possible values for position see |scroll-cursor|. + See also |g:tlib_viewline_position|. + + *tlib#buffer#DeleteRange()* +tlib#buffer#DeleteRange(line1, line2) + Delete the lines in the current buffer. Wrapper for |:delete|. + + *tlib#buffer#ReplaceRange()* +tlib#buffer#ReplaceRange(line1, line2, lines) + Replace a range of lines. + + *tlib#buffer#ScratchStart()* +tlib#buffer#ScratchStart() + Initialize some scratch area at the bottom of the current buffer. + + *tlib#buffer#ScratchEnd()* +tlib#buffer#ScratchEnd() + Remove the in-buffer scratch area. + + *tlib#buffer#BufDo()* +tlib#buffer#BufDo(exec) + Run exec on all buffers via bufdo and return to the original buffer. + + *tlib#buffer#InsertText()* +tlib#buffer#InsertText(text, keyargs) + Keyargs: + 'shift': 0|N + 'col': col('.')|N + 'lineno': line('.')|N + 'indent': 0|1 + 'pos': 'e'|'s' ... Where to locate the cursor (somewhat like s and e in {offset}) + Insert text (a string) in the buffer. + + *tlib#buffer#KeepCursorPosition()* +tlib#buffer#KeepCursorPosition(cmd) + Evaluate cmd while maintaining the cursor position and jump registers. + + +------------------------------------------------------------------------ + *autoload/tlib/cache.vim* *g:tlib_cache* g:tlib_cache (default: '') The cache directory. If empty, use |tlib#dir#MyRuntime|.'/cache'. @@ -1031,20 +648,12 @@ g:tlib#cache#max_filename (default: 200) |pathshorten()|. *tlib#cache#Dir()* -tlib#cache#Dir(?mode = 'bg') +tlib#cache#Dir(?mode = 'bg', ?ensure_dir = true) The default cache directory. - *tlib#cache#Filename()* -tlib#cache#Filename(type, ?file=%, ?mkdir=0, ?dir='') - - *tlib#cache#Save()* -tlib#cache#Save(cfile, dictionary, ...) - - *tlib#cache#MTime()* -tlib#cache#MTime(cfile) - - *tlib#cache#Get()* -tlib#cache#Get(cfile, ...) + *tlib#cache#EncodedFilename()* +tlib#cache#EncodedFilename(type, file, ?mkdir=0, ?dir='') + Encode `file` and call |tlib#cache#Filename()|. *tlib#cache#Value()* tlib#cache#Value(cfile, generator, ftime, ?generator_args=[], ?options={}) @@ -1060,421 +669,151 @@ tlib#cache#MaybePurge() tlib#cache#Purge() Delete old files. - *tlib#cache#ListFilesInCache()* -tlib#cache#ListFilesInCache(...) - -======================================================================== -autoload/tlib/normal.vim~ - - *tlib#normal#WithRegister()* -tlib#normal#WithRegister(cmd, ?register='t', ?norm_cmd='norm!') - Execute a normal command while maintaining all registers. - - -======================================================================== -autoload/tlib/time.vim~ - - *tlib#time#MSecs()* -tlib#time#MSecs() - - *tlib#time#Now()* -tlib#time#Now() - - *tlib#time#FormatNow()* -tlib#time#FormatNow() - - *tlib#time#Diff()* -tlib#time#Diff(a, b, ...) - - *tlib#time#DiffMSecs()* -tlib#time#DiffMSecs(a, b, ...) - - -======================================================================== -autoload/tlib/var.vim~ - - *tlib#var#Let()* -tlib#var#Let(name, val) - Define a variable called NAME if yet undefined. - You can also use the :TLLet command. +------------------------------------------------------------------------ + *autoload/tlib/char.vim* + *tlib#char#Get()* +tlib#char#Get(?timeout=0) + Get a character. EXAMPLES: > - exec tlib#var#Let('g:foo', 1) - TLet g:foo = 1 + echo tlib#char#Get() + echo tlib#char#Get(5) < - *tlib#var#EGet()* -tlib#var#EGet(var, namespace, ?default='') - Retrieve a variable by searching several namespaces. + +------------------------------------------------------------------------ + *autoload/tlib/cmd.vim* + *tlib#cmd#BrowseOutput()* +tlib#cmd#BrowseOutput(command) + See |:TBrowseOutput|. + + *tlib#cmd#BrowseOutputWithCallback()* +tlib#cmd#BrowseOutputWithCallback(callback, command) + Execute COMMAND and present its output in a |tlib#input#List()|; + when a line is selected, execute the function named as the CALLBACK + and pass in that line as an argument. + + The CALLBACK function gives you an opportunity to massage the COMMAND output + and possibly act on it in a meaningful way. For example, if COMMAND listed + all URIs found in the current buffer, CALLBACK could validate and then open + the selected URI in the system's default browser. + + This function is meant to be a tool to help compose the implementations of + powerful commands that use |tlib#input#List()| as a common interface. See + |TBrowseScriptnames| as an example. EXAMPLES: > - let g:foo = 1 - let b:foo = 2 - let w:foo = 3 - echo eval(tlib#var#EGet('foo', 'vg')) => 1 - echo eval(tlib#var#EGet('foo', 'bg')) => 2 - echo eval(tlib#var#EGet('foo', 'wbg')) => 3 + call tlib#cmd#BrowseOutputWithCallback('tlib#cmd#ParseScriptname', 'scriptnames') < - *tlib#var#Get()* -tlib#var#Get(var, namespace, ?default='') - Retrieve a variable by searching several namespaces. + *tlib#cmd#UseVertical()* +tlib#cmd#UseVertical(?rx='') + Look at the history whether the command was called with vertical. If + an rx is provided check first if the last entry in the history matches + this rx. + *tlib#cmd#Time()* +tlib#cmd#Time(cmd) + Print the time in seconds or milliseconds (if your version of VIM + has |+reltime|) a command takes. + + +------------------------------------------------------------------------ + *autoload/tlib/comments.vim* + *tlib#comments#Comments()* +tlib#comments#Comments(...) + function! tlib#comments#Comments(?rx='') + + +------------------------------------------------------------------------ + *autoload/tlib/date.vim* + *tlib#date#SecondsSince1970()* +tlib#date#Parse(date, ?allow_zero=0, ?silent=0) "{{{3 + tlib#date#SecondsSince1970(date, ?daysshift=0, ?allow_zero=0) + + +------------------------------------------------------------------------ + *autoload/tlib/dir.vim* + *g:tlib#dir#sep* +g:tlib#dir#sep (default: exists('+shellslash') && !&shellslash ? '\' : '/') + TLet g:tlib#dir#sep = '/' + + *tlib#dir#CanonicName()* +tlib#dir#CanonicName(dirname) EXAMPLES: > - let g:foo = 1 - let b:foo = 2 - let w:foo = 3 - echo tlib#var#Get('foo', 'bg') => 1 - echo tlib#var#Get('foo', 'bg') => 2 - echo tlib#var#Get('foo', 'wbg') => 3 + tlib#dir#CanonicName('foo/bar') + => 'foo/bar/' < - *tlib#var#List()* -tlib#var#List(rx, ?prefix='') - Get a list of variables matching rx. - EXAMPLE: - echo tlib#var#List('tlib_', 'g:') - - -======================================================================== -autoload/tlib/agent.vim~ -Various agents for use as key handlers in tlib#input#List() - - *g:tlib_scroll_lines* -g:tlib_scroll_lines (default: 10) - Number of items to move when pressing in the input list window. - - *tlib#agent#Exit()* -tlib#agent#Exit(world, selected) - - *tlib#agent#CopyItems()* -tlib#agent#CopyItems(world, selected) - - *tlib#agent#PageUp()* -tlib#agent#PageUp(world, selected) - - *tlib#agent#PageDown()* -tlib#agent#PageDown(world, selected) - - *tlib#agent#Home()* -tlib#agent#Home(world, selected) - - *tlib#agent#End()* -tlib#agent#End(world, selected) - - *tlib#agent#Up()* -tlib#agent#Up(world, selected, ...) - - *tlib#agent#Down()* -tlib#agent#Down(world, selected, ...) - - *tlib#agent#UpN()* -tlib#agent#UpN(world, selected) - - *tlib#agent#DownN()* -tlib#agent#DownN(world, selected) - - *tlib#agent#ShiftLeft()* -tlib#agent#ShiftLeft(world, selected) - - *tlib#agent#ShiftRight()* -tlib#agent#ShiftRight(world, selected) - - *tlib#agent#Reset()* -tlib#agent#Reset(world, selected) - - *tlib#agent#ToggleRestrictView()* -tlib#agent#ToggleRestrictView(world, selected) - - *tlib#agent#RestrictView()* -tlib#agent#RestrictView(world, selected) - - *tlib#agent#UnrestrictView()* -tlib#agent#UnrestrictView(world, selected) - - *tlib#agent#Input()* -tlib#agent#Input(world, selected) - - *tlib#agent#SuspendToParentWindow()* -tlib#agent#SuspendToParentWindow(world, selected) - Suspend (see |tlib#agent#Suspend|) the input loop and jump back to the - original position in the parent window. - - *tlib#agent#Suspend()* -tlib#agent#Suspend(world, selected) - Suspend lets you temporarily leave the input loop of - |tlib#input#List|. You can resume editing the list by pressing , - . , or in the suspended window. - and will immediatly select the item under the cursor. - < will select the item but the window will remain opened. - - *tlib#agent#Help()* -tlib#agent#Help(world, selected) - - *tlib#agent#OR()* -tlib#agent#OR(world, selected) - - *tlib#agent#AND()* -tlib#agent#AND(world, selected) - - *tlib#agent#ReduceFilter()* -tlib#agent#ReduceFilter(world, selected) - - *tlib#agent#PopFilter()* -tlib#agent#PopFilter(world, selected) - - *tlib#agent#Debug()* -tlib#agent#Debug(world, selected) - - *tlib#agent#Select()* -tlib#agent#Select(world, selected) - - *tlib#agent#SelectUp()* -tlib#agent#SelectUp(world, selected) - - *tlib#agent#SelectDown()* -tlib#agent#SelectDown(world, selected) - - *tlib#agent#SelectAll()* -tlib#agent#SelectAll(world, selected) - - *tlib#agent#ToggleStickyList()* -tlib#agent#ToggleStickyList(world, selected) - - *tlib#agent#EditItem()* -tlib#agent#EditItem(world, selected) - - *tlib#agent#NewItem()* -tlib#agent#NewItem(world, selected) - Insert a new item below the current one. - - *tlib#agent#DeleteItems()* -tlib#agent#DeleteItems(world, selected) - - *tlib#agent#Cut()* -tlib#agent#Cut(world, selected) - - *tlib#agent#Copy()* -tlib#agent#Copy(world, selected) - - *tlib#agent#Paste()* -tlib#agent#Paste(world, selected) - - *tlib#agent#EditReturnValue()* -tlib#agent#EditReturnValue(world, rv) - - *tlib#agent#ViewFile()* -tlib#agent#ViewFile(world, selected) - - *tlib#agent#EditFile()* -tlib#agent#EditFile(world, selected) - - *tlib#agent#EditFileInSplit()* -tlib#agent#EditFileInSplit(world, selected) - - *tlib#agent#EditFileInVSplit()* -tlib#agent#EditFileInVSplit(world, selected) - - *tlib#agent#EditFileInTab()* -tlib#agent#EditFileInTab(world, selected) - - *tlib#agent#ToggleScrollbind()* -tlib#agent#ToggleScrollbind(world, selected) - - *tlib#agent#ShowInfo()* -tlib#agent#ShowInfo(world, selected) - - *tlib#agent#PreviewLine()* -tlib#agent#PreviewLine(world, selected) - - *tlib#agent#GotoLine()* -tlib#agent#GotoLine(world, selected) - If not called from the scratch, we assume/guess that we don't have to - suspend the input-evaluation loop. - - *tlib#agent#DoAtLine()* -tlib#agent#DoAtLine(world, selected) - - *tlib#agent#Wildcard()* -tlib#agent#Wildcard(world, selected) - - *tlib#agent#Null()* -tlib#agent#Null(world, selected) - - *tlib#agent#ExecAgentByName()* -tlib#agent#ExecAgentByName(world, selected) - - *tlib#agent#CompleteAgentNames()* -tlib#agent#CompleteAgentNames(ArgLead, CmdLine, CursorPos) - - *tlib#agent#Complete()* -tlib#agent#Complete(world, selected) - - -======================================================================== -autoload/tlib/bitwise.vim~ - - *tlib#bitwise#Num2Bits()* -tlib#bitwise#Num2Bits(num) - - *tlib#bitwise#Bits2Num()* -tlib#bitwise#Bits2Num(bits, ...) - - *tlib#bitwise#AND()* -tlib#bitwise#AND(num1, num2, ...) - - *tlib#bitwise#OR()* -tlib#bitwise#OR(num1, num2, ...) - - *tlib#bitwise#XOR()* -tlib#bitwise#XOR(num1, num2, ...) - - *tlib#bitwise#ShiftRight()* -tlib#bitwise#ShiftRight(bits, n) - - *tlib#bitwise#ShiftLeft()* -tlib#bitwise#ShiftLeft(bits, n) - - *tlib#bitwise#Add()* -tlib#bitwise#Add(num1, num2, ...) - - *tlib#bitwise#Sub()* -tlib#bitwise#Sub(num1, num2, ...) - - -======================================================================== -autoload/tlib/url.vim~ - - *tlib#url#Decode()* -tlib#url#Decode(url) - Decode an encoded URL. - - *tlib#url#DecodeChar()* -tlib#url#DecodeChar(char) - Decode a single character. - - *tlib#url#EncodeChar()* -tlib#url#EncodeChar(char) - Encode a single character. - - *tlib#url#Encode()* -tlib#url#Encode(url, ...) - Encode an URL. - - -======================================================================== -autoload/tlib/signs.vim~ - - *tlib#signs#ClearAll()* -tlib#signs#ClearAll(sign) - Clear all signs with name SIGN. - - *tlib#signs#ClearBuffer()* -tlib#signs#ClearBuffer(sign, bufnr) - Clear all signs with name SIGN in buffer BUFNR. - - *tlib#signs#Mark()* -tlib#signs#Mark(sign, list) - Add signs for all locations in LIST. LIST must adhere with the - quickfix list format (see |getqflist()|; only the fields lnum and - bufnr are required). - - list:: a quickfix or location list - sign:: a sign defined with |:sign-define| - - -======================================================================== -autoload/tlib/rx.vim~ - - *tlib#rx#Escape()* -tlib#rx#Escape(text, ?magic='m') - magic can be one of: m, M, v, V - See :help 'magic' - - *tlib#rx#EscapeReplace()* -tlib#rx#EscapeReplace(text, ?magic='m') - Escape return |sub-replace-special|. - - *tlib#rx#Suffixes()* -tlib#rx#Suffixes(...) - - *tlib#rx#LooksLikeRegexp()* -tlib#rx#LooksLikeRegexp(text) - - -======================================================================== -autoload/tlib/tag.vim~ - - *g:tlib_tags_extra* -g:tlib_tags_extra (default: '') - Extra tags for |tlib#tag#Retrieve()| (see there). Can also be buffer-local. - - *g:tlib_tag_substitute* -g:tlib_tag_substitute - Filter the tag description through |substitute()| for these filetypes. - This applies only if the tag cmd field (see |taglist()|) is used. - - *tlib#tag#Retrieve()* -tlib#tag#Retrieve(rx, ?extra_tags=0) - Get all tags matching rx. Basically, this function simply calls - |taglist()|, but when extra_tags is true, the list of the tag files - (see 'tags') is temporarily expanded with |g:tlib_tags_extra|. - - Example use: - If you want to include tags for, eg, JDK, normal tags use can become - slow. You could proceed as follows: - 1. Create a tags file for the JDK sources. When creating the tags - file, make sure to include inheritance information and the like - (command-line options like --fields=+iaSm --extra=+q should be ok). - In this example, we want tags only for public methods (there are - most likely better ways to do this): > - ctags -R --fields=+iaSm --extra=+q ${JAVA_HOME}/src - head -n 6 tags > tags0 - grep access:public tags >> tags0 -< 2. Make 'tags' include project specific tags files. In - ~/vimfiles/after/ftplugin/java.vim insert: > - let b:tlib_tags_extra = $JAVA_HOME .'/tags0' -< 3. When this function is invoked as > - echo tlib#tag#Retrieve('print') -< it will return only project-local tags. If it is invoked as > - echo tlib#tag#Retrieve('print', 1) -< tags from the JDK will be included. - - *tlib#tag#Collect()* -tlib#tag#Collect(constraints, ?use_extra=1, ?match_front=1) - Retrieve tags that meet the constraints (a dictionnary of fields and - regexp, with the exception of the kind field which is a list of chars). - For the use of the optional use_extra argument see - |tlib#tag#Retrieve()|. - - *tlib#tag#Format()* -tlib#tag#Format(tag) - - -======================================================================== -autoload/tlib/map.vim~ - - *tlib#map#PumAccept()* -tlib#map#PumAccept(key) - If |pumvisible()| is true, return "\". Otherwise return a:key. - For use in maps like: > - imap tlib#map#PumAccept("\") + *tlib#dir#NativeName()* +tlib#dir#NativeName(dirname) + EXAMPLES: > + tlib#dir#NativeName('foo/bar/') + On Windows: + => 'foo\bar\' + On Linux: + => 'foo/bar/' < + *tlib#dir#PlainName()* +tlib#dir#PlainName(dirname) + EXAMPLES: > + tlib#dir#PlainName('foo/bar/') + => 'foo/bar' +< -======================================================================== -autoload/tlib/Filter_cnfd.vim~ + *tlib#dir#Ensure()* +tlib#dir#Ensure(dir) + Create a directory if it doesn't already exist. - *tlib#Filter_cnfd#New()* -tlib#Filter_cnfd#New(...) - The same as |tlib#Filter_cnf#New()| but a dot is expanded to '\.\{-}'. - As a consequence, patterns cannot match dots. - The pattern is a '/\V' very no-'/magic' regexp pattern. + *tlib#dir#MyRuntime()* +tlib#dir#MyRuntime() + Return the first directory in &rtp. -======================================================================== -autoload/tlib/input.vim~ +------------------------------------------------------------------------ + *autoload/tlib/file.vim* + *g:tlib#file#drop* +g:tlib#file#drop (default: has('gui')) + If true, use |:drop| to edit loaded buffers (only available with GUI). + + *tlib#file#Split()* +tlib#file#Split(filename) + EXAMPLES: > + tlib#file#Split('foo/bar/filename.txt') + => ['foo', 'bar', 'filename.txt'] +< + + *tlib#file#Join()* +tlib#file#Join(filename_parts, ?strip_slashes=1, ?maybe_absolute=0) + EXAMPLES: > + tlib#file#Join(['foo', 'bar', 'filename.txt']) + => 'foo/bar/filename.txt' +< + + *tlib#file#Relative()* +tlib#file#Relative(filename, basedir) + EXAMPLES: > + tlib#file#Relative('foo/bar/filename.txt', 'foo') + => 'bar/filename.txt' +< + + *tlib#file#Edit()* +tlib#file#Edit(fileid) + Return 0 if the file isn't readable/doesn't exist. + Otherwise return 1. + + +------------------------------------------------------------------------ + *autoload/tlib/hook.vim* + *tlib#hook#Run()* +tlib#hook#Run(hook, ?dict={}) + Execute dict[hook], w:{hook}, b:{hook}, or g:{hook} if existent. + + +------------------------------------------------------------------------ + *autoload/tlib/input.vim* Input-related, select from a list etc. *g:tlib#input#sortprefs_threshold* @@ -1546,15 +885,6 @@ g:tlib_pick_last_item (default: 1) Keys for |tlib#input#List|~ - *g:tlib#input#and* -g:tlib#input#and (default: ' ') - - *g:tlib#input#or* -g:tlib#input#or (default: '|') - - *g:tlib#input#not* -g:tlib#input#not (default: '-') - *g:tlib#input#numeric_chars* g:tlib#input#numeric_chars When editing a list with |tlib#input#List|, typing these numeric chars @@ -1580,12 +910,6 @@ g:tlib#input#keyagents_InputList_s \ 11: 'tlib#agent#Up' \ } - *g:tlib#input#keyagents_InputList_m* -g:tlib#input#keyagents_InputList_m - - *g:tlib#input#handlers_EditList* -g:tlib#input#handlers_EditList - *g:tlib#input#user_shortcuts* g:tlib#input#user_shortcuts (default: {}) A dictionary KEY => {'agent': AGENT, 'key_name': KEY_NAME} to @@ -1670,9 +994,6 @@ tlib#input#EditList(query, list, ?timeout=0) echo tlib#input#EditList('Edit:', [100,200,300]) < - *tlib#input#Resume()* -tlib#input#Resume(name, pick, bufnr) - *tlib#input#CommandSelect()* tlib#input#CommandSelect(command, ?keyargs={}) Take a command, view the output, and let the user select an item from @@ -1700,159 +1021,120 @@ tlib#input#Edit(name, value, callback, ?cb_args=[]) call tlib#input#Edit('foo', b:var, 'FooContinue') < - *tlib#input#Dialog()* -tlib#input#Dialog(text, options, default) - -======================================================================== -autoload/tlib/number.vim~ - - *tlib#number#ConvertBase()* -tlib#number#ConvertBase(num, base, ...) - - -======================================================================== -autoload/tlib/file.vim~ - - *g:tlib#file#drop* -g:tlib#file#drop (default: has('gui')) - If true, use |:drop| to edit loaded buffers (only available with GUI). - - *g:tlib#file#use_tabs* -g:tlib#file#use_tabs (default: 0) - - *g:tlib#file#edit_cmds* -g:tlib#file#edit_cmds (default: g:tlib#file#use_tabs ? {'buffer': 'tab split | buffer', 'edit': 'tabedit'} : {}) - - *g:tlib#file#absolute_filename_rx* -g:tlib#file#absolute_filename_rx (default: '^\~\?[\/]') - - *tlib#file#Split()* -tlib#file#Split(filename) +------------------------------------------------------------------------ + *autoload/tlib/list.vim* + *tlib#list#Inject()* +tlib#list#Inject(list, initial_value, funcref) EXAMPLES: > - tlib#file#Split('foo/bar/filename.txt') - => ['foo', 'bar', 'filename.txt'] + echo tlib#list#Inject([1,2,3], 0, function('Add') + => 6 < - *tlib#file#Join()* -tlib#file#Join(filename_parts, ?strip_slashes=1, ?maybe_absolute=0) + *tlib#list#Compact()* +tlib#list#Compact(list) EXAMPLES: > - tlib#file#Join(['foo', 'bar', 'filename.txt']) - => 'foo/bar/filename.txt' + tlib#list#Compact([0,1,2,3,[], {}, ""]) + => [1,2,3] < - *tlib#file#Relative()* -tlib#file#Relative(filename, basedir) + *tlib#list#Flatten()* +tlib#list#Flatten(list) EXAMPLES: > - tlib#file#Relative('foo/bar/filename.txt', 'foo') - => 'bar/filename.txt' + tlib#list#Flatten([0,[1,2,[3,""]]]) + => [0,1,2,3,""] < - *tlib#file#Absolute()* -tlib#file#Absolute(filename, ...) + *tlib#list#FindAll()* +tlib#list#FindAll(list, filter, ?process_expr="") + Basically the same as filter() - *tlib#file#Canonic()* -tlib#file#Canonic(filename, ...) + EXAMPLES: > + tlib#list#FindAll([1,2,3], 'v:val >= 2') + => [2, 3] +< - *tlib#file#With()* -tlib#file#With(fcmd, bcmd, files, ?world={}) + *tlib#list#Find()* +tlib#list#Find(list, filter, ?default="", ?process_expr="") - *tlib#file#Edit()* -tlib#file#Edit(fileid) - Return 0 if the file isn't readable/doesn't exist. - Otherwise return 1. + EXAMPLES: > + tlib#list#Find([1,2,3], 'v:val >= 2') + => 2 +< - *tlib#file#Glob()* -tlib#file#Glob(pattern) + *tlib#list#Any()* +tlib#list#Any(list, expr) + EXAMPLES: > + tlib#list#Any([1,2,3], 'v:val >= 2') + => 1 +< - *tlib#file#Globpath()* -tlib#file#Globpath(path, pattern) + *tlib#list#All()* +tlib#list#All(list, expr) + EXAMPLES: > + tlib#list#All([1,2,3], 'v:val >= 2') + => 0 +< + + *tlib#list#Remove()* +tlib#list#Remove(list, element) + EXAMPLES: > + tlib#list#Remove([1,2,1,2], 2) + => [1,1,2] +< + + *tlib#list#RemoveAll()* +tlib#list#RemoveAll(list, element) + EXAMPLES: > + tlib#list#RemoveAll([1,2,1,2], 2) + => [1,1] +< + + *tlib#list#Zip()* +tlib#list#Zip(lists, ?default='') + EXAMPLES: > + tlib#list#Zip([[1,2,3], [4,5,6]]) + => [[1,4], [2,5], [3,6]] +< -======================================================================== -autoload/tlib/sys.vim~ - - *g:tlib#sys#special_protocols* -g:tlib#sys#special_protocols (default: ['https\?', 'nntp', 'mailto']) - A list of |regexp|s matching protocol names that should be handled - by |g:tlib#sys#system_browser|. - CAVEAT: Must be a |\V| |regexp|. - - *g:tlib#sys#special_suffixes* -g:tlib#sys#special_suffixes (default: ['xlsx\?', 'docx\?', 'pptx\?', 'accdb', 'mdb', 'sqlite', 'pdf', 'jpg', 'png', 'gif']) - A list of |regexp|s matching suffixes that should be handled by - |g:tlib#sys#system_browser|. - CAVEAT: Must be a |\V| |regexp|. - - *g:tlib#sys#system_rx* -g:tlib#sys#system_rx (default: printf('\V\%(\^\%(%s\):\|.\%(%s\)\)', join(g:tlib#sys#special_protocols, '\|'), join(g:tlib#sys#special_suffixes, '\|'))) - Open links matching this |regexp| with |g:tlib#sys#system_browser|. - CAVEAT: Must be a |\V| |regexp|. - - *g:tlib#sys#system_browser* -g:tlib#sys#system_browser (default: ...) - Open files in the system browser. - - *g:tlib#sys#windows* -g:tlib#sys#windows (default: &shell !~ 'sh' && (has('win16') || has('win32') || has('win64'))) - - *g:tlib#sys#null* -g:tlib#sys#null (default: g:tlib#sys#windows ? 'NUL' : (filereadable('/dev/null') ? '/dev/null' : '')) - - *tlib#sys#IsCygwinBin()* -tlib#sys#IsCygwinBin(cmd) - - *tlib#sys#IsExecutable()* -tlib#sys#IsExecutable(cmd, ...) - - *g:tlib#sys#check_cygpath* -g:tlib#sys#check_cygpath (default: g:tlib#sys#windows && tlib#sys#IsExecutable('cygpath', 1)) - If true, check whether we have to convert a path via cyppath -- - see |tlib#sys#MaybeUseCygpath| - - *g:tlib#sys#cygwin_path_rx* -g:tlib#sys#cygwin_path_rx (default: '/cygwin/') - If a full windows filename (with slashes instead of backslashes) - matches this |regexp|, it is assumed to be a cygwin executable. - - *g:tlib#sys#cygwin_expr* -g:tlib#sys#cygwin_expr (default: '"bash -c ''". escape(%s, "''\\") ."''"') - For cygwin binaries, convert command calls using this vim - expression. - - *tlib#sys#GetCmd()* -tlib#sys#GetCmd(cmd) - - *tlib#sys#MaybeUseCygpath()* -tlib#sys#MaybeUseCygpath(cmd) - If cmd seems to be a cygwin executable, use cygpath to convert - filenames. This assumes that cygwin's which command returns full - filenames for non-cygwin executables. - - *tlib#sys#ConvertPath()* -tlib#sys#ConvertPath(converter, filename) - - *tlib#sys#FileArgs()* -tlib#sys#FileArgs(cmd, files) - - *tlib#sys#IsSpecial()* -tlib#sys#IsSpecial(filename) - Check whether filename matches |g:tlib#sys#system_rx|, i.e. whether it - is a special file that should not be opened in vim. - - *tlib#sys#Open()* -tlib#sys#Open(filename) - Open filename with the default OS application (see - |g:tlib#sys#system_browser|), if |tlib#sys#IsSpecial()| return 1. - Returns 1 if successful or 0 otherwise. - - *tlib#sys#SystemInDir()* -tlib#sys#SystemInDir(dir, expr, ?input='') +------------------------------------------------------------------------ + *autoload/tlib/map.vim* + *tlib#map#PumAccept()* +tlib#map#PumAccept(key) + If |pumvisible()| is true, return "\". Otherwise return a:key. + For use in maps like: > + imap tlib#map#PumAccept("\") +< -======================================================================== -autoload/tlib/paragraph.vim~ +------------------------------------------------------------------------ + *autoload/tlib/normal.vim* + *tlib#normal#WithRegister()* +tlib#normal#WithRegister(cmd, ?register='t', ?norm_cmd='norm!') + Execute a normal command while maintaining all registers. + +------------------------------------------------------------------------ + *autoload/tlib/notify.vim* + *tlib#notify#Echo()* +tlib#notify#Echo(text, ?style='') + Print text in the echo area. Temporarily disable 'ruler' and 'showcmd' + in order to prevent |press-enter| messages. + + *tlib#notify#TrimMessage()* +tlib#notify#TrimMessage(message) + Contributed by Erik Falor: + If the line containing the message is too long, echoing it will cause + a 'Hit ENTER' prompt to appear. This function cleans up the line so + that does not happen. + The echoed line is too long if it is wider than the width of the + window, minus cmdline space taken up by the ruler and showcmd + features. + + +------------------------------------------------------------------------ + *autoload/tlib/paragraph.vim* *tlib#paragraph#GetMetric()* tlib#paragraph#GetMetric() Return an object describing a |paragraph|. @@ -1872,50 +1154,193 @@ tlib#paragraph#Move(direction, count) < -======================================================================== -autoload/tlib/World.vim~ -A prototype used by |tlib#input#List|. -Inherits from |tlib#Object#New|. +------------------------------------------------------------------------ + *autoload/tlib/persistent.vim* + *g:tlib_persistent* +g:tlib_persistent (default: '') + The directory for persistent data files. If empty, use + |tlib#dir#MyRuntime|.'/share'. - *g:tlib_inputlist_pct* -g:tlib_inputlist_pct (default: 50) - Size of the input list window (in percent) from the main size (of &lines). + *tlib#persistent#Dir()* +tlib#persistent#Dir(?mode = 'bg') + Return the full directory name for persistent data files. + + *tlib#persistent#EncodedFilename()* +tlib#persistent#EncodedFilename(type, file, ?mkdir=0, ?dir='') + Encode `file` and call |tlib#persistent#Filename()|. + + +------------------------------------------------------------------------ + *autoload/tlib/progressbar.vim* + *tlib#progressbar#Init()* +tlib#progressbar#Init(max, ...) + EXAMPLE: > + call tlib#progressbar#Init(20) + try + for i in range(20) + call tlib#progressbar#Display(i) + call DoSomethingThatTakesSomeTime(i) + endfor + finally + call tlib#progressbar#Restore() + endtry +< + + +------------------------------------------------------------------------ + *autoload/tlib/rx.vim* + *tlib#rx#Escape()* +tlib#rx#Escape(text, ?magic='m') + magic can be one of: m, M, v, V + See :help 'magic' + + *tlib#rx#EscapeReplace()* +tlib#rx#EscapeReplace(text, ?magic='m') + Escape return |sub-replace-special|. + + +------------------------------------------------------------------------ + *autoload/tlib/scratch.vim* + *g:tlib_scratch_pos* +g:tlib_scratch_pos (default: 'botright') + Scratch window position. By default the list window is opened on the + bottom. Set this variable to 'topleft' or '' to change this behaviour. See |tlib#input#List()|. - *g:tlib_inputlist_width_filename* -g:tlib_inputlist_width_filename (default: '&co / 3') - Size of filename columns when listing filenames. - See |tlib#input#List()|. + *g:tlib#scratch#hidden* +g:tlib#scratch#hidden (default: 'hide') + If you want the scratch buffer to be fully removed, you might want to + set this variable to 'wipe'. + See also https://github.com/tomtom/tlib_vim/pull/16 - *g:tlib_inputlist_filename_indicators* -g:tlib_inputlist_filename_indicators (default: 0) - If true, |tlib#input#List()| will show some indicators about the - status of a filename (e.g. buflisted(), bufloaded() etc.). - This is disabled by default because vim checks also for the file on - disk when doing this. + *tlib#scratch#UseScratch()* +tlib#scratch#UseScratch(?keyargs={}) + Display a scratch buffer (a buffer with no file). See :TScratch for an + example. + Return the scratch buffer's number. + Values for keyargs: + scratch_split ... 1: split, 0: window, -1: tab - *g:tlib_inputlist_shortmessage* -g:tlib_inputlist_shortmessage (default: 0) - If not null, display only a short info about the filter. - - *tlib#World#New()* -tlib#World#New(...) - -prototype.PrintLines - -prototype.Suspend + *tlib#scratch#CloseScratch()* +tlib#scratch#CloseScratch(keyargs, ...) + Close a scratch buffer as defined in keyargs (usually a World). + Return 1 if the scratch buffer is closed (or if it already was + closed). -======================================================================== -autoload/tlib/loclist.vim~ - - *tlib#loclist#Browse()* -tlib#loclist#Browse(...) +------------------------------------------------------------------------ + *autoload/tlib/selection.vim* + *tlib#selection#GetSelection()* +tlib#selection#GetSelection(mode, ?mbeg="'<", ?mend="'>", ?opmode='selection') + mode can be one of: selection, lines, block -======================================================================== -autoload/tlib/tab.vim~ +------------------------------------------------------------------------ + *autoload/tlib/signs.vim* + *tlib#signs#ClearAll()* +tlib#signs#ClearAll(sign) + Clear all signs with name SIGN. + *tlib#signs#ClearBuffer()* +tlib#signs#ClearBuffer(sign, bufnr) + Clear all signs with name SIGN in buffer BUFNR. + + *tlib#signs#Mark()* +tlib#signs#Mark(sign, list) + Add signs for all locations in LIST. LIST must adhere with the + quickfix list format (see |getqflist()|; only the fields lnum and + bufnr are required). + + list:: a quickfix or location list + sign:: a sign defined with |:sign-define| + + +------------------------------------------------------------------------ + *autoload/tlib/string.vim* + *tlib#string#RemoveBackslashes()* +tlib#string#RemoveBackslashes(text, ?chars=' ') + Remove backslashes from text (but only in front of the characters in + chars). + + *tlib#string#Format()* +tlib#string#Chomp(string, ?max=0) + Format a template string. Placeholders have the format "%{NAME}". A + "%" can be inserted as "%%". + + Examples: + echo tlib#string#Format("foo %{bar} foo", {'bar': 123}, ?prefix='%') + => foo 123 foo + + *tlib#string#Printf1()* +tlib#string#Printf1(format, string) + This function deviates from |printf()| in certain ways. + Additional items: + %{rx} ... insert escaped regexp + %{fuzzyrx} ... insert typo-tolerant regexp + + +------------------------------------------------------------------------ + *autoload/tlib/sys.vim* + *g:tlib#sys#special_protocols* +g:tlib#sys#special_protocols (default: ['https\?', 'nntp', 'mailto']) + A list of |regexp|s matching protocol names that should be handled + by |g:tlib#sys#system_browser|. + CAVEAT: Must be a |\V| |regexp|. + + *g:tlib#sys#special_suffixes* +g:tlib#sys#special_suffixes (default: ['xlsx\?', 'docx\?', 'pptx\?', 'accdb', 'mdb', 'sqlite', 'pdf', 'jpg', 'png', 'gif', 'od\[tspg]']) + A list of |regexp|s matching suffixes that should be handled by + |g:tlib#sys#system_browser|. + CAVEAT: Must be a |\V| |regexp|. + + *g:tlib#sys#system_rx* +g:tlib#sys#system_rx (default: printf('\V\%(\^\%(%s\):\|.\%(%s\)\$\)', join(g:tlib#sys#special_protocols, '\|'), join(g:tlib#sys#special_suffixes, '\|'))) + Open links matching this |regexp| with |g:tlib#sys#system_browser|. + CAVEAT: Must be a |\V| |regexp|. + + *g:tlib#sys#system_browser* +g:tlib#sys#system_browser (default: ...) + Open files in the system browser. + + *g:tlib#sys#check_cygpath* +g:tlib#sys#check_cygpath (default: g:tlib#sys#windows && tlib#sys#IsExecutable('cygpath', 1)) + If true, check whether we have to convert a path via cyppath -- + see |tlib#sys#MaybeUseCygpath| + + *g:tlib#sys#cygwin_path_rx* +g:tlib#sys#cygwin_path_rx (default: '/cygwin/') + If a full windows filename (with slashes instead of backslashes) + matches this |regexp|, it is assumed to be a cygwin executable. + + *g:tlib#sys#cygwin_expr* +g:tlib#sys#cygwin_expr (default: '"bash -c ''". escape(%s, "''\\") ."''"') + For cygwin binaries, convert command calls using this vim + expression. + + *tlib#sys#MaybeUseCygpath()* +tlib#sys#MaybeUseCygpath(cmd) + If cmd seems to be a cygwin executable, use cygpath to convert + filenames. This assumes that cygwin's which command returns full + filenames for non-cygwin executables. + + *tlib#sys#IsSpecial()* +tlib#sys#IsSpecial(filename) + Check whether filename matches |g:tlib#sys#system_rx|, i.e. whether it + is a special file that should not be opened in vim. + + *tlib#sys#Open()* +tlib#sys#Open(filename) + Open filename with the default OS application (see + |g:tlib#sys#system_browser|), if |tlib#sys#IsSpecial()| return 1. + Returns 1 if successful or 0 otherwise. + + *tlib#sys#OpenWithSystemViewer()* +tlib#sys#OpenWithSystemViewer(filename) + Open filename with the default system viewer. + + +------------------------------------------------------------------------ + *autoload/tlib/tab.vim* *tlib#tab#BufMap()* tlib#tab#BufMap() Return a dictionary of bufnumbers => [[tabpage, winnr] ...] @@ -1924,99 +1349,54 @@ tlib#tab#BufMap() tlib#tab#TabWinNr(buffer) Find a buffer's window at some tab page. - *tlib#tab#Set()* -tlib#tab#Set(tabnr) + +------------------------------------------------------------------------ + *autoload/tlib/tag.vim* + *g:tlib_tags_extra* +g:tlib_tags_extra (default: '') + Extra tags for |tlib#tag#Retrieve()| (see there). Can also be buffer-local. + + *g:tlib_tag_substitute* +g:tlib_tag_substitute + Filter the tag description through |substitute()| for these filetypes. + This applies only if the tag cmd field (see |taglist()|) is used. + + *tlib#tag#Retrieve()* +tlib#tag#Retrieve(rx, ?extra_tags=0) + Get all tags matching rx. Basically, this function simply calls + |taglist()|, but when extra_tags is true, the list of the tag files + (see 'tags') is temporarily expanded with |g:tlib_tags_extra|. + + Example use: + If you want to include tags for, eg, JDK, normal tags use can become + slow. You could proceed as follows: + 1. Create a tags file for the JDK sources. When creating the tags + file, make sure to include inheritance information and the like + (command-line options like --fields=+iaSm --extra=+q should be ok). + In this example, we want tags only for public methods (there are + most likely better ways to do this): > + ctags -R --fields=+iaSm --extra=+q ${JAVA_HOME}/src + head -n 6 tags > tags0 + grep access:public tags >> tags0 +< 2. Make 'tags' include project specific tags files. In + ~/vimfiles/after/ftplugin/java.vim insert: > + let b:tlib_tags_extra = $JAVA_HOME .'/tags0' +< 3. When this function is invoked as > + echo tlib#tag#Retrieve('print') +< it will return only project-local tags. If it is invoked as > + echo tlib#tag#Retrieve('print', 1) +< tags from the JDK will be included. + + *tlib#tag#Collect()* +tlib#tag#Collect(constraints, ?use_extra=1, ?match_front=1) + Retrieve tags that meet the constraints (a dictionnary of fields and + regexp, with the exception of the kind field which is a list of chars). + For the use of the optional use_extra argument see + |tlib#tag#Retrieve()|. -======================================================================== -autoload/tlib/date.vim~ - - *tlib#date#IsDate()* -tlib#date#IsDate(text) - - *tlib#date#Format()* -tlib#date#Format(secs1970) - - *tlib#date#DiffInDays()* -tlib#date#DiffInDays(date1, ?date2=localtime(), ?allow_zero=0) - - *tlib#date#Parse()* -tlib#date#Parse(date, ?allow_zero=0) "{{{3 - - *tlib#date#SecondsSince1970()* -tlib#date#SecondsSince1970(date, ...) - tlib#date#SecondsSince1970(date, ?daysshift=0, ?allow_zero=0) - - *tlib#date#Shift()* -tlib#date#Shift(date, shift) - - -======================================================================== -autoload/tlib/type.vim~ - - *tlib#type#IsNumber()* -tlib#type#IsNumber(expr) - - *tlib#type#IsString()* -tlib#type#IsString(expr) - - *tlib#type#IsFuncref()* -tlib#type#IsFuncref(expr) - - *tlib#type#IsList()* -tlib#type#IsList(expr) - - *tlib#type#IsDictionary()* -tlib#type#IsDictionary(expr) - - *tlib#type#Is()* -tlib#type#Is(val, type) - - *tlib#type#Are()* -tlib#type#Are(vals, type) - - *tlib#type#Has()* -tlib#type#Has(val, lst) - - *tlib#type#Have()* -tlib#type#Have(vals, lst) - - -======================================================================== -autoload/tlib/Filter_fuzzy.vim~ - - *tlib#Filter_fuzzy#New()* -tlib#Filter_fuzzy#New(...) - Support for "fuzzy" pattern matching in |tlib#input#List()|. - Patterns are interpreted as if characters were connected with '.\{-}'. - - In "fuzzy" mode, the pretty printing of filenames is disabled. - - -======================================================================== -autoload/tlib/assert.vim~ - - *tlib#assert#Enable()* -tlib#assert#Enable() - Enable tracing via |:Tlibassert|. - - *tlib#assert#Disable()* -tlib#assert#Disable() - Disable tracing via |:Tlibassert|. - - *tlib#assert#Assert()* -tlib#assert#Assert(caller, check, vals) - - *tlib#assert#Map()* -tlib#assert#Map(vals, expr) - - *tlib#assert#All()* -tlib#assert#All(vals) - - -======================================================================== -autoload/tlib/textobjects.vim~ - +------------------------------------------------------------------------ + *autoload/tlib/textobjects.vim* *standard-paragraph* tlib#textobjects#StandardParagraph() Select a "Standard Paragraph", i.e. a text block followed by blank @@ -2029,468 +1409,201 @@ tlib#textobjects#StandardParagraph() < Return 1, if the paragraph is the last one in the document. - *tlib#textobjects#Init()* -tlib#textobjects#Init() - *v_sp* v_sp ... :call tlib#textobjects#StandardParagraph() sp ... Standard paragraph (for use as |text-objects|). - *o_sp* -o_sp ... :normal Vsp + +------------------------------------------------------------------------ + *autoload/tlib/trace.vim* + *g:tlib#trace#backtrace* +g:tlib#trace#backtrace (default: 2) + The length of the backtrace that should be included in + |tlib#trace#Print()|. + + *g:tlib#trace#printer* +g:tlib#trace#printer (default: 'echom') + Possible values: + - 'echom' + - ['file', FILENAME] + + *tlib#trace#Printer_echom()* +tlib#trace#Printer_echom(type, text, args) + Print traces from |tlib#trace#Print()|. + + *tlib#trace#Set()* +tlib#trace#Set(vars, ...) + Set the tracing |regexp|. See |:Tlibtrace|. + This will also call |tlib#trace#Enable()|. + + Examples: + call tlib#trace#Set(["+foo", "-bar"]) + call tlib#trace#Set("+foo,-bar") + + *tlib#trace#Print()* +tlib#trace#Print(caller, vars, values) + Print the values of vars. The first value is a "guard" (see + |:Tlibtrace|). + + *tlib#trace#Enable()* +tlib#trace#Enable() + Enable tracing via |:Tlibtrace|. + + *tlib#trace#Disable()* +tlib#trace#Disable() + Disable tracing via |:Tlibtrace|. -======================================================================== -autoload/tlib/arg.vim~ +------------------------------------------------------------------------ + *autoload/tlib/type.vim* + *tlib#type#Enable()* +tlib#type#Enable() + Enable type assertiona via |:Tlibtype|. - *tlib#arg#Get()* -tlib#arg#Get(n, var, ?default="", ?test='') - Set a positional argument from a variable argument list. - See tlib#string#RemoveBackslashes() for an example. + *tlib#type#Disable()* +tlib#type#Disable() + Disable type assertiona via |:Tlibtype|. - *tlib#arg#Let()* -tlib#arg#Let(list, ?default='') - Set a positional arguments from a variable argument list. - See tlib#input#List() for an example. - *tlib#arg#StringAsKeyArgs()* -tlib#arg#StringAsKeyArgs(string, ?keys=[], ?evaluate=0, ?sep=':', ?booleans=0) +------------------------------------------------------------------------ + *autoload/tlib/url.vim* + *tlib#url#Decode()* +tlib#url#Decode(url) + Decode an encoded URL. - *tlib#arg#StringAsKeyArgsEqual()* -tlib#arg#StringAsKeyArgsEqual(string) + *tlib#url#DecodeChar()* +tlib#url#DecodeChar(char) + Decode a single character. - *tlib#arg#GetOpts()* -tlib#arg#GetOpts(args, ?def={}) - Convert a list of strings of command-line arguments into a dictonary. + *tlib#url#EncodeChar()* +tlib#url#EncodeChar(char) + Encode a single character. - The main use case is to pass [], i.e. the command-line - arguments of a command as list, from a command definition to this - function. + *tlib#url#Encode()* +tlib#url#Encode(url, ...) + Encode an URL. - Example: - ['-h'] - => If def contains a 'help' key, invoke |:help| on its value. - ['-ab', '--foo', '--bar=BAR', 'bla', bla'] - => {'a': 1, 'b': 1, 'foo': 1, 'bar': 'BAR', '__rest__': ['bla', 'bla']} - - ['-ab', '--', '--foo', '--bar=BAR'] - => {'a': 1, 'b': 1, '__rest__': ['--foo', '--bar=BAR']} - - *tlib#arg#Ex()* -tlib#arg#Ex(arg, ?chars='%#! ') - Escape some characters in a string. - - Use |fnamescape()| if available. +------------------------------------------------------------------------ + *autoload/tlib/var.vim* + *tlib#var#Let()* +tlib#var#Let(name, val) + Define a variable called NAME if yet undefined. + You can also use the :TLLet command. EXAMPLES: > - exec 'edit '. tlib#arg#Ex('foo%#bar.txt') + exec tlib#var#Let('g:foo', 1) + TLet g:foo = 1 < + *tlib#var#EGet()* +tlib#var#EGet(var, namespace, ?default='') + Retrieve a variable by searching several namespaces. -======================================================================== -autoload/tlib/fixes.vim~ - - *tlib#fixes#Winpos()* -tlib#fixes#Winpos() - - -======================================================================== -autoload/tlib/dir.vim~ - - *g:tlib#dir#sep* -g:tlib#dir#sep (default: exists('+shellslash') && !&shellslash ? '\' : '/') - TLet g:tlib#dir#sep = '/' - - *tlib#dir#CanonicName()* -tlib#dir#CanonicName(dirname) EXAMPLES: > - tlib#dir#CanonicName('foo/bar') - => 'foo/bar/' + let g:foo = 1 + let b:foo = 2 + let w:foo = 3 + echo eval(tlib#var#EGet('foo', 'vg')) => 1 + echo eval(tlib#var#EGet('foo', 'bg')) => 2 + echo eval(tlib#var#EGet('foo', 'wbg')) => 3 < - *tlib#dir#NativeName()* -tlib#dir#NativeName(dirname) + *tlib#var#Get()* +tlib#var#Get(var, namespace, ?default='') + Retrieve a variable by searching several namespaces. + EXAMPLES: > - tlib#dir#NativeName('foo/bar/') - On Windows: - => 'foo\bar\' - On Linux: - => 'foo/bar/' + let g:foo = 1 + let b:foo = 2 + let w:foo = 3 + echo tlib#var#Get('foo', 'bg') => 1 + echo tlib#var#Get('foo', 'bg') => 2 + echo tlib#var#Get('foo', 'wbg') => 3 < - *tlib#dir#PlainName()* -tlib#dir#PlainName(dirname) - EXAMPLES: > - tlib#dir#PlainName('foo/bar/') - => 'foo/bar' -< - - *tlib#dir#Ensure()* -tlib#dir#Ensure(dir) - Create a directory if it doesn't already exist. - - *tlib#dir#MyRuntime()* -tlib#dir#MyRuntime() - Return the first directory in &rtp. - - *tlib#dir#CD()* -tlib#dir#CD(dir, ?locally=0) - - *tlib#dir#Push()* -tlib#dir#Push(dir, ?locally=0) - - *tlib#dir#Pop()* -tlib#dir#Pop() + *tlib#var#List()* +tlib#var#List(rx, ?prefix='') + Get a list of variables matching rx. + EXAMPLE: + echo tlib#var#List('tlib_', 'g:') -======================================================================== -autoload/tlib/hash.vim~ +------------------------------------------------------------------------ + *autoload/tlib/vcs.vim* + *g:tlib#vcs#def* +g:tlib#vcs#def {...} + A dictionarie of supported VCS (currently: git, hg, svn, bzr). - *g:tlib#hash#use_crc32* -g:tlib#hash#use_crc32 (default: '') + *g:tlib#vcs#executables* +g:tlib#vcs#executables {...} + A dictionary of custom executables for VCS commands. If the value is + empty, support for that VCS will be removed. If no key is present, it + is assumed that the VCS "type" is the name of the executable. - *g:tlib#hash#use_adler32* -g:tlib#hash#use_adler32 (default: '') + *g:tlib#vcs#check* +g:tlib#vcs#check (default: has('win16') || has('win32') || has('win64') ? '%s.exe' : '%s') + If non-empty, use it as a format string to check whether a VCS is + installed on your computer. - *tlib#hash#CRC32B()* -tlib#hash#CRC32B(chars) + *tlib#vcs#Ls()* +tlib#vcs#Ls(?filename=bufname('%'), ?vcs=[type, dir]) + Return the files under VCS. - *tlib#hash#CRC32B_ruby()* -tlib#hash#CRC32B_ruby(chars) - - *tlib#hash#CRC32B_vim()* -tlib#hash#CRC32B_vim(chars) - - *tlib#hash#Adler32()* -tlib#hash#Adler32(chars) - - *tlib#hash#Adler32_vim()* -tlib#hash#Adler32_vim(chars) - - *tlib#hash#Adler32_tlib()* -tlib#hash#Adler32_tlib(chars) + *tlib#vcs#Diff()* +tlib#vcs#Diff(filename, ?vcs=[type, dir]) + Return the diff for "filename" -======================================================================== -autoload/tlib/win.vim~ +------------------------------------------------------------------------ + *autoload/tlib/vim.vim* + *g:tlib#vim#simalt_maximize* +g:tlib#vim#simalt_maximize (default: 'x') + The alt-key for maximizing the window. + CAUTION: The value of this paramter depends on your locale and + maybe the windows version you are running. + *g:tlib#vim#simalt_restore* +g:tlib#vim#simalt_restore (default: 'r') + The alt-key for restoring the window. + CAUTION: The value of this paramter depends on your locale and + maybe the windows version you are running. + + *g:tlib#vim#use_vimtweak* +g:tlib#vim#use_vimtweak (default: 0) + If true, use the vimtweak.dll for windows. This will enable + tlib to remove the caption for fullscreen windows. + + *tlib#vim#Maximize()* +tlib#vim#Maximize(fullscreen) + Maximize the window. + You might need to redefine |g:tlib#vim#simalt_maximize| if it doesn't + work for you. + + *tlib#vim#RestoreWindow()* +tlib#vim#RestoreWindow() + Restore the original vimsize after having called |tlib#vim#Maximize()|. + + *g:tlib#vim#use_wmctrl* +g:tlib#vim#use_wmctrl (default: executable('wmctrl')) + If true, use wmctrl for X windows to make a window + maximized/fullscreen. + + This is the preferred method for maximizing windows under X + windows. Some window managers have problem coping with the + default method of setting 'lines' and 'columns' to a large + value. + + +------------------------------------------------------------------------ + *autoload/tlib/win.vim* *tlib#win#Set()* tlib#win#Set(winnr) Return vim code to jump back to the original window. - *tlib#win#GetLayout()* -tlib#win#GetLayout(?save_view=0) - - *tlib#win#SetLayout()* -tlib#win#SetLayout(layout) - - *tlib#win#List()* -tlib#win#List() - - *tlib#win#Width()* -tlib#win#Width(wnr) - - *tlib#win#WinDo()* -tlib#win#WinDo(ex) - - -======================================================================== -autoload/tlib/comments.vim~ - - *tlib#comments#Comments()* -tlib#comments#Comments(...) - function! tlib#comments#Comments(?rx='') - - -======================================================================== -autoload/tlib/grep.vim~ - - *tlib#grep#Do()* -tlib#grep#Do(cmd, rx, files) - - *tlib#grep#LocList()* -tlib#grep#LocList(rx, files) - - *tlib#grep#QuickFixList()* -tlib#grep#QuickFixList(rx, files) - - *tlib#grep#List()* -tlib#grep#List(rx, files) - - -======================================================================== -autoload/tlib/qfl.vim~ - - *tlib#qfl#FormatQFLE()* -tlib#qfl#FormatQFLE(qfe) - - *tlib#qfl#QfeFilename()* -tlib#qfl#QfeFilename(qfe) - - *tlib#qfl#InitListBuffer()* -tlib#qfl#InitListBuffer(world) - - *tlib#qfl#SetSyntax()* -tlib#qfl#SetSyntax() - - *tlib#qfl#Balloon()* -tlib#qfl#Balloon() - - *tlib#qfl#AgentEditQFE()* -tlib#qfl#AgentEditQFE(world, selected, ...) - - *tlib#qfl#AgentPreviewQFE()* -tlib#qfl#AgentPreviewQFE(world, selected) - - *tlib#qfl#AgentGotoQFE()* -tlib#qfl#AgentGotoQFE(world, selected) - - *tlib#qfl#AgentWithSelected()* -tlib#qfl#AgentWithSelected(world, selected, ...) - - *tlib#qfl#RunCmdOnSelected()* -tlib#qfl#RunCmdOnSelected(world, selected, cmd, ...) - - *tlib#qfl#AgentSplitBuffer()* -tlib#qfl#AgentSplitBuffer(world, selected) - - *tlib#qfl#AgentTabBuffer()* -tlib#qfl#AgentTabBuffer(world, selected) - - *tlib#qfl#AgentVSplitBuffer()* -tlib#qfl#AgentVSplitBuffer(world, selected) - - *tlib#qfl#AgentEditLine()* -tlib#qfl#AgentEditLine(world, selected) - - *tlib#qfl#EditLine()* -tlib#qfl#EditLine(lnum) - - *tlib#qfl#SetFollowCursor()* -tlib#qfl#SetFollowCursor(world, selected) - - *tlib#qfl#QflList()* -tlib#qfl#QflList(list, ...) - - *tlib#qfl#Browse()* -tlib#qfl#Browse(...) - - -======================================================================== -autoload/tlib/Filter_cnf.vim~ - - *tlib#Filter_cnf#New()* -tlib#Filter_cnf#New(...) - The search pattern for |tlib#input#List()| is in conjunctive normal - form: (P1 OR P2 ...) AND (P3 OR P4 ...) ... - The pattern is a '/\V' very no-'/magic' regexp pattern. - - Pressing joins two patterns with AND. - Pressing | joins two patterns with OR. - I.e. In order to get "lala AND (foo OR bar)", you type - "lala foo|bar". - - This is also the base class for other filters. - -prototype.Pretty - - -======================================================================== -autoload/tlib/Object.vim~ -Provides a prototype plus some OO-like methods. - - *tlib#Object#New()* -tlib#Object#New(?fields={}) - This function creates a prototype that provides some kind of - inheritance mechanism and a way to call parent/super methods. - - The usage demonstrated in the following example works best when every - class/prototype is defined in a file of its own. - - The reason for why there is a dedicated constructor function is that - this layout facilitates the use of templates and that methods are - hidden from the user. Other solutions are possible. - - EXAMPLES: > - let s:prototype = tlib#Object#New({ - \ '_class': ['FooBar'], - \ 'foo': 1, - \ 'bar': 2, - \ }) - " Constructor - function! FooBar(...) - let object = s:prototype.New(a:0 >= 1 ? a:1 : {}) - return object - endf - function! s:prototype.babble() { - echo "I think, therefore I am ". (self.foo * self.bar) ." months old." - } - -< This could now be used like this: > - let myfoo = FooBar({'foo': 3}) - call myfoo.babble() - => I think, therefore I am 6 months old. - echo myfoo.IsA('FooBar') - => 1 - echo myfoo.IsA('object') - => 1 - echo myfoo.IsA('Foo') - => 0 - echo myfoo.RespondTo('babble') - => 1 - echo myfoo.RespondTo('speak') - => 0 -< - -prototype.New - -prototype.Inherit - -prototype.Extend - -prototype.IsA - -prototype.IsRelated - -prototype.RespondTo - -prototype.Super - - *tlib#Object#Methods()* -tlib#Object#Methods(object, ...) - - -======================================================================== -autoload/tlib/buffer.vim~ - - *g:tlib_viewline_position* -g:tlib_viewline_position (default: 'zz') - Where to display the line when using |tlib#buffer#ViewLine|. - For possible values for position see |scroll-cursor|. - - *tlib#buffer#EnableMRU()* -tlib#buffer#EnableMRU() - - *tlib#buffer#DisableMRU()* -tlib#buffer#DisableMRU() - - *tlib#buffer#Set()* -tlib#buffer#Set(buffer) - Set the buffer to buffer and return a command as string that can be - evaluated by |:execute| in order to restore the original view. - - *tlib#buffer#Eval()* -tlib#buffer#Eval(buffer, code) - Evaluate CODE in BUFFER. - - EXAMPLES: > - call tlib#buffer#Eval('foo.txt', 'echo b:bar') -< - - *tlib#buffer#GetList()* -tlib#buffer#GetList(?show_hidden=0, ?show_number=0, " ?order='bufnr') - Possible values for the "order" argument: - bufnr :: Default behaviour - mru :: Sort buffers according to most recent use - basename :: Sort by the file's basename (last component) - - NOTE: MRU order works on second invocation only. If you want to always - use MRU order, call tlib#buffer#EnableMRU() in your ~/.vimrc file. - - *tlib#buffer#ViewLine()* -tlib#buffer#ViewLine(line, ?position='z') - line is either a number or a string that begins with a number. - For possible values for position see |scroll-cursor|. - See also |g:tlib_viewline_position|. - - *tlib#buffer#HighlightLine()* -tlib#buffer#HighlightLine(...) - - *tlib#buffer#DeleteRange()* -tlib#buffer#DeleteRange(line1, line2) - Delete the lines in the current buffer. Wrapper for |:delete|. - - *tlib#buffer#ReplaceRange()* -tlib#buffer#ReplaceRange(line1, line2, lines) - Replace a range of lines. - - *tlib#buffer#ScratchStart()* -tlib#buffer#ScratchStart() - Initialize some scratch area at the bottom of the current buffer. - - *tlib#buffer#ScratchEnd()* -tlib#buffer#ScratchEnd() - Remove the in-buffer scratch area. - - *tlib#buffer#BufDo()* -tlib#buffer#BufDo(exec) - Run exec on all buffers via bufdo and return to the original buffer. - - *tlib#buffer#InsertText()* -tlib#buffer#InsertText(text, keyargs) - Keyargs: - 'shift': 0|N - 'col': col('.')|N - 'lineno': line('.')|N - 'indent': 0|1 - 'pos': 'e'|'s' ... Where to locate the cursor (somewhat like s and e in {offset}) - Insert text (a string) in the buffer. - - *tlib#buffer#InsertText0()* -tlib#buffer#InsertText0(text, ...) - - *tlib#buffer#CurrentByte()* -tlib#buffer#CurrentByte() - - *tlib#buffer#KeepCursorPosition()* -tlib#buffer#KeepCursorPosition(cmd) - Evaluate cmd while maintaining the cursor position and jump registers. - - -======================================================================== -autoload/tlib/hook.vim~ - - *tlib#hook#Run()* -tlib#hook#Run(hook, ?dict={}) - Execute dict[hook], w:{hook}, b:{hook}, or g:{hook} if existent. - - -======================================================================== -autoload/tlib/string.vim~ - - *tlib#string#RemoveBackslashes()* -tlib#string#RemoveBackslashes(text, ?chars=' ') - Remove backslashes from text (but only in front of the characters in - chars). - - *tlib#string#Chomp()* -tlib#string#Chomp(string, ?max=0) - - *tlib#string#Format()* -tlib#string#Format(template, dict) - - *tlib#string#Printf1()* -tlib#string#Printf1(format, string) - This function deviates from |printf()| in certain ways. - Additional items: - %{rx} ... insert escaped regexp - %{fuzzyrx} ... insert typo-tolerant regexp - - *tlib#string#TrimLeft()* -tlib#string#TrimLeft(string) - - *tlib#string#TrimRight()* -tlib#string#TrimRight(string) - - *tlib#string#Strip()* -tlib#string#Strip(string) - - *tlib#string#Count()* -tlib#string#Count(string, rx) - - *tlib#string#SplitCommaList()* -tlib#string#SplitCommaList(text, ...) + *tlib#win#SetById()* +tlib#win#SetById(win_id) + Return vim code to jump back to the original window. diff --git a/sources_non_forked/tlib/etc/tpl_tlib.txt b/sources_non_forked/tlib/etc/tpl_tlib.txt new file mode 100644 index 00000000..f8059703 --- /dev/null +++ b/sources_non_forked/tlib/etc/tpl_tlib.txt @@ -0,0 +1,30 @@ +*tlib.txt* tlib -- A library of vim functions + Author: Tom Link, micathom at gmail com + +This library provides some utility functions. There isn't much need to +install it unless another plugin requires you to do so. + +Most of the library is included in autoload files. No autocommands are +created. With the exception of loading ../plugin/02tlib.vim at startup +the library has no impact on startup time or anything else. + +The change-log is included at the bottom of ../plugin/02tlib.vim +(move the cursor over the file name and type gfG) + +Demo of |tlib#input#List()|: +http://vimsomnia.blogspot.com/2010/11/selecting-items-from-list-with-tlibs.html + + +----------------------------------------------------------------------- +Install~ + +Edit the vba file and type: > + + :so % + +See :help vimball for details. If you have difficulties, please make +sure, you have the current version of vimball (vimscript #1502) +installed. + + +%s diff --git a/sources_non_forked/tlib/macros/tlib.vim b/sources_non_forked/tlib/macros/tlib.vim new file mode 100644 index 00000000..3e5a7912 --- /dev/null +++ b/sources_non_forked/tlib/macros/tlib.vim @@ -0,0 +1,38 @@ +" @Author: Tom Link (micathom AT gmail com?subject=[vim]) +" @GIT: http://github.com/tomtom/tlib_vim/ +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Last Change: 2015-11-09. +" @Revision: 10 + +if &cp || exists("loaded_tlib_macros") + finish +endif +let loaded_tlib_macros = 1 + +let s:save_cpo = &cpo +set cpo&vim + + +" :display: :TRequire NAME [VERSION [FILE]] +" Make a certain vim file is loaded. +" +" Conventions: If FILE isn't defined, plugin/NAME.vim is loaded. The +" file must provide a variable loaded_{NAME} that represents the version +" number. +command! -nargs=+ TRequire let s:require = [] + \ | if !exists('loaded_'. get(s:require, 0)) + \ | exec 'runtime '. get(s:require, 2, 'plugin/'. get(s:require, 0) .'.vim') + \ | if !exists('loaded_'. get(s:require, 0)) || loaded_{get(s:require, 0)} < get(s:require, 1, loaded_{get(s:require, 0)}) + \ | echoerr 'Require '. get(s:require, 0) .' >= '. get(s:require, 1, 'any version will do') + \ | finish + \ | endif + \ | endif | unlet s:require + + +" :display: :Ttimecommand CMD +" Time the execution time of CMD. +command! -nargs=1 -complete=command Ttimecommand call tlib#cmd#Time() + + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/sources_non_forked/tlib/plugin/02tlib.vim b/sources_non_forked/tlib/plugin/02tlib.vim index cc2c3ca0..94a600f0 100644 --- a/sources_non_forked/tlib/plugin/02tlib.vim +++ b/sources_non_forked/tlib/plugin/02tlib.vim @@ -1,8 +1,8 @@ " @Author: Tom Link (micathom AT gmail com?subject=[vim]) " @Created: 2007-04-10. -" @Last Change: 2015-11-23. +" @Last Change: 2019-04-09. " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) -" @Revision: 808 +" @Revision: 836 " @Website: http://www.vim.org/account/profile.php?user_id=4037 " GetLatestVimScripts: 1863 1 tlib.vim " tlib.vim -- Some utility functions @@ -14,7 +14,7 @@ if v:version < 700 "{{{2 echoerr "tlib requires Vim >= 7" finish endif -let g:loaded_tlib = 117 +let g:loaded_tlib = 127 let s:save_cpo = &cpo set cpo&vim @@ -74,7 +74,17 @@ command! -nargs=1 -complete=command TBrowseOutput call tlib#cmd#BrowseOutput( " TBrowseScriptnames -command! -nargs=0 -complete=command TBrowseScriptnames call tlib#cmd#TBrowseScriptnames() +command! -nargs=0 TBrowseScriptnames call tlib#cmd#TBrowseScriptnames() + + +" :display: :Texecqfl CMD +" Run CMD and display the quickfix list. +command! -nargs=1 Texecqfl | call tlib#qfl#QflList(getqflist()) + + +" :display: :Texecloc CMD +" Run CMD and display the quickfix list. +command! -nargs=1 Texecloc | call tlib#qfl#QflList(getloclist(0)) " :display: :Tlibtrace GUARD, VAR1, VAR2... @@ -85,17 +95,31 @@ command! -nargs=0 -complete=command TBrowseScriptnames call tlib#cmd#TBrowseScri " If GUARD is a number that evaluates to true or if it is a string that " matches a |regexp|, which was added using Tlibtrace! (with '!'), " display the values of VAR1, VAR2 ... -command! -nargs=+ -bang -bar Tlibtrace : +command! -nargs=+ -bang Tlibtrace : -" :Tlibtraceset +RX1, -RX2... +" :Tlibtraceset[!] [--file=FILE] +RX1 -RX2... " If |tlib#trace#Enable()| was called: With the optional , users " can add and remove GUARDs (actually a |regexp|) that should be traced. -command! -nargs=+ -bang -bar Tlibtraceset call tlib#trace#Set() +" +" If no `+` or `-` is prepended, assume `+`. +" +" With the optional bang '!', reset any options. +command! -nargs=+ -bang Tlibtraceset call tlib#trace#Set(tlib#arg#GetOpts([], {'short': 0}), !empty("")) " :display: :Tlibtrace ASSERTION -command! -nargs=+ -bang -bar Tlibassert : +command! -nargs=+ -bang Tlibassert : + +" :display: :Tlibtype val, 'type', ... +command! -nargs=+ Tlibtype : + + +" Browse the current |quickfix| list. +command! -bar Tbrowseqfl call tlib#qfl#Browse() + +" Browse the current |location-list|. +command! -bar Tbrowseloc call tlib#loclist#Browse() let &cpo = s:save_cpo diff --git a/sources_non_forked/tlib/samples/tlib/input/tlib_input_list.vim b/sources_non_forked/tlib/samples/tlib/input/tlib_input_list.vim new file mode 100644 index 00000000..4d668ffa --- /dev/null +++ b/sources_non_forked/tlib/samples/tlib/input/tlib_input_list.vim @@ -0,0 +1,50 @@ +" The following variable configures the way |tlib#input#ListD()| works. +" In this example, we allow selection of multiple items (we could also +" allow only a single choice and make |tlib#input#ListD()| work on the +" indices, not the items). +" +" We also set a prompt that will be displayed in the command area. +" +" By default, |tlib#input#ListD()| will automatically select an item if +" there is only one item left matching the filter. In this example, we +" disable this feature. +" +" For demonstration purposes, we also define a key handler that prints +" the selected items. +let s:state = { + \ 'type': 'm', + \ 'query': 'Select lines for command output', + \ 'pick_last_item': 0, + \ 'key_handlers': [ + \ {'key': 16, 'agent': 'PrintMe', 'key_name': '', 'help': 'Print line'}, + \ ], + \ } + +" A key handler takes two arguments: the current state of the list +" display and a list of selected items/indices (depending on the type +" parameter). +function! PrintMe(state, items) "{{{3 + echom "You selected:" + for i in a:items + echom i + endfor + call input("Press ENTER to continue") + let a:state.state = 'redisplay' + return a:state +endf + +" In this example, we evaluate an ex-command with |:execute| and display +" the command's output as list. The user can select certain lines by +" typing some pattern or by pressing to select an item by +" number. The user can then press to print the lines (see above) +" or to pick the selected lines. +function! SelectOutput(ex) "{{{3 + redir => lines + silent exec a:ex + redir END + let state = copy(s:state) + let state.base = split(lines, '\n') + let picked = tlib#input#ListD(state) + echom "You picked: ". join(picked, ', ') +endf + diff --git a/sources_non_forked/tlib/scripts/create_crc_table.rb b/sources_non_forked/tlib/scripts/create_crc_table.rb new file mode 100644 index 00000000..149fe11f --- /dev/null +++ b/sources_non_forked/tlib/scripts/create_crc_table.rb @@ -0,0 +1,67 @@ +# @Author: Tom Link (micathom AT gmail com) +# @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +# @Revision: 14 + + +def crc_vim_table + tbl = [0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d] + tbl.map! do |num| + b = "%b" % num + bits = b.split(//) + bits.map! {|b| b.to_i} + bits.reverse + end + VIM::command("let @t = '#{tbl.inspect}'") +end + diff --git a/sources_non_forked/tlib/spec/tlib/arg.vim b/sources_non_forked/tlib/spec/tlib/arg.vim new file mode 100644 index 00000000..cf060a26 --- /dev/null +++ b/sources_non_forked/tlib/spec/tlib/arg.vim @@ -0,0 +1,66 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @Website: http://www.vim.org/account/profile.php?user_id=4037 +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 2010-04-03. +" @Last Change: 2010-04-03. +" @Revision: 1 + +let s:save_cpo = &cpo +set cpo&vim + + + +SpecBegin 'title': 'tlib#arg' + +function! TestGetArg(...) "{{{3 + exec tlib#arg#Get(1, 'foo', 1) + return foo +endf + +function! TestGetArg1(...) "{{{3 + exec tlib#arg#Get(1, 'foo', 1, '!= ""') + return foo +endf + +Should be equal TestGetArg(), 1 +Should be equal TestGetArg(''), '' +Should be equal TestGetArg(2), 2 +Should be equal TestGetArg1(), 1 +Should be equal TestGetArg1(''), 1 +Should be equal TestGetArg1(2), 2 + +function! TestArgs(...) "{{{3 + exec tlib#arg#Let([['foo', "o"], ['bar', 2]]) + return repeat(foo, bar) +endf +Should be equal TestArgs(), 'oo' +Should be equal TestArgs('a'), 'aa' +Should be equal TestArgs('a', 3), 'aaa' + +function! TestArgs1(...) "{{{3 + exec tlib#arg#Let(['foo', ['bar', 2]]) + return repeat(foo, bar) +endf +Should be equal TestArgs1(), '' +Should be equal TestArgs1('a'), 'aa' +Should be equal TestArgs1('a', 3), 'aaa' + +function! TestArgs2(...) "{{{3 + exec tlib#arg#Let(['foo', 'bar'], 1) + return repeat(foo, bar) +endf +Should be equal TestArgs2(), '1' +Should be equal TestArgs2('a'), 'a' +Should be equal TestArgs2('a', 3), 'aaa' + +function! TestArgs3(...) + TVarArg ['a', 1], 'b' + return a . b +endf +Should be equal TestArgs3(), '1' +Should be equal TestArgs3('a'), 'a' +Should be equal TestArgs3('a', 3), 'a3' + + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/sources_non_forked/tlib/spec/tlib/date.vim b/sources_non_forked/tlib/spec/tlib/date.vim new file mode 100644 index 00000000..42c336bd --- /dev/null +++ b/sources_non_forked/tlib/spec/tlib/date.vim @@ -0,0 +1,61 @@ +" @Author: Tom Link (micathom AT gmail com?subject=[vim]) +" @Website: http://www.vim.org/account/profile.php?user_id=4037 +" @GIT: http://github.com/tomtom/vimtlib/ +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 2010-09-17. +" @Last Change: 2016-03-16. +" @Revision: 21 + +SpecBegin 'title': 'tlib#date' + +Should be equal tlib#date#Parse('2000-1-0', 1), [2000, 1, 0] +Should be equal tlib#date#Parse('2000-1-2'), [2000, 1, 2] +Should be equal tlib#date#Parse('2000-01-02'), [2000, 1, 2] +Should be equal tlib#date#Parse('2000-10-20'), [2000, 10, 20] + +Should be equal tlib#date#Parse('00-1-0', 1), [2000, 1, 0] +Should be equal tlib#date#Parse('00-1-2'), [2000, 1, 2] +Should be equal tlib#date#Parse('00-01-02'), [2000, 1, 2] +Should be equal tlib#date#Parse('00-10-20'), [2000, 10, 20] + +Should be equal tlib#date#Parse('2000/2/1'), [2000, 1, 2] +Should be equal tlib#date#Parse('2000/02/01'), [2000, 1, 2] +Should be equal tlib#date#Parse('2000/20/10'), [2000, 10, 20] + +Should be equal tlib#date#Parse('00/2/1'), [2000, 1, 2] +Should be equal tlib#date#Parse('00/02/01'), [2000, 1, 2] +Should be equal tlib#date#Parse('00/20/10'), [2000, 10, 20] + +Should be equal tlib#date#Parse('2.1.2000'), [2000, 1, 2] +Should be equal tlib#date#Parse('2. 1. 2000'), [2000, 1, 2] +Should be equal tlib#date#Parse('02.01.2000'), [2000, 1, 2] +Should be equal tlib#date#Parse('02. 01. 2000'), [2000, 1, 2] +Should be equal tlib#date#Parse('20.10.2000'), [2000, 10, 20] +Should be equal tlib#date#Parse('20. 10. 2000'), [2000, 10, 20] + +Should throw exception "tlib#date#Parse('2000-14-2')", 'TLib: Invalid date' +Should throw exception "tlib#date#Parse('2000-011-02')", 'TLib: Invalid date' +Should throw exception "tlib#date#Parse('2000-10-40')", 'TLib: Invalid date' +Should throw exception "tlib#date#Parse('2000-10-0')", 'TLib: Invalid date' + +Should be equal tlib#date#Shift('2015-10-29', '1m'), '2015-11-29' +Should be equal tlib#date#Shift('2015-11-29', '1m'), '2015-12-29' +Should be equal tlib#date#Shift('2015-12-29', '1m'), '2016-01-29' +Should be equal tlib#date#Shift('2016-01-29', '1m'), '2016-02-29' +Should be equal tlib#date#Shift('2015-10-29', '2m'), '2015-12-29' +Should be equal tlib#date#Shift('2015-10-29', '3m'), '2016-01-29' +Should be equal tlib#date#Shift('2015-10-29', '4m'), '2016-02-29' +Should be equal tlib#date#Shift('2015-12-30', '1d'), '2015-12-31' +Should be equal tlib#date#Shift('2015-12-31', '1d'), '2016-01-01' +Should be equal tlib#date#Shift('2015-12-30', '2d'), '2016-01-01' +Should be equal tlib#date#Shift('2015-12-30', '3d'), '2016-01-02' + +Should be equal tlib#date#Shift('2016-03-16', '1b'), '2016-03-17' +Should be equal tlib#date#Shift('2016-03-16', '2b'), '2016-03-18' +Should be equal tlib#date#Shift('2016-03-16', '3b'), '2016-03-21' +Should be equal tlib#date#Shift('2016-03-16', '4b'), '2016-03-22' +Should be equal tlib#date#Shift('2016-03-16', '5b'), '2016-03-23' +Should be equal tlib#date#Shift('2016-03-16', '6b'), '2016-03-24' +Should be equal tlib#date#Shift('2016-03-16', '7b'), '2016-03-25' +Should be equal tlib#date#Shift('2016-03-16', '8b'), '2016-03-28' + diff --git a/sources_non_forked/tlib/spec/tlib/dictionary.vim b/sources_non_forked/tlib/spec/tlib/dictionary.vim new file mode 100644 index 00000000..52439e6d --- /dev/null +++ b/sources_non_forked/tlib/spec/tlib/dictionary.vim @@ -0,0 +1,28 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @Website: https://github.com/tomtom +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 2016-04-03. +" @Last Change: 2016-04-03. + +let s:save_cpo = &cpo +set cpo&vim + + + +SpecBegin 'title': 'tlib#dictionary' + + +It should handle basic test cases for tlib#dictionary#Rev properly. + +Should be equal tlib#dictionary#Rev({}), {} +Should be equal tlib#dictionary#Rev({1: 2, 3: 4}), {'2': '1', '4': '3'} +Should be equal tlib#dictionary#Rev({1: '', 3: 4}, {'empty': '*'}), {'*': '1', '4': '3'} +Should be equal tlib#dictionary#Rev({1: '', 3: 4}, {'use_string': 1}), {'''''': '1', '4': '3'} +Should be equal tlib#dictionary#Rev({1: '', 3: 4}, {'use_string': 1, 'use_eval': 1}), {'''''': 1, '4': 3} +Should be equal tlib#dictionary#Rev(tlib#dictionary#Rev({1: '', 3: 4}, {'use_string': 1}), {'use_eval': 1}), {1: '', 3: 4} +Should be equal tlib#dictionary#Rev({1: 4, 2: 4}, {'values_as_list': 1}), {'4': ['1', '2']} +Should be equal tlib#dictionary#Rev({1: 4, 2: 4}, {'values_as_list': 1, 'use_eval': 1}), {'4': [1, 2]} + + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/sources_non_forked/tlib/spec/tlib/eval.vim b/sources_non_forked/tlib/spec/tlib/eval.vim new file mode 100644 index 00000000..40c51386 --- /dev/null +++ b/sources_non_forked/tlib/spec/tlib/eval.vim @@ -0,0 +1,27 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @Website: https://github.com/tomtom +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 2015-10-26. +" @Last Change: 2015-10-26. + +let s:save_cpo = &cpo +set cpo&vim + + +SpecBegin 'title': 'tlib#eval' + + +let g:eval_a = {'foo': range(0, 5), 'd': {'a': range(0, 5)}} +let g:eval_b = {'foo': range(6, 10), 'd': {'a': range(6, 10), 'b': 2}, 'bar': range(5)} +let g:eval_a0 = deepcopy(g:eval_a) +let g:eval_b0 = deepcopy(g:eval_b) +let g:eval_c = {'foo': range(0, 10), 'd': {'a': range(0, 10), 'b': 2}, 'bar': range(5)} + + +Should be equal tlib#eval#Extend(copy(g:eval_a), g:eval_b), g:eval_c +Should be equal g:eval_a, g:eval_a0 +Should be equal g:eval_b, g:eval_b0 + + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/sources_non_forked/tlib/spec/tlib/file.vim b/sources_non_forked/tlib/spec/tlib/file.vim new file mode 100644 index 00000000..f692abfc --- /dev/null +++ b/sources_non_forked/tlib/spec/tlib/file.vim @@ -0,0 +1,59 @@ +" @Author: Thomas Link (micathom AT gmail com?subject=[vim]) +" @Website: http://www.vim.org/account/profile.php?user_id=4037 +" @GIT: http://github.com/tomtom/vimtlib/ +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 2009-02-25. +" @Last Change: 2010-04-03. +" @Revision: 13 + +let s:save_cpo = &cpo +set cpo&vim + + +SpecBegin 'title': 'tlib/file', + \ 'sfile': 'autoload/tlib/file.vim' + + + +It should split filenames. +Should be equal tlib#file#Split('foo/bar/filename.txt'), ['foo', 'bar', 'filename.txt'] +Should be equal tlib#file#Split('/foo/bar/filename.txt'), ['', 'foo', 'bar', 'filename.txt'] +Should be equal tlib#file#Split('ftp://foo/bar/filename.txt'), ['ftp:/', 'foo', 'bar', 'filename.txt'] + + +It should join filenames. +Should be#Equal tlib#file#Join(['foo', 'bar']), 'foo/bar' +Should be#Equal tlib#file#Join(['foo/', 'bar'], 1), 'foo/bar' +Should be#Equal tlib#file#Join(['', 'bar']), '/bar' +Should be#Equal tlib#file#Join(['/', 'bar'], 1), '/bar' +Should be#Equal tlib#file#Join(['foo', 'bar', 'filename.txt']), 'foo/bar/filename.txt' +Should be#Equal tlib#file#Join(['', 'foo', 'bar', 'filename.txt']), '/foo/bar/filename.txt' +Should be#Equal tlib#file#Join(['ftp:/', 'foo', 'bar', 'filename.txt']), 'ftp://foo/bar/filename.txt' +Should be#Equal tlib#file#Join(['ftp://', 'foo', 'bar', 'filename.txt'], 1), 'ftp://foo/bar/filename.txt' + +Should be equal tlib#file#Join(['foo', 'bar', 'filename.txt']), 'foo/bar/filename.txt' +Should be equal tlib#file#Join(['', 'foo', 'bar', 'filename.txt']), '/foo/bar/filename.txt' +Should be equal tlib#file#Join(['ftp:/', 'foo', 'bar', 'filename.txt']), 'ftp://foo/bar/filename.txt' + + +It should construct relative path names. +Should be#Equal tlib#file#Relative('foo/bar/filename.txt', 'foo'), 'bar/filename.txt' +Should be#Equal tlib#file#Relative('foo/bar/filename.txt', 'foo/base'), '../bar/filename.txt' +Should be#Equal tlib#file#Relative('filename.txt', 'foo/base'), '../../filename.txt' +Should be#Equal tlib#file#Relative('/foo/bar/filename.txt', '/boo/base'), '../../foo/bar/filename.txt' +Should be#Equal tlib#file#Relative('/bar/filename.txt', '/boo/base'), '../../bar/filename.txt' +Should be#Equal tlib#file#Relative('/foo/bar/filename.txt', '/base'), '../foo/bar/filename.txt' +Should be#Equal tlib#file#Relative('c:/bar/filename.txt', 'x:/boo/base'), 'c:/bar/filename.txt' + + +Should be equal tlib#file#Relative('foo/bar/filename.txt', 'foo'), 'bar/filename.txt' +Should be equal tlib#file#Relative('foo/bar/filename.txt', 'foo/base'), '../bar/filename.txt' +Should be equal tlib#file#Relative('filename.txt', 'foo/base'), '../../filename.txt' +Should be equal tlib#file#Relative('/foo/bar/filename.txt', '/boo/base'), '../../foo/bar/filename.txt' +Should be equal tlib#file#Relative('/bar/filename.txt', '/boo/base'), '../../bar/filename.txt' +Should be equal tlib#file#Relative('/foo/bar/filename.txt', '/base'), '../foo/bar/filename.txt' +Should be equal tlib#file#Relative('c:/bar/filename.txt', 'x:/boo/base'), 'c:/bar/filename.txt' + + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/sources_non_forked/tlib/spec/tlib/hash.vim b/sources_non_forked/tlib/spec/tlib/hash.vim new file mode 100644 index 00000000..a2403a3d --- /dev/null +++ b/sources_non_forked/tlib/spec/tlib/hash.vim @@ -0,0 +1,58 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @Website: http://www.vim.org/account/profile.php?user_id=4037 +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Revision: 31 + + +SpecBegin 'title': 'tlib#hash' + + +It should calculate CRC32B checksums. + +let g:tlib_hash_use_crc32 = g:tlib#hash#use_crc32 + +let g:tlib#hash#use_crc32 = 'ruby' +Should be equal tlib#hash#CRC32B('The quick brown fox jumps over the lazy dog'), '414FA339' +Should be equal tlib#hash#CRC32B('foo'), '8C736521' +Should be equal tlib#hash#CRC32B('f'), '76D32BE0' + +let g:tlib#hash#use_crc32 = 'vim' +Should be equal tlib#hash#CRC32B('The quick brown fox jumps over the lazy dog'), '414FA339' +Should be equal tlib#hash#CRC32B('foo'), '8C736521' +Should be equal tlib#hash#CRC32B('f'), '76D32BE0' + + +function! s:CompareHash(text) "{{{3 + if !empty(a:text) + exec 'It should calculate the crc32b checksum for:' a:text + let crc32ruby = tlib#hash#CRC32B_ruby(a:text) + let crc32vim = tlib#hash#CRC32B_vim(a:text) + exec 'Should be equal' string(crc32ruby) ',' string(crc32vim) + exec 'It should calculate the adler32 checksum for:' a:text + let adler32tlib = tlib#hash#Adler32_tlib(a:text) + let adler32vim = tlib#hash#Adler32_vim(a:text) + exec 'Should be equal' string(adler32tlib) ',' string(adler32vim) + endif +endf + +redir => s:scriptnames +silent scriptnames +redir END +for s:script in split(s:scriptnames, '\n') + let s:scriptfile = matchstr(s:script, '^\s*\d\+:\s\+\zs.*$') + call s:CompareHash(s:scriptfile) + try + let s:scriptlines = readfile(s:scriptfile) + call s:CompareHash(join(s:scriptlines, "\n")) + for s:scriptline in s:scriptlines + call s:CompareHash(s:scriptline) + endfor + catch /^Vim\%((\a\+)\)\=:E484/ + endtry +endfor +unlet s:scriptnames, :script, s:scriptfile, s:scriptlines, s:scriptline +delf s:CompareHash + + +let g:tlib#hash#use_crc32 = g:tlib_hash_use_crc32 + diff --git a/sources_non_forked/tlib/spec/tlib/input.vim b/sources_non_forked/tlib/spec/tlib/input.vim new file mode 100644 index 00000000..f82aea6c --- /dev/null +++ b/sources_non_forked/tlib/spec/tlib/input.vim @@ -0,0 +1,127 @@ +" @Author: Tom Link (micathom AT gmail com?subject=[vim]) +" @Website: http://www.vim.org/account/profile.php?user_id=4037 +" @GIT: http://github.com/tomtom/vimtlib/ +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 2009-02-28. +" @Last Change: 2009-03-14. +" @Revision: 73 + +let s:save_cpo = &cpo +set cpo&vim + + +SpecBegin 'title': 'tlib: Input', 'scratch': '%', + \ 'after': ':unlet! g:spec_lib_rv', + \ 'options': [ + \ 'vim', + \ ] + + +let g:spec_tlib_list = [10, 20, 30, 40, 'a50', 'aa60', 'b70', 'ba80', 90] + + + +It should return empty values when the user presses . +Replay :let g:spec_lib_rv = tlib#input#List('s', '', g:spec_tlib_list)\ + \ \\\ +Should be#Equal g:spec_lib_rv, '' + +Replay :let g:spec_lib_rv = tlib#input#List('m', '', g:spec_tlib_list)\ + \ \\\ +Should be#Equal g:spec_lib_rv, [] + +Replay :let g:spec_lib_rv = tlib#input#List('si', '', g:spec_tlib_list)\ + \ \\\ +Should be#Equal g:spec_lib_rv, 0 + + + +It should pick an item from s-type list. +Replay :let g:spec_lib_rv = tlib#input#List('s', '', g:spec_tlib_list)\ + \ \\\ +Should be#Equal g:spec_lib_rv, 30 + + + +It should return an index from si-type list. +Replay :let g:spec_lib_rv = tlib#input#List('si', '', g:spec_tlib_list)\ + \ \\\ +Should be#Equal g:spec_lib_rv, 3 + + + +It should return a list from a m-type list. +Replay :let g:spec_lib_rv = tlib#input#List('m', '', g:spec_tlib_list)\ + \ \#\\\ +Should be#Equal sort(g:spec_lib_rv), [20, 40] + +Replay :let g:spec_lib_rv = tlib#input#List('m', '', g:spec_tlib_list)\ + \ \\\ +Should be#Equal sort(g:spec_lib_rv), [20, 30] + +Replay :let g:spec_lib_rv = tlib#input#List('m', '', g:spec_tlib_list)\ + \ \\\\ +Should be#Equal sort(g:spec_lib_rv), [20, 30] + + + +It should return a list of indices from a mi-type list. +Replay :let g:spec_lib_rv = tlib#input#List('mi', '', g:spec_tlib_list)\ + \ \#\\\ +Should be#Equal sort(g:spec_lib_rv), [2, 4] + +Replay :let g:spec_lib_rv = tlib#input#List('mi', '', g:spec_tlib_list)\ + \ \\\ +Should be#Equal sort(g:spec_lib_rv), [2, 3] + +Replay :let g:spec_lib_rv = tlib#input#List('mi', '', g:spec_tlib_list)\ + \ \\\\ +Should be#Equal sort(g:spec_lib_rv), [2, 3] + + + +It should filter items from a s-type list. +Replay :let g:spec_lib_rv = tlib#input#List('s', '', g:spec_tlib_list)\ + \ \a\\ +Should be#Equal g:spec_lib_rv, 'aa60' + + + +It should filter items from a si-type list. +Replay :let g:spec_lib_rv = tlib#input#List('si', '', g:spec_tlib_list)\ + \ \a\\ +Should be#Equal g:spec_lib_rv, 6 + + + +It should filter items from a m-type list. +Replay :let g:spec_lib_rv = tlib#input#List('m', '', g:spec_tlib_list)\ + \ a\#\\ +Should be#Equal sort(g:spec_lib_rv), ['aa60', 'ba80'] + +Replay :let g:spec_lib_rv = tlib#input#List('m', '', g:spec_tlib_list)\ + \ a\\\ +Should be#Equal sort(g:spec_lib_rv), ['aa60', 'ba80'] + +Replay :let g:spec_lib_rv = tlib#input#List('m', '', g:spec_tlib_list)\ + \ a\\\\ +Should be#Equal sort(g:spec_lib_rv), ['aa60', 'ba80'] + + + +It should filter items from a mi-type list. +Replay :let g:spec_lib_rv = tlib#input#List('mi', '', g:spec_tlib_list)\ + \ a\#\\ +Should be#Equal sort(g:spec_lib_rv), [6, 8] + +Replay :let g:spec_lib_rv = tlib#input#List('mi', '', g:spec_tlib_list)\ + \ a\\\ +Should be#Equal sort(g:spec_lib_rv), [6, 8] + +Replay :let g:spec_lib_rv = tlib#input#List('mi', '', g:spec_tlib_list)\ + \ a\\\\ +Should be#Equal sort(g:spec_lib_rv), [6, 8] + + + +let &cpo = s:save_cpo diff --git a/sources_non_forked/tlib/spec/tlib/list.vim b/sources_non_forked/tlib/spec/tlib/list.vim new file mode 100644 index 00000000..d4aae54a --- /dev/null +++ b/sources_non_forked/tlib/spec/tlib/list.vim @@ -0,0 +1,67 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @Website: http://www.vim.org/account/profile.php?user_id=4037 +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 2010-04-03. +" @Last Change: 2010-04-03. +" @Revision: 4 + +let s:save_cpo = &cpo +set cpo&vim + + + +SpecBegin 'title': 'tlib: List' + " \, 'options': [vim, <+SET+>] + " \, 'sfile': '<+SCRIPT CONTEXT+>' + " \, 'scratch': '<+SCRATCH FILE+>' + " \, 'before': '<+BEFORE EX COMMANDS+>' + " \, 'after': '<+AFTER EX COMMANDS+>' + " \, 'cleanup': ['<+FUNCTION+>()'] + + +" List {{{2 +fun! Add(a,b) + return a:a + a:b +endf + +Should be equal tlib#list#Inject([], 0, function('Add')), 0 +Should be equal tlib#list#Inject([1,2,3], 0, function('Add')), 6 + +Should be equal tlib#list#Compact([]), [] +Should be equal tlib#list#Compact([0,1,2,3,[], {}, ""]), [1,2,3] + +Should be equal tlib#list#Flatten([]), [] +Should be equal tlib#list#Flatten([1,2,3]), [1,2,3] +Should be equal tlib#list#Flatten([1,2, [1,2,3], 3]), [1,2,1,2,3,3] +Should be equal tlib#list#Flatten([0,[1,2,[3,""]]]), [0,1,2,3,""] + +Should be equal tlib#list#FindAll([1,2,3], 'v:val >= 2'), [2,3] +Should be equal tlib#list#FindAll([1,2,3], 'v:val >= 2', 'v:val * 10'), [20,30] + +Should be equal tlib#list#Find([1,2,3], 'v:val >= 2'), 2 +Should be equal tlib#list#Find([1,2,3], 'v:val >= 2', 0, 'v:val * 10'), 20 +Should be equal tlib#list#Find([1,2,3], 'v:val >= 5', 10), 10 + +Should be equal tlib#list#Any([1,2,3], 'v:val >= 2'), 1 +Should be equal tlib#list#Any([1,2,3], 'v:val >= 5'), 0 + +Should be equal tlib#list#All([1,2,3], 'v:val < 5'), 1 +Should be equal tlib#list#All([1,2,3], 'v:val >= 2'), 0 + +Should be equal tlib#list#Remove([1,2,1,2], 2), [1,1,2] +Should be equal tlib#list#RemoveAll([1,2,1,2], 2), [1,1] + +Should be equal tlib#list#Zip([[1,2,3], [4,5,6]]), [[1,4], [2,5], [3,6]] +Should be equal tlib#list#Zip([[1,2,3], [4,5,6,7]]), [[1,4], [2,5], [3,6], ['', 7]] +Should be equal tlib#list#Zip([[1,2,3], [4,5,6,7]], -1), [[1,4], [2,5], [3,6], [-1,7]] +Should be equal tlib#list#Zip([[1,2,3,7], [4,5,6]], -1), [[1,4], [2,5], [3,6], [7,-1]] + + +Should be equal tlib#list#Uniq([]), [] +Should be equal tlib#list#Uniq([1,1]), [1] +Should be equal tlib#list#Uniq([1,2,2,3,2,3,4,2,1,7,2,3,2,3,7]), [1,2,3,4,7] + + + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/sources_non_forked/tlib/spec/tlib/rx.vim b/sources_non_forked/tlib/spec/tlib/rx.vim new file mode 100644 index 00000000..fc281035 --- /dev/null +++ b/sources_non_forked/tlib/spec/tlib/rx.vim @@ -0,0 +1,27 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @Website: http://www.vim.org/account/profile.php?user_id=4037 +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 2010-04-03. +" @Last Change: 2010-04-03. +" @Revision: 2 + +let s:save_cpo = &cpo +set cpo&vim + + + +SpecBegin 'title': 'tlib#rx' + + +for c in split('^$.*+\()|{}[]~', '\zs') + let s = printf('%sfoo%sbar%s', c, c, c) + Should be like s, '\m^'. tlib#rx#Escape(s, 'm') .'$' + Should be like s, '\M^'. tlib#rx#Escape(s, 'M') .'$' + Should be like s, '\v^'. tlib#rx#Escape(s, 'v') .'$' + Should be like s, '\V\^'. tlib#rx#Escape(s, 'V') .'\$' +endfor + + + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/sources_non_forked/tlib/spec/tlib/string.vim b/sources_non_forked/tlib/spec/tlib/string.vim new file mode 100644 index 00000000..4329d946 --- /dev/null +++ b/sources_non_forked/tlib/spec/tlib/string.vim @@ -0,0 +1,29 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @Website: http://www.vim.org/account/profile.php?user_id=4037 +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 2010-04-03. +" @Last Change: 2010-04-03. +" @Revision: 4 + +let s:save_cpo = &cpo +set cpo&vim + + + +SpecBegin 'title': 'tlib#string' + +Should be equal tlib#string#RemoveBackslashes('foo bar'), 'foo bar' +Should be equal tlib#string#RemoveBackslashes('foo\ bar'), 'foo bar' +Should be equal tlib#string#RemoveBackslashes('foo\ \\bar'), 'foo \\bar' +Should be equal tlib#string#RemoveBackslashes('foo\ \\bar', '\ '), 'foo \bar' + + +Should be equal tlib#string#Count("fooo", "o"), 3 +Should be equal tlib#string#Count("***", "\\*"), 3 +Should be equal tlib#string#Count("***foo", "\\*"), 3 +Should be equal tlib#string#Count("foo***", "\\*"), 3 + + + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/sources_non_forked/tlib/spec/tlib/url.vim b/sources_non_forked/tlib/spec/tlib/url.vim new file mode 100644 index 00000000..80783e9c --- /dev/null +++ b/sources_non_forked/tlib/spec/tlib/url.vim @@ -0,0 +1,23 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @Website: http://www.vim.org/account/profile.php?user_id=4037 +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 2010-04-03. +" @Last Change: 2010-04-03. +" @Revision: 2 + +let s:save_cpo = &cpo +set cpo&vim + + + +SpecBegin 'title': 'tlib#url' + +Should be equal tlib#url#Decode('http://example.com/foo+bar%25bar'), 'http://example.com/foo bar%bar' +Should be equal tlib#url#Decode('Hello%20World.%20%20Good%2c%20bye.'), 'Hello World. Good, bye.' + +Should be equal tlib#url#Encode('foo bar%bar'), 'foo+bar%%bar' +Should be equal tlib#url#Encode('Hello World. Good, bye.'), 'Hello+World.+Good%2c+bye.' + + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/sources_non_forked/tlib/spec/tlib/var.vim b/sources_non_forked/tlib/spec/tlib/var.vim new file mode 100644 index 00000000..28e3fac8 --- /dev/null +++ b/sources_non_forked/tlib/spec/tlib/var.vim @@ -0,0 +1,37 @@ +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) +" @Website: http://www.vim.org/account/profile.php?user_id=4037 +" @License: GPL (see http://www.gnu.org/licenses/gpl.txt) +" @Created: 2010-04-03. +" @Last Change: 2010-04-03. +" @Revision: 2 + +let s:save_cpo = &cpo +set cpo&vim + + + +SpecBegin 'title': 'tlib#var' + + +let g:foo = 1 +let g:bar = 2 +let b:bar = 3 +let s:bar = 4 + +Should be equal tlib#var#Get('bar', 'bg'), 3 +Should be equal tlib#var#Get('bar', 'g'), 2 +Should be equal tlib#var#Get('foo', 'bg'), 1 +Should be equal tlib#var#Get('foo', 'g'), 1 +Should be equal tlib#var#Get('none', 'l'), '' + +Should be equal eval(tlib#var#EGet('bar', 'bg')), 3 +Should be equal eval(tlib#var#EGet('bar', 'g')), 2 +" Should be equal eval(tlib#var#EGet('bar', 'sg')), 4 +Should be equal eval(tlib#var#EGet('foo', 'bg')), 1 +Should be equal eval(tlib#var#EGet('foo', 'g')), 1 +Should be equal eval(tlib#var#EGet('none', 'l')), '' + + + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/sources_non_forked/typescript-vim/README.md b/sources_non_forked/typescript-vim/README.md new file mode 100644 index 00000000..a8809983 --- /dev/null +++ b/sources_non_forked/typescript-vim/README.md @@ -0,0 +1,136 @@ +Typescript Syntax for Vim +========================= + +Syntax file and other settings for [TypeScript](http://typescriptlang.org). The +syntax file is taken from this [blog +post](https://docs.microsoft.com/en-us/archive/blogs/interoperability/sublime-text-vi-emacs-typescript-enabled). + +Checkout [Tsuquyomi](https://github.com/Quramy/tsuquyomi) for omni-completion +and other features for TypeScript editing. + +Install +------- + +From Vim 8 onward, the plugin can be installed as simply as (Unix/Mac): +``` +git clone https://github.com/leafgarland/typescript-vim.git ~/.vim/pack/typescript/start/typescript-vim +``` + +On Windows/Powershell, use the following: +``` +git clone https://github.com/leafgarland/typescript-vim.git $home/vimfiles/pack/typescript/start/typescript-vim +``` + +For older versions of Vim, the simplest way to install is via a Vim add-in manager such as +[Plug](https://github.com/junegunn/vim-plug), +[Vundle](https://github.com/gmarik/vundle) or +[Pathogen](https://github.com/tpope/vim-pathogen/). + +_See the [Installation Wiki](https://github.com/leafgarland/typescript-vim/wiki/Installation)_ + +### Pathogen + +``` +git clone https://github.com/leafgarland/typescript-vim.git ~/.vim/bundle/typescript-vim +``` + +If you want to install manually then you need to copy the files from this +repository into your vim path, see the vim docs for [:help +runtimepath](http://vimdoc.sourceforge.net/htmldoc/options.html#'runtimepath') +for more information. This might be as simple as copying the files and +directories to `~/.vim/` but it depends on your Vim install and operating +system. + +Usage +----- + +Once the files are installed the syntax highlighting and other settings will be +automatically enabled anytime you edit a `.ts` file. + +Indenting +--------- + +This plugin includes a custom indenter (based on [pangloss/vim-javascript's +indenter](https://github.com/pangloss/vim-javascript/blob/master/indent/javascript.vim)), +it works pretty well but there are cases where it fails. If these bother you or +want to use other indent settings you can disable it by setting a flag in your +`.vimrc`: + +```vim +let g:typescript_indent_disable = 1 +``` + +If you want the indenter to automatically indent chained method calls as you type. + +```typescript +something + .foo() + .bar(); +``` + +Then add something like `setlocal indentkeys+=0.` to your `.vimrc`, see `:help +'indentkeys'` in vim for more information. + +If you use the `=` operator to re-indent code it will always indent +chained method calls - this can be disabled by changing the regex the +indent script uses to identify indented lines. In this case removing '.' +from the regex means that it wont indent lines starting with '.'. Note, +this is not ideal as the regex may change making your setting out of date. + +```vim +let g:typescript_opfirst='\%([<>=,?^%|*/&]\|\([-:+]\)\1\@!\|!=\|in\%(stanceof\)\=\>\)' +``` + +Compiler settings +----------------- + +This plugin contains compiler settings to set `makeprg` and `errorformat`. +The compiler settings enable you to call the `tsc` compiler directly from Vim +and display any errors or warnings in Vim's QuickFix window. + +To run the compiler, enter `:make`, this will run `tsc` against the last saved +version of your currently edited file. + +The default for `makeprg` is `tsc $* %`. You can enter other compiler options into your `:make` +command line and they will be inserted in place of `$*`. + +There are options to change the compiler name and to insert default options. + +```vim +let g:typescript_compiler_binary = 'tsc' +let g:typescript_compiler_options = '' +``` + +These options will be passed to the binary as command arguments. For example, +if `g:typescript_compiler_binary = 'tsc'` and `g:typescript_compiler_options = '--lib es6'`, +`l:makeprg` will be: `tsc --lib es6 $* %`. + +You can completely override this plugin's compiler settings with something like +this in your `.vimrc`, where you can set makeprg to whatever you want. + +```vim + autocmd FileType typescript :set makeprg=tsc +``` + +Note, this plugin's compiler settings are not used by Syntastic which has its own +way of changing the options. See https://github.com/scrooloose/syntastic#faqargs. + +You can use something like this in your `.vimrc` to make the QuickFix +window automatically appear if `:make` has any errors. + +```vim +autocmd QuickFixCmdPost [^l]* nested cwindow +autocmd QuickFixCmdPost l* nested lwindow +``` + +Syntax highlighting +------------------- + +Syntax highlighting for TypeScript can be customized by following variables. + +- `g:typescript_ignore_typescriptdoc`: When this variable is defined, doccomments will not be + highlighted. +- `g:typescript_ignore_browserwords`: When this variable is set to `1`, browser API names such as + `window` or `document` will not be highlighted. (default to `0`) + +![Obligatory screenshot](https://raw.github.com/leafgarland/typescript-vim/master/vimshot01.png) diff --git a/sources_non_forked/typescript-vim/compiler/typescript.vim b/sources_non_forked/typescript-vim/compiler/typescript.vim new file mode 100644 index 00000000..77121eb5 --- /dev/null +++ b/sources_non_forked/typescript-vim/compiler/typescript.vim @@ -0,0 +1,30 @@ +if exists("current_compiler") + finish +endif +let current_compiler = "typescript" + +if !exists("g:typescript_compiler_binary") + let g:typescript_compiler_binary = "tsc" +endif + +if !exists("g:typescript_compiler_options") + let g:typescript_compiler_options = "" +endif + +if exists(":CompilerSet") != 2 + command! -nargs=* CompilerSet setlocal +endif + +let s:cpo_save = &cpo +set cpo-=C + +execute 'CompilerSet makeprg=' + \ . escape(g:typescript_compiler_binary, ' ') + \ . '\ ' + \ . escape(g:typescript_compiler_options, ' ') + \ . '\ $*\ %' + +CompilerSet errorformat=%+A\ %#%f\ %#(%l\\\,%c):\ %m,%C%m + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/sources_non_forked/typescript-vim/compiler/typescriptreact.vim b/sources_non_forked/typescript-vim/compiler/typescriptreact.vim new file mode 100644 index 00000000..0f734095 --- /dev/null +++ b/sources_non_forked/typescript-vim/compiler/typescriptreact.vim @@ -0,0 +1 @@ +runtime! compiler/typescript.vim diff --git a/sources_non_forked/typescript-vim/ftdetect/typescript.vim b/sources_non_forked/typescript-vim/ftdetect/typescript.vim new file mode 100644 index 00000000..7c102061 --- /dev/null +++ b/sources_non_forked/typescript-vim/ftdetect/typescript.vim @@ -0,0 +1,4 @@ +" use `set filetype` to override default filetype=xml for *.ts files +autocmd BufNewFile,BufRead *.ts set filetype=typescript +" use `setfiletype` to not override any other plugins like ianks/vim-tsx +autocmd BufNewFile,BufRead *.tsx setfiletype typescript diff --git a/sources_non_forked/typescript-vim/ftplugin/typescript.vim b/sources_non_forked/typescript-vim/ftplugin/typescript.vim new file mode 100644 index 00000000..da4b1e85 --- /dev/null +++ b/sources_non_forked/typescript-vim/ftplugin/typescript.vim @@ -0,0 +1,21 @@ +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo-=C + +compiler typescript +setlocal commentstring=//\ %s + +" Set 'formatoptions' to break comment lines but not other lines, +" " and insert the comment leader when hitting or using "o". +setlocal formatoptions-=t formatoptions+=croql + +setlocal suffixesadd+=.ts,.tsx + +let b:undo_ftplugin = "setl fo< ofu< com< cms<" + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/sources_non_forked/typescript-vim/ftplugin/typescriptreact.vim b/sources_non_forked/typescript-vim/ftplugin/typescriptreact.vim new file mode 100644 index 00000000..c23ec132 --- /dev/null +++ b/sources_non_forked/typescript-vim/ftplugin/typescriptreact.vim @@ -0,0 +1 @@ +runtime! ftplugin/typescript.vim diff --git a/sources_non_forked/typescript-vim/indent/typescript.vim b/sources_non_forked/typescript-vim/indent/typescript.vim new file mode 100644 index 00000000..3ee9aa01 --- /dev/null +++ b/sources_non_forked/typescript-vim/indent/typescript.vim @@ -0,0 +1,360 @@ +" Vim indent file +" Language: Typescript +" Acknowledgement: Almost direct copy from https://github.com/pangloss/vim-javascript + +" Only load this indent file when no other was loaded. +if exists('b:did_indent') || get(g:, 'typescript_indent_disable', 0) + finish +endif +let b:did_indent = 1 + +" Now, set up our indentation expression and keys that trigger it. +setlocal indentexpr=GetTypescriptIndent() +setlocal autoindent nolisp nosmartindent +setlocal indentkeys+=0],0) + +let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys<' + +" Only define the function once. +if exists('*GetTypescriptIndent') + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +" Get shiftwidth value +if exists('*shiftwidth') + function s:sw() + return shiftwidth() + endfunction +else + function s:sw() + return &sw + endfunction +endif + +" searchpair() wrapper +if has('reltime') + function s:GetPair(start,end,flags,skip,time,...) + return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,max([prevnonblank(v:lnum) - 2000,0] + a:000),a:time) + endfunction +else + function s:GetPair(start,end,flags,skip,...) + return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,max([prevnonblank(v:lnum) - 1000,get(a:000,1)])) + endfunction +endif + +" Regex of syntax group names that are or delimit string or are comments. +let s:syng_strcom = 'string\|comment\|regex\|special\|doc\|template\%(braces\)\@!' +let s:syng_str = 'string\|template\|special' +let s:syng_com = 'comment\|doc' +" Expression used to check whether we should skip a match with searchpair(). +let s:skip_expr = "synIDattr(synID(line('.'),col('.'),0),'name') =~? '".s:syng_strcom."'" + +function s:skip_func() + if !s:free || search('\m`\|\${\|\*\/','nW',s:looksyn) + let s:free = !eval(s:skip_expr) + let s:looksyn = line('.') + return !s:free + endif + let s:looksyn = line('.') + return getline('.') =~ '\%<'.col('.').'c\/.\{-}\/\|\%>'.col('.').'c[''"]\|\\$' && + \ eval(s:skip_expr) +endfunction + +function s:alternatePair(stop) + let pos = getpos('.')[1:2] + while search('\m[][(){}]','bW',a:stop) + if !s:skip_func() + let idx = stridx('])}',s:looking_at()) + if idx + 1 + if s:GetPair(['\[','(','{'][idx], '])}'[idx],'bW','s:skip_func()',2000,a:stop) <= 0 + break + endif + else + return + endif + endif + endwhile + call call('cursor',pos) +endfunction + +function s:save_pos(f,...) + let l:pos = getpos('.')[1:2] + let ret = call(a:f,a:000) + call call('cursor',l:pos) + return ret +endfunction + +function s:syn_at(l,c) + return synIDattr(synID(a:l,a:c,0),'name') +endfunction + +function s:looking_at() + return getline('.')[col('.')-1] +endfunction + +function s:token() + return s:looking_at() =~ '\k' ? expand('') : s:looking_at() +endfunction + +function s:previous_token() + let l:n = line('.') + if (s:looking_at() !~ '\k' || search('\m\<','cbW')) && search('\m\S','bW') + if (getline('.')[col('.')-2:col('.')-1] == '*/' || line('.') != l:n && + \ getline('.') =~ '\%<'.col('.').'c\/\/') && s:syn_at(line('.'),col('.')) =~? s:syng_com + while search('\m\/\ze[/*]','cbW') + if !search('\m\S','bW') + break + elseif s:syn_at(line('.'),col('.')) !~? s:syng_com + return s:token() + endif + endwhile + else + return s:token() + endif + endif + return '' +endfunction + +function s:others(p) + return "((line2byte(line('.')) + col('.')) <= ".(line2byte(a:p[0]) + a:p[1]).") || ".s:skip_expr +endfunction + +function s:tern_skip(p) + return s:GetPair('{','}','nbW',s:others(a:p),200,a:p[0]) > 0 +endfunction + +function s:tern_col(p) + return s:GetPair('?',':\@ 0 +endfunction + +function s:label_col() + let pos = getpos('.')[1:2] + let [s:looksyn,s:free] = pos + call s:alternatePair(0) + if s:save_pos('s:IsBlock') + let poss = getpos('.')[1:2] + return call('cursor',pos) || !s:tern_col(poss) + elseif s:looking_at() == ':' + return !s:tern_col([0,0]) + endif +endfunction + +" configurable regexes that define continuation lines, not including (, {, or [. +let s:opfirst = '^' . get(g:,'typescript_opfirst', + \ '\%([<>=,?^%|*/&]\|\([-.:+]\)\1\@!\|!=\|in\%(stanceof\)\=\>\)') +let s:continuation = get(g:,'typescript_continuation', + \ '\%([-+<>=,.~!?/*^%|&:]\|\<\%(typeof\|delete\|void\|in\|instanceof\)\)') . '$' + +function s:continues(ln,con) + return !cursor(a:ln, match(' '.a:con,s:continuation)) && + \ eval( (['s:syn_at(line("."),col(".")) !~? "regex"'] + + \ repeat(['getline(".")[col(".")-2] != tr(s:looking_at(),">","=")'],3) + + \ repeat(['s:previous_token() != "."'],5) + [1])[ + \ index(split('/ > - + typeof in instanceof void delete'),s:token())]) +endfunction + +" get the line of code stripped of comments and move cursor to the last +" non-comment char. +function s:Trim(ln) + call cursor(a:ln+1,1) + call s:previous_token() + return strpart(getline('.'),0,col('.')) +endfunction + +" Find line above 'lnum' that isn't empty or in a comment +function s:PrevCodeLine(lnum) + let l:n = prevnonblank(a:lnum) + while l:n + if getline(l:n) =~ '^\s*\/[/*]' + if (stridx(getline(l:n),'`') > 0 || getline(l:n-1)[-1:] == '\') && + \ s:syn_at(l:n,1) =~? s:syng_str + return l:n + endif + let l:n = prevnonblank(l:n-1) + elseif getline(l:n) =~ '\([/*]\)\1\@![/*]' && s:syn_at(l:n,1) =~? s:syng_com + let l:n = s:save_pos('eval', + \ 'cursor('.l:n.',1) + search(''\m\/\*'',"bW")') + else + return l:n + endif + endwhile +endfunction + +" Check if line 'lnum' has a balanced amount of parentheses. +function s:Balanced(lnum) + let l:open = 0 + let l:line = getline(a:lnum) + let pos = match(l:line, '[][(){}]', 0) + while pos != -1 + if s:syn_at(a:lnum,pos + 1) !~? s:syng_strcom + let l:open += match(' ' . l:line[pos],'[[({]') + if l:open < 0 + return + endif + endif + let pos = match(l:line, '[][(){}]', pos + 1) + endwhile + return !l:open +endfunction + +function s:OneScope(lnum) + let pline = s:Trim(a:lnum) + let kw = 'else do' + if pline[-1:] == ')' && s:GetPair('(', ')', 'bW', s:skip_expr, 100) > 0 + call s:previous_token() + let kw = 'for if let while with' + if index(split('await each'),s:token()) + 1 + call s:previous_token() + let kw = 'for' + endif + endif + return pline[-2:] == '=>' || index(split(kw),s:token()) + 1 && + \ s:save_pos('s:previous_token') != '.' +endfunction + +" returns braceless levels started by 'i' and above lines * &sw. 'num' is the +" lineNr which encloses the entire context, 'cont' if whether line 'i' + 1 is +" a continued expression, which could have started in a braceless context +function s:iscontOne(i,num,cont) + let [l:i, l:num, bL] = [a:i, a:num + !a:num, 0] + let pind = a:num ? indent(l:num) + s:W : 0 + let ind = indent(l:i) + (a:cont ? 0 : s:W) + while l:i >= l:num && (ind > pind || l:i == l:num) + if indent(l:i) < ind && s:OneScope(l:i) + let bL += s:W + let l:i = line('.') + elseif !a:cont || bL || ind < indent(a:i) + break + endif + let ind = min([ind, indent(l:i)]) + let l:i = s:PrevCodeLine(l:i - 1) + endwhile + return bL +endfunction + +" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader +function s:IsBlock() + if s:looking_at() == '{' + let l:n = line('.') + let char = s:previous_token() + if match(s:stack,'xml\|jsx') + 1 && s:syn_at(line('.'),col('.')-1) =~? 'xml\|jsx' + return char != '{' + elseif char =~ '\k' + return index(split('return const let import export yield default delete var await void typeof throw case new in instanceof') + \ ,char) < (line('.') != l:n) || s:previous_token() == '.' + elseif char == '>' + return getline('.')[col('.')-2] == '=' || s:syn_at(line('.'),col('.')) =~? '^jsflow' + elseif char == ':' + return getline('.')[col('.')-2] != ':' && s:label_col() + elseif char == '/' + return s:syn_at(line('.'),col('.')) =~? 'regex' + endif + return char !~ '[=~!<*,?^%|&([]' && + \ (char !~ '[-+]' || l:n != line('.') && getline('.')[col('.')-2] == char) + endif +endfunction + +function GetTypescriptIndent() + let b:js_cache = get(b:,'js_cache',[0,0,0]) + " Get the current line. + call cursor(v:lnum,1) + let l:line = getline('.') + " use synstack as it validates syn state and works in an empty line + let s:stack = synstack(v:lnum,1) + let syns = synIDattr(get(s:stack,-1),'name') + + " start with strings,comments,etc. + if syns =~? s:syng_com + if l:line =~ '^\s*\*' + return cindent(v:lnum) + elseif l:line !~ '^\s*\/[/*]' + return -1 + endif + elseif syns =~? s:syng_str && l:line !~ '^[''"]' + if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1) + let b:js_cache[0] = v:lnum + endif + return -1 + endif + let l:lnum = s:PrevCodeLine(v:lnum - 1) + if !l:lnum + return + endif + + let l:line = substitute(l:line,'^\s*','','') + if l:line[:1] == '/*' + let l:line = substitute(l:line,'^\%(\/\*.\{-}\*\/\s*\)*','','') + endif + if l:line =~ '^\/[/*]' + let l:line = '' + endif + + " the containing paren, bracket, curly, or closing '>'. + " Many hacks for performance + let idx = index([']',')','}','>'],l:line[0]) + if b:js_cache[0] >= l:lnum && b:js_cache[0] < v:lnum && + \ (b:js_cache[0] > l:lnum || s:Balanced(l:lnum)) + call call('cursor',b:js_cache[1:]) + else + let [s:looksyn, s:free, top] = [v:lnum - 1, 1, (!indent(l:lnum) && + \ s:syn_at(l:lnum,1) !~? s:syng_str) * l:lnum] + if idx + 1 + call s:GetPair(['\[','(','{'][idx],'])}'[idx],'bW','s:skip_func()',2000,top) + elseif getline(v:lnum) !~ '^\S' && syns =~? 'block' + call s:GetPair('{','}','bW','s:skip_func()',2000,top) + else + call s:alternatePair(top) + endif + endif + + let b:js_cache = [v:lnum] + (line('.') == v:lnum ? [0,0] : getpos('.')[1:2]) + let num = b:js_cache[1] + + let [s:W, isOp, bL, switch_offset] = [s:sw(),0,0,0] + if !num || s:IsBlock() + let ilnum = line('.') + let pline = s:save_pos('s:Trim',l:lnum) + if num && s:looking_at() == ')' && s:GetPair('(', ')', 'bW', s:skip_expr, 100) > 0 + let num = ilnum == num ? line('.') : num + if idx < 0 && s:previous_token() ==# 'switch' && s:previous_token() != '.' + if &cino !~ ':' + let switch_offset = s:W + else + let cinc = matchlist(&cino,'.*:\zs\(-\)\=\(\d*\)\(\.\d\+\)\=\(s\)\=\C') + let switch_offset = max([cinc[0] is '' ? 0 : (cinc[1].1) * + \ ((strlen(cinc[2].cinc[3]) ? str2nr(cinc[2].str2nr(cinc[3][1])) : 10) * + \ (cinc[4] is '' ? 1 : s:W)) / 10, -indent(num)]) + endif + if pline[-1:] != '.' && l:line =~# '^\%(default\|case\)\>' + return indent(num) + switch_offset + endif + endif + endif + if idx < 0 && pline !~ '[{;]$' + if pline =~# ':\@" +hi link shebang Comment + +"" typescript comments"{{{ +syn keyword typescriptCommentTodo TODO FIXME XXX TBD contained +syn match typescriptLineComment "\/\/.*" contains=@Spell,typescriptCommentTodo,typescriptRef +syn match typescriptRefComment /\/\/\/<\(reference\|amd-\(dependency\|module\)\)\s\+.*\/>$/ contains=typescriptRefD,typescriptRefS +syn region typescriptRefD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ +syn region typescriptRefS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ + +syn match typescriptCommentSkip "^[ \t]*\*\($\|[ \t]\+\)" +syn region typescriptComment start="/\*" end="\*/" contains=@Spell,typescriptCommentTodo extend +"}}} +"" JSDoc support start"{{{ +if !exists("typescript_ignore_typescriptdoc") + syntax case ignore + +" syntax coloring for JSDoc comments (HTML) +"unlet b:current_syntax + + syntax region typescriptDocComment start="/\*\*\s*$" end="\*/" contains=typescriptDocTags,typescriptCommentTodo,typescriptCvsTag,@typescriptHtml,@Spell fold extend + syntax match typescriptDocTags contained "@\(param\|argument\|requires\|exception\|throws\|type\|class\|extends\|see\|link\|member\|module\|method\|title\|namespace\|optional\|default\|base\|file\|returns\=\)\>" nextgroup=typescriptDocParam,typescriptDocSeeTag skipwhite + syntax match typescriptDocTags contained "@\(beta\|deprecated\|description\|fileoverview\|author\|license\|version\|constructor\|private\|protected\|final\|ignore\|addon\|exec\)\>" + syntax match typescriptDocParam contained "\%(#\|\w\|\.\|:\|\/\)\+" + syntax region typescriptDocSeeTag contained matchgroup=typescriptDocSeeTag start="{" end="}" contains=typescriptDocTags + + syntax case match +endif "" JSDoc end +"}}} +syntax case match + +"" Syntax in the typescript code"{{{ +syn match typescriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}" contained containedin=typescriptStringD,typescriptStringS,typescriptStringB display +syn region typescriptStringD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=typescriptSpecial,@htmlPreproc extend +syn region typescriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=typescriptSpecial,@htmlPreproc extend +syn region typescriptStringB start=+`+ skip=+\\\\\|\\`+ end=+`+ contains=typescriptInterpolation,typescriptSpecial,@htmlPreproc extend + +syn region typescriptInterpolation matchgroup=typescriptInterpolationDelimiter + \ start=/${/ end=/}/ contained + \ contains=@typescriptExpression + +syn match typescriptNumber "-\=\<\d[0-9_]*L\=\>" display +syn match typescriptNumber "-\=\<0[xX][0-9a-fA-F][0-9a-fA-F_]*\>" display +syn match typescriptNumber "-\=\<0[bB][01][01_]*\>" display +syn match typescriptNumber "-\=\<0[oO]\o[0-7_]*\>" display +syn region typescriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gimsuy]\{0,2\}\s*$+ end=+/[gimsuy]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline +" syntax match typescriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\." +" syntax region typescriptStringD start=+"+ skip=+\\\\\|\\$"+ end=+"+ contains=typescriptSpecial,@htmlPreproc +" syntax region typescriptStringS start=+'+ skip=+\\\\\|\\$'+ end=+'+ contains=typescriptSpecial,@htmlPreproc +" syntax region typescriptRegexpString start=+/\(\*\|/\)\@!+ skip=+\\\\\|\\/+ end=+/[gimsuy]\{,3}+ contains=typescriptSpecial,@htmlPreproc oneline +" syntax match typescriptNumber /\<-\=\d\+L\=\>\|\<0[xX]\x\+\>/ +syntax match typescriptFloat /\<-\=\%(\d[0-9_]*\.\d[0-9_]*\|\d[0-9_]*\.\|\.\d[0-9]*\)\%([eE][+-]\=\d[0-9_]*\)\=\>/ +" syntax match typescriptLabel /\(?\s*\)\@/ +"}}} +"" typescript Prototype"{{{ +syntax keyword typescriptPrototype contained prototype +"}}} +" DOM, Browser and Ajax Support {{{ +"""""""""""""""""""""""" +if get(g:, 'typescript_ignore_browserwords', 0) + syntax keyword typescriptBrowserObjects window navigator screen history location + + syntax keyword typescriptDOMObjects document event HTMLElement Anchor Area Base Body Button Form Frame Frameset Image Link Meta Option Select Style Table TableCell TableRow Textarea + syntax keyword typescriptDOMMethods contained createTextNode createElement insertBefore replaceChild removeChild appendChild hasChildNodes cloneNode normalize isSupported hasAttributes getAttribute setAttribute removeAttribute getAttributeNode setAttributeNode removeAttributeNode getElementsByTagName hasAttribute getElementById adoptNode close compareDocumentPosition createAttribute createCDATASection createComment createDocumentFragment createElementNS createEvent createExpression createNSResolver createProcessingInstruction createRange createTreeWalker elementFromPoint evaluate getBoxObjectFor getElementsByClassName getSelection getUserData hasFocus importNode + syntax keyword typescriptDOMProperties contained nodeName nodeValue nodeType parentNode childNodes firstChild lastChild previousSibling nextSibling attributes ownerDocument namespaceURI prefix localName tagName + + syntax keyword typescriptAjaxObjects XMLHttpRequest + syntax keyword typescriptAjaxProperties contained readyState responseText responseXML statusText + syntax keyword typescriptAjaxMethods contained onreadystatechange abort getAllResponseHeaders getResponseHeader open send setRequestHeader + + syntax keyword typescriptPropietaryObjects ActiveXObject + syntax keyword typescriptPropietaryMethods contained attachEvent detachEvent cancelBubble returnValue + + syntax keyword typescriptHtmlElemProperties contained className clientHeight clientLeft clientTop clientWidth dir href id innerHTML lang length offsetHeight offsetLeft offsetParent offsetTop offsetWidth scrollHeight scrollLeft scrollTop scrollWidth style tabIndex target title + + syntax keyword typescriptEventListenerKeywords contained blur click focus mouseover mouseout load item + + syntax keyword typescriptEventListenerMethods contained scrollIntoView addEventListener dispatchEvent removeEventListener preventDefault stopPropagation +endif +" }}} +"" Programm Keywords"{{{ +syntax keyword typescriptSource import export from as +syntax keyword typescriptIdentifier arguments this void +syntax keyword typescriptStorageClass let var const +syntax keyword typescriptOperator delete new instanceof typeof +syntax keyword typescriptBoolean true false +syntax keyword typescriptNull null undefined +syntax keyword typescriptMessage alert confirm prompt status +syntax keyword typescriptGlobal self top parent +syntax keyword typescriptDeprecated escape unescape all applets alinkColor bgColor fgColor linkColor vlinkColor xmlEncoding +"}}} +"" Statement Keywords"{{{ +syntax keyword typescriptConditional if else switch +syntax keyword typescriptRepeat do while for in of +syntax keyword typescriptBranch break continue yield await +syntax keyword typescriptLabel case default async readonly +syntax keyword typescriptStatement return with + +syntax keyword typescriptGlobalObjects Array Boolean Date Function Infinity JSON Math Number NaN Object Packages RegExp String Symbol netscape ArrayBuffer BigInt64Array BigUint64Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray Buffer Collator DataView DateTimeFormat Intl Iterator Map Set WeakMap WeakSet NumberFormat ParallelArray Promise Proxy Reflect Uint8ClampedArray WebAssembly console document fetch window +syntax keyword typescriptGlobalNodeObjects module exports global process __dirname __filename + +syntax keyword typescriptExceptions try catch throw finally Error EvalError RangeError ReferenceError SyntaxError TypeError URIError + +syntax keyword typescriptReserved constructor declare as interface module abstract enum int short export interface static byte extends long super char final native synchronized class float package throws goto private transient debugger implements protected volatile double import public type namespace from get set keyof +"}}} +"" typescript/DOM/HTML/CSS specified things"{{{ + +" typescript Objects"{{{ + syn match typescriptFunction "(super\s*|constructor\s*)" contained nextgroup=typescriptVars + syn region typescriptVars start="(" end=")" contained contains=typescriptParameters transparent keepend + syn match typescriptParameters "([a-zA-Z0-9_?.$][\w?.$]*)\s*:\s*([a-zA-Z0-9_?.$][\w?.$]*)" contained skipwhite +"}}} +" DOM2 Objects"{{{ + syntax keyword typescriptType DOMImplementation DocumentFragment Node NodeList NamedNodeMap CharacterData Attr Element Text Comment CDATASection DocumentType Notation Entity EntityReference ProcessingInstruction void any string boolean number symbol never object unknown + syntax keyword typescriptExceptions DOMException +"}}} +" DOM2 CONSTANT"{{{ + syntax keyword typescriptDomErrNo INDEX_SIZE_ERR DOMSTRING_SIZE_ERR HIERARCHY_REQUEST_ERR WRONG_DOCUMENT_ERR INVALID_CHARACTER_ERR NO_DATA_ALLOWED_ERR NO_MODIFICATION_ALLOWED_ERR NOT_FOUND_ERR NOT_SUPPORTED_ERR INUSE_ATTRIBUTE_ERR INVALID_STATE_ERR SYNTAX_ERR INVALID_MODIFICATION_ERR NAMESPACE_ERR INVALID_ACCESS_ERR + syntax keyword typescriptDomNodeConsts ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE CDATA_SECTION_NODE ENTITY_REFERENCE_NODE ENTITY_NODE PROCESSING_INSTRUCTION_NODE COMMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE DOCUMENT_FRAGMENT_NODE NOTATION_NODE +"}}} +" HTML events and internal variables"{{{ + syntax case ignore + syntax keyword typescriptHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize onload onsubmit + syntax case match +"}}} + +" Follow stuff should be highligh within a special context +" While it can't be handled with context depended with Regex based highlight +" So, turn it off by default +if exists("typescript_enable_domhtmlcss") + +" DOM2 things"{{{ + syntax match typescriptDomElemAttrs contained /\%(nodeName\|nodeValue\|nodeType\|parentNode\|childNodes\|firstChild\|lastChild\|previousSibling\|nextSibling\|attributes\|ownerDocument\|namespaceURI\|prefix\|localName\|tagName\)\>/ + syntax match typescriptDomElemFuncs contained /\%(insertBefore\|replaceChild\|removeChild\|appendChild\|hasChildNodes\|cloneNode\|normalize\|isSupported\|hasAttributes\|getAttribute\|setAttribute\|removeAttribute\|getAttributeNode\|setAttributeNode\|removeAttributeNode\|getElementsByTagName\|getAttributeNS\|setAttributeNS\|removeAttributeNS\|getAttributeNodeNS\|setAttributeNodeNS\|getElementsByTagNameNS\|hasAttribute\|hasAttributeNS\)\>/ nextgroup=typescriptParen skipwhite +"}}} +" HTML things"{{{ + syntax match typescriptHtmlElemAttrs contained /\%(className\|clientHeight\|clientLeft\|clientTop\|clientWidth\|dir\|id\|innerHTML\|lang\|length\|offsetHeight\|offsetLeft\|offsetParent\|offsetTop\|offsetWidth\|scrollHeight\|scrollLeft\|scrollTop\|scrollWidth\|style\|tabIndex\|title\)\>/ + syntax match typescriptHtmlElemFuncs contained /\%(blur\|click\|focus\|scrollIntoView\|addEventListener\|dispatchEvent\|removeEventListener\|item\)\>/ nextgroup=typescriptParen skipwhite +"}}} +" CSS Styles in typescript"{{{ + syntax keyword typescriptCssStyles contained color font fontFamily fontSize fontSizeAdjust fontStretch fontStyle fontVariant fontWeight letterSpacing lineBreak lineHeight quotes rubyAlign rubyOverhang rubyPosition + syntax keyword typescriptCssStyles contained textAlign textAlignLast textAutospace textDecoration textIndent textJustify textJustifyTrim textKashidaSpace textOverflowW6 textShadow textTransform textUnderlinePosition + syntax keyword typescriptCssStyles contained unicodeBidi whiteSpace wordBreak wordSpacing wordWrap writingMode + syntax keyword typescriptCssStyles contained bottom height left position right top width zIndex + syntax keyword typescriptCssStyles contained border borderBottom borderLeft borderRight borderTop borderBottomColor borderLeftColor borderTopColor borderBottomStyle borderLeftStyle borderRightStyle borderTopStyle borderBottomWidth borderLeftWidth borderRightWidth borderTopWidth borderColor borderStyle borderWidth borderCollapse borderSpacing captionSide emptyCells tableLayout + syntax keyword typescriptCssStyles contained margin marginBottom marginLeft marginRight marginTop outline outlineColor outlineStyle outlineWidth padding paddingBottom paddingLeft paddingRight paddingTop + syntax keyword typescriptCssStyles contained listStyle listStyleImage listStylePosition listStyleType + syntax keyword typescriptCssStyles contained background backgroundAttachment backgroundColor backgroundImage backgroundPosition backgroundPositionX backgroundPositionY backgroundRepeat + syntax keyword typescriptCssStyles contained clear clip clipBottom clipLeft clipRight clipTop content counterIncrement counterReset cssFloat cursor direction display filter layoutGrid layoutGridChar layoutGridLine layoutGridMode layoutGridType + syntax keyword typescriptCssStyles contained marks maxHeight maxWidth minHeight minWidth opacity MozOpacity overflow overflowX overflowY verticalAlign visibility zoom cssText + syntax keyword typescriptCssStyles contained scrollbar3dLightColor scrollbarArrowColor scrollbarBaseColor scrollbarDarkShadowColor scrollbarFaceColor scrollbarHighlightColor scrollbarShadowColor scrollbarTrackColor +"}}} +endif "DOM/HTML/CSS + +" Highlight ways"{{{ +syntax match typescriptDotNotation "\." nextgroup=typescriptPrototype,typescriptDomElemAttrs,typescriptDomElemFuncs,typescriptDOMMethods,typescriptDOMProperties,typescriptHtmlElemAttrs,typescriptHtmlElemFuncs,typescriptHtmlElemProperties,typescriptAjaxProperties,typescriptAjaxMethods,typescriptPropietaryMethods,typescriptEventListenerMethods skipwhite skipnl +syntax match typescriptDotNotation "\.style\." nextgroup=typescriptCssStyles +"}}} + +"" end DOM/HTML/CSS specified things""}}} + + +"" Code blocks +syntax cluster typescriptAll contains=typescriptComment,typescriptLineComment,typescriptDocComment,typescriptStringD,typescriptStringS,typescriptStringB,typescriptRegexpString,typescriptNumber,typescriptFloat,typescriptDecorators,typescriptLabel,typescriptSource,typescriptType,typescriptOperator,typescriptBoolean,typescriptNull,typescriptFuncKeyword,typescriptConditional,typescriptGlobal,typescriptRepeat,typescriptBranch,typescriptStatement,typescriptGlobalObjects,typescriptMessage,typescriptIdentifier,typescriptStorageClass,typescriptExceptions,typescriptReserved,typescriptDeprecated,typescriptDomErrNo,typescriptDomNodeConsts,typescriptHtmlEvents,typescriptDotNotation,typescriptBrowserObjects,typescriptDOMObjects,typescriptAjaxObjects,typescriptPropietaryObjects,typescriptDOMMethods,typescriptHtmlElemProperties,typescriptDOMProperties,typescriptEventListenerKeywords,typescriptEventListenerMethods,typescriptAjaxProperties,typescriptAjaxMethods,typescriptFuncArg,typescriptGlobalNodeObjects + +if main_syntax == "typescript" + syntax sync clear + syntax sync ccomment typescriptComment minlines=200 +" syntax sync match typescriptHighlight grouphere typescriptBlock /{/ +endif + +syntax keyword typescriptFuncKeyword function +"syntax region typescriptFuncDef start="function" end="\(.*\)" contains=typescriptFuncKeyword,typescriptFuncArg keepend +"syntax match typescriptFuncArg "\(([^()]*)\)" contains=typescriptParens,typescriptFuncComma contained +"syntax match typescriptFuncComma /,/ contained +" syntax region typescriptFuncBlock contained matchgroup=typescriptFuncBlock start="{" end="}" contains=@typescriptAll,typescriptParensErrA,typescriptParensErrB,typescriptParen,typescriptBracket,typescriptBlock fold + +syn match typescriptBraces "[{}\[\]]" +syn match typescriptParens "[()]" +syn match typescriptEndColons "[;,]" +syn match typescriptLogicSymbols "\(&&\)\|\(||\)\|\(!\)" +syn match typescriptOpSymbols "=\{1,3}\|!==\|!=\|<\|>\|>=\|<=\|++\|+=\|--\|-=" + +" typescriptFold Function {{{ + +" function! typescriptFold() + +" skip curly braces inside RegEx's and comments +syn region foldBraces start=/{/ skip=/\(\/\/.*\)\|\(\/.*\/\)/ end=/}/ transparent fold keepend extend + +" setl foldtext=FoldText() +" endfunction + +" au FileType typescript call typescriptFold() + +" }}} + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already by this script +" For version 5.8 and later: only when an item doesn't have highlighting yet +" For version 8.1.1486 and later: only when not done already by this script (need to override vim's new typescript support) +if version >= 508 || !exists("did_typescript_syn_inits") + if version < 508 || has('patch-8.1.1486') + let did_typescript_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + "typescript highlighting + HiLink typescriptParameters Operator + HiLink typescriptSuperBlock Operator + + HiLink typescriptEndColons Exception + HiLink typescriptOpSymbols Operator + HiLink typescriptLogicSymbols Boolean + HiLink typescriptBraces Function + HiLink typescriptParens Operator + HiLink typescriptComment Comment + HiLink typescriptLineComment Comment + HiLink typescriptRefComment Include + HiLink typescriptRefS String + HiLink typescriptRefD String + HiLink typescriptDocComment Comment + HiLink typescriptCommentTodo Todo + HiLink typescriptCvsTag Function + HiLink typescriptDocTags Special + HiLink typescriptDocSeeTag Function + HiLink typescriptDocParam Function + HiLink typescriptStringS String + HiLink typescriptStringD String + HiLink typescriptStringB String + HiLink typescriptInterpolationDelimiter Delimiter + HiLink typescriptRegexpString String + HiLink typescriptGlobal Constant + HiLink typescriptCharacter Character + HiLink typescriptPrototype Type + HiLink typescriptConditional Conditional + HiLink typescriptBranch Conditional + HiLink typescriptIdentifier Identifier + HiLink typescriptStorageClass StorageClass + HiLink typescriptRepeat Repeat + HiLink typescriptStatement Statement + HiLink typescriptFuncKeyword Keyword + HiLink typescriptMessage Keyword + HiLink typescriptDeprecated Exception + HiLink typescriptError Error + HiLink typescriptParensError Error + HiLink typescriptParensErrA Error + HiLink typescriptParensErrB Error + HiLink typescriptParensErrC Error + HiLink typescriptReserved Keyword + HiLink typescriptOperator Operator + HiLink typescriptType Type + HiLink typescriptNull Type + HiLink typescriptNumber Number + HiLink typescriptFloat Number + HiLink typescriptDecorators Special + HiLink typescriptBoolean Boolean + HiLink typescriptLabel Label + HiLink typescriptSpecial Special + HiLink typescriptSource Special + HiLink typescriptGlobalObjects Special + HiLink typescriptGlobalNodeObjects Special + HiLink typescriptExceptions Special + + HiLink typescriptDomErrNo Constant + HiLink typescriptDomNodeConsts Constant + HiLink typescriptDomElemAttrs Label + HiLink typescriptDomElemFuncs PreProc + + HiLink typescriptHtmlElemAttrs Label + HiLink typescriptHtmlElemFuncs PreProc + + HiLink typescriptCssStyles Label + + " Ajax Highlighting + HiLink typescriptBrowserObjects Constant + + HiLink typescriptDOMObjects Constant + HiLink typescriptDOMMethods Function + HiLink typescriptDOMProperties Special + + HiLink typescriptAjaxObjects Constant + HiLink typescriptAjaxMethods Function + HiLink typescriptAjaxProperties Special + + HiLink typescriptFuncDef Title + HiLink typescriptFuncArg Special + HiLink typescriptFuncComma Operator + + HiLink typescriptHtmlEvents Special + HiLink typescriptHtmlElemProperties Special + + HiLink typescriptEventListenerKeywords Keyword + + HiLink typescriptNumber Number + HiLink typescriptPropietaryObjects Constant + + delcommand HiLink +endif + +" Define the htmltypescript for HTML syntax html.vim +"syntax clear htmltypescript +"syntax clear typescriptExpression +syntax cluster htmltypescript contains=@typescriptAll,typescriptBracket,typescriptParen,typescriptBlock,typescriptParenError +syntax cluster typescriptExpression contains=@typescriptAll,typescriptBracket,typescriptParen,typescriptBlock,typescriptParenError,@htmlPreproc + +let b:current_syntax = "typescript" +if main_syntax == 'typescript' + unlet main_syntax +endif + +" vim: ts=4 diff --git a/sources_non_forked/typescript-vim/syntax/typescriptreact.vim b/sources_non_forked/typescript-vim/syntax/typescriptreact.vim new file mode 100644 index 00000000..8fc4480f --- /dev/null +++ b/sources_non_forked/typescript-vim/syntax/typescriptreact.vim @@ -0,0 +1 @@ +runtime! syntax/typescript.vim diff --git a/sources_non_forked/typescript-vim/vimshot01.png b/sources_non_forked/typescript-vim/vimshot01.png new file mode 100644 index 00000000..7c2627f9 Binary files /dev/null and b/sources_non_forked/typescript-vim/vimshot01.png differ diff --git a/sources_non_forked/vim-abolish/.github/FUNDING.yml b/sources_non_forked/vim-abolish/.github/FUNDING.yml new file mode 100644 index 00000000..e2a49d11 --- /dev/null +++ b/sources_non_forked/vim-abolish/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: tpope +custom: ["https://www.paypal.me/vimpope"] diff --git a/sources_non_forked/vim-abolish/plugin/abolish.vim b/sources_non_forked/vim-abolish/plugin/abolish.vim index 4a97542e..4be1122d 100644 --- a/sources_non_forked/vim-abolish/plugin/abolish.vim +++ b/sources_non_forked/vim-abolish/plugin/abolish.vim @@ -215,7 +215,6 @@ function! s:SubComplete(A,L,P) endfunction function! s:Complete(A,L,P) - let g:L = a:L " Vim bug: :Abolish - calls this function with a:A equal to 0 if a:A =~# '^[^/?-]' && type(a:A) != type(0) return join(s:words(),"\n") @@ -285,7 +284,7 @@ function! s:parse_subvert(bang,line1,line2,count,args) else let args = a:args endif - let separator = matchstr(args,'^.') + let separator = '\v((\\)@ 0 let c -= 1 if a:type ==# 'line' @@ -603,9 +603,6 @@ function! s:coerce(type) abort silent exe 'normal!' move.'y' let word = @@ let @@ = s:send(g:Abolish.Coercions,s:transformation,word) - if !exists('begin') - let begin = getpos("'[") - endif if word !=# @@ let changed = 1 exe 'normal!' move.'p' @@ -621,8 +618,8 @@ function! s:coerce(type) abort endfunction nnoremap (abolish-coerce) coerce(nr2char(getchar())) -nnoremap (abolish-coerce) coerce(nr2char(getchar())) -nnoremap (abolish-coerce-word) coerce(nr2char(getchar())).'iw' +vnoremap (abolish-coerce) coerce(nr2char(getchar())) +nnoremap (abolish-coerce-word) coerce(nr2char(getchar())).'iw' " }}}1 diff --git a/sources_non_forked/vim-addon-mw-utils/autoload/glob_linux.vim b/sources_non_forked/vim-addon-mw-utils/autoload/glob_linux.vim index 6fd3f044..e93820c2 100644 --- a/sources_non_forked/vim-addon-mw-utils/autoload/glob_linux.vim +++ b/sources_non_forked/vim-addon-mw-utils/autoload/glob_linux.vim @@ -2,7 +2,8 @@ " TODO refactor: create glob function " noremap \og :callglob_linux#FileByGlobCurrentDir('**/*'.input('glob open '),"\\.git\\\\.hg\\node_modules\\\\.pyc" ) " noremap \og :callglob_linux#FileByGlobCurrentDir('**/*'.input('glob open '),"default" ) -function! glob_linux#FileByGlobCurrentDir(glob, exclude_pattern) +function! glob_linux#FileByGlobCurrentDir(glob, exclude_pattern, ...) + let opts = a:0 > 0 ? a:1 : {} if a:exclude_pattern == "default" let exclude_pattern = '\.git\|\.hg\|node_modules\|\.pyc' else @@ -16,7 +17,7 @@ function! glob_linux#FileByGlobCurrentDir(glob, exclude_pattern) let exclude = exclude_pattern == '' ? '' : ' | grep -v -e '.shellescape(exclude_pattern) - let cmd = 'find | grep -e '.shellescape(g).exclude + let cmd = get(opts, 'cmd_find', 'find'). ' . | grep -e '.shellescape(g).exclude let files = split(system(cmd),"\n") " for nom in a:excludes " call filter(files,nom) diff --git a/sources_non_forked/vim-bundle-mako/ftplugin/mako.vim b/sources_non_forked/vim-bundle-mako/ftplugin/mako.vim index 41be4705..565defc7 100644 --- a/sources_non_forked/vim-bundle-mako/ftplugin/mako.vim +++ b/sources_non_forked/vim-bundle-mako/ftplugin/mako.vim @@ -1,11 +1,19 @@ " Vim filetype plugin file " Language: Mako " Maintainer: Randy Stauner -" Last Change: 2014-02-07 -" Version: 0.1 +" Last Change: 2019-09-06 +" Version: 0.2 if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 setlocal comments=:## setlocal commentstring=##%s + +if exists("loaded_matchit") + let b:match_ignorecase = 1 + let b:match_words = "<:>," . + \ "<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>," . + \ "<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>," . + \ "<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>" +endif diff --git a/sources_non_forked/vim-bundle-mako/indent/mako.vim b/sources_non_forked/vim-bundle-mako/indent/mako.vim index 4433cc4a..f1f9482a 100644 --- a/sources_non_forked/vim-bundle-mako/indent/mako.vim +++ b/sources_non_forked/vim-bundle-mako/indent/mako.vim @@ -170,66 +170,101 @@ endfun " [-- --] call HtmlIndentPush('a') call HtmlIndentPush('abbr') -call HtmlIndentPush('acronym') call HtmlIndentPush('address') +call HtmlIndentPush('applet') +call HtmlIndentPush('article') +call HtmlIndentPush('aside') +call HtmlIndentPush('audio') call HtmlIndentPush('b') +call HtmlIndentPush('bdi') call HtmlIndentPush('bdo') -call HtmlIndentPush('big') call HtmlIndentPush('blockquote') call HtmlIndentPush('button') +call HtmlIndentPush('canvas') call HtmlIndentPush('caption') -call HtmlIndentPush('center') call HtmlIndentPush('cite') call HtmlIndentPush('code') call HtmlIndentPush('colgroup') +call HtmlIndentPush('content') +call HtmlIndentPush('data') +call HtmlIndentPush('datalist') call HtmlIndentPush('del') +call HtmlIndentPush('details') call HtmlIndentPush('dfn') +call HtmlIndentPush('dialog') call HtmlIndentPush('dir') call HtmlIndentPush('div') call HtmlIndentPush('dl') +call HtmlIndentPush('element') call HtmlIndentPush('em') call HtmlIndentPush('fieldset') -call HtmlIndentPush('font') +call HtmlIndentPush('figcaption') +call HtmlIndentPush('figure') +call HtmlIndentPush('footer') call HtmlIndentPush('form') -call HtmlIndentPush('frameset') call HtmlIndentPush('h1') call HtmlIndentPush('h2') call HtmlIndentPush('h3') call HtmlIndentPush('h4') call HtmlIndentPush('h5') call HtmlIndentPush('h6') +call HtmlIndentPush('header') +call HtmlIndentPush('hgroup') call HtmlIndentPush('i') call HtmlIndentPush('iframe') call HtmlIndentPush('ins') call HtmlIndentPush('kbd') call HtmlIndentPush('label') call HtmlIndentPush('legend') +call HtmlIndentPush('li') +call HtmlIndentPush('main') call HtmlIndentPush('map') +call HtmlIndentPush('mark') +call HtmlIndentPush('MediaStream') call HtmlIndentPush('menu') -call HtmlIndentPush('noframes') +call HtmlIndentPush('menuitem') +call HtmlIndentPush('meter') +call HtmlIndentPush('nav') +call HtmlIndentPush('noembed') call HtmlIndentPush('noscript') call HtmlIndentPush('object') call HtmlIndentPush('ol') call HtmlIndentPush('optgroup') +call HtmlIndentPush('option') +call HtmlIndentPush('output') +call HtmlIndentPush('picture') call HtmlIndentPush('pre') +call HtmlIndentPush('progress') call HtmlIndentPush('q') +call HtmlIndentPush('rb') +call HtmlIndentPush('rp') +call HtmlIndentPush('rt') +call HtmlIndentPush('rtc') +call HtmlIndentPush('ruby') call HtmlIndentPush('s') call HtmlIndentPush('samp') call HtmlIndentPush('script') +call HtmlIndentPush('section') call HtmlIndentPush('select') +call HtmlIndentPush('shadow') +call HtmlIndentPush('slot') call HtmlIndentPush('small') call HtmlIndentPush('span') call HtmlIndentPush('strong') call HtmlIndentPush('style') call HtmlIndentPush('sub') +call HtmlIndentPush('summary') call HtmlIndentPush('sup') call HtmlIndentPush('table') +call HtmlIndentPush('template') call HtmlIndentPush('textarea') +call HtmlIndentPush('time') call HtmlIndentPush('title') call HtmlIndentPush('tt') call HtmlIndentPush('u') call HtmlIndentPush('ul') call HtmlIndentPush('var') +call HtmlIndentPush('video') " For some reason the default HTML indentation script doesn't consider these " elements to be worthy of indentation. @@ -256,6 +291,44 @@ if !exists('g:html_indent_strict_table') call HtmlIndentPush('thead') endif +" [-- --] +call HtmlIndentPush('abbr') +call HtmlIndentPush('acronym') +call HtmlIndentPush('applet') +call HtmlIndentPush('audio') +call HtmlIndentPush('basefont') +call HtmlIndentPush('bgsound') +call HtmlIndentPush('big') +call HtmlIndentPush('blink') +call HtmlIndentPush('center') +call HtmlIndentPush('command') +call HtmlIndentPush('content') +call HtmlIndentPush('dir') +call HtmlIndentPush('element') +call HtmlIndentPush('embed') +call HtmlIndentPush('font') +call HtmlIndentPush('frame') +call HtmlIndentPush('frameset') +call HtmlIndentPush('image') +call HtmlIndentPush('img') +call HtmlIndentPush('isindex') +call HtmlIndentPush('keygen') +call HtmlIndentPush('listing') +call HtmlIndentPush('marquee') +call HtmlIndentPush('menuitem') +call HtmlIndentPush('multicol') +call HtmlIndentPush('nextid') +call HtmlIndentPush('nobr') +call HtmlIndentPush('noembed') +call HtmlIndentPush('noframes') +call HtmlIndentPush('object') +call HtmlIndentPush('plaintext') +call HtmlIndentPush('shadow') +call HtmlIndentPush('spacer') +call HtmlIndentPush('strike') +call HtmlIndentPush('tt') +call HtmlIndentPush('xmp') + " [-- --] call MakoIndentPush('%def') call MakoIndentPush('%block') diff --git a/sources_non_forked/vim-coffee-script/ftdetect/coffee.vim b/sources_non_forked/vim-coffee-script/ftdetect/coffee.vim index e6c4d698..4e5285d1 100644 --- a/sources_non_forked/vim-coffee-script/ftdetect/coffee.vim +++ b/sources_non_forked/vim-coffee-script/ftdetect/coffee.vim @@ -7,6 +7,7 @@ autocmd BufNewFile,BufRead *.coffee set filetype=coffee autocmd BufNewFile,BufRead *Cakefile set filetype=coffee autocmd BufNewFile,BufRead *.coffeekup,*.ck set filetype=coffee autocmd BufNewFile,BufRead *._coffee set filetype=coffee +autocmd BufNewFile,BufRead *.cson set filetype=coffee function! s:DetectCoffee() if getline(1) =~ '^#!.*\' diff --git a/sources_non_forked/vim-commentary/.github/FUNDING.yml b/sources_non_forked/vim-commentary/.github/FUNDING.yml new file mode 100644 index 00000000..e2a49d11 --- /dev/null +++ b/sources_non_forked/vim-commentary/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: tpope +custom: ["https://www.paypal.me/vimpope"] diff --git a/sources_non_forked/vim-commentary/doc/commentary.txt b/sources_non_forked/vim-commentary/doc/commentary.txt index b0485694..01f73dad 100644 --- a/sources_non_forked/vim-commentary/doc/commentary.txt +++ b/sources_non_forked/vim-commentary/doc/commentary.txt @@ -6,6 +6,9 @@ License: Same terms as Vim itself (see |license|) Comment stuff out. Then uncomment it later. Relies on 'commentstring' to be correctly set, or uses b:commentary_format if it is set. +Assign b:commentary_startofline to insert comment characters at column 1 +regardless of indentation. + *gc* gc{motion} Comment or uncomment lines that {motion} moves over. diff --git a/sources_non_forked/vim-commentary/plugin/commentary.vim b/sources_non_forked/vim-commentary/plugin/commentary.vim index 862ca820..2c81622a 100644 --- a/sources_non_forked/vim-commentary/plugin/commentary.vim +++ b/sources_non_forked/vim-commentary/plugin/commentary.vim @@ -36,6 +36,7 @@ function! s:go(...) abort let [l, r] = s:surroundings() let uncomment = 2 + let force_uncomment = a:0 > 2 && a:3 for lnum in range(lnum1,lnum2) let line = matchstr(getline(lnum),'\S.*\s\@ 2 && l.r !~# '\\' let line = substitute(line, - \'\M'.r[0:-2].'\zs\d\*\ze'.r[-1:-1].'\|'.l[0].'\zs\d\*\ze'.l[1:-1], + \'\M' . substitute(l, '\ze\S\s*$', '\\zs\\d\\*\\ze', '') . '\|' . substitute(r, '\S\zs', '\\zs\\d\\*\\ze', ''), \'\=substitute(submatch(0)+1-uncomment,"^0$\\|^-\\d*$","","")','g') endif - if uncomment + if force_uncomment + if line =~ '^\s*' . l + let line = substitute(line,'\S.*\s\@,) +command! -range -bar -bang Commentary call s:go(,,0) xnoremap Commentary go() nnoremap Commentary go() nnoremap CommentaryLine go() . '_' diff --git a/sources_non_forked/vim-flake8/README.mdown b/sources_non_forked/vim-flake8/README.mdown index d4c58111..338e4450 100644 --- a/sources_non_forked/vim-flake8/README.mdown +++ b/sources_non_forked/vim-flake8/README.mdown @@ -47,7 +47,7 @@ If you don't want to use the `` key for flake8-checking, simply remap it to another key. It autodetects whether it has been remapped and won't register the `` key if so. For example, to remap it to `` instead, use: - autocmd FileType python map :call Flake8() + autocmd FileType python map :call flake8#Flake8() For flake8 configuration options please consult the following page: @@ -104,13 +104,19 @@ To customize the colors used for markers, define the highlight groups, `Flake8_E highlight link Flake8_Naming WarningMsg highlight link Flake8_PyFlake WarningMsg +To show the error message of the current line in the ruler, call `flake8#ShowError()`: + + " add binding to call the function + nnoremap :call flake8#Flake8ShowError() + + Tips ---- A tip might be to run the Flake8 check every time you write a Python file, to enable this, add the following line to your `.vimrc` file (thanks [Godefroid](https://github.com/gotcha)!): - autocmd BufWritePost *.py call Flake8() + autocmd BufWritePost *.py call flake8#Flake8() This plugin goes well together with the following plugin: diff --git a/sources_non_forked/vim-flake8/autoload/flake8.vim b/sources_non_forked/vim-flake8/autoload/flake8.vim index cf592cf7..c407b9be 100644 --- a/sources_non_forked/vim-flake8/autoload/flake8.vim +++ b/sources_non_forked/vim-flake8/autoload/flake8.vim @@ -20,6 +20,10 @@ function! flake8#Flake8UnplaceMarkers() call s:Warnings() endfunction +function! flake8#Flake8ShowError() + call s:ShowErrorMessage() +endfunction + "" }}} "" ** internal ** {{{ @@ -101,6 +105,7 @@ function! s:Setup() " {{{ let s:markerdata['F'].marker = s:flake8_pyflake_marker let s:markerdata['C'].marker = s:flake8_complexity_marker let s:markerdata['N'].marker = s:flake8_naming_marker + endfunction " }}} "" do flake8 @@ -141,7 +146,7 @@ function! s:Flake8() " {{{ set t_te= " perform the grep itself - let &grepformat="%f:%l:%c: %m\,%f:%l: %m" + let &grepformat="%f:%l:%c: %m\,%f:%l: %m,%-G%\\d" let &grepprg=s:flake8_cmd silent! grep! "%" " close any existing cwindows, @@ -154,11 +159,20 @@ function! s:Flake8() " {{{ let &shellpipe=l:old_shellpipe let &t_ti=l:old_t_ti let &t_te=l:old_t_te + " store mapping of line number to error string " process results + let s:resultDict = {} + let l:results=getqflist() let l:has_results=results != [] if l:has_results + " save line number of each error message + for result in l:results + let linenum = result.lnum + let s:resultDict[linenum] = result.text + endfor + " markers if !s:flake8_show_in_gutter == 0 || !s:flake8_show_in_file == 0 call s:PlaceMarkers(l:results) @@ -184,8 +198,9 @@ function! s:Flake8() " {{{ endif endfunction " }}} -"" markers + +"" markers function! s:PlaceMarkers(results) " {{{ " in gutter? if !s:flake8_show_in_gutter == 0 @@ -253,8 +268,34 @@ function! s:UnplaceMarkers() " {{{ endfor endfunction " }}} +function! s:ShowErrorMessage() " {{{ + let l:cursorPos = getpos(".") + if !exists('s:resultDict') + return + endif + if !exists('b:showing_message') + " ensure showing msg is always defined + let b:showing_message = ' ' + endif + + " if there is a message on the current line, + " then echo it + if has_key(s:resultDict, l:cursorPos[1]) + let l:errorText = get(s:resultDict, l:cursorPos[1]) + echo strpart(l:errorText, 0, &columns-1) + let b:showing_message = 1 + endif + + " if a message is already being shown, + " then clear it + if !b:showing_message == 0 + echo + let b:showing_message = 0 + endif + +endfunction " }}} + "" }}} let &cpo = s:save_cpo unlet s:save_cpo - diff --git a/sources_non_forked/vim-fugitive/autoload/fugitive.vim b/sources_non_forked/vim-fugitive/autoload/fugitive.vim index 8e68428c..5366c489 100644 --- a/sources_non_forked/vim-fugitive/autoload/fugitive.vim +++ b/sources_non_forked/vim-fugitive/autoload/fugitive.vim @@ -1,19 +1,18 @@ " Location: autoload/fugitive.vim " Maintainer: Tim Pope +" The functions contained within this file are for internal use only. For the +" official API, see the commented functions in plugin/fugitive.vim. + if exists('g:autoloaded_fugitive') finish endif let g:autoloaded_fugitive = 1 -if !exists('g:fugitive_git_executable') - let g:fugitive_git_executable = 'git' -endif - " Section: Utility function! s:function(name) abort - return function(substitute(a:name,'^s:',matchstr(expand(''), '\d\+_'),'')) + return function(substitute(a:name,'^s:',matchstr(expand(''), '.*\zs\d\+_'),'')) endfunction function! s:sub(str,pat,rep) abort @@ -39,15 +38,35 @@ function! s:Uniq(list) abort return a:list endfunction +function! s:JoinChomp(list) abort + if empty(a:list[-1]) + return join(a:list[0:-2], "\n") + else + return join(a:list, "\n") + endif +endfunction + function! s:winshell() abort return has('win32') && &shellcmdflag !~# '^-' endfunction +function! s:WinShellEsc(arg) abort + if type(a:arg) == type([]) + return join(map(copy(a:arg), 's:WinShellEsc(v:val)')) + elseif a:arg =~# '^[A-Za-z0-9_/:.-]\+$' + return a:arg + else + return '"' . s:gsub(s:gsub(a:arg, '"', '""'), '\%', '"%"') . '"' + endif +endfunction + function! s:shellesc(arg) abort - if a:arg =~ '^[A-Za-z0-9_/.-]\+$' + if type(a:arg) == type([]) + return join(map(copy(a:arg), 's:shellesc(v:val)')) + elseif a:arg =~# '^[A-Za-z0-9_/:.-]\+$' return a:arg elseif s:winshell() - return '"'.s:gsub(s:gsub(a:arg, '"', '""'), '\%', '"%"').'"' + return '"' . s:gsub(s:gsub(a:arg, '"', '""'), '\%', '"%"') . '"' else return shellescape(a:arg) endif @@ -55,7 +74,9 @@ endfunction let s:fnameescape = " \t\n*?[{`$\\%#'\"|!<" function! s:fnameescape(file) abort - if exists('*fnameescape') + if type(a:file) == type([]) + return join(map(copy(a:file), 's:fnameescape(v:val)')) + elseif exists('*fnameescape') return fnameescape(a:file) else return escape(a:file, s:fnameescape) @@ -63,61 +84,90 @@ function! s:fnameescape(file) abort endfunction function! s:throw(string) abort - let v:errmsg = 'fugitive: '.a:string - throw v:errmsg + throw 'fugitive: '.a:string endfunction -function! s:warn(str) abort - echohl WarningMsg - echomsg a:str - echohl None - let v:warningmsg = a:str +function! s:VersionCheck() abort + if v:version < 703 + return 'return ' . string('echoerr "fugitive: Vim 7.3 or newer required"') + elseif empty(fugitive#GitVersion()) + let exe = get(s:GitCmd(), 0, '') + if len(exe) && !executable(exe) + return 'return ' . string('echoerr "fugitive: cannot find ' . string(exe) . ' in PATH"') + endif + return 'return ' . string('echoerr "fugitive: cannot execute Git"') + elseif !fugitive#GitVersion(1, 8, 5) + return 'return ' . string('echoerr "fugitive: Git 1.8.5 or newer required"') + else + return '' + endif endfunction -function! s:Slash(path) abort - if exists('+shellslash') +let s:worktree_error = "core.worktree is required when using an external Git dir" +function! s:DirCheck(...) abort + let vcheck = s:VersionCheck() + if !empty(vcheck) + return vcheck + endif + let dir = call('FugitiveGitDir', a:000) + if !empty(dir) && FugitiveWorkTree(dir, 1) is# 0 + return 'return ' . string('echoerr "fugitive: ' . s:worktree_error . '"') + elseif !empty(dir) + return '' + elseif empty(bufname('')) + return 'return ' . string('echoerr "fugitive: working directory does not belong to a Git repository"') + else + return 'return ' . string('echoerr "fugitive: file does not belong to a Git repository"') + endif +endfunction + +function! s:Mods(mods, ...) abort + let mods = substitute(a:mods, '\C', '', '') + let mods = mods =~# '\S$' ? mods . ' ' : mods + if a:0 && mods !~# '\<\%(aboveleft\|belowright\|leftabove\|rightbelow\|topleft\|botright\|tab\)\>' + if a:1 ==# 'Edge' + if mods =~# '\' ? &splitright : &splitbelow + let mods = 'botright ' . mods + else + let mods = 'topleft ' . mods + endif + else + let mods = a:1 . ' ' . mods + endif + endif + return substitute(mods, '\s\+', ' ', 'g') +endfunction + +if exists('+shellslash') + function! s:Slash(path) abort return tr(a:path, '\', '/') - else + endfunction +else + function! s:Slash(path) abort return a:path - endif -endfunction - -function! s:PlatformSlash(path) abort - if exists('+shellslash') && !&shellslash - return tr(a:path, '/', '\') - else - return a:path - endif -endfunction + endfunction +endif function! s:Resolve(path) abort let path = resolve(a:path) if has('win32') - let path = s:PlatformSlash(fnamemodify(fnamemodify(path, ':h'), ':p') . fnamemodify(path, ':t')) + let path = FugitiveVimPath(fnamemodify(fnamemodify(path, ':h'), ':p') . fnamemodify(path, ':t')) endif return path endfunction -function! s:cpath(path, ...) abort - if exists('+fileignorecase') && &fileignorecase - let path = s:PlatformSlash(tolower(a:path)) - else - let path = s:PlatformSlash(a:path) - endif - return a:0 ? path ==# s:cpath(a:1) : path +function! s:FileIgnoreCase(for_completion) abort + return (exists('+fileignorecase') && &fileignorecase) + \ || (a:for_completion && exists('+wildignorecase') && &wildignorecase) endfunction -function! s:Cd(...) abort - let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : exists(':tcd') && haslocaldir(-1) ? 'tcd' : 'cd' - if !a:0 - return cd +function! s:cpath(path, ...) abort + if s:FileIgnoreCase(0) + let path = FugitiveVimPath(tolower(a:path)) + else + let path = FugitiveVimPath(a:path) endif - let cwd = getcwd() - if s:cpath(cwd, a:1) - return '' - endif - exe cd s:fnameescape(a:1) - return cd . ' ' . s:fnameescape(cwd) + return a:0 ? path ==# s:cpath(a:1) : path endfunction let s:executables = {} @@ -129,64 +179,279 @@ function! s:executable(binary) abort return s:executables[a:binary] endfunction -function! s:map(mode, lhs, rhs, ...) abort - let flags = (a:0 ? a:1 : '') . (a:rhs =~# '' ? '' : ' snippet scripts diff --git a/sources_non_forked/vim-snippets/snippets/java.snippets b/sources_non_forked/vim-snippets/snippets/java.snippets index 66821c16..739f20b7 100644 --- a/sources_non_forked/vim-snippets/snippets/java.snippets +++ b/sources_non_forked/vim-snippets/snippets/java.snippets @@ -175,9 +175,9 @@ snippet tryf ## ## Find Methods snippet findall - List<${1:listName}> ${2:items} = ${1}.findAll(); + List<${1:listName}> ${2:items} = $1.findAll(); snippet findbyid - ${1:var} ${2:item} = ${1}.findById(${3}); + ${1:var} ${2:item} = $1.findById(${3}); ## ## Javadocs snippet /** diff --git a/sources_non_forked/vim-snippets/snippets/javascript-es6-react.snippets b/sources_non_forked/vim-snippets/snippets/javascript-es6-react.snippets deleted file mode 100644 index c9138752..00000000 --- a/sources_non_forked/vim-snippets/snippets/javascript-es6-react.snippets +++ /dev/null @@ -1,82 +0,0 @@ -# Import only React -snippet ri1 - import React from 'react' - -# Import both React and Component -snippet ri2 - import React, { Component } from 'react' - import PropTypes from 'prop-types' - -# React class -snippet rcla - class ${1:MyComponent} extends Component { - render() { - return ( - ${0:
} - ) - } - } - -# React constructor -snippet rcon - constructor(props) { - super(props) - - this.state = { - ${1}: ${0}, - } - } - -# Proptypes for React Class -snippet rcpt - static propTypes = { - ${1}: PropTypes.${0}, - } - -# Default props for React Class -snippet rcdp - static defaultProps = { - ${1}: ${0}, - } - -# Presentational component -snippet rcom - props => { - return ( - ${0:
} - ) - } - -# Proptypes for Presentational component -snippet rpt - ${1}.propTypes = { - ${2}: PropTypes.${0}, - } - -# Default props for Presentational component -snippet rdp - ${1}.defaultProps = { - ${2}: ${0}, - } - -# Lifecycle Methods -snippet rcdm - componentDidMount() { - ${0:${VISUAL}} - } - -# State -snippet rsst - this.setState({ - ${1}: ${0}, - }) - -snippet rtst - this.state.${0} - -# Props -snippet rp - props.${0} - -snippet rtp - this.props.${0} diff --git a/sources_non_forked/vim-snippets/snippets/javascript/javascript-jasmine.snippets b/sources_non_forked/vim-snippets/snippets/javascript-jasmine.snippets similarity index 100% rename from sources_non_forked/vim-snippets/snippets/javascript/javascript-jasmine.snippets rename to sources_non_forked/vim-snippets/snippets/javascript-jasmine.snippets diff --git a/sources_non_forked/vim-snippets/snippets/javascript/javascript-react.snippets b/sources_non_forked/vim-snippets/snippets/javascript/javascript-react.snippets index 011c5c1f..65cb4e1d 100644 --- a/sources_non_forked/vim-snippets/snippets/javascript/javascript-react.snippets +++ b/sources_non_forked/vim-snippets/snippets/javascript/javascript-react.snippets @@ -1,85 +1,190 @@ -snippet ir +# Import +snippet ir import React import React from 'react'; -snippet irc - import React, {Component} from 'react'; -snippet ird + +snippet irc import React and Component + import React, { Component } from 'react'; + +snippet irh import React hooks + import { use$1 } from 'react'; + +snippet ird import ReactDOM import ReactDOM from 'react-dom'; -snippet cdm + +snippet irp import PropTypes + import PropTypes from 'prop-types'; + +# Lifecycle Methods +snippet cdm componentDidMount componentDidMount() { ${1} - } -snippet cdup + }; + +snippet cdup componentDidUpdate componentDidUpdate(prevProps, prevState) { ${1} - } -snippet cwm + }; + +snippet cwm componentWillMount componentWillMount() { ${1} - } -snippet cwr + }; + +snippet cwr componentWillReceiveProps componentWillReceiveProps(nextProps) { ${1} - } -snippet cwun + }; + +snippet cwun componentWillUnmount componentWillUnmount() { ${1} - } -snippet cwu + }; + +snippet cwu componentWillUpdate componentWillUpdate(nextProps, nextState) { ${1} + }; + +snippet scu shouldComponentUpdate + shouldComponentUpdate(nextProps, nextState) { + ${1} } -snippet fup - forceUpdate(${1:callback}); -snippet dp + +# Props +snippet spt static propTypes + static propTypes = { + ${1}: PropTypes.${2} + }; + +snippet pt propTypes + ${1}.propTypes = { + ${2}: PropTypes.${2} + }; + +snippet sdp static defaultProps static defaultProps = { - ${1}: ${2}, - } + ${1}: ${2} + }; + +snippet dp defaultProps + ${1}.defaultProps = { + ${2}: ${3} + }; + +snippet pp props + props.${1}; + +snippet tp this props + this.props.${1}; + +# State snippet st state = { ${1}: ${2}, - } -snippet pt - static propTypes = { - ${1}: React.PropTypes.${2:type}, - } -snippet rcc - class ${1:ClassName} extends React.Component { - render() { - return ( - ${0:
} - ); - } - } -snippet rdr - ReactDOM.render(${1}, ${2}) -snippet ercc - export default class ${1:ClassName} extends React.Component { - render() { - return ( - ${0:
} - ); - } - } -snippet ctor - constructor() { - super(); - ${1} - } -snippet ren - render() { - return ( - ${1:
} - ); - } + }; + snippet sst this.setState({ ${1}: ${2} }); -snippet scu - shouldComponentUpdate(nextProps, nextState) { - ${1} + +snippet tst + this.state.${1}; + +# Component +snippet raf + const ${1:ComponentName} = (${2:props}) => { + ${3:state} + + return ( + <> + ${4} + + ); + }; + +snippet rcla + class ${1:ClassName} extends Component { + render() { + return ( + <> + ${2} + + ); + } } -snippet prp i - this.props.${1} -snippet ste i - this.state.${1} + +snippet ercla + export default class ${1:ClassName} extends Component { + render() { + return ( + <> + ${2} + + ); + }; + }; + +snippet ctor + constructor() { + super(); + + ${1:state} + } + +snippet ren + render() { + return ( + <> + ${2} + + ); + } + +snippet fup + forceUpdate(${1:callback}); + +# Hooks +snippet uses useState + const [${1:state}, set${2}] = useState(${3:initialState}); + +snippet usee useEffect + useEffect(() => { + ${1} + }); + +snippet userd useReducer + const [${1:state}, ${2:dispatch}] = useReducer(${3:reducer}); + +snippet userf useRef + const ${1:refContainer} = useRef(${2:initialValue}); + +snippet usect useContext + const ${1:value} = useContext(${2:MyContext}); + +snippet usecb useCallback + const ${1:memoizedCallback} = useCallback( + () => { + ${2}(${3}) + }, + [$3] + ); + +snippet usem useMemo + const ${1:memoizedCallback} = useMemo(() => ${2}(${3}), [$3]); + +snippet usei useImperativeHandle + useImperativeHandle(${1:ref}, ${2:createHandle}); + +snippet used useDebugValue + useDebugValue(${1:value}); + +# ReactDOM methods +snippet rdr ReactDOM.render + ReactDOM.render(${1}, ${2}); + +snippet rdh ReactDOM.hydrate + ReactDOM.hydrate(${1:element}, ${2:container}[, ${3:callback}]); + +snippet rdcp ReactDOM.createPortal + ReactDOM.createPortal(${1:child}, ${2:container}); diff --git a/sources_non_forked/vim-snippets/snippets/javascript/javascript-redux.snippets b/sources_non_forked/vim-snippets/snippets/javascript/javascript-redux.snippets new file mode 100644 index 00000000..e13253c3 --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/javascript/javascript-redux.snippets @@ -0,0 +1,37 @@ +snippet ist + import { createStore } from 'redux'; +snippet con + connect(${1:mapStateToProps}, ${2:mapDispatchToProps})(<${3:VISUAL}/>); +snippet act + const ${1:actionName} = (${2:arg}) => { + return { + type: ${3:VISUAL}, + $2 + }; + }; +snippet rdc + const ${1:reducerName} = (state={}, action) => { + switch(action.type) { + case ${1:action}: + return { + ...state, + $2 + }; + default: + return state; + }; + }; +snippet mstp + const mapStateToProps = (state) => { + return { + ${1:propName}: state.$1, + }; + }; +snippet mdtp + const mapDispatchToProps = (dispatch) => { + return { + ${1:propName}: () => { + dispatch(${2:actionName}()); + }, + }; + }; diff --git a/sources_non_forked/vim-snippets/snippets/javascript/javascript.es6.snippets b/sources_non_forked/vim-snippets/snippets/javascript/javascript.es6.snippets deleted file mode 100644 index 7e885e6e..00000000 --- a/sources_non_forked/vim-snippets/snippets/javascript/javascript.es6.snippets +++ /dev/null @@ -1,55 +0,0 @@ -snippet const - const ${1} = ${0}; -snippet let - let ${1} = ${0}; -snippet im "import xyz from 'xyz'" - import ${1} from '${2:$1}'; -snippet imas "import * as xyz from 'xyz'" - import * as ${1} from '${2:$1}'; -snippet imm "import { member } from 'xyz'" - import { ${1} } from '${2}'; -snippet cla - class ${1} { - ${0:${VISUAL}} - } -snippet clax - class ${1} extends ${2} { - ${0:${VISUAL}} - } -snippet clac - class ${1} { - constructor(${2}) { - ${0:${VISUAL}} - } - } -snippet foro "for (const prop of object}) { ... }" - for (const ${1:prop} of ${2:object}) { - ${0:$1} - } -# Generator -snippet fun* - function* ${1:function_name}(${2}) { - ${0:${VISUAL}} - } -snippet c=> - const ${1:function_name} = (${2}) => { - ${0:${VISUAL}} - } -snippet caf - const ${1:function_name} = (${2}) => { - ${0:${VISUAL}} - } -snippet => - (${1}) => { - ${0:${VISUAL}} - } -snippet af - (${1}) => { - ${0:${VISUAL}} - } -snippet sym - const ${1} = Symbol('${0}'); -snippet ed - export default ${0} -snippet ${ - ${${1}}${0} diff --git a/sources_non_forked/vim-snippets/snippets/javascript/javascript.node.snippets b/sources_non_forked/vim-snippets/snippets/javascript/javascript.node.snippets index 489e0abb..52a2ba4c 100644 --- a/sources_non_forked/vim-snippets/snippets/javascript/javascript.node.snippets +++ b/sources_non_forked/vim-snippets/snippets/javascript/javascript.node.snippets @@ -5,7 +5,7 @@ snippet ex module.exports = ${1}; # require snippet re - ${1:const} ${2} = require('${3:module_name}'); + const ${1} = require('${2:module_name}'); # EventEmitter snippet on on('${1:event_name}', function(${2:stream}) { diff --git a/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets b/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets index 0dc5783e..9649bdce 100644 --- a/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets +++ b/sources_non_forked/vim-snippets/snippets/javascript/javascript.snippets @@ -5,10 +5,15 @@ snippet proto ${0:${VISUAL}} }; # Function -snippet fun +snippet fun "function" function ${1:function_name}(${2}) { ${0:${VISUAL}} } +# Asynchronous Function +snippet asf "async function" + async function ${1:function_name}(${2}) { + ${0:${VISUAL}} + } # Anonymous Function snippet anf "" w function(${1}) { @@ -94,11 +99,11 @@ snippet terr snippet ret return ${0:result}; snippet for "for (...) {...}" - for (var ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) { + for (let ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) { ${0:${VISUAL}} } snippet forr "reversed for (...) {...}" - for (var ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) { + for (let ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) { ${0:${VISUAL}} } snippet wh "(condition) { ... }" @@ -111,7 +116,7 @@ snippet do "do { ... } while (condition)" } while (${1:/* condition */}); # For in loop snippet fori - for (var ${1:prop} in ${2:object}) { + for (let ${1:prop} in ${2:object}) { ${0:$2[$1]} } # Objects @@ -202,8 +207,6 @@ snippet @par @param {${1:type}} ${2:name} ${0:description} snippet @ret @return {${1:type}} ${0:description} -# JSON - # JSON.parse snippet jsonp JSON.parse(${0:jstr}); @@ -272,10 +275,85 @@ snippet cprof "console.profile" console.profileEnd(); snippet ctable "console.table" console.table(${1:"${2:value}"}); +snippet clstr "console.log stringified" + console.log(JSON.stringify(${0}, null, 2)); # Misc -# 'use strict'; snippet us 'use strict'; # setTimeout function snippet timeout setTimeout(function () {${0}}${2}, ${1:10}); +snippet const + const ${1} = ${0}; +snippet constn + const ${1} = new ${0}; +snippet let + let ${1} = ${0}; +snippet im "import xyz from 'xyz'" + import ${1} from '${2:$1}'; +snippet imas "import * as xyz from 'xyz'" + import * as ${1} from '${2:$1}'; +snippet imm "import { member } from 'xyz'" + import { ${1} } from '${2}'; +snippet cla + class ${1} { + ${0:${VISUAL}} + } +snippet clax + class ${1} extends ${2} { + ${0:${VISUAL}} + } +snippet clac + class ${1} { + constructor(${2}) { + ${0:${VISUAL}} + } + } +snippet foro "for (const prop of object}) { ... }" + for (const ${1:prop} of ${2:object}) { + ${0:$1} + } +snippet forl "for (let prop of object}) { ... }" + for (let ${1:prop} of ${2:object}) { + ${0:$1} + } +snippet fun* + function* ${1:function_name}(${2}) { + ${0:${VISUAL}} + } +snippet c=> + const ${1:function_name} = (${2}) => { + ${0:${VISUAL}} + } +snippet ca=> + const ${1:function_name} = async (${2}) => { + ${0:${VISUAL}} + } +snippet caf + const ${1:function_name} = (${2}) => { + ${0:${VISUAL}} + } +snippet casf + const ${1:function_name} = async (${2}) => { + ${0:${VISUAL}} + } +snippet => + (${1}) => { + ${0:${VISUAL}} + } +snippet af "() =>" + (${1}) => ${0:${VISUAL}} +snippet afb "() => {}" + (${1}) => { + ${0:${VISUAL}} + } +snippet sym + const ${1} = Symbol('${0}'); +snippet ed + export default ${0} +snippet ${ + ${${1}}${0} +snippet as "async" + async ${0} +snippet aw "await" + await ${0:${VISUAL}} diff --git a/sources_non_forked/vim-snippets/snippets/julia.snippets b/sources_non_forked/vim-snippets/snippets/julia.snippets index 490d050d..1e0d3f2f 100644 --- a/sources_non_forked/vim-snippets/snippets/julia.snippets +++ b/sources_non_forked/vim-snippets/snippets/julia.snippets @@ -89,14 +89,26 @@ snippet thr throw ${0} # Messages -snippet in - info("${1}") - ${0} +snippet @i + @info "${1}" ${0} -snippet wa - warn("${1}") - ${0} +snippet @w + @warn "${1}" ${0} -snippet err - error("${1}") - ${0} +snippet @e + @error "${1}" ${0} + +snippet @d + @debug "${1}" ${0} + +snippet @t @testset with @test + @testset "${1}" begin + ${2} + @test ${0} + end + +snippet @tt @testset with @test_throws + @testset "${1}" begin + ${2} + @test_throws ${0} + end diff --git a/sources_non_forked/vim-snippets/snippets/liquid.snippets b/sources_non_forked/vim-snippets/snippets/liquid.snippets new file mode 100644 index 00000000..72a78d0e --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/liquid.snippets @@ -0,0 +1,472 @@ +# Port of Shopify Liquid Template Snippets +# https://marketplace.visualstudio.com/items?itemName=killalau.vscode-liquid-snippets + +snippet if + {% if ${1:condition} %} + ${0:${VISUAL}} + {% endif %} +snippet else + {% else %} +snippet elsif + {% elsif ${1:condition} %} +snippet ifelse + {% if ${1:condition} %} + ${2} + {% else %} + ${0} + {% endif %} +snippet unless + {% unless ${1:condition} %} + ${0:${VISUAL}} + {% endunless %} +snippet case + {% case ${1:variable} %} + {% when ${2:condition} %} + ${3} + {% else %} + ${0} + {% endcase %} +snippet when + {% when ${1:condition} %} + ${0:${VISUAL}} +snippet cycle + {% cycle '${1:odd}', '${2:even}' %} +snippet cyclegroup + {% cycle '${1:group name}': '${2:odd}', '${3:even}' %} +snippet for + {% for ${1:item} in ${2:collection} %} + ${0} + {% endfor %} +snippet limit + limit: ${1:5} +snippet offset + offset: ${1:0} +snippet reversed + reversed +snippet break + {% break %} +snippet continue + {% continue %} +snippet tablerow + {% tablerow ${1:item} in ${2:collection} cols: ${3:2} %} + ${0} + {% endtablerow %} +snippet assign + {% assign ${1:variable} = ${0:value} %} +snippet increment + {% increment ${0:variable} %} +snippet decrement + {% decrement ${0:variable} %} +snippet capture + {% capture ${1:variable} %}${0}{% endcapture %} +snippet include + {% include '${0:snippet}' %} +snippet includewith + {% include '${1:snippet}', ${2:variable}: ${0:value} %} +snippet render + {% render '${0:snippet}' %} +snippet renderwith + {% render '${1:snippet}', ${2:variable}: ${0:value} %} +snippet section + {% section '${1:snippet}' %} +snippet raw + {% raw %}${0}{% endraw %} +snippet layout + {% layout '${1:layout}' %} +snippet layoutnone + {% layout none %} +snippet paginate + {% paginate ${1:collection.products} by ${2:12} %} + {% for ${3:product} in $1 %} + ${0} + {% endfor %} + {% endpaginate %} +snippet schema + {% schema %} + { + ${0} + } + {% endschema %} +snippet stylesheet + {% stylesheet %} + ${0} + {% endstylesheet %} +snippet stylesheet_scss + {% stylesheet '${1:scss}' %} + ${0} + {% endstylesheet %} +snippet javascript + {% javascript %} + ${0} + {% endjavascript %} +snippet comment- + {%- comment -%}${0:${VISUAL}}{%- endcomment -%} +snippet if- + {%- if ${1:condition} -%} + ${0:${VISUAL}} + {%- endif -%} +snippet else- + {%- else -%} +snippet elsif- + {%- elsif ${1:condition} -%} +snippet ifelse- + {%- if ${1:condition} -%} + ${2} + {%- else -%} + ${0} + {%- endif -%} +snippet unless- + {%- unless ${1:condition} -%} + ${0:${VISUAL}} + {%- endunless -%} +snippet case- + {%- case ${1:variable} -%} + {%- when ${2:condition} -%} + ${3} + {%- else -%} + ${0} + {%- endcase -%} +snippet when- + {%- when ${1:condition} -%} + ${0:${VISUAL}} +snippet cycle- + {%- cycle '${1:odd}', '${2:even}' -%} +snippet cyclegroup- + {%- cycle '${1:group name}': '${2:odd}', '${3:even}' -%} +snippet for- + {%- for ${1:item} in ${2:collection} -%} + ${0} + {%- endfor -%} +snippet continue- + {%- continue -%} +snippet tablerow- + {%- tablerow ${1:item} in ${2:collection} cols: ${3:2} -%} + ${0} + {%- endtablerow -%} +snippet assign- + {%- assign ${1:variable} = ${0:value} -%} +snippet capture- + {%- capture ${1:variable} -%}${0}{%- endcapture -%} +snippet include- + {%- include '${0:snippet}' -%} +snippet includewith- + {%- include '${1:snippet}', ${2:variable}: ${0:value} -%} +snippet render- + {%- render '${0:snippet}' -%} +snippet renderwith- + {%- render '${1:snippet}', ${2:variable}: ${0:value} -%} +snippet section- + {%- section '${1:snippet}' -%} +snippet layout- + {%- layout '${1:layout}' -%} +snippet layoutnone- + {%- layout none -%} +snippet paginate- + {%- paginate ${1:collection.products} by ${2:12} -%} + {%- for ${3:product} in $1 -%} + ${0} + {%- endfor -%} + {%- endpaginate -%} +snippet join + | join: '${1:, }' +snippet first + | first +snippet last + | last +snippet concat + | concat: ${1:array} +snippet map + | map: '${1:key}' +snippet reverse + | reverse +snippet size + | size +snippet sort + | sort: '${1:key}' +snippet uniq + | uniq +snippet img_tag + | img_tag +snippet img_tag_param + | img_tag: '${1:alt}', '${2:class}' +snippet script_tag + | script_tag +snippet stylesheet_tag + | stylesheet_tag +snippet abs + | abs +snippet ceil + | ceil +snippet divided_by + | divided_by: ${1:2} +snippet floor + | floor +snippet minus + | minus: ${1:1} +snippet plus + | plus: ${1:1} +snippet round + | round: ${1:0} +snippet times + | times: ${1:1} +snippet modulo + | modulo: ${1:2} +snippet money + | money +snippet money_with_currency + | money_with_currency +snippet money_without_trailing_zeros + | money_without_trailing_zeros +snippet money_without_currency + | money_without_currency +snippet append + | append: '${1:string}' +snippet camelcase + | camelcase +snippet capitalize + | capitalize +snippet downcase + | downcase +snippet escape + | escape +snippet handleize + | handleize +snippet md5 + | md5 +snippet newline_to_br + | newline_to_br +snippet pluralize + | pluralize: '${1:item}', '${2:items}' +snippet prepend + | prepend: '${1:string}' +snippet remove + | remove: '${1:string}' +snippet remove_first + | remove_first: '${1:string}' +snippet replace + | replace: '${1:target}', '${2:replace}' +snippet replace_first + | replace_first: '${1:target}', '${2:replace}' +snippet slice + | slice: ${1:0}, ${2:5} +snippet slice_single + | slice: ${1:at} +snippet split + | split: '${1:,}' +snippet strip + | strip +snippet lstrip + | lstrip +snippet rstrip + | rstrip +snippet strip_html + | strip_html +snippet strip_newlines + | strip_newlines +snippet truncate + | truncate: ${1:20}, '${2:...}' +snippet truncatewords + | truncatewords: ${1:5}, '${2:...}' +snippet upcase + | upcase +snippet url_encode + | url_encode +snippet url_escape + | url_escape +snippet url_param_escape + | url_param_escape +snippet asset_url + | asset_url +snippet asset_img_url + | asset_img_url: '${1:medium}' +snippet img_url + | img_url: '${1:medium}' +snippet _schema + {% schema %} + { + "name": "${1}", + "class": "${2}", + "settings": [ + ${0} + ] + } + {% endschema %} +snippet _blocks + "blocks": [ + { + "type": "${1}", + "name": "${2}", + "settings": [ + ${0} + ] + } + ] +snippet _text + { + "type": "text", + "id": "${1}", + "label": "${2}", + "default": "${3}", + "info": "${4}", + "placeholder": "${0}" + } +snippet _textarea + { + "type": "textarea", + "id": "${1}", + "label": "${2}", + "default": "${3}", + "info": "${4}", + "placeholder": "${0}" + } +snippet _image_picker + { + "type": "image_picker", + "id": "${1}", + "label": "${0}" + } +snippet _radio + { + "type": "radio", + "id": "${1}", + "label": "${2}", + "options": [ + { "value": "${5}", "label": "${0}" } + ], + "default": "${3}", + "info": "${4}" + } +snippet _select + { + "type": "select", + "id": "${1}", + "label": "${2}", + "options": [ + { + "group": "${5}", + "value": "${6}", + "label": "${0}" + } + ], + "default": "${3}", + "info": "${4}" + } +snippet _checkbox + { + "type": "checkbox", + "id": "${1}", + "label": "${2}", + "default": ${3:true}, + "info": "${0}" + } +snippet _range + { + "type": "range", + "id": "${1}", + "min": ${2}, + "max": ${3}, + "step": ${4}, + "unit": "${5}", + "label": "${6}", + "default": ${0} + } +snippet _color + { + "type": "color", + "id": "${1}", + "label": "${2}", + "default": "${3}", + "info": "${0}" + } +snippet _font + { + "type": "font_picker", + "id": "${1}", + "label": "${2}", + "info": "${3}", + "default": "${0:helvetica_n4}" + } +snippet _collection + { + "type": "collection", + "id": "${1}", + "label": "${2}", + "info": "${0}" + } +snippet _product + { + "type": "product", + "id": "${1}", + "label": "${2}", + "info": "${0}" + } +snippet _blog + { + "type": "blog", + "id": "${1}", + "label": "${2}", + "info": "${0}" + } +snippet _page + { + "type": "page", + "id": "${1}", + "label": "${2}", + "info": "${0}" + } +snippet _link_list + { + "type": "link_list", + "id": "${1}", + "label": "${2}", + "info": "${0}" + } +snippet _url + { + "type": "url", + "id": "${1}", + "label": "${2}", + "info": "${0}" + } +snippet _video + { + "type": "video_url", + "id": "${1}", + "label": "${2}", + "accept": ["youtube", "vimeo"${0}], + "default": "${3}", + "info": "${4}", + "placeholder": "${5}" + } +snippet _richtext + { + "type": "richtext", + "id": "${1}", + "label": "${2}", + "default": "

${0}

" + } +snippet _html + { + "type": "html", + "id": "${1}", + "label": "${2}", + "default": "
${0}
" + } +snippet _article + { + "type": "article", + "id": "${1}", + "label": "${2}", + "info": "${0}" + } +snippet _header + { + "type": "header", + "content": "${1}", + "info": "${0}" + } +snippet _paragraph + { + "type": "paragraph", + "content": "${0}" + } diff --git a/sources_non_forked/vim-snippets/snippets/lpc.snippets b/sources_non_forked/vim-snippets/snippets/lpc.snippets new file mode 100644 index 00000000..2a849efa --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/lpc.snippets @@ -0,0 +1,190 @@ +## +## Preprocessor +# #include <...> +snippet inc + #include <${1:stdio}.h> +# #include "..." +snippet Inc + #include "${1:`vim_snippets#Filename("$1.h")`}" +# ifndef...define...endif +snippet ndef + #ifndef $1 + #define ${1:SYMBOL} ${2:value} + #endif /* ifndef $1 */ +# define +snippet def + #define +# ifdef...endif +snippet ifdef + #ifdef ${1:FOO} + ${2:#define } + #endif +# if +snippet #if + #if ${1:FOO} + ${0:${VISUAL}} + #endif +# header include guard +snippet once + #ifndef ${1:`toupper(vim_snippets#Filename('$1_H', 'UNTITLED_H'))`} + + #define $1 + + ${0} + + #endif /* end of include guard: $1 */ +## +## Control Statements +# if +snippet if + if(${1:true}) + { + ${0:${VISUAL}} + } +snippet ife + if(${1:true}) + { + ${2:${VISUAL}} + } + else + { + ${0} + } +# else +snippet el + else + { + ${0:${VISUAL}} + } +# else if +snippet elif + else if(${1:true}) + { + ${0:${VISUAL}} + } +# ifi +snippet ifi + if(${1:true}) ${0}; +# ternary +snippet t + ${1:/* condition */} ? ${2:a} : ${3:b} +# switch +snippet switch + switch(${1:/* variable */}) + { + case ${2:/* variable case */}: + ${3} + ${4:break;}${5} + default: + ${6} + } +# switch without default +snippet switchndef + switch(${1:/* variable */}) + { + case ${2:/* variable case */}: + ${3} + ${4:break;}${5} + } +# case +snippet case + case ${1:/* variable case */}: + ${2} + ${3:break;} +snippet ret + return ${0}; +## +## Loops +#foreach +snippet fore + foreach(${1:mixed} ${2:ele} in ${3:arr}) + { + ${4} + } +# for +snippet for + for(int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) + { + ${4} + } +# for (custom) +snippet forr + for(int ${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) + { + ${5} + } +# while +snippet wh + while(${1:/* condition */}) + { + ${0:${VISUAL}} + } +# do... while +snippet do + do{ + ${0:${VISUAL}} + }while (${1:/* condition */}); +## +## Functions +# function definition +snippet fnc + ${1:void} ${2:function_name}(${3}) + { + ${4} + } +# function definition with zero parameters +snippet defun0 + ${1:void} ${2:function_name}() + { + ${3} + } +# function definition with one parameter +snippet defun1 + ${1:void} ${2:function_name}(${3:Type} ${4:Parameter}) + { + ${5} + } +# function definition with two parameters +snippet defun2 + ${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}) + { + ${7} + } +# function definition with three parameters +snippet defun3 + ${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}, ${7:Type} ${8:Parameter}) + { + ${9} + } +# function declaration +snippet fund + ${1:void} ${2:function_name}(${3}); +## +## Input/Output +# printf +snippet pr + printf("${1:%s}\n"${2}); +# fprintf (again, this isn't as nice as TextMate's version, but it works) +snippet fpr + fprintf(${1:stderr}, "${2:%s}\n"${3}); +snippet prd + printf("${1:} = %d\n", $1); +snippet prf + printf("${1:} = %f\n", $1); +snippet prx + printf("${1:} = %${2}\n", $1); +## +# TODO section +snippet todo + /*! TODO: ${1:Todo description here} */ + +## Miscellaneous +# This is kind of convenient +snippet . + [${1}] + + +## +## MHXY +snippet head + // code for ${1} by `$USER` create at `strftime("%Y-%m-%d %H:%M:%S")` diff --git a/sources_non_forked/vim-snippets/snippets/markdown.snippets b/sources_non_forked/vim-snippets/snippets/markdown.snippets index 303271ed..364066cf 100644 --- a/sources_non_forked/vim-snippets/snippets/markdown.snippets +++ b/sources_non_forked/vim-snippets/snippets/markdown.snippets @@ -5,19 +5,19 @@ # The suffix `c` stands for "Clipboard". snippet [ - [${1:text}](http://${2:address}) + [${1:text}](https://${2:address}) snippet [* [${1:link}](${2:`@*`}) snippet [c [${1:link}](${2:`@+`}) snippet [" - [${1:text}](http://${2:address} "${3:title}") + [${1:text}](https://${2:address} "${3:title}") snippet ["* [${1:link}](${2:`@*`} "${3:title}") snippet ["c [${1:link}](${2:`@+`} "${3:title}") snippet [: - [${1:id}]: http://${2:url} + [${1:id}]: https://${2:url} snippet [:* [${1:id}]: ${2:`@*`} @@ -26,7 +26,7 @@ snippet [:c [${1:id}]: ${2:`@+`} snippet [:" - [${1:id}]: http://${2:url} "${3:title}" + [${1:id}]: https://${2:url} "${3:title}" snippet [:"* [${1:id}]: ${2:`@*`} "${3:title}" @@ -129,6 +129,12 @@ snippet img snippet youtube {% youtube ${0:video_id} %} +snippet tb + | ${0:factors} | ${1:a} | ${2:b} | + | ------------- |------------- | ------- | + | ${3:f1} | Y | N | + | ${4:f2} | Y | N | + # The quote should appear only once in the text. It is inherently part of it. # See http://octopress.org/docs/plugins/pullquote/ for more info. diff --git a/sources_non_forked/vim-snippets/snippets/ocaml.snippets b/sources_non_forked/vim-snippets/snippets/ocaml.snippets index eb5a799c..aec43bed 100644 --- a/sources_non_forked/vim-snippets/snippets/ocaml.snippets +++ b/sources_non_forked/vim-snippets/snippets/ocaml.snippets @@ -1,7 +1,7 @@ snippet doc - (* - ${0} - *) + (** ${0} *) +snippet comment + (* ${0} *) snippet let let ${1} = ${2} in ${0} diff --git a/sources_non_forked/vim-snippets/snippets/octave.snippets b/sources_non_forked/vim-snippets/snippets/octave.snippets new file mode 100644 index 00000000..c11805ff --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/octave.snippets @@ -0,0 +1,2 @@ +extends matlab + diff --git a/sources_non_forked/vim-snippets/snippets/pandoc.snippets b/sources_non_forked/vim-snippets/snippets/pandoc.snippets new file mode 100644 index 00000000..1dd9e82e --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/pandoc.snippets @@ -0,0 +1,2 @@ +extends markdown + diff --git a/sources_non_forked/vim-snippets/snippets/perl.snippets b/sources_non_forked/vim-snippets/snippets/perl.snippets index 2ed2932a..b318d18c 100644 --- a/sources_non_forked/vim-snippets/snippets/perl.snippets +++ b/sources_non_forked/vim-snippets/snippets/perl.snippets @@ -357,6 +357,10 @@ snippet dump use Data::Dump qw(dump); warn dump ${1:variable} +snippet ddp + use DDP; + p ${1:variable} + snippet subtest subtest '${1: test_name}' => sub { ${2} diff --git a/sources_non_forked/vim-snippets/snippets/php.snippets b/sources_non_forked/vim-snippets/snippets/php.snippets index 2828f2fb..c769baab 100644 --- a/sources_non_forked/vim-snippets/snippets/php.snippets +++ b/sources_non_forked/vim-snippets/snippets/php.snippets @@ -38,7 +38,7 @@ snippet i ${0:${VISUAL}} } snippet t. - $this-> + \$this-> snippet f function ${1}(${3}) { diff --git a/sources_non_forked/vim-snippets/snippets/ps1.snippets b/sources_non_forked/vim-snippets/snippets/ps1.snippets index 41099d9d..08de1efd 100644 --- a/sources_non_forked/vim-snippets/snippets/ps1.snippets +++ b/sources_non_forked/vim-snippets/snippets/ps1.snippets @@ -29,8 +29,8 @@ snippet function # PowerShell Splatting snippet splatting $Params = @{ - ${1:Param1} = '{2:Value1}' - ${3:Param2} = '{4:Value2}' + ${1:Param1} = '${2:Value1}' + ${3:Param2} = '${4:Value2}' } ${5:CommandName} @Params @@ -99,4 +99,3 @@ snippet switch ${2:condition1} { ${3:action} } ${4:condition2} { ${5:action} } default { ${6:action} } - diff --git a/sources_non_forked/vim-snippets/snippets/puppet.snippets b/sources_non_forked/vim-snippets/snippets/puppet.snippets index 7d8e6d8a..5a1dd6a1 100644 --- a/sources_non_forked/vim-snippets/snippets/puppet.snippets +++ b/sources_non_forked/vim-snippets/snippets/puppet.snippets @@ -7,16 +7,16 @@ # Header using Puppet Strings (YARD tags) https://puppet.com/docs/puppet/latest/modules_documentation.html # More info: https://github.com/puppetlabs/puppet-strings snippet classheader - # ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:h:h'), 'class-name')`} + # ${1:`vim_snippets#Filename(substitute(expand('%:p:s?\v.{-}/(\w+)/manifests/(.+)\.pp?\1/\2?'), '/', '::', 'g'), 'class-name')`} # ${2:A description of what this class does} # # @summary ${3:A short summary of the purpose of this class} # - # @param ${4:parameter1} [${5:String}] + # @param ${4:parameter1} # ${6:Explanation of what this parameter affects.} # # @example Simple use - # class { '$1': } + # include $1 # # @example Use with params # class { '$1': @@ -28,7 +28,7 @@ snippet classheader # @note Copyright `strftime("%Y")` $8 # class $1( - $$4 = undef, + ${5:String} $$4 = undef, ) { ${0} } @@ -207,7 +207,7 @@ snippet define } snippet service - service { "${1:service}" : + service { "${1:service}": ensure => running, enable => true, require => [ Package["${2:package}"], File["${3:file}"], ], @@ -215,7 +215,7 @@ snippet service } snippet file - file { "${1:filename}" : + file { "${1:filename}": ensure => ${2:present}, owner => "${3:root}", group => "${4:root}", @@ -227,7 +227,7 @@ snippet file } snippet archive - archive { "${1:filename}" : + archive { "${1:filename}": ensure => ${2:present}, url => "http://${3:url}", extension => "${4:tgz}", @@ -237,7 +237,7 @@ snippet archive } snippet firewall - firewall { "${1:comment}" : + firewall { "${1:comment}": proto => ${2:tcp}, action => ${3:accept}, port => ${4}, diff --git a/sources_non_forked/vim-snippets/snippets/python.snippets b/sources_non_forked/vim-snippets/snippets/python.snippets index 42832815..179ce64f 100644 --- a/sources_non_forked/vim-snippets/snippets/python.snippets +++ b/sources_non_forked/vim-snippets/snippets/python.snippets @@ -85,16 +85,15 @@ snippet adefm # New Property snippet property - def ${1:foo}(): - doc = "${2:The $1 property.}" - def fget(self): - ${3:return self._$1} - def fset(self, value): - ${4:self._$1 = value} - def fdel(self): - ${0:del self._$1} - return locals() - $1 = property(**$1()) + @property + def ${1:foo}(self) -> ${2:type}: + """${3:doc}""" + return self._${1:foo} + + @${1:foo}.setter + def ${1:foo}(self, value: ${2:type}): + self._${1:foo} = value + # Ifs snippet if if ${1:condition}: @@ -123,6 +122,8 @@ snippet ret return ${0} snippet . self. +snippet sa self.attribute = attribute + self.${1:attribute} = $1 snippet try Try/Except try: ${1:${VISUAL}} @@ -182,6 +183,10 @@ snippet ptpython # python console debugger (pudb) snippet pudb __import__('pudb').set_trace() +# python console debugger remote (pudb) +snippet pudbr + from pudb.remote import set_trace + set_trace() # pdb in nosetests snippet nosetrace __import__('nose').tools.set_trace() @@ -235,7 +240,7 @@ snippet addsp snippet addarg parser.add_argument("${0:short_arg}", "${1:long_arg}", default=${2:None}, help="${3:Help text}") snippet addnarg - parser.add_argument("${0:arg}", nargs="${1:*}", default"${2:None}, help="${3:Help text}") + parser.add_argument("${0:arg}", nargs="${1:*}", default=${2:None}, help="${3:Help text}") snippet addaarg parser.add_argument("${0:arg}", "${1:long_arg}", action="${2:store_true}", default=${3:False}, help="${4:Help text}") snippet pargs diff --git a/sources_non_forked/vim-snippets/snippets/r.snippets b/sources_non_forked/vim-snippets/snippets/r.snippets index 7bdeeec0..9dbe0f39 100644 --- a/sources_non_forked/vim-snippets/snippets/r.snippets +++ b/sources_non_forked/vim-snippets/snippets/r.snippets @@ -32,6 +32,10 @@ snippet for for (${1:item} in ${2:list}) { ${3} } +snippet foreach + foreach (${1:item} = ${2:list}) { + ${3} + } # functions snippet fun diff --git a/sources_non_forked/vim-snippets/snippets/racket.snippets b/sources_non_forked/vim-snippets/snippets/racket.snippets index 723d7383..5304cd8b 100644 --- a/sources_non_forked/vim-snippets/snippets/racket.snippets +++ b/sources_non_forked/vim-snippets/snippets/racket.snippets @@ -1,3 +1,4 @@ +# Languages snippet #r #lang racket snippet #tr @@ -10,56 +11,38 @@ snippet #d #lang datalog snippet #wi #lang web-server/insta + +# Defines snippet def (define ${1} ${0}) snippet defun (define (${1}) ${0}) +snippet defv "define-values" + (define-values (${1}) (${0})) +snippet defm "define/match" + (define/match (${1}) + [(${2}) ${3}] + ${0}) +snippet defs "define-syntax" + (define-syntax (${1}) + ${0}) + +# Conditionals snippet if (if ${1} ${2} ${0}) snippet ifn - (if (not ${1}) ${2} {0}) + (if (not ${1}) ${2} ${0}) snippet ifl (if ${1} - (let () - ${2}) + (let (${2}) + ${3}) ${0}) snippet ifnl (if (not ${1}) - (let () - ${2}) + (let (${2}) + ${3}) ${0}) -snippet when - (when ${1} - ${0}) -snippet cond - (cond - [(${1}) - ${0}]) -snippet case - (case ${1} - [(${2}) - ${0}]) -snippet match - (match ${1} - [(${2}) - ${0}]) -snippet letcc - (let/cc here (set! ${1} here) ${0}) -snippet for - (for ([${1} ${2}]) - ${0}) -snippet req - (require ${0}) -snippet unless - (unless ${1} ${2} ${0}) -snippet let - (let ([${1}]) ${0}) -snippet begin - (begin - ${0}) -snippet lambda - (lambda (${1}) ${0}) snippet ifb (if ${1} (begin @@ -70,3 +53,79 @@ snippet ifnb (begin ${2}) ${0}) +snippet when + (when ${1} + ${0}) +snippet unless + (unless ${1} ${2} ${0}) +snippet cond + (cond + [(${1}) ${0}]) +snippet conde + (cond + [(${1}) ${2}] + [else ${0}]) +snippet case + (case ${1} + [(${2}) ${0}]) +snippet match + (match ${1} + [(${2}) ${0}]) + +# For iterations +snippet for + (for ([${1}]) + ${0}) +snippet forl "for/list" + (for/list ([${1}]) + ${0}) +snippet forf "for/fold" + (for/fold + ([${1}]) + ([${2}]) + ${0}) +snippet forfr "for/foldr" + (for/foldr + ([${1}]) + ([${2}]) + ${0}) +snippet fora "for/and" + (for/and ([${1}]) + ${0}) +snippet foro "for/or" + (for/or ([${1}]) + ${0}) +snippet fors "for/sum" + (for/sum ([${1}]) + ${0}) +snippet forp "for/product" + (for/product ([${1}]) + ${0}) +snippet forfi "for/first" + (for/first ([${1}]) + ${0}) +snippet forla "for/last" + (for/last ([${1}]) + ${0}) + +snippet lambda + (lambda (${1}) ${0}) +snippet apply + (apply ${1} ${0}) +snippet map + (map ${1} ${0}) +snippet filter + (filter ${1} ${0}) + +snippet req + (require ${0}) +snippet prov + (provide ${0}) + +snippet let + (let ([${1}]) ${0}) +snippet letcc + (let/cc here (set! ${1} here) ${0}) +snippet begin + (begin + ${0}) diff --git a/sources_non_forked/vim-snippets/snippets/rmd.snippets b/sources_non_forked/vim-snippets/snippets/rmd.snippets new file mode 100644 index 00000000..96b0ea0e --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/rmd.snippets @@ -0,0 +1,205 @@ +# +# Snipmate Snippets for Pandoc Markdown +# +# Many snippets have starred versions, i.e., versions +# that end with an asterisk (`*`). These snippets use +# vim's `"*` register---i.e., the contents of the +# system clipboard---to insert text. + +# Insert Title Block +snippet %% + % ${1:`Filename('', 'title')`} + % ${2:`g:snips_author`} + % ${3:`strftime("%d %B %Y")`} + + ${4} +snippet %%* + % ${1:`Filename('', @*)`} + % ${2:`g:snips_author`} + % ${3:`strftime("%d %b %Y")`} + + ${4} + +# Insert Definition List +snippet :: + ${1:term} + ~ ${2:definition} + +# Underline with `=`s or `-`s +snippet === + `repeat('=', strlen(getline(line(".") - 1)))` + + ${1} +snippet --- + `repeat('-', strlen(getline(line(".") - 1)))` + + ${1} + +# Links and their kin +# ------------------- +# +# (These don't play very well with delimitMate) +# + +snippet [ + [${1:link}](http://${2:url} "${3:title}")${4} +snippet [* + [${1:link}](${2:`@*`} "${3:title}")${4} + +snippet [: + [${1:id}]: http://${2:url} "${3:title}" +snippet [:* + [${1:id}]: ${2:`@*`} "${3:title}" + +snippet [@ + [${1:link}](mailto:${2:email})${3} +snippet [@* + [${1:link}](mailto:${2:`@*`})${3} + +snippet [:@ + [${1:id}]: mailto:${2:email} "${3:title}" +snippet [:@* + [${1:id}]: mailto:${2:`@*`} "${3:title}" + +snippet ![ + ![${1:alt}](${2:url} "${3:title}")${4} +snippet ![* + ![${1:alt}](${2:`@*`} "${3:title}")${4} + +snippet ![: + ![${1:id}]: ${2:url} "${3:title}" +snippet ![:* + ![${1:id}]: ${2:`@*`} "${3:title}" + +snippet [^: + [^${1:id}]: ${2:note} +snippet [^:* + [^${1:id}]: ${2:`@*`} + +# + +# library() +snippet req + require(${1:}, quietly = TRUE) +# If Condition +snippet if + if ( ${1:condition} ) + { + ${2:} + } +snippet el + else + { + ${1:} + } + +# Function +snippet fun + ${1:funname} <- # ${2:} + function + ( + ${3:} + ) + { + ${4:} + } +# repeat +snippet re + repeat{ + ${2:} + if(${1:condition}) break + } + +# matrix +snippet ma + matrix(NA, nrow = ${1:}, ncol = ${2:}) + +# data frame +snippet df + data.frame(${1:}, header = TRUE) + +snippet cmdarg + args <- commandArgs(TRUE) + if (length(args) == 0) + stop("Please give ${1:}!") + if (!all(file.exists(args))) + stop("Couln't find input files!") + +snippet getopt + require('getopt', quietly = TRUE) + opt_spec <- matrix(c( + 'help', 'h', 0, "logical", "Getting help", + 'file', 'f', 1, "character","File to process" + ), ncol = 5, byrow = TRUE) + opt <- getopt(spec = opt_spec) + if ( !is.null(opt$help) || is.null(commandArgs()) ) { + cat(getopt(spec = opt_spec, usage = TRUE, command = "yourCmd")) + q(status=0) + } + # some inital value + if ( is.null(opt$???) ) { opt$??? <- ??? } + +snippet optparse + require("optparse", quietly = TRUE) + option_list <- + list(make_option(c("-n", "--add_numbers"), action="store_true", default=FALSE, + help="Print line number at the beginning of each line [default]") + ) + parser <- OptionParser(usage = "%prog [options] file", option_list=option_list) + arguments <- parse_args(parser, positional_arguments = TRUE) + opt <- arguments$options + + if(length(arguments$args) != 1) { + cat("Incorrect number of required positional arguments\n\n") + print_help(parser) + stop() + } else { + file <- arguments$args + } + + if( file.access(file) == -1) { + stop(sprintf("Specified file ( %s ) does not exist", file)) + } else { + file_text <- readLines(file) + } + +snippet #! + #!/usr/bin/env Rscript + +snippet debug + # Development & Debugging, don't forget to uncomment afterwards! + #-------------------------------------------------------------------------------- + #setwd("~/Projekte/${1:}") + #opt <- list(${2:} + # ) + #-------------------------------------------------------------------------------- + + +# Took from pandoc-plugin <<<< +# Underline with `=`s or `-`s +snippet #=== + #`repeat('=', strlen(getline(line(".") - 1)))` + ${1} +snippet #--- + #`repeat('-', strlen(getline(line(".") - 1)))` + ${1} + +# >>>> + +snippet r + \`\`\`{r ${1:chung_tag}, echo = FALSE ${2:options}} + ${3:} + \`\`\` +snippet ri + \`{r ${1:}}\` + +snippet copt + \`\`\` {r setup, echo = FALSE} + opts_chunk$set(fig.path='../figures/${1:}', cache.path='../cache/-' + , fig.align='center', fig.show='hold', par=TRUE) + #opts_knit$set(upload.fun = imgur_upload) # upload images + \`\`\` + + +# End of File =================================================================== +# vim: set noexpandtab: diff --git a/sources_non_forked/vim-snippets/snippets/rst.snippets b/sources_non_forked/vim-snippets/snippets/rst.snippets index dd47863e..31b4fec2 100644 --- a/sources_non_forked/vim-snippets/snippets/rst.snippets +++ b/sources_non_forked/vim-snippets/snippets/rst.snippets @@ -19,16 +19,17 @@ snippet - ${0} #some directive snippet img: - .. |${0:alias}| image:: ${1:img} + .. |${1:alias}| image:: ${0:img} snippet fig: .. figure:: ${1:img} - :alt: ${0:alter text} + :alt: ${2:alter text} + + $0 +snippet con: + .. contents:: ${1:Table of Contents} - $2 -snippet cont: - .. contents:: ${0:content} -snippet code: +snippet cod: .. code:: ${1:type} ${0:write some code} @@ -65,34 +66,36 @@ snippet tod: .. todo:: ${0} snippet lis: - .. list-table:: ${0:Title} + .. list-table:: ${1:Title} :header-rows: 1 - :stub-columns: 1 + :stub-columns: 0 - * - x1,y1 - - x2,y1 - - x3,y1 - * - x1,y2 - - x2,y2 - - x3,y2 - * - x1,y3 - - x2,y3 - - x3,y3 + * - ${0:R1C1} + - R1C2 + * - R2C1 + - R2C2 +snippet csv: + .. csv-table:: ${1:Title} + :header-rows: 1 + :stub-columns: 0 + ${0:R1C1}, R1C2 + R2C1, R2C2 snippet toc: .. toctree:: :maxdepth: 2 ${0} snippet dow: - :download:\`${0:text} <${1:path}>\` + :download:\`${1:text} <${0:path}>\` snippet ref: - :ref:\`${0:text} <${1:path}>\` + :ref:\`${1:text} <${0:path}>\` snippet doc: - :doc:`${0:text} <${1:path}>` + :doc:\`${1:text} <${0:path}>\` # CJK optimize, CJK has no space between charaters snippet *c \ *${1:Emphasis}*\ ${0} snippet **c \ **${1:Strong emphasis}**\ ${0} +# vim:set list noet sts=0 sw=4 ts=4: diff --git a/sources_non_forked/vim-snippets/snippets/ruby.snippets b/sources_non_forked/vim-snippets/snippets/ruby.snippets index ff5fede1..3c9eec52 100644 --- a/sources_non_forked/vim-snippets/snippets/ruby.snippets +++ b/sources_non_forked/vim-snippets/snippets/ruby.snippets @@ -24,7 +24,7 @@ snippet rb snippet beg begin ${0} - rescue ${1:Exception} => ${2:e} + rescue ${1:StandardError} => ${2:e} end snippet req require require '${1}' @@ -485,22 +485,22 @@ snippet asnm snippet aso assert_operator ${1:left}, :${2:operator}, ${3:right} snippet asr - assert_raise ${1:Exception} { ${0} } + assert_raises(${1:StandardError}) { ${0} } snippet asrd - assert_raise ${1:Exception} do + assert_raises ${1:StandardError} do ${0} end snippet asnr - assert_nothing_raised ${1:Exception} { ${0} } + assert_nothing_raised(${1:StandardError}) { ${0} } snippet asnrd - assert_nothing_raised ${1:Exception} do + assert_nothing_raised ${1:StandardError} do ${0} end snippet asrt assert_respond_to ${1:object}, :${2:method} snippet ass assert_same(..) assert_same ${1:expected}, ${2:actual} -snippet ass assert_send(..) +snippet asss assert_send(..) assert_send [${1:object}, :${2:message}, ${3:args}] snippet asns assert_not_same ${1:unexpected}, ${2:actual} @@ -518,6 +518,24 @@ snippet asntd end snippet fl flunk '${1:Failure message.}' +snippet rf + refute ${1:test}, '${2:Failure message.}' +snippet rfe + refute_equal ${1:unexpected}, ${2:actual} +snippet rfko + refute_kind_of ${1:UnexpectedKind}, ${2:actual_instance} +snippet rfn + refute_nil ${1:instance} +snippet rfo + refute_operator ${1:left}, :${2:operator}, ${3:right} +snippet rfi + refute_includes ${1:collection}, ${2:object} +snippet rfid + refute_in_delta ${1:unexpected_float}, ${2:actual_float}, ${3:2**-20} +snippet rfio + refute_instance_of ${1:UnexpectedClass}, ${2:actual_instance} +snippet rfs + refute_same ${1:unexpected}, ${2:actual} # Benchmark.bmbm do .. end snippet bm- TESTS = ${1:10_000} @@ -568,7 +586,7 @@ snippet b snippet begin begin fail 'A test exception.' - rescue Exception => e + rescue StandardError => e puts e.message puts e.backtrace.inspect else @@ -640,7 +658,7 @@ snippet wm snippet mout -> { ${1} }.must_output '${0}' snippet mra - -> { ${1} }.must_raise ${0:Exception} + -> { ${1} }.must_raise ${0:StandardError} snippet mrt must_respond_to :${0:method} snippet wrt diff --git a/sources_non_forked/vim-snippets/snippets/rust.snippets b/sources_non_forked/vim-snippets/snippets/rust.snippets index 7a97fdc2..5e9eb2b1 100644 --- a/sources_non_forked/vim-snippets/snippets/rust.snippets +++ b/sources_non_forked/vim-snippets/snippets/rust.snippets @@ -11,6 +11,14 @@ snippet pfn "Function definition" pub fn ${1:function_name}(${2})${3} { ${0} } +snippet afn "Async function definition" + async fn ${1:function_name}(${2})${3} { + ${0} + } +snippet pafn "Async function definition" + pub async fn ${1:function_name}(${2})${3} { + ${0} + } snippet bench "Bench function" b #[bench] fn ${1:bench_function_name}(b: &mut test::Bencher) { @@ -93,7 +101,7 @@ snippet crate "Define create meta attributes" // Crate name #![crate_name = "${1:crate_name}"] // Additional metadata attributes - #![desc = "${2:Descrption.}"] + #![desc = "${2:Description.}"] #![license = "${3:BSD}"] #![comment = "${4:Comment.}"] // Specify the output type @@ -102,7 +110,7 @@ snippet crate "Define create meta attributes" snippet opt "Option" Option<${1:i32}> snippet res "Result" - Result<${1:~str}, ${2:()}> + Result<${1:&str}, ${2:()}> # Control structures snippet if if ${1} { @@ -114,6 +122,10 @@ snippet ife "if / else" } else { ${0} } +snippet ifl "if let (...)" + if let ${1:Some($2)} = $3 { + ${0:${VISUAL}} + } snippet el "else" else { ${0:${VISUAL}} @@ -138,6 +150,10 @@ snippet wh "while loop" while ${1:condition} { ${0:${VISUAL}} } +snippet whl "while let (...)" + while let ${1:Some($2)} = $3 { + ${0:${VISUAL}} + } snippet for "for ... in ... loop" for ${1:i} in ${2} { ${0} @@ -153,7 +169,7 @@ snippet st "Struct definition" ${0} } snippet impl "Struct/Trait implementation" - impl ${1:Type/Trait}${2: for ${3:Type}} { + impl ${1:Type/Trait}${2: for $3} { ${0} } snippet stn "Struct with new constructor" @@ -161,9 +177,9 @@ snippet stn "Struct with new constructor" ${0} } - impl $1 { - pub fn new(${2}) -> Self { - $1 { ${3} } + impl$2 $1$2 { + pub fn new(${4}) -> Self { + $1 { ${5} } } } snippet ty "Type alias" @@ -182,7 +198,7 @@ snippet trait "Trait definition" ${0} } snippet drop "Drop trait implementation (destructor)" - impl Drop for ${1:Name} { + impl Drop for $1 { fn drop(&mut self) { ${0} } @@ -193,10 +209,6 @@ snippet ss "static string declaration" snippet stat "static item declaration" static ${1}: ${2:usize} = ${0}; # Concurrency -snippet scoped "spawn a scoped thread" - thread::scoped(${1:move }|| { - ${0} - }); snippet spawn "spawn a thread" thread::spawn(${1:move }|| { ${0} @@ -230,5 +242,11 @@ snippet macro "macro_rules!" b $3 ) } -snippet box "Box::new()" +snippet boxp "Box::new()" Box::new(${0:${VISUAL}}) +snippet rc "Rc::new()" + Rc::new(${0:${VISUAL}}) +snippet unim "unimplemented!()" + unimplemented!() +snippet use "use ...;" b + use ${1:std::$2}; diff --git a/sources_non_forked/vim-snippets/snippets/sass.snippets b/sources_non_forked/vim-snippets/snippets/sass.snippets index 3e84c20e..30bac6c7 100644 --- a/sources_non_forked/vim-snippets/snippets/sass.snippets +++ b/sources_non_forked/vim-snippets/snippets/sass.snippets @@ -34,6 +34,72 @@ snippet while ${0:${VISUAL}} snippet ! !important +snippet ac + align-content: ${0} +snippet ac:s + align-content: start +snippet ac:e + align-content: end +snippet ac:c + align-content: center +snippet ac:fs + align-content: flex-start +snippet ac:fe + align-content: flex-end +snippet ac:sb + align-content: space-between +snippet ac:sa + align-content: space-around +snippet ac:se + align-content: space-evenly +snippet ac:st + align-content: stretch +snippet ac:b + align-content: baseline +snippet ac:fb + align-content: first baseline +snippet ac:lb + align-content: last baseline +snippet ai + align-items: ${0} +snippet ai:s + align-items: start +snippet ai:e + align-items: end +snippet ai:c + align-items: center +snippet ai:fs + align-items: flex-start +snippet ai:fe + align-items: flex-end +snippet ai:st + align-items: stretch +snippet ai:b + align-items: baseline +snippet ai:fb + align-items: first baseline +snippet ai:lb + align-items: last baseline +snippet as + align-self: ${0} +snippet as:s + align-self: start +snippet as:e + align-self: end +snippet as:c + align-self: center +snippet as:st + align-self: stretch +snippet as:fs + align-self: flex-start +snippet as:fe + align-self: flex-end +snippet as:b + align-self: baseline +snippet as:fb + align-self: first baseline +snippet as:lb + align-self: last baseline snippet bdi:m+ -moz-border-image: url('${1}') ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch} snippet bdi:m @@ -411,6 +477,10 @@ snippet d:b display: block snippet d:cp display: compact +snippet d:g + display: grid +snippet d:f + display: flex snippet d:ib display: inline-block snippet d:itb @@ -561,10 +631,122 @@ snippet fw:n font-weight: normal snippet f font: ${0} +snippet g + grid: ${0} +snippet gaf + grid-auto-flow: ${0} +snippet gaf+ + grid-auto-flow: ${1:row} ${0:dense} +snippet gaf:r + grid-auto-flow: row +snippet gaf:c + grid-auto-flow: column +snippet gaf:d + grid-auto-flow: dense +snippet gaf:rd + grid-auto-flow: row dense +snippet gaf:cd + grid-auto-flow: column dense +snippet gar + grid-auto-rows: ${0} +snippet gar:a + grid-auto-rows: auto +snippet gar:mac + grid-auto-rows: max-content +snippet gar:mic + grid-auto-rows: min-content +snippet gac + grid-auto-columns: ${0} +snippet gac:a + grid-auto-columns: auto +snippet gac:mac + grid-auto-columns: max-content +snippet gac:mic + grid-auto-columns: min-content +snippet gt + grid-template: ${0} +snippet gt+ + grid-template: ${1} / ${0} +snippet gtr + grid-template-rows: ${0} +snippet gtc + grid-template-columns: ${0} +snippet gta + grid-template-areas: ${0} +snippet gg + grid-gap: ${0} +snippet gg+ + grid-gap: ${1} ${0} +snippet gg:0 + grid-gap: 0 +snippet grg + grid-row-gap: ${0} +snippet grg:0 + grid-row-gap: 0 +snippet gcg + grid-column-gap: ${0} +snippet gcg:0 + grid-column-gap: 0 +snippet gr + grid-row: ${1} / ${0} +snippet grs + grid-row-start: ${0} +snippet gre + grid-row-end: ${0} +snippet gc + grid-column: ${1} / ${0} +snippet gcs + grid-column-start: ${0} +snippet gce + grid-column-end: ${0} snippet h height: ${0} snippet h:a height: auto +snippet jc + justify-content: ${0} +snippet jc:s + justify-content: start +snippet jc:e + justify-content: end +snippet jc:c + justify-content: center +snippet jc:fs + justify-content: flex-start +snippet jc:fe + justify-content: flex-end +snippet jc:sb + justify-content: space-between +snippet jc:sa + justify-content: space-around +snippet jc:se + justify-content: space-evenly +snippet jc:st + justify-content: stretch +snippet jc:l + justify-content: left +snippet jc:r + justify-content: right +snippet ji + justify-items: ${0} +snippet ji:s + justify-items: start +snippet ji:e + justify-items: end +snippet ji:c + justify-items: center +snippet ji:st + justify-items: stretch +snippet js + justify-self: ${0} +snippet js:s + justify-self: start +snippet js:e + justify-self: end +snippet js:c + justify-self: center +snippet js:st + justify-self: stretch snippet l left: ${0} snippet l:a @@ -729,6 +911,28 @@ snippet p:2 padding: ${1:0} ${0:0} snippet p:0 padding: 0 +snippet pc + place-content: ${0} +snippet pc+ + place-content: ${1} ${0} +snippet pc:s + place-content: start +snippet pc:e + place-content: end +snippet pc:c + place-content: center +snippet pc:fs + place-content: flex-start +snippet pc:fe + place-content: flex-end +snippet pc:sb + place-content: space-between +snippet pc:sa + place-content: space-around +snippet pc:se + place-content: space-evenly +snippet pc:st + place-content: stretch snippet pgba page-break-after: ${0} snippet pgba:aw @@ -755,6 +959,18 @@ snippet pgbi:a page-break-inside: auto snippet pgbi:av page-break-inside: avoid +snippet pi + place-items: ${0} +snippet pi+ + place-items: ${1:stretch} ${0:stretch} +snippet pi:s + place-items: start +snippet pi:e + place-items: end +snippet pi:c + place-items: center +snippet pi:st + place-items: stretch snippet pos position: ${0} snippet pos:a @@ -765,6 +981,18 @@ snippet pos:r position: relative snippet pos:s position: static +snippet ps + place-self: ${0} +snippet ps+ + place-self: ${1:stretch} ${0:stretch} +snippet ps:s + place-self: start +snippet ps:e + place-self: end +snippet ps:c + place-self: center +snippet ps:st + place-self: stretch snippet q quotes: ${0} snippet q:en diff --git a/sources_non_forked/vim-snippets/snippets/sh.snippets b/sources_non_forked/vim-snippets/snippets/sh.snippets index 35afa301..2ce67ec4 100644 --- a/sources_non_forked/vim-snippets/snippets/sh.snippets +++ b/sources_non_forked/vim-snippets/snippets/sh.snippets @@ -4,10 +4,10 @@ snippet #! snippet s#! #!/usr/bin/env sh - set -euo pipefail + set -eu snippet safe - set -euo pipefail + set -eu snippet bash #!/usr/bin/env bash diff --git a/sources_non_forked/vim-snippets/snippets/stylus.snippets b/sources_non_forked/vim-snippets/snippets/stylus.snippets index 3ce35c26..ab703fee 100644 --- a/sources_non_forked/vim-snippets/snippets/stylus.snippets +++ b/sources_non_forked/vim-snippets/snippets/stylus.snippets @@ -1,5 +1,71 @@ snippet ! !important +snippet ac + align-content ${0} +snippet ac:s + align-content start +snippet ac:e + align-content end +snippet ac:c + align-content center +snippet ac:fs + align-content flex-start +snippet ac:fe + align-content flex-end +snippet ac:sb + align-content space-between +snippet ac:sa + align-content space-around +snippet ac:se + align-content space-evenly +snippet ac:st + align-content stretch +snippet ac:b + align-content baseline +snippet ac:fb + align-content first baseline +snippet ac:lb + align-content last baseline +snippet ai + align-items ${0} +snippet ai:s + align-items start +snippet ai:e + align-items end +snippet ai:c + align-items center +snippet ai:fs + align-items flex-start +snippet ai:fe + align-items flex-end +snippet ai:st + align-items stretch +snippet ai:b + align-items baseline +snippet ai:fb + align-items first baseline +snippet ai:lb + align-items last baseline +snippet as + align-self ${0} +snippet as:s + align-self start +snippet as:e + align-self end +snippet as:c + align-self center +snippet as:st + align-self stretch +snippet as:fs + align-self flex-start +snippet as:fe + align-self flex-end +snippet as:b + align-self baseline +snippet as:fb + align-self first baseline +snippet as:lb + align-self last baseline snippet bdi:m+ -moz-border-image url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch} snippet bdi:m @@ -379,10 +445,12 @@ snippet d:mis display -moz-inline-stack snippet d:b display block -snippet d:f - display flex snippet d:cp display compact +snippet d:g + display grid +snippet d:f + display flex snippet d:ib display inline-block snippet d:itb @@ -533,6 +601,74 @@ snippet fw:n font-weight normal snippet f font ${0} +snippet g + grid ${0} +snippet gaf + grid-auto-flow ${0} +snippet gaf+ + grid-auto-flow ${1:row} ${0:dense} +snippet gaf:r + grid-auto-flow row +snippet gaf:c + grid-auto-flow column +snippet gaf:d + grid-auto-flow dense +snippet gaf:rd + grid-auto-flow row dense +snippet gaf:cd + grid-auto-flow column dense +snippet gar + grid-auto-rows ${0} +snippet gar:a + grid-auto-rows auto +snippet gar:mac + grid-auto-rows max-content +snippet gar:mic + grid-auto-rows min-content +snippet gac + grid-auto-columns ${0} +snippet gac:a + grid-auto-columns auto +snippet gac:mac + grid-auto-columns max-content +snippet gac:mic + grid-auto-columns min-content +snippet gt + grid-template ${0} +snippet gt+ + grid-template ${1} / ${0} +snippet gtr + grid-template-rows ${0} +snippet gtc + grid-template-columns ${0} +snippet gta + grid-template-areas ${0} +snippet gg + grid-gap ${0} +snippet gg+ + grid-gap ${1} ${0} +snippet gg:0 + grid-gap 0 +snippet grg + grid-row-gap ${0} +snippet grg:0 + grid-row-gap 0 +snippet gcg + grid-column-gap ${0} +snippet gcg:0 + grid-column-gap 0 +snippet gr + grid-row ${1} / ${0} +snippet grs + grid-row-start ${0} +snippet gre + grid-row-end ${0} +snippet gc + grid-column ${1} / ${0} +snippet gcs + grid-column-start ${0} +snippet gce + grid-column-end ${0} snippet h height ${0} snippet h:a @@ -701,6 +837,28 @@ snippet p:2 padding ${1:0} ${0:0} snippet p:0 padding 0 +snippet pc + place-content ${0} +snippet pc+ + place-content ${1} ${0} +snippet pc:s + place-content start +snippet pc:e + place-content end +snippet pc:c + place-content center +snippet pc:fs + place-content flex-start +snippet pc:fe + place-content flex-end +snippet pc:sb + place-content space-between +snippet pc:sa + place-content space-around +snippet pc:se + place-content space-evenly +snippet pc:st + place-content stretch snippet pgba page-break-after ${0} snippet pgba:aw @@ -727,6 +885,18 @@ snippet pgbi:a page-break-inside auto snippet pgbi:av page-break-inside avoid +snippet pi + place-items ${0} +snippet pi+ + place-items ${1:stretch} ${0:stretch} +snippet pi:s + place-items start +snippet pi:e + place-items end +snippet pi:c + place-items center +snippet pi:st + place-items stretch snippet pos position ${0} snippet pos:a @@ -737,6 +907,18 @@ snippet pos:r position relative snippet pos:s position static +snippet ps + place-self ${0} +snippet ps+ + place-self ${1:stretch} ${0:stretch} +snippet ps:s + place-self start +snippet ps:e + place-self end +snippet ps:c + place-self center +snippet ps:st + place-self stretch snippet q quotes ${0} snippet q:en @@ -993,7 +1175,47 @@ snippet for for ${1:i} in ${0} snippet keyf @keyframes ${0} +snippet jc + justify-content ${0} +snippet jc:s + justify-content start +snippet jc:e + justify-content end snippet jc:c justify-content center -snippet jc - justify-content +snippet jc:fs + justify-content flex-start +snippet jc:fe + justify-content flex-end +snippet jc:sb + justify-content space-between +snippet jc:sa + justify-content space-around +snippet jc:se + justify-content space-evenly +snippet jc:st + justify-content space-evenly +snippet jc:l + justify-content left +snippet jc:r + justify-content right +snippet ji + justify-items ${0} +snippet ji:s + justify-items start +snippet ji:e + justify-items end +snippet ji:c + justify-items center +snippet ji:st + justify-items stretch +snippet js + justify-self ${0} +snippet js:s + justify-self start +snippet js:e + justify-self end +snippet js:c + justify-self center +snippet js:st + justify-self stretch diff --git a/sources_non_forked/vim-snippets/snippets/svelte.snippets b/sources_non_forked/vim-snippets/snippets/svelte.snippets new file mode 100644 index 00000000..4e09d0cc --- /dev/null +++ b/sources_non_forked/vim-snippets/snippets/svelte.snippets @@ -0,0 +1 @@ +extends html, javascript, css diff --git a/sources_non_forked/vim-snippets/snippets/systemverilog.snippets b/sources_non_forked/vim-snippets/snippets/systemverilog.snippets index 70a9d2d3..f510750d 100644 --- a/sources_non_forked/vim-snippets/snippets/systemverilog.snippets +++ b/sources_non_forked/vim-snippets/snippets/systemverilog.snippets @@ -1,7 +1,7 @@ extends verilog # Foreach Loop -snippet fe +snippet forea foreach (${1}) begin ${0} end diff --git a/sources_non_forked/vim-snippets/snippets/tex.snippets b/sources_non_forked/vim-snippets/snippets/tex.snippets index 79e70628..ff94f187 100644 --- a/sources_non_forked/vim-snippets/snippets/tex.snippets +++ b/sources_non_forked/vim-snippets/snippets/tex.snippets @@ -1,5 +1,11 @@ #version 1 #PREAMBLE +#documentclass without options +snippet dcl \documentclass{} + \\documentclass{${1:class}} ${0} +#documentclass with options +snippet dclo \documentclass[]{} + \\documentclass[${1:options}]{${2:class}} ${0} #newcommand snippet nc \newcommand \\newcommand{\\${1:cmd}}[${2:opt}]{${3:realcmd}} ${0} @@ -19,6 +25,11 @@ snippet begin \begin{} ... \end{} block \\begin{${1:env}} ${0:${VISUAL}} \\end{$1} + +# Maketitle +snippet mkt maketitle + \\maketitle + # Tabular snippet tab tabular (or arbitrary) environment \\begin{${1:tabular}}{${2:c}} @@ -204,34 +215,38 @@ snippet fcite \footcite[]{} \\footcite[${1}]{${2}}${0} #Formating text: italic, bold, underline, small capital, emphase .. snippet ita italic text - \\textit{${1:${VISUAL:text}}} ${0} + \\textit{${1:${VISUAL:text}}}${0} snippet bf bold face text - \\textbf{${1:${VISUAL:text}}} ${0} + \\textbf{${1:${VISUAL:text}}}${0} snippet under underline text - \\underline{${1:${VISUAL:text}}} ${0} + \\underline{${1:${VISUAL:text}}}${0} snippet over overline text - \\overline{${1:${VISUAL:text}}} ${0} + \\overline{${1:${VISUAL:text}}}${0} snippet emp emphasize text \\emph{${1:${VISUAL:text}}}${0} snippet sc small caps text - \\textsc{${1:${VISUAL:text}}} ${0} + \\textsc{${1:${VISUAL:text}}}${0} #Choosing font snippet sf sans serife text - \\textsf{${1:${VISUAL:text}}} ${0} + \\textsf{${1:${VISUAL:text}}}${0} snippet rm roman font text - \\textrm{${1:${VISUAL:text}}} ${0} + \\textrm{${1:${VISUAL:text}}}${0} snippet tt typewriter (monospace) text - \\texttt{${1:${VISUAL:text}}} ${0} + \\texttt{${1:${VISUAL:text}}}${0} +snippet tsub subscripted text + \\textsubscript{${1:${VISUAL:text}}}${0} +snippet tsup superscripted text + \\textsuperscript{${1:${VISUAL:text}}}${0} #Math font snippet mf mathfrak - \\mathfrak{${1:${VISUAL:text}}} ${0} + \\mathfrak{${1:${VISUAL:text}}}${0} snippet mc mathcal - \\mathcal{${1:${VISUAL:text}}} ${0} + \\mathcal{${1:${VISUAL:text}}}${0} snippet ms mathscr - \\mathscr{${1:${VISUAL:text}}} ${0} + \\mathscr{${1:${VISUAL:text}}}${0} #misc snippet ft \footnote - \\footnote{${1:${VISUAL:text}}} ${0} + \\footnote{${1:${VISUAL:text}}}${0} snippet fig figure environment (includegraphics) \\begin{figure} \\begin{center} @@ -248,7 +263,7 @@ snippet tikz figure environment (tikzpicture) ${2} \\end{tikzpicture} \\end{center} - \\caption{${3}} + \\caption{${3}}% \\label{fig:${4}} \\end{figure} ${0} @@ -285,7 +300,9 @@ snippet sum \sum^{}_{} snippet lim \lim_{} \\lim_{${1:n \\to \\infty}} ${0} snippet frame frame environment - \\begin{frame}[${1:t}]{${2:title}} + \\begin{frame}[${1:t}] + \frametitle{${2:title}} + \framesubtitle{${3:subtitle}} ${0:${VISUAL}} \\end{frame} snippet block block environment @@ -352,3 +369,59 @@ snippet hrefc # enquote from package csquotes snippet enq enquote \\enquote{${1:${VISUAL:text}}} ${0} + +# Time derivative +snippet ddt time derivative + \\frac{d}{dt} {$1} {$0} + +# Limit +snippet lim limit + \\lim_{{$1}} {{$2}} {$0} + +# Partial derivative +snippet pdv partial derivation + \\frac{\\partial {$1}}{\\partial {$2}} {$0} + +# Second order partial derivative +snippet ppdv second partial derivation + \\frac{\\partial^2 {$1}}{\\partial {$2} \\partial {$3}} {$0} + +# Ordinary derivative +snippet dv derivative + \\frac{d {$1}}{d {$2}} {$0} + +# Summation +snippet summ summation + \\sum_{{$1}} {$0} + +# Shorthand for time derivative +snippet dot dot + \\dot{{$1}} {$0} + +# Shorthand for second order time derivative +snippet ddot ddot + \\ddot{{$1}} {$0} + +# Vector +snippet vec vector + \\vec{{$1}} {$0} + +# Cross product +snippet \x cross product + \\times {$0} + +# Dot product +snippet . dot product + \\cdot {$0} + +# Integral +snippet int integral + \\int_{{$1}}^{{$2}} {$3} \\: d{$4} {$0} + +# Right arrow +snippet ra rightarrow + \\rightarrow {$0} + +# Long right arrow +snippet lra longrightarrow + \\longrightarrow {$0} diff --git a/sources_non_forked/vim-snippets/snippets/twig.snippets b/sources_non_forked/vim-snippets/snippets/twig.snippets index d0d7e1c9..8102984d 100644 --- a/sources_non_forked/vim-snippets/snippets/twig.snippets +++ b/sources_non_forked/vim-snippets/snippets/twig.snippets @@ -1,34 +1,177 @@ -snippet bl "{% block xyz %} .. {% endblock xyz %}" +# Tags +snippet apply "twig apply" + {% apply ${1} %} + ${0} + {% endapply %} +snippet autoescape "twig autoescape" + {% autoescape %} + ${0} + {% endautoescape %} +snippet endautoescape "twig endautoescape" + {% endautoescape %}${0} +snippet bl "twig block" {% block ${1} %} - ${2:${VISUAL}} - {% endblock $1 %} -snippet js "{% javascripts 'xyz' %} .. {% endjavascripts %}" - {% javascripts '${1}' %} - - {% endjavascripts %} -snippet css "{% stylesheets 'xyz' %} .. {% endstylesheets %}" - {% stylesheets '${1}' %} - - {% endstylesheets %} -snippet if "{% if %} .. {% endif %}" - {% if ${1} %} - ${2:${VISUAL}} - {% endif %} -snippet ife "{% if %} .. {% else %} .. {% endif %}" - {% if ${1} %} - ${2:${VISUAL}} - {% else %} - ${0} - {% endif %} -snippet el "{% else %}" - {% else %} - ${0:${VISUAL}} -snippet eif "{% elseif %}" - {% elseif ${1} %} - ${0} -snippet for "{% for x in y %} .. {% endfor %}" + ${0} + {% endblock %} +snippet block "twig block" + {% block ${1} %} + ${0} + {% endblock %} +snippet endblock "twig endblock" + {% endblock %}${0} +snippet cache "twig cache" + {% cache %} + ${0} + {% endcache %} +snippet endcache "twig endcache" + {% endcache %}${0} +snippet css "twig css" + {% css %} + ${0} + {% endcss %} +snippet endcss "twig endcss" + {% endcss %}${0} +snippet dd "twig dd" + {% dd ${1} %}${0} +snippet do "twig do" + {% do ${1} %}${0} +snippet embed "twig embed" + {% embed "${1}" %} + ${0} + {% endembed %} +snippet endembed "twig endembed" + {% endembed %}${0} +snippet exit "twig exit" + {% exit ${1} %} +snippet extends "twig extends" + {% extends "${1}" %}${0} +snippet ext "twig extends" + {% extends "${1}" %}${0} +snippet for "twig for" {% for ${1} in ${2} %} - ${3} + ${0} {% endfor %} -snippet ext "{% extends xyz %}" - {% extends ${1} %} +snippet fore "twig for else" + {% for ${1} in ${2} %} + ${3} + {% else %} + ${0} + {% endfor %} +snippet endfor "twig endfor" + {% endfor %}${0} +snippet from "twig from" + {% from "${1}" import ${2} %}${0} +snippet header "twig header" + {% header "${1}" %}${0} +snippet hook "twig hook" + {% hook "${1}" %}${0} +snippet html "twig html" + {% html %} + ${0} + {% endhtml %} +snippet endhtml "twig endhtml" + {% endhtml %}${0} +snippet if "twig if" + {% if ${1} %} + ${0} + {% endif %} +snippet ife "twig if else" + {% if ${1} %} + ${2} + {% else %} + ${0} + {% endif %} +snippet el "twig else" + {% else %} +snippet eif "twig elseif" + {% elseif ${1} %} + ${0} +snippet endif "twig endif" + {% endif %}${0} +snippet import "twig import" + {% import "${1}" as ${2} %}${0} +snippet include "twig include" + {% include "${1}" %}${0} +snippet includewith "twig include with parameters" + {% include "${1}" with ${2} %}${0} +snippet js "twig js" + {% js %} + ${0} + {% endjs %} +snippet endjs "twig endjs" + {% endjs %}${0} +snippet macro "twig macro" + {% macro ${1}(${2}) %} + ${0} + {% endmacro %} +snippet endmacro "twig endmacro" + {% endmacro %}${0} +snippet namespace "twig namespace" + {% namespace "${1}" %} + ${0} + {% endnamespace %} +snippet endnamespace "twig endnamespace" + {% endnamespace %}${0} +snippet nav "twig nav" + {% nav ${1} in ${2} %} + ${0} + {% endnav %} +snippet endnav "twig endnav" + {% endnav %}${0} +snippet paginate "twig paginate" + {% paginate ${1} as ${2} %}${0} +snippet redirect "twig redirect" + {% redirect "${1}" %}${0} +snippet requireguest "twig requireguest" + {% requireGuest %}${0} +snippet requirelogin "twig requirelogin" + {% requireLogin %}${0} +snippet requirepermission "twig requirepermission" + {% requirePermission "${1}" %}${0} +snippet set "twig set" + {% set ${1} = ${2} %}${0} +snippet setb "twig set block" + {% set ${1} %} + ${0} + {% endset %} +snippet endset "twig endset" + {% endset %}${0} +snippet switch "twig switch" + {% switch ${1} %} + {% case "${2}" %} + ${0} + {% default %} + + {% endswitch %} +snippet case "twig switch case" + {% case "${1}" %} + ${0} +snippet default "twig switch default" + {% default %} + ${0} +snippet endswitch "twig endswitch" + {% endswitch %}${0} +snippet use "twig use" + {% use "${1}" %}${0} +snippet verbatim "twig verbatim" + {% verbatim %} + ${0} + {% endverbatim %} +snippet endverbatim "twig endverbatim" + {% endverbatim %}${0} +snippet with "twig with" + {% with %} + ${0} + {% endwith %} +snippet endwith "twig endwith" + {% endwith %}${0} + +# Functions +snippet dump "twig dump" +
+		{{ dump(${1}) }}
+	
+ +# Filters +snippet translate "twig translate" + {{ "${1}"|t }}${0} diff --git a/sources_non_forked/vim-snippets/snippets/typescript.snippets b/sources_non_forked/vim-snippets/snippets/typescript.snippets index aa87242f..a784c5ef 100644 --- a/sources_non_forked/vim-snippets/snippets/typescript.snippets +++ b/sources_non_forked/vim-snippets/snippets/typescript.snippets @@ -1 +1,67 @@ extends javascript + +snippet tconst "ts const" + const ${1}: ${2:any} = ${3}; + ${0} +snippet tlet "ts let" + let ${1}: ${2:any} = ${3}; + ${0} +snippet tvar "ts var" + var ${1}: ${2:any} = ${3}; + ${0} +snippet + "ts create field" + ${1}: ${0:any} +snippet #+ "ts create private field using #" + #${1}: ${0:any} +snippet tpfi "ts create public field" + public ${1}: ${0:any} +snippet tprfi "ts create private field" + private ${1}: ${0:any} +snippet tprofi "ts create protected field" + protected ${1}: ${0:any} +snippet int "interface" + interface ${1} { + ${2}: ${3:any}; + ${0} + } +snippet intx "interface extends" + interface ${1} extends ${2} { + ${3}: ${4:any}; + ${0} + } +snippet tfun "ts function" + function ${1}(${2}): ${3:any} { + ${0} + } +snippet tpmet "ts public method" + public ${1}(${2}): ${3:any} { + ${0} + } +snippet tpsmet "ts public static method" + public static ${1}(${2}): ${3:any} { + ${0} + } +snippet tprmet "ts private method" + private ${1}(${2}): ${3:any} { + ${0} + } +snippet tpromet "ts protected method" + protected ${1}(${2}): ${3:any} { + ${0} + } +snippet tcla "ts class" + class ${1} { + ${2} + constructor(public ${3}: ${4: any}) { + ${5} + } + ${0} + } +snippet tclax "ts class extends" + class ${1} extends ${2} { + ${3} + constructor(public ${4}: ${5: any}) { + ${6} + } + ${0} + } diff --git a/sources_non_forked/vim-snippets/snippets/verilog.snippets b/sources_non_forked/vim-snippets/snippets/verilog.snippets index 5cd80f39..16bacc2a 100644 --- a/sources_non_forked/vim-snippets/snippets/verilog.snippets +++ b/sources_non_forked/vim-snippets/snippets/verilog.snippets @@ -9,7 +9,7 @@ snippet ife ${2} end else begin - ${1} + ${3} end # Else if statement snippet eif @@ -58,6 +58,42 @@ snippet al end # Module block snippet mod - module ${1:module_name} (${2}); + module ${1:`vim_snippets#Filename('$1', 'name')`} (${2}); ${0} endmodule +# For +snippet for + for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) begin + ${4} + end +# Forever +snippet forev + forever begin + ${0} + end +# Function +snippet fun + function ${1:void} ${2:name}(${3}); + ${0} + endfunction: $2 +# Task +snippet task + task ${1:name}(${2}); + ${0} + endtask: $1 +# Initial +snippet ini + initial begin + ${0} + end +# typedef struct packed +snippet tdsp + typedef struct packed { + int ${2:data}; + } ${1:`vim_snippets#Filename('$1_t', 'name')`}; +# typedef eum +snippet tde + typedef enum ${2:logic[15:0]} + { + ${3:REG = 16'h0000} + } ${1:my_dest_t}; diff --git a/sources_non_forked/vim-snippets/snippets/vhdl.snippets b/sources_non_forked/vim-snippets/snippets/vhdl.snippets index f13f5bf9..0683a218 100644 --- a/sources_non_forked/vim-snippets/snippets/vhdl.snippets +++ b/sources_non_forked/vim-snippets/snippets/vhdl.snippets @@ -3,7 +3,7 @@ snippet lib library ${1} - use ${1}.${2} + use $1.${2} # Standard Libraries snippet libs @@ -75,6 +75,16 @@ snippet prc ${2} end if; end process; +# process with clock and reset +snippet prcr + process (${1:clk}, ${2:nrst}) + begin + if ($2 = '${3:0}') then + ${4} + elsif rising_edge($1) then + ${5} + end if; + end process; # process all snippet pra process (${1:all}) diff --git a/sources_non_forked/vim-snippets/snippets/vim.snippets b/sources_non_forked/vim-snippets/snippets/vim.snippets index 6822b8a9..85cf2922 100644 --- a/sources_non_forked/vim-snippets/snippets/vim.snippets +++ b/sources_non_forked/vim-snippets/snippets/vim.snippets @@ -43,9 +43,14 @@ snippet ife if ... else statement endif snippet au augroup ... autocmd block augroup ${1:AU_NAME} - " this one is which you're most likely to use? + autocmd! autocmd ${2:BufRead,BufNewFile} ${3:*.ext,*.ext3|} ${0} - augroup end + augroup END +snippet auv augroupvisual ... autocmd block with visual placeholder + augroup ${1:AU_NAME} + autocmd! + ${0:${VISUAL}} + augroup END snippet bun Vundle.vim Plugin definition Plugin '${0}' snippet plug vim-plug Plugin definition @@ -76,3 +81,5 @@ snippet im imap ${1} ${2} snippet exe execute ${1} +snippet filename + `Filename()` diff --git a/sources_non_forked/vim-snippets/snippets/vue.snippets b/sources_non_forked/vim-snippets/snippets/vue.snippets index 0f14caec..1385ecb7 100644 --- a/sources_non_forked/vim-snippets/snippets/vue.snippets +++ b/sources_non_forked/vim-snippets/snippets/vue.snippets @@ -118,7 +118,7 @@ snippet vfilter snippet vfor
{{ $1 }} -
snippet vgetters getters: { @@ -176,3 +176,14 @@ snippet vstore ${1:key}: ${2:value} } }); + + +# vue-i18n snippets https://github.com/kazupon/vue-i18n + +snippet trans + $t('$1') + +# Translation with parameter +snippet transc + $t('$1', { $2: $3 }) + diff --git a/sources_non_forked/vim-surround/.github/FUNDING.yml b/sources_non_forked/vim-surround/.github/FUNDING.yml new file mode 100644 index 00000000..e2a49d11 --- /dev/null +++ b/sources_non_forked/vim-surround/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: tpope +custom: ["https://www.paypal.me/vimpope"] diff --git a/sources_non_forked/vim-surround/plugin/surround.vim b/sources_non_forked/vim-surround/plugin/surround.vim index 5626f22f..527dc3c9 100644 --- a/sources_non_forked/vim-surround/plugin/surround.vim +++ b/sources_non_forked/vim-surround/plugin/surround.vim @@ -1,6 +1,6 @@ " surround.vim - Surroundings " Author: Tim Pope -" Version: 2.1 +" Version: 2.2 " GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim if exists("g:loaded_surround") || &cp || v:version < 700 @@ -336,7 +336,16 @@ function! s:insert(...) " {{{1 if exists("g:surround_insert_tail") call setreg('"',g:surround_insert_tail,"a".getregtype('"')) endif - if col('.') >= col('$') + if &ve != 'all' && col('.') >= col('$') + if &ve == 'insert' + let extra_cols = virtcol('.') - virtcol('$') + if extra_cols > 0 + let [regval,regtype] = [getreg('"',1,1),getregtype('"')] + call setreg('"',join(map(range(extra_cols),'" "'),''),'v') + norm! ""p + call setreg('"',regval,regtype) + endif + endif norm! ""p else norm! ""P @@ -438,7 +447,7 @@ function! s:dosurround(...) " {{{1 let keeper = substitute(keeper,'^\s\+','','') let keeper = substitute(keeper,'\s\+$','','') endif - if col("']") == col("$") && col('.') + 1 == col('$') + if col("']") == col("$") && virtcol('.') + 1 == virtcol('$') if oldhead =~# '^\s*$' && a:0 < 2 let keeper = substitute(keeper,'\%^\n'.oldhead.'\(\s*.\{-\}\)\n\s*\%$','\1','') endif diff --git a/update_plugins.py b/update_plugins.py index 0fbbb29f..158e61fd 100644 --- a/update_plugins.py +++ b/update_plugins.py @@ -6,6 +6,7 @@ except ImportError: except ImportError: futures = None +import re import zipfile import shutil import tempfile @@ -13,25 +14,28 @@ import requests from os import path - -#--- Globals ---------------------------------------------- +# --- Globals ---------------------------------------------- PLUGINS = """ auto-pairs https://github.com/jiangmiao/auto-pairs -ale https://github.com/w0rp/ale +ale https://github.com/dense-analysis/ale vim-yankstack https://github.com/maxbrunsfeld/vim-yankstack +<<<<<<< HEAD +======= +ack.vim https://github.com/mileszs/ack.vim +bufexplorer https://github.com/jlanzarotta/bufexplorer +ctrlp.vim https://github.com/ctrlpvim/ctrlp.vim +>>>>>>> 5108ca4ec066ed9b93bab2c7f5b0d37d244ac0a9 mayansmoke https://github.com/vim-scripts/mayansmoke -nerdtree https://github.com/scrooloose/nerdtree +nerdtree https://github.com/preservim/nerdtree nginx.vim https://github.com/chr4/nginx.vim open_file_under_cursor.vim https://github.com/amix/open_file_under_cursor.vim -snipmate-snippets https://github.com/scrooloose/snipmate-snippets -tlib https://github.com/vim-scripts/tlib +tlib https://github.com/tomtom/tlib_vim vim-addon-mw-utils https://github.com/MarcWeber/vim-addon-mw-utils vim-bundle-mako https://github.com/sophacles/vim-bundle-mako vim-coffee-script https://github.com/kchmck/vim-coffee-script vim-colors-solarized https://github.com/altercation/vim-colors-solarized vim-indent-object https://github.com/michaeljsmith/vim-indent-object vim-less https://github.com/groenewege/vim-less -vim-markdown https://github.com/tpope/vim-markdown vim-pyte https://github.com/therubymug/vim-pyte vim-snipmate https://github.com/garbas/vim-snipmate vim-snippets https://github.com/honza/vim-snippets @@ -39,25 +43,37 @@ vim-surround https://github.com/tpope/vim-surround vim-expand-region https://github.com/terryma/vim-expand-region vim-multiple-cursors https://github.com/terryma/vim-multiple-cursors vim-fugitive https://github.com/tpope/vim-fugitive +vim-rhubarb https://github.com/tpope/vim-rhubarb goyo.vim https://github.com/junegunn/goyo.vim vim-zenroom2 https://github.com/amix/vim-zenroom2 vim-repeat https://github.com/tpope/vim-repeat vim-commentary https://github.com/tpope/vim-commentary -vim-go https://github.com/fatih/vim-go vim-gitgutter https://github.com/airblade/vim-gitgutter gruvbox https://github.com/morhetz/gruvbox vim-flake8 https://github.com/nvie/vim-flake8 vim-pug https://github.com/digitaltoad/vim-pug lightline.vim https://github.com/itchyny/lightline.vim lightline-ale https://github.com/maximbaz/lightline-ale -vim-abolish https://github.com/tpope/tpope-vim-abolish -mru.vim https://github.com/vim-scripts/mru.vim +vim-abolish https://github.com/tpope/vim-abolish +rust.vim https://github.com/rust-lang/rust.vim vim-markdown https://github.com/plasticboy/vim-markdown +<<<<<<< HEAD +======= +vim-gist https://github.com/mattn/vim-gist +vim-ruby https://github.com/vim-ruby/vim-ruby +typescript-vim https://github.com/leafgarland/typescript-vim +vim-javascript https://github.com/pangloss/vim-javascript +vim-python-pep8-indent https://github.com/Vimjas/vim-python-pep8-indent +vim-indent-guides https://github.com/nathanaelkane/vim-indent-guides +mru.vim https://github.com/vim-scripts/mru.vim +editorconfig-vim https://github.com/editorconfig/editorconfig-vim +dracula https://github.com/dracula/vim +>>>>>>> 5108ca4ec066ed9b93bab2c7f5b0d37d244ac0a9 """.strip() -GITHUB_ZIP = '%s/archive/master.zip' +GITHUB_ZIP = "%s/archive/master.zip" -SOURCE_DIR = path.join(path.dirname(__file__), 'sources_non_forked') +SOURCE_DIR = path.join(path.dirname(__file__), "sources_non_forked") def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir): @@ -65,13 +81,14 @@ def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir): # Download and extract file in temp dir req = requests.get(zip_path) - open(temp_zip_path, 'wb').write(req.content) + open(temp_zip_path, "wb").write(req.content) zip_f = zipfile.ZipFile(temp_zip_path) zip_f.extractall(temp_dir) - plugin_temp_path = path.join(temp_dir, - path.join(temp_dir, '%s-master' % plugin_name)) + content_disp = req.headers.get("Content-Disposition") + filename = re.findall("filename=(.+).zip", content_disp)[0] + plugin_temp_path = path.join(temp_dir, path.join(temp_dir, filename)) # Remove the current plugin and replace it with the extracted plugin_dest_path = path.join(source_dir, plugin_name) @@ -82,17 +99,19 @@ def download_extract_replace(plugin_name, zip_path, temp_dir, source_dir): pass shutil.move(plugin_temp_path, plugin_dest_path) - print('Updated {0}'.format(plugin_name)) + print("Updated {0}".format(plugin_name)) def update(plugin): - name, github_url = plugin.split(' ') + name, github_url = plugin.split(" ") zip_path = GITHUB_ZIP % github_url - download_extract_replace(name, zip_path, - temp_directory, SOURCE_DIR) + try: + download_extract_replace(name, zip_path, temp_directory, SOURCE_DIR) + except Exception as exp: + print("Could not update {}. Error was: {}".format(name, str(exp))) -if __name__ == '__main__': +if __name__ == "__main__": temp_directory = tempfile.mkdtemp() try: diff --git a/vimrcs/basic.vim b/vimrcs/basic.vim index 794752d9..910b37eb 100644 --- a/vimrcs/basic.vim +++ b/vimrcs/basic.vim @@ -1,5 +1,5 @@ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Maintainer: +" Maintainer: " Amir Salihefendic โ€” @amix3k " " Awesome_version: @@ -39,6 +39,7 @@ filetype indent on " Set to auto read when a file is changed from the outside set autoread +au FocusGained,BufEnter * checktime " With a map leader it's possible to do extra key combinations " like w saves the current file @@ -47,9 +48,9 @@ let mapleader = "," " Fast saving nmap w :w! -" :W sudo saves the file +" :W sudo saves the file " (useful for handling the permission-denied error) -command W w !sudo tee % > /dev/null +command! W execute 'w !sudo tee % > /dev/null' edit! """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -59,7 +60,7 @@ command W w !sudo tee % > /dev/null set so=7 " Avoid garbled characters in Chinese language windows OS -let $LANG='en' +let $LANG='en' set langmenu=en source $VIMRUNTIME/delmenu.vim source $VIMRUNTIME/menu.vim @@ -75,11 +76,11 @@ else set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store endif -"Always show current position +" Always show current position set ruler " Height of the command bar -set cmdheight=2 +set cmdheight=1 " A buffer becomes hidden when it is abandoned set hid @@ -91,23 +92,24 @@ set whichwrap+=<,>,h,l " Ignore case when searching set ignorecase -" When searching try to be smart about cases +" When searching try to be smart about cases set smartcase " Highlight search results set hlsearch " Makes search act like search in modern browsers -set incsearch +set incsearch " Don't redraw while executing macros (good performance config) -set lazyredraw +set lazyredraw " For regular expressions turn magic on set magic " Show matching brackets when text indicator is over them -set showmatch +set showmatch + " How many tenths of a second to blink when matching brackets set mat=2 @@ -122,7 +124,6 @@ if has("gui_macvim") autocmd GUIEnter * set vb t_vb= endif - " Add a bit extra margin to the left set foldcolumn=1 @@ -131,7 +132,7 @@ set foldcolumn=1 " => Colors and Fonts """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Enable syntax highlighting -syntax enable +syntax enable " Enable 256 colors palette in Gnome Terminal if $COLORTERM == 'gnome-terminal' @@ -163,7 +164,7 @@ set ffs=unix,dos,mac """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Files, backups and undo """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Turn backup off, since most stuff is in SVN, git et.c anyway... +" Turn backup off, since most stuff is in SVN, git etc. anyway... set nobackup set nowb set noswapfile @@ -205,7 +206,7 @@ vnoremap # :call VisualSelection('', '')?=@/ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Map to / (search) and Ctrl- to ? (backwards search) map / -map ? +map ? " Disable highlight when is pressed map :noh @@ -229,8 +230,8 @@ map h :bprevious map tn :tabnew map to :tabonly map tc :tabclose -map tm :tabmove -map t :tabnext +map tm :tabmove +map t :tabnext " Let 'tl' toggle between this and the last accessed tab let g:lasttab = 1 @@ -240,12 +241,12 @@ au TabLeave * let g:lasttab = tabpagenr() " Opens a new tab with the current buffer's path " Super useful when editing files in the same directory -map te :tabedit =expand("%:p:h")/ +map te :tabedit =expand("%:p:h")/ " Switch CWD to the directory of the open buffer map cd :cd %:p:h:pwd -" Specify the behavior when switching between buffers +" Specify the behavior when switching between buffers try set switchbuf=useopen,usetab,newtab set stal=2 @@ -362,7 +363,7 @@ endfunction function! CmdLine(str) call feedkeys(":" . a:str) -endfunction +endfunction function! VisualSelection(direction, extra_filter) range let l:saved_reg = @" diff --git a/vimrcs/extended.vim b/vimrcs/extended.vim index cb350ae5..5a951b6d 100644 --- a/vimrcs/extended.vim +++ b/vimrcs/extended.vim @@ -14,9 +14,9 @@ if has("mac") || has("macunix") elseif has("win16") || has("win32") set gfn=IBM\ Plex\ Mono:h14,Source\ Code\ Pro:h12,Bitstream\ Vera\ Sans\ Mono:h11 elseif has("gui_gtk2") - set gfn=IBM\ Plex\ Mono:h14,:Hack\ 14,Source\ Code\ Pro\ 12,Bitstream\ Vera\ Sans\ Mono\ 11 + set gfn=IBM\ Plex\ Mono\ 14,:Hack\ 14,Source\ Code\ Pro\ 12,Bitstream\ Vera\ Sans\ Mono\ 11 elseif has("linux") - set gfn=IBM\ Plex\ Mono:h14,:Hack\ 14,Source\ Code\ Pro\ 12,Bitstream\ Vera\ Sans\ Mono\ 11 + set gfn=IBM\ Plex\ Mono\ 14,:Hack\ 14,Source\ Code\ Pro\ 12,Bitstream\ Vera\ Sans\ Mono\ 11 elseif has("unix") set gfn=Monospace\ 11 endif @@ -85,7 +85,7 @@ vnoremap $2 `>a]` vnoremap $3 `>a}` vnoremap $$ `>a"` vnoremap $q `>a'` -vnoremap $e `>a"` +vnoremap $e `>a`` " Map auto complete of (, ", ', [ inoremap $1 ()i @@ -99,7 +99,7 @@ inoremap $e ""i """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => General abbreviations """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -iab xdate =strftime("%d/%m/%y %H:%M:%S") +iab xdate =strftime("%d/%m/%y %H:%M:%S") """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -139,6 +139,8 @@ map co ggVGy:tabnew:set syntax=qfpgg map n :cn map p :cp +" Make sure that enter is never overriden in the quickfix window +autocmd BufReadPost quickfix nnoremap """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -167,3 +169,59 @@ endfunc func! CurrentFileDir(cmd) return a:cmd . " " . expand("%:p:h") . "/" endfunc + +"================================================================================= +" +" Following file contains the commands on how to run the currently open code. +" The default mapping is set to F5 like most code editors. +" Change it as you feel comfortable with, keeping in mind that it does not +" clash with any other keymapping. +" +" NOTE: Compilers for different systems may differ. For example, in the case +" of C and C++, we have assumed it to be gcc and g++ respectively, but it may +" not be the same. It is suggested to check first if the compilers are installed +" before running the code, or maybe even switch to a different compiler. +" +" NOTE: Adding support for more programming languages +" +" Just add another elseif block before the 'endif' statement in the same +" way it is done in each case. Take care to add tabbed spaces after each +" elseif block (similar to python). For example: +" +" elseif &filetype == '' +" exec '! %' +" +" NOTE: The '%' sign indicates the name of the currently open file with extension. +" The time command displays the time taken for execution. Remove the +" time command if you dont want the system to display the time +" +"================================================================================= + +map :call CompileRun() +imap :call CompileRun() +vmap :call CompileRun() + +func! CompileRun() +exec "w" +if &filetype == 'c' + exec "!gcc % -o %<" + exec "!time ./%<" +elseif &filetype == 'cpp' + exec "!g++ % -o %<" + exec "!time ./%<" +elseif &filetype == 'java' + exec "!javac %" + exec "!time java %" +elseif &filetype == 'sh' + exec "!time bash %" +elseif &filetype == 'python' + exec "!time python3 %" +elseif &filetype == 'html' + exec "!google-chrome % &" +elseif &filetype == 'go' + exec "!go build %<" + exec "!time go run %" +elseif &filetype == 'matlab' + exec "!time octave %" +endif +endfunc diff --git a/vimrcs/filetypes.vim b/vimrcs/filetypes.vim index 84141be8..f92bea76 100644 --- a/vimrcs/filetypes.vim +++ b/vimrcs/filetypes.vim @@ -17,9 +17,6 @@ au FileType python map 1 /class au FileType python map 2 /def au FileType python map C ?class au FileType python map D ?def -au FileType python set cindent -au FileType python set cinkeys-=0# -au FileType python set indentkeys-=0# """""""""""""""""""""""""""""" @@ -29,11 +26,11 @@ au FileType python set indentkeys-=0# au FileType javascript setl fen au FileType javascript setl nocindent -au FileType javascript imap $log();hi -au FileType javascript imap alert();hi +au FileType javascript,typescript imap console.log();hi +au FileType javascript,typescript imap alert();hi -au FileType javascript inoremap $r return -au FileType javascript inoremap $f // --- PHFP2xi +au FileType javascript,typescript inoremap $r return +au FileType javascript,typescript inoremap $f // --- PHFP2xi function! JavaScriptFold() setl foldmethod=syntax @@ -75,3 +72,9 @@ endif " => Twig section """""""""""""""""""""""""""""" autocmd BufRead *.twig set syntax=html filetype=html + + +"""""""""""""""""""""""""""""" +" => Markdown +"""""""""""""""""""""""""""""" +let vim_markdown_folding_disabled = 1 diff --git a/vimrcs/plugins_config.vim b/vimrcs/plugins_config.vim index b6fa3236..8bc7ffba 100644 --- a/vimrcs/plugins_config.vim +++ b/vimrcs/plugins_config.vim @@ -1,6 +1,6 @@ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Important: -" This requries that you install https://github.com/amix/vimrc ! +" This requires that you install https://github.com/amix/vimrc ! " """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -14,6 +14,19 @@ call pathogen#infect(s:vim_runtime.'/sources_non_forked/{}') call pathogen#infect(s:vim_runtime.'/my_plugins/{}') call pathogen#helptags() +<<<<<<< HEAD +======= + +"""""""""""""""""""""""""""""" +" => bufExplorer plugin +"""""""""""""""""""""""""""""" +let g:bufExplorerDefaultHelp=0 +let g:bufExplorerShowRelativePath=1 +let g:bufExplorerFindActive=1 +let g:bufExplorerSortBy='name' +map o :BufExplorer + +>>>>>>> 5108ca4ec066ed9b93bab2c7f5b0d37d244ac0a9 """""""""""""""""""""""""""""" " => MRU plugin @@ -27,17 +40,32 @@ map f :MRU """""""""""""""""""""""""""""" let g:yankstack_yank_keys = ['y', 'd'] -nmap yankstack_substitute_older_paste -nmap yankstack_substitute_newer_paste +nmap yankstack_substitute_older_paste +nmap yankstack_substitute_newer_paste """""""""""""""""""""""""""""" " => FZF """""""""""""""""""""""""""""" +<<<<<<< HEAD nnoremap :Files nmap o :Buffers nnoremap g :Ag set rtp+=/usr/local/opt/fzf +======= +let g:ctrlp_working_path_mode = 0 + +" Quickly find and open a file in the current working directory +let g:ctrlp_map = '' +map j :CtrlP + +" Quickly find and open a buffer +map b :CtrlPBuffer + +let g:ctrlp_max_height = 20 +let g:ctrlp_custom_ignore = 'node_modules\|^\.DS_Store\|^\.git\|^\.coffee' + +>>>>>>> 5108ca4ec066ed9b93bab2c7f5b0d37d244ac0a9 """""""""""""""""""""""""""""" " => ZenCoding @@ -49,8 +77,9 @@ let g:user_zen_mode='a' """""""""""""""""""""""""""""" " => snipMate (beside support ) """""""""""""""""""""""""""""" -ino =snipMate#TriggerSnippet() -snor i=snipMate#TriggerSnippet() +ino =snipMate#TriggerSnippet() +snor i=snipMate#TriggerSnippet() +let g:snipMate = { 'snippet_version' : 1 } """""""""""""""""""""""""""""" @@ -99,10 +128,6 @@ au FileType mako vmap Si S"i${ _(2f"a) } """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => lightline """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -let g:lightline = { - \ 'colorscheme': 'wombat', - \ } - let g:lightline = { \ 'colorscheme': 'wombat', \ 'active': { @@ -113,12 +138,12 @@ let g:lightline = { \ 'component': { \ 'readonly': '%{&filetype=="help"?"":&readonly?"๐Ÿ”’":""}', \ 'modified': '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}', - \ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}' + \ 'fugitive': '%{exists("*FugitiveHead")?FugitiveHead():""}' \ }, \ 'component_visible_condition': { \ 'readonly': '(&filetype!="help"&& &readonly)', \ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))', - \ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())' + \ 'fugitive': '(exists("*FugitiveHead") && ""!=FugitiveHead())' \ }, \ 'separator': { 'left': ' ', 'right': ' ' }, \ 'subseparator': { 'left': ' ', 'right': ' ' } @@ -134,16 +159,10 @@ nnoremap z :Goyo """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Vim-go -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -let g:go_fmt_command = "goimports" - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Syntastic (syntax checker) +" => Ale (syntax checker and linter) """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let g:ale_linters = { -\ 'javascript': ['jshint'], +\ 'javascript': ['eslint'], \ 'python': ['flake8'], \ 'go': ['go', 'golint', 'errcheck'] \} @@ -163,3 +182,17 @@ let g:ale_lint_on_enter = 0 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let g:gitgutter_enabled=0 nnoremap d :GitGutterToggle + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => EditorConfig (project-specific EditorConfig rule) +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +let g:EditorConfig_exclude_patterns = ['fugitive://.*'] + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Fugitive +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Copy the link to the line of a Git repository to the clipboard +nnoremap v :.GBrowse! +xnoremap v :'<'>GBrowse!