Home Man
Search
Today's Posts
Register

If you're not sure where to post a Unix or Linux question, post it here. All unix and Linux beginners welcome in this forum!

Vim tips and tricks

Tags
beginners

Login to Reply

 
Thread Tools Search this Thread
# 8  
Old 04-28-2010
Bug How Copy upto first blank space

Hi,
I need to copy text up to first blank space in the line.
Code:
my_number=12345.6789% 1654.2345 This a sample line. 
I need to copy upto first.blank_space in this line.

Here my cursor is at m i need to copy upto first blank i.e my_number=12345.6789% to a register.similarly we go for second line here if cursor is at fthen i need first.blank_space to some other register.

Thanks
posix
# 9  
Old 05-08-2010
Shift + k is used to open the man page under the cursor. if you want to execute the command instead of opening the man page use the following functions.

"This function used to get the current cursor word and execute that command
Code:
                fu ExecuteCommand()
                let l:Command = expand("<cword>")
                execute "!" . l:Command
                endfu

"This function used to get the current cursor line and execute that command
Code:
                fu ExecuteCommandLine()
                let l:Command = getline(line("."))
                execute "!" . l:Command
                endfu

Note:
<cword> is replaced with the word under the cursor (like |star|)
<cWORD> is replaced with the WORD under the cursor (see WORD|)


---------- Post updated at 01:14 ---------- Previous update was at 01:08 ----------

Quote:
Originally Posted by posix
Hi,
I need to copy text up to first blank space in the line.
Code:
my_number=12345.6789% 1654.2345 This a sample line. 
I need to copy upto first.blank_space in this line.

Here my cursor is at m i need to copy upto first blank i.e my_number=12345.6789% to a register.similarly we go for second line here if cursor is at fthen i need first.blank_space to some other register.

Thanks
posix

use the keys : 1yW


The Following 2 Users Say Thank You to ungalnanban For This Useful Post:
Neo (05-20-2010), posix (07-29-2010)
# 10  
Old 05-29-2010
MySQL

Underline a text/line in vim
Code:
nnoremap <F5> yyp<c-v>$r-
" <F5> underline a word or line

Example:

This is for Example

if you want to underline this above line use the above code then it will be like this.

This is for Example
--------------------
# 11  
Old 07-21-2010
wq with dot

Be very careful when you quit with editing some file. I use the following ...
Code:
:wq

But ones one little dot came between ...
Code:
:.wq

Whot does it mean? It saves only the line where the cursor was at that moment.

That time I lost more than 12000 lines and about 2 hours and a half work. Only because a finger slides over a dot.
# 12  
Old 07-21-2010
Quote:
Originally Posted by frajer
Be very careful when you quit with editing some file. I use the following ...
Code:
:wq

But ones one little dot came between ...
Code:
:.wq

Whot does it mean? It saves only the line where the cursor was at that moment.

That time I lost more than 12000 lines and about 2 hours and a half work. Only because a finger slides over a dot.
Great point, but iit should only allow it if you force a write with:

Code:
:.wq!

But it's easily done, especially if saving a read-only file, where you have to use ! anyway.
# 13  
Old 07-23-2010
Hi,
I am using VIM 7.1 version on my Ubuntu 8.04 (hardy heron). I am irritated to see the auto matching cursor whenever it comes across parantheses, brackets and braces while editing. I used ':set noshowmatch', but no use. What other options are available for me?
# 14  
Old 07-23-2010
MySQL

set the following code in your .vimrc file

Code:
let g:loaded_matchparen= 1

The Following User Says Thank You to ungalnanban For This Useful Post:
royalibrahim (07-23-2010)
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Basic VI tricks cokedude UNIX for Advanced & Expert Users 3 08-05-2011 04:11 PM
Sed Tricks siba.s.nayak UNIX for Dummies Questions & Answers 3 10-20-2009 03:01 AM
Solaris tips and tricks solaris_user Post Here to Contact Site Administrators and Moderators 1 09-24-2009 01:02 PM
need couple of ksh tricks please JamesByars Shell Programming and Scripting 4 02-23-2008 02:07 PM
Set prompt, problems and tricks HybridLogic UNIX for Dummies Questions & Answers 6 09-26-2007 08:05 PM
tar tricks neked UNIX for Advanced & Expert Users 2 08-14-2006 03:14 PM


All times are GMT -4. The time now is 12:21 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password