nvim.d/neovim/init.lua

67 lines
2.6 KiB
Lua

local set = vim.opt
local g = vim.g
local cmd = vim.cmd
g.mapleader = ","
-- Backups, Undos and Swaps
set.backup = true
set.writebackup = true
set.backupdir = vim.fn.stdpath("data").."/backup"
set.swapfile = true
set.directory = vim.fn.stdpath("data").."/swap"
set.undofile = true
set.undodir = vim.fn.stdpath("data").."/undo"
set.viewdir = vim.fn.stdpath("data").."/view"
set.spellfile = vim.fn.stdpath("data").."/spell/en.utf-8.add"
-- Searching
set.ignorecase = true -- ignore case when searching.
set.smartcase = true -- override ignorecase when upper case characters are used when searching.
set.incsearch = true -- set incremental searching.
-- Default tabs and spaces
set.expandtab = true -- turn tabs into spaces
set.tabstop = 2 -- number of spaces per tab
set.softtabstop = 2 -- number of spaces per tab while editing
set.shiftwidth = 2 -- specifies the amount of whitespaces to insert/remove using indentation commands in normal mode.
-- File format and encoding
set.fileformat = "unix"
set.encoding = "utf-8"
set.fileencoding = "utf-8"
set.fileencodings = "utf-8"
-- Colour scheme
set.termguicolors = true
set.background = "dark"
g.tokyonight_style = "night"
g.tokyonight_sidebars = {"packer", "terminal"}
cmd "colorscheme tokyonight"
-- UI and UX
set.number = true -- enable line numbers
set.relativenumber = true -- enable releative line numbers
set.lazyredraw = true -- do not redraw screen when executing macros, registers, etc that have not been typed
set.splitright = true -- split vertical windows to the right
set.splitbelow = true -- split horizontal windows below
g.pastetoggle = "<F3>" -- Use <F3> to toggle paste/nopaste
set.confirm = true -- raise a dialogue to confirm if you wish to save a file before continuing.
set.cmdheight = 2 -- set the height of the command window to 2 lines.
set.modelines = 5 -- the first 5 lines are checked for modelines.
set.cursorline = true -- highlight the line that the cursor is on
set.smartindent = true -- smart autoidenting
set.scrolloff = 5
set.signcolumn = "number"
set.completeopt = "longest,menuone"
-- Netrw settings
g.netrw_banner = 0 -- disable the banner
g.netrw_liststyle = 3 -- display files and folders in a tree style
g.netrw_browse_split = 2 -- open files in a vertical split by default
g.netrw_altv = 1 -- open split to the right
g.netrw_winsize = 10 -- set the size of the Explorer window
g.netrw_keepdir = 0 -- keep the browsing directory the same as the current directory
--- Configure Omnifunc to use the LSP client.
set.omnifunc = "v:lua.vim.lsp.omnifunc"