From 5c8e114e44c08d8a1c6eff46330be4c68c359a0e Mon Sep 17 00:00:00 2001 From: Vladan Popovic Date: Mon, 12 Aug 2024 16:10:35 +0200 Subject: [PATCH] remove utils module --- lua/keymappings.lua | 2 -- lua/lsp.lua | 1 - lua/plugins/cmp.lua | 4 +--- lua/plugins/init.lua | 11 ++++++++++ lua/plugins/oil.lua | 2 +- lua/settings.lua | 50 +++++++++++++++++++------------------------- lua/utils.lua | 10 --------- 7 files changed, 35 insertions(+), 45 deletions(-) delete mode 100644 lua/utils.lua diff --git a/lua/keymappings.lua b/lua/keymappings.lua index 23f0484..000918e 100644 --- a/lua/keymappings.lua +++ b/lua/keymappings.lua @@ -1,5 +1,3 @@ -local utils = require('utils') - -- Clear trailing whitespace vim.keymap.set("n", "", "let _s=@/:%s/\\s\\+$//e:let @/=_s") diff --git a/lua/lsp.lua b/lua/lsp.lua index 039429f..9d59498 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -1,5 +1,4 @@ local on_attach = function(client, bufnr) - local utils = require('utils') local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) -- Mappings. diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 1dcea37..cfd0ba5 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -1,8 +1,6 @@ -- Completion plugin config -local utils = require('utils') - -utils.opt('o', 'completeopt', 'menuone,noselect') +vim.opt.completeopt = 'menuone,noselect' local cmp = require('cmp') local cmp_kinds = { diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 9b2988e..7412466 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -86,6 +86,17 @@ require('packer').startup(function() use { 'Shougo/deoplete.nvim' } use { 'beeender/Comrade' } + use({ + 'MeanderingProgrammer/render-markdown.nvim', + after = { 'nvim-treesitter' }, + requires = { 'echasnovski/mini.nvim', opt = true }, -- if you use the mini.nvim suite + -- requires = { 'echasnovski/mini.icons', opt = true }, -- if you use standalone mini plugins + -- requires = { 'nvim-tree/nvim-web-devicons', opt = true }, -- if you prefer nvim-web-devicons + config = function() + require('render-markdown').setup({}) + end, + }) + end) require('plugins.cmp') diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua index 3503f42..fc55dd9 100644 --- a/lua/plugins/oil.lua +++ b/lua/plugins/oil.lua @@ -94,7 +94,7 @@ require('oil').setup({ if not dir then return false end - return vim.list_contains(git_ignored[dir], name) + -- return vim.list_contains(git_ignored[dir], name) end, -- This function defines what will never be shown, even when `show_hidden` is set is_always_hidden = function(name, bufnr) diff --git a/lua/settings.lua b/lua/settings.lua index 3101d37..4f55cb6 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -1,44 +1,38 @@ -local utils = require('utils') local indent = 4 -vim.cmd 'syntax enable' -vim.cmd 'filetype plugin indent on' --- --- Highlight on yank -vim.cmd 'au TextYankPost * lua vim.highlight.on_yank {on_visual = false}' - -utils.opt('b', 'expandtab', true) -utils.opt('b', 'shiftwidth', indent) -utils.opt('b', 'tabstop', indent) -utils.opt('b', 'softtabstop', indent) -utils.opt('b', 'smartindent', true) -utils.opt('o', 'hidden', true) -utils.opt('o', 'ignorecase', true) -utils.opt('o', 'scrolloff', 4) -utils.opt('o', 'shiftround', true) -utils.opt('o', 'smartcase', true) -utils.opt('o', 'splitbelow', true) -utils.opt('o', 'splitright', true) -utils.opt('o', 'wildmode', 'list:longest') -utils.opt('w', 'number', true) -utils.opt('o', 'clipboard', 'unnamed,unnamedplus') -utils.opt('o', 'mouse', 'a') +vim.opt.shiftwidth = indent +vim.opt.tabstop = indent +vim.opt.softtabstop = indent +vim.opt.scrolloff = indent +vim.opt.wildmode = 'list:longest,list:full' +vim.opt.expandtab = true +vim.opt.smartindent = true +vim.opt.hidden = true +vim.opt.ignorecase = true +vim.opt.shiftround = true +vim.opt.smartcase = true +vim.opt.splitbelow = true +vim.opt.splitright = true +vim.opt.number = true vim.opt.autoindent = false vim.opt.smartindent = false -vim.opt.background = 'light' vim.opt.errorformat:prepend('%f|%l col %c|%m') vim.opt.fileformat = 'unix' vim.opt.undofile = true +vim.opt.background = 'light' + -- Enable vimrc files per project and disable unsafe commands in project vimrc vim.opt.exrc = true vim.opt.secure = true --- unknown filetypes mappings vim.cmd([[ - autocmd BufRead,BufNewFile *.bu set filetype=yaml - autocmd BufRead,BufNewFile *.yml.example set filetype=yaml - autocmd BufRead,BufNewFile *.yaml.example set filetype=yaml + syntax enable + filetype plugin indent on + set noautoread + autocmd CursorHold * checktime + autocmd TextYankPost * lua vim.highlight.on_yank {on_visual = false} + autocmd BufRead,BufNewFile *.bu,*.yml.example,*.yaml.example set filetype=yaml autocmd BufRead,BufNewFile *.ign set filetype=json ]]) diff --git a/lua/utils.lua b/lua/utils.lua deleted file mode 100644 index 1da951a..0000000 --- a/lua/utils.lua +++ /dev/null @@ -1,10 +0,0 @@ -local utils = {} - -local scopes = { o = vim.o, b = vim.bo, w = vim.wo } - -function utils.opt(scope, key, value) - scopes[scope][key] = value - if scope ~= 'o' then scopes['o'][key] = value end -end - -return utils