I am trying to get an editor with syntax highlighting for Vala code. So far I have tried:
Vim
Sublime Text
Visual Studio Code
Notepad++
None of these highlight my text. I have found this list which says that three of the above support highlighting for Vala. So how do do I get them to highlight? Or if I can't what can I use instead (I don't really want to download each one in turn to find out).
The list you point to, https://wiki.gnome.org/Projects/Vala/Tools#Editors, is meant to be an up to date list for the Vala community. The table on that page has Yes indicated for each editor that has syntax highlighting. Some of the Yes entries have links through to pages with more information. For example the Yes link for Vim has detailed instructions for setting up syntax highlighting.
Vim
Vim has very good support provided by https://github.com/arrufat/vala.vim There are even some nice screenshots in the README.md for that repository.
For Vim it depends on the plugin manager you are using. For example if you are using vim-plug add the following line to ~/.vimrc:
Plug 'arrufat/vala.vim'
There are more details on the Coding in Vala with the Vim Text Editor on the Wiki. A page linked to from the Vala Tools page.
Visual Studio Code
Syntax highlighting is provided by https://github.com/thiagoabreu/vala-code
In VS Code you open the extension tab by clicking on the square within a square like symbol and type 'Vala'. The extension will come up in the list and you can install it.
There is a page on the Vala wiki dedicated to Coding in Vala with Visual Studio Code.
Sublime Text
Syntax highlighting is provided by https://packagecontrol.io/packages/Vala
Again this is linked to from the Tools page on the Wiki.
Notepad++
I don't know anything about that.
In General
In general a lot of editors have generated their syntax highlighting from TextMate language bundles, including Visual Studio Code and Sublime Text. If you wish to work on syntax highlighting then more details, with more links, are given on the Vala Tools wiki page.
Related
I'm currently writing a blog web app in rails and ultimately this blog is for me to post about F#. I currently have TinyMCE installed a along with the samplecode plugin found here. However... after installing it I realized that the TOOLBAR version doesn't support F#.
prismjs does support F# highlighting but TinyMCE does not! Is there a way to support F# in the tinymce drop down?
I do care about others such as Python, C#, Scala but most importantly I need F#.
Luke -
I work for the company that created TinyMCE. In order to get Prism to work in TinyMCE's Codesample plugin we had to make a few changes to the Prism.js that is included with TinyMCE. (Most notably to not immediately try to add its markup to the page)
You could try to generate a new Prism.js file with additional languages and merge in the customizations we made. You would then update the plugin (and its dialog) appropriately.
The languages you see in the select list are the only ones we provide as a part of the TinyMCE open source product.
I just downloaded brackets after hearing recent buzz about the editor. There are some really cool / useful features out of the box.
Alot of my projects use templating engines, like twig. Does this editor support bundles for other filetypes? I have been using textmate for a while and by simply downloading the twig bundle I have highlighting and code snippets integrated into the editor. I am hoping brackets has a similar feature.
The short answer is: not yet, but soon.
Longer answer:
APIs for Brackets extensions to add a new syntax/language are currently in progress, and will probably be done in about a month.
Since Brackets uses the CodeMirror editor, syntax highlighting is driven by CodeMirror "modes." It doesn't appear that anyone has made a Twig mode yet. But it might not be too hard to build one, either based on the sample code for Mustache highlighting or the new "multiplexing mode" feature in CodeMirror 3 (Brackets is updating to CodeMirror 3 soon).
Brackets may eventually support directly importing TextMate language bundles, like Sublime does, but that's a ways off.
As a stopgap, you could have Brackets just highlight Twig files as plain HTML -- better than no color coding at all. That'll be doable with the upcoming extension APIs, but if you're feeling adventurous you could hack your current copy of Brackets to do that right now. Just dig into the app folder, open www/editor/EditorUtils.js, and add the file extension after the case "html": line.
(p.s. - I work on the Brackets core team. Thanks for giving Brackets a try!)
Visual Studio doesn't offer automatic formatting for F#, is there any other editor I can use to automate that?
I would like it would put reasonable white spaces in between arithmetic operators (a+b) goes to (a + b) or assignment operators =
I have been developing a source code formatter for F#. The source can be found on Github.
At the moment, a VS extension has been released in Visual Studio gallery. Integration to other IDEs and editors should be possible while the API and command line are already available.
The VS extension can handle the situations you described quite well via formatting selection feature.
Generic code indentation is supported in FSharpMode in Emacs:
Link to download site
But it wont help you to do automatic white-space separation of operators, only indentation.
Maybe write a simple formatter based on Tomas Petriceks code for syntax highlighting?
Link to FSharp.Formatting
What solutions are there for working on a LaTeX document on both Windows and Linux?
It's a large document, and I will be working daily on both platforms so compatibility is essential if it's two different pieces of software.
Bonus points for a solution that includes easy previewing.
Writing text is not very different from writing software. Similar management techniques apply when scaling up.
Modularity: Split the document to smaller pieces e.g. a separate .tex file for each chapter. I also like to keep the preamble and other LaTeX set-up separate from the body text. My chapter files themselves just have the body text with some markup but do not define any new commands.
Source control: Keep all the source files in a version control tool such as subversion. Transfer files between systems using the tool.
Builds: Have a Makefile or similar to control the build process: it should be consistent and repeatable. Build regularly and fix build problems as soon as possible. If you want easy previews, you can set up a Makefile rule to launch e.g. a PDF viewer after the target PDF has been compiled.
Editing: Use whatever you're compatible with. It does not matter that much, though some good advice has been given by other answerers.
Communication: If there's more than one person working on the same stuff, no tool is a substitute for interpersonal communication.
TeXworks is a new cross-platform TeX editor with a built-in PDF preview that has source-output synchronisation. Click in the source to go to the matching part in the output, and vice versa. It's not the most feature-rich editor, by design, but the simplicity/power trade-off is just right, in my opinion.
I've used Emacs and its AucTeX mode, which is great for editing, as it has a set of very consistent shortcuts to insert many common commands and environments. There are also preview modes that display maths graphically in the Emacs window but I haven't used them.
As with VIM, there's a learning curve of course.
Unlike Legoolas, I'd advise for direct-to-PDF compilation using pdfTeX, but maybe Windows/Linux doesn't have a PDF viewer that automatically reloads the file? I'd be surprised if so (I use Skim on Mac). Check if your viewer supports synctex, as it's quite handy to navigate from PDF to source and back, without the cons of pdfsync.
To compile, my tool of choice is latexmk which is included in TeXlive. It completely automates the build, and can watch the .tex source to rebuild automatically.
Try LyX – The Document Processor, a "What You See Is What You Mean" editor for LaTeX.
Eclipse with its TeXlipse plugin should solve the IDE problem. More important are, however, issues like using only fonts that are available or installable on both platforms.
For previewing I am using Emacs with its Preview Latex feature in the AucTeX package.
For windows, you can use the TeXnicCenter, that is one of the best IDE for windows.
For Linux, you can use simply use Kile (it is possible to use kile with KDE on CygWin, but it is not the perfect solution).
There is no problem to switch from one IDE to another one (since you just save the .tex file and nothing else)
It also exists some cross-platform IDE, but I do not know them:
TeXmaker
TeXmakerX: a fork from TeXmaker
Since you'll probably not want to change text editor from whatever you usually use just for editing LaTeX docs (unless you use an editor which can't do syntax highlighting for LaTeX as well as whatever else you code/write in it), I'd recommend the simple following set of tools:
Whatever text editor you are used to, as long as it can highlight LaTeX markup. If it can't, then find a better editor for using with everything you do!.
Install MikTeX or TeXLive and just use the DVI viewer which comes with them by double-clicking on your DVI file. This will automatically update whenever the dvi file is changed by your editing of the latex file and re-creating the output.
I use Emacs as my text editor of choice, on both Linux and Windows. Setting up some scripts or makefiles to build the latex document when I hit a key is pretty easy, and fits in with everything else I use Emacs for nicely.
Other cross-platform options (many of which have already been mentioned by others in this thread):
LyX
TeXlispse for Eclipse
I've used VIM, combined with the VIM-LaTeX plugin, with great success. It does have a bit of a learning curve though.
Gummi is the best LaTeX editor. It is a free, open source, program written in python, featuring a live preview pane.
http://gummi.midnightcoding.org/
e4 http://gummi.midnightcoding.org/wp-content/uploads/20091012-1large(1).png
Get your work in some kind of version control system, then when you move from computer to computer you just update from a central server and its just like you left it.
It doesn't matter about the IDE, as you are saving just the .tex file, as noted above. If you want to use the same editor though, for the sake of coherency, use texmaker.
I use version control, and just use MikTex/WinEDT on Windows and TexShop on the mac.
IF your document doesn't compile on both, you're probably forgetting to keep the two directories synchronized or use funky commands, I like the sanity checks of knowing that it "compiles" cleanly on two platforms.
I use some text editor, and then I have a cron job that does a compile hourly from my source control.
Tex files are just text. I would recommend using a version control system (you should be using that anyway) to keep the source in sync. You can then use any (or different) editors on each system, e.g. Kile for linux and winEdt for windows. Both com with nice viewrs.
For a simple solution for the source control that just works with minimum knowledge and hassle, consider dropbox.
Revisiting my own question after quite a few years, I thought I'd add
https://www.writelatex.com/
not strictly what I had in mind, but have used it for collaborative writing
An excellent multiplatform LaTeX IDE is Texmaker.
For Debian or Ubuntu, I made a tutorial easy to follow: Install LaTeX on Ubuntu or Debian. This tutorial explains how to install LaTeX on Debian or Ubuntu and how to create your first PDF.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 months ago.
Improve this question
I have occasion to need to print code (Horrors!!! ;) ), and i was wondering what editor or tool would i use to print that code out with proper formatting and syntax highlighting? If it's important, it will be c# code but ideally the tool will work for as many languages as possible. Can Notepad++ or something handle this?
You can use Vim! It's probably installed already if you're on modern Linux/MacOS and an easy install if not.
:syntax will turn syntax highlighting on and :hardcopy will print it. There's syntax highlighting definitions for many languages out there. The default look is usually optimised for screen display, but you can fix that.
Simply open the file on command line with vim <filename>, type :syntax on<ENTER>, then :hardcopy<ENTER> to print it. Quit Vim with :q!<ENTER>.
There's also the :TOhtml command which will open the current selection as HTML in a new Vim window. Capture the entire document with :%y<ENTER> followed by :TOhtml<ENTER> to open it.
Yes, Notepad++ can certainly print code with syntax highlighting.
Colour printing would obviously be preferable, but on the occasions when I've printed in black and white, the subtle differences in colour [rendered as shades of grey, of course] can be difficult to distinguish.
However, I think a little customisation of the colour schemes should make this less of a problem.
New Answer:
Use TextMate. It prints colored code automatically. There's no setup. Just print. In case previous or newer versions can't do this I'm using TextMate version 2.0.23
Old Answer, and the answer for people who don't have Macs:
Use vim. Its the easiest method to do it in my experience by far, that is, once you know how.
Vim comes pre-installed on Macs, btw. And I know how you special people like colors, so I'm going to make this impatientbusinessman-proof for the benefit of all.
1.) open file
vim filename.m
2.) enable syntax coloration (mine did not have enabled by default)
:syntax on
3.) print
:hardcopy
Vim will choose your system's default printer without asking you so make sure you set that up first.
4.) exit the program (this is actually not a given)
:q
http://pygments.org/ is one option. It supports a ton of languages, and since it's written as a python library, you can script the conversion process however you want.
Visual Studio will, and allows you have a completely separate configuration for printing.
I recently compared the 2 solutions already mentioned : vim & pygments. They both give great results, but there is how you can practically use them quickly:
pygments does not provide direct export to PDF. Hence, the simplest solution I found was to export to HTML and then use wkhtmltopdf. You can combine both operations using the following bash script:
src2pdf () {
local noext="${1%.*}"
pygmentize -O full -o "$noext.html" "$1"
# enabling line wrapping in <pre> blocks
perl -i -wpe '/<style.*>$/&&($_.="pre{white-space:pre-wrap;}\n")' "$noext.html"
wkhtmltopdf "$noext.html" "$noext.pdf"
rm "$noext.html"
}
for vim, it's as simple as this: TERM=xterm-256color vim '+hardcopy >out.ps' +q code.src
I found out that the $TERM environment variable can affect the output colors, so I prefer to set it explicitly.
And finally, you may need to tweak your .vimrc a little:
set printfont=:h9
set printoptions=number:y,left:5pc
The tool called enscript is very much the tool for doing this. It is very powerful, is not tied to an editor nor a language and you can create PDF's with syntax highlighting.
The documentation pretty much says it all.
enscript man page
Under unix you might want to try a2ps. It is flexible and produces nice results.
I while ago I created a household python script that wraps pygments into a small console utility. It works with any language supported by pygments.
Also if you happen to use eclipse, you could simply copy the selected text in the editor and then paste it in a RTF-aware editor like MS Word - it will preserve all the colors, fonts and formatting.
If you have problems with Visual Studio 2012 concerning the highlighted printing an handeling the described problem:
Download and install this Power Tool which implements the color
printing, besides some other features and bug fixes. Works for me!
Solution For Bash Shell
Add this line to ~/.bashrc if you are using UBUNTU
or, to ~/.bash_profile if you are using MAC
If that file does not exists, create it.
alias lprc='vim -me -c ":syntax on" -c ":hardcopy" -c ":q"'
source ~/.bashrc or source ~/.bash_profile
To print colored hello.py just do this:
lprc hello.py instead of lpr hello.py
Use ConTEXT programming editor (which is free). I am using it for both generating .pdf-s with syntax highlighted source code and printing to paper.
There are many ConTEXT syntax highlihting definitions to download and you can make your own highligher file which will BTW be highlighted using the ConTEXT Highlighter Files highlighter definition.
I do it downloading js and css files from
https://prismjs.com/
There are so many 5-7 options to select the theme and language highlighter. Once you select a theme and download the tiny js/css files the next thing you need to do is rename the code file to html, and call the css/js files. Open the html in a browser and print it. Done!
You can also use this in case you've to print with bnw syntax highlighting https://github.com/SGI-CAPP-AT2/code-highlight-n-print