stevearc / oil.nvim

Neovim file explorer: edit your filesystem like a buffer
MIT License
3.84k stars 110 forks source link

[question] How i can hide numbers in search? #333

Closed kaiphat closed 5 months ago

kaiphat commented 6 months ago

Did you check existing requests?

Describe the feature

How i can hide numbers on left side?

image

Provide background

No response

What is the significance of this feature?

nice to have

Additional details

No response

bugabinga commented 6 months ago

Judging from the code; https://github.com/stevearc/oil.nvim/blob/e462a3446505185adf063566f5007771b69027a1/lua/oil/view.lua#L676 there is currently no way to disable the ID column.

However, in my setup, the ID column sometimes vanishes. It is hard to reliably reproduce. Open nvim without buffer → :Oil → Navigate around with - and _ → ID columns stays persistently. As soon as I load any buffer, the ID column vanishes, most of the time. (NVIM v0.10.0-dev-2660+g7549845e8 in WSL2)

stevearc commented 6 months ago

See :help conceallevel and :help concealcursor for more information about how and why the IDs are being concealed. The ID column is sadly not optional. It's required for oil to be able to track file moves and renames properly.

There was a known bug that was fixed recently related to the ID column sometimes reappearing when it shouldn't #287. See if this is still a problem for you after updating.

If you are still experiencing this issue, it would be extremely helpful to get a simple repro. I can't do much without a repro and can pretty much guarantee that I won't have the time to try to find a repro myself.

bugabinga commented 6 months ago

Here is s repro, that might be the issue at hand.

-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify( './.repro', ':p' )

-- set stdpaths to use .repro
for _, name in ipairs { 'config', 'data', 'state', 'runtime', 'cache', } do
  vim.env[('XDG_%s_HOME'):format( name:upper() )] = root .. '/' .. name
end

-- bootstrap lazy
local lazypath = root .. '/plugins/lazy.nvim'
if not vim.loop.fs_stat( lazypath ) then
  vim.fn.system {
    'git',
    'clone',
    '--filter=blob:none',
    '--single-branch',
    'https://github.com/folke/lazy.nvim.git',
    lazypath,
  }
end
vim.opt.runtimepath:prepend( lazypath )

-- install plugins
local plugins = {
  'folke/tokyonight.nvim',
  {
    'stevearc/oil.nvim',
    cmd = { 'Oil', },
    keys = { { '-', function () require 'oil'.open() end, mode = 'n', desc = 'Open Oil', }, },
    --init = function() vim.cmd.echo '"off"' end, --does not trigger the issue
    init = function() vim.cmd.syntax 'off' end,
    opts = { },
  },
  -- add any other plugins here
}
require 'lazy'.setup( plugins, {
  root = root .. '/plugins',
} )

vim.cmd.colorscheme 'tokyonight'

With the above code, the ID column is always visible, although I am not too sure if this is expected behavior or not, given that syntax off was called.

stevearc commented 6 months ago

Yes, oil relies on this syntax file to conceal the IDs

bugabinga commented 6 months ago

In that case, I fixed my issue by creating a ftplugin/oil.lua file in the Neovim config directory with the following contents:

-- oil needs its syntax file to be able to conceal IDs
vim.opt_local.syntax = 'on'

@kaiphat Can you confirm if this is indeed the same issue you experienced?

jwoo0122 commented 3 months ago

FYI, https://github.com/ggandor/leap.nvim/blob/2ec33f2a38974fe6997c42c5ce61ce84eab84cc8/lua/leap/main.lua#L848 leap.nvim set conceallevel to 0 when it runs. This makes the ID colum flicker while using leap, so I just made conceallevel to 0 for oil. And it'd be better to set contrain cursor option as true.