nvim-orgmode / orgmode

Orgmode clone written in Lua for Neovim 0.9+.
https://nvim-orgmode.github.io/
MIT License
3.04k stars 134 forks source link

when an org file is loaded via telescope folding does not work #131

Closed crypt17 closed 2 years ago

crypt17 commented 2 years ago

Are you using "tree-sitter" branch?

No

Describe the bug

if I naviagate to an org file using telescope folding is not enabled

if starting from the command line or using :e then this works as expecded

Steps to reproduce

use the telescope loat file function when loaded everything is expanded and no folds are found

Expected behavior

tab should expand folds

Emacs functionality

No response

Screenshots and recordings

No response

OS / Distro

debian sid

Neovim version/commit

NVIM v0.6.0-dev+509-g09e96fe60

Additional context

No response

levouh commented 2 years ago

Do you have a minimal configuration to reproduce this? Obviously me saying "it works on my machine" isn't super helpful, but it works for me when I use the following configuration:

vim.cmd([[
  set rtp=$VIMRUNTIME
  packadd nvim-treesitter
  packadd orgmode.nvim
  packadd plenary.nvim
  packadd telescope.nvim
]])

vim.g.mapleader = ","

vim.opt.splitright = true
vim.opt.splitbelow = true

require("nvim-treesitter.configs").setup({
  ensure_installed = { "python", "c", "json", "lua", "bash", "comment" },
  highlight = {
    enable = true,
  },
})

local parser_config = require("nvim-treesitter.parsers").get_parser_configs()

parser_config.org = {
  install_info = {
    url = "https://github.com/milisims/tree-sitter-org",
    revision = "main",
    files = { "src/parser.c", "src/scanner.cc" },
  },
  filetype = "org",
}

require("nvim-treesitter.configs").setup({
  highlight = {
    enable = true,
    disable = { "org" },
    additional_vim_regex_highlighting = { "org" },
  },
  ensure_installed = { "org" },
})

require("orgmode").setup()
require("telescope").setup()

_G.find_home_files = function()
  require("telescope.builtin").find_files({ search_dirs = { vim.fn.expand("~") } })
end

vim.api.nvim_set_keymap("n", "<leader>f~", "<Cmd>lua _G.find_home_files()<CR>", { noremap = true })

and run nvim --noplugin -u /path/to/above/file.lua.


Edit: I am using the tree-sitter branch though, whereas you note that you aren't.

crypt17 commented 2 years ago

I do not have much time to look carefully at the moment as I am getting ready for work but this should all the stuff relate to the above that I have

" my vim init settings

" {{{ treesitter :lua require'my_treesitter' " }}}

" {{{ telescope setup :lua require'my_telescope' " lua << EOF " local actions = require('telescope.actions') " " require('telescope').setup { " defaults = { " file_sorter = require('telescope.sorters').get_fzy_sorter, " prompt_prefix = ' >', " color_devicons = true, " " file_previewer = require('telescope.previewers').vim_buffer_cat.new, " grep_previewer = require('telescope.previewers').vim_buffer_vimgrep.new, " qflist_previewer = require('telescope.previewers').vim_buffer_qflist.new, " " mappings = { " i = { " [""] = false, " [""] = actions.send_to_qflist, " }, " } " }, " extensions = { " fzy_native = { " override_generic_sorter = false, " override_file_sorter = true, " } " } " } " require('telescope').load_extension('fzy_native') " EOF " }}}

" {{{ mappings for telescope nnoremap tf :lua require('telescope.builtin').find_files() nnoremap tb :lua require('telescope.builtin').buffers({sortlastused=true}) nnoremap tbd :bdelete nnoremap <C-> :Telescope current_buffer_fuzzy_find sorting_strategy=ascending

" }}}

" {{{ nvim orgmode settings :lua require'my_orgmode' " }}}

" files that I pull in for org, treesitter and telescope

local parser_config = require "nvim-treesitter.parsers".get_parser_configs() parser_config.org = { install_info = { url = 'https://github.com/milisims/tree-sitter-org', revision = 'main', files = {'src/parser.c', 'src/scanner.cc'}, }, filetype = 'org', }

require'nvim-treesitter.configs'.setup { -- If TS highlights are not enabled at all, or disabled via disable prop, highlighting will fallback to default Vim syntax highlighting highlight = { enable = true, disable = {'org'}, -- Remove this to use TS highlighter for some of the highlights (Experimental) additional_vim_regex_highlighting = {'org'}, -- Required since TS highlighter doesn't support all syntax features (conceal) }, ensure_installed = {'org'}, -- Or run :TSUpdate org }

require('orgmode').setup({ org_agenda_files = {'~/Org/*'}, org_default_notes_file = '~/Org/refile.org',

org_agenda_templates = { t = { description = 'Task', template = '* TODO %?\n SCHEDULED: %t', target='~/Org/tasks.org'} },

mappings = { global = { org_agenda = 'oa', org_capture = 'oc' } } })

require'compe'.setup({ source = { orgmode = true } })

" my_treesitter.lua require'nvim-treesitter.configs'.setup{highlight = {enable = true} }

" my_telescope.lua

local actions = require('telescope.actions')

require('telescope').setup { defaults = { file_sorter = require('telescope.sorters').get_fzy_sorter, prompt_prefix = ' >', color_devicons = true,

    file_previewer   =

require('telescope.previewers').vim_buffer_cat.new, grep_previewer = require('telescope.previewers').vim_buffer_vimgrep.new, qflist_previewer = require('telescope.previewers').vim_buffer_qflist.new,

    mappings = {
        i = {
            ["<C-x>"] = false,
            ["<C-q>"] = actions.send_to_qflist,
            ["<C-e>"] = actions.move_selection_previous,
        },
    }
},
extensions = {
    fzy_native = {
        override_generic_sorter = false,
        override_file_sorter = true,
    }
}

} require('telescope').load_extension('fzy_native')

On Wed, 3 Nov 2021 at 12:57, August Masquelier @.***> wrote:

Do you have a minimal configuration to reproduce this? Obviously it isn't super helpful, but it works for me on my machine when I use:

vim.cmd([[ set rtp=$VIMRUNTIME packadd nvim-treesitter packadd orgmode.nvim packadd plenary.nvim packadd telescope.nvim ]])

vim.g.mapleader = ","

vim.opt.splitright = true vim.opt.splitbelow = true

require("nvim-treesitter.configs").setup({ ensure_installed = { "python", "c", "json", "lua", "bash", "comment" }, highlight = { enable = true, }, })

local parser_config = require("nvim-treesitter.parsers").get_parser_configs() parser_config.org = { install_info = { url = "https://github.com/milisims/tree-sitter-org", revision = "main", files = { "src/parser.c", "src/scanner.cc" }, }, filetype = "org", }

require("nvim-treesitter.configs").setup({ highlight = { enable = true, disable = { "org" }, additional_vim_regex_highlighting = { "org" }, }, ensure_installed = { "org" }, })

require("orgmode").setup() require("telescope").setup()

_G.find_home_files = function() require("telescope.builtin").find_files({ search_dirs = { vim.fn.expand("~") } }) end

vim.api.nvim_set_keymap("n", "f~", "lua _G.find_home_files()", { noremap = true })

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kristijanhusak/orgmode.nvim/issues/131#issuecomment-958461421, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJN5S46TGYQMUA57CG27SRLUKCCIJANCNFSM5HHSKF6A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

levouh commented 2 years ago

Yea so you are using the tree-sitter branch it appears. Can you try with the configuration & command I mentioned and see if the issue still persists? It doesn't require any weird configuration changes, just copy that file and pass it as the value to -u.

crypt17 commented 2 years ago

will try that when I get back from work

On Thu, 4 Nov 2021 at 12:11, August Masquelier @.***> wrote:

Yea so you are using the tree-sitter branch it appears. Can you try with the configuration & command I mentioned and see if the issue still persists? It doesn't require any weird configuration changes, just copy that file and pass it as the value to -u.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kristijanhusak/orgmode.nvim/issues/131#issuecomment-960280324, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJN5S42MLJ7SBW4HLU2NZZ3UKHFR3ANCNFSM5HHSKF6A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

crypt17 commented 2 years ago

Hi I tried your config file but it didn't work due to the lack of having tack installed.

I will have a further play during the weekend

On Thu, 4 Nov 2021 at 12:11, August Masquelier @.***> wrote:

Yea so you are using the tree-sitter branch it appears. Can you try with the configuration & command I mentioned and see if the issue still persists? It doesn't require any weird configuration changes, just copy that file and pass it as the value to -u.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kristijanhusak/orgmode.nvim/issues/131#issuecomment-960280324, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJN5S42MLJ7SBW4HLU2NZZ3UKHFR3ANCNFSM5HHSKF6A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

kristijanhusak commented 2 years ago

@crypt17 did you manage to set it up? You can use master branch now, it has tree sitter support.

kristijanhusak commented 2 years ago

Closing due to inactivity.

milanglacier commented 1 year ago

I have the same problem with this issue,

if a file is opended via telescope, e.g :Telescope oldfiles, then folding does not work

jyfzh commented 1 year ago