Hatena::Groupvim

vim and plasticity

2009-07-07

Linuxのvim(not gvim)にてkeyboard layoutがいつもpc104なのに、insert modeとcommand line modeのCtrl押している間だけjp109になる問題

19:55

俺がバカだっただけぽいけど。一応環境。

ubuntu9.04

Xorg 1:7.3+10ubuntu10.2

vim7.1.138

題名どおり。


なんでだろうなー、気持ち悪いなー、と薄々感づいてはいたけど放置してきた問題をようやく直した。<C-[>でmode抜けようとすると<C-@>と認識されるとか質悪い。

gvimでは問題なかった。


xorg.confのキーボードの箇所が日本語キーボード設定(jp106)なのに、[システム]->[設定]->[キーボード]->[レイアウト]はGeneric 104-key PCにしていたことがおそらく原因。

ということでxorg.confを以下の様に直し、X再起動した。自信ないが、うまく動いているぽいからいいや。

Section "InputDevice"
	Identifier	"Generic Keyboard"
	Driver		"kbd"
	Option		"XkbRules"	"xorg"
	#Option		"XkbModel"	"jp106"
	Option		"XkbModel"	"pc104"
	#Option		"XkbLayout"	"jp,jp"
	Option		"XkbLayout"	"us"
	#Option		"XkbVariant"	"106,"
	Option		"XkbVariant"	"104"
	Option		"XkbOptions"	"grp:alt_shift_toggle,grp_led:scroll"
EndSection

しかしCtrl押してる間だけlayout変わるって変な挙動だな。

NormNorm2011/07/11 02:18You keep it up now, unedrtsand? Really good to know.

tkxvpjtkxvpj2011/07/11 17:53Ao3fZ7 <a href="http://xgsdwumiqgsa.com/">xgsdwumiqgsa</a>

grmqzaycgrmqzayc2011/07/11 21:42du88n9 , [url=http://yhqewnwhdytc.com/]yhqewnwhdytc[/url], [link=http://eefcdgtbhvbt.com/]eefcdgtbhvbt[/link], http://rqzkljdzfchs.com/

zkdcjoxgfazkdcjoxgfa2011/07/13 18:47VJyfR1 <a href="http://kwkuvzbyvnno.com/">kwkuvzbyvnno</a>

2009-06-20

jumpも覚えるか

05:25

参考 :help jump-motions

jump-listの確認

:ju[mps]


jump-motions

8. Jumps					*jump-motions*

A "jump" is one of the following commands: "'", "`", "G", "/", "?", "n",
"N", "%", "(", ")", "[[", "]]", "{", "}", ":s", ":tag", "L", "M", "H" and
the commands that start editing a new file.  If you make the cursor "jump"
with one of these commands, the position of the cursor before the jump is
remembered.  You can return to that position with the "''" and "``" command,
unless the line containing that position was changed or deleted.

jumpしたときに、Vimはjump前のカーソル位置を覚えています、と。

bufferを開くこともjumpに含まれているので注意。

<c-f>,<c-b>,<c-u>,<c-d>はjumpに含まれていないので注意。

"gg"は書いてないがjumpに含まれている模様。"1G"のaliasなのだろうか。


jump-listを移動

<C-O>(alphabetのo)でjump元に戻れる。jump-listを辿れる。bufferを跨いで戻るので乱発注意。

<C-I>(alphabetのi),<Tab>でjump-listを進める。

							*CTRL-O*
CTRL-O			Go to [count] Older cursor position in jump list
			(not a motion command).  {not in Vi}
			{not available without the +jumplist feature}

<Tab>		or					*CTRL-I* *<Tab>*
CTRL-I			Go to [count] newer cursor position in jump list
			(not a motion command).
			In a |quickfix-window| it takes you to the position of
			the error under the cursor.
			{not in Vi}
			{not available without the +jumplist feature}

jumpは便利だけど、乱発すると狙ったとこにうまく戻れない感が。

jump-list見ても何がどこだか分からないし。

<C-O>で戻るのは記憶してる範囲に留めるのがいいかもしれない。それ以上はmarkするとかして。


最後にinsert-modeだった場所に戻る

gi

bufferは跨がない。

便利かも。

registerでも覚えるか

03:52

参考1 :help :registers

参考2 :help registers


現在のレジスタの確認

:reg[isters]


レジスタの種類

[RO]はRead Onlyのレジスタを意味する。

""Unnamed register.最後に用いられたregisterを指す
"0yankしたときに用いられるregister
"1delete,changeの際に用いられるregister
"2delete,changeの際、旧"1の値が入る
"3delete,changeの際、旧"2の値が入る
...... "4から"9まで同じ ...
"-small delete register.1行以下のdelete内容が入る
"aレジスタa。ユーザが指定しないと使われない。
"A指定すると"aに追加(append)される
...... 以下"b,"Bから"z,"Zまで同じ ...
".The last inserted text.[RO]
":The most recent executed command-line.[RO]
"%Current file name.[RO]
"#Alternate file name.[RO]
"=Expression register.計算してくれる特殊なレジスタ*1[RO]
"*X11ならMouse overした内容、またはVisual modeで選択した内容。 WindowsならClipboardの内容。
"+X11ならClipboardの内容。Windowsなら"*と同じ。
"~Drag and dropの際に用いられる[RO]
"_Black hole register.何も起こらない。

レジスタに書き込む

"0から"9はyank,delete,changeの際にVimが放り込んでいくけど、"a-"z,"A-"Zは指定しないと使われない。特定のレジスタに書き込むには、yy,dd,cc,etc.の前にレジスタを指定すれば良い。

"aに書き込むには、

"add

などとすればいい。

数字レジスタに書き込むことも出来る。あんまり意味なさそうだけど。


Clipboardに書き込むなら、

"+yy

とか。


レジスタの読み込み

Insert mode, Command-line modeにて、<C-R>の後にレジスタをDouble quote(")無しで指定する。

つまり"aの内容を読み込むには、

<C-R>a

と押す。

もしくはNormal modeでレジスタを指定してpaste,

"ap

としてもいい。

*1:Reference :help "=

2009-06-17

Command-line mode

05:05

現ファイル名が%で表されることは知っていたけど、

:!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}

ファイル名関連の取得修飾子。長いので抜粋。

							 *filename-modifiers*
	 *:_%:* *::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|
feature.
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
		unpredictable.

	: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 %<

とすれば良いと。で適当にどこかのキーにMapすればいいと。


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

こんな感じか。


追記:

~/.vimrcに以下を追加して、

filetype plugin on

~/.vim/ftplugin/java.vimに以下を書いた。

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

もうfiletype-detectされてるため、autocmdはいらないようだ。c.vimとcpp.vimも作って試してみた。

参考:help filetypes


新しいfiletype作るなら

:help new-filetype

を参考にすると。

ヘルプ強い。

command-line modeでの操作

03:27

help見てたらC-Wなんてもの見つけた。

CTRL-W
Delete the word before the cursor.

CTRL-Hでちまちま消す必要なかったのだね。

ふと思い立ってTerminalでも試してみたらzshでもbashでも使えて噴いた。ずっと欲しいと思ってたよこの機能。

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

uvxenwtuvxenwt2011/07/10 00:245cnnWn <a href="http://veoutzanwfee.com/">veoutzanwfee</a>

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

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

paljtydtaxrpaljtydtaxr2011/07/12 22:448CaEIS , [url=http://yiowgcntnemt.com/]yiowgcntnemt[/url], [link=http://aivyeqzrfzps.com/]aivyeqzrfzps[/link], http://awysqhficrfm.com/

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

golistergolister2017/02/02 18:39
I could subscribe.

OiikbMubOiikbMub2017/05/23 11:09online payday loans mississippi
- <a href="https://onlinepaydayloanquickes.com">fast online payday loans
</a>
bad credit online payday loans
- <a href=https://onlinepaydayloanquickes.com/>online payday loans reviews
</a>

imnwgMubimnwgMub2017/05/23 19:07payday loans online
- <a href="http://paydayloansonlineglhf.com">payday loans online
</a>
paydayloansonlineglhf.com
- <a href=http://paydayloansonlineglhf.com/>paydayloansonlineglhf.com
</a>

izkmeMubizkmeMub2017/05/24 08:13anabolicsteroidsnpc.com
- <a href="https://anabolicsteroidsnpc.com">anabolic definition
</a>
what are steroids
- <a href=https://anabolicsteroidsnpc.com/>anabolicsteroidsnpc.com
</a>

iffygMubiffygMub2017/05/24 09:49anabolism
- <a href="https://anabolicsteroidsnpc.com">types of steroids
</a>
steroids online
- <a href=https://anabolicsteroidsnpc.com/>types of steroids
</a>

idserMubidserMub2017/05/24 11:28anabolic steroids side effects
- <a href="https://anabolicsteroidsnpc.com">anabolics
</a>
legal anabolic steroids
- <a href=https://anabolicsteroidsnpc.com/>anabolic pathways
</a>

StaceyDesStaceyDes2017/06/11 23:47loans for people with poor credit payday loans no brokers bad credit <a href=http://usa-payday-loans.org/>loans for people with bad credit rating</a> get a quick loan

StaceyDesStaceyDes2017/06/11 23:47cash loans for people with bad credit no direct deposit payday loans <a href=http://usa-payday-loans.org/>payday loans online pa</a> fast cash today

StaceyDesStaceyDes2017/06/11 23:52personal loans with fair credit i need a loan <a href=http://usa-payday-loans.org/>online easy loans</a> payday loans monthly payments

StaceyDesStaceyDes2017/06/12 02:38payday loans lake charles short term payday loan <a href=http://usa-payday-loans.org/>online personal loans</a> unsecured loan lenders

StaceyDesStaceyDes2017/06/12 02:38borrow cash now nimble small loans <a href=http://usa-payday-loans.org/>loan rates</a> payday loans nampa id

StaceyDesStaceyDes2017/06/12 02:42personal loans texas pay day laons <a href=http://usa-payday-loans.org/>easy loans for bad credit</a> payday loans louisville ky

StaceyDesStaceyDes2017/06/12 03:25need personal loan now money quick <a href=http://usa-payday-loans.org/>payday loans rockford il</a> need money right now

StaceyDesStaceyDes2017/06/12 03:25no fee loans loans in texas <a href=http://usa-payday-loans.org/>online personal loans for bad credit</a> loans bad credit

StaceyDesStaceyDes2017/06/12 03:28payday loans cheyenne wy ssi payday loans <a href=http://usa-payday-loans.org/>payday loans without a checking account</a> large unsecured loans bad credit

StaceyDesStaceyDes2017/06/12 18:43where can i get a small loan with bad credit payday loan nj <a href=http://usa-payday-loans.org/>payday loans salina ks</a> payday loans in arlington tx

StaceyDesStaceyDes2017/06/12 19:00payday loans benefits accepted small loan companies <a href=http://usa-payday-loans.org/>unsecured loans online</a> check advance loans

StaceyDesStaceyDes2017/06/12 19:15payday loan nj i need cash today <a href=http://usa-payday-loans.org/>cash advance tampa</a> loans bad credit

StaceyDesStaceyDes2017/06/12 19:15payday loans cleveland ohio payday loan online bad credit <a href=http://usa-payday-loans.org/>loans for bad credit no guarantor no fees</a> loans for disabled

StaceyDesStaceyDes2017/06/12 19:17loan for no credit easiest payday loans <a href=http://usa-payday-loans.org/>payday loans as seen on tv</a> utah payday loans

StaceyDesStaceyDes2017/06/12 21:48need cash now money lenders <a href=http://usa-payday-loans.org/>banks that do personal loans</a> immediate loans

StaceyDesStaceyDes2017/06/12 21:48american payday loan loan payday <a href=http://usa-payday-loans.org/>payday loan colorado springs</a> online cash advance

StaceyDesStaceyDes2017/06/12 21:48get cash loan now interest free loan <a href=http://usa-payday-loans.org/>no doc loan</a> first payday loan free

StaceyDesStaceyDes2017/06/13 01:12borrow money fast where can i borrow money <a href=http://usa-payday-loans.org/>real online loans for bad credit</a> check cashing payday loans

StaceyDesStaceyDes2017/06/13 01:12alternative loans cashusa <a href=http://usa-payday-loans.org/>signature loans for bad credit</a> online payday advance

StaceyDesStaceyDes2017/06/13 01:12cash loans columbus ohio unsecured personal loans poor credit <a href=http://usa-payday-loans.org/>payday lones</a> payday loans in pennsylvania

StaceyDesStaceyDes2017/06/13 03:28payday advances online how to get cash fast <a href=http://usa-payday-loans.org/>getting loan with bad credit</a> money loan with bad credit

StaceyDesStaceyDes2017/06/13 03:28check advance payday loans kansas city mo <a href=http://usa-payday-loans.org/>payday advance loan</a> payday loans norfolk va

StaceyDesStaceyDes2017/06/13 03:28bad credit need loan personal loan interest rates <a href=http://usa-payday-loans.org/>apply for loan with bad credit</a> short term online loans

StaceyDesStaceyDes2017/06/13 05:45credit check free next payday advance <a href=http://usa-payday-loans.org/>loans for bad credit</a> fast pay day loans

StaceyDesStaceyDes2017/06/13 05:45short term cash advance cash advance akron ohio <a href=http://usa-payday-loans.org/>non payday loans for bad credit</a> take a loan

StaceyDesStaceyDes2017/06/13 07:58pay day loans online online loan for bad credit <a href=http://usa-payday-loans.org/>basic bank account for bad credit</a> cash advance dayton ohio

StaceyDesStaceyDes2017/06/13 11:19www personal loan com cash advance miami <a href=http://usa-payday-loans.org/>long term loans for bad credit no guarantor</a> i need a loan today

StaceyDesStaceyDes2017/06/13 11:19delaware payday loans short cash loans <a href=http://usa-payday-loans.org/>bad credit loans online approval</a> direct loans for bad credit

StaceyDesStaceyDes2017/06/13 13:33loans for young adults ach loan <a href=http://usa-payday-loans.org/>online loan bad credit</a> same day payday loans direct lender

StaceyDesStaceyDes2017/06/13 13:33flexible loans money borrowing sites <a href=http://usa-payday-loans.org/>loan cash now</a> money lender

StaceyDesStaceyDes2017/06/13 13:33personal loans for bad credit in maryland lendingtree loans <a href=http://usa-payday-loans.org/>online lending</a> how can i get a loan

StaceyDesStaceyDes2017/06/13 15:44payday loans in montgomery al www payday loans <a href=http://usa-payday-loans.org/>defaulted loans</a> american payday loan

StaceyDesStaceyDes2017/06/13 15:44long term payday loan not a payday loan <a href=http://usa-payday-loans.org/>payday loan same day</a> compare payday lenders

StaceyDesStaceyDes2017/06/13 15:44payday cash advances money in minutes loan <a href=http://usa-payday-loans.org/>how to get fast cash</a> online payday loans texas

StaceyDesStaceyDes2017/06/13 18:00bad credit loans now lenders for people with bad credit <a href=http://usa-payday-loans.org/>short term bad credit loans</a> personal small loans

StaceyDesStaceyDes2017/06/13 18:00payday loan calgary emergency cash <a href=http://usa-payday-loans.org/>quick cash advance</a> loans from direct lenders

kgzflmAdenokgzflmAdeno2017/06/21 23:20what is a cash advance
<br />
<a href="http://paydayourloansonline.com#242/">best payday loans</a> <br />
<a href="http://paydayourloansonline.com#070/">personal loans </a> <br />
http://paydayourloansonline.com#440/ - payday loans online <br />
ace cash advance
#gagahshsnsnfbfhhw2333

kbviurAdenokbviurAdeno2017/06/23 09:06need a payday loans, castle payday loans reviews, payday loans no bank account needed, payday loans san antonio <a href="http://paydayourloansonline.com/#personal"> loans with bad credit </a> payday loans same day, payday loans birmingham al <a href="http://paydayourloansonline.com/#loan"> short term loans </a> easy payday loans online, payday loans peoria il, payday loans jackson ms, payday loans roanoke va, payday loans direct lenders only, can you have two payday loans at once http://paydayourloansonline.com/#loan - online payday loans faxless payday loans, payday online loans, payday loans in houston #helloganamana2233

BriaxVorBriaxVor2017/07/01 19:22Пожалуйста, прочтите инструкции ниже для правильного использования новой версии программы. От этого напрямую зависит, насколько эффективно Вы сможете применить преимущества именно последних версий программы. </br>
<a href=http://mail.ru>Bingosio</a>
Новый инструмент распознавания изображений: </br>
<a href=https://gooogle.com/>Bingosio</a>
В состав программного комплекса XRumer </br> включен новый инструмент распознавания изображений XEvil, значительно повышающий эффективность комплекса, и многократно расширяющий потенциальный охват ресурсов для размещения Вашей рекламы. По состоянию на </br> года программа способна распознавать свыше 8400 типов изображений – буквенных, числовых, арифметических. Подробности Вы можете прочесть на нашем сайте. </br>

DvuspvAdenoDvuspvAdeno2017/07/02 17:46hahgsgdnna - google.com google.com - hywyywkkkkkkzzzzsssss

DargtkAdenoDargtkAdeno2017/07/04 02:51hhhhhhbbbxbxcv - google.com google.com - hjgjasdfkjwieururu

jackHexjackHex2017/07/15 22:29We do not recommend specific pharmacies, but you can search for verified international online pharmacies at PharmacyChecker.
A pharmacy can refuse to fill our prescription if you are from another city say you live a mile from Orlando and you are trying to find your meds.
Generic ViagraGeneric Viagra is starting to replace it's original as customers become more educated to the...

<a href=http://kamagra100mgoraljelly.today>kamagra now</a>

jackHexjackHex2017/07/16 20:23It surpassed my expectations for learning and connection.
Aircraft departing the circuit from other legs must broadcast intentions and depart in a manner that does not conflict with aircraft in or joining the circuit.
How alprazolam affects pregnancy.

<a href=http://kamagra100mgoraljelly.today>kamagra100mgoraljelly.today</a>

DbkgefAdenoDbkgefAdeno2017/07/19 10:39google.com - #000999uuquuqyshshshx

2008-12-26

hoge

07:50

moge

てけてけ.

TerrahTerrah2011/07/08 02:17You’re the one with the barnis here. I’m watching for your posts.

fngcgijvmzffngcgijvmzf2011/07/08 16:28TGNoLO <a href="http://evxcikkwrgkm.com/">evxcikkwrgkm</a>

gchqqkogchqqko2011/07/11 01:16BqocUn <a href="http://ugfjvtfnyvte.com/">ugfjvtfnyvte</a>

nsyvkrnsyvkr2011/07/11 23:28pkd4zU , [url=http://wfvfwfgbulee.com/]wfvfwfgbulee[/url], [link=http://ixzimvkwkjtw.com/]ixzimvkwkjtw[/link], http://iycvaputjntf.com/