]> git.wincent.com - docvim.git/blob - tests/fixtures/markdown/integration-ferret-ftplugin-qf.vim
2d277d9ba309046b62db88fadac86f25d70228a7
[docvim.git] / tests / fixtures / markdown / integration-ferret-ftplugin-qf.vim
1 " Copyright 2015-present Greg Hurrell. All rights reserved.
2 " Licensed under the terms of the BSD 2-clause license.
3
4 ""
5 " @option g:FerretQFOptions boolean 1
6 "
7 " Controls whether to set up setting overrides for |quickfix| windows. These are
8 " various settings, such as |norelativenumber|, |nolist| and |nowrap|, that are
9 " intended to make the |quickfix| window, which is typically very small relative
10 " to other windows, more usable.
11 "
12 " A full list of overridden settings can be found in |ferret-overrides|.
13 "
14 " To prevent the custom settings from being applied, set |g:FerretQFOptions|
15 " to 0:
16 "
17 " ```
18 " let g:FerretQFOptions=0
19 " ```
20 let s:options=get(g:, 'FerretQFOptions', 1)
21 if s:options
22   setlocal nolist
23   if exists('+relativenumber')
24     setlocal norelativenumber
25   endif
26   setlocal nowrap
27   setlocal number
28
29   " Want to set scrolloff only for the qf window, but it is a global option.
30   let s:original_scrolloff=&scrolloff
31   set scrolloff=0
32
33   if has('autocmd')
34     augroup FerretQF
35       autocmd!
36       autocmd BufLeave <buffer> execute 'set scrolloff=' . s:original_scrolloff
37       autocmd BufEnter <buffer> set scrolloff=0 | setlocal nocursorline
38     augroup END
39   endif
40 endif
41
42 ""
43 " @option g:FerretQFMap boolean 1
44 "
45 " Controls whether to set up mappings in the |quickfix| results window for
46 " deleting results. The mappings include:
47 "
48 " - `d` (|visual-mode|): delete visual selection
49 " - `dd` (|Normal-mode|): delete current line
50 " - `d`{motion} (|Normal-mode|): delete range indicated by {motion}
51 "
52 " To prevent these mappings from being set up, set to 0:
53 "
54 " ```
55 " let g:FerretQFMap=0
56 " ```
57 let s:map=get(g:, 'FerretQFMap', 1)
58 if s:map
59   " Make it easy to remove entries from the quickfix listing.
60   " TODO: distinguish between quickfix and location list
61   nnoremap <buffer> <silent> d :set operatorfunc=ferret#private#qf_delete_motion<CR>g@
62   nnoremap <buffer> <silent> dd :call ferret#private#qf_delete()<CR>
63   vnoremap <buffer> <silent> d :call ferret#private#qf_delete()<CR>
64 endif