2015-05-30 23:21 GMT+03:00 Rick Dooling <rpdooling@gmail.com>:
> Hello,
>
> I frequently want to open a text file, go to the last line, open the fold, add one or two blank lines and begin writing.
>
> I'm trying to make an alias for vim that does this. Something like:
>
> alias note="gvim -c $ +foldo +put='' +star /Users/name/Notes/notes.md"
>
> Everything works except the attempt to put a blank line. No matter what I try: :pu='' :$pu=' _' etc it will not add blank lines for me.
You need to learn how shell processes arguments
`+pu=''` does not work because it is `+pu=`. Dunno why it does not
give an error, but it is "put empty expression", not "put expressin
that evaluates to an empty string".
+$pu=' _' is `+= _` (actually, `+${pu}= _`, but I do not think you
have variable named pu defined in shell; undefined variables expand to
an empty string). Should give E488 because `=` command does not accept
_ as an argument.
@TimChase advice avoids escaping issues by creating a string that does
not need to be escaped. But this is not always possible and if you
want to know how to fix such issues check out advanced bash scripting
guide. Quoting is described in
http://www.tldp.org/LDP/abs/html/quoting.html.
Note about aliases: `alias note={some string}` means "when 'note'
appears to be a non-escaped separate command substitute 'note' with
'{some string}'". {Some string} is also subject to various
expansions/quote removals once at the time alias is being defined so
you need to quote it so that the result of these expansions is itself
properly quoted.
>
> Thanks for any help.
>
> Rick
>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sunday, May 31, 2015
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment