Compare commits

..

9 Commits

Author SHA1 Message Date
n
782f37021e added cpp, rust, go, php, ruby to the language list 2024-10-27 07:48:17 +00:00
n
12aa936655 updated comment.lua to use the default full config object 2024-10-27 07:47:26 +00:00
n
330c26bddb added trouble 2024-10-27 07:46:58 +00:00
n
a1f0559227 added nio 2024-10-27 07:46:50 +00:00
n
1929ec4eff added neotest 2024-10-27 07:46:39 +00:00
n
8c7fb8053b added fugitive 2024-10-27 07:46:32 +00:00
n
49ac91e246 added set.lua and remap.lua to init.lua (so that they're loaded) 2024-10-27 07:46:12 +00:00
n
95c89e1fa0 moved leader mapping to remap.lua 2024-10-27 07:45:35 +00:00
n
7b3e08f8a9 moved remaps to their own file 2024-10-27 07:44:47 +00:00
10 changed files with 203 additions and 90 deletions

View File

@ -1 +1,3 @@
require("nat.set")
require("nat.remap")
require("nat.lazy_init")

View File

@ -1,4 +1,43 @@
return {
"numToStr/Comment.nvim",
opts = function() require("Comment").setup({ }) end
}
return { "numToStr/Comment.nvim", opts = function() require("Comment").setup({
-- Add a space b/w comment and the line
padding = true,
-- Whether the cursor should stay at its position
sticky = true,
-- Lines to be ignored while (un)comment
ignore = nil,
-- LHS of toggle mappings in NORMAL mode
toggler = {
-- Line-comment toggle keymap
line = 'gcc',
-- Block-comment toggle keymap
block = 'gbc',
},
-- LHS of operator-pending mappings in NORMAL and VISUAL mode
opleader = {
-- Line-comment keymap
line = 'gc',
-- Block-comment keymap
block = 'gb',
},
-- LHS of extra mappings
extra = {
-- Add comment on the line above
above = 'gcO',
-- Add comment on the line below
below = 'gco',
-- Add comment at the end of line
eol = 'gcA',
},
-- Enable keybindings
-- NOTE: If given `false` then the plugin won't create any mappings
mappings = {
-- Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}`
basic = true,
-- Extra mapping; `gco`, `gcO`, `gcA`
extra = true,
},
-- Function to call before (un)comment
pre_hook = nil,
-- Function to call after (un)comment
post_hook = nil,
}) end }

34
lua/nat/lazy/fugitive.lua Normal file
View File

@ -0,0 +1,34 @@
return {
"tpope/vim-fugitive",
config = function()
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
local nat_Fugitive = vim.api.nvim_create_augroup("nat_Fugitive", {})
local autocmd = vim.api.nvim_create_autocmd
autocmd("BufWinEnter", {
group = nat_Fugitive,
pattern = "*",
callback = function()
if vim.bo.ft ~= "fugitive" then
return
end
local bufnr = vim.api.nvim_get_current_buf()
local opts = {buffer = bufnr, remap = false}
-- rebase always
vim.keymap.set("n", "<leader>gp", function() vim.cmd.Git({'pull', '--rebase'}) end, opts)
vim.keymap.set("n", "<leader>gP", function() vim.cmd.Git('push') end, opts)
-- NOTE: It allows me to easily set the branch i am pushing and any tracking
-- needed if i did not set the branch up correctly
vim.keymap.set("n", "<leader>gT", ":Git push -u origin ", opts);
end,
})
vim.keymap.set("n", "gu", "<cmd>diffget //2<CR>")
vim.keymap.set("n", "gh", "<cmd>diffget //3<CR>")
end
}

21
lua/nat/lazy/neotest.lua Normal file
View File

@ -0,0 +1,21 @@
return { { "nvim-neotest/neotest", dependencies = {
"nvim-lua/plenary.nvim",
"antoinemadec/FixCursorHold.nvim",
"nvim-treesitter/nvim-treesitter",
"marilari88/neotest-vitest",
"nvim-neotest/neotest-plenary",
},
config = function()
local neotest = require("neotest")
neotest.setup({
adapters = {
require("neotest-vitest"),
-- require("neotest-plenary").setup({
-- -- this is my standard location for minimal vim rc
-- -- in all my projects
-- min_init = "./scripts/tests/minimal.vim",
-- }),
}
})
vim.keymap.set("n", "<leader>tc", function() neotest.run.run() end)
end } }

1
lua/nat/lazy/nio.lua Normal file
View File

@ -0,0 +1 @@
return { { "nvim-neotest/nvim-nio" } }

View File

@ -1,14 +1,11 @@
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
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"
"xml", "cpp", "rust", "go", "php", "ruby",
},
-- Install parsers synchronously (only applied to `ensure_installed`)
@ -35,14 +32,10 @@ return {
})
local treesitter_parser_config = require("nvim-treesitter.parsers").get_parser_configs()
treesitter_parser_config.templ = {
install_info = {
treesitter_parser_config.templ = { install_info = {
url = "https://github.com/vrischmann/tree-sitter-templ.git",
files = {"src/parser.c", "src/scanner.c"},
branch = "master",
},
}
files = {"src/parser.c", "src/scanner.c"}, branch = "master",
} }
vim.treesitter.language.register("templ", "templ")
end
}
end }

23
lua/nat/lazy/trouble.lua Normal file
View File

@ -0,0 +1,23 @@
return {
{
"folke/trouble.nvim",
config = function()
require("trouble").setup({
icons = false,
})
vim.keymap.set("n", "<leader>tt", function()
require("trouble").toggle()
end)
vim.keymap.set("n", "[t", function()
require("trouble").next({skip_groups = true, jump = true});
end)
vim.keymap.set("n", "]t", function()
require("trouble").previous({skip_groups = true, jump = true});
end)
end
},
}

View File

@ -1,11 +1,8 @@
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",
local out = vim.fn.system({ "git", "clone",
"--filter=blob:none", "--branch=stable",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
if vim.v.shell_error ~= 0 then
@ -20,12 +17,6 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
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",

19
lua/nat/remap.lua Normal file
View File

@ -0,0 +1,19 @@
vim.g.mapleader = " "
vim.g.maplocalleader = "<5C>"
-- https://neovim.reddit.com/comments/xykklt/_/j4gxyqx
vim.keymap.set("n", "<C-_>", function()
require("Comment.api").toggle.linewise.current() end,
{ noremap = true, silent = true }
)
vim.keymap.set("n", "<leader>Tt", function() vim.cmd [[Neotree toggle left]] end)
vim.keymap.set("n", "<leader>Tf", function() vim.cmd [[Neotree toggle float]] end)
-- Map Alt + Up to move the current line up
vim.keymap.set("n", "<A-Up>", ":m .-2<CR>==", { noremap = true, silent = true })
vim.keymap.set("i", "<A-Up>", "<Esc>:m .-2<CR>==gi", { noremap = true, silent = true })
-- -- Map Alt + Down to move the current line down
vim.keymap.set("n", "<A-Down>", ":m .+1<CR>==", { noremap = true, silent = true })
vim.keymap.set("i", "<A-Down>", "<Esc>:m .+1<CR>==gi", { noremap = true, silent = true })

View File

@ -1,45 +1,35 @@
vim.g.mapleader = " "
-- local HOME = "C:\\Users\\Nathan"
local HOME = os.getenv("HOME") or "~"
local set = vim.opt
local HOME = "C:\\Users\\Nathan"
vim.opt.guicursor = ""
vim.opt.nu = true
set.guicursor = ""
vim.opt.relativenumber = true
-- set.number = "relativenumber"
set.relativenumber = true
vim.opt.paste = true
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.softtabstop = 2
vim.opt.expandtab = false
set.tabstop = 2
set.softtabstop = 2
set.shiftwidth = 2
set.expandtab = true
vim.opt.smartindent = true
set.smartindent = true
vim.opt.wrap = false
set.wrap = false
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = HOME .. "/.vim/undodir"
vim.opt.undofile = true
set.swapfile = false
set.backup = false
set.undodir = HOME .. "/.vim/undodir"
set.undofile = true
vim.opt.hlsearch = false
vim.opt.incsearch = true
set.hlsearch = false
set.incsearch = true
vim.opt.termguicolors = true
set.termguicolors = true
vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
set.scrolloff = 8
set.signcolumn = "yes"
set.isfname:append("@-@")
vim.opt.updatetime = 50
set.updatetime = 50
-- set.colorcolumn = "161"
-- https://neovim.reddit.com/comments/xykklt/_/j4gxyqx
vim.keymap.set("n", "<C-_>", function()
require('Comment.api').toggle.linewise.current() end,
{ noremap = true, silent = true }
)
vim.keymap.set("n", "<leader>tt", function() vim.cmd [[Neotree left toggle]] end)
vim.keymap.set("n", "<leader>tf", function() vim.cmd [[Neotree float]] end)
-- vim.opt.colorcolumn = "161"