feat: Refactor neovim to a more modern stack. (#1)
Co-authored-by: Mariano Uvalle <u.g.a.mariano@gmail.com> Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
@@ -1,45 +1,40 @@
|
||||
-- Comes from the Chris@Machine config.
|
||||
vim.opt.iskeyword:append('-')
|
||||
vim.opt.hidden = true
|
||||
vim.opt.wrap = false
|
||||
vim.opt.fileencoding = 'utf-8'
|
||||
vim.opt.splitbelow = true
|
||||
vim.opt.splitright = true
|
||||
vim.opt.conceallevel = 0
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.smartindent = true
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.showmode = false
|
||||
vim.opt.backup = false
|
||||
vim.opt.writebackup = false
|
||||
vim.opt.signcolumn = 'yes'
|
||||
vim.opt.updatetime = 300
|
||||
vim.opt.timeoutlen = 500
|
||||
|
||||
vim.cmd('set iskeyword+=-') -- treat dash separated words as a word text object"
|
||||
vim.o.hidden = true -- Required to keep multiple buffers open multiple buffers
|
||||
vim.wo.wrap = false -- Display long lines as just one line
|
||||
vim.o.fileencoding = "utf-8" -- The encoding written to file
|
||||
vim.o.splitbelow = true -- Horizontal splits will automatically be below
|
||||
vim.o.splitright = true -- Vertical splits will automatically be to the right
|
||||
vim.o.conceallevel = 0 -- So that I can see `` in markdown files
|
||||
vim.cmd('set ts=4') -- Insert 2 spaces for a tab
|
||||
vim.cmd('set sw=4') -- Change the number of space characters inserted for indentation
|
||||
vim.bo.expandtab = true -- Converts tabs to spaces
|
||||
vim.bo.smartindent = true -- Makes indenting smart
|
||||
vim.wo.number = true -- set numbered lines
|
||||
vim.wo.cursorline = true -- Enable highlighting of the current line
|
||||
--vim.o.showtabline = 2 -- Always show tabs
|
||||
vim.o.showmode = false -- We don't need to see things like -- INSERT -- anymore
|
||||
vim.o.backup = false -- This is recommended by coc
|
||||
vim.o.writebackup = false -- This is recommended by coc
|
||||
vim.wo.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
|
||||
vim.o.updatetime = 300 -- Faster completion
|
||||
vim.o.timeoutlen = 500 -- By default timeoutlen is 1000 ms
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = { 'helm', 'yaml', 'yml' },
|
||||
callback = function()
|
||||
vim.opt_local.fixendofline = false
|
||||
vim.opt_local.list = true
|
||||
vim.opt_local.listchars:append({ space = '⋅', eol = '↴' })
|
||||
end,
|
||||
})
|
||||
|
||||
vim.cmd(":set number relativenumber")
|
||||
|
||||
|
||||
vim.cmd("autocmd FileType helm set nofixendofline")
|
||||
vim.cmd("autocmd FileType yaml set nofixendofline")
|
||||
vim.cmd("autocmd FileType yml set nofixendofline")
|
||||
vim.cmd("autocmd BufReadPost * :lua require('gitsigns').setup()")
|
||||
|
||||
------ Folding
|
||||
-- vim.o.foldlevel = 99
|
||||
-- Persist folds.
|
||||
-- Ignore errors.
|
||||
-- vim.cmd([[
|
||||
-- augroup AutoSaveFolds
|
||||
-- autocmd!
|
||||
-- autocmd BufWinLeave * silent! mkview
|
||||
-- autocmd BufWinEnter * silent! loadview
|
||||
-- augroup END
|
||||
-- ]])
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'go',
|
||||
callback = function()
|
||||
vim.opt_local.colorcolumn = '80'
|
||||
vim.opt_local.formatoptions:append({ 'c', 'r' })
|
||||
end,
|
||||
})
|
||||
|
||||
-- Show full file path in lightline.
|
||||
vim.cmd([[
|
||||
@@ -65,21 +60,8 @@ function! FilenameForLightline()
|
||||
endfunction
|
||||
]])
|
||||
|
||||
-- Custom command for ripgrep.
|
||||
-- vim.cmd([[
|
||||
-- function! RipgrepFzf(query, fullscreen)
|
||||
-- let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case -- %s || true'
|
||||
-- let initial_command = printf(command_fmt, shellescape(a:query))
|
||||
-- let reload_command = printf(command_fmt, '{q}')
|
||||
-- let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
|
||||
-- call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
|
||||
-- endfunction
|
||||
|
||||
-- command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0)
|
||||
-- ]])
|
||||
|
||||
-- Use upstream zig plugin instead of polyglot.
|
||||
vim.g.polyglot_disabled = { "zig" }
|
||||
vim.g.polyglot_disabled = { 'zig' }
|
||||
|
||||
-- Prioritize Objective-C
|
||||
vim.filetype.add({
|
||||
@@ -89,17 +71,15 @@ vim.filetype.add({
|
||||
})
|
||||
|
||||
-- Soft line wrapping for markdown.
|
||||
local markdown_group = vim.api.nvim_create_augroup("MarkdownSpecific", { clear = true })
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "markdown" }, -- Match markdown file patterns
|
||||
group = markdown_group,
|
||||
callback = function()
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.linebreak = true
|
||||
vim.opt_local.textwidth = 0 -- Visual wrap to window edge
|
||||
-- Optionally remap j/k for wrapped line navigation
|
||||
vim.keymap.set('n', 'j', 'gj', { noremap = true, silent = true, buffer = true })
|
||||
vim.keymap.set('n', 'k', 'gk', { noremap = true, silent = true, buffer = true })
|
||||
end,
|
||||
local markdown_group = vim.api.nvim_create_augroup('MarkdownSpecific', { clear = true })
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'markdown',
|
||||
group = markdown_group,
|
||||
callback = function()
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.linebreak = true
|
||||
vim.opt_local.textwidth = 0
|
||||
vim.keymap.set('n', 'j', 'gj', { silent = true, buffer = true })
|
||||
vim.keymap.set('n', 'k', 'gk', { silent = true, buffer = true })
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user