3

I have output from static analyzer, that I parsed with Bash.

Now I want Vim to run on specified by analyzer line and add comment containing warning id and description.

I tried this,

vim $file +$line+'normal A'+'/* KW: $kwid desc: $desc */'

Where $file is the path to file, $line line number, $kwid and $desc are strings that describe what problem I'm working on for this case.

1

Try this:

vim "$file" +$line +"normal! A/* KW: $your text $here */"

Parameter expansion does not happen in single quotes in bash.

Each command given to vim get’s one + (it is not like string concatenation at all).

| improve this answer | |
  • 1
    @filbranden done! Good catch I got lazy typing on mobile (could you tell :P ) – D. Ben Knoble Aug 10 '19 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.