execute visual/motion; syntax of doc window#24
execute visual/motion; syntax of doc window#24dstahlke wants to merge 2 commits intoivanov:masterfrom
Conversation
|
Just a quick note: it appears that you already had a mapping to run a visually selected bit of code. My patch differs in that it works not just with linewise selections but also with character and block selections. |
|
Dan, thanks for your contributions. It'd be easier to deal with these three things as separate pull requests.
looking forward to your feedback (sorry, i hate it myself when my contributions get pushed back a bit from upstream) |
|
Paul, I could redo this as two separate pull requests if you would like. I am new to using git in a collaborative way. Regarding your comments:
I have other suggestions that would perhaps best be discussed as part of a separate pull request. For instance, the key mapping should be made buffer-local with the |
Paul,
I have made three changes:
The doc window gets "set syntax=rest" so that it can be colorized properly if the user has installed the rest syntax plugin (which isn't part of stock vim).
Ability to execute a block of python code selected visually, or via a motion command. I have mapped "<leader>p" for this purpose, although feel free to change that of course. "<leader>p" with code visually selected of course executes that visual selection. In normal mode, "<leader>p" acts as an operator which takes a motion. So for instance "\piw" executes the current word, "\pi)" executes stuff within parenthesis, "\pp" executes the current line, etc. This is useful for inspecting the value of a variable or half of an expression.
I have made some of the key mappings route through "<Plug>" mappings. So for instance, there is a mapping "<Plug>IPyRunLine" for running the current line. The advantage of doing it this way is that users are able to easily set up the key mappings however they want. See ":help using-<Plug>" for more info on this.