nvim/init.lua
2025-06-04 17:26:03 +02:00

96 lines
2 KiB
Lua

-- lua configuratiuon file for neovim
local opt = vim.opt
local g = vim.g
opt.clipboard = "unnamedplus"
opt.cursorline = true
opt.showmode = false
opt.laststatus = 3
-- Indenting
opt.expandtab = true
opt.shiftwidth = 2
opt.smartindent = true
opt.tabstop = 2
opt.softtabstop = 2
opt.fillchars = { eob = " " }
opt.ignorecase = true
opt.smartcase = true
opt.mouse = "a"
opt.mousemoveevent = true
-- Numbers
opt.number = true
opt.numberwidth = 2
opt.ruler = false
opt.signcolumn = "yes"
opt.splitbelow = true
opt.splitright = true
opt.termguicolors = true
opt.timeoutlen = 300
opt.undofile = true
g.mapleader = ","
-- opt.fillchars = { eob = "~" }
opt.scrolloff = 4
opt.spelllang = "fr"
opt.colorcolumn = { 100 }
-- opt.textwidth = 100
opt.timeoutlen = 1000
opt.breakindent = true
opt.foldmethod = "expr"
opt.foldlevelstart = 99
opt.foldexpr = 'nvim_treesitter#foldexpr()'
opt.sessionoptions = 'blank,buffers,curdir,help,tabpages,winsize,terminal'
require("bootstrap")
local plugins = require("plugins")
require("lazy").setup(plugins)
if vim.fn.getenv("TERM") == "xterm-kitty" and vim.fn.getenv("SSH_CONNECTION") ~= nil then
vim.g.clipboard = {
name = 'OSC 52',
copy = {
['+'] = require('vim.ui.clipboard.osc52').copy '+',
['*'] = require('vim.ui.clipboard.osc52').copy '*',
},
paste = {
['+'] = require('vim.ui.clipboard.osc52').paste '+',
['*'] = require('vim.ui.clipboard.osc52').paste '*',
},
}
end
vim.cmd.colorscheme "catppuccin"
function set_theme_according_to_darkman()
local obj = vim.system({ 'darkman', 'get' }, { text = true }):wait()
if obj.code == 0 then
local theme = "light"
if obj.stdout == "dark\n" then
theme = "dark"
end
if obj.stdout == "light\n" then
theme = "light"
end
opt.background = theme
vim.api.nvim_exec_autocmds("ColorScheme", {})
end
end
set_theme_according_to_darkman()
vim.api.nvim_create_autocmd("Signal", {
pattern = "SIGUSR1",
callback = set_theme_according_to_darkman
})
require("mappings")