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

Ctrl-P

Expand Messages
  • A. S. Budden
    Hi there, Please forgive me if I m being utterly useless here. I ve been browsing the web and reading the manual for ages and I think I know what I m supposed
    Message 1 of 6 , Jun 2, 2004
    • 0 Attachment
      Hi there,

      Please forgive me if I'm being utterly useless here. I've been browsing
      the web and reading the manual for ages and I think I know what I'm
      supposed to be doing, but I can't do it! I've got a feeling it's
      something to do with the iskeyword option, but I can't get it to do what
      I'm trying to achieve.

      I have a utf8 file (with a fair number of characters with accents).
      This file contains a lot of fields, all separated by tabs. The fields
      can contain pretty much anything except a tab (although typically they
      will have alphanumeric characters, apostrophes, commas, SPACES,
      fullstops etc plus a few accented characters and upside down question
      marks etc).

      What I would like to be able to do when adding text to this file is to
      use Ctrl-P (or something similar) to complete the field that I'm typing
      (as opposed to just the word). For example, earlier in the file I may
      have an entry that reads "Pentref Wrth Y Mor (Village By The Sea)" with
      a tab (or start of line/end of line) before and after it (and without
      the double quotes in this case) and I want to be able to type:

      Pentre^P

      (where ^P is Ctrl-P) to complete the whole string.

      Can anyone offer any suggestions with how to go about this? I have to
      confess I'm getting rather confused with the iskeyword documentation...
      What I think I would like to do is say "let iskeyword be everything
      except tabs, starts of lines and ends of lines" or something like
      iskeyword=*-\t,\n

      Many thanks in advance for any help you can offer,

      Al
    • gumnos (Tim Chase)
      ... Well, you can get this with (while this isn t exactly it, it s good enough for the most part) ... which includes spaces, but excludes tabs and cr/lf.
      Message 2 of 6 , Jun 2, 2004
      • 0 Attachment
        > What I think I would like to do is say "let iskeyword be everything
        > except tabs, starts of lines and ends of lines" or something like
        > iskeyword=*-\t,\n

        Well, you can get this with (while this isn't exactly it, it's good
        enough for the most part)

        :set iskeyword=32-255

        which includes spaces, but excludes tabs and cr/lf. However, then
        keywords can only begin at the start of a line or tab. Thus, if you
        have (I just used your email as example text)

        ___snip__
        (as opposed to just the word). For example, earlier in the file I may
        have an entry that reads "Pentref Wrth Y Mor (Village By The Sea)" with
        a tab (or start of line/end of line) before and after it (and without

        ___snip__

        and you start typing "Pent" followed by ^P, it won't find the whole
        thing. However, if you type "have" and hit ^P, it will find that whole
        line.

        If your fields are delimited by tabs, then this should ameliorate the
        problem, so if you have ("rendered" with "set list")

        some field^IPentref Wrth Y Mor (Village By The Sea)^Isome other
        field$

        This will appropriately complete the whole thing for you.

        I'm not sure how kindly this plays with Unicode/UTF8 joys, but perhaps
        Antoine M. or one of the other folks better versed in the peculiarities
        of alternate character encodings can jump in here.

        To truely just get tabs & cr/lf as your delims, you could set iskeyword
        to"1-8,11,12,14-255" or something like that. This would exclude *just*
        those characters. However, if you're lazy like me, and don't have other
        control characters in your document (<32) then you can just use the
        32-255 range. :)

        Hope this helps,

        -tim
      • Antony Scriven
        ... I don t know anything about utf8, sorry, but hopefully this will still apply. ... Try something along the lines of: set iskeywork=1-255,^9 Replace `1-255
        Message 3 of 6 , Jun 2, 2004
        • 0 Attachment
          A. S. Budden wrote:

          > I have a utf8 file (with a fair number of characters with accents).
          > This file contains a lot of fields, all separated by tabs.
          > [...]

          I don't know anything about utf8, sorry, but hopefully this
          will still apply.

          > What I would like to be able to do when adding text to this file is to
          > use Ctrl-P (or something similar) to complete the field that I'm typing
          > (as opposed to just the word).

          Try something along the lines of:

          set iskeywork=1-255,^9

          Replace `1-255' with whatever range you need for utf8. `^9'
          means exclude tabs. I don't think you need to exclude
          newlines as I'm not sure that you can complete across a line
          boundary, although I admit I've never tried.

          You may also want to change the 'complete' option:

          set complete=.

          to just complete from the current buffer.

          > [...] I have to confess I'm getting rather confused with
          > the iskeyword documentation...

          The actual format for 'iskeyword' is documented under
          'isfname'.

          Hope this is of some use

          Antony
        • A. S. Budden
          ... [snip] ... [snip] I ve tried both of these solutions, but I still can t get it to work. The result I get is that I type Pent^P and it completes the Pentref
          Message 4 of 6 , Jun 2, 2004
          • 0 Attachment
            Thus spake gumnos (Tim Chase):
            > > What I think I would like to do is say "let iskeyword be everything
            > > except tabs, starts of lines and ends of lines" or something like
            > > iskeyword=*-\t,\n
            >
            > Well, you can get this with (while this isn't exactly it, it's good
            > enough for the most part)
            >
            > :set iskeyword=32-255
            >
            [snip]

            Thus spake Antony Scriven:
            > A. S. Budden wrote:
            >
            > > I have a utf8 file (with a fair number of characters with accents).
            > > This file contains a lot of fields, all separated by tabs.
            > > [...]
            >
            > I don't know anything about utf8, sorry, but hopefully this
            > will still apply.
            >
            > > What I would like to be able to do when adding text to this file is to
            > > use Ctrl-P (or something similar) to complete the field that I'm typing
            > > (as opposed to just the word).
            >
            > Try something along the lines of:
            >
            > set iskeywork=1-255,^9
            >
            > Replace `1-255' with whatever range you need for utf8. `^9'
            > means exclude tabs. I don't think you need to exclude
            > newlines as I'm not sure that you can complete across a line
            > boundary, although I admit I've never tried.
            >
            > You may also want to change the 'complete' option:
            >
            > set complete=.
            >
            > to just complete from the current buffer.
            [snip]

            I've tried both of these solutions, but I still can't get it to work.
            The result I get is that I type Pent^P and it completes the Pentref bit,
            but not the rest of the field.

            In case it helps, I have uploaded the text file in question to
            http://tinyurl.com/yupsv

            Can anyone point out what I'm missing here... or at least confirm that
            it works with this file so that I can see if there's something wrong
            with my setup here...

            Many thanks again for the help,

            Al
          • Antoine J. Mechelynck
            ... [...] ... Seeing my name in the mail, I just have to answer. Yet there are a LOT of things about Vin that I don t know, even in the Unicode department.
            Message 5 of 6 , Jun 2, 2004
            • 0 Attachment
              gumnos (Tim Chase) <gumnos@...> wrote:
              > > What I think I would like to do is say "let iskeyword be everything
              > > except tabs, starts of lines and ends of lines" or something like
              > > iskeyword=*-\t,\n
              >
              > Well, you can get this with (while this isn't exactly it, it's good
              > enough for the most part)
              >
              > :set iskeyword=32-255

              [...]

              > I'm not sure how kindly this plays with Unicode/UTF8 joys, but perhaps
              > Antoine M. or one of the other folks better versed in the
              > peculiarities of alternate character encodings can jump in here.
              >
              > To truely just get tabs & cr/lf as your delims, you could set
              > iskeyword to"1-8,11,12,14-255" or something like that. This would
              > exclude *just* those characters. However, if you're lazy like me,
              > and don't have other control characters in your document (<32) then
              > you can just use the 32-255 range. :)
              >
              > Hope this helps,
              >
              > -tim

              Seeing my name in the mail, I just have to answer. Yet there are a LOT of
              things about Vin that I don't know, even in the Unicode department. About
              "higher" codepoints, I read under 'isfname' (to which 'iskeyword' resends)
              that "under Unicode", multibyte codepoints U+00A0 and above are always
              "included" ("multibyte" in UTF-8 means anything other than 7-bit ASCII).

              Regards,
              Tony.
            • Antony Scriven
              ... I see the problem, but I m afraid I have no further suggestions. Works fine for latin1; switch to utf-8 and it stops working. Antony
              Message 6 of 6 , Jun 2, 2004
              • 0 Attachment
                A. S. Budden wrote:

                > Thus spake Antony Scriven:
                > >
                > > [...]
                > >
                > > set iskeywork=1-255,^9
                > >
                > > [...]
                >
                > I've tried both of these solutions, but I still can't get it to work.
                > The result I get is that I type Pent^P and it completes the Pentref bit,
                > but not the rest of the field.
                >
                > In case it helps, I have uploaded the text file in question to
                > http://tinyurl.com/yupsv
                >
                > Can anyone point out what I'm missing here... or at least confirm that
                > it works with this file so that I can see if there's something wrong
                > with my setup here...

                I see the problem, but I'm afraid I have no further
                suggestions. Works fine for latin1; switch to utf-8 and it
                stops working.

                Antony
              Your message has been successfully submitted and would be delivered to recipients shortly.