nvim: refactor part 2

This commit is contained in:
Hoang Nguyen 2021-11-25 22:21:18 +07:00
parent 6945941009
commit 706595eaa9
No known key found for this signature in database
GPG key ID: 813CF484F4993419
7 changed files with 12 additions and 8 deletions

View file

@ -283,8 +283,8 @@ local function undefined_mappings()
api.nvim_set_keymap('v', '<', '<gv', opts)
api.nvim_set_keymap('v', '>', '>gv', opts)
-- Also move up/down virtual lines (:set wrap)
api.nvim_set_keymap('n', 'j', 'gj', opts)
api.nvim_set_keymap('n', 'k', 'gk', opts)
api.nvim_set_keymap('n', 'j', 'v:count == 0 ? "gj" : "j"', {noremap = true, expr = true, silent = true})
api.nvim_set_keymap('n', 'k', 'v:count == 0 ? "gk" : "k"', {noremap = true, expr = true, silent = true})
-- winshift.nvim
api.nvim_set_keymap('n', '<C-w><C-m>', ':WinShift<CR>', opts)
api.nvim_set_keymap('n', '<C-w>m', ':WinShift<CR>', opts)

View file

@ -1,7 +1,7 @@
local fn, cmd = vim.fn, vim.api.nvim_command
-- Require since we use 'packer' as opt
cmd('packadd packer.nvim')
vim.api.nvim_exec('packadd packer.nvim', false) -- using vim.api.nvim_command() here fails the whole script on initial setup (since it's an ex command)
local present, packer = pcall(require, 'packer')
if not present then

View file

@ -61,11 +61,11 @@ function M.saga()
end
function M.lsp()
require('modules.lsp.lsp_conf')
require('modules.lsp.lspconfig')
end
function M.null_ls()
require('modules.lsp.null_ls_conf')
require('modules.lsp.null_ls')
end
function M.sqls()

View file

@ -29,13 +29,15 @@ function M.load_plugins()
-- This is recommended when using `luafile <afile>` a lot
packer.reset()
-- Configure plugins
packer.startup(function(use)
for _, repo in ipairs(repos) do
use(repo)
end
end)
-- Install plugins if missing
packer.install()
end)
end
return M

View file

@ -69,7 +69,7 @@ function M.load_options()
-- opt.laststatus = 2
-- opt.textwidth = 80
opt.synmaxcol = 2500
-- opt.shell = 'bash'
opt.shell = 'bash'
opt.grepformat = '%f:%l:%c:%m'
opt.grepprg = 'rg --hidden --vimgrep --smart-case --'
opt.diffopt = 'filler,iwhite,internal,algorithm:patience'
@ -103,6 +103,7 @@ function M.load_options()
opt.ttimeoutlen = 25
opt.updatetime = 150
opt.redrawtime = 1500
opt.lazyredraw = true
-- No swapfile
opt.backup = false
@ -141,6 +142,7 @@ function M.load_options()
opt.smartindent = true
-- opt.autoindent = true
opt.shiftround = true
opt.breakindent = true
-- Trailings, line break
opt.list = true