GithubHelp home page GithubHelp logo

Comments (5)

anihm136 avatar anihm136 commented on July 20, 2024 1

One way to solve this would be to set a custom filetype for the preview buffer in the plugin (say, glowpreview). Then, while setting the mapping, the autocommand can include that filetype as well. Thoughts?

from glow.nvim.

ellisonleao avatar ellisonleao commented on July 20, 2024

I cannot toggle the glow preview window by hitting because the mapping is not enabled in the preview buffer.

So are you suggesting to have the same mapping added to call the window and to close it? like a toggling feature? The current :Glow command already works as a toggle, so if you call the original mapping it will already close the window

from glow.nvim.

mnacamura avatar mnacamura commented on July 20, 2024

I want to map some key (in the above example, <Space>) to :Glow<CR> only when file type is markdown, not global. The problem for doing this is that the mapping is not available in the preview buffer. So I proposed enabling to customize mapping to toggle preview window in the preview buffer.

from glow.nvim.

ellisonleao avatar ellisonleao commented on July 20, 2024

This is what i am not understanding. Do you want a custom mapping to trigger the window AND another one for closing it?

from glow.nvim.

mnacamura avatar mnacamura commented on July 20, 2024

Do you want a custom mapping to trigger the window AND another one for closing it?

Yes. More precisely, I need

augroup glow
autocmd!
autocmd FileType markdown nnoremap <buffer> <silent> <Space> <Cmd>Glow<CR>
augroup END

to open a preview window by typing <Space> only in markdown file type, AND

-- In lua/glow.lua around lines 115-118
api.nvim_buf_set_keymap(buf, "n", "<Space>", ":lua require('glow').close_window()<cr>",
                                            {noremap = true, silent = true})

to close the preview window, because the above autocmd does not work in the preview window.

from glow.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.