Coder Social home page Coder Social logo

Comments (5)

errael avatar errael commented on May 27, 2024 1

Note the error you are getting

E1072: Cannot compare string with number

You can do

if str2nr(&t_Co) > 2

I don't see what the textwidth issue is about.

from vim.

RestorerZ avatar RestorerZ commented on May 27, 2024 1

string
E1072: Cannot compare string with number

Oh, yeah, that's right!
And I was checking the expression "&t_Co > 2"..... But there is a comparison operation here too.
I'll be more careful.

from vim.

RestorerZ avatar RestorerZ commented on May 27, 2024

I also checked this on my Vim 9.1.0296 build.
And the data types for both "&t_Co > 2" and "has("gui_running")" are numbers.

:echo type(&t_Co > 2)
:echo type(has("gui_running"))

It is possible that an old version of Vim is to blame, as I remember there were several fixes for data types.

from vim.

errael avatar errael commented on May 27, 2024

The type of "&t_Co" is string

vim9script

var x = &t_Co
echo typename(x)

if x > 2
endif
string
E1072: Cannot compare string with number

from vim.

stipplehatch avatar stipplehatch commented on May 27, 2024

Note the error you are getting

E1072: Cannot compare string with number

You can do

if str2nr(&t_Co) > 2

I don't see what the textwidth issue is about.

Fixed with str2nr().
There was no textwidth issue. Had added spaces around the "=" as per the changes in the manual.
Thanks a lot!

from vim.

Related Issues (20)

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.