Update Neovim setup and macOS kitty icon

This commit is contained in:
2026-03-28 20:07:45 +01:00
parent 942dd697e8
commit a03ced7084
8 changed files with 324 additions and 9 deletions

4
nvim/init.lua Normal file
View File

@@ -0,0 +1,4 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
require("tracer")

4
nvim/lua/tracer/init.lua Normal file
View File

@@ -0,0 +1,4 @@
require("tracer.options")
require("tracer.plugins")
pcall(require, "tracer.plugins.telescope")
require("tracer.statusline")

View File

@@ -0,0 +1,49 @@
local opt = vim.opt
opt.number = true
opt.cursorline = true
opt.ignorecase = true
opt.laststatus = 2
opt.termguicolors = true
opt.autoread = true
opt.mouse = "a"
opt.expandtab = true
opt.shiftwidth = 4
opt.tabstop = 4
opt.softtabstop = 4
opt.smartindent = true
opt.wrap = false
opt.wildmode = "longest:full,full"
opt.title = true
vim.cmd.colorscheme("slate")
local normalfloat_hl = vim.api.nvim_get_hl(0, { name = "NormalFloat", link = false })
if normalfloat_hl.bg then
vim.api.nvim_set_hl(0, "FloatBorder", {
fg = normalfloat_hl.bg,
bg = normalfloat_hl.bg,
})
end
local cursorline_hl = vim.api.nvim_get_hl(0, { name = "CursorLine", link = false })
if cursorline_hl.bg then
vim.api.nvim_set_hl(0, "CursorLineBg", {
fg = cursorline_hl.bg,
bg = cursorline_hl.bg,
})
end
local autoread_group = vim.api.nvim_create_augroup("tracer_autoread", { clear = true })
vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave", "BufEnter" }, {
group = autoread_group,
command = "checktime",
})
vim.api.nvim_create_autocmd("FileChangedShellPost", {
group = autoread_group,
callback = function()
vim.notify("File changed on disk. Buffer reloaded.", vim.log.levels.INFO)
end,
})

134
nvim/lua/tracer/plugins.lua Normal file
View File

@@ -0,0 +1,134 @@
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
vim.cmd([[packadd packer.nvim]])
return true
end
return false
end
local packer_bootstrap = ensure_packer()
require("packer").reset()
vim.g.polyglot_disabled = { "autoindent" }
require("packer").init({
compile_path = vim.fn.stdpath("data") .. "/site/plugin/packer_compiled.lua",
display = {
open_fn = function()
return require("packer.util").float({ border = "solid" })
end,
},
})
require("packer").startup(function(use)
use("wbthomason/packer.nvim")
-- My plugins here
-- Commenting support.
use("tpope/vim-commentary")
-- Add, change, and delete surrounding text.
use("tpope/vim-surround")
-- Useful commands like :Rename and :SudoWrite.
use("tpope/vim-eunuch")
-- Pairs of handy bracket mappings, like [b and ]b.
use("tpope/vim-unimpaired")
-- Indent autodetection with editorconfig support.
use("tpope/vim-sleuth")
-- Allow plugins to enable repeating of commands.
use("tpope/vim-repeat")
-- Add more languages.
use("sheerun/vim-polyglot")
-- Navigate seamlessly between Vim windows and Tmux panes.
use("christoomey/vim-tmux-navigator")
-- Jump to the last location when opening a file.
use("farmergreg/vim-lastplace")
-- Enable * searching with visually selected text.
use("nelstrom/vim-visual-star-search")
-- Automatically create parent dirs when saving.
use("jessarcher/vim-heritage")
-- Text objects for HTML attributes.
use({
"whatyouhide/vim-textobj-xmlattr",
requires = "kana/vim-textobj-user",
})
-- Automatically set the working directory to the project root.
use({
"airblade/vim-rooter",
setup = function()
-- Instead of this running every time we open a file, we'll just run it once when Vim starts.
vim.g.rooter_manual_only = 1
end,
config = function()
vim.cmd("Rooter")
end,
})
-- Automatically add closing brackets, quotes, etc.
use({
"windwp/nvim-autopairs",
config = function()
require("nvim-autopairs").setup()
end,
})
-- Add smooth scrolling to avoid jarring jumps
use({
"karb94/neoscroll.nvim",
config = function()
require("neoscroll").setup()
end,
})
-- All closing buffers without closing the split window.
use({
"famiu/bufdelete.nvim",
config = function()
vim.keymap.set("n", "<Leader>q", ":Bdelete<CR>")
end,
})
-- Split arrays and methods onto multiple lines, or join them back up.
use({
"AndrewRadev/splitjoin.vim",
config = function()
vim.g.splitjoin_html_attributes_bracket_on_new_line = 1
vim.g.splitjoin_trailing_comma = 1
vim.g.splitjoin_php_method_chain_full = 1
end,
})
-- Automatically fix indentation when pasting code.
use({
"sickill/vim-pasta",
config = function()
vim.g.pasta_disabled_filetypes = { "fugitive" }
end,
})
-- Fuzzy finder
use({
"nvim-telescope/telescope.nvim",
requires = {
"nvim-lua/plenary.nvim",
"kyazdani42/nvim-web-devicons",
"nvim-telescope/telescope-live-grep-args.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim", run = "make" },
},
config = function()
require("tracer.plugins.telescope")
end,
})
-- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins
if packer_bootstrap then
require("packer").sync()
end
end)
vim.cmd([[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerSync
augroup end
]])

View File

@@ -0,0 +1,58 @@
local actions = require('telescope.actions')
vim.cmd([[
highlight link TelescopePromptTitle PMenuSel
highlight link TelescopePreviewTitle PMenuSel
highlight link TelescopePromptNormal NormalFloat
highlight link TelescopePromptBorder FloatBorder
highlight link TelescopeNormal CursorLine
highlight link TelescopeBorder CursorLineBg
]])
require('telescope').setup({
defaults = {
path_display = { truncate = 1 },
prompt_prefix = '',
selection_caret = ' ',
layout_config = {
prompt_position = 'top',
},
sorting_strategy = 'ascending',
mappings = {
i = {
['<esc>'] = actions.close,
['<C-Down>'] = actions.cycle_history_next,
['<C-Up>'] = actions.cycle_history_prev,
},
},
file_ignore_patterns = { '.git/' },
},
pickers = {
find_files = {
hidden = true,
},
buffers = {
previewer = false,
layout_config = {
width = 80,
},
},
oldfiles = {
prompt_title = 'History',
},
lsp_references = {
previewer = false,
},
},
})
require('telescope').load_extension('fzf')
require('telescope').load_extension('live_grep_args')
vim.keymap.set('n', '<leader>f', [[<cmd>lua require('telescope.builtin').find_files()<CR>]])
vim.keymap.set('n', '<leader><leader>', [[<cmd>lua require('telescope.builtin').find_files()<CR>]])
vim.keymap.set('n', '<leader>F', [[<cmd>lua require('telescope.builtin').find_files({ no_ignore = true, prompt_title = 'All Files' })<CR>]])
vim.keymap.set('n', '<leader>b', [[<cmd>lua require('telescope.builtin').buffers()<CR>]])
vim.keymap.set('n', '<leader>g', [[<cmd>lua require('telescope').extensions.live_grep_args.live_grep_args()<CR>]])
vim.keymap.set('n', '<leader>h', [[<cmd>lua require('telescope.builtin').oldfiles()<CR>]])
vim.keymap.set('n', '<leader>s', [[<cmd>lua require('telescope.builtin').lsp_document_symbols()<CR>]])