GithubHelp home page GithubHelp logo

mhartington / vim-nerdtree-syntax-highlight Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tiagofumo/vim-nerdtree-syntax-highlight

0.0 2.0 0.0 953 KB

Extra syntax and highlight for nerdtree files

License: GNU General Public License v3.0

Vim Script 84.85% Shell 15.15%

vim-nerdtree-syntax-highlight's Introduction

vim-nerdtree-syntax-highlight

This adds syntax for nerdtree on most common file extensions. Whether you want to easily see what is going on in a new project, or trying to learn a new framework with a different folder structure, or just trying to make your vim look like it is 2016, this plugin can help you. This is intended to be used with vim-devicons to add color to icons or entire labels, but will work without it. It is possible to disable highlight, but the syntax will still be available if you want to make something specific with it. The file icons are linked to their labels which are linked to NERDTreeFile, so it will not break anything.

Warning: This is sort of a hack and has some limitations.

File syntax will follow this pattern:

@ label icon
file extensions nerdtreeFileExtensionLabel_#{extension} nerdtreeFileExtensionIcon_#{extension}
exact match nerdtreeExactMatchLabel_#{name} nerdtreeExactMatchIcon_#{name}
pattern match nerdtreePatternMatchLabel_#{pattern_letters} nerdtreePatternMatchIcon_#{pattern_letters}

Screenshots:

Installation:

add this line to your .vimrc or neovim configuration file (usually it is in '~/.config/nvim/init.vim'):

NeoBundle 'tiagofumo/vim-nerdtree-syntax-highlight'

Dependencies

This plugin is intended to be used with vim-devicons and to use it you will need to add a new font from nerd-fonts to your machine so you can see the icons when using vim.

Configuration

  • Disable Highlighting
let g:NERDTreeDisableFileExtensionHighlight = 1
let g:NERDTreeDisableExactMatchHighlight = 1
let g:NERDTreeDisablePatternMatchHighlight = 1
  • Highlight full name (not only icons). You need to add this if you don't have vim-devicons and want highlight.
let g:NERDTreeFileExtensionHighlightFullName = 1
let g:NERDTreeExactMatchHighlightFullName = 1
let g:NERDTreePatternMatchHighlightFullName = 1
  • Highlight folders using exact match
let g:NERDTreeHighlightFolders = 1 " enables folder icon highlighting using exact match
let g:NERDTreeHighlightFoldersFullName = 1 " highlights the folder name
  • Customizing colors
" you can add these colors to your .vimrc to help customizing
let s:brown = "905532"
let s:aqua =  "3AFFDB"
let s:blue = "689FB6"
let s:darkBlue = "44788E"
let s:purple = "834F79"
let s:lightPurple = "834F79"
let s:red = "AE403F"
let s:beige = "F5C06F"
let s:yellow = "F09F17"
let s:orange = "D4843E"
let s:darkOrange = "F16529"
let s:pink = "CB6F6F"
let s:salmon = "EE6E73"
let s:green = "8FAA54"
let s:lightGreen = "31B53E"
let s:white = "FFFFFF"
let s:rspec_red = 'FE405F'
let s:git_orange = 'F54D27'

let g:NERDTreeExtensionHighlightColor = {} " this line is needed to avoid error
let g:NERDTreeExtensionHighlightColor['css'] = s:blue " sets the color of css files to blue

let g:NERDTreeExactMatchHighlightColor = {} " this line is needed to avoid error
let g:NERDTreeExactMatchHighlightColor['.gitignore'] = s:git_orange " sets the color for .gitignore files

let g:NERDTreePatternMatchHighlightColor = {} " this line is needed to avoid error
let g:NERDTreePatternMatchHighlightColor['.*_spec\.rb$'] = s:rspec_red " sets the color for files ending with _spec.rb
  • Disable Highlight for specific file extension
" If you have vim-devicons you can customize your icons for each file type.
let g:NERDTreeExtensionHighlightColor = {} "this line is needed to avoid error
let g:NERDTreeExtensionHighlightColor['css'] = '' "assigning it to an empty string will skip highlight
  • Disable uncommon file extensions highlighting (this is a good idea if you are experiencing lag when scrolling)
let g:NERDTreeLimitedSyntax = 1
  • Disable all default file extensions highlighting (you can use this to easily customize which extensions you want to highlight)
let g:NERDTreeSyntaxDisableDefaultExtensions = 1
  • Customize which file extensions are enabled (you only need this if you set g:NERDTreeLimitedSyntax or g:NERDTreeSyntaxDisableDefaultExtensions)
" set g:NERDTreeExtensionHighlightColor if you want a custom color instead of the default one
let g:NERDTreeSyntaxEnabledExtensions = ['hbs', 'lhs'] " enable highlight to .hbs and .lhs files with default colors

generate_files.sh script

There is a script folder called generate_files.sh that will generate all the files supported by this plugin by default for a quick review. These files will be generated on a 'files' subfolder.

vim-nerdtree-syntax-highlight's People

Contributors

tiagofumo avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.