learnvimscriptthehardway
                                
                                
                                
                                    learnvimscriptthehardway copied to clipboard
                            
                            
                            
                        Ch19 Poor example for why we should use `let` instead of `set`
Chapter 19:
Why would we want to do this when we could just use
set? Run the following commands:
:let &textwidth = &textwidth + 10
:set textwidth?
This time Vim displays "textwidth=110". When you set an option using
setyou can only set it to a single literal value.
But in this case we can also do exactly the same thing with set:
:set textwidth=100
:set textwidth+=10
:set textwidth?
Vim displays "textwidth=110".
Yeah, it's tough to come up with simple examples that don't require a lot of outside knowledge. If you can think of a good standalone example here let me know.
One possible example would be a command to increase textwidth by 15% or something similar.
:let &textwidth = &textwidth * 115 / 100
That couldn't really be accomplished using :set (well there's ^= but that doesn't seem to work with a float.) Just a suggestion... Thanks for the excellent guide!!!