vim

autoindent is subset of smartindent in vim?

柔情痞子 提交于 2020-01-11 18:49:32
问题 :help autoindent : Copy indent from current line when starting a new line (typing in Insert mode or when using the "o" or "O" command). ... :help smartindent : Do smart autoindenting when starting a new line. Works for C-like programs, but can also be used for other languages. ... Normally 'autoindent' should also be on when using 'smartindent'. An indent is automatically inserted: After a line ending in '{'. After a line starting with a keyword from 'cinwords'. Before a line starting with '}

Using numpad in Vi (Vim) via PuTTY

无人久伴 提交于 2020-01-11 14:56:30
问题 The numberpad does not work properly when using Vim through PuTTY. Instead of numbers I get y x w v u t s r q 回答1: The answer is in Numpad in PuTTY while using vi [Cialug] : In the configuration, go to Terminal->Features and check "Disable application keypad mode". Save the settings and enjoy a numeric pad that works! 回答2: I have always used this set of mappings to interpret the escape sequences as numbers when $TERM=xterm imap <Esc>Oq 1 imap <Esc>Or 2 imap <Esc>Os 3 imap <Esc>Ot 4 imap <Esc

vim “modifiable” is off

℡╲_俬逩灬. 提交于 2020-01-11 14:51:15
问题 Trying to create a new file with nerd tree. I hit the a key to create a new file and i get the message: E21: Cannot make changes, 'Modifiable' is off I'm using MacVim and Janus (almost out of the box) 回答1: :set ma which is short for :set modifiable will make a buffer modifiable. And :set noma does the opposite. 回答2: I am not familiar with NerdTree but I guess that by typing a into a nerdtree view, it is interpreted as " I want to append something in the nerdtree buffer", and that buffer is

Grep for String and open at the corresponding line

别等时光非礼了梦想. 提交于 2020-01-11 10:03:33
问题 I'm having several occurrences of a specific string over several files in several lines obtained with grep . $ grep -rn --include="*.cpp" mystring lib/mlib/actionbuttonrule.cpp:300: mystring Foobar... lib/mlib/actionbuttonrule.cpp:314: other mystring lib/mlib/item.cpp:3025: /* mystring**/ lib/mlib/item.cpp:3082: mystring Foobar... lib/mlib/item.cpp:3095: Foo mystring bar I'd like to open these files sequencially on the corresponding lines. I tried to do it with vim , but so far no success

Grep for String and open at the corresponding line

为君一笑 提交于 2020-01-11 10:03:13
问题 I'm having several occurrences of a specific string over several files in several lines obtained with grep . $ grep -rn --include="*.cpp" mystring lib/mlib/actionbuttonrule.cpp:300: mystring Foobar... lib/mlib/actionbuttonrule.cpp:314: other mystring lib/mlib/item.cpp:3025: /* mystring**/ lib/mlib/item.cpp:3082: mystring Foobar... lib/mlib/item.cpp:3095: Foo mystring bar I'd like to open these files sequencially on the corresponding lines. I tried to do it with vim , but so far no success

Grep for String and open at the corresponding line

核能气质少年 提交于 2020-01-11 10:02:07
问题 I'm having several occurrences of a specific string over several files in several lines obtained with grep . $ grep -rn --include="*.cpp" mystring lib/mlib/actionbuttonrule.cpp:300: mystring Foobar... lib/mlib/actionbuttonrule.cpp:314: other mystring lib/mlib/item.cpp:3025: /* mystring**/ lib/mlib/item.cpp:3082: mystring Foobar... lib/mlib/item.cpp:3095: Foo mystring bar I'd like to open these files sequencially on the corresponding lines. I tried to do it with vim , but so far no success

Add a hash/pound symbol as the first character in a git commit message in vim

佐手、 提交于 2020-01-11 09:48:47
问题 GitHub (probably, wrongly) uses # 's when referring to GitHub issues. So I would like to add a commit message that refers to the issue on the first line. e.g. #12: New commit - Did a thing - Did another thing Vim/git ignores lines starting with # 's though so I'm not sure how to escape it 🤷‍♂️ 回答1: Git allows you to update the comment char from the # symbol to any other. Then you can use the # symbol. e.g. git config core.commentChar '>' or optionally set it globally git config --global core

Passing register name in mapping to an ex command

瘦欲@ 提交于 2020-01-11 09:21:12
问题 Suppose I want to create a map in vim that will call an ex command as part of its work. And suppose that the ex command takes a register name as input. Here is a toy example: nmap <leader>p :put x The problem there is that the 'x' register will always be used. But when typing, I want to be able to write: "a<leader>p To use the 'a' register, or: "b<leader>p to use the 'b' register. Is there a way that I can pass the 'current normal-mode register' along to the 'ex' command? 回答1: Ah, I figured

display two rows of tabs vim

不羁岁月 提交于 2020-01-11 08:21:54
问题 Is there anyway in Vim to display two rows of tabs when you have a lot of files open at once. I don't want the tab overflow-style arrows to appear. 回答1: This isn't exactly what you asked for. But I switched from using tabs to plain old multiple buffers with BufExplorer to switch between them. http://www.vim.org/scripts/script.php?script_id=42 BufExplorer brings up a nice quick list of all the buffer filenames so that you can quickly select one without any need for mousing.. 来源: https:/

display two rows of tabs vim

我的未来我决定 提交于 2020-01-11 08:21:47
问题 Is there anyway in Vim to display two rows of tabs when you have a lot of files open at once. I don't want the tab overflow-style arrows to appear. 回答1: This isn't exactly what you asked for. But I switched from using tabs to plain old multiple buffers with BufExplorer to switch between them. http://www.vim.org/scripts/script.php?script_id=42 BufExplorer brings up a nice quick list of all the buffer filenames so that you can quickly select one without any need for mousing.. 来源: https:/