NeogitOrg / neogit

An interactive and powerful Git interface for Neovim, inspired by Magit
MIT License
3.83k stars 228 forks source link

nowrap is set at startup on nightly #1228

Closed yutkat closed 5 months ago

yutkat commented 5 months ago

Description

NeogitConsole buffer is created when Neogit is started for the first time, but the window is set to nowrap at that time.

https://github.com/NeogitOrg/neogit/blob/4fa379c01040f8a51cd34be29c7e038a34c9f0a5/lua/neogit/lib/buffer.lua#L638-L640

Simple idea is to check if win_handle is nil before setting it up.

if self.win_handle then

Neovim version

NVIM v0.10.0-dev-2765+gb8858dddb Build type: RelWithDebInfo LuaJIT 2.1.1710088188

Operating system and version

ArchLinux

Steps to reproduce

  1. nvim -nu minimal.lua
  2. :set wrap?

Expected behavior

Keep wrap

Actual behavior

nowrap

Minimal config

vim.cmd [[syntax enable]]
vim.cmd [[filetype plugin indent on]]

vim.wo.wrap = true

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
  vim.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  }, { text = true }):wait()
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
  {
    "NeogitOrg/neogit",
    event = "VeryLazy",
    branch = "nightly",
    dependencies = {
      "nvim-lua/plenary.nvim", -- required
    },
    config = true
  },
}, {
  defaults = {
    lazy = true,
  },
})
CKolkey commented 5 months ago

Good catch - I put that behind a guard, so it should only run if there's a win handle to pass. Seems to have solved the wrap value for me. Are you still experiencing the issue?

yutkat commented 5 months ago

Thank you :+1: It works fine with this commit. https://github.com/NeogitOrg/neogit/commit/9043ad7a188f171a4fb6099a2d9280f31bfb443c