32

2016 update The Vim syntax file was updated for this in v7.4.649 (March 2015); so if you have this patch you don't need to do this. The easiest way to fix this is probably by downloading the newer syntax/java.vim file and putting it in ~/.vim/syntax/java.vim so it will override the default $VIMRUNTIME/syntax/java.vim. You will also need to symlink html.vim ...


4

It's not necessary to edit the default syntax file. The vim-java plugin has support for this. Just install like any other plugin and the lambda operator will be highlighted correctly.


3

It can be done with a substitution with a sub-replace-expression: :%s/\ze\(\s*\)private \w\+ \(\w\+\)/\=submatch(1).'@Column(name="'.substitute(submatch(2), '\u', '_\l&', 'g').'");'."\r" For more help see: :h :s :h sub-replace-expression :h \zs :h submatch() :h substitute() :h /\u :h sub-replace-special :h s/\l


3

First thing I notice is that you have quotes in there. When using set everything after the = symbol is set to the value. Since errorformat has spaces and backslashes my preferred way to set it is with let and single-quoted strings, then string concatenation so I can break it up into more easily parsed lines. let &errorformat = \ '%*[^"]"%f"%*\D%l: ...


2

The error is from vim-android. Your project.properties file don't have a line with target=. There is a new version for the java plugin vim-javacomplete2.


2

Thanks to David Ben Knoble's comment I was able to find relevant information and solve my problem. I did as follows and it worked for me: In .vimrc, remove source ~/yang.vim, add :syntax on and :filetype plugin on (I added them to the top of the file). Inside vim (normal mode), type :set runtimepath?. In my case one of the directories printed was ~/.vim. ...


2

Yet another solution g/^\s*private/copy. | normal! -2dwdw"_C@Column(name = "^R=substitute(@-, '\(\l\)\(\u\)', '\1_\l\2', 'g')^M") An explanation: g/^\s*private/... for all lines starting with "<spaces>private" copy. | normal! ... make a copy of the current line then enter normal mode command -2dwdw"_C up one line ...


1

If you'd accept a solution that requires a Vim plug-in (specifically for the snake case coercion), then I could recommend one that involves recording a macro to process each line. In particular, you would have to install plug-in vim-abolish, which includes a cr operation to do case coersion, in particular crs (or equivalently cr_) for snake_case. So you ...


1

I figured it out, mostly. Vim has a special version of the zero-width assertion. It doesn't recognize the standard regex ?= zero-width assertion. Thanks to Karl and user1685095 for pointing out the \ze specifier. Actually you can use either \ze or \@= - though, as pointed out by user1685095, \ze is the more efficient of the two. \@= is a successor operation ...


Only top voted, non community-wiki answers of a minimum length are eligible