Neovim_Backup/lua/settings.lua

104 lines
2.2 KiB
Lua
Raw Normal View History

2021-12-16 02:15:56 -06:00
-- Defining alias for vim.opt.
local opt = vim.opt
-- Alias for vim.g
local g = vim.g
2021-12-16 02:15:56 -06:00
-- Number settings.
opt.number = true
opt.numberwidth = 2
opt.relativenumber = false
-- Set scroll offset.
opt.scrolloff = 3
-- Remove showing mode.
opt.showmode = false
-- True color support.
2021-12-16 02:15:56 -06:00
opt.termguicolors = true
-- Enable clipboard.
opt.clipboard = "unnamedplus"
-- Enable mouse in all modes.
opt.mouse = "a"
-- Enable cursor line.
opt.cursorline = true
-- Setting colorcolumn. This is set because of
-- this (https://github.com/lukas-reineke/indent-blankline.nvim/issues/59)
-- indent-blankline bug.
opt.colorcolumn = "9999"
-- With set hidden youre telling Neovim that you can
-- have unsaved worked thats not displayed on your screen.
opt.hidden = true
-- Set indentation stuf.
opt.tabstop = 4
opt.shiftwidth = 4
opt.smartindent = true
opt.smartcase = true
opt.expandtab = true
opt.smarttab = true
-- Set searching stuf.
opt.hlsearch = true
opt.incsearch = true
opt.ignorecase = true
-- Set terminal bidirectual.
-- For writing in right to left languages like arabic, persian and hebrew.
opt.termbidi = true
-- Without this option some times backspace did not work correctly.
opt.backspace = "indent,eol,start"
-- For opening splits on right or bottom.
opt.splitbelow = true
opt.splitright = true
-- Enabling ruler and statusline.
opt.ruler = true
-- Setting time that Neovim wait after each keystroke.
opt.ttimeoutlen = 20
opt.timeoutlen = 1000
-- Setting up autocomplete menu.
opt.completeopt = "menuone,noselect"
-- Enable persistent undo
vim.opt.undofile = true
-- Set tokynonight transparency variable
vim.g.tokyonight_transparent = true
2021-12-16 02:15:56 -06:00
-- Add cursorline and diasable it in terminal
vim.cmd("autocmd WinEnter,BufEnter * if &ft is \"toggleterm\" | set nocursorline | else | set cursorline | endif")
-- Set line number for help files.
vim.cmd
[[
augroup help_config
autocmd!
autocmd FileType help :set number
augroup END
]]
-- Auto open nvim-tree when writing (nvim .) in command line
-- and auto open Dashboard when nothing given as argument.
vim.cmd
[[
if index(argv(), ".") >= 0
autocmd VimEnter * NvimTreeToggle
bd1
elseif len(argv()) == 0
autocmd VimEnter * Dashboard
endif
]]
vim.cmd("autocmd BufWritePost plugins.lua source <afile>")