diff options
| author | Chris <[email protected]> | 2020-08-03 20:52:44 -0400 | 
|---|---|---|
| committer | Chris <[email protected]> | 2020-08-03 20:52:44 -0400 | 
| commit | 4395fe9403937a9dd6c79867a597dc89be821c34 (patch) | |
| tree | d13ef3d3692931d5c848ec29b89ee01ceb79430f | |
| parent | af7eadb7ac71c7bc4e515dd56e5c67dc77fcd488 (diff) | |
Adding Java syntax highlighting (thanks king Dan) and updating rainbow parens
| -rw-r--r-- | coc-settings.json | 3 | ||||
| -rw-r--r-- | init.vim | 4 | ||||
| -rw-r--r-- | plug-config/rainbow.vim | 38 | ||||
| -rw-r--r-- | syntax/java.vim | 182 | ||||
| -rw-r--r-- | vim-plug/plugins.vim | 4 | 
5 files changed, 224 insertions, 7 deletions
| diff --git a/coc-settings.json b/coc-settings.json index 1c409d4c..0003b2cc 100644 --- a/coc-settings.json +++ b/coc-settings.json @@ -33,7 +33,8 @@      "html",      "yaml",      "json", -    "python" +    "python", +    "java"    ],    "coc.preferences.hoverTarget": "float", @@ -24,7 +24,6 @@ else    source $HOME/.config/nvim/themes/airline.vim    source $HOME/.config/nvim/plug-config/rnvimr.vim    source $HOME/.config/nvim/plug-config/fzf.vim -  "source $HOME/.config/nvim/plug-config/nerd-commenter.vim switching to vim-commentary    source $HOME/.config/nvim/plug-config/vim-commentary.vim    source $HOME/.config/nvim/plug-config/rainbow.vim    source $HOME/.config/nvim/plug-config/codi.vim @@ -40,7 +39,6 @@ else    source $HOME/.config/nvim/plug-config/floaterm.vim    source $HOME/.config/nvim/plug-config/vista.vim    luafile $HOME/.config/nvim/lua/plug-colorizer.lua -  " source $HOME/.config/nvim/plug-config/easymotion.vim  endif  " Experimental @@ -53,4 +51,4 @@ let g:polyglot_disabled = ['csv']  " Python  " https://realpython.com/python-debugging-pdb/ " breakpoint syntax is really cool  " also look into profiling as well -" let g:python_highlight_all=1 +let g:python_highlight_all=1 diff --git a/plug-config/rainbow.vim b/plug-config/rainbow.vim index 4c441fe0..0900b5ab 100644 --- a/plug-config/rainbow.vim +++ b/plug-config/rainbow.vim @@ -1,5 +1,39 @@ -let g:rainbow#max_level = 16  let g:rainbow#pairs = [['(', ')'], ['[', ']'], ['{', '}']] +let g:rainbow_conf = {'guis': ['bold']} +let g:rainbow_active = 1 "set to 0 if you want to enable it later via :RainbowToggle -autocmd FileType * RainbowParentheses +" \	'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick'], +let g:rainbow_conf = { +\	'guifgs': ['#858580', '#8FBCBB', '#D08770', '#A3BE8C', '#EBCB8B', '#B48EAD', '#80a880', '#887070'], +\	'ctermfgs': ['lightblue', 'lightyellow', 'lightcyan', 'lightmagenta'], +\	'guis': [''], +\	'cterms': [''], +\	'operators': '_,_', +\	'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold'], +\	'separately': { +\		'*': {}, +\		'markdown': { +\			'parentheses_options': 'containedin=markdownCode contained',  +\		}, +\		'lisp': { +\	    'guifgs': ['#858580', '#8FBCBB', '#D08770', '#A3BE8C', '#EBCB8B', '#B48EAD', '#80a880', '#887070'], +\		}, +\		'jsx': { +\	    'guifgs': ['#858580', '#8FBCBB', '#D08770', '#A3BE8C', '#EBCB8B', '#B48EAD', '#80a880', '#887070'], +\		}, +\		'haskell': { +\			'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/\v\{\ze[^-]/ end=/}/ fold'], +\		}, +\		'vim': { +\			'parentheses_options': 'containedin=vimFuncBody',  +\		}, +\		'perl': { +\			'syn_name_prefix': 'perlBlockFoldRainbow',  +\		}, +\		'stylus': { +\			'parentheses': ['start=/{/ end=/}/ fold contains=@colorableGroup'],  +\		}, +\		'css': 0,  +\	} +\} diff --git a/syntax/java.vim b/syntax/java.vim new file mode 100644 index 00000000..8a08493c --- /dev/null +++ b/syntax/java.vim @@ -0,0 +1,182 @@ + +" note do not change the order... +" some of them are overridding privous regrex  + +"this code made with build-in syntax regrex(and key words), and with some custome regrex(and +"key words) + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + +" gruvbox (dark) +"let orange = "#d65d0e" "special color for numbers +"let black = "#282828" +"let red = "#cc241d" +"let green = "#98971a" +"let yellow = "#d79921" +"let blue = "#458588" +"let purple = "#b16286" +"let cyan = "#689d6a" +"let white = "#a89984" + + +" one dark +let orange = "#d19a66" "special color for numbers +let black = "#282c34" +let red = "#E06C75" +let green = "#98c379" +let yellow = "#E5C07B" +let blue = "#61AFEF" +let purple = "#C678DD" +let cyan = "#56B6C2" +let white = "#ABB2BF" + + + +" you may chage the color according to your will :) + + +" main color (for left over words) +syn match main "\w" +execute "highlight main ctermfg=4  guifg=".red + +" numbers +syn match posNum "\d" +execute "highlight posNum ctermfg=4  guifg=".orange + +" method names() +syn match class ".\w*\((\)\@=" +execute "highlight class ctermfg=4  guifg=".blue + +"execute "highlight names which contains numbers +syn match main "\v(\a)\w*\d" +execute "highlight main ctermfg=4  guifg=".red + + +"all regrex works +" /^import (+);$/mg  +" import \zs.*\ze +" \v(^import\s+)@<=.*; + +" imported packages  +syn match importName "\v(^import\s+)@<=.*;" +execute "highlight importName ctermfg=4  guifg=".yellow + +" import  +syn match importWord "import " +execute "highlight importWord ctermfg=4  guifg=".purple + +" package name +syn match packageName "\v(^package\s+)@<=.*;" +execute "highlight packageName ctermfg=4  guifg=".yellow + +" package  +syn match packageWord "package " +execute "highlight packageWord ctermfg=4  guifg=".purple + +"ex: int, double, char +execute "highlight javaType ctermfg=4  guifg=".purple + +"ex: static, throws +execute "highlight javaStorageClass ctermfg=4  guifg=".purple + + +"class name... basically starts with caps letter +syntax match ClassName display '\<\([A-Z][a-z0-9]*\)\+\>' +syntax match ClassName display '\.\@<=\*' +highlight link ClassName Identifier +execute "highlight ClassName ctermfg=4  guifg=".yellow + +" Just some special color, why not?   +syn match print " System.out." +execute "highlight print ctermfg=4  guifg=".yellow + +"objects (ex: String)  +execute "highlight Constant ctermfg=4  guifg=".yellow + +" class +syn match javaClassDecl2 " class\> " +execute "highlight javaClassDecl2 ctermfg=4  guifg=".purple + +" package +execute "highlight javaExternal ctermfg=4  guifg=".purple + +"if else switch +execute "highlight javaConditional ctermfg=4  guifg=".purple + +"while for do  +execute "highlight javaRepeat ctermfg=4  guifg=".purple + +"true flase +execute "highlight javaBoolean ctermfg=4  guifg=".orange + + +" null +syn match null "\v[ =]null[; ]" +execute "highlight null ctermfg=4  guifg=".orange + + +" this super +execute "highlight javaTypedef ctermfg=4  guifg=".purple +		 +" var new instanceof +execute "highlight javaOperator ctermfg=4  guifg=".purple +	 +" return +execute "highlight javaStatement ctermfg=4  guifg=".purple + +" static synchronized transient volatile final strictfp serializable +execute "highlight javaStorageClass ctermfg=4  guifg=".purple + +"throw try catch finally +execute "highlight javaExceptions ctermfg=4  guifg=".purple + +" assert +execute "highlight javaAssert ctermfg=4  guifg=".purple + +" synchronized throws +execute "highlight javaMethodDecl ctermfg=4  guifg=".red + +" extends implements interface +execute "highlight javaClassDecl ctermfg=4  guifg=".red + +" interface  +execute "highlight javaClassDecl ctermfg=4  guifg=".purple + +" break continue skipwhite +execute "highlight javaBranch ctermfg=4  guifg=".purple + +" public protected private abstract +execute "highlight javaScopeDecl ctermfg=4  guifg=".purple + + +""""""""""""""""""""""""""""""""""""""' +" java 9... +" module transitive +execute "highlight javaModuleStorageClass ctermfg=4  guifg=".purple + + +" open requires exports opens uses provides  +execute "highlight javaModuleStmt ctermfg=4  guifg=".yellow + + +" to with +execute "highlight javaModuleExternal ctermfg=4  guifg=".red + + +""""""""""""""""""""""""""""""""""""""""" +" lambda +execute "highlight javaLambdaDef ctermfg=4  guifg=".cyan + + +"""""""""""""""""""""""""""""""""""""""""" +" clone equals finalize getClass hashCode +" notify notifyAll toString wait +execute "highlight javaLangObject ctermfg=4  guifg=".yellow + + + + + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + diff --git a/vim-plug/plugins.vim b/vim-plug/plugins.vim index 515fc12e..f960bc95 100644 --- a/vim-plug/plugins.vim +++ b/vim-plug/plugins.vim @@ -41,7 +41,9 @@ call plug#begin('~/.config/nvim/autoload/plugged')      " Plug 'easymotion/vim-easymotion'      " Add some color      Plug 'norcalli/nvim-colorizer.lua' -    Plug 'junegunn/rainbow_parentheses.vim' +    " Plug 'junegunn/rainbow_parentheses.vim' + +    Plug 'luochen1990/rainbow'      " Better Syntax Support      Plug 'sheerun/vim-polyglot'      " Cool Icons | 
