local function H()if vim.g.neovide then return true end local H=vim.api.nvim_list_uis()if vim.tbl_count(H)==1 then return not(H[1].stdin_tty or H[1].stdout_tty)end return true end local function A()if H()then return true elseif os.getenv("\083\083\072\095\084\084\089")then return true elseif os.getenv("\087\069\090\084\069\082\077\095\085\078\073\088\095\083\079\067\075\069\084")then return true end return false end local function K()vim.o.autoread=true vim.o.breakindent=true vim.o.breakindentopt="\115\098\114"vim.o.showbreak="\226\134\170"vim.o.foldmethod="\109\097\110\117\097\108"vim.o.cmdheight=0 vim.o.colorcolumn="\056\048\044\049\050\048"vim.o.cursorline=true vim.o.expandtab=true vim.o.laststatus=3 vim.o.list=true vim.o.listchars="\116\097\098\058\226\150\184 \044\116\114\097\105\108\058\226\139\133\044\101\120\116\101\110\100\115\058\226\157\175\044\112\114\101\099\101\100\101\115\058\226\157\174"vim.o.number=true if vim.fn.executable("\098\097\115\104")then vim.o.shell=vim.fn.exepath("\098\097\115\104")end vim.o.shortmess="\070\079\073\087\099\097"vim.o.showmatch=true vim.o.showmode=false vim.o.signcolumn="\121\101\115"vim.o.smartcase=true vim.o.smartindent=true vim.o.smarttab=true vim.o.smoothscroll=true vim.o.splitbelow=true vim.o.splitright=true vim.o.splitkeep="\115\099\114\101\101\110"vim.o.swapfile=false vim.o.termguicolors=true vim.o.updatetime=100 if os.getenv("\087\069\090\084\069\082\077\095\080\065\078\069")~=nil and(os.getenv("\084\077\085\088")==nil and os.getenv("\090\069\076\076\073\074")==nil)then vim.o.termsync=false end vim.o.shiftround=true vim.o.more=false if A()then local H=(require("\118\105\109\046\117\105\046\099\108\105\112\098\111\097\114\100\046\111\115\099\053\050")).copy vim.g.clipboard={name="\079\083\067 \053\050";copy={["\043"]=H("\043");["\042"]=H("\042")},paste={["\043"]=function() end;["\042"]=function() end}}end end K()
-- This module contains these options you usually expect to be set with
-- :set or vim.o

local function is_gui_attached()
  if vim.g.neovide then
    return true
  end

  local uis = vim.api.nvim_list_uis()
  if vim.tbl_count(uis) == 1 then
    -- Neovide and other editors have std{in,out}_tty properties set to false
    return not (uis[1].stdin_tty or uis[1].stdout_tty)
  end

  return true
end

local function require_osc52()
  if is_gui_attached() then
    return true
  elseif os.getenv("SSH_TTY") then
    return true
  elseif os.getenv("WEZTERM_UNIX_SOCKET") then
    return true
  end

  return false
end

local function setup()
  -- suggest to reload if file was updated outside
  -- https://neovim.io/doc/user/options.html#'autoread'
  vim.o.autoread = true

  -- keep indentation for a wrapped line
  -- https://neovim.io/doc/user/options.html#'breakindent'
  vim.o.breakindent = true
  vim.o.breakindentopt = "sbr"
  vim.o.showbreak = "↪"

  -- by default we use manual folding
  vim.o.foldmethod = "manual"

  -- Disable mandatory 1 line for cmd
  -- https://neovim.io/doc/user/options.html#'cmdheight'
  vim.o.cmdheight = 0

  -- ruler lines on columns
  -- https://neovim.io/doc/user/options.html#'colorcolumn'
  vim.o.colorcolumn = "80,120"

  -- highlight a line where cursor is placed
  -- https://neovim.io/doc/user/options.html#'cursorline'
  vim.o.cursorline = true

  -- do not use tabs, only spaces
  -- https://neovim.io/doc/user/options.html#'expandtab'
  vim.o.expandtab = true

  -- use global status line
  -- https://neovim.io/doc/user/options.html#'laststatus'
  vim.o.laststatus = 3

  -- show some hidden characters
  -- https://neovim.io/doc/user/options.html#'list'
  vim.o.list = true -- show hidden characters
  vim.o.listchars = "tab:▸ ,trail:⋅,extends:❯,precedes:❮"

  -- show line numbers
  -- https://neovim.io/doc/user/options.html#'number'
  vim.o.number = true

  -- set shell
  -- https://neovim.io/doc/user/options.html#'shell'
  if vim.fn.executable("bash") then
    vim.o.shell = vim.fn.exepath("bash")
  end

  -- what to do with hit-enter pages
  -- https://neovim.io/doc/user/options.html#'shortmess'
  vim.o.shortmess = "FOIWca"

  -- show matching stuff
  -- https://neovim.io/doc/user/options.html#'showmatch'
  vim.o.showmatch = true

  -- do not show active mode.
  -- actually, show but we are going to rely on lualine here instead
  -- https://neovim.io/doc/user/options.html#'showmode'
  vim.o.showmode = false

  -- always reserve a space for a sign column
  -- https://neovim.io/doc/user/options.html#'signcolumn'
  vim.o.signcolumn = "yes"

  -- smartcase search
  -- https://neovim.io/doc/user/options.html#'smartcase'
  vim.o.smartcase = true

  -- always try to smart indent
  -- https://neovim.io/doc/user/options.html#'smartindent'
  vim.o.smartindent = true

  -- smartly recognize when we are going to insert or remove indentation
  -- https://neovim.io/doc/user/options.html#'smarttab'
  vim.o.smarttab = true

  -- enable smoothscroll
  -- https://neovim.io/doc/user/options.html#'smoothscroll'
  vim.o.smoothscroll = true

  -- fix split positions
  -- https://neovim.io/doc/user/options.html#'splitbelow'
  -- https://neovim.io/doc/user/options.html#'splitright'
  -- https://neovim.io/doc/user/options.html#'splitkeep'
  vim.o.splitbelow = true
  vim.o.splitright = true
  vim.o.splitkeep = "screen"

  -- disable swap files
  -- https://neovim.io/doc/user/options.html#'swapfile'
  vim.o.swapfile = false

  -- enable 24bit colors
  -- https://neovim.io/doc/user/options.html#'termguicolors'
  vim.o.termguicolors = true

  -- a period of time to flush to a swap file
  -- https://neovim.io/doc/user/options.html#'updatetime'
  vim.o.updatetime = 100

  if
    os.getenv("WEZTERM_PANE") ~= nil
    and os.getenv("TMUX") == nil
    and os.getenv("ZELLIJ") == nil
  then
    -- https://neovim.io/doc/user/options.html#'termsync'
    -- this just simply does not work well with wezterm multiplexing
    vim.o.termsync = false
  end

  -- always round indentation by a given length
  -- https://neovim.io/doc/user/options.html#'shiftround'
  vim.o.shiftround = true

  -- disable internal pager
  -- https://neovim.io/doc/user/options.html#'more'
  vim.o.more = false

  -- set clipboard
  if require_osc52() then
    local copy = require("vim.ui.clipboard.osc52").copy

    vim.g.clipboard = {
      name = "OSC 52",
      copy = {
        ["+"] = copy("+"),
        ["*"] = copy("*"),
      },
      paste = {
        ["+"] = function() end,
        ["*"] = function() end,
      },
    }
  end
end

setup()
