Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vim-pipe submits the whole buffer only #10

Open
randomizedthinking opened this issue Mar 30, 2016 · 1 comment
Open

vim-pipe submits the whole buffer only #10

randomizedthinking opened this issue Mar 30, 2016 · 1 comment

Comments

@randomizedthinking
Copy link

Then a user has to either open a new file or comment out other lines when working on different piece of codes. It becomes so inconvenient especially when working with a large file. I wonder it possible to add a keymap which will submit selected lines? Thanks!

@jpassaro
Copy link

The VimPipe() command that r maps to does take a range, which means this is trivial to implement. This is in my vimrc:

vnoremap <silent> <LocalLeader>r : call VimPipe()<CR>

I have certain SQL files with common commands that I want to run individually, not all at once, without having to comment out the rest. For those, I also override the range for the usual VimPipe() command:

nnoremap <silent> <LocalLeader>r :. call VimPipe()<CR>

(uses "." as the range, i.e. the current line, rather than "%" which is the whole buffer.)

@krisajenkins would you be interested in PRs for the following?

  • Optionally implement the vnoremap based on, say, g:vimpipe_selection = 1
  • Change the nnoremap to something like exec "nnoremap <silent> " . g:vimpipe_invoke_map . " :" . g:vimpipe_invoke_range . "call VimPipe()<CR>", with g:vimpipe_invoke_range having a default value of %

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants