Possibility to read .xtend on Geany text editor - text-editor

Context: I would like to read file .xtend. Normally I use Geany as a text editor.
Questions:
Is it possible reading file .xtend on Geany? What I mean is that the language is recognized and the keywords highlighted.
If so, how to make it possible? Any procedure?

According to Wikipedia, Xtend is syntactically similar to Java. Try opening an Xtend file in Geany, setting the highlighting to Java by selecting Document > Set Filetype > Programming Languages > Java source code, and see if that serves the purpose. If it does, you can then create a custom filetype for .xtend files by copying the Java filetype and adding the appropriate configuration info as noted in the Geany manual.

Related

Change the markup/detected-language of a file

Is it possible to change the language that is detected in a vim file? For example, in TextMate, there is a language dropdown so that you can, for example, change a file from one language to another:
Also, sometimes I will have a json object in a python file, or some javascript in html, etc. I don't exact it to be able to mark-up each section properly, though it would be nice to be able to change the language-detected-formatted accordingly. Is this possible in vim?
Is it possible to change the language that is detected in a vim file? For example, in TextMate, there is a language dropdown so that you can, for example, change a file from one language to another:
Yes, it is! You can manually change the filetype (language) of files by setting the filetype option:
:set filetype=html
More information is available in the documentation.
Also, sometimes I will have a json object in a python file, or some javascript in html, etc. I don't exact it to be able to mark-up each section properly, though it would be nice to be able to change the language-detected-formatted accordingly. Is this possible in vim?
I have not tried this myself, but there are some solutions in the Vim Tips Wiki: Different syntax highlighting within regions of a file

vim snippet default snippet file issue

I installed Vundle, got the snippetMate running. But when vim launched, the snippet it loaded is _.snippets. With my Understanding, it is the default for snippet. However, i want to use other snippet such as sh.snippets and tex.snippets. I try to run the SnippetMateOpenFile in Vim to locate the snippets file It doesn't appear. I checked and see that all of the snippet file is there.
Yes, the _.snippets contains the global snippets. In order to use the other ones, the correct filetype has to be set. The snippet plugin reuses the same mechanism that Vim uses for syntax highlighting and settings (like indent) that are specific to a certain programming language. Usually, filetype detection works automatically; you can check with
:verbose setlocal filetype?
This needs to print sh for shell scripts, to use sh.snippets. If it doesn't, you have to fix / enable filetype detection (see :help filetype-detect), or, for a one-time fix, set it manually:
:setf sh
(I'm not sure about your particular snippet plugin; I guess it's snipMate, but there are multiple variants around.)
I found out what happened. the snippets won't recognize the snippet files rightaway. So i saved and exit the text and reopen vim again. It works, yet seems like there must be a certain tag in order for vim to recognize the format of the file.

Prolog support for Vim users

I am starting with Prolog programming using XSB.
What syntax highlighting script or plugin for vim editor would you suggest for (XSB) Prolog ?
Vim (7.3) comes with filetype-specific settings and syntax highlighting for Prolog. Just make sure that your file is detected as such (i.e. :setlocal filetype? prints prolog), and you have the usual :filetype plugin on and :syntax on in your ~/.vimrc.
Vim auto-detects *.pdb and *.pl (depending on contents, can also be Perl); but you can configure additional patterns, see :help new-filetype.
The Vim support for Logtalk is an alternative for syntax coloring of Prolog files. Given that Logtalk extends Prolog, you will get nice syntax coloring for official and de facto standard Prolog features. The latest version is available here:
https://github.com/LogtalkDotOrg/logtalk3/tree/master/coding/vim
You will need to configure Vim, however, to use the Logtalk syntax highlighter support for the Prolog files (basically to recognize the file extensions that you're using for Prolog; e.g. XSB, by default, prefers .P). Also do try different Vim themes. Some of them are more pleasant than others.
There are two big plugins "set" for working with Prolog in Vim:
adimit/prolog.vim - widely known but abandoned
soli/prolog-vim - lesser known, but more updated and advanced
You can check files of the second - they are extending standard prolog.vim which comes with Vim, but including it. Moreover they support different flavours of Prolog - SWI Prolog, GNU Prolog, etc. You can use them as an examble and create your own.

Multiple file types in vim

When I am working on a PHP file for example the default filetype is php. This makes sense, however when that PHP file has HTML as well the filetype is still only php. For some plugins that means that I get the PHP functionality for that plugin, but miss out on the HTML functionality.
A more specific situation where this happens is with my snippet plugin. I get php snippets and not html snippets when I am editing a php file.
Possible solutions to this (which I obviously don't like, hence my posting this question) are:
add a map to toggle between different filetypes when I am editing different sections of the file.
update my php snippets file to include the html snippets as well (while this would work for the example above, it doesn't solve the fundamental problem).
So, Is there a way to edit a file using multiple filetypes at the same time in vim?
Edit: For future reference the specific plugin that I am talking about is called snipMate. http://www.vim.org/scripts/script.php?script_id=2540
You can specify to use multiple filetypes at the same time. For example:
:setfiletype html.php
But most of filetype plugings and syntax files are not designed for such cases.
See also :help 'filetype'

Auto formatting for vi?

Does an auto-formatting tool exist for vi that'll allow me to define per language preferences?
edit: I'm not looking for syntax highlighting. I'm looking for something that will apply formatting rules to my code. (Like brace positioning, spaces around oeprators, etc)
Well, there's Vim which comes with a lot of languages covered already and which is easy to customize per language.
Vim has tons of support for filetype-specific customisations. You might find what you are looking for in there.
You can add a file in ~/.vim/ftplugin/ for each file type. For example, set ~/.vim/ftplugin/c.vim to
set tabstop=2 shiftwidth=2
This sets your indentation for C files to two spaces.
You can use vim. If you're on GNU/Linux, take a look at /etc/vim/vimrc for global defaults. Some things you may want are "syntax on" "filetype indent on" and "set showmatch".
There is a vim plugin that enables formatting on your code from within vim. It's called vim-autoformat and you can dowload it here:
https://github.com/vim-autoformat/vim-autoformat
It integrates external code-formatting programs into vim. For example, if you want to format C, C++, C# or Java code, you can install the program astyle, and vim sets it as the format program automatically.
As Darrin says, "flee from the vi wasteland" and embrace the one true vim path instead! Your desired language preferences, assuming that they're not for SNOBOL or Simula, will thank you!
Edit: Actually extending the syntax highlighting to cover SNOBOL or Simula would not be that hard! (-:

Resources