I have installed Sublime Text2. I want auto formatting php code to PSR Standards. Can anyone please help me how to configure in Sublime Text2
I just yesterday installed one plugin that you could use for PSR-1 and PSR-2.
Link that I found for this is:
sublimetext-codeformatter
Install it in Sublime Text 3 via console and after that you can use from Command Pallete [CTRL + P windows (default keyboard shortcut)] and type format and choose Codeformatter: Format code and this will format your code. You can see also the options for PHP and adapt them as you want, see 2nd image.
Default PHP settings:
I also adjusted my own keyboard shortcut in Preferences -> Keybindings
{ "keys": ["ctrl+alt+l"], "command": "code_formatter"}
If you need something more, tag me below in comments and I'll gladly reply back.
I believe that to achive what you are looking for, there are several steps included:
1) Download and install Sublime PHPCS
2) Configure according php packages you intend to use (Available: PHP_CodeSniffer, PHP Mess Detector, PHP CS Fixer, Scheck and PHP Code Beautifier)
3) Lastly you will need to configure the plugin inside of sublime text.
According to this link here, you can configure it to comply with PSR-2 standard.
Hope this helps!
Related
Is there a way to re-indent a block of code? I'm looking for something similar to Ctrl+Shift+F in Eclipse (Auto-Format/Indent).
To be clear,
I already know how to format XML outside of Notepad++ (Eclipse works fine, as mentioned) so I don't need a bunch of links to other XML-formatting tools.
I'm specifically working with XML and HTML.
Ideally, there's a keybinding as convenient as the one in Eclipse, so I don't have to break my workflow.
I already know about NppAutoIndent - it won't work, as I'm working with XML, HTML and CSS.
Since I upgraded to 6.3.2, I use XML Tools.
install XML Tools via the Plugin Admin (Plugins → Plugins Admin... Then search for "XML Tools", check its box and click the "Install" button).
use the shortcut Ctrl+Alt+Shift+B (or
menu → Plugins → XML Tools → Pretty Print)
In older versions:
menu → TextFX → HTML Tidy → Tidy: Reindent XML.
Install Tidy2 plugin. I have Notepad++ v6.2.2, and Tidy2 works fine so far.
For those who don't know, npp has a lot of support from plugins and other projects. You can download those plugins from SourceForge.
You need XML Tools to format your text in n++
After you have downloaded XML Tools ..
Exit Notepad++
Go To C:\Program File\Notepad++ .... Your N++ installed folder.
Place below files from xml tools which you downloaded in the npp root folder by copy replace
Go To ..\Plugins subfolder and place below downloaded file
Restart and enjoy!!!
Ctrl + Alt + Shft + B to format.
It's been the third time that I install Windows and npp and after some time I realize the tidy function no longer work. So I google for a solution, come to this thread, then with the help of few more so threads I finally fix it. I'll put a summary of all my actions once and for all.
Install TextFX plugin: Plugins -> Plugin Manager -> Show Plugin Manager. Select TextFX Characters and install. After a restart of npp, the menu 'TextFX' should be visible. (credits: #remipod).
Install libtidy.dll by pasting the Config folder from an old npp package: Follow instructions in this answer.
After having a Config folder in your latest npp installation destination (typically C:\Program Files (x86)\Notepad++\plugins), npp needs write access to that folder. Right click Config folder -> Properties -> Security tab -> select Users, click Edit -> check Full control to allow read/write access. Note that you need administrator privileges to do that.
Restart npp and verify TextFX -> TextFX HTML Tidy -> Tidy: Reindent XML works.
Not exactly a solution but a workaround.
Notepad ++ doesn't provide any such feature by default. But you can use some online tools to autoformat text like https://www.freeformatter.com/xml-formatter.html.
I had to update the proxy settings under Plugins -> Plugin Manager -> Show Plugin Manager -> Settings to see any PlugIns in the "Available" list.
After that, installing "XML Tools" was easy and did the requested job as described above.
Just install the latest notepad++ and install indent By fold. On the menu bar select Plugins -> Plugins Admin and selct indent By fold and the install. Works finest
To directly answer the OP, take a look at this guy's site: Thomas Hunter Notepad++ Tidy for XML. Simple steps to follow and you get very nice formatting of your XML right inside NPP. So far the only anomaly I've found is with nested self closing elements EG:
<OuterTag>Text for outer element<SelfClosingTag/></OuterTag>
Will be tidied up to:
<OuterTag>Text for outer element
<SelfClosingTag/></OuterTag>
There may be a way to fix this, but for the time being, it's managed to reduce the number of lines in my document by 300k and this particular anomaly can be worked around.
I'm using Notepad 7.6 with "Plugin Admin" and I could not find XML Tools.
I had to install it manually like #some-java-guy did in his answer except that my plugins folder was located here: C:\Users\<my username>\AppData\Local\Notepad++\plugins
In that directory I created a new directory (named XmlTools) and copied XMLTools.dll there. (And I copied all dependencies to the Notepad++ directory in Program files.)
I have configured Ctrl+B to open a file in my browser, but when I press Ctrl+B when the editor is focused on some HTML page, it doesn’t work. Why not?
more details:
what makes me confused is that this ctrl+b works if it is combined to other command such as close, but why not openInBrowser command, so does st2 support this command, how to know whether it support this command or not?
Edit 1:
you may find openInBrowser command in this link http://www.sublimetext.com/docs/commands
Edit 2
#MattDMo what is the corresponding name of command then, i cannot find them in its official document http://www.sublimetext.com/docs/2/
The command you are looking for is open_in_browser, not openInBrowser (which is an old Sublime Text 1 command). So, your keymapping should work with that. However, if you weren't already aware, CtrlB is already mapped to the Build command, used for running build systems. It's not a very good idea to overwrite built-in commands, especially one as important as this one, so I'd suggest changing your keybinding to:
{ "keys": ["ctrl+alt+b"], "command": "open_in_browser" }
This isn't in use by any of the default Sublime commands, although some plugins may use it.
I have a program that uses a file called user.cfg to get its user defined configuration settings. The odd thing is that they chose the syntax for this file to be Tcl (it's not odd that it is Tcl, it's odd they chose the .cfg extension instead of .tcl). So, when I open this file in Sublime Text, it doesn't know what syntax highlighting scheme to choose.
What I would like to do is set the syntax highlighting for user.cfg to Tcl, but not all .cfg files to Tcl.
I have seen this question which is very similar to mine, except in that case the special file name had no extension so Sublime Text knew to assign Ruby highlighting to only that one file. Unfortunately, I have an extension so the solution given there will not work for me.
Is there any known way to get Sublime Text base a highlighting scheme on the full filename?
Take a look at the ApplySyntax plugin.
The previous answer is completely true; however, I thought it would be better to have it here all in one place rather than going on another webpage to find the list of procedure to apply it
Sublime text 3
This is found here
Ensure Package Control is installed. Instructions are found here.
In Sublime Text, press Ctrl+Shift+P (Win, Linux) or Cmd+Shift+P (macOS) to bring up the quick panel and start typing Package Control: Install Package.
Select the command and it will show a list of installable plugins.
Start typing ApplySyntax; when you see it, select it.
Restart to be sure everything is loaded proper.
Enjoy!
There is an excellent package to preview markdown written using sublime text. I wanted to know how I might modify it, or perhaps use it as the basis for writing one that could process multi-markdown.
I'm using Linux (Ubuntu) and I'm currently calling multimarkdown in the terminal on each file.
One of the issues I think I might face is that multimarkdown refuses to parse an open file for some reason.
Any thoughts on how I might begin this or if an alternative solution exists would be very gratefully received.
There is a MultiMarkdown option in the syntax list - View > Syntax > Markdown > MultiMarkdown. Isn't that working? By the way the syntax (and almost any other) files are in packages folder of Sublime Text 2. This is the syntax file:
/Users/[username]/Library/Application Support/Sublime Text 2/Packages/Markdown/Markdown.tmLanguage
And MultiMarkdown file is in the same directory.
I'm intrigued by your statement that "multimarkdown refuses to parse an open file". Can you provide more information, or email me, or open an issue on github? MultiMarkdown doesn't check to see whether a file is open or not --- it simply reads the file and processes it. So if there's a problem, then the OS is not allowing MMD to proceed for some reason...
I don't have Sublime Text installed on Ubuntu (I generally use a command line only version of Ubuntu for testing MMD), so I can't test this situation exactly. I haven't had any other reports of difficulties parsing files (open or not). I don't have any trouble with Sublime Text 2 on Mac OS X and MMD.
As an alternative, you could try using one of the support scripts (e.g. mmd if you want MMD->HTML) and see if that has the same problem with open files.
PS> Are you using the latest build of MultiMarkdown, e.g. 4.2+?? (Though it shouldn't change anything related to open files)
Is there a way to re-indent a block of code? I'm looking for something similar to Ctrl+Shift+F in Eclipse (Auto-Format/Indent).
To be clear,
I already know how to format XML outside of Notepad++ (Eclipse works fine, as mentioned) so I don't need a bunch of links to other XML-formatting tools.
I'm specifically working with XML and HTML.
Ideally, there's a keybinding as convenient as the one in Eclipse, so I don't have to break my workflow.
I already know about NppAutoIndent - it won't work, as I'm working with XML, HTML and CSS.
Since I upgraded to 6.3.2, I use XML Tools.
install XML Tools via the Plugin Admin (Plugins → Plugins Admin... Then search for "XML Tools", check its box and click the "Install" button).
use the shortcut Ctrl+Alt+Shift+B (or
menu → Plugins → XML Tools → Pretty Print)
In older versions:
menu → TextFX → HTML Tidy → Tidy: Reindent XML.
Install Tidy2 plugin. I have Notepad++ v6.2.2, and Tidy2 works fine so far.
For those who don't know, npp has a lot of support from plugins and other projects. You can download those plugins from SourceForge.
You need XML Tools to format your text in n++
After you have downloaded XML Tools ..
Exit Notepad++
Go To C:\Program File\Notepad++ .... Your N++ installed folder.
Place below files from xml tools which you downloaded in the npp root folder by copy replace
Go To ..\Plugins subfolder and place below downloaded file
Restart and enjoy!!!
Ctrl + Alt + Shft + B to format.
It's been the third time that I install Windows and npp and after some time I realize the tidy function no longer work. So I google for a solution, come to this thread, then with the help of few more so threads I finally fix it. I'll put a summary of all my actions once and for all.
Install TextFX plugin: Plugins -> Plugin Manager -> Show Plugin Manager. Select TextFX Characters and install. After a restart of npp, the menu 'TextFX' should be visible. (credits: #remipod).
Install libtidy.dll by pasting the Config folder from an old npp package: Follow instructions in this answer.
After having a Config folder in your latest npp installation destination (typically C:\Program Files (x86)\Notepad++\plugins), npp needs write access to that folder. Right click Config folder -> Properties -> Security tab -> select Users, click Edit -> check Full control to allow read/write access. Note that you need administrator privileges to do that.
Restart npp and verify TextFX -> TextFX HTML Tidy -> Tidy: Reindent XML works.
Not exactly a solution but a workaround.
Notepad ++ doesn't provide any such feature by default. But you can use some online tools to autoformat text like https://www.freeformatter.com/xml-formatter.html.
I had to update the proxy settings under Plugins -> Plugin Manager -> Show Plugin Manager -> Settings to see any PlugIns in the "Available" list.
After that, installing "XML Tools" was easy and did the requested job as described above.
Just install the latest notepad++ and install indent By fold. On the menu bar select Plugins -> Plugins Admin and selct indent By fold and the install. Works finest
To directly answer the OP, take a look at this guy's site: Thomas Hunter Notepad++ Tidy for XML. Simple steps to follow and you get very nice formatting of your XML right inside NPP. So far the only anomaly I've found is with nested self closing elements EG:
<OuterTag>Text for outer element<SelfClosingTag/></OuterTag>
Will be tidied up to:
<OuterTag>Text for outer element
<SelfClosingTag/></OuterTag>
There may be a way to fix this, but for the time being, it's managed to reduce the number of lines in my document by 300k and this particular anomaly can be worked around.
I'm using Notepad 7.6 with "Plugin Admin" and I could not find XML Tools.
I had to install it manually like #some-java-guy did in his answer except that my plugins folder was located here: C:\Users\<my username>\AppData\Local\Notepad++\plugins
In that directory I created a new directory (named XmlTools) and copied XMLTools.dll there. (And I copied all dependencies to the Notepad++ directory in Program files.)