mphe / grayout.vim Goto Github PK
View Code? Open in Web Editor NEWA Vim/Neovim plugin that grays out inactive C/C++/Obj-C preprocessor regions.
License: MIT License
A Vim/Neovim plugin that grays out inactive C/C++/Obj-C preprocessor regions.
License: MIT License
Hello, mphe
I am always use this script to read code. Thanks for your nice grayout.vim!
Recently, I want to change the style of grayout.vim shown, but failed. And the change that I am try is described as following:
In my vimrc, I always add "set cc=80" to code. And now, the grayout.vim will gray an area, but the area beyonds column 80.
So, I am think about whether the grayout.vim can limits this gray area to a certain comumn.
P.S. I had searched how to gray an area and limit the column of the gray area. But I failed. So asking you for help!
Thanks!
After recently updating both vim and plugins, I've started getting a bunch of errors related to Grayout when opening non C files:
Error detected while processing function 52_UpdateGrayout[13]..52_RunPyScript:
What is the proper way to limit the plugin to just .c.h files?
Hi,
grayout.vim is currently not working for me and throws the following error:
Error parsing translation unit.
This is clang related, but I'm not sure what is causes it?
I'm running ubuntu 18.04.02 LTS and invoking grayout from neovim
I have clang 6.0 and 9 installed... any specific version needed?
I remember a long time ago you had grayout_debug_compiler_inout
but that doesn't seem to work anymore?
Any suggestions on how to aid in debugging this?
Thanks.
GrayoutUpdate seems to gray-out everything, even if the #define is in the same c file.
`#define HELLO
#ifdef HELLO
int x = 0;
#endif`
If I run :GrayoutUpdate
, int x = 0;
is grayed out even though HELLO
was defined right above it.
This is my .grayout.conf
:
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F411xE -IDrivers/STM32F4xx_HAL_Driver/Inc -IDrivers/STM32F4xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F4xx/Include -IDrivers/CMSIS/Include -IInc -IInc -IBT
Hi :)
Is this plugin compatible with neovim?
I got an error with neovim:
Error detected while processing /home/gohm/.vim/bundle/grayout.vim/plugin/grayout.vim:
line 19:
This plugin requires python.
Press ENTER or type command to continue`
I have installed the latest pynvim:
pip2 show pynvim
Name: pynvim
Version: 0.4.0
Summary: Python client to neovim
Home-page: http://github.com/neovim/python-client
Author: Thiago de Arruda
Author-email: [email protected]
License: Apache
Location: /usr/local/lib/python2.7/dist-packages
Requires: greenlet, msgpack, trollius`
pip3 show pynvim
Name: pynvim
Version: 0.4.0
Summary: Python client to neovim
Home-page: http://github.com/neovim/python-client
Author: Thiago de Arruda
Author-email: [email protected]
License: Apache
Location: /usr/local/lib/python3.7/dist-packages
Requires: msgpack, greenlet
Required-by:
:checkhealth
## Python 2 provider (optional)
- INFO: Using: g:python_host_prog = "/usr/bin/python2"
- INFO: Executable: /usr/bin/python2
- INFO: Python version: 2.7.17
- INFO: pynvim version: 0.4.0
- OK: Latest pynvim is installed.
## Python 3 provider (optional)
- INFO: Using: g:python3_host_prog = "/usr/bin/python3"
- INFO: Executable: /usr/bin/python3
- INFO: Python version: 3.7.5
- INFO: pynvim version: 0.4.0
- OK: Latest pynvim is installed.
## Ruby provider (optional)
- INFO: Ruby: ruby 2.5.5p157 (2019-03-15 revision 67260
Describe the bug
Log file
grayout.log
https://github.com/junegunn/goyo.vim
vimrc goyo-specific setup:
function! s:goyo_enter()
if executable('tmux') && strlen($TMUX)
silent !tmux set status off
endif
set noshowmode
set noshowcmd
set scrolloff=999
Limelight
" ...
endfunction
function! s:goyo_leave()
if executable('tmux') && strlen($TMUX)
silent !tmux set status on
endif
set showmode
set showcmd
set scrolloff=1
Limelight!
endfunction
Steps to reproduce:
Enter goyo mode with :Goyo
Leave goyo mode with :Goyo
Result:
grayout highligting stops working
Thank you for your great work. It helps me a lot.
Source code like this (which is very common in those "lagacy" projects I am mentaining) will trigger the issue.
/*#ifdef A
#ifdef B
// a tag is injected here
#endif
#endif*/
// no tags will be injected from here
#if D
// no tag injected here
#endif
It seems that "#endif*/" thing caused _parseblock() called directly from _parse() returned, and left the rest of source code unparsed.
I have a solution that works for me. I can not give a qualified pull request, since I am not familiar with python, and it is not well tested.
grayout.py.txt
And I guess this will trigger the same issue as well.
char somestring[] = "\
#endif";
Hi
I have tried to use this script in my vim file, using it helps me read the Linux kernel easily.
But, It seems NOT support the compile_commands.json generated by GCC, is really?
Regards,
Rongwei Wang
Python2.7 is deprecated in the recent releases of vim. However plugin doesn't supports python3
Getting this error when running ':GrayoutUpdate' :
Error detected while processing function grayout#UpdateGrayout:
line 1:
Traceback (most recent call last):
File "", line 1, in
File "/Users/rwmitch1/.vim/bundle/grayout.vim/autoload/../python/grayout.py", line 52, in grayout
tu = INDEX.parse(
AttributeError: 'NoneType' object has no attribute 'parse'
I have installed the ~latest python: python3 --version
Python 3.8.2
OSX: 10.14.6
MacVim is compiled with:
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon -lm -lncurses -lico
nv -framework AppKit -fstack-protector -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl
:version shows I have both +python/dyn and +python3/dyn
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled May 4 2020 07:08:21)
macOS version
Included patches: 1-607
I've used the default grayout configuration arguments and just '-x c'. I've attached the debug log showing both.
What do I have setup incorrectly?
I'm installing it using vim-plugged by doing like this, omitting other plugins:
call plug#begin('~/.vim/plugged')
Plug 'mphe/grayout.vim'
call plug#end()
After this, I called :PlugInstall
with success.
I appended the followings into ~/.vimrc :
" Run GrayoutUpdate when cursor stands still. This can cause lag in more complex files.
autocmd CursorHold,CursorHoldI * if &ft == 'c' || &ft == 'cpp' || &ft == 'objc' | exec 'GrayoutUpdate' | endif
" Set default compile flags.
" These are used, when no `compile_commands.json` or `.grayout.conf` file was found.
let g:grayout_default_args = [ '-x', 'c', '-std=c11' ]
" Set libclang searchpath. Leave empty for auto-detect.
let g:grayout_libclang_path = ''
" Enable to print debug messages inside vim.
let g:grayout_debug = 0
" Enable to write debug messages to `grayout.log`.
let g:grayout_debug_logfile = 0
Now, I open a .c file and move the cursor over a #define
, and vim's command line shows grayout.vim: ERROR: Not initialized
My vim is 8.1 (2018 May 18, compiled Nov 08 2021 14:21:34),
Python 3.8.10,
clang version 10.0.0-4ubuntu1
Ubuntu 20.04.3 LTS
Could anyone tell me what I've lost or what I can try?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.