Loading ...
Sorry, an error occurred while loading the content.

Re: question about 'isfname'

Expand Messages
  • ZyX
    Reply to message «Re: question about isfname », sent 06:36:28 30 July 2011, Saturday ... It is strange because first variant works better. Correct variant
    Message 1 of 12 , Jul 30, 2011
    • 0 Attachment
      Reply to message «Re: question about 'isfname'»,
      sent 06:36:28 30 July 2011, Saturday
      by Gary Johnson:

      > Either way works--I just prefer the former.
      It is strange because first variant works better. Correct variant using :execute
      is
      execute 'edit' fnameescape(testme)

      Original message:
      > On 2011-07-29, sc wrote:
      > > On Friday, July 29, 2011 16:55:17 Gary Johnson wrote:
      > > > (which I'm surprised even works) to
      > > >
      > > > exe 'e' testme
      > >
      > > well -- i was surprised THAT works and changed it to
      > >
      > > execute 'e ' . testme
      >
      > From ":help :exe":
      > :exe[cute] {expr1} .. Executes the string that results from
      >
      > the evaluation of {expr1} as an Ex
      > command. Multiple arguments are
      > concatenated, with a space in between.
      >
      > Either way works--I just prefer the former.
      >
      > Regards,
      > Gary
    • AlmostSurely
      Hey, I ve been trying to capture a portion of output from a shell command. Suppose I need the first line of output from, ... Is it possible for me to execute
      Message 2 of 12 , Oct 26, 2013
      • 0 Attachment
        Hey,

        I've been trying to capture a portion of output from a shell command. Suppose I need the first line of output from,

        :!g++ --version

        Is it possible for me to execute the above, storing only the first line of output in a string variable?

        Thanks!

        --
        --
        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@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Tim Chase
        ... Depending on the context you want it, you can either read the output of the command into the current buffer with ... Note that this will give you the
        Message 3 of 12 , Oct 26, 2013
        • 0 Attachment
          On 2013-10-26 13:30, AlmostSurely wrote:
          > I've been trying to capture a portion of output from a shell
          > command. Suppose I need the first line of output from,
          >
          > :!g++ --version
          >
          > Is it possible for me to execute the above, storing only the first
          > line of output in a string variable?

          Depending on the context you want it, you can either read the output
          of the command into the current buffer with

          :r !g++ --version

          or you can put it in a variable to be manipulated:

          :let my_var=system('g++ --version')

          Note that this will give you the complete output, so you'd have to
          throw away the bits you don't want.

          -tim


          --
          --
          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@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • tooth pik
          ... which would be easy enough to do with head, as ... -- _|_ _ __|_|_ ._ o| ... -- -- You received this message from the vim_use maillist. Do not top-post!
          Message 4 of 12 , Oct 26, 2013
          • 0 Attachment
            On Sat, Oct 26, 2013 at 06:23:22PM -0500, Tim Chase wrote:
            > On 2013-10-26 13:30, AlmostSurely wrote:
            > > I've been trying to capture a portion of output from a shell
            > > command. Suppose I need the first line of output from,
            > >
            > > :!g++ --version
            > >
            > > Is it possible for me to execute the above, storing only the first
            > > line of output in a string variable?

            > Depending on the context you want it, you can either read the output
            > of the command into the current buffer with

            > :r !g++ --version

            > or you can put it in a variable to be manipulated:

            > :let my_var=system('g++ --version')

            > Note that this will give you the complete output, so you'd have to
            > throw away the bits you don't want.

            which would be easy enough to do with head, as

            :let my_var = system('g++ --version | head -1')

            --
            _|_ _ __|_|_ ._ o|
            |_(_)(_)|_| ||_)||<
            |

            --
            --
            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@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • AlmostSurely
            ... Hi Tim, thanks for the response. This seems to work and do what I need, function! Test2() ... endfunction -- -- You received this message from the
            Message 5 of 12 , Oct 27, 2013
            • 0 Attachment
              On Saturday, October 26, 2013 7:23:22 PM UTC-4, Tim Chase wrote:
              > On 2013-10-26 13:30, AlmostSurely wrote:
              >
              > > I've been trying to capture a portion of output from a shell
              >
              > > command. Suppose I need the first line of output from,
              >
              > >
              >
              > > :!g++ --version
              >
              > >
              >
              > > Is it possible for me to execute the above, storing only the first
              >
              > > line of output in a string variable?
              >
              >
              >
              > Depending on the context you want it, you can either read the output
              >
              > of the command into the current buffer with
              >
              >
              >
              > :r !g++ --version
              >
              >
              >
              > or you can put it in a variable to be manipulated:
              >
              >
              >
              > :let my_var=system('g++ --version')
              >
              >
              >
              > Note that this will give you the complete output, so you'd have to
              >
              > throw away the bits you don't want.
              >
              >
              >
              > -tim

              Hi Tim, thanks for the response. This seems to work and do what I need,

              function! Test2()
              :!clear
              :let str1 = system('g++ --version')
              :let str2 = split(str1, "\n")
              :execute "!echo " . shellescape(str2[0])
              endfunction

              --
              --
              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@....
              For more options, visit https://groups.google.com/groups/opt_out.
            • AlmostSurely
              ... Nice! Thank you. -- -- 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
              Message 6 of 12 , Oct 27, 2013
              • 0 Attachment
                On Saturday, October 26, 2013 7:28:22 PM UTC-4, toothpik wrote:
                > On Sat, Oct 26, 2013 at 06:23:22PM -0500, Tim Chase wrote:
                >
                > > On 2013-10-26 13:30, AlmostSurely wrote:
                >
                > > > I've been trying to capture a portion of output from a shell
                >
                > > > command. Suppose I need the first line of output from,
                >
                > > >
                >
                > > > :!g++ --version
                >
                > > >
                >
                > > > Is it possible for me to execute the above, storing only the first
                >
                > > > line of output in a string variable?
                >
                >
                >
                > > Depending on the context you want it, you can either read the output
                >
                > > of the command into the current buffer with
                >
                >
                >
                > > :r !g++ --version
                >
                >
                >
                > > or you can put it in a variable to be manipulated:
                >
                >
                >
                > > :let my_var=system('g++ --version')
                >
                >
                >
                > > Note that this will give you the complete output, so you'd have to
                >
                > > throw away the bits you don't want.
                >
                >
                >
                > which would be easy enough to do with head, as
                >
                >
                >
                > :let my_var = system('g++ --version | head -1')
                >
                >
                >
                > --
                >
                > _|_ _ __|_|_ ._ o|
                >
                > |_(_)(_)|_| ||_)||<
                >
                > |

                Nice! Thank you.

                --
                --
                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@....
                For more options, visit https://groups.google.com/groups/opt_out.
              Your message has been successfully submitted and would be delivered to recipients shortly.