Created
October 31, 2017 16:50
-
-
Save hoelzro/b5fb7deeef25f16656a88b81ad6cf4eb to your computer and use it in GitHub Desktop.
A dumb vimscript "workbench" for sending queries to a MySQL shell in another tmux pane
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function! SendSelectionToMySQL(start_line_no, end_line_no) | |
| let lines = getline(a:start_line_no, a:end_line_no) | |
| let index = 0 | |
| for line in lines | |
| call system('tmux send-keys -l -t:.- ' . shellescape(line)) | |
| if index == len(lines) - 1 | |
| call system('tmux send-keys -t:.- ' . shellescape('\;') . ' Enter') | |
| else | |
| call system('tmux send-keys -t:.- Enter ') | |
| endif | |
| let index = index + 1 | |
| endfor | |
| endfunction | |
| command! -range SendSelectionToMySQL :call SendSelectionToMySQL(<line1>, <line2>) | |
| nnoremap <F5> vip | |
| vnoremap <F5> :SendSelectionToMySQL<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment