Patching macvim remote editing, file netrw.vim - macos

So there's a problem with macvim when doing remote editing through
:e scp://path/to/file
Every time I try to save :w, macvim complains E382: Cannot write, 'buftype' option is set.
The quick fix to solving this is to do :set buftype:""
However, there are patches out there to solve the issue. So I downloaded a patch file to fix this problem. The problem is located in the netrw.vim file. When I try to patch the file netrw.vim through patch -p1 < file.patch, it gives me an error that says
patch: **** Can't rename file netrw.vim to netrw.vim.orig : Permission denied
I tried chmod for netrw.vim, but it doesn't let me.
Any help is appreciated!
p.s. I'm running on OSX 10.9.5

I just tried mvim scp://hostname/, picked a file, edited and changed it, and saved it. It worked.
I then tried mvim scp://hostname/somefile, edited and changed it, and saved it. It worked.
So, I suggest that you upgrade: you can find netrw v154b on http://www.drchip.org/astronaut/vim/index.html#NETRW .
btw, the mvim I used is v7.4.258 .

if you opened a remote directory and selected a file to edit you need create the tmp file in you local and set this command :set by=acwrite or :set buftype=acwrite and finally save your changes :w.

Related

PATH related issues

A couple of days ago, I added code to my Mac's PATH to make some newly installed programs work properly on my machine. Unfortunately, it seems I have messed it up somewhere because some additional lines are printed every time I open my terminal.
Here is a screenshot of my terminal:
And here is a screenshot of my PATH Variable:
Does anyone know how I can remove extra lines in my terminal?
Thanks in advance
I renamed my ~/.zshrc file to ~/.zshrc2. Then all the extra lines were not shown anymore while opening up my terminal. Now I am sure the problems belong somewhere in my ~/.zshrc file
You can rename a folder by entering this command mv old-name-folder new-name-folder in the folder's directory.

How do I create the folder .vimrc?

I'm new to VIM so I was doing the VIM tutorial and in the Lesson 7.2 it asks to edit the .vimrc file in the ~/.vimrc directory by typing this command: :e ~/.vimrc but I get an error E37: No write since last change (add ! to override) I didn't know what to do so I tried to find if that file existed but it didn't. I searched for "Where is my .vimrc file" and found this answer: https://stackoverflow.com/a/10921485/5220885 but I don't know how to create it, I wanted to ask in the comments but I don't have enough reputation.
Your error has nothing to do with .vimrc as such, rather it is simply Vim warning you that you are trying to edit a different file when you are already editing another one with unsaved changes.
If you write the changes to your current file, :w, first you won't get the error. Alternatively as the error suggests you can discard the changes and switch to editing .vimrc by adding the exclamation mark to the command, :e! ~/.vimrc
Of course you can just type vim ~/.vimrc in the Terminal to open and edit the file.
HTH

Can't edit remote file with VIM

I'm trying to edit a remote file with VIM. In terminal, I type:
vim scp://my_user#some.server.net//app/logs/jboss/sso.log
and get this output:
:!scp -q 'my_user#some.server.net:/app/logs/jboss/sso.log' '/var/folders/4d/6z5mf6m96bq105stbqy_tjf4jmvwpj/T/vyHJPX5/0.log'
my_user#some.server.net's password:
[8]+ Stopped vim scp://my_user#some.server.net//app/logs/jboss/sso.log
I know that I have the right credentials and the file exists, because:
scp my_user#some.server.net:/app/logs/jboss/sso.log ~/Documents
successfully copies the desired file to localhost.
The vim wikia suggests that my syntax is correct.
The file is being downloaded, but VIM doesn't start to edit it.
The same happens when I start vim and issue the following command:
:e scp://my_user#some.server.net//app/logs/jboss/sso.log
The file is downloaded to the temp folder, and I'm being thrown out of VIM back to the console.
I'm using VIM 7.3 (2010 Aug 15, compiled Nov 6 2014 14:32:04) on OSX. I installed it with brew.
How can I fix this situation and have VIM started to edit the remote file?
It appears that Vim is trying to create a temporary local copy of your file for the editing. But this is located at /var/folders/... (as shown in the scp), which you may not have permissions to write to.
Try having it write somewhere your user controls by setting TMPDIR:
export TMPDIR=$HOME/tmp
mkdir $TMPDIR # if it doesn't exist
Also, by having the double-slash (//), you’re telling vim to use an absolute path, so /app should not be relative to my_user’s home. Not clear if you’re doing that intentionally.

Vim Can't Save File (E212)

Sometimes when I create a file using vim some/path/newfile, vim lets me edit it, only to complain when I attempt to save my changes.
E212 Can't open file for writing.
This appears to happen only when the new file is located in a system directory.
:w! does not override this error.
How can I write the current buffer, without having to save it to a temporary location, exit, then rename it using sudo?
This will ask you for the root password, then save your changes as you requested:
:w !sudo tee %
Then type (L)oad at the prompt, to re-load the file after it is saved.
You can mkdir first, then save it.
Add this line to your .vimrc:
cmap w!! %!sudo tee > /dev/null
and then you can do
:w!!
when you get into this position, and it will write the file using sudo. Very handy.
You can avoid this problem by using "sudo" to start the editing session.
sudo vi name-of-file
If you want a robust, easy-to-remember solution and don't mind installing a plugin, try SudoEdit.vim - Edit Files using sudo or su or any other tool.
If this is the case in Windows 7 or later editions, run the VI editor as Administrator. Right Click of the application and select "Run as Administrator". This issue will be resolved. Moreover, the error is due to Administrative Privileges.
vim some/path/newfile
you can try to do it in two steps,first create the folder 'some' and 'path' by use mkdir ~ ;second you go into the 'path' folder,use the command:sudo vim newfile.then save it
Make sure the directory where you are trying to save the file exists and that you have permission to edit the file.
You can type :help message in Vim to get more information on this and other error messages. Try searching by typing /E212 once the docs come up. You can also view the documentation online at http://vimdoc.sourceforge.net/htmldoc/message.html and CTRL-F to find it.
For what it's worth, you may also want to ensure you have sufficient storage in the partition where you're attempting to save the file. I had to free up some space in my /home drive and that resolved the issue.
I know this is an old question, but this is what fixed it for me. Your file might be set to immutable meaning that you can't edit it.
You can check this with lsattr /path/to/file.txt
If it is use
chattr -i /etc/resolv.conf to make it no longer immutable.
Just had this issue outside of system directory.
When I tried to open a file vim src/help/tips.c. Turns out help directory did not exist, the directory was named differently and it was one of those very rare occasions that I did not auto-complete with Tab.
So, in conclusion, if this happens for a file that is not at a place where you may have permission issues, look if the path leading up to the file is a valid one.
I have experienced this in Kali!! The default account requires escalation to root with "sudo" in order for the file to be editable.
e.g: sudo vim / at this point all standard expectations appear to follow.

How can I fix permissions for bundles or Subversion in TextMate?

When I try to use GetBundles to update my TextMate bundles, "Parsing Local Bundles" appears and the progress wheel spins endlessly (e.g. >20 minutes). Reading the Help manual for GetBundles suggests that this might be a permissions error.
In line with this, typing at the command line the commands from this question ( How to update GetBundles in TextMate? ),
cd ~/Library/Application Support/TextMate/Bundles/
svn co http://svn.textmate.org/trunk/Review/Bundles/GetBundles.tmbundle/
produces this response:
Can't make directory 'GetBundles.tmbundle': Permission denied
Can I fix permissions somehow, to make GetBundles work properly, if that's my problem? Thanks!
update: I seem to have TextMate/Bundles/ in both my user user Library and the higher level Library. Could that be my problem? And if so, how should I fix it?
ORIGINAL RESPONSE:
You need to remove the trailing slash from GetBundles.tmbundle/ so it reads like a file and not a directory: GetBundles.tmbundle <- incorrect (I misunderstood the question - apologies)
UPDATE:
I think the mistake (in your command as typed above anyway) is that spaces need escaping or the path needs quoting in your 'cd' command. So, from a fresh Terminal session (i.e. from your user Home directory) try quoting the path:
cd "Library/Application Support/TextMate/Bundles/"
then
svn co http://svn.textmate.org/trunk/Review/Bundles/GetBundles.tmbundle/
Try that, and post the exact terminal readout here...

Resources