nix-config/home/neovim/init.lua

99 lines
3.3 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

-- luacheck: globals vim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
vim.g.mapleader = ","
vim.g.maplocaleader = "\\"
require("lazy").setup('plugins')
vim.opt.wrap = false
vim.opt.number = true
vim.opt.compatible = false
vim.opt.mouse = "a" -- mouse support
vim.opt.showcmd = true -- show incomplete cmds down the bottom
vim.opt.showmode = true -- show current mode
vim.opt.showmatch = true -- set show matching parenthesis
vim.opt.visualbell = true -- no sounds
vim.opt.autoread = true -- reload files changed outside of vim
vim.opt.backspace = [[indent,eol,start]] -- allow backspacing over everything in insert mode
vim.opt.ignorecase = true -- ignore case when searching
vim.opt.shiftround = true -- use multiple of shiftwidth when indenting with '<' and '>'
vim.opt.smartcase = true -- ignore case if searching pattern is all lowecase, case-sensitive otherwise
vim.opt.smarttab = true -- insert tabs on the start of a line according to shiftwidth, not tabstop
vim.opt.hlsearch = true -- highlight search terms
vim.opt.incsearch = true -- show search matches as you type
vim.opt.hidden = true
vim.opt.ruler = true
vim.opt.clipboard = "unnamed" -- system clipboard
vim.opt.colorcolumn = "80"
-- vim.cmd("syntax on")
vim.cmd("filetype plugin on")
if vim.fn.has("multi_byte") == 1 and vim.o.encoding == "utf-8" then
vim.opt.listchars = [[tab:▸ ,extends:,precedes:,nbsp:±,trail:…]]
else
vim.opt.listchars = [[tab:> ,extends:>,precedes:<,nbsp:.,trail:_]]
end
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.api.nvim_set_keymap('n', "<A-r>", "<C-w>r", {})
vim.api.nvim_set_keymap('n', "<A-1>", "1gt", {})
vim.api.nvim_set_keymap('n', "<A-2>", "2gt", {})
vim.api.nvim_set_keymap('n', "<A-3>", "3gt", {})
vim.api.nvim_set_keymap('n', "<A-4>", "4gt", {})
vim.api.nvim_set_keymap('n', "<A-5>", "5gt", {})
vim.api.nvim_set_keymap('n', "<A-6>", "6gt", {})
vim.api.nvim_set_keymap('n', "<A-7>", "7gt", {})
vim.api.nvim_set_keymap('n', "<A-8>", "8gt", {})
vim.api.nvim_set_keymap('n', "<A-9>", ":tablast<cr>", {})
vim.api.nvim_set_keymap('n', "<C-l>", ":nohl<CR><C-l>", { noremap = true })
-- todo: try to do it with `vim.api.nvim_set_hl`
vim.cmd("hi CursorLine cterm=NONE,underline ctermbg=NONE") -- highlight line when in insert mode
vim.opt.timeoutlen = 1000
vim.opt.ttimeoutlen = 0
vim.cmd("autocmd InsertEnter * :set cursorline")
vim.cmd("autocmd InsertLeave * :set nocursorline")
-- indentation
vim.cmd("filetype indent on")
vim.opt.softtabstop = 4
vim.opt.expandtab = true
vim.opt.shiftwidth = 4
vim.opt.tabstop = 4
vim.opt.autoindent = true
vim.opt.copyindent = true
-- folds
vim.opt.foldmethod = "indent"
vim.opt.foldnestmax = 3
vim.opt.foldenable = false
vim.opt.termguicolors = true
-- vim.g.markdown_syntax_conceal = 0
vim.opt.updatetime = 100 -- to make gigutter more responsive
if vim.g.neovide then
vim.o.guifont = "Hack Nerd Font:h10"
end