I am trying to write my (first) function which is (eventually to be) a toggle on my colorscheme. What I have now is as follows:
nnoremap <expr> <leader>3 ToggleColors() func ToggleColors() let x = ":colorscheme" echom '111' + x x = x += "TextMate" echom '222' + x return x endfunc
Here is what I am trying to do:
- Set a variable
xto be the string
- Print it, which should give me the output message
- Append to the variable
x, so now it should be
- Print it again, so now it should print
However, it seems like the
echom '111' + x only prints
111, and the string-concatenation is giving me an error.
What would be the proper way to write this? Finally, is there any way to debug functions in vim? Or do you just have to check
messages? All the error messages (stacktraces) I get give almost zero information...less than even SQL would.