(Remove html character entities) |
m (Tagged as duplicated with Insert current filename with a copy of the template) |
||
Line 1: | Line 1: | ||
+ | <div id="News" style="background-color: #ccffcc; margin: 0 1em 0 1em; padding: 0 10px; border: 1px solid #000;"> |
||
+ | <big>'''Duplicate tip'''</big> |
||
+ | |||
+ | This tip is very similar to the following: |
||
+ | *[[Insert current filename]] |
||
+ | These tips need to be merged – see the [[Vim_Tips_Wiki:Merge_guidelines|merge guidelines]]. |
||
+ | </div> |
||
{{review}} |
{{review}} |
||
{{TipImported |
{{TipImported |
||
Line 40: | Line 47: | ||
---- |
---- |
||
+ | [[Category:Duplicate]] |
Revision as of 10:44, 28 January 2011
Duplicate tip
This tip is very similar to the following:
These tips need to be merged – see the merge guidelines.
Tip 530 Printable Monobook Previous Next
created August 13, 2003 · complexity basic · author Geoff Hubbard · version 5.7
To get the name of the file you are currently editing use:
@%
If you want to make sure of the path as well use:
expand("%:p")
References
- :help @
- :help expand()
- :help cmdline-special
- Copy filename to clipboard shows why it might be useful
Comments
To enter the name of the current file in insert or command mode, use <C-R>%.
If you want to use it as part of a command line just use %, for example:
!echo %
Ctrl-G is an easier way to get this info.
If you need to insert otherfile names (say the *.h name in an #include), you can do C-X+C-F for filename completion.