GithubHelp home page GithubHelp logo

aserebryakov / filestyle Goto Github PK

View Code? Open in Web Editor NEW
30.0 6.0 5.0 85 KB

filestyle is a Vim plugin that highlights unwanted whitespace and characters.

Home Page: http://www.vim.org/scripts/script.php?script_id=5065

License: Apache License 2.0

Vim Script 100.00%
viml vim-plugins vim-plugin vim-scripts clean-code

filestyle's People

Contributors

alx741 avatar aserebryakov avatar kovetskiy avatar markus00000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

filestyle's Issues

Disable FileStyle in Quickfix

I've tried pretty much everything, but I cannot get FileStyleDeactivate to work when a QuickFix window is populated. The result is compiler errors being highlighted because their lines are too long. This isn't a massive issue, but it's certainly a nuisance. Would it be possible to have an option for FileStyle to not act on QuickFix or nonmodifiable buffers in general?

[BUG]: Error E315 if 'splitbelow' option is set.

When using the splitbelow option, I get strange Vim internal errors (E315), for each line, when opening a help topic.

How to reproduce (minimal vimrc - I use vim-plug as plugin manager):

set nocompatible

filetype off
call plug#begin('~/.vim/plugged')
    Plug 'aserebryakov/filestyle'
call plug#end()

filetype plugin indent on
syntax on

set splitbelow

The errors look like:

:h syntax.txt
E315: ml_get: invalid lnum: 5319
E315: ml_get: invalid lnum: 5318
...
E315: ml_get: invalid lnum: 1

I suspect the wincmd w commands are to blame, but I don't know how to change them.

Thanks for the plugin!

Normal colorscheme in vim problems

Hi!
I am new to vim and I am using it in linux terminal.

This colorscheme issue gave me some problems...

First it would be good to change

hi Normal ctermbg=15

in documentaion to

highlight Normal ctermbg=15

so it would be possible just to google it. Googling for "hi" is pointless...

Second issue, I am using some black background color scheme, that goes in debian by default.

When I did "hi Normal ctermbg=15" background changed to white, it was awful.

I tried "hi Normal ctermbg=0" it made background black, but changed colors of the text.

Trying things blindly I came to "hi Normal ctermbg=16" that gives black background and keeps text colors as they were. But I do not understand why.

It would be nice to have more explanation in the doc concerning this Normal colorscheme issue. Or may be not explanations but some ready recipes for new users like "use "hi Normal ctermbg=16" if your color scheme is black", if it is too complex to explain. There should not be many usual cases, so most of them can be covered.

[FEATURE]: Do not highlight trailing spaces in INSERT mode

User scenario

  1. Switch to INSERT mode
  2. Type a sentence

Current behavior

Each time when user puts a space after word and before starting a new word, trailing space is highlighted.

Expected behavior

Trailing space is not highlighted in current line while in INSERT mode, but highlighted immediately after exiting from INSERT mode

Automatic styling errors fixing when file is opened

Functionality

When file is opened and style is checked, user should be asked if he wants to cleanup the file.

Additional Requirements

  • Add an option to enable / disable this feature
  • Feature should be disabled by default

Function [...] already exists

I'm using vundle and after installing any other plugin i got a messages:

Error detected while processing /home/vxw/repos/filestyle/plugin/filestyle.vim:
line   54:
E122: Function FileStyleActivate already exists, add ! to replace it
line   65:
E122: Function FileStyleDeactivate already exists, add ! to replace it
line   73:
E122: Function FileStyleClearFile already exists, add ! to replace it
line   82:
E122: Function FileStyleCheckFiletype already exists, add ! to replace it
line   88:
E122: Function FileStyleHighlightPattern already exists, add ! to replace it
line  101:
E122: Function FileStyleExpandtabCheck already exists, add ! to replace it
line  109:
E122: Function FileStyleTrailingSpaces already exists, add ! to replace it
line  119:
E122: Function FileStyleLongLines already exists, add ! to replace it
line  127:
E122: Function FileStyleControlCharacters already exists, add ! to replace it
line  139:
E122: Function FileStyleCheck already exists, add ! to replace it

Make \t\t\t\s\s indent schema possible

Hi!
In some projects codestyle allows to use several spaces after tabs for indention.
So it would be good if there would be possibility to configure filestyle to accept it.

As far as I can see it there can be two modes in it.

  1. spaces after tabs (or some number of it) are totally legal. So user can enumerate numbers of spaces that are acceptable
    2 for accept \t*\s\s
    1,2,3 for accept \t*\s*{1,3}
    (regexp are in perl-style sorry)

The last one I've solved with

let g:filestyle_ignore_patterns = ['^\t* \{1,3}\S']

but it take me a while, i am not good with vim regexp. Better to have it in the code of plugin or at least in documentation...

  1. Second mode is when spaces after tabs are acceptable, but should draw an attention.

As far as I can see this mode should be configured in the same way, and only spaces after \t* should be highlighted in some warning highlight background (i.e. gray: all is ok, but please pay attention)

This mode will suit me better then the first one, but I am not able to implement using tools that are described in plugin docs.

[FEATURE]: Style fixing

Requirements:

  1. User should be able to fix style errors with a command
  2. Trailing spaces should be removed
  3. Tabs should be replaced by spaces dependently on expandtab option set
  4. Spaces in the beginning of the line should be replaces by tabs if noexpandtab option is set
  5. In case of control symbols in the file, user should be asked if they will be removed

Find a better solution for issue #6

Current solution l of the issue 'Spaces and tabs are highlighed for help files #6' looks like a workaround of the issue. Probably, there is another one better solution.

[BUG:] E803 error when opening a go file using Unite

Should be able to duplicate this by opening the tcp_socket.go file in github.com/docker/docker/

Here is the full error message:

[unite.vim] function FileStyleActivate..FileStyleCheck..FileStyleClearBufferMatches, line 3
[unite.vim] Vim(call):E803: ID not found: 10
[unite.vim] Error occurred while executing "open" action!

\t\t\s\t\t is highligted only till the first space

I am using filstyle without expandtab

I found out that if I mix spaces and tabs in indention then this mix will be highlighted only till the first space in that mixture. The rest of the empty space would be black.

I do not see it is as a good behavior, as if i do \s\t\t\t\t\t only one character will be highlighted so it would be a bit difficult to notice the problem.

The second issue, if somebody will write \s\t\s\t\s\t\s\t\s\t I would not be able to see the whole problem form the start, I will see next problematic space only after deleting the previous one.

So my suggestion is the following: If there is a problem is indention the whole indention is highlighted as yellow. And all problematic characters are highlighted in red. It should work in this way both with expandtab and without. Expandtab just changes what characters are considered wrong.

Error first time open vim after downloading filestyle

After I download filestyle to my vim folder, when I open a file in Vim, this error is raised:

FileStyle: ctermbg parameter should be defined explicitly. Ignored patterns are disabled

Error detected while processing VimEnter Autocommands for "*"..function FileStyleActivate[3]..FileStyleCheck[13]..FileStyleClearBufferMatches:
line    3:
E803: ID not found: 7
Press ENTER or type command to continue
Error detected while processing VimEnter Autocommands for "*"..function FileStyleActivate[3]..FileStyleCheck[13]..FileStyleClearBufferMatches:
line    3:
E803: ID not found: 8
Press ENTER or type command to continue
Error detected while processing VimEnter Autocommands for "*"..function FileStyleActivate[3]..FileStyleCheck[13]..FileStyleClearBufferMatches:
line    3:
E803: ID not found: 9
Press ENTER or type command to continue

[BUG]: Errors when starting Vim in a narrow terminal

Starting Vim in a narrow terminal with fewer than 40 columns produces these messages at startup and while editing:

FileStyle: ctermbg parameter should be defined explicitly
Press ENTER or type command to continue

Error detected while processing functio
n FileStyleActivate..FileStyleCheck..Fi
leStyleClearIgnoredPatters..FileStyleHi
ghlightPattern:
line    7:
E28: No such highlight group name: File
StyleIgnoredPattern
Error detected while processing functio
n FileStyleActivate..FileStyleCheck..Fi
leStyleClearBufferMatches:
line    3:
E802: Invalid ID: -1 (must be greater t
han or equal to 1)
Press ENTER or type command to continue

Error detected while processing functio
n FileStyleActivate..FileStyleCheck..Fi
leStyleClearIgnoredPatters..FileStyleHi
ghlightPattern:
line    7:
E28: No such highlight group name: File
StyleIgnoredPattern
Press ENTER or type command to continue

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.