faster settings.lua; added globals to default conf (#609)

This commit is contained in:
Zahin Muhaimeen 2021-07-04 01:33:54 +10:00 committed by GitHub
parent 98c4324084
commit 1137ef1a4a
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 60 additions and 51 deletions

View file

@ -1,6 +1,7 @@
CONFIG_PATH = vim.fn.stdpath('config') CONFIG_PATH = vim.fn.stdpath('config')
DATA_PATH = vim.fn.stdpath('data') DATA_PATH = vim.fn.stdpath('data')
CACHE_PATH = vim.fn.stdpath('cache') CACHE_PATH = vim.fn.stdpath('cache')
TERMINAL = vim.fn.expand('$TERMINAL')
O = { O = {
auto_close_tree = 0, auto_close_tree = 0,
@ -18,6 +19,7 @@ O = {
ignore_case = true, ignore_case = true,
smart_case = true, smart_case = true,
lushmode = false, lushmode = false,
hl_search = false,
leader_key = "space"; leader_key = "space";
-- @usage pass a table with your desired languages -- @usage pass a table with your desired languages
@ -188,8 +190,7 @@ O = {
formatter = '', formatter = '',
autoformat = false, autoformat = false,
virtual_text = true virtual_text = true
}, }
zig = {}
}, },

View file

@ -1,50 +1,58 @@
vim.cmd('set iskeyword+=-') -- treat dash separated words as a word text object" --- HELPERS ---
vim.opt.shortmess:append("c") -- Don't pass messages to |ins-completion-menu|.
vim.cmd('set inccommand=split') -- Make substitution work in realtime
vim.o.hidden = O.hidden_files -- Required to keep multiple buffers open multiple buffers local cmd = vim.cmd
vim.o.title = true local opt = vim.opt
TERMINAL = vim.fn.expand('$TERMINAL')
vim.cmd('let &titleold="'..TERMINAL..'"')
vim.o.titlestring="%<%F%=%l/%L - nvim" --- VIM ONLY COMMANDS ---
vim.wo.wrap = O.wrap_lines -- Display long lines as just one line
vim.cmd('set whichwrap+=<,>,[,],h,l') -- move to next line with theses keys
vim.o.pumheight = 10 -- Makes popup menu smaller cmd('filetype plugin on') -- filetype detection
vim.o.fileencoding = "utf-8" -- The encoding written to file cmd('let &titleold="'..TERMINAL..'"')
vim.o.cmdheight = 2 -- More space for displaying messages cmd('set inccommand=split') -- show what you are substituting in real time
vim.cmd('set colorcolumn=99999') -- fix indentline for now cmd('set iskeyword+=-') -- treat dash as a separate word
vim.o.mouse = "a" -- Enable your mouse cmd('set whichwrap+=<,>,[,],h,l') -- move to next line with theses keys
vim.o.splitbelow = true -- Horizontal splits will automatically be below
vim.o.termguicolors = true -- set term gui colors most terminals support this
vim.o.splitright = true -- Vertical splits will automatically be to the right --- SETTINGS ---
-- vim.o.t_Co = "256" -- Support 256 colors
vim.o.conceallevel = 0 -- So that I can see `` in markdown files
vim.opt.tabstop = 4 -- Insert 2 spaces for a tab opt.backup = false -- creates a backup file
vim.opt.shiftwidth = 4 -- Change the number of space characters inserted for indentation opt.clipboard = "unnamedplus" -- allows neovim to access the system clipboard
--vim.opt.softtabstop = 4 opt.cmdheight = 2 -- more space in the neovim command line for displaying messages
vim.opt.expandtab = true -- Converts tabs to spaces opt.colorcolumn = "99999" -- fix indentline for now
vim.o.completeopt = "menuone,noselect" opt.completeopt = {'menuone', 'noselect'}
vim.bo.smartindent = true -- Makes indenting smart opt.conceallevel = 0 -- so that `` is visible in markdown files
vim.wo.number = O.number -- set numbered lines opt.fileencoding = "utf-8" -- the encoding written to a file
vim.wo.relativenumber = O.relative_number -- set relative number opt.guifont = "monospace:h17" -- the font used in graphical neovim applications
vim.wo.cursorline = O.cursorline -- set highlighting of the current line opt.hidden = O.hidden_files -- required to keep multiple buffers and open multiple buffers
vim.o.showtabline = 2 -- Always show tabs opt.hlsearch = O.hl_search -- highlight all matches on previous search pattern
vim.o.showmode = false -- We don't need to see things like -- INSERT -- anymore opt.ignorecase = O.ignore_case -- ignore case in search patterns
vim.o.backup = false -- This is recommended by coc opt.mouse = "a" -- allow the mouse to be used in neovim
vim.o.writebackup = false -- This is recommended by coc opt.pumheight = 10 -- pop up menu height
vim.o.swapfile = false -- Do not write any swp files opt.showmode = false -- we don't need to see things like -- INSERT -- anymore
vim.o.undodir = CACHE_PATH .. '/undo' -- Set undo directory opt.showtabline = 2 -- always show tabs
vim.o.undofile = true -- Enable persistent undo opt.smartcase = O.smart_case -- smart case
vim.wo.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time opt.smartindent = true -- make indenting smarter again
vim.o.updatetime = 300 -- Faster completion opt.splitbelow = true -- force all horizontal splits to go below current window
vim.o.timeoutlen = O.timeoutlen -- By default timeoutlen is 1000 ms opt.splitright = true -- force all vertical splits to go to the right of current window
vim.o.clipboard = "unnamedplus" -- Copy paste between vim and everything else opt.swapfile = false -- creates a swapfile
-- vim.g.nvim_tree_disable_netrw = O.nvim_tree_disable_netrw -- enable netrw for remote gx gf support (must be set before plugin's packadd) opt.termguicolors = true -- set term gui colors (most terminals support this)
vim.cmd('filetype plugin on') -- filetype detection opt.timeoutlen = O.timeoutlen -- time to wait for a mapped sequence to complete (in milliseconds)
-- vim.o.guifont = "JetBrainsMono\\ Nerd\\ Font\\ Mono:h18" opt.title = true -- set the title of window to the value of the titlestring
-- vim.o.guifont = "Hack\\ Nerd\\ Font\\ Mono" opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will be set to
-- vim.o.guifont = "SauceCodePro Nerd Font:h17" opt.undodir = CACHE_PATH .. '/undo' -- set an undo directory
vim.o.guifont = "FiraCode Nerd Font:h17" opt.undofile = true -- enable persisten undo
opt.updatetime = 300 -- faster completion
opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
opt.expandtab = true -- convert tabs to spaces
opt.shiftwidth = 4 -- the number of spaces inserted for each indentation
opt.shortmess:append("c") -- don't pass messages to |ins-completion-menu|
opt.tabstop = 4 -- insert 4 spaces for a tab
opt.cursorline = O.cursorline -- highlight the current line
opt.number = O.number -- set numbered lines
opt.relativenumber = O.relative_number -- set relative numbered lines
opt.signcolumn = "yes" -- always show the sign column, otherwise it would shift the text each time
opt.wrap = O.wrap_lines -- display lines as one long line
-- vim.o.guifont = "JetBrains\\ Mono\\ Regular\\ Nerd\\ Font\\ Complete"
vim.o.ignorecase = O.ignore_case
vim.o.smartcase = O.smart_case