Vi copying text


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Vi copying text
# 1  
Old 01-26-2011
Vi copying text

Is there a trick for copying from something like a powerpoint into vi? Every time I try to copy text from something like a powerpoint to vi my spacing gets messed up. I think it has something to do with my .vimrc file. When I renamed it was able to copy it in just fine so can someone please tell me what in my .vimrc is messing it up. Here is my .vimrc so you can take a look at it. Below it is what I am trying to copy into vi.

Code:
set nocompatible
set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
set showmatch
set vb t_vb=
set ruler
set nohls
set incsearch
set virtualedit=all
set number
set cmdheight=2
"This command uses unix mode
set ff=unix

"This command uses dos mode
"set ff=dos

Code:
#include <iostream>

int main( void )                                          
{   
   int a;
   int b;
   std::cout << "Enter two integers to compute their sum:" << std::endl;

   std::cin >> a;
   std::cin >> b;

   std::cout << "The sum of " << a << " and " << b  << " is ";
   std::cout << a + b << std::endl;

   return 0;
}

# 2  
Old 01-26-2011
You could simply remark the entries one by one and try it out, which of them is messing up your copy & paste. My guess is, that it is one of the following:

Code:
set autoindent
set smartindent
set tabstop=4
set shiftwidth=4


Last edited by zaxxon; 01-26-2011 at 06:21 AM.. Reason: typos, grammar
# 3  
Old 01-26-2011
although this is not strictly a vi solution, it is quite useful:

$ cat > new_file.c
(Now paste your code)

^D
$

it will not be subject to the same spacing issues.

HTH
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copying a text file from my Ubuntu Windows Sub System to a remote instance through SSH

*Following questions involves use of YAML, BASH, SSH and Software called Ansible* I am trying to learn how to use a Linux environment (in my case a Ubuntu Windows Sub System) to copy a text file from my files to a remote instance (in this case Amazon Web Services) by connecting via SSH. I... (8 Replies)
Discussion started by: Suhaba
8 Replies

2. Shell Programming and Scripting

Extracting and copying text from one file to another

Helooo, So I have a .fasta file (a text file with sequence data) which looks like this, with just over 3 million lines of data. >TCONS_00000001 gene=XLOC_000001 AATTGTGGTGAAATGACTTCTGTTAACGGAGACATCGATGATTGTTGTTACTATTTGTTCTCAGGATTCA... (8 Replies)
Discussion started by: 4galaxy7
8 Replies

3. Shell Programming and Scripting

Copying a file to multiple other files using a text file as input

Hello, I have a file called COMPLIST as follows that contains 4 digit numbers.0002 0003 0010 0013 0015 0016 0022 0023 0024 0025 0027 0030 0031 0032 0033 0035 0038 0041 (3 Replies)
Discussion started by: sph90457
3 Replies

4. Shell Programming and Scripting

Shell Script for copying text file to Excel Sheet

Hi, I want to write a program to copy a log file to Excel sheet. Excel sheet has four columns MethodName , Code , Description, Details and Time. I want to pick these info from text file and put it in excel sheet. here is how the text file looks - 04.17.2014 08:06:12,697... (1 Reply)
Discussion started by: hershey
1 Replies

5. Shell Programming and Scripting

Inserting text in file names while copying them.

I'm trying to find a Bourne shell script that will copy files from one directory using a wild card for the file name (*) and add some more characters in the middle of the file name as it is copied. As an example: /u01/tmp-file1.xml => /u02/tmp-file1-20130620.xml /u01/tmp-file2.xml => ... (6 Replies)
Discussion started by: Tony Keller
6 Replies

6. Shell Programming and Scripting

copying text from between a pattern and *

Hej all, I have a LS-DYNA keyword file which I want to extract the node coordinates from it to another file for processing and then returning the result coordinates to the same place, the structure of the file is like: Keyword file: 5010497 -266.6623535 -446.2596130 ... (3 Replies)
Discussion started by: Johanni
3 Replies

7. UNIX for Dummies Questions & Answers

Copying text from Windows to AIX - missing text?

Hi All, I'm hoping this is an easy question, but I'm having a weird problem trying to simply copy and paste text from MS Windows (XP) Notepad and then pasting into vi or vim in AIX. When I type "oslevel" I get "5.3.0.0". The problem is that once the text is pasted, there are sections of text... (2 Replies)
Discussion started by: PlainInverted
2 Replies

8. UNIX for Dummies Questions & Answers

Copying and Pasting columns from one text file to another

I have a tab delimited text file that I want to cut columns 3,4,5 from. Then I want to paste these columns into a space delimited text file between columns 2 and 3. I still want to keep the space delimited format in the final text file. How do I go about doing that? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies

9. Shell Programming and Scripting

Need help with searching and copying in a text file

Hi, I need help searching through a large text file. I need to find a certain string within the text, and copy each line until another string appears. The file looks like this: >scf15164843 ATTAAAGGNNNGGAATTTCCCCAA ATTACCGGCTTTAAANNNTTACCC >scf15154847 CCGGGNNNTTTAAACCCGNGNGCC... (2 Replies)
Discussion started by: repiv
2 Replies

10. UNIX for Dummies Questions & Answers

Copying Text between two unique text patterns

Dear Colleagues: I have .rtf files of a collection of newspaper articles. Each newspaper article starts with a variation of the phrase "Document * of 20" and is separated from the next article with the character string "===================" I would like to be able to take the text composing... (3 Replies)
Discussion started by: spindoctor
3 Replies
Login or Register to Ask a Question