About: Enhanced command window   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

and you * would prefer entering : commands in a modal command window rather than on the command line Then this tip is for you. Some key features of the command window (see [help cmdwin]) that would lead one to be interested in it are: * One can edit the buffer any way one wants * Hitting results in the line one was on being executed * editing in the command window is much nicer than editing on the command line Begin with some mappings to easily enter and leave the command window with a single key-stroke: If one wants to get even more fancy, one can start with the map

AttributesValues
rdfs:label
  • Enhanced command window
rdfs:comment
  • and you * would prefer entering : commands in a modal command window rather than on the command line Then this tip is for you. Some key features of the command window (see [help cmdwin]) that would lead one to be interested in it are: * One can edit the buffer any way one wants * Hitting results in the line one was on being executed * editing in the command window is much nicer than editing on the command line Begin with some mappings to easily enter and leave the command window with a single key-stroke: If one wants to get even more fancy, one can start with the map
Version
  • 6(xsd:integer)
dbkwik:vim/property/wikiPageUsesTemplate
Previous
  • 680(xsd:integer)
Author
  • Suresh Govindachar
Complexity
  • intermediate
Created
  • 2004-03-18(xsd:date)
ID
  • 681(xsd:integer)
NEXT
  • 682(xsd:integer)
Rating
  • 16(xsd:integer)
abstract
  • and you * would prefer entering : commands in a modal command window rather than on the command line Then this tip is for you. Some key features of the command window (see [help cmdwin]) that would lead one to be interested in it are: * One can edit the buffer any way one wants * Hitting results in the line one was on being executed * editing in the command window is much nicer than editing on the command line Basic use of the command window is easy, but this tip allows you to improve the command window with simple mappings to enter and leave it, as well as providing missing functionality from the command line such as using to view matches for what you have typed so far. Begin with some mappings to easily enter and leave the command window with a single key-stroke: nmap q:_ nmap q/ q/_ nmap q? q?_ augroup ECW_au au! au CmdwinEnter * nmap :q au CmdwinLeave * nmap q:_ augroup END Some nice things about the command line that are not present in the usual command window are: * The and arrow find all the commands that match the text entered to the left of the cursor * Hitting shows the ways in which the typed text can be completed (see [ help cmdline-completion]) It is possible to have similar features in the command-window too. For the feature, add the following au-command event triggered maps: augroup ECW_au " musn't do au! again au CmdwinEnter : imap y0:let@/='^'.@0? au CmdwinLeave : iunmap au CmdwinEnter : imap y0:let@/='^'.@0/ au CmdwinLeave : iunmap au CmdwinLeave : :let @/="" augroup END Now, while in the command window, going to insert mode and hitting the arrow followed by the n key results in one visiting all the commands that match the text to the left of the cursor when the key was hit – then hitting while on any line causes it to be executed. Likewise, for the arrow. Next for the feature. This is slightly more complex. Begin by adding the following autocommand event triggered maps: augroup ECW_au " musn't do au! again au CmdwinEnter : imap y0:ECWCtrlD au CmdwinLeave : iunmap augroup END Then provide this function: function! s:ECWCtrlD() With this function, hitting while in insert mode in the command window results in more information about the text to the left of the cursor appearing on the lines below the cursor. This information can left on the command window or removed by typing u (undo). The nature of the information provided by depends on what is to the left of the cursor: * If the stuff to the left of the cursor looks, essentially like "map " or "map foo" then the information provided by is the same as the information that appears when the the same stuff is typed on the command line and return is hit. * If the stuff to the left of the cursor begins, essentially like "sf " or like "find " then what is displayed on is the glob of the remaining stuff (after appending the remaining stuff with a *) * If the stuff to the left of the cursor looks like neither of the above two cases then what is displayed is the glob of the very last non-space separated "word" (after appending that "word" with a *) function! s:ECWCtrlD() if (match(@", '^ *[a-z]\?map\s\s*\(\S\S*\)\?\s*$') >=0 ) let s:foo = @" let save_more=&more set nomore execute ':redir @" |'.s:foo.'|redir END' let &more = save_more put=@" "Keep this next command even though Vim complains -- it is "a work-around for some "unknown bad thing" silent normal return endif "sf and find can have space separated arguments if (match(@", '^ *\(\(sf\)\|\(find\)\)\ *') >=0 ) let s:foo = substitute(@", '^ *\(\(sf\)\|\(find\)\)\ *', '', '') else "pick the trailing non-space separated stuff let s:foo = substitute(@", '\(.\{-}\)\(\S\S*\s*\)$', '\2', '') endif let s:foo = substitute(s:foo, '\s*$', '*', '') "OK if ending has two wild-cards let @"=glob(s:foo) if(@" == "") | let @"='no match' | endif put=@" endfunction if !exists(":ECWCtrlD") command -nargs=0 ECWCtrlD call s:ECWCtrlD() endif If one wants to get even more fancy, one can start with the map nmap :ECWtobedefined wherein the function ECWtobedefined opens up a new buffer in which one can do anything one likes. Even if this new buffer merely mimics the command window, it will the feature of co-existing with other buffers -- which is a feature that the command window does not have!
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software