You are not logged in.

#1 2005-12-24 17:36:38

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Pasting stuff into vim arranges text weirdly

When I paste things into a vim session (in a terminal), the text I'm transferring gets rearranged weirdly.

Example: the PKGBUILD for Cube. It goes from this:

# Maintainer: Eric Belanger <belanger@astro.umontreal.ca>
# Contributor: Peter Baldwin <bald_pete@hotmail.com>

pkgname=cube
pkgver=2005_08_29
pkgrel=4
pkgdesc="Open source multiplayer and singleplayer first person shooter game"
url="http://www.cubeengine.com/"
depends=('sdl_mixer' 'sdl_image')
backup=(opt/cube/autoexec.cfg opt/cube/servers.cfg)
install=cube.install
source=(http://dl.sourceforge.net/sourceforge/cube/${pkgname}_${pkgver}_unix.tar.gz 
                    cube.xpm cube.desktop cube.sh cubed.sh)
md5sums=('e77f3cf85292bf61100d2f8511a254cc' 'd8c1368a2ac729e168fe3dac7e7bd284'
         'a09afc0facfb3f048bcc4d9377af3189' 'b57c33005a88a72cb4f6d0bab0e5bb0a'
         '9fe10f48983864e0ebaa76abe9827065')

build() {
  install -d $startdir/pkg/opt
  cp -r $startdir/src/cube $startdir/pkg/opt
  cd $startdir/pkg/opt/cube

  touch servers.cfg packages/base/temp.{cfg,cgz}
  chown root:20 servers.cfg autoexec.cfg packages/base/temp.{cfg,cgz}
  chown root:20 savegames demos screenshots
  chmod 664 servers.cfg autoexec.cfg packages/base/temp.{cfg,cgz}
  chmod 775 savegames demos screenshots

  install -D -m644 $startdir/src/cube.desktop $startdir/pkg/usr/share/applications/cube.desktop
  install -D -m644 $startdir/src/cube.xpm $startdir/pkg/usr/share/pixmaps/cube.xpm
  install -D -m755 $startdir/src/cube.sh $startdir/pkg/usr/bin/cube
  install -D -m755 $startdir/src/cubed.sh $startdir/pkg/usr/bin/cubed
  install -m755 bin_unix/linux_client cube_client
  install -m755 bin_unix/linux_server cube_server
  rm -r $startdir/pkg/opt/cube/{bin_unix,cube_unix}
}

To this:

intainer: Eric Belanger <belanger@astro.umontreal.ca>
# Contributor: Peter Baldwin <bald_pete@hotmail.com>

pkgname=cube
pkgver=2005_08_29
pkgrel=4
pkgdesc="Open source multiplayer and singleplayer first person shooter game"
url="http://www.cubeengine.com/"
depends=('sdl_mixer' 'sdl_image')
backup=(opt/cube/autoexec.cfg opt/cube/servers.cfg)
install=cube.install
source=(http://dl.sourceforge.net/sourceforge/cube/${pkgname}_${pkgver}_unix.tar.gz

                    cube.xpm cube.desktop cube.sh cubed.sh)
                    md5sums=('e77f3cf85292bf61100d2f8511a254cc'
                    'd8c1368a2ac729e168fe3dac7e7bd284'
                             'a09afc0facfb3f048bcc4d9377af3189'
                             'b57c33005a88a72cb4f6d0bab0e5bb0a'
                                      '9fe10f48983864e0ebaa76abe9827065')

                                      build() {
                                           install -d $startdir/pkg/opt
                                             cp -r $startdir/src/cube
                                             $startdir/pkg/opt
                                               cd $startdir/pkg/opt/cube

                                                 touch servers.cfg
                                                 packages/base/temp.{cfg,cgz}
                                                   chown root:20 servers.cfg
                                                   autoexec.cfg
                                                   packages/base/temp.{cfg,cgz}
                                                     chown root:20 savegames
                                                     demos screenshots
                                                       chmod 664 servers.cfg
                                                       autoexec.cfg
                                                       packages/base/temp.{cfg,cgz}
                                                         chmod 775 savegames
                                                         demos screenshots

                                                           install -D -m644
                                                           $startdir/src/cube.desktop
                                                           $startdir/pkg/usr/share/applications/cube.desktop
                                                             install -D -m644
                                                             $startdir/src/cube.xpm
                                                             $startdir/pkg/usr/share/pixmaps/cube.xpm
                                                               install -D
                                                               -m755
                                                               $startdir/src/cube.sh
                                                               $startdir/pkg/usr/bin/cube
                                                                 install -D
                                                                 -m755
                                                                 $startdir/src/cubed.sh
                                                                 $startdir/pkg/usr/bin/cubed
                                                                   install
                                                                   -m755
                                                                   bin_unix/linux_client
                                                                   cube_client
                                                                     install
                                                                     -m755
                                                                     bin_unix/linux_server
                                                                     cube_server
                                                                       rm -r
                                                                       $startdir/pkg/opt/cube/{bin_unix,cube_unix}
                                                                    }

WTF is going on?

Offline

#2 2005-12-24 17:55:21

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,751

Re: Pasting stuff into vim arranges text weirdly

cat prog | sed -e 's/^ * //' > prog2

Mr Green

Offline

#3 2005-12-24 20:20:00

paranoos
Member
From: thornhill.on.ca
Registered: 2004-07-22
Posts: 442

Re: Pasting stuff into vim arranges text weirdly

it's because vim automatically tabs stuff out for you.
this is what the paste option is for.

:set paste

and when you're done, turn it off.

:set nopaste

Offline

#4 2005-12-24 20:24:28

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: Pasting stuff into vim arranges text weirdly

Thanks!

(I assume that turning off autoindent would also solve the problem?)

Offline

#5 2005-12-25 11:18:00

gunnix
Member
Registered: 2005-11-11
Posts: 102
Website

Re: Pasting stuff into vim arranges text weirdly

Nice! I also had problems with this smile


As is true for most people I know, I've always loved learning. As is also true for most people I know, I always hated school. Why is that?

Offline

#6 2005-12-25 11:23:24

shbang
Member
Registered: 2005-10-03
Posts: 76

Re: Pasting stuff into vim arranges text weirdly

Thanks paranoos.  I have been switching to gvim for cut and paste when I have this issue.

Who says you can't teach an old dog new tricks.

Offline

#7 2005-12-25 11:33:30

T-Dawg
Forum Fellow
From: Wilmington, NC
Registered: 2005-01-29
Posts: 2,734

Re: Pasting stuff into vim arranges text weirdly

Am I the only who feels silly for not knowing this?

Offline

#8 2005-12-25 12:42:17

postlogic
Member
Registered: 2005-02-24
Posts: 410
Website

Re: Pasting stuff into vim arranges text weirdly

nano has the same problem, with you set auto indenting on.

Offline

#9 2005-12-26 06:33:36

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Pasting stuff into vim arranges text weirdly

paranoos wrote:

it's because vim automatically tabs stuff out for you.
this is what the paste option is for.

:set paste

and when you're done, turn it off.

:set nopaste

Just to expand - you can also do:

:set paste!

to toggle the setting (which makes this key bindable).

However, vim-devel in [unstable] supports

set pastetoggle=<F2>

which will allow F2 to toggle the paste mode in any mode (normal, insert, visual, select, etc)

Offline

#10 2005-12-26 06:50:15

Moo-Crumpus
Member
From: Hessen / Germany
Registered: 2003-12-01
Posts: 1,444

Re: Pasting stuff into vim arranges text weirdly

this is why i hate all the vims so much ...


Frumpus addict
[mu'.krum.pus], [frum.pus]

Offline

#11 2005-12-27 10:52:26

postlogic
Member
Registered: 2005-02-24
Posts: 410
Website

Re: Pasting stuff into vim arranges text weirdly

IMHO, it would be nice for all tips like these to be added to some kind of tips & tricks section in the Wiki. Not directly related to Arch, but it's always nice to have a page with stuff like this.

Offline

#12 2005-12-27 16:12:07

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Pasting stuff into vim arranges text weirdly

Problem with that is there's *so much* vim information out there, that it's hard to keep track of them all.  But still, it'd be nice to have common things in the wiki.

Offline

#13 2005-12-28 01:56:23

codemac
Member
From: Cliche Tech Place
Registered: 2005-05-13
Posts: 784
Website

Re: Pasting stuff into vim arranges text weirdly

How about we have a vim page in the wiki, with links to vim wikis :-D

Offline

#14 2005-12-28 07:40:51

postlogic
Member
Registered: 2005-02-24
Posts: 410
Website

Re: Pasting stuff into vim arranges text weirdly

I didn't mean a specific vim-wiki (although a few, nice vimrc's is always good),  but a tips & tricks section. Maybe with a vim-article? Just a suggestion.

Offline

#15 2005-12-28 18:53:00

Komodo
Member
From: Oxford, UK
Registered: 2005-11-03
Posts: 674

Re: Pasting stuff into vim arranges text weirdly

I think that'd be a great idea, since everyone tries vim at some point.

Personally I think phrakture would be the best person to write it, but I understand if he's too busy now he's a dev tongue


.oO Komodo Dave Oo.

Offline

#16 2005-12-29 08:26:35

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: Pasting stuff into vim arranges text weirdly

And theres so many things that everyone asks at one stage or another.

I'll try starting one now

iphitus

Offline

Board footer

Powered by FluxBB