Giter Site home page Giter Site logo

Comments (2)

jan-xyz avatar jan-xyz commented on June 2, 2024 1

Thanks for the hint! I dug a bit deeper and in the same doc it says:

  • Q: How can I disable LSP formatting when using the |gq| command?
    A: To use the default internal formatting method and bypass the LSP client's
    'formatexpr', use |gw| instead.
    Alternatively you can completely disable LSP formatting with gq by
    unsetting 'formatexpr':
   vim.api.nvim_create_autocmd('LspAttach', {
       callback = function(args)
           vim.bo[args.buf].formatexpr = nil
       end,
   })

Doing the suggestion from the docs works for me!

from comment.nvim.

andres-lowrie avatar andres-lowrie commented on June 2, 2024

So I had this same issue, and after I uninstalled this plugin to test, I was still facing it. I think the problem is with lsp-config however

:h lsp-config

shows the following

formatexpr' is set to |vim.lsp.formatexpr()| if both 'formatprg' and
  'formatexpr' are empty. This allows to format lines via |gq| if the language
  server supports it.

and for me formatprg is empty but formatexpr is not

:set formatexpr
:set formatprg

# the expression is set to
formatexpr=v:lua.vim.lsp.formatexpr()

so I'm thinking this is a problem with lsp and how I have that configured and not this plugin given the test I did by uninstalling it and also quickly looking at the mappings be set by this plugin gq isn't mentioned anywhere, so I'm leaning towards lsp

Hope that helps and lmk if you find a solve for this


also. When I do gww instead of gqq it kinda works but it's not respecting the column width, I'm diving through the docs to try and understand how all the things interplay... muscle memory is too strong to change 😂

from comment.nvim.

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.