vim

vim: move to buffer?

浪子不回头ぞ 提交于 2020-01-01 10:48:30
问题 Is there a function in Vim which will move to a buffer? For example, if I know that I have “TODO.txt” open in some window in some tab, I'd like to jump to that tab and focus that window. Is that possible? 回答1: set swb=useopen,usetabe will set make :sb [number] or :sb [pattern] switch to an open window in whichever tab. 回答2: I believe it's :drop filename 回答3: I use :buf TODO you need a unique identifiying piece of the buffers filename. You can use tab-completion, though :) Oh IC, just noted

How do I Join the line above after current line?

久未见 提交于 2020-01-01 09:59:07
问题 I know these commands in Vim: J : Join line below after current line -J : Join current line after line above but how do I join the line above after current line? 回答1: There are many ways to do it. One would be… deleting the line above and appending it to the end of the line below: k move up one line ^ move to the first printable character y$ yank to the end of the line "_d get rid of the now useless line by deleting it into the black hole register $ move to the end of the line p put the

Howto compile vim with ruby 1.9.2

两盒软妹~` 提交于 2020-01-01 09:32:25
问题 I tried to re-compile vim with ruby support because I noticed that vim was still using 1.8.7 (which is the default ruby version on Snow Leopard). Ruby 1.9.2 is installed via rvm. When compiling with ./configure --enable-rubyinterp --enable-gui=no --disable-nls --enable-cscope --prefix=/Users/madhatter I get the following error from make: ld: library not found for -lruby.1.9.1 collect2: ld returned 1 exit status make[1]: *** [vim] Error 1 make: *** [first] Error 2 I then cloned the actual

Vimdiff: How to put all changes inside a particular function from one file to another?

无人久伴 提交于 2020-01-01 09:08:40
问题 In Vimdiff, I know I can use "do" or "dp" to move changes from one file to the other...but these are for individual changes. If I have to undo all changes inside a specific scope/selection (say undo all changes to a particular function, but leave the rest untouched), is there a way to do it in one go ? 回答1: You can use a visual selection and the ex command :diffget / :diffput So, for example to get the changes for just the current insides of a code block ( { ... } ) Vi}:diffget<Enter> To put

Create a mapping for Vim's command-line that escapes the contents of a register before inserting it

眉间皱痕 提交于 2020-01-01 09:08:13
问题 Suppose that I have a document like this, and I want to search for all occurences of the URL: Vim resources: [http://example.com/search?q=vim][q] ... [q]: http://example.com/search?q=vim I don't want to type it out in full, so I'll place my cursor on the first URL, and run "uyi[ to yank it into the 'u' register. Now to search for it, I'd like to just paste the contents of that register into the search field by running: /\V<c-r>u<CR> This results in Vim searching for the string 'http:' -

Create a mapping for Vim's command-line that escapes the contents of a register before inserting it

自闭症网瘾萝莉.ら 提交于 2020-01-01 09:08:06
问题 Suppose that I have a document like this, and I want to search for all occurences of the URL: Vim resources: [http://example.com/search?q=vim][q] ... [q]: http://example.com/search?q=vim I don't want to type it out in full, so I'll place my cursor on the first URL, and run "uyi[ to yank it into the 'u' register. Now to search for it, I'd like to just paste the contents of that register into the search field by running: /\V<c-r>u<CR> This results in Vim searching for the string 'http:' -

Trouble mapping <C-j> in Vim with latex-suite

强颜欢笑 提交于 2020-01-01 09:05:43
问题 I wanted to map <C-j> to switch to the next window below the current one map <C-j> <C-w>j However, it goes into Insert mode instead of moving the window below. Why? Solution attempted: I have latex-suite installed. So I tried to query what <C-j> is mapped to :map <C-j> And I get the following output: v <NL> <Plug>IMAP_JumpForward n <NL> <Plug>IMAP_JumpForward o <NL> <C-W>j This means that I should change the mapping of <Plug>IMAP_JumpForward . I read around a bit and I found out it's related

vimrc to be cross-platform and synced with Dropbox.

女生的网名这么多〃 提交于 2020-01-01 09:05:12
问题 I'v been using vim/gVim so far in my Linux Machine, and I have a Windows machine as well. In this windows machine I'm mainly notepad++. I would like to store all my .vimrc settings and .vim folder in Dropbox, and create symbolic links in Linux pointing to them, and them do the same in my Windows machine. I have plenty of "home shortcut notation" (don't if this is the correct name) ~ in my configuration, and would like to know if writing down for example $HOME instead of ~ it's going to work:

Mark block based on indentation level in Vim

梦想的初衷 提交于 2020-01-01 09:03:18
问题 Is it possible to mark a block in Vim based on the indentation already in place? Similarly to v{ . It would be extremely useful for programming languages with whitespace-sensitive syntax (like Haskell and Python). For example mark everything between the first let and return in this function: checkArg (com:arg) s d ns | com == "add-source " = do let s' = v ++ s lift $ saveLinks s' return (s', d) | com == "remove-source" = do let s' = filter (not . hasWord str) s lift $ saveLinks s' return (s',

How do I redirect output into Gvim as a list of files to be opened?

空扰寡人 提交于 2020-01-01 08:45:18
问题 I would like findstr /m background *.vim | gvim to open all *.vim files containing background in a single instance of gvim - but I can't get the piping to work. This is very similar to this question but instead of capturing the stdin output I would like GViM to treat the output as a list of files to be opened - and on a Windows system so xargs isn't guaranteed. Any ideas? 回答1: I can think of a few ways of doing this: Use vimgrep Use vimgrep: after running gvim, enter: :vimgrep /background/ **