aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lua/settings.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/settings.lua')
-rw-r--r--.config/nvim/lua/settings.lua106
1 files changed, 59 insertions, 47 deletions
diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua
index dab30f7..837f22a 100644
--- a/.config/nvim/lua/settings.lua
+++ b/.config/nvim/lua/settings.lua
@@ -3,72 +3,73 @@ vim.cmd([[
filetype plugin indent on
]])
-HOME = os.getenv("HOME")
+HOME = os.getenv("HOME")
-vim.g.mapleader = ' '
+vim.g.mapleader = ' '
-vim.wo.cursorline = true
+vim.wo.cursorline = true
vim.opt.termguicolors = true
-- basic settings
-vim.o.encoding = "utf-8"
-vim.o.backspace = "indent,eol,start" -- backspace works on every char in insert mode
-vim.o.completeopt = 'menuone,noselect'
-vim.o.history = 1000
-vim.o.dictionary = '/usr/share/dict/words'
-vim.o.startofline = true
+vim.o.encoding = "utf-8"
+vim.o.backspace = "indent,eol,start" -- backspace works on every char in insert mode
+vim.o.completeopt = 'menuone,noselect'
+vim.o.history = 1000
+vim.o.dictionary = '/usr/share/dict/words'
+vim.o.startofline = true
-- Mapping waiting time
-vim.o.timeout = false
-vim.o.ttimeout = true
-vim.o.ttimeoutlen = 100
+vim.o.timeout = false
+vim.o.ttimeout = true
+vim.o.ttimeoutlen = 100
-- Display
-vim.o.showmatch = true -- show matching brackets
-vim.o.scrolloff = 3 -- always show 3 rows from edge of the screen
-vim.o.synmaxcol = 300 -- stop syntax highlight after x lines for performance
-vim.o.laststatus = 2 -- always show status line
+vim.o.showmatch = true -- show matching brackets
+vim.o.scrolloff = 3 -- always show 3 rows from edge of the screen
+vim.o.synmaxcol = 300 -- stop syntax highlight after x lines for performance
+vim.o.laststatus = 2 -- always show status line
-vim.o.list = false -- do not display white characters
-vim.o.foldenable = false
-vim.o.foldlevel = 4 -- limit folding to 4 levels
-vim.o.foldmethod = 'syntax' -- use language syntax to generate folds
-vim.o.wrap = true --do not wrap lines even if very long
-vim.o.eol = true -- show if there's no eol char
-vim.o.showbreak= '↪' -- character to show when line is broken
+vim.o.list = false -- do not display white characters
+vim.o.foldenable = false
+vim.o.foldlevel = 4 -- limit folding to 4 levels
+vim.o.foldmethod = 'syntax' -- use language syntax to generate folds
+vim.o.wrap = true --do not wrap lines even if very long
+vim.o.eol = true -- show if there's no eol char
+vim.o.showbreak = '↪' -- character to show when line is broken
-vim.opt.clipboard = 'unnamedplus'
+vim.opt.clipboard = 'unnamedplus'
-- Sidebar
-vim.o.number = true -- line number on the left
-vim.o.numberwidth = 3 -- always reserve 3 spaces for line number
-vim.o.signcolumn = 'yes' -- keep 1 column for coc.vim check
-vim.o.modelines = 0
-vim.o.showcmd = true -- display command in bottom bar
+vim.o.number = true -- line number on the left
+vim.o.numberwidth = 3 -- always reserve 3 spaces for line number
+vim.o.signcolumn = 'yes' -- keep 1 column for coc.vim check
+vim.o.modelines = 0
+vim.o.showcmd = true -- display command in bottom bar
-- Search
-vim.o.incsearch = true -- starts searching as soon as typing, without enter needed
-vim.o.ignorecase = true -- ignore letter case when searching
-vim.o.smartcase = true -- case insentive unless capitals used in search
+vim.o.incsearch = true -- starts searching as soon as typing, without enter needed
+vim.o.ignorecase = true -- ignore letter case when searching
+vim.o.smartcase = true -- case insentive unless capitals used in search
-vim.o.matchtime = 2 -- delay before showing matching paren
-vim.o.mps = vim.o.mps .. ",<:>"
+vim.o.matchtime = 2 -- delay before showing matching paren
+vim.o.mps = vim.o.mps .. ",<:>"
-- White characters
-vim.o.autoindent = true
-vim.o.smartindent = true
-vim.o.tabstop = 2 -- 1 tab = 2 spaces
-vim.o.shiftwidth = 2 -- indentation rule
-vim.o.formatoptions = 'qnj1' -- q - comment formatting; n - numbered lists; j - remove comment when joining lines; 1 - don't break after one-letter word
-vim.o.expandtab = true -- expand tab to spaces
+vim.o.autoindent = true
+vim.o.smartindent = true
+vim.o.tabstop = 2 -- 1 tab = 2 spaces
+vim.o.shiftwidth = 2 -- indentation rule
+vim.o.formatoptions =
+'qnj1' -- q - comment formatting; n - numbered lists; j - remove comment when joining lines; 1 - don't break after one-letter word
+vim.o.expandtab = true -- expand tab to spaces
-- Backup files
-vim.o.backup = true -- use backup files
-vim.o.writebackup = false
-vim.o.swapfile = false -- do not use swap file
-vim.o.undodir = HOME .. '/.vim/tmp/undo//' -- undo files
-vim.o.backupdir = HOME .. '/.vim/tmp/backup//' -- backups
-vim.o.directory = '/.vim/tmp/swap//' -- swap files
+vim.o.backup = true -- use backup files
+vim.o.writebackup = false
+vim.o.swapfile = false -- do not use swap file
+vim.o.undodir = HOME .. '/.vim/tmp/undo//' -- undo files
+vim.o.backupdir = HOME .. '/.vim/tmp/backup//' -- backups
+vim.o.directory = '/.vim/tmp/swap//' -- swap files
vim.cmd([[
au FileType python set ts=4 sw=4
@@ -78,6 +79,7 @@ vim.cmd([[
au BufRead,BufNewFile *.slimbars set syntax=slim
]])
+
vim.cmd('colorscheme gruvbox')
vim.cmd([[
" ### Transparency ###
@@ -93,13 +95,23 @@ hi EndOfBuffer guibg=none ctermbg=none
-- Commands mode
vim.o.wildmenu = true -- on TAB, complete options for system command
-vim.o.wildignore = 'deps,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc'
+vim.o.wildignore =
+'deps,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc'
+
-- rust format on save
-- https://sharksforarms.dev/posts/neovim-rust/
local format_sync_grp = vim.api.nvim_create_augroup("Format", {})
vim.api.nvim_create_autocmd("BufWritePre", {
+ pattern = { "*" },
callback = function()
+ print(vim.bo.filetype)
+ -- idk what's happening but:
+ -- https://github.com/sqls-server/sqls/issues/105
+ if vim.bo.filetype == 'sql' then
+ return
+ end
+
vim.lsp.buf.format({ timeout_ms = 200 })
end,
group = format_sync_grp,