Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ require("mappings")
require("options")
require("autocommands")
require("config.lazy")
require("health")

if vim.fn.has("mac") == 1 then
require("config.mac")
Expand Down
6 changes: 1 addition & 5 deletions lua/autocommands.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
-- Highlight yanked text
local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true })

vim.api.nvim_set_hl(0, "YankHighlight", { bg = "#2d3f5f" })

vim.api.nvim_create_autocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank { higroup = "YankHighlight", timeout = 250 }
end,
group = highlight_group,
group = vim.api.nvim_create_augroup("YankHighlight", { clear = true }),
pattern = "*",
})
41 changes: 41 additions & 0 deletions lua/health.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
local check_version = function()
local verstr = tostring(vim.version())
if not vim.version.ge then
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
return
end

if vim.version.ge(vim.version(), "0.12-dev") then
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
else
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
end
end

local check_external_reqs = function()
-- Basic utils: `git`, `make`, `unzip`
for _, exe in ipairs { "git", "make", "unzip", "rg" } do
local is_executable = vim.fn.executable(exe) == 1
if is_executable then
vim.health.ok(string.format("Found executable: '%s'", exe))
else
vim.health.warn(string.format("Could not find executable: '%s'", exe))
end
end

return true
end

return {
check = function()
vim.health.info([[NOTE: Not every warning is a 'must-fix' in `:checkhealth`

Fix only warnings for plugins and languages you intend to use.]])

local uv = vim.uv or vim.loop
vim.health.info("System Information: " .. vim.inspect(uv.os_uname()))

check_version()
check_external_reqs()
end,
}
4 changes: 4 additions & 0 deletions lua/mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ map("x", "<C-\\>", "gc", { remap = true })
-- clearing highlights
map("n", "<leader>h", "<cmd>nohlsearch<CR>")

-- diagnostics
map("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous [D]iagnostic message" })
map("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next [D]iagnostic message" })

-- toggle diff mode
local function toggle_diff()
if vim.wo.diff then
Expand Down
3 changes: 3 additions & 0 deletions lua/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ local options = {
hidden = true, -- required to keep multiple buffers and open multiple buffers
hlsearch = true, -- highlight all matches on previous search pattern
ignorecase = true, -- required for smartcase to work
inccommand = 'split', -- show incremental substitution
mouse = "a", -- enable mouse in all modes
pumheight = 10, -- pop up menu height
showmode = false, -- included in statusline
Expand Down Expand Up @@ -36,6 +37,8 @@ local options = {
whichwrap = "<,>,[,],h,l" -- which "horizontal" keys should wrap to next/previous line
}

vim.g.have_nerd_font = true

vim.opt.shortmess:append("c") -- don't give |ins-completion-menu| messages
vim.opt.iskeyword:append("-") -- hyphenated words recognized by searches
-- stylua: ignore end
Expand Down