macvim

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',

Command key in MacVim

◇◆丶佛笑我妖孽 提交于 2020-01-01 01:53:52
问题 How do I use the command key in MacVim? For example I would like to be able to press Cmd t to open CtrlP or Cmd n to open NerdTree. 回答1: See :help <D- . Use <D-t> to map to ⌘-T ; however , ⌘-T is already mapped to "New Tab" within MacVim's menu. You'll have to remove that to be able to use it in a Vim map. Some keys are OS-bound and you just can't access them, but ⌘-T can be made available and is actually the example they use in the help file (see :help Actions.plist and scroll up a few lines

How to break a line in vim in normal mode?

做~自己de王妃 提交于 2019-12-31 09:09:33
问题 I would like to break a line (at the location of the cursor) in to two lines without leaving normal mode (entering insert or command-line mode). Is this possible? I currently get to the location I want and hit 'i' to enter insert mode, 'enter' to break the line in two, then 'esc' to return to normal mode. I am not trying to set a maximum line length or do any syntax or anything like that. I just want to break one line into two lines without leaving normal mode. 'J' joins the line the cursor

set .vim home directory to something specific

为君一笑 提交于 2019-12-30 18:33:11
问题 My projects are all under /Users/username/workspace/my_project where /Users/username/ is $HOME . I want macvim to always have the home as /Users/username/workspace/my_project instead of /Users/username/ . I understand set autochdir sets the home to whatever the current file's directory is, but this is not what I want. Also I'm using NerdTree if that helps. 回答1: Do you want Vim's working directory to be ~/my_project ? Add cd ~/my_project to your ~/.vimrc . Do you want all your plugins and

VIM Unix commands printed in color

爷,独闯天下 提交于 2019-12-30 18:26:23
问题 I'm using MacVim and I would like to have ! commands printed in color. For example: In bash, the following echo statement prints Hello World in green (as expected): $ echo -e "\033[32m Hello World" Hello World However, in VIM the output is not color, and the escape codes are printed: :!echo -e "\033[32m Hello World" [32m Hello World How can one have VIM (and MacVim build 57 in particular) print the output of ! commands and honour ANSI color escapes. 回答1: You can't. But you can suspend the

Proper tag highlighting in Vim?

我怕爱的太早我们不能终老 提交于 2019-12-24 09:33:20
问题 Just getting into Vim, but can't figure out why it's not highlighting these HTML tags properly. Shouldn't the closing body and html tags be bold and red? See pic. 回答1: Most colorschemes don't go very far beyond the generic highlight groups like Keyword or String . My favorite colorscheme is Sorcerer but I had to customize it like that : hi htmlTag guifg=#90b0d1 gui=NONE hi htmlSpecialTagName guifg=#90b0d1 gui=NONE hi htmlTagName guifg=#90b0d1 gui=NONE hi htmlEndTag guifg=#90b0d1 gui=NONE to

Vim copy a block and paste it to multiple lines

▼魔方 西西 提交于 2019-12-24 07:56:40
问题 I know I can yy on line 1 and then visual select lines 4 and 5 2p (Vim copy one line and paste it to multiple lines). 1 COPY THIS 2 3 4 HERE 5 HERE So I get: 1 COPY THIS 2 3 4 COPY THIS 5 COPY THIS But instead, let's say I would like just COPY. If I visual block select COPY and then 2p on lines 4 and 5 visual selected 1 COPY THIS 2 3 4 COPYCOPY 5 How do I paste 1x at each line? Like: 1 COPY THIS 2 3 4 COPY 5 COPY 回答1: You can modify the register " (unnamed) to contain a newline, but at this

Key escape sequences not working for tmux

百般思念 提交于 2019-12-23 18:53:34
问题 I have been using iTerm2 and vim for a while. I have experienced some issues when I needed to use key combinations such as CTRL-F10 and SHIFT-F10 inside a vim session running inside iTerm2 . It is straight forward to define key bindings such as <C-F10> and <S-F10> for the GUI version of MacVim. No problems there. However, it proved to be difficult to get the same key combinations in the terminal version of MacVim . I have solved this by using iTerm2 's Send Escape Sequence functionality. Once

MacVim color issues when launching from command line

旧城冷巷雨未停 提交于 2019-12-23 18:32:02
问题 I'm relatively new to Vim and have been using it without issues so far. I'd either launch MacVim from my dock or using mvim from the command line. This worked great so far, but just now I've run into an issue. For no apparent reason, launching MacVim from the command line started to create a MacVim window that had all the colors screwed up. When I'd launch it from the dock, everything is fine. The colorscheme is the same between both editors (solarized), so I'm really puzzled as to what the

using rails.vim Rake run spec in MacVim, how to get colored output

陌路散爱 提交于 2019-12-23 10:54:28
问题 when using Rake to run a spec, the output in quickfix is not colored, meaning, it doesn't have green for passing specs and red for failing specs. Is this something solvable? Thanks for any hints. 回答1: According to Tim Pope, the author of rails.vim, not much that can be done about that; Vim doesn't support ANSI color codes. 回答2: It may be possible by recompiling vim as this plugin suggest. I haven't tried it myself. http://www.vim.org/scripts/script.php?script_id=302 来源: https://stackoverflow