mirror of
https://github.com/davegallant/nix-config
synced 2025-08-07 09:12:28 +00:00
Refactor init.lua
This commit is contained in:
43
flake.lock
generated
43
flake.lock
generated
@@ -7,11 +7,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1631730143,
|
"lastModified": 1622060422,
|
||||||
"narHash": "sha256-A8PaUyZu5WVp+IojG5q+39rjf5x57OFDYmVoDFPZLlY=",
|
"narHash": "sha256-hPVlvrAyf6zL7tTx0lpK+tMxEfZeMiIZ/A2xaJ41WOY=",
|
||||||
"owner": "lnl7",
|
"owner": "lnl7",
|
||||||
"repo": "nix-darwin",
|
"repo": "nix-darwin",
|
||||||
"rev": "e1a3f7292f085fd588d11f94ed0f47968c16df0c",
|
"rev": "007d700e644ac588ad6668e6439950a5b6e2ff64",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -58,11 +58,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1632431340,
|
"lastModified": 1630890028,
|
||||||
"narHash": "sha256-9xUnx5aeDp8Irg2/rWBKn3AjiiQTtsjTX0UshzMXy94=",
|
"narHash": "sha256-Q2ZuK0QQiSdgei68a6wV1FDPmBkR6M0apFjQrWsv8FY=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "b0651cc2173427857b172604f85da6afe69e1d41",
|
"rev": "5e46262cb1fa888f6f46a675cc2806a23ba9625c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -75,17 +75,16 @@
|
|||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"neovim-nightly-overlay",
|
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "contrib",
|
"dir": "contrib",
|
||||||
"lastModified": 1632502776,
|
"lastModified": 1630777757,
|
||||||
"narHash": "sha256-Qd9ukz/nL22GMZLdvZfmS8QXTx1KghzQpHJQKnSpMpw=",
|
"narHash": "sha256-TIcYO6hmrXNHa/SJs52UAnRwNZ3yMRexUfCdt1ANAvY=",
|
||||||
"owner": "neovim",
|
"owner": "neovim",
|
||||||
"repo": "neovim",
|
"repo": "neovim",
|
||||||
"rev": "7cb34a341db72699798fbefe49e2ed6d9aa84cb1",
|
"rev": "dce50312e1e9af81fb0e3b61d6e70bdf286fbffb",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -102,11 +101,11 @@
|
|||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1632557510,
|
"lastModified": 1630829527,
|
||||||
"narHash": "sha256-7FOckNb8Sc7j/ShEVRBDDHh9+auzDAy6o/EAUAiWi1M=",
|
"narHash": "sha256-wSbHRebRTythc3NXLePvdF0wPfjzRTZGSgnL5d9o24s=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "neovim-nightly-overlay",
|
"repo": "neovim-nightly-overlay",
|
||||||
"rev": "aa4db453a19788bb78d6e5c4bc4b7c9524a9d8af",
|
"rev": "b0e95d8a87473740e51a6e8d266f23b1b3577a85",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -117,11 +116,11 @@
|
|||||||
},
|
},
|
||||||
"nixos-hardware": {
|
"nixos-hardware": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1632267580,
|
"lastModified": 1629975021,
|
||||||
"narHash": "sha256-AvNXdmaPHYs6idbfgu1H40vEw4Wq15xLAgCnpCN1l1A=",
|
"narHash": "sha256-+z4pK5yvoIKAIPGnyxt7I7Y9yX72HFP2krppGENpn6I=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixos-hardware",
|
"repo": "nixos-hardware",
|
||||||
"rev": "3cc8c47af31798040ea62499090540413279f832",
|
"rev": "342048461da7fc743e588ee744080c045613a226",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -133,11 +132,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1632411313,
|
"lastModified": 1630761588,
|
||||||
"narHash": "sha256-lekODc44lVo9/0EwGiX6LoEt2KhiPdcfNopealMJ7n4=",
|
"narHash": "sha256-7GXckvZy7DGh2KIyfdArqwnyeSc5Owy1fumEDQyd8eY=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "51bcdc4cdaac48535dabf0ad4642a66774c609ed",
|
"rev": "a51aa6523bd8ee985bc70987909eff235900197a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -149,11 +148,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1632411313,
|
"lastModified": 1630850248,
|
||||||
"narHash": "sha256-lekODc44lVo9/0EwGiX6LoEt2KhiPdcfNopealMJ7n4=",
|
"narHash": "sha256-OzJi6Olf7mSVhGt3W7qOMVP5Qk1lH60zlHeCcITzfv0=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "51bcdc4cdaac48535dabf0ad4642a66774c609ed",
|
"rev": "23d5823337f4502dfa17e192d8c53a47cabcb6b4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@@ -71,6 +71,7 @@
|
|||||||
] ++ defaultModules;
|
] ++ defaultModules;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
darwinConfigurations = {
|
darwinConfigurations = {
|
||||||
demeter = darwin.lib.darwinSystem {
|
demeter = darwin.lib.darwinSystem {
|
||||||
|
|
||||||
|
@@ -334,7 +334,6 @@ in
|
|||||||
tabular
|
tabular
|
||||||
telescope-nvim
|
telescope-nvim
|
||||||
trouble-nvim
|
trouble-nvim
|
||||||
twilight-nvim
|
|
||||||
typescript-vim
|
typescript-vim
|
||||||
vim-commentary
|
vim-commentary
|
||||||
vim-go
|
vim-go
|
||||||
|
@@ -1,63 +1,59 @@
|
|||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- Options {{{1 ---------------------------------------------------------------
|
-- Options {{{1 ---------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
vim.opt.autoindent = true -- maintain indent of current line
|
vim.opt.autoindent = true
|
||||||
vim.opt.backup = false -- don't make backups before writing
|
vim.opt.backup = false
|
||||||
vim.opt.belloff = "all" -- never ring the bell for any reason
|
vim.opt.belloff = "all"
|
||||||
vim.opt.breakindent = true
|
vim.opt.breakindent = true
|
||||||
vim.opt.completeopt = "menuone" -- show menu even if there is only one candidate (for nvim-compe)
|
vim.opt.completeopt = "menuone"
|
||||||
vim.opt.completeopt = vim.opt.completeopt + "noselect" -- don't automatically select canditate (for nvim-compe)
|
vim.opt.completeopt = vim.opt.completeopt + "noselect"
|
||||||
vim.opt.cursorline = true -- highlight current line
|
vim.opt.cursorline = true
|
||||||
vim.opt.expandtab = true -- always use spaces instead of tabs
|
vim.opt.expandtab = true
|
||||||
vim.opt.fillchars = {
|
vim.opt.fillchars = {
|
||||||
diff = "∙", -- BULLET OPERATOR (U+2219, UTF-8: E2 88 99)
|
diff = "∙",
|
||||||
eob = " ", -- NO-BREAK SPACE (U+00A0, UTF-8: C2 A0) to suppress ~ at EndOfBuffer
|
eob = " ",
|
||||||
vert = "┃", -- BOX DRAWINGS HEAVY VERTICAL (U+2503, UTF-8: E2 94 83)
|
vert = "┃",
|
||||||
}
|
}
|
||||||
vim.opt.hlsearch = true
|
vim.opt.hlsearch = true
|
||||||
vim.opt.ignorecase = true
|
vim.opt.ignorecase = true
|
||||||
vim.opt.incsearch = true
|
vim.opt.incsearch = true
|
||||||
vim.opt.mouse = "a" -- enable mouse
|
vim.opt.modelines = 5
|
||||||
|
vim.opt.mouse = "a"
|
||||||
|
vim.opt.number = true
|
||||||
|
vim.opt.pumblend = 10
|
||||||
|
vim.opt.relativenumber = true
|
||||||
|
vim.opt.scrolloff = 3
|
||||||
|
vim.opt.shell = "bash"
|
||||||
|
vim.opt.shiftround = false
|
||||||
vim.opt.shiftwidth = 2
|
vim.opt.shiftwidth = 2
|
||||||
|
vim.opt.shiftwidth = 2
|
||||||
|
vim.opt.shortmess = vim.opt.shortmess + "A"
|
||||||
|
vim.opt.shortmess = vim.opt.shortmess + "I"
|
||||||
|
vim.opt.shortmess = vim.opt.shortmess + "O"
|
||||||
|
vim.opt.shortmess = vim.opt.shortmess + "T"
|
||||||
|
vim.opt.shortmess = vim.opt.shortmess + "W"
|
||||||
|
vim.opt.shortmess = vim.opt.shortmess + "a"
|
||||||
|
vim.opt.shortmess = vim.opt.shortmess + "c"
|
||||||
|
vim.opt.shortmess = vim.opt.shortmess + "o"
|
||||||
|
vim.opt.shortmess = vim.opt.shortmess + "t"
|
||||||
|
vim.opt.showbreak = "↳ "
|
||||||
|
vim.opt.showcmd = false
|
||||||
vim.opt.showcmd = true
|
vim.opt.showcmd = true
|
||||||
|
vim.opt.sidescroll = 0
|
||||||
|
vim.opt.sidescrolloff = 3
|
||||||
vim.opt.smartcase = true
|
vim.opt.smartcase = true
|
||||||
|
vim.opt.smarttab = true
|
||||||
|
vim.opt.spellcapcheck = ""
|
||||||
|
vim.opt.splitbelow = true
|
||||||
|
vim.opt.splitright = true
|
||||||
|
vim.opt.swapfile = false
|
||||||
|
vim.opt.switchbuf = "usetab"
|
||||||
|
vim.opt.synmaxcol = 200
|
||||||
vim.opt.tabstop = 2
|
vim.opt.tabstop = 2
|
||||||
|
vim.opt.tabstop = 2
|
||||||
|
vim.opt.termguicolors = true
|
||||||
vim.opt.wildmenu = true
|
vim.opt.wildmenu = true
|
||||||
|
|
||||||
vim.opt.modelines = 5 -- scan this many lines looking for modeline
|
|
||||||
vim.opt.number = true -- show line numbers in gutter
|
|
||||||
vim.opt.pumblend = 10 -- pseudo-transparency for popup-menu
|
|
||||||
vim.opt.relativenumber = true -- show relative numbers in gutter
|
|
||||||
vim.opt.scrolloff = 3 -- start scrolling 3 lines before edge of viewport
|
|
||||||
|
|
||||||
vim.opt.spellcapcheck = "" -- don't check for capital letters at start of sentence
|
|
||||||
vim.opt.splitbelow = true -- open horizontal splits below current window
|
|
||||||
vim.opt.splitright = true -- open vertical splits to the right of the current window
|
|
||||||
vim.opt.suffixes = vim.opt.suffixes - ".h" -- don't sort header files at lower priority
|
|
||||||
vim.opt.swapfile = false -- don't create swap files
|
|
||||||
vim.opt.switchbuf = "usetab" -- try to reuse windows/tabs when switching buffers
|
|
||||||
vim.opt.synmaxcol = 200 -- don't bother syntax highlighting long lines
|
|
||||||
vim.opt.tabstop = 2 -- spaces per tab
|
|
||||||
vim.opt.termguicolors = true -- use guifg/guibg instead of ctermfg/ctermbg in terminal
|
|
||||||
|
|
||||||
vim.opt.shell = "bash" -- shell to use for `!`, `:!`, `system()` etc.
|
|
||||||
vim.opt.shiftround = false -- don't always indent by multiple of shiftwidth
|
|
||||||
vim.opt.shiftwidth = 2 -- spaces per tab (when shifting)
|
|
||||||
vim.opt.shortmess = vim.opt.shortmess + "A" -- ignore annoying swapfile messages
|
|
||||||
vim.opt.shortmess = vim.opt.shortmess + "I" -- no splash screen
|
|
||||||
vim.opt.shortmess = vim.opt.shortmess + "O" -- file-read message overwrites previous
|
|
||||||
vim.opt.shortmess = vim.opt.shortmess + "T" -- truncate non-file messages in middle
|
|
||||||
vim.opt.shortmess = vim.opt.shortmess + "W" -- don't echo "[w]"/"[written]" when writing
|
|
||||||
vim.opt.shortmess = vim.opt.shortmess + "a" -- use abbreviations in messages eg. `[RO]` instead of `[readonly]`
|
|
||||||
vim.opt.shortmess = vim.opt.shortmess + "c" -- completion messages
|
|
||||||
vim.opt.shortmess = vim.opt.shortmess + "o" -- overwrite file-written messages
|
|
||||||
vim.opt.shortmess = vim.opt.shortmess + "t" -- truncate file messages at start
|
|
||||||
vim.opt.showbreak = "↳ " -- DOWNWARDS ARROW WITH TIP RIGHTWARDS (U+21B3, UTF-8: E2 86 B3)
|
|
||||||
vim.opt.showcmd = false -- don't show extra info at end of command line
|
|
||||||
vim.opt.sidescroll = 0 -- sidescroll in jumps because terminals are slow
|
|
||||||
vim.opt.sidescrolloff = 3 -- same as scrolloff, but for columns
|
|
||||||
vim.opt.smarttab = true -- <tab>/<BS> indent/dedent in leading whitespace
|
|
||||||
|
|
||||||
-- Format JSON
|
-- Format JSON
|
||||||
vim.cmd([[command! JsonFormat execute "::%!jq '.'"]])
|
vim.cmd([[command! JsonFormat execute "::%!jq '.'"]])
|
||||||
|
|
||||||
@@ -178,46 +174,45 @@ vim.api.nvim_exec(
|
|||||||
-- trouble
|
-- trouble
|
||||||
require("trouble").setup({
|
require("trouble").setup({
|
||||||
{
|
{
|
||||||
position = "bottom", -- position of the list can be: bottom, top, left, right
|
position = "bottom",
|
||||||
height = 10, -- height of the trouble list when position is top or bottom
|
height = 10,
|
||||||
width = 50, -- width of the list when position is left or right
|
width = 50,
|
||||||
icons = true, -- use devicons for filenames
|
icons = true,
|
||||||
mode = "lsp_workspace_diagnostics", -- "lsp_workspace_diagnostics", "lsp_document_diagnostics", "quickfix", "lsp_references", "loclist"
|
mode = "lsp_workspace_diagnostics",
|
||||||
fold_open = "", -- icon used for open folds
|
fold_open = "",
|
||||||
fold_closed = "", -- icon used for closed folds
|
fold_closed = "",
|
||||||
action_keys = { -- key mappings for actions in the trouble list
|
action_keys = {
|
||||||
close = "q", -- close the list
|
close = "q",
|
||||||
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
|
cancel = "<esc>",
|
||||||
refresh = "r", -- manually refresh
|
refresh = "r",
|
||||||
jump = { "<cr>", "<tab>" }, -- jump to the diagnostic or open / close folds
|
jump = { "<cr>", "<tab>" },
|
||||||
open_split = { "<c-x>" }, -- open buffer in new split
|
open_split = { "<c-x>" },
|
||||||
open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
|
open_vsplit = { "<c-v>" },
|
||||||
open_tab = { "<c-t>" }, -- open buffer in new tab
|
open_tab = { "<c-t>" },
|
||||||
jump_close = { "o" }, -- jump to the diagnostic and close the list
|
jump_close = { "o" },
|
||||||
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
|
toggle_mode = "m",
|
||||||
toggle_preview = "P", -- toggle auto_preview
|
toggle_preview = "P",
|
||||||
hover = "K", -- opens a small popup with the full multiline message
|
hover = "K",
|
||||||
preview = "p", -- preview the diagnostic location
|
preview = "p",
|
||||||
close_folds = { "zM", "zm" }, -- close all folds
|
close_folds = { "zM", "zm" },
|
||||||
open_folds = { "zR", "zr" }, -- open all folds
|
open_folds = { "zR", "zr" },
|
||||||
toggle_fold = { "zA", "za" }, -- toggle fold of current file
|
toggle_fold = { "zA", "za" },
|
||||||
previous = "k", -- preview item
|
previous = "k",
|
||||||
next = "j", -- next item
|
next = "j",
|
||||||
},
|
},
|
||||||
indent_lines = true, -- add an indent guide below the fold icons
|
indent_lines = true,
|
||||||
auto_open = false, -- automatically open the list when you have diagnostics
|
auto_open = false,
|
||||||
auto_close = false, -- automatically close the list when you have no diagnostics
|
auto_close = false,
|
||||||
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
|
auto_preview = true,
|
||||||
auto_fold = false, -- automatically fold a file trouble list at creation
|
auto_fold = false,
|
||||||
signs = {
|
signs = {
|
||||||
-- icons / text used for a diagnostic
|
|
||||||
error = "",
|
error = "",
|
||||||
warning = "",
|
warning = "",
|
||||||
hint = "",
|
hint = "",
|
||||||
information = "",
|
information = "",
|
||||||
other = "",
|
other = "",
|
||||||
},
|
},
|
||||||
use_lsp_diagnostic_signs = false, -- enabling this will use the signs defined in your lsp client
|
use_lsp_diagnostic_signs = false,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
vim.api.nvim_set_keymap("n", "<leader>xx", "<cmd>Trouble<cr>", { silent = true, noremap = true })
|
vim.api.nvim_set_keymap("n", "<leader>xx", "<cmd>Trouble<cr>", { silent = true, noremap = true })
|
||||||
@@ -237,23 +232,6 @@ vim.api.nvim_set_keymap("n", "<leader>xl", "<cmd>Trouble loclist<cr>", { silent
|
|||||||
vim.api.nvim_set_keymap("n", "<leader>xq", "<cmd>Trouble quickfix<cr>", { silent = true, noremap = true })
|
vim.api.nvim_set_keymap("n", "<leader>xq", "<cmd>Trouble quickfix<cr>", { silent = true, noremap = true })
|
||||||
vim.api.nvim_set_keymap("n", "gR", "<cmd>Trouble lsp_references<cr>", { silent = true, noremap = true })
|
vim.api.nvim_set_keymap("n", "gR", "<cmd>Trouble lsp_references<cr>", { silent = true, noremap = true })
|
||||||
|
|
||||||
-- twilight
|
|
||||||
require("twilight").setup({
|
|
||||||
dimming = {
|
|
||||||
alpha = 0.25, -- amount of dimming
|
|
||||||
-- we try to get the foreground from the highlight groups or fallback color
|
|
||||||
color = { "Normal", "#cccccc" },
|
|
||||||
},
|
|
||||||
context = 10, -- amount of lines we will try to show around the current line
|
|
||||||
expand = { -- for treesitter, we we always try to expand to the top-most ancestor with these types
|
|
||||||
"function",
|
|
||||||
"method",
|
|
||||||
"table",
|
|
||||||
"if_statement",
|
|
||||||
},
|
|
||||||
exclude = {}, -- exclude these filetypes
|
|
||||||
})
|
|
||||||
|
|
||||||
-- hound.nvim
|
-- hound.nvim
|
||||||
require("hound").setup({
|
require("hound").setup({
|
||||||
hound_base_url = "http://hound", -- Rely on Tailscale's MagicDNS
|
hound_base_url = "http://hound", -- Rely on Tailscale's MagicDNS
|
||||||
@@ -267,7 +245,6 @@ vim.api.nvim_set_keymap("n", "<leader>hs", ":Hound", { silent = true, noremap =
|
|||||||
-- neoclip
|
-- neoclip
|
||||||
require('telescope').load_extension('neoclip')
|
require('telescope').load_extension('neoclip')
|
||||||
|
|
||||||
|
|
||||||
-- vim-go
|
-- vim-go
|
||||||
vim.g.go_auto_sameids = 0
|
vim.g.go_auto_sameids = 0
|
||||||
vim.g.go_fmt_command = "goimports"
|
vim.g.go_fmt_command = "goimports"
|
||||||
|
Reference in New Issue
Block a user