Creating dotfiles for terminals

dot files for terminals

a
This commit is contained in:
2025-10-06 16:05:23 +11:00
commit cea1901016
37 changed files with 1577 additions and 0 deletions

2
nvim/init.lua Normal file
View File

@@ -0,0 +1,2 @@
require("sam.options")
require("sam.lazy")

38
nvim/lazy-lock.json Normal file
View File

@@ -0,0 +1,38 @@
{
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "73813308abc2eaeff2bc0d3f2f79270c491be9d7" },
"catppuccin": { "branch": "main", "commit": "c89184526212e04feffbddda9d06b041a8fca416" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"conform.nvim": { "branch": "master", "commit": "9d6f881a4047a51c7709223dcf24e967633c6523" },
"dracula.nvim": { "branch": "main", "commit": "041d923368d540a1e438989ce8f915628081a56a" },
"everforest-nvim": { "branch": "main", "commit": "d2936185a6d266def29fd7b523d296384580ef08" },
"gitsigns.nvim": { "branch": "main", "commit": "1ee5c1fd068c81f9dd06483e639c2aa4587dc197" },
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
"kanagawa.nvim": { "branch": "master", "commit": "27f1e119f3a7e6d11d435a59e3262e6affda1f83" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"live-preview.nvim": { "branch": "main", "commit": "35ddc5a99499d1d2f4adefb7e92d0c537353fdec" },
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "155eac5d8609a2f110041f8ac3491664cc126354" },
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-dap": { "branch": "master", "commit": "48570d8372f63c9e9ba399a16606f9553034a9b2" },
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
"nvim-lint": { "branch": "master", "commit": "335a6044be16d7701001059cba9baa36fbeef422" },
"nvim-lspconfig": { "branch": "master", "commit": "db8fef885009fdec0daeff3e5dda92e1f539611e" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-tree.lua": { "branch": "master", "commit": "87d096a39cb2d5d43e6771563575ff042a79f48b" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" },
"onedark.nvim": { "branch": "master", "commit": "de495fabe171d48aed5525f002d14414efcecbb2" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"tabular": { "branch": "master", "commit": "12437cd1b53488e24936ec4b091c9324cafee311" },
"telescope-themes": { "branch": "main", "commit": "65721365bd7a04a6c9679e76b6387b60320fd5f3" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
"tokyonight.nvim": { "branch": "main", "commit": "4d159616aee17796c2c94d2f5f87d2ee1a3f67c7" },
"vim-markdown": { "branch": "master", "commit": "8f6cb3a6ca4e3b6bcda0730145a0b700f3481b51" },
"which-key.nvim": { "branch": "main", "commit": "904308e6885bbb7b60714c80ab3daf0c071c1492" }
}

View File

@@ -0,0 +1 @@
vim.cmd("colorscheme catppuccin")

17
nvim/lua/sam/lazy.lua Normal file
View File

@@ -0,0 +1,17 @@
-- ~/.config/nvim/lua/sam/lazy.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- Tell lazy to load our plugin specs from the "plugins" directory
require("lazy").setup("sam.plugins", {})

7
nvim/lua/sam/options.lua Normal file
View File

@@ -0,0 +1,7 @@
-- ~/.config/nvim/lua/sam/options.lua
vim.g.mapleader = " " -- Set the leader key to the space bar.
vim.g.maplocalleader = " " -- Set the local leader key to the space bar.
-- sam.options.lua
vim.opt.number = true -- Absolute numbers on all lines
vim.opt.relativenumber = true -- Relative numbers (hybrid when both enabled)

View File

@@ -0,0 +1,7 @@
return {
"windwp/nvim-autopairs",
event = "InsertEnter",
config = function()
require("nvim-autopairs").setup({})
end,
}

View File

@@ -0,0 +1,39 @@
-- ~/.config/nvim/lua/sam/plugins/cmp.lua
return {
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp", -- Source for LSP completions
"hrsh7th/cmp-buffer", -- Source for buffer completions
"hrsh7th/cmp-path", -- Source for path completions
"L3MON4D3/LuaSnip", -- Snippet engine
"saadparwaiz1/cmp_luasnip", -- Bridge for snippet engine
},
config = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-k>"] = cmp.mapping.select_prev_item(), -- Previous item
["<C-j>"] = cmp.mapping.select_next_item(), -- Next item
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), -- Trigger completion
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Confirm selection
}),
-- The sources for completion
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
}),
})
end,
}

View File

@@ -0,0 +1,11 @@
-- ~/.config/nvim/lua/sam/plugins/colorscheme.lua
return {
"catppuccin/nvim",
name = "catppuccin",
priority = 1000, -- Make sure to load this before all the other start plugins
config = function()
-- load the colorscheme here
vim.cmd.colorscheme("catppuccin")
end,
}

View File

@@ -0,0 +1,6 @@
return {
"numToStr/Comment.nvim",
config = function()
require("Comment").setup()
end,
}

View File

@@ -0,0 +1,20 @@
return {
"mfussenegger/nvim-dap",
dependencies = {
-- Installs the beautiful UI for DAP
"rcarriga/nvim-dap-ui",
-- Required by dap-ui
"nvim-neotest/nvim-nio",
},
config = function()
local dap, dapui = require("dap"), require("dapui")
dapui.setup()
-- Add your keymaps for debugging here
vim.keymap.set("n", "<Leader>db", dap.toggle_breakpoint, { desc = "Toggle Breakpoint" })
vim.keymap.set("n", "<Leader>dc", dap.continue, { desc = "Continue" })
vim.keymap.set("n", "<Leader>do", dap.step_over, { desc = "Step Over" })
vim.keymap.set("n", "<Leader>di", dap.step_into, { desc = "Step Into" })
vim.keymap.set("n", "<Leader>du", dapui.toggle, { desc = "Toggle DAP UI" })
end,
}

View File

@@ -0,0 +1,14 @@
-- ~/.config/nvim/lua/sam/plugins/filetree.lua
return {
"nvim-tree/nvim-tree.lua",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("nvim-tree").setup({})
-- A keymap to toggle the file tree
vim.keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>", {
desc = "Toggle file explorer",
})
end,
}

View File

@@ -0,0 +1,34 @@
-- ~/.config/nvim/lua/sam/plugins/formatter.lua
return {
"stevearc/conform.nvim",
config = function()
require("conform").setup({
formatters_by_ft = {
-- Web
javascript = { "prettier" },
typescript = { "prettier" },
javascriptreact = { "prettier" },
typescriptreact = { "prettier" },
html = { "prettier" },
css = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
sh = { "shfmt" }, -- << ADD THIS LINE
bash = { "shfmt" }, -- << AND THIS ONE
-- PHP
php = { "pint" },
-- Python
python = { "black" },
-- Lua (for our config)
lua = { "stylua" },
},
})
-- A keymap to trigger formatting
vim.keymap.set({ "n", "v" }, "<leader>f", function()
require("conform").format({ async = true, lsp_fallback = true })
end, { desc = "Format code" })
end,
}

View File

@@ -0,0 +1,17 @@
-- ~/.config/nvim/lua/sam/plugins/gitsigns.lua
return {
"lewis6991/gitsigns.nvim",
config = function()
require("gitsigns").setup({
-- You can configure the signs here if you want
-- signs = {
-- add = { text = '+' },
-- change = { text = '~' },
-- delete = { text = '_' },
-- topdelete = { text = '‾' },
-- changedelete = { text = '~' },
-- },
})
end,
}

View File

@@ -0,0 +1,5 @@
-- ~/.config/nvim/lua/sam/plugins/icons.lua
return {
"nvim-tree/nvim-web-devicons",
}

View File

@@ -0,0 +1,16 @@
return {
"mfussenegger/nvim-lint",
event = "VeryLazy",
config = function()
require("lint").linters_by_ft = {
-- You can add your languages here. Examples:
-- javascript = { "eslint_d" },
-- python = { "ruff" },
}
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
callback = function()
require("lint").try_lint()
end,
})
end,
}

View File

@@ -0,0 +1,97 @@
-- ~/.config/nvim/lua/sam/plugins/lsp.lua (emmet-ls for HTML Tag Completion + No Warning)
return {
"neovim/nvim-lspconfig",
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"hrsh7th/nvim-cmp",
},
config = function()
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local on_attach = function(client, bufnr)
-- LSP keymaps
local nmap = function(keys, func, desc)
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = "LSP: " .. desc })
end
nmap("gD", vim.lsp.buf.declaration, "Go to Declaration")
nmap("gd", vim.lsp.buf.definition, "Go to Definition")
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
nmap("<leader>rn", vim.lsp.buf.rename, "Rename Symbol")
nmap("<leader>ca", vim.lsp.buf.code_action, "Code Action")
end
require("mason").setup()
-- ADDING THE NEW LSP SERVERS HERE (emmet_ls replaces html for better tags)
local servers = {
"intelephense", -- PHP
"pyright", -- Python
"ts_ls", -- TS/JS
"clangd", -- C++
"lua_ls", -- Lua
"emmet_ls", -- HTML/CSS (for tag completion/snippets)
"jsonls", -- JSON
"yamlls", -- YAML
"marksman", -- Markdown
"bashls",
}
local mason_lspconfig = require("mason-lspconfig")
mason_lspconfig.setup({
ensure_installed = servers,
handlers = {
-- Global handler using new vim.lsp.config API (no global lspconfig require)
function(server_name)
vim.lsp.config(server_name, {
on_attach = on_attach,
capabilities = capabilities,
root_dir = function(fname)
if type(fname) ~= "string" then
return vim.fn.getcwd()
end
local util = require("lspconfig.util")
return util.root_pattern(".git", "composer.json", "package.json")(fname)
or util.path.dirname(fname)
end,
})
end,
},
})
-- emmet-ls Specific Setup (for HTML/CSS tag completion + snippets)
vim.lsp.config("emmet_ls", {
on_attach = on_attach,
capabilities = vim.tbl_deep_extend("force", capabilities, {
textDocument = {
completion = {
completionItem = {
snippetSupport = true, -- Enables <div> → <div></div> + Emmet expansions
},
},
},
}),
filetypes = { "html", "css", "javascriptreact", "typescriptreact" }, -- Broad for web files
root_dir = function(fname)
if type(fname) ~= "string" then
return vim.fn.getcwd()
end
local util = require("lspconfig.util")
return util.root_pattern(".git", "package.json")(fname)
or util.path.dirname(fname)
end,
init_options = {
html = {
options = {
["bem.enabled"] = true, -- Optional: BEM naming support
},
completions = true,
format = true,
extractColors = true,
includeLanguages = {
javascript = "javascriptreact",
},
},
},
})
end,
}

View File

@@ -0,0 +1,9 @@
-- ~/.config/nvim/lua/sam/plugins/lualine.lua
return {
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("lualine").setup({})
end,
}

View File

@@ -0,0 +1,75 @@
return {
-- Enhanced Markdown editing (only for .md)
{
"godlygeek/tabular",
ft = "markdown",
},
{
"plasticboy/vim-markdown",
ft = "markdown",
dependencies = { "godlygeek/tabular" },
config = function()
-- Core settings
vim.g.vim_markdown_folding_disabled = 0
vim.g.vim_markdown_conceal = 1
vim.g.vim_markdown_toc_autofit = 1
vim.g.vim_markdown_strikethrough = 1
-- Prose-friendly wrapping + Pandoc exports (MD only)
vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown",
callback = function()
-- Wrapping
vim.opt_local.wrap = true
vim.opt_local.linebreak = true
vim.opt_local.list = false
-- HTML preview/export
vim.keymap.set("n", "<leader>mh", function()
local input = vim.fn.expand("%")
local output = "/tmp/" .. vim.fn.fnamemodify(input, ":t:r") .. ".html"
vim.fn.system("pandoc " .. vim.fn.shellescape(input) .. " -o " .. vim.fn.shellescape(output) .. " --standalone --self-contained")
vim.fn.system("open " .. vim.fn.shellescape(output))
end, { desc = "Markdown to HTML Preview", buffer = true })
-- PDF export
vim.keymap.set("n", "<leader>mp", function()
local input = vim.fn.expand("%")
local output = vim.fn.fnamemodify(input, ":r") .. ".pdf"
vim.fn.system("pandoc " .. vim.fn.shellescape(input) .. " -o " .. vim.fn.shellescape(output) .. " --pdf-engine=pdflatex")
end, { desc = "Markdown to PDF", buffer = true })
-- TOC preview
vim.keymap.set("n", "<leader>mt", ":!pandoc % --toc -o /tmp/toc.html && open /tmp/toc.html<CR>", { desc = "Generate TOC Preview", buffer = true })
end,
})
end,
},
-- Live browser preview (MD + HTML)
{
"brianhuster/live-preview.nvim",
dependencies = { "nvim-telescope/telescope.nvim" },
ft = { "markdown", "html" }, -- Load for both
lazy = false,
opts = {
usage_title = "Usage: <leader>lp to start preview",
picker_title = "Select file to preview",
templates = { -- Basic MD render (for .md); HTML serves raw
md = {
command = "pandoc % -o /tmp/preview.html --standalone --self-contained", -- Use Pandoc for MD
extension = "html"
},
html = {
command = "echo 'Serving raw HTML'", -- No-op; serves file directly
extension = "html"
}
},
debounce = 300, -- Refresh delay post-save
},
keys = {
{ "<leader>lp", "<cmd>LivePreview start<cr>", desc = "Start Live Preview", ft = { "markdown", "html" } },
{ "<leader>ls", "<cmd>LivePreview stop<cr>", desc = "Stop Live Preview", ft = { "markdown", "html" } },
},
},
}

View File

@@ -0,0 +1,17 @@
-- ~/.config/nvim/lua/sam/plugins/mason-tools.lua
return {
"williamboman/mason.nvim",
opts = {
ensure_installed = {
-- Formatters
"html-ls",
"prettier", -- For web files
"pint", -- For PHP/Laravel
"black", -- For Python
"shfmt",
-- Linters (optional but recommended)
"eslint_d", -- For JS/TS
},
},
}

View File

@@ -0,0 +1,3 @@
return {
"andrewberty/telescope-themes",
}

View File

@@ -0,0 +1,16 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
-- This section is unchanged
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Find files" })
vim.keymap.set("n", "<leader>fg", builtin.live_grep, { desc = "Live grep" })
-- ADD THIS LINE to load the new extension
require("telescope").load_extension("themes")
-- ADD THIS LINE to create the new keymap
vim.keymap.set("n", "<leader>th", "<cmd>Telescope themes<cr>", { desc = "Switch Theme" })
end,
}

View File

@@ -0,0 +1,8 @@
return {
"catppuccin/nvim",
name = "catppuccin",
priority = 1000, -- Make sure this theme is loaded first
config = function()
-- You can add custom settings here if you like
end,
}

View File

@@ -0,0 +1 @@
return { "Mofiqul/dracula.nvim" }

View File

@@ -0,0 +1 @@
return { "neanias/everforest-nvim" }

View File

@@ -0,0 +1 @@
return { "ellisonleao/gruvbox.nvim" }

View File

@@ -0,0 +1 @@
return { "rebelot/kanagawa.nvim" }

View File

@@ -0,0 +1 @@
return { "navarasu/onedark.nvim" }

View File

@@ -0,0 +1 @@
return { "folke/tokyonight.nvim" }

View File

@@ -0,0 +1,36 @@
-- ~/.config/nvim/lua/sam/plugins/treesitter.lua
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate", -- Installs and updates parsers
config = function()
require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all"
ensure_installed = {
"c",
"cpp",
"lua",
"vim",
"vimdoc",
"python",
"javascript",
"typescript",
"tsx",
"html",
"css",
"json",
"php",
},
-- Install parsers synchronously (only applied on startup)
sync_install = false,
-- Automatically install missing parsers when entering buffer
auto_install = true,
highlight = {
enable = true,
},
})
end,
}

View File

@@ -0,0 +1,9 @@
return {
"folke/which-key.nvim",
config = function()
require("which-key").setup({
-- your configuration comes here
-- or leave it empty to use the default settings
})
end,
}