vim

vim regex for replacing spaces within quotes

*爱你&永不变心* 提交于 2019-12-21 12:29:22
问题 I have text in the follwing format: ERR_OUT_OF_MEM, "ERR OUT OF MEM" ERR_SOMETHING_BAD, "ERR SOMETHING BAD" I want to replace all spaces in the text which are within quotes with underscores: ERR_OUT_OF_MEM, "ERR_OUT_OF_MEM" ERR_SOMETHING_BAD, "ERR_SOMETHING_BAD" The best regex I could come up with is: \("\w\+\)\@<= (there's a space at the end of that) but this only finds the first space in each quoted string, and I would need to repeat this multiple times to get the desired effect. Any way to

Convert escaped codepoint to unicode character

六眼飞鱼酱① 提交于 2019-12-21 12:16:10
问题 I am trying to take a chunk of JSON that has strings which contain the literal characters \u009e and I would like to convert those characters to its associated single unicode character, in this case é . I use curl or wget to download the json which looks like: { "name": "Kitsun\u00e9" } And need to translate this in Vim to: { "name": "Kitsuné" } My first thought was to use Vim's iconv, but it does not evaluate the string as a single character and just returns the input. let code = '\u00e9'

Vim - delete line in insert mode

风流意气都作罢 提交于 2019-12-21 11:32:34
问题 Can I delete a line in insert mode? Because currently I have to press <ESC>dd to be able to that, and I would like a quicker way to delete a line in insert mode 回答1: If the cursor is at the end of the line, you can press <C-U> twice. The first one will clear the text before the cursor, the second one will remove the now empty line (and put the cursor at the end of the previous line). That said, I would not use this often. Insert mode is for inserting ; for all other edits, it's better to exit

Vim - delete line in insert mode

柔情痞子 提交于 2019-12-21 11:32:10
问题 Can I delete a line in insert mode? Because currently I have to press <ESC>dd to be able to that, and I would like a quicker way to delete a line in insert mode 回答1: If the cursor is at the end of the line, you can press <C-U> twice. The first one will clear the text before the cursor, the second one will remove the now empty line (and put the cursor at the end of the previous line). That said, I would not use this often. Insert mode is for inserting ; for all other edits, it's better to exit

sending code from vim to stata

醉酒当歌 提交于 2019-12-21 10:16:13
问题 I have been using Vim to write Stata scripts in Windows for a while now at the university. I am learning R at the moment, and I want to switch completely to Linux as my OS (I've recently switched to Ubuntu on my laptop). R works fine with Vim in both Windows and Linux, however I still need to use Stata sometimes. In Windows I have been using a simple AutoIt script provided by a Stata user to send lines / the whole file to stata for evaluation. This script doesnt work in Linux. This is what

Highlight every matched pattern while searching in Vim [duplicate]

时间秒杀一切 提交于 2019-12-21 09:17:06
问题 This question already has answers here : Vim: highlight all matches in incsearch (3 answers) Closed 5 years ago . I have set incsearch set in my .vimrc and it highlights EVERY matched pattern only when tapping enter. But is there any way to highlight all the matches while typing in the search? 回答1: That's what :set incsearch is about: showing the matches while typing the pattern : Ensure that the IncSearch highlight group actually has distinctive visual features; it may have been cleared: :hi

syntastic - Disable automatic compilation of Java

人盡茶涼 提交于 2019-12-21 09:15:34
问题 How can I tell Syntastic to not compile my Java code on save? I have tried following in my .vimrc : let g:syntastic_disabled_filetypes = ['java'] let g:syntastic_java_checker='checkstyle' let g:syntastic_java_checker='' 回答1: let g:syntastic_mode_map = { 'mode': 'active', \ 'active_filetypes': ['foo', 'bar'], \ 'passive_filetypes': ['java'] } This should work. 回答2: This is something of a hack, but you can trick Syntastic into not loading the javac checker by pretending it's already loaded, by

autopep8 with vim

江枫思渺然 提交于 2019-12-21 09:14:11
问题 Is there a way to automatically apply autopep8 to a file being edited in vim? I have the following vimrc. Thank you in advance. 回答1: The correct way of using autopep8 is to rely on vim "formatprg" settings. So you add the line below to vimrc: au FileType python setlocal formatprg=autopep8\ - Now when you select lines in python and hit gq (the default mapping unless you remapped it). It will filter the lines through autopep8 and writes the nicely formatted version in place. The setting above

autopep8 with vim

女生的网名这么多〃 提交于 2019-12-21 09:13:06
问题 Is there a way to automatically apply autopep8 to a file being edited in vim? I have the following vimrc. Thank you in advance. 回答1: The correct way of using autopep8 is to rely on vim "formatprg" settings. So you add the line below to vimrc: au FileType python setlocal formatprg=autopep8\ - Now when you select lines in python and hit gq (the default mapping unless you remapped it). It will filter the lines through autopep8 and writes the nicely formatted version in place. The setting above

Setting the vim color theme for highlighted braces

▼魔方 西西 提交于 2019-12-21 09:06:09
问题 How do you change the vim color scheme for highlighted braces? I'm looking to actually edit the .vim theme file to make the change permanent. Regards, Craig 回答1: The automatic highlight colour for matching brackets is called MatchParen . You can change the colour in your .vimrc by doing eg: highlight MatchParen cterm=bold ctermfg=cyan 回答2: After reading the FAQ, I can answer my own question. :) 24.9. Is there a built-in function to syntax-highlight the corresponding matching bracket? No. Vim