Showing posts with label vim. Show all posts
Showing posts with label vim. Show all posts

Sunday, February 3, 2013

After installing installing "oh-my-zsh', I could not start vim.



Problem :
After installing installing "oh-my-zsh', I could not start vim.

Solution:

export PATH=/usr/local/bin:/usr/local/sbin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr
Ref:
http://stackoverflow.com/questions/10995722/messed-up-my-path-in-zsh

Wednesday, January 16, 2013

Vim Using elinks with netrw


Tip: Using elinks with netrw


The Vim Netrw plugin allows one to view the contents of an http hyperlink via CTRL-W_CTRL-F. Netrw checks the user's system (in this order) for curl, wget, and fetch. Text browsers such as elinks and links are better alternatives to HTTP clients like curl because they have a -dump option which strips out the HTML tags and formats tables for improved ASCII viewing. Getting these text-based web browsers working with Netrw requires a simple wrapper script to format the arguments in the order that Netrw provides them:

$ agent tempfile url

Here is a sample wrapper script for elinks (in a file named elinks-for-vim).

#!/bin/sh
tempfile=`echo $* | awk '{print $1}'`
url=`echo $* | awk '{print $2}'`
elinks -dump $url > $tempfile
Then, add this line to your vimrc:

let g:netrw_http_cmd = "elinks-for-vim"

Reference:

created July 25, 2008 · complexity basic · author Emallove · version 7.0


Monday, January 14, 2013

Vim tips: Moving around using marks and jumps



Editing in Vim can be a breeze, if you know how to make use of its more advanced features. Moving around files can feel like a slog if you're stuck with the basic movement keys, but editing is effortless when you have command of marks and jumps.
Basically, a mark is a bookmark or placeholder that allows you to return to a spot in the file where you were editing. This can be handy when you're working on longer projects, whether you're writing a long paper, making changes to your Apache configuration, or writing code.

Jumps are movements within a file. For example, when you use G to move to the last line of a file from your current position, that's a jump. Vim not only makes it easy to move from one point in the file to another, it also makes it easy to retrace your steps.



Vim mark quick reference
mx tells Vim to add a mark called x.
`x tells Vim to return to the line and column for mark x.
'x tells Vim to return to the beginning of the line where mark x is set.
`. moves the cursor to the line and column where the last edit was made.
'. moves the cursor to the line where the last edit was made.
'" moves the cursor to the last position of the cursor when you exited the previous session.
:marks shows all marks set.
:marks x shows the mark named x.
:jumps shows the jumplist.
Ctrl-o moves the cursor to the last jump.
Ctrl-i moves the cursor to the previous jump.
H moves the cursor to the top of the screen or viewport.
M moves the cursor to the middle of the screen or viewport.
L moves the cursor to the bottom of the screen or viewport.









Reference :

By Joe 'Zonker' Brockmeier



Sunday, January 13, 2013

Vim remap the Caps Lock key in one of two ways


Remapping the escape key

The first thing you need to do to make using
Remap Vim to the Caps Lock key to be a Ctrl key.

This serves two purpose:

It makes it much easier to invoke CTRL commands in vim, the shell, and all your applications.

More significant is that CTRL-[ is equivalent to hitting the Esc key.

You can remap the Caps Lock key in one of two ways:

1- Using a directive in /etc/X11/xorg.conf:
In your Section "InputDevice" section for the keyboard, add the line:

Option "XkbOptions" "ctrl:nocaps"
         
2- Using an xmodmap :

Create a file in your home directory called " .Xmodmap" with the following contents:

remove Lock = Caps_Lock
remove Control = Control_L
keysym Caps_Lock = Control_L
add Control = Control_L

Refrence :
Kevin's Vim Tips and Tricks at :
http://www.8t8.us/vim/vim.html