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

Writing a configuration file in vim script

Expand Messages
  • Gusman
    Dear All, Currently I try to make my custom function in Vim, in this case I need to create/write/read/delete a configuration file contains the global variable
    Message 1 of 5 , Aug 28 8:51 PM
    • 0 Attachment
      Dear All,

      Currently I try to make my custom function in Vim, in this case I need to
      create/write/read/delete a configuration file contains the global variable
      value.

      This is my question:
      "Can I create/write/read/delete file using vim script as other programming
      language do?"

      Thank you for you response before hand.


      Best Regards,


      Gusman Dharma P

      --
      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
    • John Beckett
      ... Yes. Vim script takes a little bit of time to figure out. One point is that (with suitable settings) you can simply put values in certain global variables
      Message 2 of 5 , Aug 29 1:24 AM
      • 0 Attachment
        Gusman wrote:
        > "Can I create/write/read/delete file using vim script as
        > other programming language do?"

        Yes. Vim script takes a little bit of time to figure out. One
        point is that (with suitable settings) you can simply put values
        in certain global variables and they will be saved/restored
        automatically.

        There are two examples in the following: Saving to a global
        variable (search for viminfo), and reading a csv file.
        http://vim.wikia.com/wiki/Highlight_multiple_words

        Here is another example which reads/writes a file:
        http://vim.wikia.com/wiki/Restore_screen_size_and_position

        John

        --
        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
      • Tom Link
        ... I don t know if this is relevant for you, but to some extent you can use viminfo to save certain variables (all upper case names). See the ! argument in
        Message 3 of 5 , Aug 29 3:05 AM
        • 0 Attachment
          > Currently I try to make my custom function in Vim, in this case I need to
          > create/write/read/delete a configuration file contains the global variable
          > value.

          I don't know if this is relevant for you, but to some extent you can
          use viminfo to save certain variables (all upper case names). See the
          '!' argument in :help 'viminfo'.

          Regards,
          Tom

          --
          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
        • Gusman
          ... Hi, Currently I found a way to write/read/create/delete file by using python script. But is there significant difference between python script and original
          Message 4 of 5 , Aug 29 8:19 AM
          • 0 Attachment
            On Sun, Aug 29, 2010 at 5:05 PM, Tom Link <micathom@...> wrote:
            > Currently I try to make my custom function in Vim, in this case I need to
            > create/write/read/delete a configuration file contains the global variable
            > value.

            I don't know if this is relevant for you, but to some extent you can
            use viminfo to save certain variables (all upper case names). See the
            '!' argument in :help 'viminfo'.

            Regards,
            Tom

            --
            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


            Hi,

            Currently I found a way to write/read/create/delete file by using python script.
            But is there significant difference between python script and original vim script?

            Until now, I only find to read and write a file using vim script, based on John
            information.


            Best Regards,


            Gusman Dharma P

            --
            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
          • Gary Johnson
            ... When Vim writes to file, it will also create that file if it doesn t already exist, so there is no need for a separate create function. To delete a file,
            Message 5 of 5 , Sep 1, 2010
            • 0 Attachment
              On 2010-08-29, Gusman wrote:

              > On Sun, Aug 29, 2010 at 5:05 PM, Tom Link wrote:
              >
              > > Currently I try to make my custom function in Vim, in this case I need to
              > > create/write/read/delete a configuration file contains the global
              > variable
              > > value.
              >
              > I don't know if this is relevant for you, but to some extent you can
              > use viminfo to save certain variables (all upper case names). See the
              > '!' argument in :help 'viminfo'.
              >
              > Regards,
              > Tom

              > Hi,
              >
              > Currently I found a way to write/read/create/delete file by using python
              > script.
              > But is there significant difference between python script and original vim
              > script?
              >
              > Until now, I only find to read and write a file using vim script, based on John
              > information.

              When Vim writes to file, it will also create that file if it doesn't
              already exist, so there is no need for a separate create function.
              To delete a file, see

              :help delete()

              Regards,
              Gary

              --
              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
            Your message has been successfully submitted and would be delivered to recipients shortly.