Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to use visible markers in vim.
I have the following in my .vimrc file:

sign define information text=!> linehl=Warning texthl=Error  
exe ":sign place 123 line=" . line(.) ."name=information file=" . expand("%:p")  
map <F7> :exe ":sign place 123 line=" . line(".") ."name=information file=".expand("%:p")<CR>  

But when I open vim I get an error in line exe ":sign etc

line   30:  
E15: Invalid expression: .) ."name=information file=" . expand("%:p")  
E116: Invalid arguments for function line(.) ."name=information file=" . expand("%:p")  
E15: Invalid expression: ":sign place 123 line=" . line(.) ."name=information file=" .   expand("%:p")

What is the problem with my syntax?

share|improve this question
    
:s/visible marks/signs –  romainl Jun 23 '13 at 10:18
    
@romainl:What is this command? –  user65971 Jun 23 '13 at 10:32
    
An inside joke and a comment: you should call them "signs" instead of "visible marks". –  romainl Jun 23 '13 at 11:30
add comment

1 Answer

up vote 2 down vote accepted

The error is fairly easy to spot.

You wrote

line(.)

instead of

line('.') or line(".")

edit

The error message in your question was related to the error above but there's a second error, a missing space.

  1. Your line:

    exe ":sign place 123 line=" . line(.) ."name=information file=" . expand("%:p")
    
  2. First error corrected by putting the argument to line() in quotes (fixed expand() as well):

    exe ":sign place 123 line=" . line('.') ."name=information file=" . expand('%:p')
    
  3. Second error corrected by adding a missing space after the third double quote:

    exe ":sign place 123 line=" . line('.') ." name=information file=" . expand('%:p')
                                              ^
                                              +-- added missing space
    

Because of the missing space, the value of the line argument was something like 26name=information and the name argument was missing.

share|improve this answer
    
If I write:exe ":sign place 123 line=" . line('.') ."name=information file=" . expand("%:p") I still get an error on this line about E474 Invalid argument –  user65971 Jun 23 '13 at 15:04
    
Same problem with exe ":sign place 123 line=" . line(".") ."name=information file=" . expand("%:p") –  user65971 Jun 23 '13 at 15:06
    
You need to use single quotes inside the surrounding double quotes: :exe "echo 'This is line number " . line('.') . ". You bet it is.'". If you don't do that Vim will get lost trying to figure where the expression to execute ends. –  romainl Jun 23 '13 at 15:25
    
This exe ":sign place 123 line=' . line('.') .'name=information file=" . expand("%:p") does not work either. I am not sure I understand which part you mean that should be corrected –  user65971 Jun 23 '13 at 15:54
    
Your command echo is straitforward.But in my case I am not sure which part should be in single quotes –  user65971 Jun 23 '13 at 16:11
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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