Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Secure Shell

Reply
 
Thread Tools Display Modes
  #1  
Old 03-14-2012, 08:50 AM
dhahn dhahn is offline
Registered User
 
Join Date: Mar 2012
Posts: 2
Feature Request: Paste Special

I'm using version 6.6.3 (x64 build 412). I'd like to make a request for a "paste special" command that would convert X number of spaces to a tab in whatever text you are pasting.

Somewhere in settings, the user could specify the number of spaces that would be replaced.

Here's my use case. I'm often doing a lot of copying and pasting from one UNIX vi text file to another. When I do, it appears my tabs get converted to spaces when I paste. Something that starts...

if ($foo == 1) {
[TAB]if ($bar == 1 ) {
[TAB][TAB]print "Baz!";
[TAB]}
}

...becomes the following when copy/pasted using SecureCRT:

if ($foo == 1) {
[SPACE][SPACE][SPACE][SPACE][SPACE]if ($bar == 1 ) {
[SPACE][SPACE][SPACE][SPACE][SPACE][SPACE][SPACE][SPACE][SPACE][SPACE]print "Baz!";
[SPACE][SPACE][SPACE][SPACE][SPACE]}
}

By using a Paste Sepcial command, it would see five (in my example above) spaces, and make each of those a tab.

--drew
Reply With Quote
  #2  
Old 03-14-2012, 09:33 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi Drew,

Thanks for the suggestion. I have created a feature request in our SecureCRT enhancement database to add this capability. Should a future release of SecureCRT have the ability to convert spaces received from vi to tabs that were originally typed, we will post to this forum thread.

If you would like to be notified directly, please complete and submit the form at the following location:
Submit Feature Request
In the meantime, the following forum thread discusses using a script as a workaround:
http://forums.vandyke.com/showthread.php?t=8756
There are two scripts that should work. A more complex example is called ConvertClipboard--LF-CR--Space-Tab.vbs.ext (found in post #3), and the simplified version is called ConvertSpacesToTabsWhenCopying.vbs.txt (found in post #6).

Are you able to use the example scripts to accomplish your goal?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #3  
Old 03-14-2012, 11:27 AM
MrC MrC is offline
Registered User
 
Join Date: Mar 2004
Posts: 216
Drew, not to distract from your request to VanDyke...

Long ago, I created vi macros to allow yanking / pulling of text from one file to another. If you're interested, I'll post them for you. They work by you setting the cursor to the first line of the copy, typing "ma" (mark 'a') and moving the the cursor to the last line, and then typing "(" - this yanks the text between the 'a' mark and the current line, placing it into a temporary file.

In another vi'd file, simply place the cursor at the location, and type ')' to put the text.

This works on a single system, or of course, NFS'd file system. I still use them today, because they are simple.
Reply With Quote
  #4  
Old 03-15-2012, 07:30 AM
dhahn dhahn is offline
Registered User
 
Join Date: Mar 2012
Posts: 2
That would be great if you would post it. Thanks.

The other thing I've done, when I know it's safe, is issue a regex within vi to convert 8 spaces to a tab:

Code:
:1,19s/        /\t/g
It works, but it would be more elegant if it was built into SecureCRT.

--drew
Reply With Quote
  #5  
Old 03-15-2012, 10:09 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi Drew,

Thanks for the update. We will post to this thread if a future release of SecureCRT has the ability to convert the spaces to tabs.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #6  
Old 03-15-2012, 10:44 AM
MrC MrC is offline
Registered User
 
Join Date: Mar 2004
Posts: 216
Here's the idea in its simplest form for *nix platforms:

Code:
map ( :'a,.w!~/.vimscratch
map ) :r ~/.vimscratch
Enter it into your .exrc or .vimrc and restart vi/vim (or re-load the init file). Use by going to the first line you want copied, mark with a (keystroke: ma) move to the last line, and then hit ( to push the lines to the scratch file. Go to your new file on the same machine, move to point one line above where you want the lines to be placed, and enter ).

Re: your tabs substitution, type:

:help retab

in vim.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 05:38 AM.