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

Position of the cursor relative to window not file

Expand Messages
  • meino.cramer@gmx.de
    Hi, for scripting purposes I am searching a function in vimscript, which returns the linenumber of the window the cursor is currently in. getpos() return
    Message 1 of 7 , Sep 30, 2009
      Hi,

      for scripting purposes I am searching a function in vimscript,
      which returns the linenumber of the window the cursor is
      currently in.
      getpos() return beside other things the number of the line
      when set number is on.
      I am looking for a function which returns a number
      between 0/1 and winheight() regardless how long the file
      is (even if there no file at all)

      Thank you very much for your help in advance!

      PS: Why does vim indents the text of this mail after
      the first line in this mysterious was?

      Keep hacking!
      mcc

      --
      Please don't send me any Word- or Powerpoint-Attachments
      unless it's absolutely neccessary. - Send simply Text.
      See http://www.gnu.org/philosophy/no-word-attachments.html
      In a world without fences and walls nobody needs gates and windows.


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Christian Brabandt
      Hi meino.cramer! ... Are you looking for winline()? ... Some strange indent expression/plugin? regards, Christian -- ...
      Message 2 of 7 , Sep 30, 2009
        Hi meino.cramer!

        On Mi, 30 Sep 2009, meino.cramer@... wrote:

        > for scripting purposes I am searching a function in vimscript,
        > which returns the linenumber of the window the cursor is
        > currently in.
        > getpos() return beside other things the number of the line
        > when set number is on.
        > I am looking for a function which returns a number
        > between 0/1 and winheight() regardless how long the file
        > is (even if there no file at all)

        Are you looking for winline()?

        >
        > Thank you very much for your help in advance!
        >
        > PS: Why does vim indents the text of this mail after
        > the first line in this mysterious was?
        Some strange indent expression/plugin?

        regards,
        Christian
        --
        :wq!

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • sc
        ... i notice the first word, not intented, is for -- this implies to me you are under the influence of a syntax module for an as yet-to-be-determined
        Message 3 of 7 , Sep 30, 2009
          On Wednesday 30 September 2009, meino.cramer@... wrote:

          > PS: Why does vim indents the text of this mail after
          >     the first line in this mysterious was?

          i notice the first word, not intented, is "for" -- this
          implies to me you are under the influence of a syntax module
          for an as yet-to-be-determined programming language -- it's
          hard to guess because virtually every language ever invented
          has a "for" keyword

          i'll wager if vim understood your filetype to be mail you
          wouldn't be having the indentation

          some things of interest:

          :set verbose filetype?
          :set verbose indent?
          :set verbose plugin indent?
          :scriptnames

          hth,

          sc

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Andy Wokula
          ... e.g. wrong filetype and Vim found the for keyword? ... thx for the suggestion ... -- Andy --~--~---------~--~----~------------~-------~--~----~ You
          Message 4 of 7 , Sep 30, 2009
            meino.cramer@... schrieb:
            > Hi,
            >
            > for scripting purposes I am searching a function in vimscript,
            > which returns the linenumber of the window the cursor is
            > currently in.
            > getpos() return beside other things the number of the line
            > when set number is on.
            > I am looking for a function which returns a number
            > between 0/1 and winheight() regardless how long the file
            > is (even if there no file at all)

            You can start here:
            :h line()
            :echo line("w0") line("w$")

            > Thank you very much for your help in advance!
            >
            > PS: Why does vim indents the text of this mail after
            > the first line in this mysterious was?

            e.g. wrong filetype and Vim found the "for" keyword?

            > Keep hacking!

            thx for the suggestion

            > mcc

            --
            Andy

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • meino.cramer@gmx.de
            ... Thanks for all the help! For the indentation problem: I will end this line with for and get no extra identation. The ft is set to filetype=mail . The mail
            Message 5 of 7 , Sep 30, 2009
              Andy Wokula <anwoku@...> [09-10-01 01:42]:
              >
              > meino.cramer@... schrieb:
              > > Hi,
              > >
              > > for scripting purposes I am searching a function in vimscript,
              > > which returns the linenumber of the window the cursor is
              > > currently in.
              > > getpos() return beside other things the number of the line
              > > when set number is on.
              > > I am looking for a function which returns a number
              > > between 0/1 and winheight() regardless how long the file
              > > is (even if there no file at all)
              >
              > You can start here:
              > :h line()
              > :echo line("w0") line("w$")
              >
              > > Thank you very much for your help in advance!
              > >
              > > PS: Why does vim indents the text of this mail after
              > > the first line in this mysterious was?
              >
              > e.g. wrong filetype and Vim found the "for" keyword?
              >
              > > Keep hacking!
              >
              > thx for the suggestion
              >
              > > mcc
              >
              > --
              > Andy
              >
              >
              Thanks for all the help! For the indentation problem: I will end this
              line with for
              and get no extra identation. The ft is set to "filetype=mail". The
              mail is written with mutt.

              I notice these sudden indentation from time to time in all sorts
              of texts even filetype-less ones.

              Keep hacking! :)
              mcc

              --
              Please don't send me any Word- or Powerpoint-Attachments
              unless it's absolutely neccessary. - Send simply Text.
              See http://www.gnu.org/philosophy/no-word-attachments.html
              In a world without fences and walls nobody needs gates and windows.


              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Jürgen Krämer
              Hi, ... you maybe have cindent set and because the first line ends with a comma, Vim thinks it s an incomplete parameter list that is going to be continued on
              Message 6 of 7 , Sep 30, 2009
                Hi,

                meino.cramer@... wrote:
                >
                > for scripting purposes I am searching a function in vimscript,
                > which returns the linenumber of the window the cursor is
                > currently in.
                > getpos() return beside other things the number of the line
                > when set number is on.
                > I am looking for a function which returns a number
                > between 0/1 and winheight() regardless how long the file
                > is (even if there no file at all)
                >
                > Thank you very much for your help in advance!
                >
                > PS: Why does vim indents the text of this mail after
                > the first line in this mysterious was?

                you maybe have cindent set and because the first line ends with a
                comma, Vim thinks it's an incomplete parameter list that is going
                to be continued on the next line.

                Regards,
                Jürgen

                --
                Sometimes I think the surest sign that intelligent life exists elsewhere
                in the universe is that none of it has tried to contact us. (Calvin)

                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_use" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • Ben Fritz
                ... I d guess smartindent myself. ... --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_use maillist. For more
                Message 7 of 7 , Oct 1, 2009
                  On Oct 1, 1:22 am, Jürgen Krämer <jottka...@...> wrote:
                  >
                  > you maybe have cindent set and because the first line ends with a
                  > comma, Vim thinks it's an incomplete parameter list that is going
                  > to be continued on the next line.
                  >

                  I'd guess smartindent myself.

                  The output of this command may help:

                  :verbose set smartindent? cindent?
                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_use" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---
                Your message has been successfully submitted and would be delivered to recipients shortly.