mirror of
https://github.com/kogakure/dotfiles.git
synced 2026-02-03 12:15:29 +00:00
feat(nix): nix and back again
I tried Nix, but it had too many downsides so I removed it. 1. Didn't like that all files are immutable and simple config changes need a complete rebuild. 2. Setting up a new Mac didn't work as smoothly as promised. Not worth the effort. 3. It sucked a lot to always have to type in the password twice on each darwin-rebuild 4. It solves problems I never had.
This commit is contained in:
55
.config/nvim/lua/config/autocmds.lua
Normal file
55
.config/nvim/lua/config/autocmds.lua
Normal file
@@ -0,0 +1,55 @@
|
||||
-- Autocmds are automatically loaded on the VeryLazy event
|
||||
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
||||
-- Add any additional autocmds here
|
||||
|
||||
-- Reload tmux config on save
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
pattern = { "*tmux.conf" },
|
||||
command = "execute 'silent !tmux source <afile> --silent'",
|
||||
})
|
||||
|
||||
-- Reload gitmux config on save
|
||||
vim.api.nvim_create_autocmd({ "BufRead" }, {
|
||||
pattern = { "gitmux.conf" },
|
||||
callback = function()
|
||||
vim.cmd([[set filetype=sh]])
|
||||
end,
|
||||
})
|
||||
|
||||
-- Restart yabai on config save
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
pattern = { ".yabairc" },
|
||||
command = "!yabai --restart-service",
|
||||
})
|
||||
|
||||
-- Add specific settings for Markdown files
|
||||
vim.api.nvim_create_autocmd({ "BufNewFile", "BufFilePre", "BufRead" }, {
|
||||
pattern = { "*.mdx", "*.md" },
|
||||
callback = function()
|
||||
vim.cmd([[set wrap linebreak nolist]])
|
||||
vim.cmd([[SoftWrapMode]])
|
||||
end,
|
||||
})
|
||||
|
||||
-- Evenly resize windows after resizing
|
||||
vim.api.nvim_create_autocmd({ "VimResized" }, {
|
||||
pattern = { "*" },
|
||||
callback = function()
|
||||
vim.cmd([[tabdo wincmd =]])
|
||||
end,
|
||||
})
|
||||
|
||||
-- Turn off paste mode when leaving insert mode
|
||||
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||
pattern = { "*" },
|
||||
command = "set nopaste",
|
||||
})
|
||||
|
||||
-- Change conceallevel for JSON files
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "json", "jsonc" },
|
||||
callback = function()
|
||||
vim.wo.spell = false
|
||||
vim.wo.conceallevel = 0
|
||||
end,
|
||||
})
|
||||
51
.config/nvim/lua/config/keymaps.lua
Normal file
51
.config/nvim/lua/config/keymaps.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
-- Keymaps are automatically loaded on the VeryLazy event
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps here
|
||||
rawset(_G, "vim", vim or {})
|
||||
|
||||
vim.keymap.set("n", "<leader>j", ":b#<CR>", { desc = "Toggle between buffers", noremap = true, silent = true })
|
||||
vim.keymap.set("n", ";;", "A;<ESC>", { desc = "Add semicolon to the end of the line", noremap = true, silent = true })
|
||||
vim.keymap.set("n", ",,", "A,<ESC>", { desc = "Add comma to the end of the line", noremap = true, silent = true })
|
||||
-- stylua: ignore
|
||||
vim.keymap.set("v", "y", "myy`y", { desc = "Maintain the cursor position when yanking a visual selection", noremap = true, silent = true })
|
||||
vim.keymap.set("n", "+", "<C-a>", { desc = "Increment", noremap = true, silent = true })
|
||||
vim.keymap.set("n", "-", "<C-x>", { desc = "Decrement", noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<leader>bx", ":bufdo bdelete<CR>", { desc = "Delete all buffers", noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<leader>bsd", "<cmd>%bd|e#|bd#<cr>|'<cr>", { desc = "Delete surrounding buffers" })
|
||||
vim.keymap.set("n", "<leader>ut", ":set list!<CR>", { desc = "Toggle list", noremap = true, silent = true })
|
||||
vim.keymap.set("n", "Y", "yg$", { desc = "Copy to the end of the line", noremap = true, silent = true })
|
||||
-- stylua: ignore
|
||||
vim.keymap.set("n", "n", "nzzzv", { desc = "Keep the window centered (next search result)", noremap = true, silent = true })
|
||||
-- stylua: ignore
|
||||
vim.keymap.set("n", "N", "Nzzzv", { desc = "Keep the window centered (previous search result)", noremap = true, silent = true })
|
||||
-- stylua: ignore
|
||||
vim.keymap.set("n", "<expr> j", "(v:count == 0 ? 'gj' : 'j')", { desc = "Move by rows in wrapped mode (down)", noremap = true, silent = true })
|
||||
-- stylua: ignore
|
||||
vim.keymap.set("n", "<expr> k", "(v:count == 0 ? 'gk' : 'k')", { desc = "Move by rows in wrapped mode (up)", noremap = true, silent = true })
|
||||
vim.keymap.set("n", "gP", "`[v`]", { desc = "Visually select of just pasted content", noremap = true, silent = true })
|
||||
vim.keymap.set("n", "gy", "`[v`]y", { desc = "Visually select of just pasted content", noremap = true, silent = true })
|
||||
-- stylua: ignore
|
||||
vim.keymap.set("n", "<leader>wi", ":silent !open -a iA\\ Writer.app '%:p'<CR>", { desc = "Open in iA Writer", noremap = true, silent = true })
|
||||
|
||||
vim.keymap.set("n", "-", "<CMD>foldclose<CR>", { desc = "Close code fold" })
|
||||
vim.keymap.set("n", "+", "<CMD>foldopen<CR>", { desc = "Open code fold" })
|
||||
|
||||
vim.keymap.set("n", "<C-h>", function()
|
||||
require("smart-splits").move_cursor_left()
|
||||
end)
|
||||
vim.keymap.set("n", "<C-j>", function()
|
||||
require("smart-splits").move_cursor_down()
|
||||
end)
|
||||
vim.keymap.set("n", "<C-k>", function()
|
||||
require("smart-splits").move_cursor_up()
|
||||
end)
|
||||
vim.keymap.set("n", "<C-l>", function()
|
||||
require("smart-splits").move_cursor_right()
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "[b", "<cmd>bprevious<cr>", { desc = "Prev buffer" })
|
||||
vim.keymap.set("n", "]b", "<cmd>bnext<cr>", { desc = "Next buffer" })
|
||||
|
||||
-- Visual Mode
|
||||
vim.keymap.set("v", "<", "<gv", { desc = "Stay in indent mode (left)", noremap = true, silent = true })
|
||||
vim.keymap.set("v", ">", ">gv", { desc = "Stay in indent mode (right)", noremap = true, silent = true })
|
||||
67
.config/nvim/lua/config/lazy.lua
Normal file
67
.config/nvim/lua/config/lazy.lua
Normal file
@@ -0,0 +1,67 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
-- bootstrap lazy.nvim
|
||||
-- stylua: ignore
|
||||
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
|
||||
end
|
||||
|
||||
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
|
||||
vim.cmd([[command! -nargs=0 GoToFile :Telescope find_files]])
|
||||
vim.cmd([[command! -nargs=0 GoToCommand :Telescope commands]])
|
||||
vim.cmd([[command! -nargs=0 Grep :Telescope live_grep]])
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
-- import any extras modules here
|
||||
{ import = "lazyvim.plugins.extras.coding.codeium" },
|
||||
{ import = "lazyvim.plugins.extras.coding.copilot" },
|
||||
{ import = "lazyvim.plugins.extras.coding.mini-surround" },
|
||||
{ import = "lazyvim.plugins.extras.dap.core" },
|
||||
{ import = "lazyvim.plugins.extras.editor.aerial" },
|
||||
{ import = "lazyvim.plugins.extras.editor.harpoon2" },
|
||||
{ import = "lazyvim.plugins.extras.formatting.prettier" },
|
||||
{ import = "lazyvim.plugins.extras.lang.go" },
|
||||
{ import = "lazyvim.plugins.extras.lang.json" },
|
||||
{ import = "lazyvim.plugins.extras.lang.ruby" },
|
||||
{ import = "lazyvim.plugins.extras.lang.tailwind" },
|
||||
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
{ import = "lazyvim.plugins.extras.lang.yaml" },
|
||||
{ import = "lazyvim.plugins.extras.linting.eslint" },
|
||||
{ import = "lazyvim.plugins.extras.test.core" },
|
||||
{ import = "lazyvim.plugins.extras.ui.mini-animate" },
|
||||
-- import/override with your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
defaults = {
|
||||
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
|
||||
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
|
||||
lazy = false,
|
||||
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
|
||||
-- have outdated releases, which may break your Neovim install.
|
||||
version = false, -- always use the latest git commit
|
||||
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
||||
},
|
||||
install = { colorscheme = { "tokyonight", "habamax" } },
|
||||
checker = {
|
||||
enabled = true,
|
||||
notify = false,
|
||||
frequency = 86400,
|
||||
},
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
-- "matchit",
|
||||
-- "matchparen",
|
||||
-- "netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
48
.config/nvim/lua/config/options.lua
Normal file
48
.config/nvim/lua/config/options.lua
Normal file
@@ -0,0 +1,48 @@
|
||||
-- Options are automatically loaded before lazy.nvim startup
|
||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
||||
-- Add any additional options here
|
||||
vim.opt.autowrite = true
|
||||
vim.opt.backspace = { "indent", "eol", "start" } -- Intuitive backspacing
|
||||
vim.opt.copyindent = true
|
||||
vim.opt.foldlevel = 2
|
||||
vim.opt.fillchars = "fold: "
|
||||
vim.opt.cursorline = false
|
||||
vim.opt.foldlevelstart = 99
|
||||
vim.opt.foldmethod = "indent"
|
||||
vim.opt.foldnestmax = 10
|
||||
vim.opt.grepprg = "rg --vimgrep --no-heading --smart-case"
|
||||
vim.opt.listchars = { tab = "↦ ", trail = "·", nbsp = ".", extends = "❯", precedes = "❮" }
|
||||
vim.opt.showbreak = "↪"
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.title = true
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.virtualedit = "block,insert"
|
||||
vim.opt.conceallevel = 2
|
||||
|
||||
vim.opt.iskeyword:append("-") -- Add dashes to words
|
||||
vim.opt.wildignore:append({ "*/node_modules/*" }) -- Wildignore
|
||||
vim.opt.complete:append({ "i", "k", "s", "kspell" })
|
||||
|
||||
-- Only the project root should be the root
|
||||
vim.g.root_spec = { ".git" }
|
||||
|
||||
-- Undercurl
|
||||
vim.cmd([[let &t_Cs = "\e[4:3m"]])
|
||||
vim.cmd([[let &t_Ce = "\e[4:0m"]])
|
||||
|
||||
-- FIXME: When using "vim.opt.spellfile:append("~/.config/…) the file is not writable"
|
||||
vim.cmd([[
|
||||
" Spell Checker
|
||||
set spellfile+=~/.config/nvim/spell/en.utf-8.add
|
||||
|
||||
" Custom Dictionaries (<C-x> <C-k>)
|
||||
set dictionary+=~/.config/nvim/dictionary/de_user.txt
|
||||
set dictionary+=~/.config/nvim/dictionary/de_neu.txt
|
||||
set dictionary+=~/.config/nvim/dictionary/en_us.txt
|
||||
|
||||
" Custom Thesauri (Synonyms) (<C-x> <C-t>)
|
||||
set thesaurus+=~/.config/nvim/thesaurus/de_user.txt
|
||||
set thesaurus+=~/.config/nvim/thesaurus/de_openthesaurus.txt
|
||||
]])
|
||||
Reference in New Issue
Block a user