sponsor Vim development Vim logo Vim Book Ad

Syntax match : Saving syntax match rules to be loaded next time

 script karma  Rating 0/0, Downloaded by 1345  Comments, bugs, improvements  Vim wiki

created by
Ondrej Chaloupka
 
script type
utility
 
description
If you do log investigation it’s handy to differentiate identifiers with colors.
When you close Vim and later open the log file again it’s fine to have preserved the colors.

This plugin offers functionality to save syntax match rules to an auxiliary file placed beside of file with the original content. Then the syntax highlighting can be restored when the file is opened later by loading from the auxiliary file.

Beside of having capability to restore defined syntax match rules when specific files is opened again the plugin can solve trouble of saving multiple color highlight matches. The Vim match command (:match Comment /pattern/) provides only one pattern at a time. When using match again the previously highlighted text is decolorized. Sure there are commands 2match and 3match but it could not be enough - e.g. if you want to add highlighting dynamically for different regexp patterns (e.g. some identifiers in a log file).

See more at
https://github.com/ochaloup/vim-syntax-match
 
install details
The easiest way to install is use pathogen plugin - see http://www.vim.org/scripts/script.php?script_id=2332

    mkdir -p ~/.vim/autoload ~/.vim/bundle

    curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

    add line execute pathogen#infect() to your ~/.vimrc file

Now the installation of this plugin is easy

    git clone [email protected]:ochaloup/vim-syntax-match.git ~/.vim/bundle/vim-syntax-match

 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-syntax-match-0.2.zip 0.2 2018-05-02 7.0 Ondrej Chaloupka * adding foreground colors highlights (e.g. commands YF <pattern>/Yellowfg, GF <pattern>/Greenfg, ...)
* adding function to call highlighting on all opened buffers (commands like :YA <pattern> (yellow highlight on all buffers), similarly then GA, BA, ...)
* adding user command SCB which aliases call of windo scroll bind as scroll binding on all opened windows
* adding command ClearAllSyntax which remove all syntax hightlighting from all opened buffers
* adding a docker file for testing the plugin functionality
vim-syntax-match-0.1.zip 0.1 2016-04-25 7.0 Ondrej Chaloupka Initial upload
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github