my .editorconfig file look like this
root = true
[*.rush]
syntax = ruby
I have put it in the top of the folder hierarchy. However, the sublime text shows all the .rush files as plain text and I have to manually change the syntax highlight to Ruby.
Anyone knows how to do this?
Syntax highlighting isn't supported by EditorConfig yet.
The core set of supported properties that is widely supported by all editors -
indent_style
indent_size
tab_width
end_of_line
charset
trim_trailing_whitespace
insert_final_newline
root
max_line_length is supported by a limited number of editors (Emacs, Vim, Atom, ReSharper, Rider, AppCode, IntelliJ IDEA, PhpStorm, PyCharm, RubyMine, and WebStorm)
It's still an open issue (#190) to support highlighting.
You can find other proposed properties on its GitHub wiki.
It makes sense to be able to specify the syntax in the .editorconfig file.
Alternatively, it could be a new standard that editors or programs can look at for specifying the syntax of different globs, file names, or file extensions.
[$]> cat ~/.syntaxconfig
[$]> cat ~/.syntaxmapping
[.custom_shell] bash
[{*.rush, *.wish}] ruby
bash [.custom_shell]
ruby [{*.rush, *.wish}]
[bash]
.custom_shell
[ruby]
*.rush
*.wish
Related
I have just started learning the Forth programming language.
I'm using Gforth on Ubuntu. In Gforth interactive console, I want to do indentation but it requires changing line. Enter key didn't work, it executed code. For comparison, for example, when one tests JavaScript code in web browser console, shift+enter change line without executing code. I want something like that. What key should I press? Is there a way other than using text editors like vim?
Best.
Gforth doesn't support multiline editing (see the manual).
A workaround is to edit a file in your favorite editor in another window and reload this file in Gforth console as:
include /tmp/scratch.fs
An external file can be also edited in Gforth console via a command like:
"vim /tmp/scratch.fs" system
So a one-liner for that is:
"vim /tmp/scratch.fs" system "/tmp/scratch.fs" included
That can be wrapped into a definition as:
: scratch "vim /tmp/scratch.fs" system "/tmp/scratch.fs" included ;
So the word scratch will open an editor and than load the edited file.
NB: if you use a quite old build of Gforth, you have to use s" ccc" instead of "ccc" for string literals.
To conditionally include/exclude some parts in a file the words [defined] and [if] can be used; to erase the previous instance of the loaded definitions the word marker can be used as:
[defined] _clear [if] _clear [then]
marker _clear
\ some definitions
\ ...
Take into account that usual control-flow words can be used in definitions only.
Whenever I open up test.log from any rails application I get the following screenshot in Sublime. I've tried messing around with encodings, but couldn't find anything that fixed it.
Any ideas on what is going on?
These are control characters used to add colour to the log files. Sublime text apparently doesn't support this.
If you're mostly going to be viewing log files with editors that don't understand these colour codes you can turn this off with the rails config.colorize_logging setting
There's a Sublime package to turn these ANSI/vt100 escape sequences into colored text -- SublimeANSI
(use Package Control and look for ANSIescape) -- this adds an "ANSI" file type that will display your log file in glorious color. (The file is displayed read-only but you can change the type back to "Plain Text" if you want to edit it.)
Backing up Tom Hundt's answer... SublimeANSI is the way to go. Compare these before/after shots:
Sublime's default rendering of colorized Rails log output:
Now change the syntax highlighting to ANSI:
Now, marvel in the majesty of SumblimeANSI's rendering:
Learn more about SublimeANSI package at: https://github.com/aziz/SublimeANSI
Note: To install it in Package Manager, search for "ANSIescape" ... NOT "SublimeANSI". This confused me for a hot minute.
I would like to be able to edit LaTeX parts of some Doxygen comments externally with some suitable editor. I would use that only for complex environments. To do that, I figured I can have LaTeX-only files and include them from Doxygen. I did create Doxygen aliases for \begin and \end to make the syntax compatible.
(For example, I know how to set-up Emacs/AUCTex for working with LaTeX snippets that have no preamble and document structure.)
Is there a way to include the contents of a .tex file inside a Doxygen comment? I look for something analogous to \htmlinclude, but for TeX files. Is there some way to emulate the functionality, given my requirements for having a TeX-only external source?
You may use something like
\latexonly
\input <file>
\endlatexonly
where <file> is the path to the file to include, either absolute or relative to the directory in which the latex documentation is generated.
Have you tried the \verbinclude command? This command includes any file verbatim in the documentation (in contrast to \include, which is used to include source files).
From the doxygen manual:
\verbinclude <file-name>
This command includes the file <file-name> verbatim in the documentation. The command is equivalent to pasting the file in the documentation and placing \verbatim and \endverbatim commands around it.
Files or directories that doxygen should look for can be specified using the EXAMPLE_PATH tag of doxygen's configuration file.
Edit: I just had a thought that you may wish to strip the preamble from your .tex file before including the rest of the file in the documentation. you could do this using the \dontinclude command which, together with the \line, \skip, \skipline, and \until commands allows you to include specific lines/blocks of a particular file. See the example in the \dontinclude documentation.
I use some .sty-files that are not part of texlive and want to have them in a subdirectory of the folder with my main.tex. I used the following line to load the package:
\usepackage{sty/prettythesis}
This works, but compiling the main.tex with xelatex and using rubber gives me a warning:
sty/prettythesis.sty: You have requested package `sty/prettythesis',
but the package provides `prettythesis'. (page 1)
Is there a way to prevent this warning or handle this case without having to include "sty\" in all .sty-files' \ProvidesPackage command or set the TEXINPUTS environment variable (which seems not to be possible from the main.tex itself)?
I believe this thread here:
LaTeX Community • View topic - Including tex files
talks about precisely the same thing: so it seems, the only alternatives are either using TEXINPUTS environment variable; or using the import package. (note, there is a variant on the import package on ...Including tex files pg 3.)
A bit more about TEXINPUTS:
TeX Frequently Asked Questions -- “Temporary” installation of (La)TeX files
Setting TeX Environment Variable Paths
Environment Variables for Running LaTeX
TeX (and Variations) for Writing Math - math.umn.edu (see 'TeX Inputs')
Installing LaTeX packages - TeX search paths
Hope this helps;
Cheers!
EDIT: I hoped that one could set the TEXINPUTS path directly in the tex file (by using \write18 -- and note, some versions of LaTeX use --enable-write18, mine uses -shell-escape to enable \write18; see also this) - but it seems it is not possible:
"... This isn't possible. ... The environment variable of the child process is set, but this hasn't an effect to its parent process (TeX)." (Re: Setting the environmental variable TEXINPUTS within latex - comp.text.tex).
... so, now I just call pdflatex in my Linux bash like this:
TEXINPUTS=.//:$TEXINPUTS pdflatex ./myfile.tex
and then it will resolve directly \usepackage{mypackage} in the myfile.tex file - even if mypackage.sty is in a subdirectory, say ./subdir/mypackage.sty.
As you discovered, putting the package in a subdirectory (say, ./sty/prettythesis.sty with respect to your main .tex file at ./), and calling the package via
\usepackage{sty/prettythesis}
will successfully load the package, but it will produce the warning
sty/prettythesis.sty: You have requested package `sty/prettythesis',
but the package provides `prettythesis'. (page 1)
If all you want is to get rid of this warning, and you're OK with minor modifications in the .sty file, then you can simply change the package name that it reports, by changing the \ProvidesPackage command to
\ProvidesPackage{sty/prettythesis}
This can be inconvenient if you're going to be moving it around loads, but the modifications load isn't too bad either.
Even better, if what you have in there is a specific, modified version of a standard TeX package (like, say, this patch of natbib), then the change in the package name clearly indicates what package it's providing, and if you reuse the file then it will (most likely) re-raise a warning to prompt you into making sure that you know what you're doing.
You can do it in your TeX file without changing your system's environment (do not forget the trailing slash / with each directory):
\makeatletter
\def\input#path{{../one-directory/}{../another-directory/}}
\makeatother
\documentclass{myclass}
\usepackage{mypackage}
This way, though, may be not recommended for portability. As other answers mention, the "correct" way is to set the TEXINPUTS variable in your system environment before you call latex; in Windows it is (you can place it in a batch file):
set TEXINPUTS=../one-directory/;../another-directory/;%TEXINPUTS%
pdflatex myfile.tex
Simply put line below before the call to pdflatex (or latex) in your makefile or build script:
export TEXINPUTS=".:./sty:"
Then reference your package as:
\usepackage{prettythesis}
I'm going to a farm. I think there are no computers there, and my laptop is broken. I want to print out the code of some of my projects on A4 paper so I can review it while I'm there. It would be nice if it was printed with syntax highlighting.
Editors: Vim, Notepad++
Code: Html, CSS, Javascript
enscript
pygmentize
In emacs use ps-print-buffer-with-faces. There is also ps-print-region-with-faces for those occasions when you only want part of a file...
Use M-x <command> to invoke commands by name. Use C-h f <command> for help on a command and also to learn what (if any) keybinding it has.
a2ps tool produces nice PostScript files for program listing printing.
Vim has :TOhtml command which produces HTML with current open file highlighted according to Vim syntax coloring. GVim has Syntax -> Convert to HTML menu for this.
If you use LaTeX, look at listings package (pdf documentation at CTAN). It's a very good solution for including your code in documentation/presentation.
All these tools support syntax of many programming (and non-programming) languages.
Editplus prints with syntax highlighting intact