View Full Version : What do i need to do to get VIM started easily each time
meshsmooth
12-20-2005, 10:59 PM
I went to http://www.bleb.org/software/770/#vim and installed vim then i run the long command
LD_LIBRARY_PATH=/var/lib/install/usr/lib /var/lib/install/usr/bin/vim to start it. But how do I just run a short comand like $ vim to get it started?
Usage
As the default PATH does not include /var/lib/install/usr/bin (the Application Installer installs packages under /var/lib/install), the command to start vim is:
LD_LIBRARY_PATH=/var/lib/install/usr/lib /var/lib/install/usr/bin/vim
This can be improved by adding PATH and LD_LIBRARY_PATH exports to /home/user/.profile and then typing sh --login after starting the X Terminal.
I have installed VIM i can run the long command
The .profiles file dose not exist, do i create it? How do i format this .profiles file
Help on this will make editing much easier.
gnuite
12-21-2005, 12:04 AM
If you have root access, it's easier to edit /etc/profile, since that affects all users. Otherwise, use that file as an example for creating ~/.profile.
gnuite
meshsmooth
12-21-2005, 12:28 AM
OK i have worked it out!
cd to the directory /bin
start vi with the long comand $ LD_LIBRARY_PATH=/var/lib/install/usr/lib /var/lib/install/usr/bin/vim
paste that command into vi
then save the file as “vim” by hitting escape and then :w vim
exit out of vim :q
then make that file executable $ chmod a+x vim
$ cd /bin
$ LD_LIBRARY_PATH=/var/lib/install/usr/lib /var/lib/install/usr/bin/vim
paste that command into vi
esc
:w vim
:q
$ chmod a+x vim
then you can start vim just by typing vim
if there is a less confusing way of explaining that go rite ahead and suggest it.
TGKnIght
12-21-2005, 01:34 AM
i like your idea of writing a script... I'm admittedly a nix noob, but another script i found useful to write was auto move all .desktop files from the extras dir to the main location
Neil McAllister
12-21-2005, 01:45 AM
Hey, speaking of VIM... I got it installed, but I couldn't get the carriage return to work. Instead, it inserted a capital "M" and maybe a couple of other garbage characters. I couldn't find a way to remap it with stty. It made it pretty hard to edit any files longer than one line. :confused: Anyone have better luck? I installed vim using the gainroot method.
aflegg
12-21-2005, 05:30 AM
Hi,
In terms of the 'vi' script in /bin, it'd be better if it read:
#!/bin/sh
LD_LIBRARY_PATH=/var/lib/install/usr/lib:$LD_LIBRARY_PATH exec /var/lib/install/usr/bin/vim "$@"
This'll ensure you can type vi foo.html and edit the foo.html file.
As for the problem with pressing enter, this only happens in insert mode, but is a pain. I've seen it on desktop systems as well, but haven't yet worked out how to fix it. Something TERM related, probably.
Cheers,
Andrew
meshsmooth
12-21-2005, 07:41 AM
I have installed bash but cant find where it intalled to and how to get it started. Will I need to run Xterm to start bash? also is there an equivelent file to the .bashrc file? for xterm?
By the way, Xterm is a memory hog for such a low level app what is with that?
anybody concidering the uses of rSync?
andymulhearn
12-21-2005, 09:19 AM
OK i have worked it out!
cd to the directory /bin
start vi with the long comand $ LD_LIBRARY_PATH=/var/lib/install/usr/lib /var/lib/install/usr/bin/vim
paste that command into vi
then save the file as “vim” by hitting escape and then :w vim
exit out of vim :q
then make that file executable $ chmod a+x vim
then you can start vim just by typing vim
if there is a less confusing way of explaining that go rite ahead and suggest it.
Do you also need to add /home/user to your path? That way, wherever you are, typing vim executes that script.
meshsmooth
12-21-2005, 09:34 AM
my way requires root acess and i would recomend using aflegg's code to be inserted instaid.
Get root acess then copy all this text in one go and paste it into Xterm and it will do half of the steps
cd /bin/
LD_LIBRARY_PATH=/var/lib/install/usr/lib /var/lib/install/usr/bin/vim
i#!/bin/sh
LD_LIBRARY_PATH=/var/lib/install/usr/lib:$LD_LIBRARY_PATH exec /var/lib/install/usr/bin/vim "$@"
now your in VIM so now hit the escape key on your nokia 770 and type or paste the text:w vim
:qand your done
I dont know if what i have done is "the way to do it" but it works everywere. If some Linux guru will come along and tell us how to do it, and in an idiot proof kind of way, well good do it there way. But untill then us linux stumblers have this way to do it.
That is what i am a "Linux Stumbler" :o
Dusty
12-21-2005, 11:29 AM
No root access is needed. Save this:
export PATH=$PATH:/var/lib/install/usr/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/var/lib/install/usr/lib
as "~/.profile".
MAKE SURE YOU GET THE TOP LINE RIGHT OR YOU WILL HAVE TO REFLASH YOUR 770. (Don't screw up your PATH.)
Then reboot the 770, and any programs you install are in the PATH, including vim. Much better approach, because you don't have to write a script for every program you want to use.
aflegg
12-21-2005, 12:12 PM
The problem with using .profile is that XTerm doesn't start login shells, and osso-af-init resets the path at desktop startup (IIRC).
Setting your .profile and then typing sh --login after starting XTerm fixes this.
Dusty
12-21-2005, 02:22 PM
It works fine. I use it on my 770. You just have to reboot for the .profile to take effect. I can start an xterm, type 'vim', and there it is.
aflegg
12-21-2005, 05:18 PM
It works fine. I use it on my 770. You just have to reboot for the .profile to take effect. I can start an xterm, type 'vim', and there it is.
Odd. What OS version have you got?
MikeB
12-21-2005, 06:50 PM
It works fine. I use it on my 770. You just have to reboot for the .profile to take effect. I can start an xterm, type 'vim', and there it is.
Thanks for mentioning this! I had been using the 'sh --login' method to use /home/user/.profile. I did not realized that this would work after a reboot. It now finds vim in my path...
Unfortunately, my aliases are not available unless I use the 'sh --login' method. Is there something I need to do differently to make these available? Example:
alias ll='ls -l'
msaunby
12-29-2005, 01:21 PM
I've created an entry in the wiki on using xterm that tries to cover what needs to be done to change the .profile. As you'll see in my examples I favour keeping things simple.
msaunby
12-29-2005, 01:43 PM
Hey, speaking of VIM... I got it installed, but I couldn't get the carriage return to work. Instead, it inserted a capital "M" and maybe a couple of other garbage characters. I couldn't find a way to remap it with stty. It made it pretty hard to edit any files longer than one line. :confused: Anyone have better luck? I installed vim using the gainroot method.
It's probably just a bad habit many of us have picked up. Use o rather than i and you won't have this problem.
Maybe someone could add this to the wiki, perhaps with a link to a vi/vim cheat sheet - there are loads out there.
aflegg
12-29-2005, 01:47 PM
I've updated the wiki and the vim port page (http://www.bleb.org/software/770/#vim) with the "proper" vim-level fix for the cursor keys/enter problem:
Put the following in /home/user/.vimrc:
set nocompatible
That removes some of vim's backwards-compatibility with the original vi which is causing the problem.
HTH,
Andrew
msaunby
12-30-2005, 04:50 PM
I've put it in .vimrc and it did the trick.
dillera
01-02-2006, 02:34 AM
Yet another method:
ssh into your 770 and cut and paste these lines to permanently modify your .profile:
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/var/lib/install/usr/lib' >> /home/user/.profile
echo 'export PATH=$PATH:/var/lib/install/usr/bin:/var/lib/install/usr/sbin' >> /home/user/.profile
echo 'set nocompatible' >> /home/user/.vimrc
Simon
01-02-2006, 03:41 AM
Maybe this is a stupid question but I managed to get Vim working whenever I run Xterminal. That's all good but if I then use sudo gainroot to get root access it no longer works. Where do I need to add those variables so Vim still works? Yes, I am a Linux newbie :)
fresta
01-02-2006, 03:55 AM
It works fine. I use it on my 770. You just have to reboot for the .profile to take effect. I can start an xterm, type 'vim', and there it is.
Not for me, the path is reset to the default (/usr/bin:/bin) after reboot. I'm using the Swedish version of the latest flash image, Nokia_770_SE2005_3_2005_51-13. It's a bit annoying having to type 'sh --logiun' or '. /home/user/.profile' at each login.
fresta
01-02-2006, 04:02 AM
Maybe this is a stupid question but I managed to get Vim working whenever I run Xterminal. That's all good but if I then use sudo gainroot to get root access it no longer works. Where do I need to add those variables so Vim still works? Yes, I am a Linux newbie :)
Place similar .profile and .vimrc files in /root.
Simon
01-02-2006, 05:39 AM
Hmmm, that didn't work for me. It doesn't seem to use that profile since when I echo the path after running sudo gainroot I don't see it? I know I must be missing something obvious.
aflegg
01-02-2006, 05:59 AM
When you run 'sudo gainroot', you don't get a login shell for root.
See http://www.dillernet.com/apple/2006/01/01/what-happened-in-51/ - scroll down to Gainroot and Root
HTH,
Andrew
Simon
01-02-2006, 06:33 AM
Yes, that got it. I don't quite know what it all means but it certainly worked once I used the su - command. Thanks!
fresta
01-02-2006, 07:39 AM
Sorry, I forgot to mention that I have changed the call "/bin/sh" to "/bin/sh --login" in /usr/sbin/gainroot.
(Don't make any mistakes when editing that script, if you wreck it the only way to regain root access is re-flashing.)
jayholler
03-17-2006, 04:38 PM
Sorry, I forgot to mention that I have changed the call "/bin/sh" to "/bin/sh --login" in /usr/sbin/gainroot.
(Don't make any mistakes when editing that script, if you wreck it the only way to regain root access is re-flashing.)
i tried that, and it didn't work. so then i thought i was misreading it, and i tried "/bin/sh -login" and now I can't use gainroot. I'll have to reflash, like you said. Fortunately I'm using extrootfs so my changes will be reflected after I run the script again. But why didn't editing "/bin/sh" to "/bin/sh --login" work?
update, i reflashed and got my system set up again. i decided instead to put
'ALL = NOPASSWD: /bin/sh' so i can now just 'su -' to get a 'true' root shell. cool. i'm still curious to know why the line '/bin/sh --login' didn't work in the gainroot script.
fresta
03-19-2006, 04:17 PM
Yes, that is a better method than editing the gainroot script. I do that instead now. I do not know why '/bin/sh --login' didn't work for you though.
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.