0

These are my commands and functions that get name and address for app or url to launch em withing vim. They store the value in .txt files. Problem is that both commands give me "E119: Not enough arguments for function: Adda/Addw"

command! -nargs=+ Addw call Addw(<q-args>)
command! -nargs=+ Adda call Adda(<q-args>)

function! Addw(name, address)
 let web_addresses_file = expand('~/vimfiles/plugged/flexibleVP/data/webaddress.txt')
  let web_addresses = readfile(web_addresses_file)
  let new_line = a:name . ': ' . a:address

  call writefile(web_addresses + [new_line], web_addresses_file)
  echo 'Web address added: ' . new_line
endfunction

function! Adda(name, address)
let app_addresses_file = expand('~/vimfiles/plugged/flexibleVP/data/appaddress.txt')
  let app_addresses = readfile(app_addresses_file)
  let new_line = a:name . ': ' . a:address

  call writefile(app_addresses + [new_line], app_addresses_file)
  echo 'App address added: ' . new_line
endfunction

Tried with l:name and l:address; Tried -nargs=*

1 Answer 1

0

just used f-args instead of q-args

Sign up to request clarification or add additional context in comments.

3 Comments

Could you elaborate a bit? How does this solve your problem? Where to read about f-args, q-args, etc.?
I think its because q-args is one whole string when you pass the parameters, while f-args splits it so the function can work with the different variables. use :help f-args or :help q-args
In your answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.