LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-15-2012, 08:59 PM   #1
Samcro
LQ Newbie
 
Registered: Sep 2010
Posts: 7

Rep: Reputation: 0
Exclamation Editing Files with "vim"


Ok so when ever I open files with "vim" or "vi" I end up with a copy of the file with a ~ at the end of it.

For example

I open

vim /etc/hosts.allow

I then receive a "hosts.allow~" file

Is there any reason why this is happens? It happens on all files.
 
Old 05-15-2012, 09:10 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,342
Blog Entries: 28

Rep: Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145Reputation: 6145
That is a backup of the original file before that editing session.
 
Old 05-15-2012, 09:12 PM   #3
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196
You can disable that feature by editing your ~/.vimrc file and adding these lines:

Code:
set nobackup
set nowritebackup
set noswapfile
I should add that this can make recovery after a system crash more difficult.

You should see the vim docs for the full meaning of each.

Last edited by astrogeek; 05-15-2012 at 09:14 PM.
 
Old 05-15-2012, 09:13 PM   #4
me@asafonov.org
LQ Newbie
 
Registered: Jan 2011
Location: Russia
Distribution: Slackware, Fedora
Posts: 19

Rep: Reputation: 1
Editing Files with "vim"

These files are simple backups. You may set the backup off by the adding these lines to your ~/.vimrc file

Code:
set nobackup
set nowritebackup
It has nothing to do with Slackware

Good day

Last edited by me@asafonov.org; 05-15-2012 at 09:50 PM.
 
Old 05-15-2012, 09:45 PM   #5
Samcro
LQ Newbie
 
Registered: Sep 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by astrogeek View Post
You can disable that feature by editing your ~/.vimrc file and adding these lines:

Code:
set nobackup
set nowritebackup
set noswapfile
I should add that this can make recovery after a system crash more difficult.

You should see the vim docs for the full meaning of each.

Where is that file located I can't find it.....
 
Old 05-15-2012, 09:48 PM   #6
me@asafonov.org
LQ Newbie
 
Registered: Jan 2011
Location: Russia
Distribution: Slackware, Fedora
Posts: 19

Rep: Reputation: 1
Quote:
Originally Posted by Samcro View Post
Where is that file located I can't find it.....
It's in your home directory. If not, just create it.
 
Old 05-15-2012, 10:00 PM   #7
Samcro
LQ Newbie
 
Registered: Sep 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by me@asafonov.org View Post
It's in your home directory. If not, just create it.
Well wasn't in the home directory so I created it but no dice still happens
 
Old 05-15-2012, 10:02 PM   #8
Samcro
LQ Newbie
 
Registered: Sep 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by me@asafonov.org View Post
It's in your home directory. If not, just create it.
never mind I got it

Thank you for all the help
 
Old 05-15-2012, 10:03 PM   #9
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Deleted: Too late
 
Old 05-16-2012, 03:00 PM   #10
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Learning vim is akin to learning a whole programming language. There's just so much about it to know. The number of configuration options it has is just staggering.

Here are a couple of links that have helped me. The first is a good basic tutorial, and the second is a detailed repository of hints and suggestions.

http://www.swaroopch.org/notes/Vim_en:Table_of_Contents
http://vim.wikia.com/wiki/Vim_Tips_Wiki
 
Old 05-16-2012, 09:51 PM   #11
AlvaroG
Member
 
Registered: Jul 2009
Location: Canelones, Uruguay
Distribution: Slackware
Posts: 147

Rep: Reputation: 43
A good compromise might be to have vim create the backups, but in a specific directory instead of cluttering the whole filesystem with *~ files.
If you want to try that option, use the backupdir option, as in

set backupdir="~/.vim-backup"

In that way, if you come to a point on which you actually need to recover a file, you know where the backup copy is. The directory you specify must exist before you start ViM
 
1 members found this post helpful.
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
executing "DOS/Windows executable" files from "/media" Ruarscampbell Linux - Newbie 10 07-05-2011 05:48 PM
[SOLVED] Missing "Search for Files..." in Gnome "Places" menu austinium Linux - Newbie 11 04-12-2011 04:38 AM
"Permission denied" and "recursive directory loop" when searching for string in files mack1e Linux - Newbie 5 06-12-2008 07:38 AM
Shell and batch operations on hidden files but not on ".." & "." danielsbrewer Linux - Software 5 09-12-2007 08:06 AM
"X-MS" cant open because "x-Multimedia System" cant access files at "smb&qu ponchy5 Linux - Networking 0 03-29-2004 11:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration