Skip to content

Commit

Permalink
refactor(options)!: move vim options to AstroCore opts
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Apr 1, 2024
1 parent 3bd128e commit 170774b
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 63 deletions.
5 changes: 0 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,6 @@ body:
root = root .. "/plugins",
})
vim.g.astronvim_options = function()
-- set options here
-- vim.g.mapleader = " " -- sets vim.g.mapleader
end
-- add anything else here (autocommands, vim.filetype, etc.)
render: Lua
validations:
Expand Down
5 changes: 2 additions & 3 deletions lua/astronvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ function M.init()
})
end

-- set options
if vim.bo.filetype == "lazy" then vim.cmd.bw() end
require "astronvim.options"
if not vim.g.mapleader then vim.g.mapleader = " " end
if not vim.g.maplocalleader then vim.g.maplocalleader = "," end

-- force setup during initialization
local plugin = require("lazy.core.config").spec.plugins.AstroNvim
Expand Down
55 changes: 0 additions & 55 deletions lua/astronvim/options.lua

This file was deleted.

56 changes: 56 additions & 0 deletions lua/astronvim/plugins/_astrocore_options.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
return {
"AstroNvim/astrocore",
---@param opts AstroCoreOpts
opts = function(_, opts)
local opt = {}
opt.backspace = vim.list_extend(vim.opt.backspace:get(), { "nostop" }) -- don't stop backspace at insert
opt.breakindent = true -- wrap indent to match line start
opt.clipboard = "unnamedplus" -- connection to the system clipboard
opt.cmdheight = 0 -- hide command line unless needed
opt.completeopt = { "menu", "menuone", "noselect" } -- Options for insert mode completion
opt.copyindent = true -- copy the previous indentation on autoindenting
opt.cursorline = true -- highlight the text line of the cursor
opt.diffopt = vim.list_extend(vim.opt.diffopt:get(), { "algorithm:histogram", "linematch:60" }) -- enable linematch diff algorithm
opt.expandtab = true -- enable the use of space in tab
opt.fileencoding = "utf-8" -- file content encoding for the buffer
opt.fillchars = { eob = " " } -- disable `~` on nonexistent lines
opt.foldcolumn = "1" -- show foldcolumn
opt.foldenable = true -- enable fold for nvim-ufo
opt.foldlevel = 99 -- set high foldlevel for nvim-ufo
opt.foldlevelstart = 99 -- start with all code unfolded
opt.history = 100 -- number of commands to remember in a history table
opt.ignorecase = true -- case insensitive searching
opt.infercase = true -- infer cases in keyword completion
opt.laststatus = 3 -- global statusline
opt.linebreak = true -- wrap lines at 'breakat'
opt.mouse = "a" -- enable mouse support
opt.number = true -- show numberline
opt.preserveindent = true -- preserve indent structure as much as possible
opt.pumheight = 10 -- height of the pop up menu
opt.relativenumber = true -- show relative numberline
opt.shiftwidth = 2 -- number of space inserted for indentation
opt.shortmess = vim.tbl_deep_extend("force", vim.opt.shortmess:get(), { s = true, I = true }) -- disable search count wrap and startup messages
opt.showmode = false -- disable showing modes in command line
opt.showtabline = 2 -- always display tabline
opt.signcolumn = "yes" -- always show the sign column
opt.smartcase = true -- case sensitive searching
opt.splitbelow = true -- splitting a new window below the current one
opt.splitright = true -- splitting a new window at the right of the current one
opt.tabstop = 2 -- number of space in a tab
opt.termguicolors = true -- enable 24-bit RGB color in the TUI
opt.timeoutlen = 500 -- shorten key timeout length a little bit for which-key
opt.title = true -- set terminal title to the filename and path
opt.undofile = true -- enable persistent undo
opt.updatetime = 300 -- length of time to wait before triggering the plugin
opt.viewoptions = vim.tbl_filter(function(val) return val ~= "curdir" end, vim.opt.viewoptions:get())
opt.virtualedit = "block" -- allow going past end of line in visual block mode
opt.wrap = false -- disable wrapping of lines longer than the width of window
opt.writebackup = false -- disable making a backup before overwriting a file

local g = {}
g.markdown_recommended_style = 0

if not vim.t.bufs then vim.t.bufs = vim.api.nvim_list_bufs() end -- initialize buffer list
opts.options = { opt = opt, g = g, t = { bufs = vim.t.bufs } }
end,
}

0 comments on commit 170774b

Please sign in to comment.