在Vim中如何切换命令和插入模式?(How do I switch between command and insert mode in Vim?)
我刚开始使用Vim作为IDE。 我现在使用它作为测试编辑器,所以我不必经常去命令模式。 但是,由于我在Java程序中,我必须去命令模式来创建文件,编译/运行它等等
问题是:我需要一种很好的方式在两种模式之间切换。
我在网上查看,它表示
<Esc>
键应该这样做,但这对我来说并不奏效(也许这不是gVim吗?我不知道为什么)我每次都要按CTRL O进入命令模式; 逃脱密钥从该模式工作...它使我回到插入模式。 但是,在命令模式和插入模式之间是否有更好的或更简单的切换方式?
I just started using Vim as an IDE. I was using it as a test editor for a while now, so I didn't have to go to command mode very often. But, since I program in Java, I have to go to command mode to make the file, compile/run it... etc.
The problem is: I need a good way to switch between the two modes.
I looked online and it says that the
<Esc>
key is supposed to do that, but that doesn't work for me (maybe it's not for gVim? I don't know why.)I have to press CTRLO every time to go to command mode; the escape key works from that mode... it brings me back to insert mode. But is there a better, or easier, way of switching between command mode and insert mode?
原文:https://stackoverflow.com/questions/13178874
最满意答案
UPDATE mytable SET myfield = SUBSTRING(myfield, 1, LENGTH(myfield)-4) ;
如果你想在截断之前检查字段是否以
'.php'
结尾,你可以添加这个条件:UPDATE mytable SET myfield = SUBSTRING(myfield, 1, LENGTH(myfield)-4) WHERE RIGHT(myfield, 4) = '.php' ;
哦,还有
LEFT()
可以用来代替SUBSTRING()
而
CHAR_LENGTH()
应该用来代替LENGTH()
因为它是多字节安全的(而LENGTH()
不是):UPDATE mytable SET myfield = LEFT(myfield, CHAR_LENGTH(myfield)-4) WHERE RIGHT(myfield, 4) = '.php' ;
UPDATE mytable SET myfield = SUBSTRING(myfield, 1, LENGTH(myfield)-4) ;
If you want to also check whether the field ends with
'.php'
before truncating, you can add this condition:UPDATE mytable SET myfield = SUBSTRING(myfield, 1, LENGTH(myfield)-4) WHERE RIGHT(myfield, 4) = '.php' ;
Oh, there's also
LEFT()
which can be used instead ofSUBSTRING()
as wellAnd
CHAR_LENGTH()
should be used instead ofLENGTH()
as it is multi-byte safe (whileLENGTH()
is not):UPDATE mytable SET myfield = LEFT(myfield, CHAR_LENGTH(myfield)-4) WHERE RIGHT(myfield, 4) = '.php' ;
相关问答
更多-
http://dev.mysql.com/doc/refman/5.0/en/fulltext-fine-tuning.html 要索引的单词的最小和最大长度由ft_min_word_len和ft_max_word_len系统变量定义。 (请参见第5.1.3节“服务器系统变量”。)默认最小值为四个字符; 默认最大值取决于版本。 如果更改任一值,则必须重建FULLTEXT索引。 我希望你能改变这个变量..! http://dev.mysql.com/doc/refman/5.0/en/fulltext-fin ...
-
有什么数据库专业书籍介绍?[2022-05-19]
mysql -
>>> import re >>> wordlist = ['Schreiben\nEs', 'Schreiben', \ 'Schreiben\nEventuell', 'Schreiben\nHaruki'] >>> [ re.sub("\n.*", "", word) for word in wordlist ] ['Schreiben', 'Schreiben', 'Schreiben', 'Schreiben'] 通过re.sub完成: >>> help(re.sub) 1 Help ...
-
如何删除包含超过一定数量字母的所有行?(How to delete all lines containing more than a certain number of letters?)[2023-08-21]
$ awk 'length<=5' input.txt bear tree $ awk 'length<=5' input.txt bear tree -
MySQL删除最后4个字母(MySQL delete last 4 letters)[2023-02-10]
UPDATE mytable SET myfield = SUBSTRING(myfield, 1, LENGTH(myfield)-4) ; 如果你想在截断之前检查字段是否以'.php'结尾,你可以添加这个条件: UPDATE mytable SET myfield = SUBSTRING(myfield, 1, LENGTH(myfield)-4) WHERE RIGHT(myfield, 4) = '.php' ; 哦,还有LEFT()可以用来代替SUBSTRING() 而CHAR_LENGTH( ... -
你几乎在那里。 只需在正则表达式的两边添加单词边界即可: sed 's/\b[A-Z][A-Z]\b//g' 更新:(由用户CodeGnome建议) 为了在BSD系统(如OS X)上工作,您需要更改字边界并使用-E标志调用sed。 例如: sed -E 's/[[:<:]][A-Z][A-Z][[:>:]]//g' You are almost there. Just add the word boundaries to the both sides of the regex : sed 's/\b[A ...
-
具有良好性能的解决方案如下( uses Character ): function RemoveNumbers(const AString: string): string; var i, j: integer; begin SetLength(result, AString.Length); j := 0; for i := 1 to AString.Length do if not AString[i].IsDigit then begin inc(j); ...
-
为什么正则表达式? 你过于复杂你的生活: def three_letters_excluding_not(text) text .split(/\W+/) .select{|w| w.length == 3} .reject{|w| w=="not} end 简短,易读,易读,享受Ruby的强大功能。 Why regex? You are overcomplicating your life: def three_letters_excluding_not(te ...
-
mysql - 计数字母(mysql - count letters)[2021-07-11]
你需要一个功能: DROP FUNCTION IF EXISTS numberOfLetters; DELIMITER // CREATE FUNCTION numberOfLetters(s VARCHAR(255)) RETURNS INT DETERMINISTIC NO SQL BEGIN DECLARE c INT; DECLARE r INT DEFAULT 0; DECLARE n INT DEFAULT LENGTH(s); DECLARE i INT D ... -
使用mb_substr的单行解决方案(如果$news['testo']至少有400个字符): ". $testo ."..."; ?> One-line solution with mb_substr(if $news['testo'] has at least 400 cha ...