11 Matching Annotations
  1. Last 7 days
    1. 创建vim session文件 :mks filename, 重写session :mks! filename,  载入session vim -S sessionFile

      该命令可以将当前Vim打开的窗口以文件的方式进行保存,当下次打开时直接以保存时的状态打开

      保存当前会话session: :mks filename

      更新当前会话session: :mks! filename

      载入会话session: vim -S sessionFile

  2. Dec 2017
  3. Sep 2017
    1. up vote 15 down vote This is one of the few reasons I like to use vim's mouse mode. If you use the GUI version, or your terminal supports sending drag events (such as xterm or rxvt-unicode) you can click on the split line and drag to resize the window exactly where you want, without a lot of guess work using the ctrl-w plus,minus,less,greater combinations. In terminal versions, you have to set mouse mode properly for this to work :set mouse=n (I use 'n', but 'a' also works) and you have to set the tty mouse type :set ttymouse=xterm2 A lot of people say that a lot of time is wasted using the mouse (mostly due to the time it takes to move your hand from the keyboard to the mouse and back), but I find that, in this case, the time saved by having immediate feedback while adjusting window sized and the quickness of re-resizing (keep movving the mouse instead of typing another key sequence) outweighs the delay of moingmy hand.

      Simply amazing setup to get multiple screens vim

  4. Aug 2017
  5. Jan 2016
  6. Aug 2015
    1. I have had an annoying problem with git and vi. I like to use vim to edit my commit messages, but I’ve been hit with this annoying message every time I write the message and quit vim.

      Thanks for this. I encountered the same issue with OS X 10.10.

      Haven't investigated the issue fully yet but there is definitely a difference in the exit status behavior when launching vim as 'vi' vs. launching it as 'vim'

  7. Jun 2015
    1. Simply: require('child_process').spawn('vim', ['test.txt'], {stdio: 'inherit'}); If there is nothing left in the Node.js event loop when vim exits, then node will exit automatically as well. Or, if you need to guarantee node will exit when vim does: var vim = require('child_process').spawn('vim', ['test.txt'], {stdio: 'inherit'}); vim.on('exit', process.exit); As for closing the node application before vim exits, that's not really possible because vim inherits standard input/output/error streams from the spawning process (node) which are destroyed when node exits.
  8. May 2015
    1. Time Travelling Without Worries But here's the best part - knowing the true nature of history, we can combo it with another cool feature of Vim - persistent undo - to be able to travel in time there and back without fear of losing anything! In other words, if you do: mkdir -p ~/.vim/undodir and then add: set undofile set undodir=~/.vim/undodir to your ~/.vimrc, you get a file-backed infinite undo. And even if you undo like a madman and then edit something, you will not lose your way back to where you’ve been. Which is pretty much a developer’s (or anyone’s, really) text-editing nirvana. Enhance you calm and enjoy a bit saner coding.
    1. Save Work On Focus Lost This feature works best in combo with infinite undo. The idea here is that everytime you leave your Vim window, all your open files are automatically saved. I find this to be extremely helpful, for example when I’m working on a laptop and continuously run unit tests in terminal. My laptop is 13'' so I prefer to run Vim full screen and with this feature, I don’t have to explicitly save my source code file; I just cmd+tab to the terminal, Vim saves the file for me and my unit tests watcher re-runs the suite. If you save unwanted changes by accident you can easily remedy that with undo. To turn autosaving on, add: :au FocusLost * silent! wa to your .vimrc. The silent! flag prevents Vim from complaining when you have open unititled buffers (see this article for details).
  9. Mar 2015
  10. Jan 2015
    1. A search reference /{string}: search for string t: jump up to a character f: jump onto a character *: search for other instances of the word under your cursor n: go to the next instance when you’ve searched for a string N: go to the previous instance when you’ve searched for a string ;: go to the next instance when you’ve jumped to a character ,: go to the previous instance when you’ve jumped to a character

      A Search Reference