Wrap comments like Vim's gq command in VS Code - editor

For some projects I use Visual Studio Code. One thing that is bugging me is that I can't quickly format comment blocks like Vim's gq command.
For those who don't know Vim, the gq command works where you select/highlight a line or lines like this one:
// This is a really really long line right here
And it makes it like this
// this is a really
// really long line
// right here
Based on your ruler settings (mine is 80 so it would wrap on any words that go past 80.

This extension should work for you:
https://marketplace.visualstudio.com/items?itemName=stkb.rewrap

It has been supported by VSCodeVim.
See https://github.com/VSCodeVim/Vim#-vscodevim-tricks for details.
You can also set the width to word-wrap when using gq by vim.textwidth. It can be found at https://github.com/VSCodeVim/Vim#vim-settings.

Related

Powershell Formating inconsistency

OK, this may seem extremely silly but....
I use VSCode as a notepad and and terminal window. I created a myFunctions.ps1 file and placed all of my frequently used functions in that file. I call that file from my profile.ps1 so they are available.
I created a function that works properly. Even the predective tab-complete finds the function in the terminal window. All of my other functions format properly. For somer eason, it won't appear color-formatted (in green) like the other funcrtions do. Here is what it looks like. The top frame is a file called PowerShellCmdletLibrary.ps1. Basically a notepad of all my commonly used one liners and such. Notice in the text, my list of functions, all fuinctions are formatted Green except Replicate-AllDomainController
Does anyone know what that might be? Silly and petty I know but just a tad annoying (killing my OCD, lol)
Tony enter image description hereenter image description here

NBConvert PDF/Latex page formatting IPython

Got some good advice on suppressing code and other items on NBConvert output,, Here Suppress code in NBConvert? IPython
BUT: now It seems I need to change top and bottom margins And I can see that it seems that it may be set in the sphnix template, (if I even know where it is), which I don't want to mess with but I cannot figure out how to edit the Latex output to get at the margins I attempted to place this in the import headers
\usepackage[margin=0.5in]{geometry}
But nothing happened.. I know squat about latex I am using the TexStudio package to modify the Latex output of NB convert, but at this point I don't see something to modify for margins...
I'm trying to touch up some page flow issues involving placement of output graphs that are just too big so I end up with big ugly blank spots,, pretty sure that if I can get at the margins I can...
To change the margins using your proposed code, you have to put this line after the other inputs, e.g. about line 71. If you put it at the top, it will be overridden by another call. With my notebook this works fine.
I'm pretty sure you know you can specify different margins using
\usepackage[left=0.5in, right=0.5in, top=0.5in, bottom=0.5in]{geometry}
see e.g. wikibooks.
Btw. be aware that the sphinx based templates are removed in current master. The new templates are much more customizable and remove some issues due to the mdframed packages (GitHub Issue)

Notepad++: block comment not working

I am running Notepad++ 5.8.5 on Windows 7, editing Perl programs.
I would like to comment out a block of text lines (and later, perhaps, uncomment it).
None of the following works:
CTRL+K, CTRL+Q, CTRL+shift+K, CTRL+shift+Q,
selecting the block of lines and going to the menu: edit-> Comment/Uncomment -> Block Comment
none of the above has any effect.
What to do?
Is NP++ interpreting your file as Perl or plain text?
If NP++ is treating your file as plain text, then language specific things like that won't work.
You may want to double-check that as described here.
Why not try updating to a newer version? That's horribly out of date (a year old).
Define your own language to match to the file extension, in your case it is: txt
and then define any comment style you want. Then close and open NP++ again. Enjoy!
Path: Language--->Define your Language --> Comments & Number tab
Hank Wei

Pretty Print for (Informix-)4gl code

i'm searching for a pretty print program (script, code, whatever) for Informix-4GL sources.
Do you know any ? Than you, Peter.
Have you looked at the IIUG (International Informix User Group) software archive? There are two pretty printers there (of indeterminate quality).
The other place to look would be the Aubit4GL site - an open source variant of I4GL. Again, I'm not sure that they have a pretty-printer, but it might be something they have (though a casual check doesn't show one).
I don't know if anyone is reading this post anymore, but the easiest way to get some kind of nice "pretty print" of 4gl code is to view it in the Openedge Developer Studio, then use ctrl-I to set indention. You can adjust indention in the editor settings by saying the length of "tabs". (default is 4, I use 3)
Then do a ctrl-shift-f to make all command words uppercase.
Next, you can condense the code a few lines by moving all the "DO:" statements up a line next to the "THEN" statement with this regular expression search and replace.
ctrl-f:
search "\s*\n\s*DO[:]"
replace " DO:"
make sure you click the checkbox marked regular expressions.
At this point the code is nice and tidy.
Do a ctrl-a and ctrl-c to copy it to the clipboard.
paste it in Outlook as an email without sending. Print it in color.

Adding MS-Word-like comments in LaTeX

I need a way to add text comments in "Word style" to a Latex document. I don't mean to comment the source code of the document. What I want is a way to add corrections, suggestions, etc. to the document, so that they don't interrupt the text flow, but that would still make it easy for everyone to know, which part of the sentence they are related to. They should also "disappear" when compiling the document for printing.
At first, I thought about writing a new command, that would just forward the input to \marginpar{}, and when compiling for printing would just make the definition empty. The problem is you have no guarantee where the comments will appear and you will not be able to distinguish them from the other marginpars.
Any idea?
todonotes is another package that makes nice looking callouts. You can see a number of examples in the documentation.
Since LaTeX is a text format, if you want to show someone the differences in a way that they can use them (and cherry pick from them) use the standard diff tool (e.g., diff -u orig.tex new.tex > docdiffs). This is the best way to annotate something like LaTeX documents, and can be easily used by anyone involved in the production of a document from LaTeX sources. You can then use standard LaTeX comments in your patch to explain the changes, and they can be very easily integrated. If the document lives in a version control system of some sort, just use the VCS to generate a patch file that can be reviewed.
I have used changes.sty, which gives basic change colouring:
\added{new text}
\deleted{old text}
\replaced{new text}{old text}
All of these take an optional parameter with the initials of the author who did this change. This results in different colours used, and these initials are displayed superscripted after the changed text.
\replaced[MI]{new text}{old text}
You can hide the change marks by giving the option final to the changes package.
This is very basic, and comments are not supported, but it might help.
My little home-rolled "fixme" tool uses \marginpar where possible and goes inline in places (like captions) where that is hard to arrange. This works out because I don't often use margin paragraphs for other things. This does mean you can't finalize the layout until everything is fixed, but I don't feel much pain from that...
Other than that I heartily agree with Michael about using standard tools and version control.
See also:
Tips for collaboratively editing a LaTeX document (which addresses you main question...)
https://stackoverflow.com/questions/193298/best-practices-in-latex
and a self-plug:
How do I get Emacs to fill sentences, but not paragraphs?
You could also try the trackchanges package.
You can use the changebar package to highlight areas of text that have been affected.
If you don't want to do the markup manually (which can be tedious and interrupt the flow of editing) the neat latexdiff utility will take a diff of your document and produce a version of it with markup added to visually display the changes between the two versions in the typeset output.
This would be my preferred solution, although I haven't tested it out on large, multi-file documents.
The best package I know is Easy Review that provides the commenting functionality into LaTeX environment. For example, you can use the following simple commands such as \add{NEW TEXT}, \remove{OLD TEXT}, \replace{OLD TEXT}{NEW TEXT}, \comment{TEXT}{COMMENT}, \highlight{TEXT}, and \alert{TEXT}.
Some examples can be found here.
The todonotes package looks great, but if that proves too cumbersome to use, a simple solution is just to use footnotes (e.g. in red to separate them from regular footnotes).
Package trackchanges.sty works exactly the way changes.sty. See #Svante's reply.
It has easy to remember commands and you can change how edits will appear after compiling the document. You can also hide the edits for printing.

Resources