------------------------------------------------------------------------------- -- Style ------------------------------------------------------------------------------- -- Editor Style vim.opt.number = true -- Show number column vim.opt.wrap = false -- Don't wrap text vim.opt.list = true -- Display tabs and trailing space vim.opt.colorcolumn='80,150' -- Show color columns -- Color vim.opt.termguicolors = true vim.cmd.color('rbdr') -- Tab Style (Always override with editorconfig) vim.opt.tabstop = 2 -- 2 Spaces per tab vim.opt.shiftwidth = 2 -- Spaces used in Autoindent vim.opt.softtabstop = 2 -- Spaces used when soft tabbing vim.opt.expandtab = true -- Always use spaces ------------------------------------------------------------------------------- -- Behavior ------------------------------------------------------------------------------- -- Search Behavior vim.opt.ignorecase = true -- Ignore case when searching vim.opt.smartcase = true -- Unless we use both cases in search -- Autocomplete Behavior vim.opt.wildmode = 'list:longest,list:full' -- Autocomplete common matching string -- Folding Behavior vim.opt.foldmethod = 'syntax' -- Use syntax highlight to define folds vim.opt.foldnestmax = 10 -- Max 10 folds vim.opt.foldlevelstart = 99 -- Start with all folds open -- Relative Number Behavior vim.api.nvim_create_autocmd({'FocusLost', 'InsertEnter'}, { pattern = '*', callback = function () vim.opt.relativenumber = false end, }) vim.api.nvim_create_autocmd({'InsertLeave', 'CursorMoved'}, { pattern = '*', callback = function () vim.opt.relativenumber = true end, }) vim.keymap.set('n', '', function() vim.opt.relativenumber = not vim.opt.relativenumber end) -- Move lines / blocks up and down using Ctrl + Shift vim.keymap.set('n', '', ':m .+1==') vim.keymap.set('n', '', ':m .-2==') vim.keymap.set('i', '', ':m .+1==gi') vim.keymap.set('i', '', ':m .-2==gi') vim.keymap.set('v', '', ':m \'>+1gv=gv') vim.keymap.set('v', '', ':m \'<-2gv=gv') -- Navigate the location list vim.keymap.set('n', '', ':lnext') vim.keymap.set('n', '', ':lprev') vim.keymap.set('n', '', ':cnext') vim.keymap.set('n', '', ':cprev') ------------------------------------------------------------------------------- -- File Specific Behavior ------------------------------------------------------------------------------- -- Makefiles vim.api.nvim_create_autocmd({'FileType'}, { pattern = 'make', callback = function () vim.opt.expandtab = false end }) -- SNES files vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead'}, { pattern = {'*.asm', '*.s'}, callback = function () vim.opt.filetype = 'snes' end }) vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead'}, { pattern = {'.plan'}, callback = function () vim.opt.filetype = 'markdown' end }) ------------------------------------------------------------------------------- -- Local Overrides ------------------------------------------------------------------------------- pcall(require, 'init_local') ------------------------------------------------------------------------------- -- Plugin Specific Behavior ------------------------------------------------------------------------------- -- FZF vim.keymap.set("n", "", "lua require('fzf-lua').files({ fzf_opts = {} })", { silent = true }) -- Toggle Autosave vim.api.nvim_set_keymap('n', 'n', ':ASToggle', {}) -- Svelte Config vim.g.vim_svelte_plugin_use_typescript = true -- Coq vim.g.coq_settings = { auto_start = 'shut-up', clients = { snippets = { warn = {} } } } -- Plugins require('plugins') require('treesitter_config') require('lsp') require('dap_config')