dgrnbrg / vim-redl

A better Vim integration story for Clojure
106 stars 8 forks source link

Repl History in Tmux / cmdline Vim #24

Closed noahlz closed 9 years ago

noahlz commented 10 years ago

Repl history is working great in gvim, but it does not work in command line vim from tmux.

My dot files a here:

With changes from this stackoverflow answer I got the arrow keys working, but in the Redl repl buffer, '' appears to cycle it through some other mode then back to insert - it pastes nothing.

Again, gvim works fine...it seems to be something tmux related?

In any case, something else I might try is changing the keybinding for repl history, i.e. <C-P>/ <C-N>. Where / how to do that correctly?

mascip commented 9 years ago

I had to add this to my .vimrc, to get history to work in Tmux:

  imap <silent> <C-S-K> <Plug>clj_repl_uphist.
  imap <silent> <C-S-J> <Plug>clj_rbepl_downhist.

which is just what was in vim-redl source code, but without the .

mascip commented 9 years ago

Oh, you might have noticed what I didn't mention : I use <C-S-K> instead of <C-K>, because <C-K> is a Tmux binding for me.

dgrnbrg commented 9 years ago

Is there some way that I can integrate this into the main vim-redl? Or @mascip, would you be willing to write a pull request to add these instructions to the README for tmux users?

mascip commented 9 years ago

Can you try my solution @noahlz ?

On my two machines it's the <buffer> that make the history commands not work, even when I don't use Tmux! (even though my machines don't mind for other commands... no idea why).

What <buffer> is for: "If the first argument to one of these commands is "" the mapping will be effective in the current buffer only"

Although it does make sense to only define the vim-redl mappings in a vim-redl buffer, we could delete these in the code, for the two history commands. Or I can write this in the doc: "If some of these key bindings don't work, you can try to redefine them like this in your .vimrc:

imap <silent> <C-K> <Plug>clj_repl_uphist.

Tell me which solution you prefer @dgrnbrg .

Either way, I can add a piece of doc for people who are not familiar with <Plug> or won't think about defining their own binding, saying: "If you don't like these default key bindings or if they don't work, you can define your own. For example:

imap <silent> <C-S-K> <Plug>clj_repl_uphist.

PS: I will be away from tomorrow (Sunday), so won't be able to contribute until the end of the week.

dgrnbrg commented 9 years ago

I like either one--it's been so long since I've written VimScript that I don't have an opinion on style any more.

On Sat, Aug 2, 2014 at 9:01 AM, Pierre Masci notifications@github.com wrote:

Can you try my solution @noahlz https://github.com/noahlz ?

On my two machines it's the that make the history commands not work, even when I don't use Tmux! (even though my machines don't mind for other commands... no idea why).

What is for: "If the first argument to one of these commands is "" the mapping will be effective in the current buffer only"

Although it does make sense to only define the vim-redl mappings in a vim-redl buffer, we could delete these in the code, for the two history commands. Or I can write this in the doc: "If some of these key bindings don't work, you can try to redefine them like this in your .vimrc:

imap clj_repl_uphist.

Tell me which solution you prefer @dgrnbrg https://github.com/dgrnbrg .

Either way, I can add a piece of doc for people who are not familiar with

or won't think about defining their own binding, saying: "If you don't like these default key bindings or if they don't work, you can define your own. For example: imap clj_repl_uphist. PS: I will be away from tomorrow (Sunday), so won't be able to contribute until the end of the week. — Reply to this email directly or view it on GitHub https://github.com/dgrnbrg/vim-redl/issues/24#issuecomment-50962257.
noahlz commented 9 years ago

@mascip Your solution worked for me, thanks!!! :thumbsup:

noahlz commented 9 years ago

And thanks @dgrnbrg for merging!