Coder Social home page Coder Social logo

Comments (5)

tamago324 avatar tamago324 commented on July 17, 2024 1

I'm glad I could help you.
Please feel free to ask me if you need anything else.

from lir.nvim.

tamago324 avatar tamago324 commented on July 17, 2024

hi @kgnugur

Thank you for asking the question.
What you are saying is that you want the cursor to always jump to the first line when you open lir? If so, you can do so by setting the following.

function _G.LirSettings()
  vim.cmd('normal! gg')
end
vim.cmd [[augroup lir-settings]]
vim.cmd [[  autocmd!]]
vim.cmd [[  autocmd Filetype lir :lua LirSettings()]]
vim.cmd [[augroup END]]

Please tell me if I'm wrong.

from lir.nvim.

thekaganugur avatar thekaganugur commented on July 17, 2024

Let's say we opened lir, and pressed Jthat invokes the below function.


function toggle()
  mark_actions.toggle_mark()
  vim.cmd('normal! j')
end

Now, the item under the cursor is marked and my cursors go one line below --> which is this part that I don't like.
I just want to mark without moving any automatic cursor move.

from lir.nvim.

tamago324 avatar tamago324 commented on July 17, 2024

Now, the item under the cursor is marked and my cursors go one line below --> which is this part that I don't like.
I just want to mark without moving any automatic cursor move.

I see, that was your intention. I'm sorry. I was mistaken.

It is possible to pass a table of keys and their corresponding functions to the mappings of setup.
So, if the key is J and the value is mark_actions.toggle_mark, you can select it without moving it down.
It is also possible to pass in your own defined functions, so you can easily create your own actions.
See also the wiki.

local lir = require'lir'
local mark_actions = require'lir.mark.actions'

lir.setup({
  -- ...
  mappings = {
    J = mark_actions.toggle_mark,

    ['!'] = function()
      -- What you want to do
      print('hello world!')
    end
  }
})

from lir.nvim.

thekaganugur avatar thekaganugur commented on July 17, 2024

My bad I feel stupid 😀
vim.cmd('normal! j') was the cause.
Than you.

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