Impossible to copy snippets in EmEditor 20.9 - code-snippets

After upgrading from EmEditor 20.8.1 to 20.9, I can no longer copy snippets. When I select, copy and paste a snippet, I end up with a snippet in which the fields 'name', 'trigger', 'tips' and 'text' have a value of -1 and the other fields are empty.
Is this a bug?

Related

How to copy paste multiple lines of code into rails console (e.g. copy paste from a script)

I discovered from here that if you have a script you want to run in the rails console, you sometimes have to copy paste it line by line (copy pasting it all at once doesn't always work)
This is very tedious for lengthy scripts
Is there a work around or faster way?
Example - this will not copy paste from text editor to console:
class Article
def initialize(title, link, paragraphs)
#title = title
#link = link
#paragraphs = paragraphs
end
attr_reader :title
attr_reader :link
attr_reader :paragraphs
end
Edit
The above snipped does copy paste right into the rails console. But when I grab the same text from sublime text 3, it errors after the second line, with:
Display all 522 possibilities? (y or n)..
The Answer
I worked out why. My script (in sublime text) used tabs as indents. The rails console only accepts spaces as indents. That's an hour of my life I won't get back. I hope this saves someone else some time.
This issue (pasting multi-line code into irb on the console, on a Mac, using iTerm) bugged me for a long time and finally found the solution.
In my case the issue was with iTerm. It turns out iTerm by default pastes the content at a speed that is too fast for readline, the library that irb uses to read input.
The solution was to do Edit > Paste Special > Paste Slower, twice.
See here for a similar case: https://gitlab.com/gnachman/iterm2/issues/3607
SOLUTION
Open the rails console with this option:
rails console -- --nomultiline
You can paste many lines of code without problem then.
EXPLANATION
The problem here is that IRB wants to write a letter at a time. You can disable this behaviour by giving up the ability to move the cursor up and down when you write and edit a block of code before closing it.
Source:
https://tosbourn.com/speed-up-pasting-text-into-rails-console/
I can't comment because of reputation, so i add an answer about a 'tips' that can save some of your time.
In most of the text editor / IDE used to write code you can choose to replace the tabulation by an amount of space. It's a good thing to do so to avoid the tabulation characters in files raising some errors like yours ;)
https://www.sublimetext.com/docs/3/indentation.html
For me replacing tabs to spaces wasn't enough, maybe because the content i was trying to paste was so large. What worked for me was removing all unneeded spaces, replacing newlines with semicolons, and replacing do...end blocks with one line curly bracket blocks. Basically getting everything into as few lines as possible.

Sublime text show path content

Is there a setting or package that allows sublime text 2/3 to show what's in a path? For example I type app/ it shows me whatever is in app/ so I can press enter to select that file or folder.
Thanks,
Jordy
There is a package called FileSystem Autocompletion, which looks like it should show autocompletion entries based on files and folders that match the path you type - see https://packagecontrol.io/packages/FileSystem%20Autocompletion
EDIT: If that doesn't work for you, there are 2 more similar packages you could try:
https://packagecontrol.io/packages/FuzzyFilePath
https://packagecontrol.io/packages/AutoFileName

Sublime Text selection using Lua/love2d

say i have this line of code :
Object.Property.field;
Object.Property:FunctionName();
in all my sublime languages if i was to double click "Property" on either line, it would select just that word.
For some reason my lua/lua love2d syntax highlighting selects the whole line up to the ":"
How can I change this behavior, so it will only select the single word?
The reason this is occurring is because of a somewhat strange addition to the Lua Love plugin, which I assume you're using. You're using Sublime 2, so select Preferences -> Browse Packages... to open up your Packages folder, then open the Lua Love subfolder. There is a file called completions.py, which has this content:
#completions.py
import sublime
import sublime_plugin
import re
class LoveCompletions(sublime_plugin.EventListener):
ST = 3000 if sublime.version() == '' else int(sublime.version())
def on_query_completions(self, view, prefix, locations):
if self.ST < 3000 and ("lua" in view.scope_name(locations[0])):
seps = view.settings().get("word_separators")
seps = seps.replace('.', '')
view.settings().set("word_separators", seps)
Even if you don't know Python, the logic is pretty easy to follow. It sets the variable ST to Sublime's version, which is 3000+ if you're using ST3 (current build is 3061), and is 2221 (I think) for ST2. It then sets up an event listener (the process is always running in the background) checking to see if the Sublime version is less than 3000 (you're using ST2) and you have lua in your current scope (basically, your file is source.lua or source.lua.love, if you're using the plugin's language definition). If both of those are true, it removes the . character from your "word_separators" setting, which is defined in Preferences -> Settings-Default and can be overridden in Preferences -> Settings-User.
The word_separators setting controls what characters are considered to be word separators when double-clicking to select a word. Its default value is ./\\()\"'-:,.;<>~!##$%^&*|+=[]{}`~? so, for example, if you double-click on the foo part of foo-bar Sublime will only select foo, but if you double-click on the foo part of foo_bar Sublime will select the whole thing (since - is in word_separators). . is in word_separators by default, so double-clicking on foo in foo.bar will only select foo, which is expected behavior for most people, I would assume. However, this cute little plugin removes . from word_separators in Sublime Text 2, so in your case clicking on Property selects everything from the beginning of the "word" (the whitespace before Object) to the next word separator - the :, in the case of your second example.
OK, so we know what the problem is, how do we fix it? First, while you're in Packages/Lua Love, just delete completions.py altogether. There's no harm in doing so, and in fact it's actually causing harm by being there. Make sure you restart Sublime after deleting the file. Next, open Preferences -> Settings-User and add . back into the word_separators list, anywhere between the beginning and ending double-quotes. Save that file, go back to your source code, and double-clicking should once again behave normally.
Good luck!
EDIT
I submitted this pull request to delete the completions.py file from the plugin's Github repo, and it was just merged, so hopefully users in the future won't have to deal with this :)

Existence of .inputrc breaks paste shortcut

I recently created an .inputrc file in the root directory of my Windows (Vista) user, to override the default history behavior. Today I realized that the 'Insert' key doesn't work for pasting text any more - a tilde character is pasted instead. I found out that this is caused by the .inputrc file being there (an empty file is sufficient). Without the file, insert works just fine.
I tried to restore the insert behavior in the inputrc file, but I don't understand it well enough to make it work. I'm not even sure if I have to override "\e[1~", "\e[2~", or if I have to set some other variable.
Any ideas on how to use both 'Insert' for pasting and .inputrc?
Adding the line
"\e[2~": paste-from-clipboard
to your .inputrc should do it, see How can I copy and paste into Cygwin console windows? You'll probably also need mappings for the Home, End and Delete keys as show under Why don't the Home and End keys work in rxvt and vim?

How to add a (large) code appendix in LaTeX / LyX?

I'd like to add a code appendix to my LyX document. There are a few options I already considered, but they all have their problems.
I know a bit about listings, but one problem with those is that, if I copy & paste my code into them, I lose all enters/newlines. Since the code is too large to correct by hand, I was wondering if there is an alternative.
In LyX there is the possibility of inserting child documents, but that seems to be only for .tex files. Would have been ideal if I could just insert my .java file as a child document.
I could print the code to PDF, but it will include margins that mess up the final document, since the PDF is placed on the left margin of the final document and then there is the margin of the PDF. Also, this PDF always contains the entire code and white areas where not the entire page has been filled.
Does anyone have good alternative?
The listings package found here
http://www.ctan.org/tex-archive/macros/latex/contrib/listings/
allows the include of external source code files (look into the reference for \lstinputlisting).
EDIT: here you find some samples how to use it:
http://en.wikibooks.org/wiki/LaTeX/Packages/Listings
If you need to copy-paste code to LyX listing box then use Edit -> Paste Special -> Seletion or Ctrl+Alt+V.
For what it's worth, at least the 2.0 versions of LyX have the ability to include listings as child documents. Insert, File, Child Document, and choose from the dropdown box "Program Listing". This uses the listings package and lets you keep your source in its own file.
If listings doesn't support your language, you can always use something like highlight or source-highlight to generate a latex snippet of syntax-highlighted code that you can add as a child document of type "Input"
Yes, if you copy&paste code into the LyX listings box, you lose all newlines, but you can preprocess your code (insert an extra newline below each line):
$ cat foo.java | sed -e 's/$/\n/' > bar.java
Then you can copy&paste the new file bar.java and everything will be ok.

Resources