Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
549 views
in Technique[技术] by (71.8m points)

unix - 你母亲从未告诉过你的Vim的黑暗角落是什么? [关闭](What are the dark corners of Vim your mom never told you about? [closed])

There are a plethora of questions where people talk about common tricks, notably " Vim+ctags tips and tricks ".

(有很多问题让人们谈论常见的技巧,特别是“ Vim + ctags提示和技巧 ”。)

However, I don't refer to commonly used shortcuts that someone new to Vim would find cool.

(但是,我没有提到Vim的新手会觉得很酷的常用快捷方式。)

I am talking about a seasoned Unix user (be they a developer, administrator, both, etc.), who thinks they know something 99% of us never heard or dreamed about.

(我说的是一个经验丰富的Unix用户(他们是开发人员,管理员,两者等),他们认为他们知道我们99%的人从未听过或梦到过的东西。)

Something that not only makes their work easier, but also is COOL and hackish .

(有些东西不仅让他们的工作变得更轻松,而且还很酷,而且很酷 。)

After all, Vim resides in the most dark-corner-rich OS in the world, thus it should have intricacies that only a few privileged know about and want to share with us.

(毕竟, Vim居住在世界上最黑暗角落最丰富的操作系统中,因此它应该只有少数特权知道并希望与我们分享的错综复杂。)

  ask by community wiki translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Might not be one that 99% of Vim users don't know about, but it's something I use daily and that any Linux+Vim poweruser must know.

(可能不是99%的Vim用户不知道的,但这是我每天使用的东西,任何Linux + Vim poweruser都必须知道。)

Basic command, yet extremely useful.

(基本命令,但非常有用。)

:w !sudo tee %

I often forget to sudo before editing a file I don't have write permissions on.

(在编辑我没有写入权限的文件之前,我经常忘记sudo。)

When I come to save that file and get a permission error, I just issue that vim command in order to save the file without the need to save it to a temp file and then copy it back again.

(当我来保存该文件并获得权限错误时,我只发出该vim命令以保存文件而无需将其保存到临时文件,然后再将其复制回来。)

You obviously have to be on a system with sudo installed and have sudo rights.

(你显然必须在安装了sudo的系统上并拥有sudo权限。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...