How to debug when vim writes random files - vim

I have a weird hard-to-localize issue with vim. It's almost certainly a weird custom configuration that is my fault, but I don't know (1) what I should be looking for and (2) how to reproduce it. I don't know if anyone will be able to help, but its been plaguing me for years, so I thought I'd at least make a post about it.
The issue is that after using vim, I occasionally find weird files in the directories I was working. The file names were usually characters I was typing. I have absolutely no idea what is triggering this, and it doesn't happen that often, so its hard to simply comment out a piece of my vimrc check if it occurs and narrow it down that way.
Examples of the file names I get are:
= np.diff(bins)
ep='')
= {
(shape0, device=device"
_rect = cv2.undistortPoints(left_corners, cameraMatrix, distCoeffs)
elf.alt_fc = nh.layers.MultiLayerPerceptronNd(
=feat_dim, noli=swish,
hape0 = (
ys, ubelt
tates, evidence=evidence)
ample_input = torch_encoder_result
tack = kwimage.stack_images(imgs, axis=1, resize='smaller')
hear_range=(-10, 10)
There is nothing in common between the files names that I can see. The majority have an "=" and a paren, but not all. I really have no idea how to reproduce this error. I feel like I must have a habit of hitting an incorrect key stroke that causes this issue, or there is some plugin doing something weird, or I have a crazy configuration (which I do).
The contents of the files varies. Sometimes they look like git differences. The one from the first example was the page for "less --help" (yes I grepped for that). Another is what looks like a docstring for a python class (I'm not 100% sure if this only happens with Python files, because most of my vim usage is Python).
Any tips that anyone has for how to further debug this would be appreciated.
Just for reference this is my vimrc: https://github.com/Erotemic/local/blob/master/vim/portable_vimrc and it does reference and source several other files in that repo, so I don't expect anybody to be able to parse it and figure it out.
If I was to take a guess I'd say its probably an auto-commands that's doing it, and I do have all of those auto-commands defined in this file: https://github.com/Erotemic/local/blob/master/vim/rc_settings/autocommand_settings.vim but I don't see anything that would cause this issue.

Related

Vim-Sexp - How do I move each inner form to a new line?

I have the awesome vim-sexp and vim-sexp-mappings-for-regular-people plugins installed, and I've come across a situation I'm not sure how to solve.
Suppose I have the following form:
(alimony barbara (code determinant) eclair final-countdown)
How can I transform that to:
(alimony
barbara
(code determinant)
eclair
final-countdown)
I can go ahead and insert a newline before every inner-form/element, but that is a bit tedious. There should be a way with or without the sexp plugin
This is an old question, but maybe an updated answer will help someone who comes here in the future.
You don't have to write the program mentioned by Kaz. Others have already done it. I have not tried them, but here are a few:
fipp,
cljfmt,
cljstyle,
zprint,
joker. (The last one does more than code formatting.)
As Kaz suggests, once installed, you can pipe code to a formatter using !. You can even bind this operation to a key combination. Some of the formatters offer suggestions about how to do this sort of thing.
In addition, some vim IDE plugins, such as vim-iced provide support for using an external formatter.
A productive way to get this behavior would be, rather than fighting with Vim modules and extensions, to write a Lisp program which reads S-expressions and outputs them reformatted in the desired way. To use that program out of Vim, just pipe a range of lines into it using the ! command.

vim buffer write destination set to stdin

EDIT: it turns out if I write to a temporary .go file in the same directory I can then start writing the file again, so I'm almost certain this is a vim-syntastic issue. Going to mark this as closed.
I have an infrequent (but extremely annoying) bug where vim gets confused about where a file is supposed to be written to. It will suddenly decide that it should be writing to "-stdin-", even though :echo expand('%:p') is showing the correct file.
When this happens, there's basically no way to write the buffer back to the correct file. :w % doesn't help, nor does :w NameOfFile.go. I can write to a different filename just fine. :bd does not fix the issue. This only happens if there's a location list open.
Given the lack of google hits for this, I'm guessing this is some kind of issue with my local config. How can I go about debugging this problem?
Edit to add: after posting this, I realized that this is very possibly related to vim-syntastic. I've opened an issue there, but it's definitely possible there's something else causing this.
Marking as closed since this appears to be a vim-syntastic issue.

LaTeX document errors where no errors exist

I am writing my thesis with LaTeX and since today very curious errors turn up. I wrote something and made a citication in the file references.bib, and then the errors turned up. Befor writing that few lines everything worked great. Thus, I deleted everything I've added. But the errors still turn up. One Error is: Extra }, or forgotten $. ...ckoverflow Permission SYSTEM_ALERT_WINDOW}. I think my citication (which I've deleted after the errors turned up) is still stored somewhere , because "ckoverflow Permission SYSTEM_ALERT_WINDOW" was a part of the title of the cite.
I hadn't found any error in any file.
The next weird thing is that a mate of mine can compile that files without any problems. He is using WinEdt. I am using TeXStudio, but I've tried it with WinEdt, too.
There is a screenshot of my errors:
Please help me, any suggestions are appreciated.
Best regards
Looks like you might need to escape your _ characters there, as they are normally used for subscript, but only in math mode; hence the "missing $ inserted".
(La)TeX error messages make me sad... :(

Error on using Vim-latex ("can't find file ~")

I'm not sure if this question is appropriate here but I have nowhere else to ask. I recently started to typeset some 'mathsy' stuff using Latex and it became a hobby for me. I've been using TeXnicCenter for this, but feeling that I've got familiar with Latex language, I decieded to improve 'efficiency' of typesetting by changing the editor.
So I decided to use Vim (latest version, 7.4) with Suite-Latex. I've just installed Vim and Suite-Latex, following exactly what was instructed here. I made every necessary changes mentioned here, and it seemed to me that installation was successful (I got what was expected on Step 4)
Then I started to work through this tutorial and everything went fine until this section.
When I press F9 for autoreference, I see that Vim is working on something for split seconds and red error message refering to "can't find [some file name]" in my user/appdata/local/temp directory. The "file name" changes every time I do this (so its kind of temporary file as its directory suggests?). And then it produces a new window with title __ OUTLINE __ where 2 empty lines are showing up.
If I press n (in the new window described above) error message saying "E486: Pattern not found: rf" pops up and pressing j results in going down one row. If I press enter key, message ":call Tex_FinishOutlineCompletion()" pops up.
More frustratingly, if I try to compile a file by entering command \ll, a new window pops up where there are two lines saying:
1.ll I can't find file `newfile.tex'. newfile.tex
2.ll Emergency stop
and below these is a message saying
[Quickfix list]: latex -interaction=nonstopmode -file-line-error-style newfile.tex
So I thought it maybe is something to do with VIM not being able to find files in my computer (so something wrong with grep?), and I tried to resolve it by downloading a software called "cygwin" on which developers said their tests were successful, but it changed nothing.
But I think the two problems are related.
As it is, I am completely newbie in this type of editing environment (or any kind of programming) but I really would like to learn some Vim seeing how efficient it is in typesetting etc. Sorry for not being a pro at typing codes here. Thanks for reading!
I believe you need a latex compiler---I've had this issue and well, one thing that's left out of the conversation a lot is the compiler (pdflatex, latexmk, etc). As of now, you should download a compiler since vim-latex (latex-suite) doesn't actually come with a compiler (that I know of) and it's just a plug in with some cool stuff in it, but not what you need to make a file.pdf out of your file.tex.
It happened to me before. I found out that this problem may happen when you have special characters (such as white space and other symbols) in your file name or folder path. Try again with file name and path only in English letters.

Vim won't write file without a "!" sometimes (E13)

Very often (as in multiple times an hour), when I save my file :w, vim tells me "E13: File exists (add ! to override)"
I don't know why it does this, I can't reliably reproduce it, it feels random.
This is my vimrc, note that it sets nobackup, nowritebackup, and noswapfile, and there is a function to strip trailing whitespace that gets run when I save a file.
Also, I tend to have 20 vims open at once, all backgrounded, often editing the same file. Also not improbable that I have the same buffer open in multiple windows (ie :vsp) and might open it, then reopen it with the e command a lot, possibly from a relative filepath, or possibly from an absolute one (the cmap %/ <C-R>=expand("%:p:h")."/"<CR>). No idea if any of this matters. Next time I have this issue, I'll check my ls and report anything odd.
Update:
When I tried to save "lib/seeing_is_believing/wrap_expressions.rb" (note that this is a different file than the one in the gif), this happened again. Here is the ss, it's buffer 3:
Update2 (for #mMontu)
I just realized that there are two errors happening here. The one in the screenshot is the readonly thing. The one in the gif is the more common one, E13: File exists (add ! to override)
The one I just hit is E13 File exists, for this one, readonly is not set:
Update 3
I'm pretty sure the problem is the ZoomWin plugin. I had switched it up to a newer version, and it simply didn't work right. So I stopped using it for a bit, and didn't have this issue. Then switched it back, b/c I miss its functionality (it's my favourite vim plugin), and the problems started again. Possibly it's ZoomWin in conjunction with NerdTree window. Probably not the lib authors' faults, vim in general seems fragile and buggy. Maybe I'll try NeoVim, see if they've done a better job. Maybe it's time to try Atom or Emacs again.
It seems that if there were read errors opening the file, Vim will print an error on :w. This can be seen by running :f:
"MANIFEST.in" [Read errors] 1 line --100%--
The errors aren't necessarily errors in reading the contents of file; they can be caused by a plugin.
I think the main problem is that the file has been modified externally, see http://vim.wikia.com/wiki/Have_Vim_check_automatically_if_the_file_has_changed_externally to reload it whenever this happens

Resources