vim and plasticity



Command-line mode



:!javac %



6. Ex special characters				*cmdline-special*

In Ex commands, at places where a file name can be used, the following
characters have a special meaning.  These can also be used in the expression
function expand() |expand()|.
	%	Is replaced with the current file name.		  *:_%* *c_%*
	#	Is replaced with the alternate file name.	  *:_#* *c_#*
	#n	(where n is a number) is replaced with the file name of
		buffer n.  "#0" is the same as "#".
	##	Is replaced with all names in the argument list	  *:_##* *c_##*
		concatenated, separated by spaces.  Each space in a name
		is preceded with a backslash.
	#<n	(where n is a number > 0) is replaced with old	  *:_#<* *c_#<*
		file name n.  See |:oldfiles| or |v:oldfiles| to get the
		number.							*E809*
		{only when compiled with the +eval and +viminfo features}


	 *:_%:* *::8* *::p* *::.* *::~* *::h* *::t* *::r* *::e* *::s* *::gs*
The file name modifiers can be used after "%", "#", "#n", "<cfile>", "<sfile>",
"<afile>" or "<abuf>".  They are also used with the |fnamemodify()| function.
These are not available when Vim has been compiled without the |+modify_fname|
These modifiers can be given, in this order:
	:p	Make file name a full path.  Must be the first modifier.  Also
		changes "~/" (and "~user/" for Unix and VMS) to the path for
		the home directory.  If the name is a directory a path
		separator is added at the end.  For a file name that does not
		exist and does not have an absolute path the result is

	:h	Head of the file name (the last component and any separators
		removed).  Cannot be used with :e, :r or :t.
		Can be repeated to remove several components at the end.
		When the file name ends in a path separator, only the path
		separator is removed.  Thus ":p:h" on a directory name results
		on the directory name itself (without trailing slash).
		When the file name is an absolute path (starts with "/" for
		Unix; "x:\" for MS-DOS, WIN32, OS/2; "drive:" for Amiga), that
		part is not removed.  When there is no head (path is relative
		to current directory) the result is empty.
	:t	Tail of the file name (last component of the name).  Must
		precede any :r or :e.
	:r	Root of the file name (the last extension removed).  When
		there is only an extension (file name that starts with '.',
		e.g., ".vimrc"), it is not removed.  Can be repeated to remove
		several extensions (last one first).
	:e	Extension of the file name.  Only makes sense when used alone.
		When there is no extension the result is empty.
		When there is only an extension (file name that starts with
		'.'), the result is empty.  Can be repeated to include more
		extensions.  If there are not enough extensions (but at least
		one) as much as possible are included.


%:p が現bufferのfullPath。

%:h がHeader。file名抜かしたpath。

%:t がTail。Header以外。

%:t:r がRoot拡張子無しのfile名。

%:t:e がExtension。拡張子


					*extension-removal* *:_%<*
If a "<" is appended to "%", "#", "#n" or "CTRL-V p" the extension of the file
name is removed (everything after and including the last '.' in the file
name).  This is included for backwards compatibility with version 3.0, the
":r" form is preferred.  Examples: >

よってjava fileをvim上でcompile,runするには

:!javac %; java %<


:au BufNewFile,BufRead *.java noremap <leader><leader> :!javac %; java %<<cr>




filetype plugin on


nnoremap <buffer> <leader><leader> :<c-u>!javac %; java %<lt><cr>


参考:help filetypes


:help new-filetype



command-line modeでの操作



Delete the word before the cursor.



StitchesStitches 2011/07/09 21:11 These topics are so cofunsing but this helped me get the job done.

uvxenwtuvxenwt 2011/07/10 00:24 5cnnWn <a href="http://veoutzanwfee.com/">veoutzanwfee</a>

jnxvmhvslkojnxvmhvslko 2011/07/10 20:30 CvbbSy , [url=http://mmhpnqhmsxvk.com/]mmhpnqhmsxvk[/url], [link=http://ahtezymyylxy.com/]ahtezymyylxy[/link], http://arivdxtdetii.com/

ipwdofcdfbipwdofcdfb 2011/07/11 20:23 SecTcO <a href="http://jcmlvsnfzpoe.com/">jcmlvsnfzpoe</a>

paljtydtaxrpaljtydtaxr 2011/07/12 22:44 8CaEIS , [url=http://yiowgcntnemt.com/]yiowgcntnemt[/url], [link=http://aivyeqzrfzps.com/]aivyeqzrfzps[/link], http://awysqhficrfm.com/

pfizer viagrapfizer viagra 2016/09/15 04:13
You've gotten good knowlwdge on this website. weferhervvbt

golistergolister 2017/02/02 18:39
I could subscribe.


トラックバック - http://vim.g.hatena.ne.jp/ruicc/20090617