Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Simple vim questions

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
19 posts • Page 1 of 1
Author
Message
iarwain
Apprentice
Apprentice
User avatar
Posts: 253
Joined: Thu Sep 25, 2003 12:39 pm

Simple vim questions

  • Quote

Post by iarwain » Fri Aug 18, 2006 9:21 am

Hi, I have 2 questions about vim:

1) I have line numbers enabled. If I want to copy a piece of code and paste it in another place, the line numbers are also copied. I mean, I can't select the text without the line numbers.

2) If I am at the beginning of a line and I press left-arrow button, it does nothing. it remains at the beginning of the same line. I'd like it to go to the end of the previous line.

Can you help me?
Top
sfragis
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 95
Joined: Thu Mar 24, 2005 5:28 pm
Location: RE < IT < Europe
Contact:
Contact sfragis
Website

Re: Simple vim questions

  • Quote

Post by sfragis » Fri Aug 18, 2006 9:46 am

iarwain wrote:1) I have line numbers enabled. If I want to copy a piece of code and paste it in another place, the line numbers are also copied. I mean, I can't select the text without the line numbers.
Line numbers are no copied with Gvim (Kvim); of course if you're using bare vim in console or terminal... you have no chance at all.
To enable line numbers for Gvim only, paste "set number" in ~/.gvimrc.
2) If I am at the beginning of a line and I press left-arrow button, it does nothing. it remains at the beginning of the same line. I'd like it to go to the end of the previous line.
Paste this in your ~/.vimrc:

Code: Select all

set   ww=b,s,<,>,[,],~
Regards
Fabio Strozzi
Top
iarwain
Apprentice
Apprentice
User avatar
Posts: 253
Joined: Thu Sep 25, 2003 12:39 pm

Re: Simple vim questions

  • Quote

Post by iarwain » Fri Aug 18, 2006 9:55 am

sfragis wrote: Line numbers are no copied with Gvim (Kvim); of course if you're using bare vim in console or terminal... you have no chance at all.
To enable line numbers for Gvim only, paste "set number" in ~/.gvimrc.
OK, I'll be switch to gvim.
sfragis wrote: Paste this in your ~/.vimrc:

Code: Select all

set   ww=b,s,<,>,[,],~
That did the trick.

Thanks dude!
Top
iarwain
Apprentice
Apprentice
User avatar
Posts: 253
Joined: Thu Sep 25, 2003 12:39 pm

  • Quote

Post by iarwain » Fri Aug 18, 2006 9:49 pm

Just another question... how can I show fileformat:encoding:filetype|filesize info in commandline? Cream (based on vim) does it, like this. But I couldn't find the piece of code.
Top
sfragis
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 95
Joined: Thu Mar 24, 2005 5:28 pm
Location: RE < IT < Europe
Contact:
Contact sfragis
Website

  • Quote

Post by sfragis » Tue Aug 22, 2006 7:43 am

You have to customize the statusline variable, type "<ESC>:help statusline" (w/o doublequotes) from within vim to get the relative help page, there's plenty of options :D . Also a "grep statusline" among Cream's sources may be helpful.
Regards
Fabio Strozzi
Top
aidy
l33t
l33t
Posts: 915
Joined: Thu Apr 07, 2005 8:46 am

  • Quote

Post by aidy » Tue Aug 22, 2006 12:05 pm

...
selecting lines without numbers works fine here in vim

I have another problem though, I can't copy paste from vim to other applications.
Top
iarwain
Apprentice
Apprentice
User avatar
Posts: 253
Joined: Thu Sep 25, 2003 12:39 pm

  • Quote

Post by iarwain » Tue Aug 22, 2006 2:27 pm

Aidy wrote:...
selecting lines without numbers works fine here in vim

I have another problem though, I can't copy paste from vim to other applications.
Are you sure it's vim and not gvim?
sfragis wrote: You have to customize the statusline variable, type "<ESC>:help statusline" (w/o doublequotes) from within vim to get the relative help page, there's plenty of options :D . Also a "grep statusline" among Cream's sources may be helpful.
Thank you for the hint, it worked.

EDIT: BBCode syntax correction
Last edited by iarwain on Tue Aug 22, 2006 2:58 pm, edited 1 time in total.
Top
transienteagle
Apprentice
Apprentice
User avatar
Posts: 190
Joined: Wed Dec 24, 2003 10:44 am
Location: UK

  • Quote

Post by transienteagle » Tue Aug 22, 2006 2:46 pm

Aidy,


I actually use the microsoft Ctrl C / V et al bindings by including the following in vimrc.local which makes it more intuitive

Code: Select all

source $VIMRUNTIME/mswin.vim 
Using these bindings makes it possible to cut and paste into other applications like openoffice etc in a consistant manner.

rgds

TE
Top
aidy
l33t
l33t
Posts: 915
Joined: Thu Apr 07, 2005 8:46 am

  • Quote

Post by aidy » Tue Aug 22, 2006 2:48 pm

iarwain wrote:
Aidy wrote:...
selecting lines without numbers works fine here in vim

I have another problem though, I can't copy paste from vim to other applications.
Are you sure it's vim and not gvim?
sfragis wrote: You have to customize the statusline variable, type "<ESC>:help statusline" (w/o doublequotes) from within vim to get the relative help page, there's plenty of options :D . Also a "grep statusline" among Cream's sources may be helpful.
Thank you for the hint, it worked.
OF COURSE I'M SURE

http://www.animewine.com/aidy/images/Sc ... 6-busy.png

does this look like gvim?
Top
aidy
l33t
l33t
Posts: 915
Joined: Thu Apr 07, 2005 8:46 am

  • Quote

Post by aidy » Tue Aug 22, 2006 2:51 pm

nah, I hate pressing ctrl-c
middle click is the rawkage

It worked on the vim version included in dapper, but the ones in edgy and gentoo (~amd64) don't work with select and middle click, I can't even select copy from the gnome-terminal right click menu. Same in xterm.
Top
iarwain
Apprentice
Apprentice
User avatar
Posts: 253
Joined: Thu Sep 25, 2003 12:39 pm

  • Quote

Post by iarwain » Tue Aug 22, 2006 2:57 pm

Sorry for the question, I just wanted to be sure. Could you post the relevant .vimrc snippet please?
Top
transienteagle
Apprentice
Apprentice
User avatar
Posts: 190
Joined: Wed Dec 24, 2003 10:44 am
Location: UK

  • Quote

Post by transienteagle » Tue Aug 22, 2006 3:02 pm

Aidy,
nah, I hate pressing ctrl-c
middle click is the rawkage
LOL

You are more purist that I am methinks

I tend to use vim (gvim) for just about everything nowadays and just cut and paste to openoffice for the final tarting up.

rgds

TE
Top
aidy
l33t
l33t
Posts: 915
Joined: Thu Apr 07, 2005 8:46 am

  • Quote

Post by aidy » Tue Aug 22, 2006 3:03 pm

iarwain wrote:Sorry for the question, I just wanted to be sure. Could you post the relevant .vimrc snippet please?

Code: Select all

adriaan@mellotron ~ $ cat ~/.vimrc
:syntax enable
:set number
:set ruler
:set mouse:a
:set scrolloff=3
:set smartindent
Top
iarwain
Apprentice
Apprentice
User avatar
Posts: 253
Joined: Thu Sep 25, 2003 12:39 pm

  • Quote

Post by iarwain » Tue Aug 22, 2006 3:06 pm

Thank you, ":set mouse:a" was the key :)
Top
ciaranm
Retired Dev
Retired Dev
User avatar
Posts: 1719
Joined: Sat Jul 19, 2003 11:04 pm
Location: In Hiding
Contact:
Contact ciaranm
Website

  • Quote

Post by ciaranm » Tue Aug 22, 2006 3:11 pm

Uh, instead of using that mswin.vim crap, you could just learn to use vim properly... "+y to copy to the X clipboard. This only works if vim was built against X libraries.
Paludis 0.12, 127.35% Portage compatible and six times faster.
Top
transienteagle
Apprentice
Apprentice
User avatar
Posts: 190
Joined: Wed Dec 24, 2003 10:44 am
Location: UK

  • Quote

Post by transienteagle » Tue Aug 22, 2006 3:29 pm

ciaranm,
Uh, instead of using that mswin.vim crap, you could just learn to use vim properly... "+y to copy to the X clipboard
Ha! lol

Its very good to know that you are still around and banging the drum for vim, which, incidentally, I still think is best suited for hairy chested C programming types rather than us svelte ruby types.

Wish you well

rgds

TE

ps using "+y and ggVG et al makes me feel like I'am playing a computer game. A simple crtl c / v/ a is where its at. lol
Top
ciaranm
Retired Dev
Retired Dev
User avatar
Posts: 1719
Joined: Sat Jul 19, 2003 11:04 pm
Location: In Hiding
Contact:
Contact ciaranm
Website

  • Quote

Post by ciaranm » Tue Aug 22, 2006 3:34 pm

transienteagle wrote:Its very good to know that you are still around and banging the drum for vim, which, incidentally, I still think is best suited for hairy chested C programming types rather than us svelte ruby types.
Pfff. Vim 7 has context-aware code completion for Ruby.
Paludis 0.12, 127.35% Portage compatible and six times faster.
Top
transienteagle
Apprentice
Apprentice
User avatar
Posts: 190
Joined: Wed Dec 24, 2003 10:44 am
Location: UK

  • Quote

Post by transienteagle » Tue Aug 22, 2006 3:51 pm

ciaranm,
Pfff. Vim 7 has context-aware code completion for Ruby.
Just upgraded a couple of days ago to 7 and have just tried out the code completion following your comment above ........Its neat......to say the least.

Don't you think its slightly ironic that ctrl x & o do the job considering the conversation above.

rgds

TE
Top
aidy
l33t
l33t
Posts: 915
Joined: Thu Apr 07, 2005 8:46 am

  • Quote

Post by aidy » Wed Aug 23, 2006 12:17 am

right so now I compiled with X support, and pasting works now, but I can't resize the buffer windows anymore :/

edit:
oh and it selects line numbers
Top
Post Reply

19 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic