I use :match to highlight problems with my code that don't meet style guidelines. The following works great for the first window I open in Vim:
~/.vimrc:
hi ExtraWhitespace ctermbg=red guibg=red
hi NoFunctionSpace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$\| \+\ze\t/
2match NoFunctionSpace /\S(/
However, when I go to :tabedit a file, or if I open Vim with the -p option and multiple files, only the first window highlights matches. I want all of my open tabs to show matches.
The :match commands only apply to the current window. To automatically apply them to each new window, hook them into the WinEnter event:
autocmd WinEnter * match ExtraWhitespace /\s\+$\| \+\ze\t/
autocmd WinEnter * 2match NoFunctionSpace /\S(/
You still need the original :match commands, too, because the WinEnter event isn't fired for the initial window.
Related
So I know autocomplete works great when you start typing a value. For example, the second you type the "c" in text-align:center, the available autocomplete values pop up (such as center, left, right).
However, when I used Dreamweaver, for properties with specific value options like text-align (center, right, left), display (block, inline-block), cursor (pointer, default), etc., the autocomplete popup would show immediately after the property was typed, it did NOT wait until I started typing a value. Right after text-align: was typed out, it would show me the autocomplete popup giving me the options center, right, left.
The value autocomplete should fire right after my property autocomplete fires:
So after I type te...
the autocomplete popup for "te" properties displays text-align, text-decoration, text-shadow etc....
then I press Enter to select text-align...
then immediately after pressing Enter an autocomplete popup should show for the text-align values: center, left, right.
Any idea how this can be accomplished in Sublime Text 3?
You can get ST to show the autocompletion popup again straight after a completion has been inserted using a small plugin and some preferences:
With a CSS file open in ST, open the Preferences menu and select Preferences - Syntax Specific. Add the following to the settings on the right hand side:
"auto_complete_triggers":
[
{
"characters": ": ",
"selector": "source.css meta.property-list.css meta.property-value.css"
},
],
and save it. This will tell ST to show the autocomplete popup automatically in CSS files when typing a : or a space when the syntax expects a property value.
Now, unfortunately, ST doesn't consider an autocompletion to have "typed" anything, so this trigger isn't fired automatically when selecting a property value like text-align from the autocomplete popup, which inserts text-align:. So, to get round that, this is where we need a small plugin. From the Tools menu, choose Developer -> New Plugin...
Select all text and replace with the following and save it, in the folder ST recommends (Packages/User/) as something like show_autocomplete_after_completion.py:
import sublime
import sublime_plugin
class AutoCompleteListener(sublime_plugin.EventListener):
def on_post_text_command(self, view, command_name, args):
if command_name in ('commit_completion', 'insert_best_completion'):
act = view.settings().get('auto_complete_triggers', [])
scope = view.scope_name(view.sel()[0].begin())
char = view.substr(view.sel()[0].begin() - 1)
for trigger in act:
if sublime.score_selector(scope, trigger['selector']) > 0:
if char in trigger['characters']:
view.run_command('auto_complete', { 'insert_best_completion': False })
break
This plugin basically detects when a completion has been inserted (although due to a limitation of the ST API, it can't detect when you click on an entry with the mouse - see https://github.com/SublimeTextIssues/Core/issues/1166), and if the text/character immediately before the caret matches one of the autocompletion triggers defined in the settings, then it will show the autocomplete popup again.
You can try out this package. This package indexes your .less and .scss (or .sass) and caches your mixins, variables, class or id names and autocompletes both on html and css. It autocompletes your less and sass mixins with mixin arguments. It also supports emmet completions and gets your css classes on popup window. -
https://github.com/subhaze/CSS-Extended/
How to remove colon in Emmet+Stylus in JetBrains IDE?
For example, I type mb10 + tab and get margin-bottom: 10px
but it mast be a margin-bottom 10px (without the colon :)
How to disable it?
Currently it is not possible unfortunately.
https://youtrack.jetbrains.com/issue/WEB-15575 -- watch this ticket (star/vote/comment) to be notified on any progress.
the auto-completes that emmet give's you for somethings like mb10 or ovh or bd10 are coming from a fuzzy search result, and I'm almost sure that It's not editable (at least in an easy way)
but you can change somethings about emmet, and in your case
It's done in this way
CTRL + ALT + S (open's up settings panel)
go to the path editor > CodeStyle > liveTemplates
expand Zen CSS
scroll down and find mb, click on it
at bottem of settings panel you should be able to see a field called Template text
change It to this margin-bottom $VALUE$;
click on ok and it's done
if you do mb + tab the output would be margin-bottom ; with the caret instead of $VALUE$ , so you can insert it then and get out of it easily by tab key
but as I said , its not responsible for something like mb10 , because it's referring to a fuzzy search
I have Sublime Text 2. When I begin typing <d a dropdown suggests autocomplete for . Hitting enter will complete the tag and even add the ending tag </div> and place the cursor between the tags. Perfect. If I hit enter again twice, I get this setup:
<div>
|</div>
But now when I go up one row to the blank row in between and hit tab, instead of indenting on the line between the tags, the cursor jumps to the end of </div>.
What I can do is hit enter once when I have <div>|</div> and then hit left to return to the end of <div>and enter again to go to a new auto-indented line.
How do I get this auto-indentation behavior to work when hitting enter in the <div>|</div> situation?
The problem you are having is that when pressing tab your are moving to the next tab stop in the snippet. That is the expected behaviour.
Snippets are tools for helping you write code faster. Those snippets can have multiple cursor positions called tab stops. You move between those positions by hitting tab. So when you hit enter to create those lines, and then tab, you are moving the the next tab stop in that particular snippet.
Sublime Text allows for deep customisation. You could change your auto indent settings, or create your own snippet.
This snippet should do what you are after. Save this as div.sublime-snippet into your User folder (in the packages folder accessed from Preference > Browse Packages) .
<snippet>
<content><![CDATA[
<div>
$1
</div>$0
]]></content>
<tabTrigger>div</tabTrigger>
<scope>source.html</scope>
<description>My own div snippet</description>
</snippet>
After doing this, you will have a new option in that dropdown auto complete menu. Usually you will only have to write div then press tab and voila.
I really like how Emmet generates HTML based on 'CSS-like' strings but I don't want to use their CSS Abbreviations. Cause when I write a piece of css as follows:
li a|
And I press 'TAB', I want to get a Tab
li a |
But with Emmet I get the following when I press Tab
li |-webkit-appearance: none;
-moz-appearance: none;
appearance: none
How can I disable this functionality of Emmet?
In Emmet.sublime-settings you have to update disable_tab_abbreviations_for_scopes property: add source.css to disable Tab trigger completely in CSS.
Also, if you’re on ST2, you may want to take a look at disable_tab_abbreviations_for_regexp preference due to some bugs in ST2 scope matcher.
If you installed with package control, search for Package Control: Remove Package in the command palette. Otherwise you can just remove the Emmet directory.
If you wish to use a custom caption to access commands, create Default.sublime-commands in your User folder. Then insert something similar to the following.
[
{
"caption": "Package Control: Uninstall Package",
"command": "remove_package"
}
]
Of course, you can customize the command and caption as you see fit.
Or try like this: CTRL + SHIFT + P >> Remove Package >>
Select package to remove then press enter
Instead of pressing Tab, you can use Shift+Tab to insert a tab without triggering the tab trigger.
It’s documented in the Sublime Text documentation.
Preferences.sublime-settings - toggle on/off is there.
Anyone know how to change the default font size when you open a new XTERM windown in Cygwin?
I have found references of putting information into the ~/.Xresources file but that file doesn't exist for me...
Thanks
here is how I fixed it:
Make sure your are in your home directory, so "cd" and "pwd" to see that you are there
Create the .Xresources file, just like "touch .Xresources"
Edit it with your favourite editor ;)
Here is my set up, it is actually very useful, it includes a side bar, and removes the top bar:
Xft*antialias: true
Xft*autohint: true
XTerm*background: black
XTerm*foreground: grey
XTerm*cursorColor: grey
XTerm.vt100.geometry: 79x25
XTerm*scrollBar: true
XTerm*rightScrollBar: true
XTerm*saveLines: 10000
XTerm*faceName: BitStream Vera Sans Mono
XTerm*faceSize: 12
XTerm*toolBar: off
You can test this changes with "xrdb -merge .Xresources" and then opening another xterm
In order to save this changes you are going to have to create or modify another file, "touch .startxwinrc", open up your editor and include the following:
#!/bin/sh
xrdb -merge ~/.Xresources
Restart your XWin Server, and you will have a prettier cygwin terminal.
Gonzalo you made my day with your fix.
The font size can also be dynamically changed with the following keyboard shortcuts:
Shift+NumPadPlus = Increase font size
Shift+NumPadMinus = Decrease font size
Please take in account that the new font size is active for the current xterm window and that it is active for the current process session only. A new process will start with XTerm*faceSize sized fonts.
Around ~2015 XWin Server was overhauled and you no longer need to create .startxwinrc because it no longer exists. I found that the ~/.Xresources is read in automatically. Also I found that XTerm.vt100.geometry is not valid anymore.
This is my .Xresources:
Xft*antialias: true
Xft*autohint: true
XTerm*background: white <== These settings mimics
XTerm*foreground: black the default back, fore
XTerm*cursorColor: grey and cursor colors
XTerm*scrollBar: true
XTerm*rightScrollBar: false <== This causes the scroll bar to be
on the default left side
XTerm*saveLines: 10000
XTerm*faceName: BitStream Vera Sans Mono
XTerm*faceSize: 12
XTerm*toolBar: On <== This causes the menu bar to appear with
Main Options, VT Options, and VT Fonts