How can I get full-line completion in Emacs, similar to Vim's CTRL-x l?

For example, in Vim, if I type:

from d<CTRL-X>-l

I will get a popup like this:

vim line completion popup

Which shows all the lines matching that prefix in open buffers.

share|improve this question
up vote 2 down vote accepted

This doesn't give a list to choose from (try tuning autocomplete for that) but otherwise gives the "feeling".

(defun my-expand-lines ()
  (interactive)
  (let ((hippie-expand-try-functions-list
         '(try-expand-line)))
    (call-interactively 'hippie-expand)))

(define-key evil-insert-state-map (kbd "C-x C-l") 'my-expand-lines)
share|improve this answer
    
Awesome! Now, is it possible to use that with a popup list? – David Wolever Jul 29 '13 at 18:22
1  
@DavidWolever: cx4a.org/software/auto-complete is one way to get popups but AC is a beast of a library. I wouldn't know about using it. – progo Jul 30 '13 at 10:10

hippie-expand does that, you just have to configure it as described on the last answer here: Does Emacs has word and line completion (like Vim's insert mode completion)?

share|improve this answer
    
Ah… where does it mention how to expand lines? I've poked around, but don't see anything obvious :\ – David Wolever Jul 29 '13 at 16:07
    
Basically, you have to add the function try-expand-line to hippie-expand-try-functions-list (as in the answer you accepted). But I've never used a popup for this one either... – jfsantos Jul 30 '13 at 17:14

Emacs comes with multi-occur if you are comfortable navigating the list as a buffer.

Otherwise you should get to know helm. See this answer https://stackoverflow.com/a/14731718/903943

share|improve this answer

Icicles command icicle-occur does what you ask. It lets you find and navigate among search-pattern matches across multiple files or buffers, updating the set of search hits incrementally as you change the pattern to search for. You can progressively refine the search by applying additional patterns. You can either access hits directly, individually, or cycle among them in various cycle orders.

share|improve this answer

See https://github.com/redguardtoo/eacl - Emacs auto complete line(s)

The difference between eacl and other solutions:

  • it gets more candidate by grepping files in current project (project root is automatically detected if you use git/svn/mercurial)

  • it can complete multi line statement by grepping

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.