How to disable brackets auto closing in light table? - clojure

I start to use Light Table IDE for Clojure programming , but I can not find way to disable brackets auto closing. I suppose that something must be added to the user.behaviors file but I can not find what exactly.

This can be disabled in the user.keymap file. By default you have a map entry for adding keymappings (:+). To remove keymappings you need to add one for removing keymappings (:-). Something like this:
:- {:app {}
:editor.keys.normal {
"[" [(:editor.open-pair "[")]
"{" [(:editor.open-pair "{")]
}
}
Add more lines for other behaviours you would like to remove (open-pair, close-pair ...). Look in default.keymap to see what has been set up in :editor.keys.normal.

I don't have an answer, but I suspect the auto-paren behavior is actually implemented by CodeMirror, not Light Table per se. Maybe you'd have better luck searching for an option there?
If you find something, you might be able to enable it in Light Table by using the set-codemirror-flags behavior.

Related

How to prevent Prettier from moving comments to new line

I have a typescript project formatted with prettier. My issue is when I save code like this:
const thing = await call({ // comment
a: 1
});
Prettier moves the comment to a new line which is not what I want.
const thing = await call({
// comment
a: 1
});
How do I prevent this from happening while retaining all other format settings?
EDIT: I do not want to use another formatter or // prettier-ignore. I need this done from the config file .prettierrc.json
This is a known issue with Prettier. If you're looking for the corresponding bug/feature request, it's here: https://github.com/prettier/prettier/issues/807
I'm pretty sure there is no way to configure this in .prettierrc, as prettier is opinionated. Though this kind of moving of comments to new line only happens when it appears beside opening brackets. If it really annoys you, you could change to a different linter, such as eslint, which to my knowledge does not do the above.
In my experience, you can specify certain areas of your code for prettier to ignore in the .prettierignore which uses the same syntax as a .gitignore. You can also ignore specific comments as this section of their documentation.

Kate Text Editor regexp for CNC code alteration on PC

When using some CAM software, the CNC code is usually generated properly with spaces.
But for example when moved to "Citizen Cincom L20" machine via USB or network and edited there it lose spaces and also lose semicolons while preserving new lines which does work as semicolons anyway.
But since editing of CNC program happens in 3 places: CAM Software(ESPRIT in this case), CNC machine controller and also via text editor on the computer as postprocessor in ESPRIT is garbage.I've come up with this regex
([0-9]{1,2})([A-Z])
\1 \2
so
G1G99X5.4Z-.5F.12
Becomes
G1 G99 X5.4 Z-.5 F.12
that works in Kate to space everything back again for clearer reviwing of code. The only issue about it is that I need to do that manually for every file and I would like to automate it, preferably via Kate, so it would happen upon opening any ????.PRG plain text files.
But I do not exactly know how such happening should be called is it like macro or what ?
I'm looking for some suggestions to accomplish this. Or maybe some alternative solutions
First, go to View -> Tool Views -> Show Search and Replace. You will see
Make sure you:
Enable {} regex option on the right as you are using a regex
Enable "AB" option on the right that enables case sensitive matching
Select In Folder value from the dropdown on the right
Fill out the regex, replacement, Folder and the Filter fields with the appropriate values
Click Search button.
You will see the results in a separate pane and Replace / Replace Checked buttons will become enabled.
Review the replacements and click Replace Checked:
Then you may check the updated file contents, and if you are satisifed with the results, use Save All, also by pressing CTRL+L.

disable printWidth on prettier

Is there a way to disable the printWidth rule warning in prettier?
I want to be able to determine my own line length for readability. In certain cases I want a line break, and in other cases I don't.
I tried this in my .prettierrc file :
{
"singleQuote": true,
"printWidth" : "off"
}
But this does not work.
The short answer is no, you cannot disable it entirely.
There are, however, a few workarounds, but they have caveats.
To quote an answer from this issue on github: https://github.com/prettier/prettier/issues/3468.
printWidth is not a rule but an input into the algorithm they use to generate their output. Meaning, it is required to be there.
One workaround is to set printWidth to a really high number, but although this will prevent lines from breaking, changing this property will affect your entire codebase, causing other lines throughout it to combine into a single line, which is most likely not desired.
Your second option is to disable prettier for a block of code with the // prettier-ignore syntax. The downside to this is that you'll disable all prettier features for this section of the code. Also, I personally don't find it very "clean" to have comments like that all over your code.
You can read about how to use the ignore functionality here: https://prettier.io/docs/en/ignore.html
If you want to disable prettier rules once, just do:
// prettier-ignore
const date = new Date() // prettier disabled on this line

How to customize Sitecore workflow Comment box

I am working in Sitecore 7 and want to customise the comments textbox. I need following functionality:
Instead of Single line, I want to replace it with multiline.
Is it possible to have rich text box instead of single line to allow users to put more meaningful comments and those are visible in History too.
You have to modify a lot to do it. When you approve button is called this command :
<command name="item:workflow" type="Sitecore.Shell.Framework.Commands.Workflow,Sitecore.Kernel"/>
with some parameters
Inside this class you have next method :
protected void Run(ClientPipelineArgs args)
{
...
where you find next lines of code that is called to show single line input :
...
if (!flag1 && flag2 && !flag3)
{
SheerResponse.Input("Enter a comment:", "");
args.WaitForPostBack();
}
Yes, this is possible, but you'll have to essentially recreate and replace some basic functionality to do it. And worse... it will require use of SheerUI, which is not documented anywhere from Sitecore that I know of. You have to figure it out by disassembling existing code. If you look at Sitecore's implementation of say, the Approve action, you'll see there is a SheerUI call to get the comment text. (not looking at it right now, so I don't know exactly where this is) You'll need to replace this with a SheerUI call to load your own custom dialog. How do you do this? Well... man, wouldn't documentation on this be nice?

Is it possible to use different tags files for omnicomplete and general tag browsing in Vim?

I've been using ctags in Vim for years, but I've only just discovered omnicomplete. (It seems good.)
However, I have a problem: to get omnicomplete working properly I have to use the --extra=+q option when generating the tags, which is fine, but this then changes the behaviour of general tag browsing in ways that I do not like.
For example, when tab-completing tag names in Vim I don't want to tag "into" the "hierarchies" of classes - that is, when tab completing "Clas" get "ClassA, ClassA::var1, ClassA::var2, ClassB", instead of "ClassA, ClassB" - but that's what happens when using --extra=+q.
So I guess I'm after one of two things. Either:
1. The ability to disable tab-completing into "tag hierarchies" even though those hierarchies do exist in the tags file. Or,
2. The ability to use differently named tags files (ie. generated with different options) for omnicomplete and general tag browsing.
Any ideas would be much appreciated!
Cheers,
thoughton.
OK, I think I've actually come up with an answer to my own question.
Firstly, I generate two tags files: tags_c_vim and tags_c_omni.
In my _vimrc I have:
let tags_vim='tags_c_vim'
let tags_omni='tags_c_omni'
exe "set tags=".tags_vim
to setup some variables pointing to the different tags files, and to set the "vim" tags to be the default tags.
Then I also have this, again in the _vimrc:
imap <F8> <ESC>:exe "set tags=".tags_omni<CR>a<C-X><C-O>
autocmd InsertLeave * if pumvisible() == 0|exe "set tags=".tags_vim|endif
the first line here maps F8 so it changes the tags setting to point to the "omni" tags before then invoking the omnicomplete popup menu, and the second line resets the tags setting to the "vim" tags when insert mode is next left after the popup has closed.
It's going to need some extensive use to make sure it's robust enough, but it does seem to work after some quick testing.
Two improvements I'd still like to make:
Map the setting of the "omni" tags to the omnicomplete C-X,C-O command instead of a new F8 mapping. (I think I need to set the tags and then call omni#cpp#maycomplete#Complete(), but I couldn't work out how to do this)
Hook the resetting of the "vim" tags into either omnicomplete itself finishing or the popup menu closing
Anyway, I just thought I'd share.
Cheers,
thoughton.
You could try the OmniCppComplete plugin.