I have a large code base that I want to standardise the indent width for.
How can I do this with clang-format without making other changes?
Passing -style='{IndentWidth: 2}' to clang-format
makes other changes to the source files as -dump-config implies.
clang-format doesn't support that at all. You might get somewhat close to that by setting "ColumnLimit: 0" which will make clang-format accept the existing line breaks to a certain extent.
Related
I am trying to configure dart to let the operator . appear on the same line.
I am not having any success on configuring it to do that.
It currently looks like this
I would like colors.removeLast() and colors.length to be each on one line.
So it should be like
do
{
colors.removeLast();
}
while(colors.length > 0);
Any suggestions on how I can make that happen ? Which settings do i need to change ?
Increase line length. The function call is being placed on the new line as the line cannot be longer than 20 (or so) symbols. Increasing this value will prevent IntelliJ IDEA to find ways to fit the text.
See the difference:
As the title says, I'm trying to get clang-format to remove the trailing white spaces of my files, but I fail to find the relevant option name.
Could anyone point me to the obvious?
clang-format does remove trailing whitespaces automatically.
You can test this by e.g. clang-format -style=Google file.cpp -i.
It is also useful to know most modern editors do have built-in options to do this and even more for you on save. Here are a few:
In Sublime text settings set trim_trailing_white_space_on_save to true.
In VScode set files.trimTrailingWhitespace to true.
In Vim you need a vimrc file as described here.
etc.
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.
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)
I tried redefining the \FancyVerbLine to have a \large, but that didn't help. Is there another way to do this?
That should do the trick. How exactly does your \FancyVerbLine look like? Notice that it’s not enough to put the formatting in – you also need to include the counter command:
\renewcommand\theFancyVerbLine{\large\arabic{FancyVerbLine}}
This should work.