About: Command line file name completion   Sponge Permalink

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

In the command line, when a file name is expected, you can press Tab or Shift-Tab for the next or previous file name. After starting file name completion, you can press Ctrl-N or Ctrl-P (next and previous) with the same effect. In addition, the standard Ctrl-W is available to delete the last word before the cursor. It may happen that you browse a directory, and want to browse another directory: :e dir1/long-file-name1 :e dir1/long-file-name2 ... :e dir1/long-file-name51 Now you want: :e dir2/

AttributesValues
rdfs:label
  • Command line file name completion
rdfs:comment
  • In the command line, when a file name is expected, you can press Tab or Shift-Tab for the next or previous file name. After starting file name completion, you can press Ctrl-N or Ctrl-P (next and previous) with the same effect. In addition, the standard Ctrl-W is available to delete the last word before the cursor. It may happen that you browse a directory, and want to browse another directory: :e dir1/long-file-name1 :e dir1/long-file-name2 ... :e dir1/long-file-name51 Now you want: :e dir2/
Version
  • 7(xsd:integer)
dbkwik:vim/property/wikiPageUsesTemplate
Previous
  • 1593(xsd:integer)
Category
  • Completion
Subpage
  • /200807
Complexity
  • basic
Created
  • 2008(xsd:integer)
ID
  • 1594(xsd:integer)
NEXT
  • 1595(xsd:integer)
abstract
  • In the command line, when a file name is expected, you can press Tab or Shift-Tab for the next or previous file name. After starting file name completion, you can press Ctrl-N or Ctrl-P (next and previous) with the same effect. In addition, the standard Ctrl-W is available to delete the last word before the cursor. It may happen that you browse a directory, and want to browse another directory: :e dir1/long-file-name1 :e dir1/long-file-name2 ... :e dir1/long-file-name51 Now you want: :e dir2/ in the command line. You could press Ctrl-N to cycle through the rest of the files, or press Ctrl-P to cycle back. Alternatively, you could press backspace to delete long-file-name51, or press Ctrl-W five times to remove the words "name51", "-", "file", "-" and "long" from the cmdline. A better procedure is to use the following script. cnoremap e(RemoveLastPathComponent()) function! s:RemoveLastPathComponent() return substitute(getcmdline(), '\%(\\ \|[\\/]\@!\f\)\+[\\/]\=$\|.$', '', '') endfunction Then you can press Ctrl-T to remove the last path component. It uses 'isfname', and stops at characters not included, except escaped spaces. At least one character is always removed. " Variant, first removes the extension. function! s:RemoveLastPathComponent() let c = getcmdline() let cRoot = fnamemodify(c, ':r') return (c != cRoot ? cRoot : substitute(c, '\%(\\ \|[\\/]\@!\f\)\+[\\/]\=$\|.$', '', '')) endfunction All of the above always remove from the end of command line, regardless of the current cursor position. (And that is mostly fine, since it's the most common use case.) The following extends the last variant with performing removal only left of the cursor. function! s:RemoveLastPathComponent() let l:cmdlineBeforeCursor = strpart(getcmdline(), 0, getcmdpos() - 1) let l:cmdlineAfterCursor = strpart(getcmdline(), getcmdpos() - 1) let l:cmdlineRoot = fnamemodify(cmdlineBeforeCursor, ':r') let l:result = (l:cmdlineBeforeCursor ==# l:cmdlineRoot ? substitute(l:cmdlineBeforeCursor, '\%(\\ \|[\\/]\@!\f\)\+[\\/]\=$\|.$', '', '') : l:cmdlineRoot) call setcmdpos(strlen(l:result) + 1) return l:result . l:cmdlineAfterCursor endfunction cnoremap e(RemoveLastPathComponent())
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