NeoVim appends the last four lines to the end of file - neovim

Since I've switched to neoVim from vim it often but not always gives me a strange behaviour:
Sometimes when I edit code it copys the last few lines of the file and appends it to the file. When I save the file, of course I get typescript and compilation issues.
Then I delete them and I can move on with my coding. This doesn't happen always, but every now and then which is pretty annoying. I couldn't figure out yet why this is happening. Maybe some plugin causes this. Not sure. Has anyone else experienced this behaviour?
i.e.:
...
export default TripRow;
);
};
export default TripRow;

Related

Vscode: Hypersnips excention sometimes duplicates cursor

I have the following snippet in the hypersnips extension (in vscode)
snippet txt "text in math" imA
\text{$1}
endsnippet
Usually, it works fine with me typing txt and it automatically sends me to
However, sometimes when using a snippet I get the following
After this occurs, if I delete that and try again, I get
This "bug" (?) occurs 10-20 per cent of the time and it is very annoying. Moreover, it is not unique to a specific snippet.
I have tried changing the version of vscode and of the extension but nothing has seemed to work.
Any help will be greatly appreciated.
EDIT: Screenshot to address rioV8's comment
I think that it is the bug of VSCode. When you overlap placeholders more than (about) 18 times, it occurs.
Just because HyperSnips adds too many placeholders, you noticed the bug.
Test: use VSCode keybindings to add snippet (without extensions).
ctrl+M inserts $|$ | .
Click here to view the result
However I don't know why it occurs and how to solve the problem. Sorry for that.

Indentation in Emacs suddenly stopped working, how do I fix it?

I've been working on this source file for a while, and indenting it just fine, and now suddenly I cannot indent lines by any means (tab, M-x indent-region, etc). Restarting Emacs doesn't fix it, closing and reopening the file doesn't fix it, and the problem seems to be isolated to this particular file.
It's a cpp file if that matters. Yes, I am working in C++ mode. Yes, syntactic indentation is on.
Look at the last part of the file that you edited. Most likely Emacs is in fact indenting, but your source code is such that indenting at the position where you are trying to indent has no effect.
IOW, look at code that precedes the position where you are trying to indent. Look for syntax problems that might be making that position actually appear to be top-level. My guess is that a syntax problem is throwing off the indenting.
You can also narrow the buffer, using C-x n n, to particular parts of the buffer, to see just where indenting does what you expect and where it does not. That will help you find any syntax problems that might be interfering.

Open cscope results in the same buffer

This might seem to be a very very stupid question.
But for the past few years I have been using vim and cscope on the terminal, with some screen to make life a bit bearable.
I have just started to learn emacs and it is much more satisfying to use it.
Problem using emacs:
Every time I do M-x find-c-symbol, I get a new buffer with a bunch of files, but I don't know how to open the file at the exact line number.
I googled a lot and found this to open file under cursor: M-x ffap
but this opens at the first line. Can some emacs expert help me??
Thanks
I've got both Emacs 23.x and 24.x installed, both setup with working cscope and xcscope installs. Neither has a "find-c-symbol" function, but there is a "cscope-find-this-symbol", which is what I assume you're actually using.
I'm going to assume you're using a GUI version, and not the text-only version, and that you're actually getting the *cscope* buffer automatically being opened and created (since that's what it sounds like from your description).
For a simple search, I'll get results that look like this:
Finding symbol: debug
Database directory: /home/user/emacs_tags/modular/
-------------------------------------------------------------------------------
*** /home/user/code/modular/frontend/common/controller.test/src/MainTest.cpp:
<global>[73] #ifdef debug
-------------------------------------------------------------------------------
Database directory: /home/user/emacs_tags/rrsdk/
-------------------------------------------------------------------------------
*** /home/user/code/rrsdk/fs/apps/busybox/src/shell/ash.c:
<global>[303] #define debug optlist[15 + ENABLE_ASH_BASH_COMPAT]
*** /home/user/code/rrsdk/bootloader/u-boot/src/board/mcc200/auto_update.c:
<global>[53] #undef debug
<global>[55] #define debug(fmt,args...) printf (fmt ,##args)
<global>[57] #define debug(fmt,args...)
-------------------------------------------------------------------------------
Search complete. Search time = 22.44 seconds.
Assuming your results look similar (they should), there are two multiple target areas in the result. Each file line (the lines starting with ***) is a target to the start of that file. Each individual result is also a target area. If you click on one of the lines that lists a specific match (or put your cursor on it and press enter), it will attempt to jump to the specific line matching the result. If it's not jumping to the specific line correctly it usually means your code has changed since the last time the cscope index file was generated.
I'm not sure how you're using the cscope tool, but you can setup xcscope to auto-index on every change to keep the file up to date, but it really only works for smaller code bases where you can keep the cscope.out files in the top level directory and provide it with a full file list for the files to index. Most people I've talked to use the cscope tool by hand in an external script to manually index/re-index every once in a while and then just interface to the existing cscope database(s) using the emacs tools (mine takes about 4 hours to generate the cscope database for a project that includes the Linux kernel as a sub-part).

Oddball issue arising with use of TextWrangler to edit Python 2.7 script which tests multithreading and Queue modules

I'm writing a script in Python 2.7 exploring the use of the multithreading and Queue modules. the script just defines two functions, one of which will be started in a thread instance to fill a Queue, and a second one which will be started in a second thread instance to pull something off the Queue. However, I cannot even get this script to execute, as it chokes on one of the function definitions even before it executes. The code snippet with the problem is:
def listenThread(counter):
while queue.empty() != True:
try:
outcome = queue.get()
print outcome
counter -=1
print counter
except:
return 'queue.get() command loop failing.'
The error message I am getting is:
$ python threading-and-queue-test.py
File "threading-and-queue-test.py", line 34
except:
^
IndentationError: unindent does not match any outer indentation level
$
I've searched SO and checked the docs for correct formation of the try-except construct, and it seems OK. I had earlier versions of the code (without the try-except ) working, so I am getting suspicious about the text editor, TextWrangler v4.0.1.
Can anyone suggest a debug approach or code correction?
Thanks!
Red
As you have already suspected, it is most likely an indentation error. Your text editor is probably mixing the use of tabs and spaces. Replace all tabs with spaces (or vice versa though the standard in python is 4 spaces) and you should see the error disappear.
For those who find this question later like I did it's easy to fix TextWrangler's settings and stop this issue altogether; Go to "Preferences" -> "Editor Defaults" -> "Auto-expand tabs" then set tabs to 4 spaces. Restart TextWrangler for changes to take affect. For existing documents that continue giving you a problem read this.

Tell ipython to keep temp files

There have been a few occasions in which I've got some code in some temp files thanks to ipython's %edit feature, and through some tragic sequence of events or other I end up exiting the shell before saving the code permanently.
Is there any setting anywhere that makes the temporary files, how should I say this ... not so temporary?
you can use %edit filename.py to keep your edits even after quitting the shell. if you want to use temp files, you could try configuring your editor to automatically save them.
you could also hack the ipython source and prevent the shell from cleaning up temp files when exiting: just comment the 5 lines after "# Cleanup all tempfiles left around". just an idea :)