initial commit.

This commit is contained in:
n 2024-08-11 01:40:33 +01:00
commit 71896e05af
16 changed files with 518 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
init.vim.old
lazy-lock.json

1
init.lua Normal file
View File

@ -0,0 +1 @@
require("nat")

1
lua/nat/init.lua Normal file
View File

@ -0,0 +1 @@
require("nat.lazy_init")

26
lua/nat/lazy/cloak.lua Normal file
View File

@ -0,0 +1,26 @@
return {
"laytan/cloak.nvim",
config = function()
require("cloak").setup({
enabled = true,
cloak_character = "*",
-- The applied highlight group (colors) on the cloaking, see `:h highlight`.
highlight_group = "Comment",
patterns = {
{
-- Match any file starting with ".env".
-- This can be a table to match multiple file patterns.
file_pattern = {
".env*",
"wrangler.toml",
".dev.vars",
},
-- Match an equals sign and any character after it.
-- This can also be a table of patterns to cloak,
-- example: cloak_pattern = { ":.+", "-.+" } for yaml files.
cloak_pattern = "=.+"
},
},
})
end
}

48
lua/nat/lazy/colors.lua Normal file
View File

@ -0,0 +1,48 @@
function ColorMyPencils(color)
color = color or "rose-pine"
vim.cmd.colorscheme(color)
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
end
return {
{
"folke/tokyonight.nvim",
config = function()
require("tokyonight").setup({
-- your configuration comes here
-- or leave it empty to use the default settings
style = "storm", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
transparent = true, -- Enable this to disable setting the background color
terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
styles = {
-- Style to be applied to different syntax groups
-- Value is any valid attr-list value for `:help nvim_set_hl`
comments = { italic = false },
keywords = { italic = false },
-- Background styles. Can be "dark", "transparent" or "normal"
sidebars = "dark", -- style for sidebars, see below
floats = "dark", -- style for floating windows
},
})
end
},
{
"rose-pine/neovim",
name = "rose-pine",
config = function()
require('rose-pine').setup({
disable_background = true,
})
vim.cmd("colorscheme rose-pine")
ColorMyPencils()
end
},
}

View File

@ -0,0 +1,15 @@
return {
{
"CopilotC-Nvim/CopilotChat.nvim",
branch = "canary",
dependencies = {
{ "zbirenbaum/copilot.lua" }, -- or github/copilot.vim
{ "nvim-lua/plenary.nvim" }, -- for curl, log wrapper
},
opts = {
debug = true, -- Enable debugging
-- See Configuration section for rest
},
-- See Commands section for default commands if you want to lazy load on them
},
}

49
lua/nat/lazy/copilot.lua Normal file
View File

@ -0,0 +1,49 @@
return {
"zbirenbaum/copilot.lua",
config = function()
require('copilot').setup({
panel = {
enabled = true,
auto_refresh = false,
keymap = {
jump_prev = "[[",
jump_next = "]]",
accept = "<CR>",
refresh = "gr",
open = "<M-CR>"
},
layout = {
position = "bottom", -- | top | left | right
ratio = 0.4
},
},
suggestion = {
enabled = true,
auto_trigger = false,
hide_during_completion = true,
debounce = 75,
keymap = {
accept = "<M-l>",
accept_word = false,
accept_line = false,
next = "<M-]>",
prev = "<M-[>",
dismiss = "<C-]>",
},
},
filetypes = {
yaml = false,
markdown = false,
help = false,
gitcommit = false,
gitrebase = false,
hgcommit = false,
svn = false,
cvs = false,
["."] = false,
},
copilot_node_command = 'node', -- Node.js version must be > 18.x
server_opts_overrides = {},
})
end
}

7
lua/nat/lazy/init.lua Normal file
View File

@ -0,0 +1,7 @@
return {
{ "nvim-lua/plenary.nvim", name = "plenary" },
"github/copilot.vim",
"eandrju/cellular-automaton.nvim",
"gpanders/editorconfig.nvim",
}

91
lua/nat/lazy/lsp.lua Normal file
View File

@ -0,0 +1,91 @@
return {
"neovim/nvim-lspconfig",
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/nvim-cmp",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"j-hui/fidget.nvim",
},
config = function()
local cmp = require('cmp')
local cmp_lsp = require("cmp_nvim_lsp")
local capabilities = vim.tbl_deep_extend(
"force",
{},
vim.lsp.protocol.make_client_capabilities(),
cmp_lsp.default_capabilities())
require("fidget").setup({})
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = {
"lua_ls",
"rust_analyzer",
"tsserver",
},
handlers = {
function(server_name) -- default handler (optional)
require("lspconfig")[server_name].setup {
capabilities = capabilities
}
end,
["lua_ls"] = function()
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup {
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim", "it", "describe", "before_each", "after_each" },
}
}
}
}
end,
}
})
local cmp_select = { behavior = cmp.SelectBehavior.Select }
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = cmp.mapping.preset.insert({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<C-y>'] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' }, -- For luasnip users.
}, {
{ name = 'buffer' },
})
})
vim.diagnostic.config({
-- update_in_insert = true,
float = {
focusable = false,
style = "minimal",
border = "rounded",
source = "always",
header = "",
prefix = "",
},
})
end
}

View File

@ -0,0 +1,30 @@
return {
"nvim-telescope/telescope.nvim",
tag = "0.1.5",
dependencies = {
"nvim-lua/plenary.nvim"
},
config = function()
require('telescope').setup({})
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
vim.keymap.set('n', '<leader>pws', function()
local word = vim.fn.expand("<cword>")
builtin.grep_string({ search = word })
end)
vim.keymap.set('n', '<leader>pWs', function()
local word = vim.fn.expand("<cWORD>")
builtin.grep_string({ search = word })
end)
vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep > ") })
end)
vim.keymap.set('n', '<leader>vh', builtin.help_tags, {})
end
}

View File

@ -0,0 +1,48 @@
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all"
ensure_installed = {
"vimdoc", "javascript", "typescript", "vue", "lua", "yaml",
"jsdoc", "bash", "powershell", "c_sharp", "json", "sql",
"vim", "html", "css", "scss", "jsonc", "python", "http",
"xml"
},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don"t have `tree-sitter` CLI installed locally
auto_install = true,
indent = {
enable = true
},
highlight = {
-- `false` will disable the whole extension
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on "syntax" being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = { "markdown" },
},
})
local treesitter_parser_config = require("nvim-treesitter.parsers").get_parser_configs()
treesitter_parser_config.templ = {
install_info = {
url = "https://github.com/vrischmann/tree-sitter-templ.git",
files = {"src/parser.c", "src/scanner.c"},
branch = "master",
},
}
vim.treesitter.language.register("templ", "templ")
end
}

View File

@ -0,0 +1,9 @@
return {
"mbbill/undotree",
config = function()
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
end
}

37
lua/nat/lazy/zenmode.lua Normal file
View File

@ -0,0 +1,37 @@
return {
"folke/zen-mode.nvim",
config = function()
vim.keymap.set("n", "<leader>zz", function()
require("zen-mode").setup {
window = {
width = 90,
options = { }
},
}
require("zen-mode").toggle()
vim.wo.wrap = false
vim.wo.number = true
vim.wo.rnu = true
ColorMyPencils()
end)
vim.keymap.set("n", "<leader>zZ", function()
require("zen-mode").setup {
window = {
width = 80,
options = { }
},
}
require("zen-mode").toggle()
vim.wo.wrap = false
vim.wo.number = false
vim.wo.rnu = false
vim.opt.colorcolumn = "0"
ColorMyPencils()
end)
end
}

37
lua/nat/lazy_init.lua Normal file
View File

@ -0,0 +1,37 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local out = vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
-- Setup lazy.nvim
require("lazy").setup({
spec = "nat.lazy",
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "habamax" } },
-- automatically check for plugin updates
checker = { enabled = true },
})

83
lua/nat/packer.lua Normal file
View File

@ -0,0 +1,83 @@
-- This file can be loaded by calling `lua require("plugins")` from your init.vim
-- Only required if you have packer configured as `opt`
vim.cmd.packadd("packer.nvim")
return require("packer").startup(function(use)
-- Packer can manage itself
use "wbthomason/packer.nvim"
use {
"nvim-telescope/telescope.nvim", tag = "0.1.0",
-- or , branch = "0.1.x",
requires = { {"nvim-lua/plenary.nvim"} }
}
use("folke/tokyonight.nvim")
use({
"rose-pine/neovim",
as = "rose-pine",
config = function()
vim.cmd("colorscheme rose-pine")
end
})
use({
"folke/trouble.nvim",
config = function()
require("trouble").setup {
icons = false,
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
end
})
use {
'nvim-treesitter/nvim-treesitter',
run = function()
local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
ts_update()
end,}
use("nvim-treesitter/playground")
use("~/personal/harpoon")
use("theprimeagen/vim-be-good")
use("theprimeagen/refactoring.nvim")
use("mbbill/undotree")
use("tpope/vim-fugitive")
--use("nvim-treesitter/nvim-treesitter-context");
use {
"VonHeikemen/lsp-zero.nvim",
branch = "v1.x",
requires = {
-- LSP Support
{"neovim/nvim-lspconfig"},
{"williamboman/mason.nvim"},
{"williamboman/mason-lspconfig.nvim"},
-- Autocompletion
{"hrsh7th/nvim-cmp"},
{"hrsh7th/cmp-buffer"},
{"hrsh7th/cmp-path"},
{"saadparwaiz1/cmp_luasnip"},
{"hrsh7th/cmp-nvim-lsp"},
{"hrsh7th/cmp-nvim-lua"},
-- Snippets
{"L3MON4D3/LuaSnip"},
{"rafamadriz/friendly-snippets"},
}
}
use("folke/zen-mode.nvim")
use("github/copilot.vim")
use("eandrju/cellular-automaton.nvim")
use("laytan/cloak.nvim")
end)

34
lua/nat/set.lua Normal file
View File

@ -0,0 +1,34 @@
vim.g.mapleader = "<Space>"
vim.opt.guicursor = ""
vim.opt.nu = true
vim.opt.relativenumber = true
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.opt.shiftwidth = 2
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.wrap = false
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.termguicolors = true
vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50
vim.opt.colorcolumn = "80"