vi calling template


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers vi calling template
# 1  
vi calling template

Hello.
I want to copy temp files when I make a new file by vi.
For example,
Code:
09:32:52 ~/ $ mkdir test
09:33:03 ~/ $ cd test/
09:33:09 ~/test/ $ ls
09:33:16 ~/test/ $ vi test.cpp
09:34:37 ~/test/ $ cat test.cpp
#include <iostream>
int main()
{

}
09:34:48 ~/test/ $ vi test.bash
09:35:19 ~/test/ $ cat test.bash
#!/bin/bash

09:35:23 ~/test/ $ vi test.pl
09:35:45 ~/test/ $ cat test.pl
#!/usr/bin/perl

exit;
09:35:50 ~/test/ $

when I make "test.cpp",
I want to do
Code:
cp $HOME/.cpp.tmp ./test.cpp

and open test.cpp by vi.
.cpp.tmp is a template file and It contains
Code:
#include <iostream>
int main()
{

}

Of course I can do this by bash script.
But can I do this by writing something in .vimrc ??
# 2  
It would be easier to put a function in you .bashrc to do this.
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #64
Difficulty: Easy
HTTP uses UDP as the core transport protocol on the Internet.
True or False?

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert values into template

I have 2 files. Template file: SELECT NAME = "" DEATILS Input file: SERVER1 06/05/2016 10:00:00 06/05/2016 05:08:59 SERVER2 06/04/2016 09:50:00 06/05/2016 01:03:59 SERVER3 06/06/2016 11:26:00 06/06/2016 10:31:55 I want to generate the output file that look like this: ... (6 Replies)
Discussion started by: vinus
6 Replies

2. Programming

Calling template at once

Hello Again, I am just wanted to know if we can call the Template using "require_once" at PHP? Any views around happy to discuss. Thanks in Advance (2 Replies)
Discussion started by: AimyThomas
2 Replies

3. Programming

C++ template error

I get some compiling errors about template instantiation :wall: , but I can't find where the syntax errors happens. Can some help me? template<typename Type> class SingleList; template<typename Type> class SingleListNode{ private: friend class SingleList<Type>; SingleListNode() :... (1 Reply)
Discussion started by: 915086731
1 Replies

4. Shell Programming and Scripting

Help with template like solution

hi experts, i'm trying to do this: file1 is a template. might have kinds of 'funny' characters. sample: <body> <form> <p><input type="text" name="abc"/></p> &nbsp; <p><my_content></p> </form> </body> file2 is a file that contains lots of text. this might be very big. might have... (2 Replies)
Discussion started by: xjohnu
2 Replies

5. Programming

Template problem ...

Hi all, Need your help. I am doing a simple template program , getting some error ... here is the code #include <iostream> #include <stdio.h> #include <stdlib.h> #include<iostream> #include<string> #include <sstream> using namespace std; class Base_class { public: Base_class(){... (1 Reply)
Discussion started by: amartya_sock
1 Replies

6. Programming

About template constraints

Hi, i have class template, 1)can i override the copy constructor 2)can we have virtual function in class template if not plz tel why? I tried , compile error comes for me... Thanks Sarwan (0 Replies)
Discussion started by: sarwan
0 Replies

Featured Tech Videos