When I try and open a file with a long name in netrw in a directory listing with file date showing it will open the file as testfile999 Sun 20 Feb..... including the date hence resulting in a new file buffer not the file.
To reproduce:
open netrw
press i to show directory listing with file dates.
open a file with a long name so that the filename runs into the next column
netrw doesn't open the file and instead opens a new file buffer with the wrong filename.
Is there a setting to fix that.
Related
I have a two file with the same name & content like this.
// File 1
m/d/b/x/s/d/x/same_name.c
// File 2
p/t/k/x/d/x/same_name.c
When I have File 1 open in the buffer and try to open File 2, it always opens File 1. The only way to open File 2 is to do
:bw <Buffer number of File1>
Tried this with/without plugins, on VIM and NVIM but I get the same result.
This is not an issue when the path name is smaller.
I am guessing that this might be because of 'd/x/same_name.c' which is common on both long paths. (Or am completely wrong :D )
What setting in vim/nvim can I use to control the path matching for buffers?
Or is this a bug (I doubt it)
PS: I have already looked at this
2 files having the same name but different paths => vim thinks they are the same
I am already using "//" in directory.
For example, I have file dwm.c. If file is currently opened in any other buffer, I want to focus this buffer, otherwise I want to take other action like opening in vsplit.
I am making simple :Make command. If there will be any errors, errors will be in format file:line:column:...., I now have parsing of this done. When I will press space, I want to open the file on the line and column specified in error, so if file is not opened in any buffer, I want to open it, for example, in vertical split (new buffer). Otherwise, if file is opened in any buffer, I want to focus to this buffer and move to line and column. Everything except focusing an buffer (if exists) is done, I just want this focusing.
I am using vim to edit .sh file. Last time, I was making changes I got: "E297: Write error in swap file" and I accidentally managed to erase the content and save.
Now, all I have is .sh .sh~ .su~ .sv~ .sw~ .sy~ .sz~ files with empty content and "E297: Write error in swap file" message. When I do :u, it says: "already at oldest change".
when I do :recover, it says: "E305: no swap file found"
How to recover my file? thanks
In this case, the original file may be recovered using swap files which have the form .filename.sh.swp. These are files that Vim creates to back up in case of a potential crash. In order to recover your original file, try these steps:
Look for swap files in the current directory (there could be more than one for a particular file):
ls -a
Open the first swap file in Vim from the terminal:
vi .filename.sh.swp
or alternatively, launch Vim with vim and edit the swap file with :e .filename.sh.swp.
From within the swap file type :recover. Now Vim will load the recovered file on a new buffer. If this is the file that you needed then simply save the file :w.
It could be that the recovered file is not exactly the latest version of your filename.sh, in this case repeat steps 2 and 3 above with a different swap file e.g. .filename.sh.swo. Once the desired file has been recovered removed the swap files.
These help pages are also relevant for recovering files:
:help swap
:help recover
:help e305
Using ctrlp, I would like to search for a string in all files in the current directory ( or a specified directory).
Using the "lines" mode is only searching for files opened. I would like to search for all files, including the files not opened.
Thanks in advance.
Is there a simple way to (in VIM) do save the currently open file with it's current name plus an appended phrase?
IE, from /home/affert/ type vim /data/folder/file1.txt
then save the file as /data/folder/file1.txt_BACKUP without needing to copy and paste the filename?
Context: I have a file that has full paths in it to other files in other folders. I use ctrl+W, ctrl+F to open the file in a new window. That's why I don't want to copy and paste. BTW, the folder and file names are a lot longer, so typing them myself is not a useful option.
:w %:p_BACKUP
For explanation see How can I expand the full path of the current file to pass to a command in Vim?.
Easy:
:w %_BACKUP
If you need override:
:w %_BACKUP!
The it gonna answer:
"filename_BACKUP!" [New] XL, XC written