In Vim's folder viewing mode I can't enter the : state for I get error:
Error detected while processing BufWinEnter Auto commands for "*"
E32: No file name
How do I fix that error?
Here's my vimrc.
Except I now have commented out the BufWin's.
I've stopped looking for this solution for now as I have managed to disable folder viewer.
For that see here.
You seem to have copied an autocmd into your configuration that is too simple and doesn't handle situations like unnamed buffers well.
If this is related to your other question, I'd suggest you have a look at http://vim.wikia.com/wiki/Make_views_automatic, where (in the comments section), multiple solutions to make the automatic view creation more robust are discussed.
Otherwise, go through the list of :autocmd BufWinEnter, try to find the culprit, and either fix it or remove that functionality.
You should be able to get out of this by doing:
:q
in the same way as you would quit from a file? Perhaps you need to add '!'
Related
I have some specific settings for my latex highlighting and am using the indentLine plugin, which requires let g:indentLine_fileTypeExclude = ['tex', 'bib'] to avoid the conceal feature annoyance. Anyway, when I start vim with vim filename.tex my vimrc gets loaded properly, but when I simply call vim and then open a given tex file, it'll ignore the vimrc.
Any idea what's causing it? Also, let me know what information you need, as I am far from certain on what would be needed.
EDIT:
Okay so I've found that for both cases i'm in a [tex] environment, but if I'm in a [plaintex] environment then the weirdness doesn't happen. If that helps anyone.
2nd EDIT:
New development, it is only the first file that's opened that seems to ignore the exclusion for indentLine, the remainder are shown exactly as they ought to.
The plaintex is a separate filetype in Vim (cp. :help ft-plaintex), so you need to add it to the IndentLine config:
let g:indentLine_fileTypeExclude = ['tex', 'plaintex', 'bib']
Edit This now looks like a command ordering issue. It's hard to remotely troubleshoot this, as the exact plugins and their initialization order may be important. Please capture a full log of a Vim session with vim -V20vimlog. After quitting Vim, examine the vimlog log file for the ordering of commands (but it might be difficult to see what's happening in a potentially vast list of commands).
It might be sufficient to just reload the first file that has those problems, with :e!.
I have weird issue with vim - for some files it doesn't color the syntax and opens it readonly mode by default, even if I use sudo. chmod for this file are 664, I am also owner of this file, so normally i shouldn't.
I have no set ro in my vimrc.
I noticed also that it often happens after removing .swp for this file - unfortunately, after this, this particular file is every time opened in readonly mode. One idea is - maybe is this some kind of spf13 cache?
For other files the behavior is correct.
Anyone knows this issue?
I found solution - it was more trivial than I expected.
I read the vim messages more carefully and I saw at the end:
if you did this already, delete the swap file `~/.vimswap/urls.py.swp`
So i did small investigation and i found .vimviews inside my /home directory. I just removed it's content and ...it works!
Probably spf13. There are WAY too many problems caused by spf13 in my opinion. Try doing :verbose set readonly? when you see the problem, to see where it happened from. My guess:
I think I remember spf13 having some kind of automatic session management built in, this would restore 'readonly' on a file if it had ever been set on that file.
It is quite possible (a fairly common solution) that if spf13 detects an existing swap file, it will automatically open the file in readonly mode, triggering (1).
It is also quite possible that some autocmd or another related to (2) sets an empty filetype or syntax, which would likewise be remembered by (1).
If this is the case, you can probably find the session file causing the issue (using that :verbose set readonly? command) and delete it.
Also consider, whether you really need all of spf13, or if you could achieve your desired configuration easier by installing plugins and configuring Vim yourself.
All of a sudden, my Vim starts with specifying fdm=marker regardless of the following two specifications
In _vimrc, both in the beignning adn bottom, set fdm=manual;
Per file type, have specified set fdm=manual through the *.vim files found in ~/vim/vimfiles/ftplugin.
Same setting had been working well around a week ago, when I updated the _vimrc. However, I just notice today that "marker" had been speificed for no reason.
Any suggestion? I have tried to Grep all the presences of "marker" in the ~vimfiles directory. This turned to be an unreasonable job to do, as there are thousands of presences of marker.
I have also tried to specify the following in my _vimrc, which did not work at all.
autocmd BufEnter * silent! set fdm=manual
fdm=manual will always pop up regardless of what type of file I open, upon typing set fdm in the command line. (by pressing :).
I have just made my Vim available on Github under: https://github.com/llinfeng/Vim
All the best,
-Linfeng
This is only a partial answer:
A plug-in called "restore_view.vim" is causing the problem. Upon uninstalling it, both settings I've tried did the work.
My guess is that, while _vimrc and "*.vim" files in ~/ftplugin/ did get sourced, the "restore_view" plugin will restore the "old view", which includes the folding methods and formatoptions, at the very end of the sourcing process. Therefore, all the previous settings of fdm and formatoptions had been restored and the newly implemented ones cannot be applied.
Here goes the github mirror of this plugin:
https://github.com/vim-scripts/restore_view.vim/blob/master/plugin/restore_view.vim
As a solution to my post, simply removing the plugin will solve all the issues. However, it remains to be an open question of how to properly deploy the "restore_view" plugin. I have emailed the author for suggestion and will also start a new question on Stack Overflow.
When I enter Vim's folder view I always enter trouble, as you can see here.
Is it possible to simply disable this folder View?
So that I never have to enter it again by accident.
And if so, how do I do that?
The "folder view" is provided by the netrw plugin (cp. :help netrw-intro-browse) that is included in the default Vim installation. You can disable it by putting
:let g:loaded_netrwPlugin = 1
into your ~/.vimrc file. However, your real problem is bad :autocmds that do not handle so-called scratch buffers (i.e. artificial buffers that do not correspond to an actual file, but are used to display plugin functionality). You'll probably encounter similar problems with other plugins, too, so rather fix or remove those autocmds! Disabling netrw is just working around the problem.
If I'm editing a file in Vim, then some external program changes the file, Vim tells me:
W11: Warning: File "test.erl" has changed since editing started
See ":help W11" for more info.
[O]K, (L)oad File:
If I Load the file, though, all the undo history is lost.
Is there any way to avoid that?
Update: it appears that this is one of the new features in Vim 7.3: https://groups.google.com/group/vim_announce/browse_thread/thread/66c02efd1523554b
I don't believe this is possible.
There is a very useful patch available for the vim source code available here that keeps the undo history after exiting vim and restarting. However, I've just tried it and it seems to fail when the file is edited externally. It might be worth contacting the author or reporting a bug on the patch website to see if this can be overcome.
G'day,
I'm not sure but does setting autoread, i.e. entering :set autoread leave the undo history for the file when it changes?
Hmmmm. I'm thinking probably not because the change history is maintained as line numbers and vim doesn't know if those line numbers are still relevant to the changed file.
BTW WTF are you editing a file that is being changed by external forces anyway? Sounds dangerous to me. (-:
This is a workaround I used before Vim 7.3:
" :e usually clears undo history, so we don't really do :e any more.
" Instead we delete the contents of the buffer, then read the file in, which
" is an operation we can undo. We must delete the top (empty) line also.
:map :e<Enter> :%d<Enter>:r<Enter>:0<Enter>dd
When you see the warning prompt, you would have to hit ok instead of load, and then perform the load yourself: :e<Enter>
There are two disadvantages (although I found the tradeoff acceptable):
You lose the line you were on. Your cursor is left sitting at the top of the file.
Vim still thinks the buffer is out of sync with the file, so when you next save, you may need to do :w! instead of the normal :w, and you will need to hit y to confirm the overwrite.
Edit: There might be a workaround for the second problem.
Edit: The first problem could be addressed with a bit more scripting (see :h line.)
I don't see how vim could keep track of something it didn't do.
So, as to the question, I would suggest - source control ... but that's probably not the answer you're looking for.