dotfiles/.config/nvim/lua/settings.lua

89 lines
2.2 KiB
Lua
Raw Normal View History

2022-07-23 11:52:42 +02:00
vim.cmd([[set undofile]])
vim.cmd([[set completeopt-=preview]])
vim.cmd([[set viewoptions-=options]])
vim.g.mapleader = ","
2021-04-18 18:51:03 +02:00
vim.o.hidden = true
2022-07-23 11:52:42 +02:00
vim.o.mouse = "a"
2021-04-18 18:51:03 +02:00
vim.o.splitbelow = true
vim.o.splitright = true
vim.o.ttimeout = true
vim.o.ttimeoutlen = 50
vim.o.updatetime = 100
vim.o.autochdir = true
2021-06-17 11:29:04 +02:00
vim.o.backupdir = "/home/dln/.local/share/nvim/backup/"
vim.o.backup = true
2022-03-04 12:11:26 +01:00
vim.g.netrw_dirhistmax = 0
vim.o.clipboard = "unnamedplus"
2021-04-20 18:10:56 +02:00
2021-04-18 18:51:03 +02:00
--- Indent
2022-01-12 15:58:29 +01:00
vim.o.autoindent = true
2021-04-20 18:10:56 +02:00
vim.o.breakindent = true
2022-01-12 15:58:29 +01:00
vim.o.expandtab = true
vim.o.smartindent = true
2021-04-18 18:51:03 +02:00
vim.o.joinspaces = false
2022-07-23 11:52:42 +02:00
vim.o.listchars = "extends:,precedes:,nbsp:·,tab:→ ,trail:·"
2021-04-18 18:51:03 +02:00
vim.wo.foldlevel = 99
vim.wo.linebreak = true
vim.wo.list = true
2021-06-17 11:29:04 +02:00
vim.o.shiftwidth = 2
vim.o.tabstop = 2
vim.o.softtabstop = 2
2021-04-18 18:51:03 +02:00
--- Search
2022-07-23 11:52:42 +02:00
vim.cmd("set path+=**")
vim.cmd("set wildignore+=*/tmp/*,/var/*,*.so,*.swp,*.zip,*.tar,*.pyc")
2021-04-18 18:51:03 +02:00
vim.o.ignorecase = true
vim.o.smartcase = true
2022-07-23 11:52:42 +02:00
vim.o.wildmode = "longest:full,full"
2021-04-18 18:51:03 +02:00
2022-07-23 11:52:42 +02:00
if vim.fn.executable("rg") then
vim.o.grepprg = "rg --vimgrep --no-heading --smart-case"
2021-04-18 18:51:03 +02:00
end
--- Completion
2022-07-23 11:52:42 +02:00
vim.cmd("set shortmess+=c")
vim.o.completeopt = "menuone,noinsert,noselect"
2021-04-18 18:51:03 +02:00
--- Appearance
2022-07-23 11:52:42 +02:00
vim.o.background = "light"
2022-03-04 12:11:26 +01:00
vim.o.scrolloff = 5
2021-04-18 18:51:03 +02:00
vim.o.showmode = false
vim.o.sidescrolloff = 5
vim.o.termguicolors = true
vim.wo.cursorline = true
vim.wo.number = true
2021-04-20 18:10:56 +02:00
vim.wo.signcolumn = "yes"
2021-04-19 20:22:00 +02:00
vim.o.laststatus = 0
vim.o.statusline = ""
vim.o.fillchars = "stl:═,stlnc:═"
2022-03-04 12:11:26 +01:00
vim.o.title = true
vim.o.titlestring = "%F%m %r %y"
vim.wo.foldmethod = "expr"
vim.wo.foldexpr = "nvim_treesitter#foldexpr()"
2021-04-18 18:51:03 +02:00
--- Key mappings
local map = require("dln.utils").map
2022-07-23 11:52:42 +02:00
map("n", "<C-l>", ':let @/=""<CR>') -- clear search
map("n", "H", "^")
map("n", "L", "$")
map("i", "", "<C-w>")
2021-04-18 18:51:03 +02:00
2022-07-23 11:52:42 +02:00
map("n", ",L", ":luafile %<CR>") -- Reload lua file
2022-03-04 12:11:26 +01:00
2021-04-18 18:51:03 +02:00
--- Plugins
vim.g.netrw_dirhistmax = 0
2021-12-20 13:00:25 +01:00
local border = {
2022-07-23 11:52:42 +02:00
{ "🭽", "FloatBorder" },
{ "", "FloatBorder" },
{ "🭾", "FloatBorder" },
{ "", "FloatBorder" },
{ "🭿", "FloatBorder" },
{ "", "FloatBorder" },
{ "🭼", "FloatBorder" },
{ "", "FloatBorder" },
2021-04-20 18:10:56 +02:00
}
2021-04-19 15:28:25 +02:00
2021-12-20 13:00:25 +01:00
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
2022-07-23 11:52:42 +02:00
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border })