Perform a split, followed by a command

4 Points

Andrew Radev Andrew Radev

10 years ago

I often want to execute a command that navigates to a different buffer. Some commands that come from plugins, for instance: :A to open the "alternate" file, usually the tests, :Emodel to open a rails model based on whatever is under the cursor, :tag function_name to jump to a tag.

Some of these have variants that open their results in a new split, but the interfaces are all slightly different. Instead, this mapping simply enters the command-line, types in a split command and then leaves the cursor after the | to enter the next command to execute. So, a simple __ before typing in A or Emodel or tag opens the results in a split window.

nnoremap __ :split \|<Space>