I would like to view whitespace characters in Sublime Text 3, except for single spaces between words.
For example, in VS Code this is enabled by the setting "editor.renderWhitespace": "boundary", and looks like this:
I'm aware of the built-in ST3 setting "draw_white_space": "all/none/selection", which does not accomplish what I'm looking for. I've tried the package Highlight Whitespaces which almost does what I want - but rather than highlighting the space, I'd like to just view the "dot" to show the "invisible" space character.
Related
I would like to select matching parentheses/braces/brackets in Sublime. I don't mean to select the text between them, I mean just them; parentheses. So you can change one type to another without going back and fort. Its like having 2 cursors at the same time on them.
Check out the BracketHighlighter plugin in Package Control. Among other features for highlighting various types of bracket pairs and tags, it includes:
Bracket plugins that can jump between bracket ends, select content, remove brackets and/or content, wrap selections with brackets, swap brackets, swap quotes (handling quote escaping between the main quotes), fold/unfold content between brackets, toggle through tag attribute selection, select both the opening and closing tag name to change both simultaneously, etc.
I've used some of the features of this plugin in the past and I really like it. The author is also very responsive to bug reports and feature requests.
It appears, surprisingly, that more self-selected SO devs prefer to indent via tabs rather than spaces. Some people brought up the argument that you can use tabs to indent, and spaces to align. In theory this sounds cool, but in practice I suspect it would be more of a pain than anything, seeing as you can't see which character you have (unless you like turning on that sort of thing).
So I had an idea - why not the editors? Why shouldn't editors let you configure the number of spaces you're going to use to indent, but also the appearance of those spaces. That is:
Normal:
class MyClass:
____def myfun():
________somevariable = 42
________volts = 40000000 # If you're into that sort of thing.
________________________________# Not well-formatted Python, though.
Leading indent set to appear as 2 spaces:
class MyClass:
__def myfun():
____somevariable = 42
____volts = 400000000
Is it possible to do something like this with vim? I know it's totally possible to write a post-open/pre-save command to replace the contents, which might work the same... but I'm more curious if it's possible, in vim, to make it appear as though the leading spaces are less (or more) than they actually are?
Yes, you can, using the conceal feature. Demonstration (using the markup from your example text and a different replacement character instead of spaces for effect):
:syntax match Indent "\%(^\%(__\)*\)\#<=__" conceal cchar=#
:set conceallevel=2 concealcursor=nvic
The pattern matches every pair of __ at the beginning of the line, and replaces (conceals) each with a single #, effectively reducing the visible indent.
As a purely visual feature, I don't find it very useful though, and would prefer the post-open / pre-save solution you seem to be aware of.
I am working on a sql file with some m4 macro embedded. Since m4 uses apostrophe to mark the start of string literals, it breaks the string highlighting of the file totally. Like
m4_include(`SQLCommon.m4')
I am wondering whether there is any option we can let vim to pair apostrophe with a single quotation mark. I searched on-line but didn't find any answer.
Thanks!
You're going to want to override vim's normal syntax highlighting for sqlString.
I was able to get the behavior I think you're looking for with just this:
:syntax region m4String start=/`/ end=/'/
To achieve nesting, we have to tell vim that a m4 string can contain more of the same:
:syntax region m4String start=/`/ end=/'/ contains=m4String extend
If you'd like to color those strings separately instead of just disrupting the normal highlighting you can separately link to the String highlight group.
:hi link m4String String
I wasn't entirely sure what you were looking for though; if the backtick-apostrophe delimited strings are inside of the normal SQL strings this won't work.
Is there a way to highlight special whitespace characters like nbsp in Sublime Text 2? Several times I copied text from word users to my code and it crashed because I couldn't see these "illegal" whitespace characters...
Thanks!
Chris
Here is a plugin for Sublime Text that does the job:
https://github.com/possan/sublime_unicode_nbsp
You can comment out lines 125 and 126 if the highlighting of trailing whitespaces annoys you.
Edit your user settings as below (you may go into "Preferences->Settings Default." or "Preferences->Setting User." depends on whether you've already had some customized settings) :
{
"color_scheme": ...,
"font_size": ...,
"draw_white_space": "$your_selection"
}
The rule to set the setting is:
Set to "none" to turn off drawing white space
Set to a list to draw only the white space within the list
Set to "all" to draw all white space
In vim, vip selects "inner paragraph" :help v_ip,
however it is of limited use.
vim paragraph boundary is hard coded, a
paragraph is separated by 2 or more blank lines.
:help paragraph
Some archaic marcos like .IP, also seem to be supported as
paragraph separators, but it is all hard coded.
I want to specify my own paragraph separators to easily
select paragraphs of text in vim.
Like perl in paragraph mode using an regexp splitter.
I tried setting paragraphs to be delimited by blank lines or braces:
:set paragraph+={ cpoptions+={
but does NOT work as documented,
braces are ignored by 'vip' selection command.
The solution I want should work for all paragraphs commands
like vip, vap, dip, dap, {,}.
Note how you can map operators, so you won't have to remap vip or vap (you could map aH to your movement operation - and all of the following work magically using your selections:
daH
vaHy
d2aH
etc
I don't know if it's an option for you, but you can change paragraph delimiting in certain way by including the 'w' flag in 'formatoptions'. Check out help for 'fo-table' to read more. Basically it makes it so that lines ending in a space are like 'soft returns' and lines ending in a non-space character mark the end of paragraphs. Empty lines are not markers at all in this case. The 'w' formation flag does work with all vip, vap, etc., if I recall.
If that isn't going to do the trick for you, then I suggest remapping the vip, vap, etc. sequences to a custom function of your own. That way you can set it up to select things exactly as you want.
See :help paragraphs.
'paragraphs' 'para' string (default "IPLPPPQPP TPHPLIPpLpItpplpipbp")
global
Specifies the nroff macros that separate paragraphs. These are pairs
of two letters (see object-motions).