63 lines
1.9 KiB
Lua
63 lines
1.9 KiB
Lua
local env = require 'env'
|
|
|
|
-- Must be set before plugins load.
|
|
vim.g.mapleader = ' '
|
|
vim.g.maplocalleader = ' '
|
|
vim.g.have_nerd_font = env.has_nerd_font
|
|
|
|
local o = vim.opt
|
|
|
|
o.number = true
|
|
o.relativenumber = true
|
|
o.mouse = 'a'
|
|
o.showmode = false -- the statusline already shows it
|
|
o.breakindent = true
|
|
o.undofile = true
|
|
o.ignorecase = true
|
|
o.smartcase = true
|
|
o.signcolumn = 'yes'
|
|
o.updatetime = 250
|
|
o.timeoutlen = 300
|
|
o.splitright = true
|
|
o.splitbelow = true
|
|
o.list = true
|
|
o.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
|
o.inccommand = 'split'
|
|
o.cursorline = true
|
|
o.scrolloff = 20
|
|
o.confirm = true -- ask instead of failing on :q with unsaved changes
|
|
o.winborder = 'rounded' -- 0.11+: border for every floating window (hover, signature, ...)
|
|
|
|
-- 2-space default; vim-sleuth overrides it per file when the file says otherwise.
|
|
o.tabstop = 2
|
|
o.softtabstop = 2
|
|
o.shiftwidth = 2
|
|
o.expandtab = true
|
|
|
|
-- Providers for other languages are never used here; disabling them silences :checkhealth
|
|
-- warnings and saves a little startup time.
|
|
vim.g.loaded_node_provider = 0
|
|
vim.g.loaded_perl_provider = 0
|
|
vim.g.loaded_python3_provider = 0
|
|
vim.g.loaded_ruby_provider = 0
|
|
|
|
-- Clipboard.
|
|
-- Over SSH (or on any box with no clipboard tool) copy through OSC 52, so the terminal sets
|
|
-- your local clipboard, and paste from the internal register: most terminals refuse OSC 52
|
|
-- reads and Neovim would hang waiting for the answer. tmux needs `set -g set-clipboard on`.
|
|
if env.is_ssh or not env.has_clipboard_tool() then
|
|
local osc52 = require 'vim.ui.clipboard.osc52'
|
|
local function paste()
|
|
return { vim.fn.split(vim.fn.getreg '', '\n'), vim.fn.getregtype '' }
|
|
end
|
|
vim.g.clipboard = {
|
|
name = 'OSC 52',
|
|
copy = { ['+'] = osc52.copy '+', ['*'] = osc52.copy '*' },
|
|
paste = { ['+'] = paste, ['*'] = paste },
|
|
}
|
|
end
|
|
-- Scheduled: setting it before UiEnter slows startup.
|
|
vim.schedule(function()
|
|
o.clipboard = 'unnamedplus'
|
|
end)
|