How to use help cmd in Vim to view .txt files? - linux

I'm using Vim 7.4 on Fedora 20. I unzipped all the .txt.gz files in /usr/share/vim/vim74/doc and when I try to use the help command in Vim's command line it gives an error saying E429: File "/usr/share/vim/vim74/doc/starting.txt.gz" does not exist. I did that because when I was using the help cmd before unzipping the files, it showed me some encrypted binary text. So, I thought that uzipping the filed might resolve the problem but, obviously, it didn't. Now, I don't know what to do? Can I configure the file extensions that help searches for in the /doc folder or something like that? What to do?
And yeah, I don't want to compress the files again. A way to resolve this problem without having to re-compress the files, is what I am looking for.

First, delete the old tags file:
rm /usr/share/vim/vim74/doc/tags
Then, run vim as root to regenerate help tags file:
sudo vim -c 'helptags /usr/share/vim/vim74/doc' +qall
Finally, fix vim's ability to read gz files for future convenience.

Related

Modify some text of a file in a zip file

On linux, I would like to modify a file that is inside a zip without having to extract it. The file is in any possible extension.
Here's an exemple.
test.zip
|---hello.someextension
|---bye.someextension
The file hello.someextension contains following text: Hello, this is a test.
What I would like to do
Modify the word test in the hello.someextension file to be "gift" instead, for instance.
Modifying the text is not really a big deal, but the issue I'm facing is that I cannot edit a file that is inside a .zip. I tried via VIM and here's an exemple output:
ÅÍ.PE¥&ö$kpì`w_OËŽ=“XÖ¸m† 86=šoÔRw«Õºxÿ¯Ûiö²X
Vim supports editing zipped files out-of-the-box. If it doesn't work for you then you have a local problem of some sort.
Check if it helps to bypass your faulty vimrc (e.g. vim -u NORC -N), or to re-install the whole Vim package etc.

How to open files from within Vim

I am trying to learn how to use Vim. Apparently I have failed at the first hurdle since Vim (certainly on my computers) cannot open files from within itself. I know this must somehow be a mistake on my part since how can Vim still be around with such a flaw??
Anyway I have searched for the last day or so with no solution.
I have tried:
:e .
And Vim helpfully tells me that: "." is a directory. I was under the impression that this command would open a file browser in current directory, but it doesn't.
Similarly I have attempted other commands:
:Ex
:Explore
:Sexplore
:Sex
:Vexplore
:Vex
:Hexplore
:Hex
I have tested these from How do you open a file from within Vim? but nothing suggested there works.
All of these produce: E492: Not an editor command: <insert any of the above commands here>.
I am left with the conclusion Vim can't open files unless Vim is called from the terminal and the file is passed as an argument or the files happen to be in the current directory (where ever that may be) and you know the file's name.
Can someone help? I would like to be able to open files in other directories and list them but for the life of me nothing is working despite every guide I have read saying it would.
Thanks.
At the request from Zaffy this question has been solved.
At Robby Cornelissen's prompting I checked the MX's Linux's package manager and found that vim-common was installed but weirdly not vim. Once I'd installed vim :e . worked and I can now navigate the filesystem.
I have no idea the difference between vim-common and vim or the reason for the separate packages; Robby Cornelissen suggests that vim-common is probably a minimal or tiny version of vim.

What is the line to add to vimrc for storing .swp files in /tmp on Ubuntu

I feel like I've literally tried everything, but no matter what I add to vimrc, I can't get it to store its annoying .swp files in /tmp. I'm using Ubuntu 16.04. I've obviously looked up this issue extensively, but again, no command I enter seems to work. I always end up with:
E510: Can't make backup file
(add ! to override)
Things I've tried:
set backupdir=$~/tmp//
set directory=$~/tmp//
set backupdir=~/tmp//
set backupdir=$HOME~/tmp//
set backupdir=/tmp//
I mean you name it, I've tried it. So, explicitly, what is the exact code I need to type in vimrc to make it so vim saves it's .swp files in my temporary folder, instead of cluttering my workspace?
Thank you.
Adding the following line to my ~/.vimrc puts .swp files for currently open buffers under /tmp
set directory=/tmp
If you've tried this without issues are you able to verify that vim is reading your vimrc at all?
It appears the issue was I didn't really understand what ~ means. I created a folder called 'tmp' in my home directory, and from there used:
set backupdir=~/tmp//

vim open existing files

When I want to open a existing file (I use vim filename.java), it seems that I create a new file. Because it says new file. And there is no code.
I don't know why. Can the command vim filename.java open any file in the computer? Should I put my file into a particular place?
Try to search for your file using a number of ways like:
$ locate filename.java
if it doesn't work, try also find
$ find filename.java
(note: you don't have to write the the "$", it's there to mark the start of the command line)
The commands above will give you an output similar to:
/home/jane/FOLDER/FOLDER/FOLDER/filename.java
To edit, write:
$ vim /home/jane/FOLDER/FOLDER/FOLDER/filename.java
Remember to save after edit!

Vim - ctags: tag not found

I want to use Ctags for a Zend framework project. I executed this command : ctags -R ./* ../ZendFramework/*to create a list of tags, but the problem is when I press Ctrl-] on a class or method I get this error: ctags: tag not found
I checked the tags file and all classes/methods/variables are listed. The tags files is located in the root of the project. Should I load it manullay when I open a file?
Yes, you should tell Vim where to find your tags file with something like:
:set tags=/path/to/tags
This is not very optimal, though. This line in your ~/.vimrc should help:
set tags=./tags,tags;$HOME
It tells Vim to look for a tags file in the directory of the current file, in the current directory and up and up until your $HOME (that's the meaning of the semicolon), stopping on the first hit.
The 'tags' variable must point to your tags file. See :help 'tags'.
An example to add the path to your tags file:
:set tags+=$HOME/yourpath/tags
I Faced the same problem few days ago. I was applying ctags shortcuts in a .c file and I was getting this error while doing so. I googled the error and found that the ctags was not installed. But the ctags is present in my server. I tried moving the ctag folder to the trunk which i'm currently working and this trick resolved my problem.
steps:
go to your home folder and enter "where is ctags"
it will display the path of the ctags file.
copy that file and move the same to the directory which you are working in
i hope this will resolve your issue.

Resources