Neovim_Backup/lua/settings.lua
2021-12-16 06:43:30 -06:00

107 lines
2.5 KiB
Lua
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- Defining alias for vim.opt.
local opt = vim.opt
-- Number settings.
opt.number = true
opt.numberwidth = 2
opt.relativenumber = false
-- Set scroll offset.
opt.scrolloff = 3
-- Remove showing mode.
opt.showmode = false
-- True collor support.
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"
-- 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>")
vim.cmd
[[
if has("win32")
set shell=powershell " Your shell must be powershell
let &shellcmdflag = "-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;"
let &shellredir = "2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode"
let &shellpipe = "2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode"
set shellquote= shellxquote=
endif
]]