sponsor Vim development Vim logo Vim Book Ad

QFEnter : Open a Quickfix item in a window you choose

 script karma  Rating 12/3, Downloaded by 355    Comments, bugs, improvements  Vim wiki

created by
yssl
 
script type
utility
 
description
A normal mode example : https://f.cloud.github.com/assets/5915359/1632228/bb76dc72-5774-11e3-83d1-2933b95d5b81.gif
A visual mode example : https://f.cloud.github.com/assets/5915359/2006385/61c6f720-8717-11e3-806b-d0f276af3ef9.gif

More information : https://github.com/yssl/QFEnter

# QFEnter

QFEnter allows you to open a Quickfix item in a window you choose.
You can choose the window by giving it a focus just before jumping to Quickfix window.
You can also open multiple items at once by including them in the visual block.

## Usage

In Quickfix window,

<Enter>, <2-LeftMouse>  
Normal mode : Open an item under cursor in a previously focused window.  
Visual mode : Open items in visual block in a previously focused window. As a result, the last item appears in the window.

<Leader><Enter>  
Normal mode : Open an item under cursor in a new vertical split from a previously focused window.  
Visual mode : Open items in visual block in a sequence of new vertical splits from a previously focused window.

<Leader><Space>  
Normal mode : Open an item under cursor in a new horizontal split from a previously focused window.  
Visual mode : Open items in visual block in a sequence of new horizontal splits from a previously focused window.

<Leader><Tab>  
Normal mode : Open an item under cursor in a new tab.  
Visual mode : Open items in visual block in a sequence of new tabs.  
Quickfix window is automatically opened in the new tab to help you open other Quickfix items.

You can change the key mappings in your .vimrc. The default setting is,
```
let g:qfenter_open_map = ['<CR>', '<2-LeftMouse>']
let g:qfenter_vopen_map = ['<Leader><CR>']
let g:qfenter_hopen_map = ['<Leader><Space>']
let g:qfenter_topen_map = ['<Leader><Tab>']
```

## Motivation

Default opening methods for QuickFix items are quite inconvenient,

- You cannot select a window in which a file is opened when you press `<Enter>` in Quickfix.  

  > Hitting the <Enter> key or double-clicking the mouse on a line has the same effect. The
file containing the error is opened in the window above the quickfix window.  
`:help quickfix`

  It is inconsistent with other Quickfix commands like `:cnext` and `:cprev` which open a file in a previously focused window.

- You also cannot specify the window when you use `Ctrl-W <Enter>`,
because Vim always create a new horizontal split window above Quickfix window and open a file in it.
There is even no command for 'open in new vertical split window'.

They are confusing and bother me every time, so I wrote a simple plugin to make up for these weak points.
It's name comes from the most basic way to open a file from Quickfix window - the `<Enter>` key.
 
install details
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
QFEnter.zip 2.2.1 2014-03-17 7.0 yssl - now QFEnter supports vim's 'switchbuf' option.
  if you change 'switchbuf' option, QFEnter adapts its behavior to the changed option.
- thanks to sergey-vlasov!
- update document for 'switchbuf' option.
QFEnter.zip 2.1.0 2014-01-28 7.0 yssl - subdivide g:qfenter_keep_quickfixfocus option for each command.
  e.g. g:qfenter_keep_quickfixfocus.open, g:qfenter_keep_quickfixfocus.cnext,
  g:qfenter_keep_quickfixfocus.cprev
- bug fix : not updated window for already opened file when g:qfenter_keep_quickfixfocus==1
- thanks for mMontu!
QFEnter.zip 2.0.0 2014-01-27 7.0 yssl - visual mode support to open multiple Quickfix items at once
- add option to keep focus in Quicifix window after opening items  (g:qfenter_keep_quickfixfocus)
- support :cnext and :cprev command to open items
QFEnter-1.3.0.zip 1.3.0 2013-12-09 7.0 yssl improve features
  - improve auto quickfix open when 'open in new tab'
    - restore view(cursor position, scroll..) of quickfix window to auto-opened quickfix window
    - restore size of quickfix window to auto-opened quickfix window
    - now you don't need to provide g:qfenter_copen_modifier option. QFEnter now smartly determine whether the new quickfix window is botright or topleft, vertical or horizontal.
  - change g:qfenter_ttopen_map option name to g:qfenter_topen_map (backward compatibility maintained)
  - remove '<Tab><Tab>' from default mapping
QFEnter-1.2.0.zip 1.2.0 2013-12-08 7.0 yssl     - now, Quickfix window is automatically opened after "open in a new tab"
    - add options about Quickfix auto opening
    - add one more default mapping for "open in a new tab"
    - code refactoring
QFEnter-1.1.1.zip 1.1.1 2013-12-06 7.0 yssl     - change default mapping for "open a file in a new tab"
QFEnter.zip 1.1.0 2013-12-05 7.0 yssl - add new feature
     : open a file under cursor in new tab window.
     : register custom "cc" command with g:qfenter_cc_cmd
QFEnter.zip 1.0.0 2013-11-23 7.0 yssl Initial upload
ip used for rating: 50.16.135.73

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo