initial neovim config, plugins and a few mappings/settings
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
function SetColorSchemeWrapper(scheme)
|
||||
scheme = scheme or "sorbet"
|
||||
vim.cmd.colorscheme(scheme)
|
||||
|
||||
-- Allow for transparency
|
||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||
end
|
||||
SetColorSchemeWrapper()
|
||||
|
||||
-- TODO: get this working as desired
|
||||
-- autocmd('BufEnter', {
|
||||
-- group = ThePrimeagenGroup, -- TODO: group needed?
|
||||
-- callback = function()
|
||||
-- if vim.bo.filetype == "zig" then
|
||||
-- pcall(SetColorSchemeWrapper, "tokyonight-night")
|
||||
-- else
|
||||
-- pcall(SetColorSchemeWrapper, "rose-pine-main")
|
||||
-- pcall(SetColorSchemeWrapper, "slate")
|
||||
-- end
|
||||
-- end
|
||||
-- })
|
||||
|
6
src_files/.config/nvim/lua/david_standard/init.lua
Normal file
6
src_files/.config/nvim/lua/david_standard/init.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
require("david_standard.settings")
|
||||
require("david_standard.remaps")
|
||||
require("david_standard.lazy_nvim")
|
||||
|
||||
require("david_standard.plugin_key_mappings")
|
||||
require("david_standard.colorscheme_settings")
|
28
src_files/.config/nvim/lua/david_standard/lazy_nvim.lua
Normal file
28
src_files/.config/nvim/lua/david_standard/lazy_nvim.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
local path_lazy_nvim = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(path_lazy_nvim) then
|
||||
local git_output = vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable",
|
||||
path_lazy_nvim,
|
||||
})
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo(
|
||||
{ { "Failed to clone lazy.nvim:\n" }, { git_output }, },
|
||||
true,
|
||||
{}
|
||||
)
|
||||
vim.fn.getchar()
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(path_lazy_nvim)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
{ import = "david_standard.plugins_lazy" },
|
||||
},
|
||||
checker = { enabled = false },
|
||||
change_detection = { notify = false },
|
||||
})
|
@@ -0,0 +1,36 @@
|
||||
-- telescope
|
||||
local builtin = require('telescope.builtin')
|
||||
local custom_tscope_grep = function()
|
||||
builtin.grep_string({ search = vim.fn.input("grep > ")})
|
||||
end
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
|
||||
vim.keymap.set('n', '<leader>ft', builtin.live_grep, { desc = 'Telescope find text (live_grep)' })
|
||||
vim.keymap.set('n', '<leader>fT', custom_tscope_grep, { desc = 'Telescope find text (grep_string)' })
|
||||
vim.keymap.set('n', '<leader>fg', builtin.git_files, { desc = 'Telescope find git-tracked files' })
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
|
||||
|
||||
-- harpoon
|
||||
local harpoon = require("harpoon")
|
||||
vim.keymap.set("n", "<leader>ha", function() harpoon:list():add() end)
|
||||
vim.keymap.set("n", "<leader>hA", function() harpoon:list():prepend() end)
|
||||
vim.keymap.set("n", "<leader>hl", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
|
||||
vim.keymap.set("n", "<leader>hn", function() harpoon:list():next() end)
|
||||
vim.keymap.set("n", "<leader>hp", function() harpoon:list():prev() end)
|
||||
vim.keymap.set("n", "<leader>z", function() harpoon:list():select(1) end)
|
||||
vim.keymap.set("n", "<leader>x", function() harpoon:list():select(2) end)
|
||||
vim.keymap.set("n", "<leader>c", function() harpoon:list():select(3) end)
|
||||
vim.keymap.set("n", "<leader>v", function() harpoon:list():select(4) end)
|
||||
vim.keymap.set("n", "<leader>Z", function() harpoon:list():replace_at(1) end)
|
||||
vim.keymap.set("n", "<leader>X", function() harpoon:list():replace_at(2) end)
|
||||
vim.keymap.set("n", "<leader>C", function() harpoon:list():replace_at(3) end)
|
||||
vim.keymap.set("n", "<leader>V", function() harpoon:list():replace_at(4) end)
|
||||
|
||||
-- undotree
|
||||
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
||||
|
||||
-- fugitive (git integration)
|
||||
vim.keymap.set("n", "<leader>gG", vim.cmd.Git)
|
||||
vim.keymap.set("n", "<leader>gg", ":Git --paginate ") -- shortcut, arbitrary git commands
|
||||
vim.keymap.set("n", "<leader>gs", function() vim.cmd.Git({ "--paginate status" }) end)
|
||||
vim.keymap.set("n", "<leader>gc", function() vim.cmd.Git({ "commit -a" }) end)
|
@@ -0,0 +1,49 @@
|
||||
return {
|
||||
-- TODO: decide which of these i won't be using, then remove from this file
|
||||
{
|
||||
"ellisonleao/gruvbox.nvim",
|
||||
name = "gruvbox",
|
||||
-- priority = 1000,
|
||||
opts = {
|
||||
terminal_colors = true, -- add neovim terminal colors
|
||||
undercurl = true,
|
||||
underline = true,
|
||||
bold = true,
|
||||
italic = {
|
||||
strings = true,
|
||||
emphasis = true,
|
||||
comments = true,
|
||||
operators = false,
|
||||
folds = true,
|
||||
},
|
||||
strikethrough = true,
|
||||
invert_selection = false,
|
||||
invert_signs = false,
|
||||
invert_tabline = false,
|
||||
inverse = true, -- invert background for search, diffs, statuslines and errors
|
||||
contrast = "", -- "hard", "soft", or ""
|
||||
palette_overrides = {},
|
||||
overrides = {},
|
||||
dim_inactive = false,
|
||||
transparent_mode = false,
|
||||
},
|
||||
},
|
||||
{
|
||||
"rose-pine/neovim",
|
||||
name = "rose-pine",
|
||||
},
|
||||
{
|
||||
"folke/tokyonight.nvim",
|
||||
lazy = false,
|
||||
opts = {
|
||||
style = "night", -- "night", "storm", "moon", "day"
|
||||
styles = {
|
||||
functions = {} -- disable italic for functions
|
||||
},
|
||||
on_colors = function(colors)
|
||||
colors.hint = colors.orange
|
||||
colors.error = "#ff0000"
|
||||
end
|
||||
},
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
{ "tpope/vim-fugitive" },
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
{
|
||||
"ThePrimeagen/harpoon",
|
||||
branch = "harpoon2", -- https://github.com/ThePrimeagen/harpoon/tree/harpoon2
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
local harpoon = require("harpoon")
|
||||
harpoon:setup()
|
||||
end,
|
||||
},
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
local glob_patterns_find_files = {
|
||||
"-g", "!**/.git/**",
|
||||
"-g", "!**/build/**",
|
||||
"-g", "!**/node_modules/**",
|
||||
}
|
||||
local glob_patterns_live_grep = {
|
||||
unpack(glob_patterns_find_files), -- same for now
|
||||
}
|
||||
|
||||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
tag = '0.1.8',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
opts = {
|
||||
pickers = {
|
||||
find_files = {
|
||||
find_command = {
|
||||
"rg", "--no-ignore", "--hidden", "--files",
|
||||
unpack(glob_patterns_find_files),
|
||||
},
|
||||
},
|
||||
live_grep = {
|
||||
additional_args = {
|
||||
"--no-ignore", "--hidden",
|
||||
unpack(glob_patterns_live_grep),
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
branch = 'master',
|
||||
lazy = false,
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
"vimdoc", "bash", "lua", "c", "cpp", "go", "python", "ruby",
|
||||
"html", "css", "json", "sql", "javascript", "jsdoc",
|
||||
"markdown", "markdown_inline",
|
||||
-- "odin", "zig", "ocaml", "java", "typescript",
|
||||
},
|
||||
sync_install = false, -- install `ensure_installed` parsers synchronously
|
||||
auto_install = true, -- install missing on BufEnter, requires tree-sitter CLI
|
||||
ignore_install = {},
|
||||
-- indent = { enable = true }, -- TODO: do i want this?
|
||||
highlight = {
|
||||
enable = true, -- `false` will disable the whole extension
|
||||
disable = function(lang, buf)
|
||||
for i, v in ipairs({ "html", }) do
|
||||
if lang == v then
|
||||
print("treesitter disabled for this language")
|
||||
return true
|
||||
end
|
||||
end
|
||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
if ok and stats and stats.size > (100 * 1024) then -- 100 KB
|
||||
vim.notify(
|
||||
"larger file, treesitter disabled for performance",
|
||||
vim.log.levels.WARN,
|
||||
{title = "Treesitter"}
|
||||
)
|
||||
return true
|
||||
end
|
||||
end,
|
||||
-- true, false, or list of langs; may cause slowness or duplicate highlights
|
||||
additional_vim_regex_highlighting = { "markdown" },
|
||||
},
|
||||
})
|
||||
|
||||
-- TODO: decide if needed/wanted
|
||||
-- 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
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
after = "nvim-treesitter",
|
||||
opts = {
|
||||
enable = true, -- can enable/disable via manual command
|
||||
multiwindow = false,
|
||||
max_lines = 0, -- lines the window should span; x <= 0 means no limit
|
||||
min_window_height = 10, -- min window height to enable; x <= 0 means no limit
|
||||
line_numbers = true,
|
||||
multiline_threshold = 40, -- max lines to show for a single context
|
||||
trim_scope = 'outer', -- 'inner', 'outer'; discard lines if max_lines exceeded
|
||||
mode = 'cursor', -- 'cursor', 'topline'; line used to calculate context
|
||||
separator = "-", -- 1 char, like '-'; only shown when >= 2 lines above
|
||||
zindex = 20, -- z-index of the context window
|
||||
on_attach = nil, -- (fun(buf: integer): boolean); return false to disable attaching
|
||||
},
|
||||
},
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
"mbbill/undotree",
|
||||
}
|
82
src_files/.config/nvim/lua/david_standard/remaps.lua
Normal file
82
src_files/.config/nvim/lua/david_standard/remaps.lua
Normal file
@@ -0,0 +1,82 @@
|
||||
vim.keymap.set("n", "<leader>d", vim.cmd.Ex)
|
||||
|
||||
-- vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
-- vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||
|
||||
-- vim.api.nvim_set_keymap("n", "<leader>tf", "<Plug>PlenaryTestFile", { noremap = false, silent = false })
|
||||
|
||||
-- vim.keymap.set("n", "J", "mzJ`z")
|
||||
-- vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
-- vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
-- vim.keymap.set("n", "n", "nzzzv")
|
||||
-- vim.keymap.set("n", "N", "Nzzzv")
|
||||
-- vim.keymap.set("n", "=ap", "ma=ap'a")
|
||||
-- vim.keymap.set("n", "<leader>zig", "<cmd>LspRestart<cr>")
|
||||
|
||||
-- vim.keymap.set("n", "<leader>vwm", function()
|
||||
-- require("vim-with-me").StartVimWithMe()
|
||||
-- end)
|
||||
-- vim.keymap.set("n", "<leader>svwm", function()
|
||||
-- require("vim-with-me").StopVimWithMe()
|
||||
-- end)
|
||||
|
||||
-- -- greatest remap ever
|
||||
-- vim.keymap.set("x", "<leader>p", [["_dP]])
|
||||
|
||||
-- -- next greatest remap ever : asbjornHaland
|
||||
-- vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
|
||||
-- vim.keymap.set("n", "<leader>Y", [["+Y]])
|
||||
|
||||
-- vim.keymap.set({ "n", "v" }, "<leader>d", "\"_d")
|
||||
|
||||
-- -- This is going to get me cancelled
|
||||
-- vim.keymap.set("i", "<C-c>", "<Esc>")
|
||||
|
||||
-- vim.keymap.set("n", "Q", "<nop>")
|
||||
-- vim.keymap.set("n", "<C-f>", "<cmd>silent !tmux neww tmux-sessionizer<CR>")
|
||||
-- vim.keymap.set("n", "<M-h>", "<cmd>silent !tmux-sessionizer -s 0 --vsplit<CR>")
|
||||
-- vim.keymap.set("n", "<M-H>", "<cmd>silent !tmux neww tmux-sessionizer -s 0<CR>")
|
||||
-- vim.keymap.set("n", "<leader>f", function()
|
||||
-- require("conform").format({ bufnr = 0 })
|
||||
-- end)
|
||||
|
||||
-- vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
|
||||
-- vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
|
||||
-- vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
|
||||
-- vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
|
||||
|
||||
-- vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||
-- vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
|
||||
|
||||
-- vim.keymap.set(
|
||||
-- "n",
|
||||
-- "<leader>ee",
|
||||
-- "oif err != nil {<CR>}<Esc>Oreturn err<Esc>"
|
||||
-- )
|
||||
|
||||
-- vim.keymap.set(
|
||||
-- "n",
|
||||
-- "<leader>ea",
|
||||
-- "oassert.NoError(err, \"\")<Esc>F\";a"
|
||||
-- )
|
||||
|
||||
-- vim.keymap.set(
|
||||
-- "n",
|
||||
-- "<leader>ef",
|
||||
-- "oif err != nil {<CR>}<Esc>Olog.Fatalf(\"error: %s\\n\", err.Error())<Esc>jj"
|
||||
-- )
|
||||
|
||||
-- vim.keymap.set(
|
||||
-- "n",
|
||||
-- "<leader>el",
|
||||
-- "oif err != nil {<CR>}<Esc>O.logger.Error(\"error\", \"error\", err)<Esc>F.;i"
|
||||
-- )
|
||||
|
||||
-- vim.keymap.set("n", "<leader>ca", function()
|
||||
-- require("cellular-automaton").start_animation("make_it_rain")
|
||||
-- end)
|
||||
|
||||
-- vim.keymap.set("n", "<leader><leader>", function()
|
||||
-- vim.cmd("so")
|
||||
-- end)
|
||||
|
33
src_files/.config/nvim/lua/david_standard/settings.lua
Normal file
33
src_files/.config/nvim/lua/david_standard/settings.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- vim.opt.guicursor = ""
|
||||
|
||||
vim.opt.nu = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
-- vim.opt.tabstop = 4
|
||||
-- vim.opt.softtabstop = 4
|
||||
-- vim.opt.shiftwidth = 4
|
||||
-- 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 = "90"
|
Reference in New Issue
Block a user