Commit ae952fcc authored by Hauleth's avatar Hauleth

Initial commit

parents
The MIT License (MIT)
Copyright (c) 2016-2017 Łukasz Niemier
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# QFx
Simple plugin for placing signs for QuickFix results.
## Installation
Just follow instructions for your plugin manager of choice or if you do not have
one then check `:h pack-add`.
## Usage
This will work OOTB with all QuickFix command. So if you want to check this out
then run for example `:grep fun`.
## License
Check out [LICENSE](LICENSE) file.
let s:sign_count = get(s:, 'sign_count', 0)
function! qfx#place() abort
if s:sign_count > 0
return
endif
let l:qflist = getqflist()
if len(l:qflist) > get(g:, 'qfx_signs_max', 200)
echohl ErrorMsg
echom 'To many results, aborting'
echohl NONE
return
endif
for l:error in l:qflist
if l:error.bufnr < 0 | continue | endif
let s:sign_count = s:sign_count + 1
if l:error.type ==# 'E'
let l:type = 'QFxErr'
elseif l:error.type ==# 'W'
let l:type = 'QFxWarn'
else
let l:type = 'QFxInfo'
endif
let l:err_sign = 'sign place ' . s:sign_count
\ . ' line=' . l:error.lnum
\ . ' name=' . l:type
\ . ' buffer=' . l:error.bufnr
silent! execute l:err_sign
endfor
endfunction
function! qfx#clear() abort
while s:sign_count > 0
execute 'sign unplace ' . s:sign_count
let s:sign_count = s:sign_count - 1
endwhile
redraw!
endfunction
*qfx.txt* Display sings on QuickFix results
Author: Hauleth <lukasz@niemier.pl>
Repo: https://gitlab.com/hauleth/qfx.vim
License: MIT <https://opensource.org/licenses/MIT>
INTRODUCTION *qfx*
This plugin automatically shows signs in place after quickfix commands. This
is useful for people who do not like using automatic linters like |ale.vim| or
|syntastic|. It integrates quite well with |asyncdo| and propably other
asynchronous |:make| runners.
FUNCTIONS *qfx-functions*
qfx#place() *qfx#place()*
Place signs on lines in |getqflist()|.
qfx#clear() *qfx#clear()*
Clear previously set signs.
COMMANDS *qfx-commands*
:QfxPlace *:QfxPlace*
The same as |qfx#place()|.
:QfxClear *:QfxClear*
The same as |qfx#clear()|.
VARIABLES *qfx-variables*
g:qfx_signs_max *g:qfx_signs_max*
Maximum amount of placed signs. This is used to improve
performance of the plugin. Defaults to 200.
FAQ *qfx-faq*
How to disable automatic placing signs on |quickfix| commands without
uninstalling plugin?
>
:autocommand! qfx
<
vim:tw=78:et:ft=help:norl:
" Display signs on QuickFix result lines
" Maintainer: Hauleth <lukasz@niemier.pl>
" License: MIT
if exists('g:loaded_qfx')
finish
endif
let g:loaded_qfx = 1
let s:save_cpo = &cpo
set cpo&vim
sign define QFxErr texthl=ErrorMsg text= 
sign define QFxWarn texthl=Cursor text= 
sign define QFxInfo texthl=Search text= 
command! -nargs=0 -bar QfxClear call qfx#clear()
command! -nargs=0 -bar QfxPlace call qfx#place()
augroup qfx
autocmd!
autocmd QuickFixCmdPre [^l]* SignsClear
autocmd QuickFixCmdPost [^l]* SignsPlace
autocmd BufWinLeave * if getbufvar(0 + expand('<abuf>'), '&ft') ==? 'qf' | SignsClear | endif
autocmd BufWinEnter * if getbufvar(0 + expand('<abuf>'), '&ft') ==? 'qf' | SignsPlace | endif
augroup END
let &cpo = s:save_cpo
unlet s:save_cpo
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment