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

scrolling and conditional map

Expand Messages
  • Arafat Mohamed
    I appreciate you guys helping me out while I ve been learning vim. I ve been reading the documentation and learning as much as I can on my own. Some things
    Message 1 of 6 , Aug 1, 2001
    • 0 Attachment
      I appreciate you guys helping me out while I've been learning vim. I've been
      reading the documentation and learning as much as I can on my own. Some
      things though, I can't seem to find the doc for (or can't find the right
      keyword combination to look up). I hope you guys can help me with a few
      things...

      1) I notice that if I use l to scroll (am I using the right word?) right, if
      I get to the end of the line, it doesn't move on to the next line. Is there
      a setting to fix this?

      2) I figured out how to use :map, however, is there a way to make it
      conditional? e.g. only use a map if I'm editing a java file.

      3) If I have my window split, how can I switch between my open buffers
      without using the mouse?

      4) Is there a way to go the next buffer? I know how to use :b4 to go to
      buffer 4. But what if I don't know the buffer number?

      5) I set sw=2 and ts=2. If I'm on a newline and hit <TAB>, I get the right
      indentation of 2 spaces. However, if I do this when I'm in the middle of a
      line, for some reason, my tabstop reverts to 8 spaces. What am I doing
      wrong? I also set smarttab, autoindent, and smartindent.

      Thank you,
      Arafat


      _________________________________________________________
      Do You Yahoo!?
      Get your free @... address at http://mail.yahoo.com
    • Vonlia
      ... We (at least I) will try :-) ... Yes, it s called whichwrap (or ww ), to add the l command, use: ... Not just with :map , but you could use (in a
      Message 2 of 6 , Aug 1, 2001
      • 0 Attachment
        On Wed, 1 Aug 2001, Arafat Mohamed wrote:

        > I appreciate you guys helping me out while I've been learning vim. I've been
        > reading the documentation and learning as much as I can on my own. Some
        > things though, I can't seem to find the doc for (or can't find the right
        > keyword combination to look up). I hope you guys can help me with a few
        > things...
        We (at least I) will try :-)
        > 1) I notice that if I use l to scroll (am I using the right word?) right, if
        > I get to the end of the line, it doesn't move on to the next line. Is there
        > a setting to fix this?

        Yes, it's called 'whichwrap' (or 'ww'), to add the 'l' command, use: >

        :set ww+=l

        :help 'whichwrap'

        > 2) I figured out how to use :map, however, is there a way to make it
        > conditional? e.g. only use a map if I'm editing a java file.

        Not just with ':map', but you could use (in a .vimrc):

        autocmd BufRead,BufNewFile *.java map x lX

        :hep autocmd

        > 3) If I have my window split, how can I switch between my open buffers
        > without using the mouse?

        If you have a window on the top, and you are on the bottom window, use
        '^Wk' to get to the top window

        :help CTRL-W

        > 4) Is there a way to go the next buffer? I know how to use :b4 to go to
        > buffer 4. But what if I don't know the buffer number?

        Have you tried using: >

        :buffers

        :help :buffers

        > 5) I set sw=2 and ts=2. If I'm on a newline and hit <TAB>, I get the right
        > indentation of 2 spaces. However, if I do this when I'm in the middle of a
        > line, for some reason, my tabstop reverts to 8 spaces. What am I doing
        > wrong? I also set smarttab, autoindent, and smartindent.

        I don't see this, can you give a reproducable example starting with 'vim
        -u NONE'?

        > Thank you,

        No problem :-)


        --
        Hunter with gun: ``I love animals. That's why I love to kill
        them.''
        -- Monty Python::sketch

        /|| Vonlia <http://members.home.net/adam.seyfarth/> ||\
        /«|| <mailto:cloud@...> <http://www.majik3d.org> ||»\
        \«|| <http://tuxaqfh.sf.net> <http://tuxkart.sf.net> ||»/
        \|| <http://vim.sf.net> <http://www.majik3d.org> ||/
      • Arun Bhanu
        ... _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
        Message 3 of 6 , Aug 1, 2001
        • 0 Attachment
          > 3) If I have my window split, how can I switch between my open buffers
          > without using the mouse?
          >

          You can use Ctrl-Tab to switch between open buffers.

          Regards,
          Arun.


          _________________________________________________________
          Do You Yahoo!?
          Get your free @... address at http://mail.yahoo.com
        • ÌìÀÚ
          Really? I m using vim60ap BETA for microsoft windows, but I cannot use Ctrl+Tab to switch in the splitted windows... I think that Ctrl+W hjkl will do the
          Message 4 of 6 , Aug 1, 2001
          • 0 Attachment
            Really?
            I'm using vim60ap BETA for microsoft windows,
            but I cannot use Ctrl+Tab to switch in the
            splitted windows...
            I think that 'Ctrl+W hjkl' will do the switch
            operations..

            > > 3) If I have my window split, how can I switch between my open buffers
            > > without using the mouse?
            > >
            >
            > You can use Ctrl-Tab to switch between open buffers.
            >
            > Regards,
            > Arun.
            >
            >

            > _________________________________________________________

            > Do You Yahoo!?

            > Get your free @... address at http://mail.yahoo.com

            >

            -------------------------------
            ����������������������
            http://enterprise.21cn.com/game/
          • Benji Fisher
            ... [snip] ... This does not work perfectly. If you edit a Java file, you will get the desired mapping, but it will not go away if you switch to another
            Message 5 of 6 , Aug 2, 2001
            • 0 Attachment
              Vonlia wrote:
              >
              > On Wed, 1 Aug 2001, Arafat Mohamed wrote:
              [snip]
              > > 2) I figured out how to use :map, however, is there a way to make it
              > > conditional? e.g. only use a map if I'm editing a java file.
              >
              > Not just with ':map', but you could use (in a .vimrc):
              >
              > autocmd BufRead,BufNewFile *.java map x lX
              >
              > :hep autocmd

              This does not work perfectly. If you edit a Java file, you will get the
              desired mapping, but it will not go away if you switch to another (non-Java)
              buffer. There are ways around this in Vim 5.x (ask if you are interested)
              but, since everyone will soon be using Vim 6.0 ;) here is the new way to do
              it. Make a new file,

              $VIM/vimfiles/ftplugin/java.vim

              (There are other choices for the directory. :help runtimepath ) If there is
              already a $VIMRUNTIME/ftplugin/java.vim with useful settings, you may want to
              copy this as a start, or :source it from your own. This file will be :sourced
              each time you open a Java file. Add a line like

              :map <buffer> x lX

              to this file. This will define a mapping that goes away when you edit another
              buffer.

              :help plugin
              :help :map-local

              > > 3) If I have my window split, how can I switch between my open buffers
              > > without using the mouse?
              >
              > If you have a window on the top, and you are on the bottom window, use
              > '^Wk' to get to the top window
              >
              > :help CTRL-W

              I usually use <C-W>w . YMMV.

              > > 4) Is there a way to go the next buffer? I know how to use :b4 to go to
              > > buffer 4. But what if I don't know the buffer number?
              >
              > Have you tried using: >
              >
              > :buffers
              >
              > :help :buffers

              Another response on this thread suggested CTRL-Tab. This does not work
              for me, but <C-^> switches to the alternate file. I think what you really
              want is :bn .

              :help ctrl-^
              :help :bn

              > > 5) I set sw=2 and ts=2. If I'm on a newline and hit <TAB>, I get the right
              > > indentation of 2 spaces. However, if I do this when I'm in the middle of a
              > > line, for some reason, my tabstop reverts to 8 spaces. What am I doing
              > > wrong? I also set smarttab, autoindent, and smartindent.
              >
              > I don't see this, can you give a reproducable example starting with 'vim
              > -u NONE'?

              Perhaps you have 'sts' set to 8? Maybe a modeline is getting in the
              way? Use

              :set ts? sts? sw?

              to make sure that these options are really set the way you think.

              :help modeline
              :help 'sts'

              HTH --Benji Fisher
            • Ibraheem Umaru-Mohammed
              [Benji Fisher wrote...] [...] -| This does not work perfectly. If you edit a Java file, you will get the -| desired mapping, but it will not go away if
              Message 6 of 6 , Aug 3, 2001
              • 0 Attachment
                [Benji Fisher wrote...]
                [...]
                -| This does not work perfectly. If you edit a Java file, you will get the
                -| desired mapping, but it will not go away if you switch to another (non-Java)
                -| buffer. There are ways around this in Vim 5.x (ask if you are interested)
                -| but, since everyone will soon be using Vim 6.0 ;) here is the new way to do
                -| it. Make a new file,
                -|
                -| $VIM/vimfiles/ftplugin/java.vim
                -|
                -| (There are other choices for the directory. :help runtimepath ) If there is
                -| already a $VIMRUNTIME/ftplugin/java.vim with useful settings, you may want to
                -| copy this as a start, or :source it from your own. This file will be :sourced
                -| each time you open a Java file.
                [...]

                In addition, under vim6.0ap, you can overrule a global filetype plugin,
                by creating a file (under unix) in:

                ~/.vim/after/ftplugin/java.vim

                which would be loaded *after* the global plugin has been loaded, and the
                file then only needs to contain those settings which you wish to change.
                You therefore don't really have to copy the original or source it.

                :he ftplugin-overrule

                Kindest regards,

                --ibs.
                --
                ibraheem umaru-mohammed
                ium@...
                www.micromuse.com
                --0--
              Your message has been successfully submitted and would be delivered to recipients shortly.