Prevent Sublime Text 3 from tab completing 'sup' to '<sup>' in a non-HTML file - sublimetext3

When I type sup then TAB in Sublime Text 3, I get <sup>. That isn't what I want; I only want tab completions based on what is in my current file.
How can I limit tag style tag-completions to just HTML files?
I was hoping to find a setting called tag_complete_file_extensions or similar.
I don't currently understand the implications of these default preference settings, but they don't look like what I want:
{
// Controls what scopes auto complete will be triggered in
"auto_complete_selector": "source - comment, meta.tag - punctuation.definition.tag.begin",
// Additional situations to trigger auto complete
"auto_complete_triggers": [ {"selector": "text.html", "characters": "<"} ],
}
At the least, I'd appreciate an answer pointing me in the right direction. I don't mind forking a package or writing some custom code.

I believe this behaviour is provided by the Emmet (formerly ZenCoding), or similar package and not sublime directly.
Are you sure syntax is set accordingly for the files you get html tag completion?
By default Emmet detects that you are working on html files and enables tag completion (in my case I did not have to configure anything to get this functionality). You should have a closer look at your packages and your configuration and possibly update existing ones.
If you need any further help with the configuration files, I'm happy to help!
Cheers!

Related

control+/ does not work to comment multi line in sublime 3

I can't comment out multi line in sublime 3. Looked at this Keyboard shortcut to comment lines in Sublime Text 3 already but it is not fixing it
Sublime version is 3.2.1 build 3207 . on windows 10.
Please help me out if have any tips.
The keyboard binding for commenting is indeed Ctrl+/ (Cmd+/ on MacOS) so in the general case what you're trying should work just fine.
That said, the keys in question are bound to the toggle_comment command and that command requires language specific metadata to know what comments are supposed to look like. For example comments look and work differently in HTML than they do in C or JavaScript. Some file types (such as plain text files) aren't code and thus don't have a concept of comments at all.
If the metadata file for a file type is missing, then the toggle_comment command won't do anything because comments are assumed to not be valid, which seems to be what's happening to here.
The first thing to check would be to examine the bottom right of the window to see if Sublime agrees with you about what the file type is supposed to be. For example, newly created tabs are Plain Text files until you save the file for the first time, and comments are not allowed in Plain Text files.
If the file type doesn't say what you think it should, you can click it to open a menu and select the appropriate type for that file.
If the type of the file looks to be correct and the command still doesn't work, then the metadata file needed is not being provided in the package that is adding support for that language. In that case you should raise an issue with whoever is responsible for the package in question and get them to add the appropriate file.
Based on the comments on your question, you think you're editing JavaScript files but Sublime thinks you're editing an ActionScript file instead. The JavaScript package includes the appropriate file, but the ActionScript package does not.
So in your particular case, your best bet is to switch the file type to JavaScript and your problem should go away. If you actually want to be editing ActionScript instead, then you need to create an issue on the Default package tracker and ask for this to be added.

How to change VIM PHP auto formatting options

I have tried googling this extensively, but all I can find are plugins which format code in the author's preferred way. What I would like to do is change the auto format options so that I can setup VIM to use the same formatting as the other editors my team uses.
For example, I would like:
public function test($param)
{
// code here
}
rather than:
public function test($param){
// code here
}
or
public function test($param)
{
// code here
}
Is this possible without a plugin? Are there formatting templates somewhere that I can edit? Thanks :)
Is this possible without a plugin?
Yes.
Are there formatting templates somewhere that I can edit?
Sure. Vim is the most customizable text editor in universe. :)
So, let's start understanding snippets.
Snippets are blocks of text that can be inserted in your text using some pre-defined keys. The idea of snippets is to easily put in your file some chunk of text you use often. Snippets are these "templates" you mentioned.
To use snippets with Vim, you need to install the garbas/vim-snipmate plugin. You probably had it installed, since it seems that you can use them. This plugin search in you .vim folder for .snippets files and open them every time you open a file with predetermined extension. For example, when you create the foo.html file, vim-snipmate plugin searches for the html.snippets file and load it. After that, everytime you type, for example, html and press tab, Vim will write the <html> tag, because in your html.snippets file there's a snippet telling Vim to do so. Every programming language needs its own .snippets file, and loads it at the start. It's common to have a _.snippets file too, that loads with all file extension. It's a global snippet file.
To edit your snippets, you have to find where are your .snippets files. In Linux, open your terminal and type:
cd ~/.vim
find -name *.snippets
And then you'll see where are your snippet files. Assuming they are ~/.vim/snippets, for example, you open your java snippets with a:
vim ~/.vim/snippets/java.snippets
A .snippets file commonly looks like this: java.snippets file
These +-- lines are compressed lines you can expand and contract typing za in normal mode. In the blue line you always see snippet something written. The something is the shortcut you need to type and press tab when you're editing a file to use the snippet. For example in this java.snippets file there is a snippet called snippet po. So, when you're editing a java file, type po and press tab, Vim will inserted protected {}.
Snippets have a simple language, you can understand a lot just by seeing them in the .snippets file and typing them in another one. If you want to understand more about creating snippets, Google about vim snippets, and you'll find lots of stuff about it.
If you find that you don't have snippets in your .vim folder, or have insufficient ones, you can install a lot of excelent scripts with the honza/vim-snippets extension on Github.

Looking for a package for sublime like task list in notepad++?

The package should work as:
I specify a word
The package open a (dock) window, show all lines in the source file that have the word.
I could use the lines in dock window to jump between the source file.
Thank you!
Not really sure what the task list in notepad++ is like, but it sounds like you want something to search for TODO entries. Take a look at https://github.com/robcowie/SublimeTODO. Though assuming your tagging is accurate, you are using ST3, and this plugin has not been ported. If that is true, you may want to check out https://github.com/dnatag/SublimeTODO, which is supposed to provide the ST3 compatibility. Note I haven't tested it, but based on some of the comments in the pull request, it seems like it might work.

Opening the header file to a C/C++ source file with vim from multiple directories and multiple extension

First off, I was about to write a long list of if/else statements in vim and realized that 1) there was a better way to do what I was trying to do and 2) SO would be ripe with help on the subject. So! I have a variety of files spread about like
foo/src/file01.C
foo/src/file02.cc
foo/src/file03.c
foo/include/file01.hh
foo/include/file02.h
foo/include/file03.h
If you notice that the C/H, cc/hh, c/h extension may or may not match then you are keen and I'd like you to please help. I've look at things like the following vim scripts from the Vim wiki for "Easily switch between source and header file" and although I only dumped a few hours into a.vim without success, it doesn't seem that the others would work via the docs on that page. So can anyone help out on how to make this work?
A good lead I had was a quick How to Easily Switch between Header and Source topic, but still couldn't make it work.
I guess what I really want is how to avoid the multiple if statements and use real matching to do what I want. I want to look into another directory and if look for a header file of the same name with any familiar extension if it was a source C/C++ file, or look for a source file of any regular extension if it was a header file. Thanks for your help!
UPDATE: I specifically want to open the file in a new tab. I live on vim tabs!
I recommend using the FSwitch plugin. https://github.com/derekwyatt/vim-fswitch
This does exactly what you need out of the box. It is better than a.vim in more than one way, being a rewrite of the idea behind a.vim.
The link you posted presents it as a solution, too.
I have just installed it to my vim configuration and it does its job well.
Enjoy.
Just to make sure I was using the most current version, I downloaded the latest a.vim script (2.18) and copied it into my ~/.vim/plugin directory.
You can define certain variables in your ~/.vimrc file to get a.vim to recognize alternate file extensions.
To get the files in your example to match their alternates I added the following to my ~/.vimrc:
let g:alternateExtensions_C = "H,hh"
let g:alternateExtensions_hh = "C"
These are global variables that allow you to override what's already defined. You'll have to define
both relationships (they don't work both ways).
You can see what the current mappings are by typing:
:echo g:alternateExtensionsDict
If you need to define other mappings, follow the same pattern. What comes after the underscore is the file extension you're editing. What's in the double quotes is a comma-separated list of alternate extensions.
let g:alternateExtensions_<ext> = "<list,of,alt,ext>"
If you have a different directory structure, you can define what paths to search by overriding the g:alternateSearchPath variable. ../src and ../include are already included by default.
:echo g:alternateSearchPath
To open the alternate file in a new tab:
:AT
By the way, the a.vim script is pretty well documented. You might want to open it up and take a look. I found a setting or two that I didn't know about and I've been using it for years ;o)
I hope that helps.
IMO your best option is to adopt existing scripts to use :tabf instead of :e or whatever the scripts use right now to open the counterpart file. You can also try to make the change configurable and submit it to the script author. (I'm pretty sure many would find the enhancement useful.)
That reminded me of a trick I used very long time ago. Instead of guessing where the corresponding source/header files are, I have used at the top of file special comment containing relative path to the counterpart file. Switching was as simple as finding the special comment, extracting file name and opening it. Problem was similar to yours in that file extensions were not predictable. My rational solution was to stop guessing and denote counterparts explicitly in the source code. (This days I would have probably tried to put the relationship table into an external file with a standard name and look it up in VIM using the upward search.)
Two helpful things
:he 'path'
:he tabfind
So you would do
:set path=../,/usr/include/,/home/buildagent/SDKROOT/mysdk/inc
:tabfind error_codes.h
to open error_codes.h from somewhere exotic without having to specify it. Note how vim globbing is very very flexible, so you might not need mucht
:argadd ./**/*.[h,H] | tab sall
will open all header files under the current directory, regardless of how many levels deep. Be careful running this command on a large tree or with symlinks outside the tree

Does CC.NET allow linking to premade .html instead of .xsl

Does CC.NET allow for you to link to premade .html files on the plugin bar on the left?
I know it allows for you to link via XSL, but when I use the XSL for a certain plugin it does not display correctly. But the program can make a .html file itself so i was wondering if i could have it make one then link to it.
I know TeamCity has the capabilities to do this I was just wondering if CC.NET had this too.
And I know about the external links ability, but I want to link to it from the bar on the left, not the main build screen.
Have a look in your webdashboard\templates folder. In there are all the templates the server uses. I think you probably could edit ProjectSideBar.vm and add a normal xxx and use your file name and possibly one of the variables used in the file, something like:
<tr><td>Your File Ouput</td></tr>
I don't know if $projectName exists, but look in the other .vm files and you should be able to find something.
It should work, although I can't check myself at the moment.
Look at the trunk on sourceforge, I just read that in 1.5 is going to be an html plugin on the dashboard for displaying html output...
The Html Report Plugin is what you want to use - it's available starting with release 1.5 as Alex mentioned: http://www.cruisecontrolnet.org/projects/ccnet/wiki/HtmlReportPlugin
EDIT: I've spent a couple of days with the Html Report Plugin and unfortunately it looks like it has too many bugs to be useful. See my issues here and here.

Resources