Oleg Pavliv
Oleg Pavliv

Reputation: 21162

quick search or auto-complete in command's history

Is it possible to use quick search and/or auto-complete in mini-buffer for command's history?

I will give an example with sqlplus package but I think it's applicable for many interactive commands.

I can launch M-sqlplus and open an sqlplus session by specifying the connect string. The connect string is stored then in a variable sqlplus-connect-string-history as you can see from the source of sqlplus.

(read-string 
 (format "Connect string%s: " 
         (if default-connect-string 
             (format " [default %s]" default-connect-string) ""))
 nil 
 'sqlplus-connect-string-history 
 default-connect-string)

I want to run M-sqlplus then do a quick search or auto-complete to be able to enter a couple of letters and find the correct connect string.

I know that I can get the previous/next item using M-p and M-n but I want a quick access to my command's history.

EDIT. I can ask the same question about the M-dired command. After invoking the M-dired I can use M-p and M-n to access the dired command history. Now I want the quick search for previously entered directories in dired.

Upvotes: 1

Views: 396

Answers (1)

pmr
pmr

Reputation: 59811

You can use C-r and C-s to i-search your buffer history. I assume you want your history to be stored across sessions, so you also need

(savehist-mode 1)

Upvotes: 3

Related Questions