macvim

(Re)formatting PHP code in Vim

萝らか妹 提交于 2019-12-08 06:42:36
问题 How do I format PHP code that looks like this class SomeClass { function insideclass() { } } into this, using Vim without any external tool? class SomeClass { function insideclass() { } } I am not arguing that this is the best way to format the code, but this is what we are following in the team. Edit : Removed reference to the snippet addon, which caused some confusion about the question. 回答1: You have two unrelated problems and you won't find a unique solution to both. You don't like the

Binding special keys as vim shortcuts

[亡魂溺海] 提交于 2019-12-08 06:19:45
问题 My keyboard has extra hotkeys like "Back" and "Forward" that work in a web browser. I would like to use these types of keys as hotkeys in vim. How can I find out what vim sees these keys as so that they can be used as hotkeys in vim? 回答1: Go to the command line, type control-k (you'll get a question mark on the command line), and then hit the key you're interested in. The question mark will be replaced with Vim's definition of what it receives. In my experience, you won't get a response for

How do I get the standard Vim FTP command to work?

旧城冷巷雨未停 提交于 2019-12-08 04:32:47
问题 When I do vim ftp://[user@]machine/path in Vim I get this error: E683: File name missing or invalid pattern . Why id Vim treating this command as a search pattern? I'm getting the same error in MacVim and Terminal Vim. 回答1: Usually you want to start Vim and then edit a file over ftp. Calling vim with a url may not work. You're supposed give a file path as argument to vim and that's what's causing the error. Also, the error says: File name missing or invalid pattern Vim is not treating it as a

No syntax highlighting after session restore in terminal

风流意气都作罢 提交于 2019-12-08 02:09:42
问题 I'm using Mac Lion 10.7.1, MacVim Snapshot 61, Vim version 7.3 I want to save the session on quit and restore the last session on Vim start without any arguments. So I added this code in my .vimrc file: autocmd VimEnter * call LoadSession() autocmd VimLeave * call SaveSession() function! SaveSession() execute 'mksession! $HOME/.vim/sessions/session.vim' endfunction function! LoadSession() if argc() == 0 execute 'source $HOME/.vim/sessions/session.vim' endif endfunction this works great with

How can I get vim to point to macvim? Where can I find macvim?

人走茶凉 提交于 2019-12-07 17:45:15
问题 I would like vim to point to macvim :) Probably through an alias. vim is here: whereis vim /usr/bin/vim macvim I can't find, e.g. whereis macvim returns nothing 回答1: My answer is kind of the opposite of michaelmichael's and I've made it quite a few times: MacVim comes with a CLI executable that you can use in place of Mac OS X's default Vim if you add a single alias to your ~/.bashrc / ~/.profile . No need to compile anything, no need to put MacVim in a special place, no need to overwrite

What do these red arrows in Vim mean?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-07 10:56:06
问题 When editing .pt files (which I've configured to be highlighted as XML) in MacVim, I get these funny little red arrows on the side. What do these mean? What "feature" is this, and where can I find out more information about it? 回答1: Those arrows are most probably added by the Syntastic plugin, you can probably remove that plugin from executing inside Janus, somehow. Also, as mentioned in my comments. You should not use Vim distributions, and here's why: It is considered bad practice, that's

How do I get the standard Vim FTP command to work?

假如想象 提交于 2019-12-07 02:26:25
When I do vim ftp://[user@]machine/path in Vim I get this error: E683: File name missing or invalid pattern . Why id Vim treating this command as a search pattern? I'm getting the same error in MacVim and Terminal Vim. Usually you want to start Vim and then edit a file over ftp. Calling vim with a url may not work. You're supposed give a file path as argument to vim and that's what's causing the error. Also, the error says: File name missing or invalid pattern Vim is not treating it as a search pattern. Notice the "or". It happens that no file name is given. Try starting vim and then: :e ftp:/

VIM: exit insert mode with :normal command

不羁岁月 提交于 2019-12-06 19:35:23
问题 When I go into insert mode with the :normal command ( :normal i ) for example, how do I exit insert mode? If I press <Esc>, or <c-c>, or <c-[>, VIM exits command mode and I can't run my :normal command. I put imap <c-e> <Esc> in my .vimrc but when I type <c-e> in command mode, nothing gets inserted. I can't figure out how to enter a "control e" in command mode. <c-o> works, for example :normal Ihello<c-o>Aworld but sometimes I want to do more than one command in normal mode. I know I can use

钗黛双收:若你也同Vim难割舍,却又看Emacs情切切

对着背影说爱祢 提交于 2019-12-06 15:06:29
1 钗黛双收:若你也同Vim难割舍,却又看Emacs情切切 (引子) 这篇文章分享我的一些经历,写给和我一样对娇小的Vim难以割舍,又在抱上Emacs这个大家闺秀以后死活不愿意撒手的朋友们。 如果你不知道什么是“编辑器圣战”,那不妨百度Google一下,总之是自从开辟鸿蒙以来,就有两个以伴君左右为己任的贤内助(Vim编辑器和Emacs 编辑器)在互掐。由于两位佳人的理念差别之大,加上各自阵营之间的鸿沟之深,使得先贤先哲基本上都会在这两个阵营里面挑一个来站队。 网络普及以后,凡有帖子对Vim和Emacs这两大编辑器作出比较,大都有成为必删贴的潜质。原因很好理解,无论是谁看了红楼梦,很难不对宝钗黛玉这两位 产生点好恶,此后但凡有人起了个头要对钗黛二人做点比较,那后面的楼经常能盖歪到变成地域攻击男女对骂。在技术论坛里,这样折腾不被河蟹掉才怪。更有甚 者,如果谁在讨论编程的时候问了一句“需要做xx开发,用什么工具比较好?”随后也常常演变成Vim对Emacs的钗黛攻伐,最后一样飞沙走石天昏地暗。 这就说明,选择Vim或Emacs已经不仅取决于我们在编辑文本时的好恶,而已经上升到干活的人怎么挑工具,过日子的人怎么选老婆这种哲学高度的问题。 我一向觉得,成事者不可狭于器。所以选工具时候没必要为了工具本身而搞个粉丝团,而是就着菜选刀,比着孩子找媳妇,揽来什么样的活计使什么样的家伙。若以

No syntax highlighting after session restore in terminal

余生颓废 提交于 2019-12-06 09:48:44
I'm using Mac Lion 10.7.1, MacVim Snapshot 61, Vim version 7.3 I want to save the session on quit and restore the last session on Vim start without any arguments. So I added this code in my .vimrc file: autocmd VimEnter * call LoadSession() autocmd VimLeave * call SaveSession() function! SaveSession() execute 'mksession! $HOME/.vim/sessions/session.vim' endfunction function! LoadSession() if argc() == 0 execute 'source $HOME/.vim/sessions/session.vim' endif endfunction this works great with MacVim, but when I open Vim in terminal syntax highlighting is not working. How do I get this to work?