refactor vim options into new file
This commit is contained in:
parent
4840b5d97f
commit
3831de930c
74
init.lua
74
init.lua
|
|
@ -13,79 +13,9 @@ if not vim.loop.fs_stat(lazypath) then
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
require('lazy').setup('plugins');
|
require('lazy').setup('plugins');
|
||||||
|
require('lua/settings');
|
||||||
-- [[ Setting options ]]
|
|
||||||
|
|
||||||
-- Line numbers
|
|
||||||
vim.opt.nu = true
|
|
||||||
vim.opt.relativenumber = true
|
|
||||||
|
|
||||||
-- Highlighting on search
|
|
||||||
vim.opt.hlsearch = true
|
|
||||||
vim.opt.incsearch = true
|
|
||||||
|
|
||||||
-- Enable mouse mode
|
|
||||||
vim.opt.mouse = ''
|
|
||||||
|
|
||||||
-- Sync clipboard between OS and Neovim.
|
|
||||||
vim.opt.clipboard = 'unnamedplus'
|
|
||||||
|
|
||||||
-- Handle indentation
|
|
||||||
vim.opt.tabstop = 4
|
|
||||||
vim.opt.softtabstop = 4
|
|
||||||
vim.opt.shiftwidth = 4
|
|
||||||
vim.opt.expandtab = true
|
|
||||||
vim.opt.smartindent = true
|
|
||||||
vim.opt.breakindent = true
|
|
||||||
|
|
||||||
-- Remove line wrapping
|
|
||||||
vim.opt.wrap = false
|
|
||||||
|
|
||||||
-- Scroll buffer
|
|
||||||
vim.opt.scrolloff = 8
|
|
||||||
|
|
||||||
-- Save undo history
|
|
||||||
vim.o.undofile = true
|
|
||||||
|
|
||||||
-- Case-insensitive searching UNLESS \C or capital in search
|
|
||||||
vim.o.ignorecase = true
|
|
||||||
vim.o.smartcase = true
|
|
||||||
|
|
||||||
-- Keep signcolumn on by default
|
|
||||||
vim.wo.signcolumn = 'yes'
|
|
||||||
|
|
||||||
-- Decrease update time
|
|
||||||
vim.o.updatetime = 250
|
|
||||||
vim.o.timeoutlen = 300
|
|
||||||
|
|
||||||
-- Set completeopt to have a better completion experience
|
|
||||||
vim.o.completeopt = 'menuone,noselect'
|
|
||||||
|
|
||||||
vim.o.termguicolors = true
|
|
||||||
|
|
||||||
-- [[ Basic Keymaps ]]
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
|
||||||
|
|
||||||
-- Remap for dealing with word wrap
|
|
||||||
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
|
||||||
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
|
||||||
|
|
||||||
-- Diagnostic keymaps
|
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
|
||||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
|
|
||||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
|
||||||
|
|
||||||
-- [[ Highlight on yank ]]
|
|
||||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
|
||||||
callback = function()
|
|
||||||
vim.highlight.on_yank()
|
|
||||||
end,
|
|
||||||
group = highlight_group,
|
|
||||||
pattern = '*',
|
|
||||||
})
|
|
||||||
|
|
||||||
-- [[ Configure Telescope ]]
|
-- [[ Configure Telescope ]]
|
||||||
require('telescope').setup {
|
require('telescope').setup {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
-- Line numbers
|
||||||
|
vim.opt.nu = true
|
||||||
|
vim.opt.relativenumber = true
|
||||||
|
|
||||||
|
-- Highlighting on search
|
||||||
|
vim.opt.hlsearch = true
|
||||||
|
vim.opt.incsearch = true
|
||||||
|
|
||||||
|
-- Enable mouse mode
|
||||||
|
vim.opt.mouse = ''
|
||||||
|
|
||||||
|
-- FIX: shared clipboard not working
|
||||||
|
-- Sync clipboard between OS and Neovim.
|
||||||
|
vim.opt.clipboard = 'unnamedplus'
|
||||||
|
|
||||||
|
-- FIX: tabs do not seem to be working as expected
|
||||||
|
-- Handle indentation
|
||||||
|
vim.opt.tabstop = 4
|
||||||
|
vim.opt.softtabstop = 4
|
||||||
|
vim.opt.shiftwidth = 4
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
vim.opt.smartindent = true
|
||||||
|
vim.opt.breakindent = true
|
||||||
|
|
||||||
|
-- Remove line wrapping
|
||||||
|
vim.opt.wrap = false
|
||||||
|
|
||||||
|
-- Scroll buffer
|
||||||
|
vim.opt.scrolloff = 8
|
||||||
|
|
||||||
|
-- Save undo history
|
||||||
|
vim.o.undofile = true
|
||||||
|
|
||||||
|
-- Case-insensitive searching UNLESS \C or capital in search
|
||||||
|
vim.o.ignorecase = true
|
||||||
|
vim.o.smartcase = true
|
||||||
|
|
||||||
|
-- Keep signcolumn on by default
|
||||||
|
vim.wo.signcolumn = 'yes'
|
||||||
|
|
||||||
|
-- Decrease update time
|
||||||
|
vim.o.updatetime = 250
|
||||||
|
vim.o.timeoutlen = 300
|
||||||
|
|
||||||
|
-- Set completeopt to have a better completion experience
|
||||||
|
vim.o.completeopt = 'menuone,noselect'
|
||||||
|
|
||||||
|
vim.o.termguicolors = true
|
||||||
|
|
||||||
|
-- [[ Basic Keymaps ]]
|
||||||
|
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
||||||
|
|
||||||
|
-- Remap for dealing with word wrap
|
||||||
|
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||||
|
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||||
|
|
||||||
|
-- Diagnostic keymaps
|
||||||
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
||||||
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
||||||
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
|
||||||
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
||||||
|
|
||||||
|
-- Highlight on yank
|
||||||
|
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
|
callback = function()
|
||||||
|
vim.highlight.on_yank()
|
||||||
|
end,
|
||||||
|
group = highlight_group,
|
||||||
|
pattern = '*',
|
||||||
|
})
|
||||||
|
|
||||||
Loading…
Reference in New Issue