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

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,
}