VIM & Nano Issue

DarkHelmet

New Member
Joined
Oct 26, 2021
Messages
5
Reaction score
0
Credits
56
Hi Everyone,

I am pretty dang new to Linux after spending over a decade with macOS. I should preface that I never learned Terminal and the CLI prior to starting my Linux journey.

With that said, I'm running into an issue with VIM and Nano. Pop! OS 21.4 is my distro of choice, currently. I installed Alacritty Terminal and after installing the alacritty.yml config file, located at ~/.config/alacritty/alacritty.yml....I used ":q!" or maybe ":q" to close the file after viewing. After this, when I reopen the file, the file appears blank, but I saved with no changes. What is even more odd, if I open the file in a text editor, the contents of the config file are still present. Before I saved the file with no changes, I was able to open it by running the command, vim alacritty.yml. When I do so, the file says "alacritty.yml" [New] at the bottem, despite my having not created a new file or saved with changes. In order for me to get to the file with content, I now have to vim into the absolute file path i.e. ~/.config/alacritty/alacritty.yml. I would really appreciate some help with this. It is driving me crazy.

By the way, I did the same thing on Mac and experienced the same issue so I know it is not an issue with Pop! OS.
 
Last edited:


To save a file in vim you can use the following.
Code:
:wq!
The w standing for write.
In order to save a file in nano you have to press the ctlr+x then it will ask you if you want to save it and then you select yes or no.
 
To save a file in vim you can use the following.
Code:
:wq!
The w standing for write.
In order to save a file in nano you have to press the ctlr+x then it will ask you if you want to save it and then you select yes or no.
As an alternate you can also use SHIFT+ZZ to save and quit which is my preferred choice.
 
To save a file in vim you can use the following.
Code:
:wq!
The w standing for write.
In order to save a file in nano you have to press the ctlr+x then it will ask you if you want to save it and then you select yes or no.
Thank you. My question was why is the file blank when I open it now? It was exited with :q (no changes). Also, I am no longer able to open with vim alacritty.yml. I have to vim into the absolute path.
 
As an alternate you can also use SHIFT+ZZ to save and quit which is my preferred choice.
Thank you. My question was why is the file blank when I open it now? It was exited with :q (no changes). Also, I am no longer able to open with vim alacritty.yml. I have to vim into the absolute path.
 
Thank you. My question was why is the file blank when I open it now? It was exited with :q (no changes). Also, I am no longer able to open with vim alacritty.yml. I have to vim into the absolute path.

That is the default behavior. I would be surprised if open the file from a different directory without typing the path. Of course if you happen to be in that directory, then the path isn't required.
 
Thank you. My question was why is the file blank when I open it now? It was exited with :q (no changes). Also, I am no longer able to open with vim alacritty.yml. I have to vim into the absolute path.
If you use :q it will tell you you made change and have to use ! to override so then it would be :q! which means quite and discard all the changes so if you made any changes to a file it will not save them but discard them. So when using :wq it means write the changes and then quit.
 

Members online


Top