Hot answers tagged

15

When you have the file open, you can run: :set filetype=messages To automate this for all files called messages, put the following into ~/.vim/ftdetect/messages.vim: autocmd BufNewFile,BufReadPost *messages* :set filetype=messages


14

less doesn't support syntax highlighting. vim, like all vi clones has a read-only mode called view which you can use to just view files. it supports all features of vim including syntax highlighting. e.g. view filename.py the main difference between view and vi is that view doesn't "lock" the file you're viewing by creating a .swp file.


14

Syntax highlighting of less, works just fine on most *nix systems. Even on Cygwin you can do it with the minor adjustment of the shell script path and installing with apt-cyg. apt-cyg install source-highlight export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s" export LESS=' -R ' However, using this drastically slows down browsing of large files. I ...


10

First things first, sit back, relax, and take a few deep breaths. Okay, relaxed now? For the first error, you need: set backspace=2 The second one I can only assume occurred becaue you're not using the standard vim that ships with Ubuntu, or your environment has become broken somehow. What you probably need to do is actually find the syntax file with ...


9

vim (on most systems these days vi is actually a symlink for vim) uses syntax files to define the coloring schemes for the various languages it can deal with. You have not specified which OS you use but on my LMDE system, these are found in /usr/share/vim/vim74/syntax/. When you open a file using vim, it will first try and figure out what type of file it ...


8

Please see: http://kde-look.org/content/show.php/darK+-+A+Kate+Syntax+Highlighting+Theme?content=53388 http://kde-look.org/content/show.php/DarkOxygen?content=140718 They might help. Also, http://askubuntu.com/questions/19005/using-oblivion-color-scheme-from-gedit-in-kate There are three dead links at the bottom of this email ...


8

I tend to disagree with Ingo, less can be taught to highlight syntax. Check out this answer on SuperUser. Basically, you have to install GNU's source-highlight (available in all major distro package repos), and then add the following to your .bashrc (or .bash_profile or what have you): export LESSOPEN="| /path/to/src-hilite-lesspipe.sh %s" export LESS=" -R ...


7

less cannot be taught to highlight syntax elements, but Vim can be used as a pager, i.e. a replacement for less. There are more advanced plugins, but the basic script actually ships with Vim ($VIMRUNTIME/macros/less.sh). For the full information, see Using vim as a syntax-highlighting pager on the Vim Tips Wiki.


5

With those syntax-highlighting rules files, nano assumes that filenames ending in .1 - .9 are man pages. It's been quite a while since I edited a man page, but I'm pretty sure that in groff -man, .I is for italic and .Bis for bold.


5

You can use: vim -c 'set syntax=sql' -


5

ack does something smiliar to grep. When it puts it text to a terminal, it will spit the results out in color. If the output is redirected to a file, the matches do not get colorized. You can override these heuristics with the options --color and --nocolor. Check man 1 ack for more details.


4

Put the line syntax on in your ~/.vimrc (assuming you're talking about vim), same as on any other installation of vim.


4

Have a look into this plugin, it's likely what you want: AnsiEsc.vim : ansi escape sequences concealed, but highlighted as specified


4

Real time syntax coloring is a lot of work, especially with shells whose syntax is trickier than fish's. Only fish has it out of the box. Zsh has syntax coloring if you install the zsh-syntax-highlighting add-on. I'm not aware of any effort to do this with bash.


4

This is wrong: if [[ ${lostsongs[a+1]}<${lostsongs[a]} ]]; then because there are no spaces around "<", [[ only sees one, non-empty, argument, and returns true every time. You want if [[ ${lostsongs[a+1]} -lt ${lostsongs[a]} ]]; then or if (( lostsongs[a+1] < lostsongs[a] )); then


3

This is not a direct answer but despite i hope it helps you. If you want to use vim to write your latex documents latex-suite isn't recommended anylonger, at least from my perspective. There are several more comprehensive vim-scripts which handle this task a lot better. It is worth to take a look at http://atp-vim.sourceforge.net/ and ...


3

Colours are provided by the font-lock minor mode. To disable colouring in your current buffer, toggle font-lock-mode off with this command: M-x font-lock-mode To disable font-lock-mode permanently, add to your init file (~/.emacs): (global-font-lock-mode 0) More info is available under Font-Lock in the Gnu Emacs Manual


3

As of Emacs 24.3, this functionality is not available in Show Paren mode. Here's some completely untested code (typed directly in my browser) that tweaks Show Paren mode to match a closing parenthesis before the cursor instead of after. (defadvice show-paren-function (around show-paren-closing-before activate compile) (if (eq (syntax-class ...


3

You have to define highlight colors. From :h :match :mat[ch] {group} /{pattern}/ Define a pattern to highlight in the current window. It will be highlighted with {group}. Example: > :highlight MyGroup ctermbg=green guibg=green :match MyGroup /TODO/ So, something like this: :hi OpenTag guibg=green ...


3

You probably have an alias for make somewhere earlier in the files that bash reads on startup. Try alias -p to list them, and adding unalias make in front of the function.


3

The problem is not with your make function. When I paste your code into my .bashrc, it works fine. Think about any recent .bashrc changes you made, they may be the culprit. One thing that could help locating the problem is the -x option. Add set -x at the top of your .bashrc, then source it again if needed. When the problem comes up again, the shell will ...


2

xterm-color is probably not a supported terminfo description on your work computers. You can verify this is the case by running infocmp. You'll likely get an error of infocmp: couldn't open terminfo file. The fix for this is to set your TERM variable to something more common, for example just 'xterm' (in fact on my own system, the xterm terminfo description ...


2

Turns out I can't define the style in the .lang file. In the <style> tag there I can only refer to a style that is defined in the files in /usr/share/gtksourceview-3.0/styles. E.g. to the style used for keywords in programming languages: <style id="chord" _name="Chord" map-to="def:keyword"/>


2

For syntaxhighlighting in Ikiwiki there is a plugin called highlight. You can use it like [[!format tex """ \documentclass{scrartcl} … """]] This will give you nice syntax highlighting. It uses Perl bindings. The library itself has a longer documentation.


2

For the first error, you're setting an option. That uses the set command, and that's all there is to it. set backspace=2 For the second error, you're missing the system file /usr/share/vim/syntax/syntax.vim. That means you need to install the package that provides this file. There is a generic method to find out what that package is, for any file provided ...


2

Vim's evaluation rules are not like those found in common programming languages. Most Ex commands do not take variables, but expect literal values. This makes it more convenient for interactively issuing the commands: no string quoting is necessary. In Vimscript, as you've already correctly discovered, you need to use :execute to get Vimscript variables ...


2

I found a solution just by chance: Settings -> Kate config -> Open/Save -> File types If I click on "Download syntax-highlighting files", all files which are already installed and can be updated (a newer version is available) are marked here. Then a click on "Install" updates alle these files. After that the folder ~/.kde/share/apps/katepart/syntax ...


1

Kate is using now ~/.kde/share/config/katemoderc From GUI: Kate menu → Settings → Configure Kate... → Editor Component → Open/Save → Modes & Filetypes Select filetype: Sources/Fortran, add ;*.h to file extensions, raise priority from 9 to 15 (Should be ok, Max priority for .h was in Sources/C++ which is 9) Close then reopen ...


1

In Vim, syntax highlighting is a two-stage process: a syntax script (for a particular language) defines the parsing rules and with that determines what can be distinctly highlighted. There's usually an abstraction layer where individual elements are linked to logical highlight groups. your colorscheme (or the default one) assigns certain colors (depending ...


1

You can provide your own function as the value of show-paren-data-function: ,---- | show-paren-data-function is a variable defined in `paren.el'. | Its value is show-paren--default | | This variable can be risky when used as a file-local variable. | | Documentation: | Function to find the opener/closer at point and its match. | The function is called ...



Only top voted, non community-wiki answers of a minimum length are eligible