Add nvim config
This commit is contained in:
parent
e46bd1cd99
commit
095953123c
1
nvim-collect.sh
Executable file
1
nvim-collect.sh
Executable file
@ -0,0 +1 @@
|
||||
cp -r ~/.config/nvim/* ./nvim
|
1
nvim-install.sh
Executable file
1
nvim-install.sh
Executable file
@ -0,0 +1 @@
|
||||
cp -r ./nvim/* ~/.config/nvim/
|
3
nvim/init.lua
Executable file
3
nvim/init.lua
Executable file
@ -0,0 +1,3 @@
|
||||
require("options")
|
||||
require("keybinds")
|
||||
require("lazy-conf")
|
54
nvim/lazy-lock.json
Executable file
54
nvim/lazy-lock.json
Executable file
@ -0,0 +1,54 @@
|
||||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||
"LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" },
|
||||
"bufdelete.nvim": { "branch": "master", "commit": "f6bcea78afb3060b198125256f897040538bcb81" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "5726c4e291224181903e960119a11e20ac677a0a" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"comment-box.nvim": { "branch": "main", "commit": "06bb771690bc9df0763d14769b779062d8f12bc5" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "fc78a3ca96f4db9f8893bb7e2fd9823e0780451b" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
|
||||
"hydra.nvim": { "branch": "main", "commit": "7f5341643107d05a8d7d4fdea00b29af28517380" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "259357fa4097e232730341fa60988087d189193a" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" },
|
||||
"lsp_lines.nvim": { "branch": "main", "commit": "7d9e2748b61bff6ebba6e30adbc7173ccf21c055" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "a700f1436d4a938b1a1a93c9962dc796afbaef4d" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
|
||||
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "8e46de9241d3997927af12196bd8faa0ed08c29a" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
"multicursors.nvim": { "branch": "main", "commit": "562809aaf203b4c65482a75199166d360f2b9298" },
|
||||
"nightfox.nvim": { "branch": "main", "commit": "7557f26defd093c4e9bc17f28b08403f706f5a44" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "58866c670d68ef80397c317a3a1ee5f53ca646fd" },
|
||||
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "ca4d3330d386e76967e53b85953c170658255ecb" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "4acf88d31b3a7a1a7f31e9c30bf2b23c6313abdb" },
|
||||
"nvim-dap": { "branch": "master", "commit": "0a0daa796a5919a51e5e5019ffa91219c94c4fef" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" },
|
||||
"nvim-jdtls": { "branch": "master", "commit": "ece818f909c6414cbad4e1fb240d87e003e10fda" },
|
||||
"nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
|
||||
"nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "6e385d2fe5da6714f00142afbd8d3591d330ffd7" },
|
||||
"nvim-navbuddy": { "branch": "master", "commit": "f22bac988f2dd073601d75ba39ea5636ab6e38cb" },
|
||||
"nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" },
|
||||
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
|
||||
"nvim-surround": { "branch": "main", "commit": "9f0cb495f25bff32c936062d85046fbda0c43517" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "c7639482a1598f4756798df1b2d72f79fe5bb34f" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "3edea87978b2ee93b197513e5cdf86012d33b7fa" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "920999bf53daa63ddf12efdeb5137a7cea1cc201" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "203da76ecfbb4b192cf830665b03eb651b635c94" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
||||
"startup.nvim": { "branch": "master", "commit": "9ca3b9a55f2f2196ef90b39a52029b46fdde5226" },
|
||||
"telescope-dap.nvim": { "branch": "master", "commit": "783366bd6c1e7fa0a5c59c07db37f49c805a28df" },
|
||||
"telescope-file-browser.nvim": { "branch": "master", "commit": "626998e5c1b71c130d8bc6cf7abb6709b98287bb" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "2eca9ba22002184ac05eddbe47a7fe2d5a384dfc" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "022ff5594acccc8d90d2e46dc43994f7722ebdf7" },
|
||||
"vimtex": { "branch": "master", "commit": "44a2f1203ce2b6fcf1ff2b03aeca52c45f8a157e" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "9b365a6428a9633e3eeb34dbef1b791511c54f70" },
|
||||
"zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" }
|
||||
}
|
122
nvim/lua/keybinds.lua
Executable file
122
nvim/lua/keybinds.lua
Executable file
@ -0,0 +1,122 @@
|
||||
local opts = require("utils").opts
|
||||
|
||||
local keymap = vim.keymap
|
||||
|
||||
-- write to file (sudo if readonly)
|
||||
if vim.g.vscode then
|
||||
keymap.set("n", "W", ":Write<CR>", opts("write file (vscode)"))
|
||||
else
|
||||
keymap.set("n", "W", ":w!<CR>", opts("write file"))
|
||||
keymap.set("n", "<leader>W", ":lua require('utils').sudo_write()<CR>", opts("sudo write file"))
|
||||
end
|
||||
|
||||
-- Handy VSCode Shortcuts
|
||||
-- Move lines up and down
|
||||
vim.api.nvim_set_keymap('n', '<A-Up>', ':m .-2<CR>==', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<A-Down>', ':m .+1<CR>==', { noremap = true, silent = true })
|
||||
|
||||
-- Move lines in insert mode
|
||||
vim.api.nvim_set_keymap('i', '<A-Up>', '<Esc>:m .-2<CR>i', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<A-Down>', '<Esc>:m .+1<CR>i', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<A-S-k>', '<Esc>:m .-2<CR>i', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<A-S-j>', '<Esc>:m .+1<CR>i', { noremap = true, silent = true })
|
||||
|
||||
-- Copy lines up and down in normal mode
|
||||
vim.api.nvim_set_keymap('n', '<C-A-S-Up>', ':t .-1<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<C-A-S-Down>', ':t .-1<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<C-A-S-k>', ':t .-1<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<C-A-S-j>', ':t .+1<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- Copy lines up and down in insert mode
|
||||
vim.api.nvim_set_keymap('i', '<C-A-S-Up>', '<Esc>:t.-1<CR>i', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<C-A-S-Down>', '<Esc>:t.<CR>i', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<C-A-S-k>', '<Esc>:t.-1<CR>i', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<C-A-S-j>', '<Esc>:t.<CR>i', { noremap = true, silent = true })
|
||||
|
||||
|
||||
|
||||
-- Save shortcut
|
||||
keymap.set("i", "<C-s>", "<Esc>:w<CR>a", opts("Save file (shortcut)"))
|
||||
keymap.set("n", "<C-s>", ":w<CR>", opts("Save file (shortcut)"))
|
||||
|
||||
-- Save and quit (sudo and no sudo)
|
||||
keymap.set("n", "E", ":wq!<CR>", opts("write and quit file"))
|
||||
keymap.set("n", "<leader>E", ":lua require('utils').sudo_write()<CR>:q!<CR>", opts("sudo write and quit file"))
|
||||
|
||||
-- Quite file
|
||||
keymap.set("n", "Q", ":q!<CR>", opts("quit file"))
|
||||
|
||||
-- Duplicate line
|
||||
keymap.set("n", "<leader>dd", ":t.<CR>", opts("Duplicate line"))
|
||||
|
||||
-- Editor focus
|
||||
keymap.set("n", "<C-b>", ":wincmd p<CR>", opts("Cycle focus"))
|
||||
|
||||
-- Key Mappings for LaTeX workflow
|
||||
keymap.set('n', '<leader>lc', ':VimtexCompile<CR>', opts("Compile latex document")) -- Compile LaTeX file
|
||||
keymap.set('n', '<leader>lv', ':VimtexView<CR>', opts("View compiled latex pdf")) -- View compiled PDF
|
||||
keymap.set('n', '<leader>lq', ':VimtexStop<CR>', opts("Stop Compiling document")) -- Stop compilation
|
||||
|
||||
-- Markdown-Preview
|
||||
keymap.set('n', '<leader><leader>m', ':MarkdownPreview<CR>', opts("Preview Markdown document in browser")) -- Stop compilation
|
||||
|
||||
-- window navigation
|
||||
keymap.set("n", "<A-h>", "<C-w>h", opts())
|
||||
keymap.set("n", "<A-j>", "<C-w>j", opts())
|
||||
keymap.set("n", "<A-k>", "<C-w>k", opts())
|
||||
keymap.set("n", "<A-l>", "<C-w>l", opts())
|
||||
|
||||
-- window resize
|
||||
keymap.set("n", "<A-C-h>", ":vertical resize -2<CR>", opts())
|
||||
keymap.set("n", "<A-C-j>", ":resize -2<CR>", opts())
|
||||
keymap.set("n", "<A-C-k>", ":resize +2<CR>", opts())
|
||||
keymap.set("n", "<A-C-l>", ":vertical resize +2<CR>", opts())
|
||||
|
||||
-- nohlsearch
|
||||
keymap.set("n", "<leader>h", ":nohlsearch<CR>", opts("remove search highlighting"))
|
||||
|
||||
-- run file
|
||||
keymap.set("n", "<leader>r", ":!%:p<CR>", opts("run current file"))
|
||||
keymap.set("n", "<leader><leader>r", ":!%:p", opts("run current file with arguments"))
|
||||
|
||||
-- chmod +x
|
||||
keymap.set("n", "<leader>m", ":!chmod +x %:p<CR>", opts("make current file executable"))
|
||||
|
||||
-- script setup
|
||||
keymap.set("n", "<leader>#", ":set syntax=sh<CR>:w<CR>:!chmod +x %:p<CR>:LspStart bashls<CR>i#!/bin/sh<CR><CR>", opts("setup sh script"))
|
||||
keymap.set("n", "<leader><leader>#", ":set syntax=python<CR>:w<CR>:!chmod +x %:p<CR>:LspStart pyright<CR>i#!/usr/bin/env python3<CR><CR>", opts("setup python script"))
|
||||
|
||||
-- CTRL + Backspace
|
||||
keymap.set("i", "<C-BackSpace>", "<C-w>", opts())
|
||||
|
||||
-- select all
|
||||
keymap.set("n", "<leader>a", "ggVG", opts("select all"))
|
||||
|
||||
-- move cursor in insert mode
|
||||
keymap.set("i", "<C-h>", "<Left>", opts())
|
||||
keymap.set("i", "<C-j>", "<Down>", opts())
|
||||
keymap.set("i", "<C-k>", "<Up>", opts())
|
||||
keymap.set("i", "<C-l>", "<Right>", opts())
|
||||
|
||||
-- open in neovide
|
||||
-- keymap.set("n", "<leader>n", ":!neovide --no-fork %:p<CR>", opts("open in neovide (wip)"))
|
||||
|
||||
-- deleting doesn't yank except when used with <leader>
|
||||
keymap.set({ "n", "v" }, "d", '"_d', opts())
|
||||
keymap.set({ "n", "v" }, "D", '"_D', opts())
|
||||
keymap.set({ "n", "v" }, "x", '"_x', opts())
|
||||
keymap.set({ "n", "v" }, "X", '"_X', opts())
|
||||
keymap.set({ "n", "v" }, "c", '"_c', opts())
|
||||
keymap.set({ "n", "v" }, "C", '"_C', opts())
|
||||
keymap.set({ "n", "v" }, "<leader>d", "d", opts("yank and delete"))
|
||||
keymap.set({ "n", "v" }, "<leader>D", "D", opts("YANK and DELETE to end"))
|
||||
|
||||
-- <leader> + yank/paste/delete uses system clipboard
|
||||
keymap.set({ "n", "v" }, "<leader>y", '"+y', opts("yank to system clipboard"))
|
||||
keymap.set({ "n", "v" }, "<leader>Y", '"+y$', opts("YANK to system clipboard"))
|
||||
keymap.set({ "n", "v" }, "<leader>p", '"+p', opts("paste from system clipboard"))
|
||||
keymap.set({ "n", "v" }, "<leader>P", '"+P', opts("PASTE from system clipboard"))
|
||||
keymap.set({ "n", "v" }, "<leader><leader>d", '"+d', opts("yank to system clipboard and delete"))
|
||||
keymap.set({ "n", "v" }, "<leader><leader>D", '"+D', opts("YANK to system clipboard and DELETE"))
|
||||
|
||||
keymap.set("n", "<leader>wk", ":WhichKey<CR>", opts("Toggle WhichKey"))
|
19
nvim/lua/lazy-conf.lua
Executable file
19
nvim/lua/lazy-conf.lua
Executable file
@ -0,0 +1,19 @@
|
||||
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)
|
||||
|
||||
|
||||
require("lazy").setup("plugins", {
|
||||
change_detection = {
|
||||
notify = false, -- dont notify when plugins are changed
|
||||
}
|
||||
})
|
36
nvim/lua/options.lua
Executable file
36
nvim/lua/options.lua
Executable file
@ -0,0 +1,36 @@
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
vim.opt.backspace = "2"
|
||||
|
||||
-- title
|
||||
vim.opt.title = true
|
||||
vim.opt.titlestring = "nvim - %f"
|
||||
|
||||
-- indentation
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.shiftround = true
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.breakindent = true
|
||||
vim.opt.linebreak = true
|
||||
|
||||
-- line numbers
|
||||
vim.wo.number = true
|
||||
vim.wo.cursorline = true
|
||||
vim.wo.relativenumber = true
|
||||
vim.opt.signcolumn = "yes" -- reserve space for diagnostics
|
||||
|
||||
-- search options
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
|
||||
-- swap and undo directories
|
||||
vim.opt.undofile = true
|
||||
vim.opt.undodir = vim.fn.expand("~/.cache/vim/undodir")
|
||||
vim.opt.directory = vim.fn.expand("~/.cache/vim/swapfiles")
|
||||
|
||||
-- add hyprlang filetype
|
||||
vim.filetype.add({
|
||||
pattern = { [".*/hypr.*%.conf"] = "hyprlang" },
|
||||
})
|
65
nvim/lua/plugins/autopairs.lua
Executable file
65
nvim/lua/plugins/autopairs.lua
Executable file
@ -0,0 +1,65 @@
|
||||
return {
|
||||
-- autoclose brackets and quotes
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup({
|
||||
fast_wrap = {
|
||||
map = "<C-e>",
|
||||
chars = { "{", "[", "(", '"', "'", "`" },
|
||||
},
|
||||
})
|
||||
|
||||
-- add spaces between parentheses
|
||||
local npairs = require("nvim-autopairs")
|
||||
local Rule = require("nvim-autopairs.rule")
|
||||
local cond = require("nvim-autopairs.conds")
|
||||
|
||||
local brackets = { { "(", ")" }, { "[", "]" }, { "{", "}" } }
|
||||
npairs.add_rules({
|
||||
-- Rule for a pair with left-side ' ' and right side ' '
|
||||
Rule(" ", " ")
|
||||
-- Pair will only occur if the conditional function returns true
|
||||
:with_pair(function(opts)
|
||||
-- We are checking if we are inserting a space in (), [], or {}
|
||||
local pair = opts.line:sub(opts.col - 1, opts.col)
|
||||
return vim.tbl_contains({
|
||||
brackets[1][1] .. brackets[1][2],
|
||||
brackets[2][1] .. brackets[2][2],
|
||||
brackets[3][1] .. brackets[3][2],
|
||||
}, pair)
|
||||
end)
|
||||
:with_move(cond.none())
|
||||
:with_cr(cond.none())
|
||||
-- We only want to delete the pair of spaces when the cursor is as such: ( | )
|
||||
:with_del(
|
||||
function(opts)
|
||||
local col = vim.api.nvim_win_get_cursor(0)[2]
|
||||
local context = opts.line:sub(col - 1, col + 2)
|
||||
return vim.tbl_contains({
|
||||
brackets[1][1] .. " " .. brackets[1][2],
|
||||
brackets[2][1] .. " " .. brackets[2][2],
|
||||
brackets[3][1] .. " " .. brackets[3][2],
|
||||
}, context)
|
||||
end
|
||||
),
|
||||
})
|
||||
-- For each pair of brackets we will add another rule
|
||||
for _, bracket in pairs(brackets) do
|
||||
npairs.add_rules({
|
||||
-- Each of these rules is for a pair with left-side '( ' and right-side ' )' for each bracket type
|
||||
Rule(bracket[1] .. " ", " " .. bracket[2])
|
||||
:with_pair(cond.none())
|
||||
:with_move(function(opts)
|
||||
return opts.char == bracket[2]
|
||||
end)
|
||||
:with_del(cond.none())
|
||||
:use_key(bracket[2])
|
||||
-- Removes the trailing whitespace that can occur without this
|
||||
:replace_map_cr(function(_)
|
||||
return "<C-c>2xi<CR><C-c>O"
|
||||
end),
|
||||
})
|
||||
end
|
||||
end,
|
||||
}
|
9
nvim/lua/plugins/bufdelete.lua
Executable file
9
nvim/lua/plugins/bufdelete.lua
Executable file
@ -0,0 +1,9 @@
|
||||
return {
|
||||
-- delete a buffer
|
||||
'famiu/bufdelete.nvim',
|
||||
config = function()
|
||||
local map = vim.api.nvim_set_keymap
|
||||
map('n', '<C-w>', '<cmd>Bdelete<CR>', { silent = true, desc = "close current buffer" })
|
||||
end
|
||||
}
|
||||
|
64
nvim/lua/plugins/bufferline.lua
Executable file
64
nvim/lua/plugins/bufferline.lua
Executable file
@ -0,0 +1,64 @@
|
||||
return {
|
||||
-- tab line
|
||||
"akinsho/bufferline.nvim",
|
||||
version = "*",
|
||||
dependencies = "nvim-tree/nvim-web-devicons",
|
||||
config = function()
|
||||
local bufferline = require("bufferline")
|
||||
bufferline.setup({
|
||||
options = {
|
||||
mode = "buffers",
|
||||
show_buffer_close_icons = false,
|
||||
middle_mouse_command = "bdelete! %d",
|
||||
indicator = { style = "underline" },
|
||||
offsets = {
|
||||
{
|
||||
filetype = "NvimTree",
|
||||
text = " ",
|
||||
text_align = "center",
|
||||
separator = true,
|
||||
},
|
||||
},
|
||||
|
||||
separator_style = { " ", " " },
|
||||
diagnostics = "nvim_lsp",
|
||||
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||
local icon = level:match("error") and " " or " "
|
||||
return icon .. count
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
local opts = { silent = true }
|
||||
-- go to buffer
|
||||
opts.desc = "go to buffer 1"
|
||||
vim.keymap.set("n", "g1", "<Cmd>BufferLineGoToBuffer 1<CR>", opts)
|
||||
opts.desc = "go to buffer 2"
|
||||
vim.keymap.set("n", "g2", "<Cmd>BufferLineGoToBuffer 2<CR>", opts)
|
||||
opts.desc = "go to buffer 3"
|
||||
vim.keymap.set("n", "g3", "<Cmd>BufferLineGoToBuffer 3<CR>", opts)
|
||||
opts.desc = "go to buffer 4"
|
||||
vim.keymap.set("n", "g4", "<Cmd>BufferLineGoToBuffer 4<CR>", opts)
|
||||
opts.desc = "go to buffer 5"
|
||||
vim.keymap.set("n", "g5", "<Cmd>BufferLineGoToBuffer 5<CR>", opts)
|
||||
opts.desc = "go to buffer 6"
|
||||
vim.keymap.set("n", "g6", "<Cmd>BufferLineGoToBuffer 6<CR>", opts)
|
||||
opts.desc = "go to buffer 7"
|
||||
vim.keymap.set("n", "g7", "<Cmd>BufferLineGoToBuffer 7<CR>", opts)
|
||||
opts.desc = "go to buffer 8"
|
||||
vim.keymap.set("n", "g8", "<Cmd>BufferLineGoToBuffer 8<CR>", opts)
|
||||
opts.desc = "go to buffer 9"
|
||||
vim.keymap.set("n", "g9", "<Cmd>BufferLineGoToBuffer 9<CR>", opts)
|
||||
opts.desc = "go to buffer 10"
|
||||
vim.keymap.set("n", "g0", "<Cmd>BufferLineGoToBuffer 10<CR>", opts)
|
||||
opts.desc = nil
|
||||
-- cycle between buffers
|
||||
vim.keymap.set("n", "J", "<cmd>BufferLineCyclePrev<CR>", opts)
|
||||
vim.keymap.set("n", "K", "<cmd>BufferLineCycleNext<CR>", opts)
|
||||
-- move buffers
|
||||
vim.keymap.set("n", "<C-S-J>", "<cmd>BufferLineMovePrev<CR>", opts)
|
||||
vim.keymap.set("n", "<C-S-K>", "<cmd>BufferLineMoveNext<CR>", opts)
|
||||
-- go to previous buffer
|
||||
vim.keymap.set({ "n", "i" }, "<C-Tab>", "<cmd>b#<CR>", opts)
|
||||
end,
|
||||
}
|
106
nvim/lua/plugins/cmp.lua
Executable file
106
nvim/lua/plugins/cmp.lua
Executable file
@ -0,0 +1,106 @@
|
||||
return {
|
||||
-- competion
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer", -- source for text in buffer
|
||||
"hrsh7th/cmp-path", -- source for file system paths
|
||||
"L3MON4D3/LuaSnip", -- snippet engine
|
||||
"saadparwaiz1/cmp_luasnip", -- for autocompletion
|
||||
"rafamadriz/friendly-snippets", -- useful snippets
|
||||
"onsails/lspkind.nvim", -- icons for cmp
|
||||
},
|
||||
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local lspkind = require("lspkind")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_vscode").lazy_load({paths = "~/projects/dotfiles/config/.config/VSCodium/User/snippets"})
|
||||
|
||||
luasnip.filetype_extend("htmldjango", { "html" })
|
||||
|
||||
cmp.setup({
|
||||
completion = {
|
||||
completeopt = "menu,menuone,preview,noselect",
|
||||
},
|
||||
|
||||
window = {
|
||||
documentation = cmp.config.window.bordered(),
|
||||
completion = cmp.config.window.bordered({
|
||||
winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None",
|
||||
}),
|
||||
},
|
||||
|
||||
snippet = { -- configure how nvim-cmp interacts with snippet engine
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.ConfirmBehavior.Select }), -- next suggestion
|
||||
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.ConfirmBehavior.Select }), -- prev suggestion
|
||||
["<C-S-J>"] = cmp.mapping.scroll_docs(4, { behavior = cmp.ConfirmBehavior.Select }), -- docs forward
|
||||
["<C-S-K>"] = cmp.mapping.scroll_docs(-4, { behavior = cmp.ConfirmBehavior.Select }), -- docs back
|
||||
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||
["<C-q>"] = cmp.mapping.abort(), -- close completion window
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }), -- autocomplete if selected
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
require("luasnip").expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if require("luasnip").jumpable(-1) then
|
||||
require("luasnip").jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
|
||||
-- sources for autocompletion
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" }, -- lsp
|
||||
{ name = "luasnip" }, -- snippets
|
||||
{ name = "buffer" }, -- text within current buffer
|
||||
{ name = "path" }, -- file system paths
|
||||
}),
|
||||
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = lspkind.cmp_format({
|
||||
mode = "symbol", -- show only symbol annotations
|
||||
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
||||
-- can also be a function to dynamically calculate max width such as
|
||||
-- maxwidth = function() return math.floor(0.45 * vim.o.columns) end,
|
||||
ellipsis_char = "…", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
|
||||
show_labelDetails = true, -- show labelDetails in menu. Disabled by default
|
||||
|
||||
-- The function below will be called before any actual modifications from lspkind
|
||||
-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
|
||||
before = function(entry, vim_item)
|
||||
return vim_item
|
||||
end,
|
||||
}),
|
||||
},
|
||||
})
|
||||
|
||||
local opts = { silent = true }
|
||||
opts.desc = "next snippet placeholder"
|
||||
vim.keymap.set({ "i", "s" }, "<C-w>", function()
|
||||
luasnip.jump(1)
|
||||
end, opts)
|
||||
opts.desc = "previous snippet placeholder"
|
||||
vim.keymap.set({ "i", "s" }, "<C-b>", function()
|
||||
luasnip.jump(-1)
|
||||
end, opts)
|
||||
end,
|
||||
}
|
34
nvim/lua/plugins/colorizer.lua
Executable file
34
nvim/lua/plugins/colorizer.lua
Executable file
@ -0,0 +1,34 @@
|
||||
return {
|
||||
-- colorizes colors in code
|
||||
'NvChad/nvim-colorizer.lua' ,
|
||||
--cmd = 'ColorizerToggle',
|
||||
config = function ()
|
||||
require("colorizer").setup {
|
||||
filetypes = { "*" },
|
||||
user_default_options = {
|
||||
RGB = true, -- #RGB hex codes - #FCE
|
||||
RRGGBB = true, -- #RRGGBB hex codes - #F5C2E7
|
||||
names = true, -- "Name" codes - lightpink
|
||||
RRGGBBAA = true, -- #RRGGBBAA hex codes - #F5C2E7CC
|
||||
AARRGGBB = true, -- 0xAARRGGBB hex codes - 0xCCF5C2E7
|
||||
rgb_fn = true, -- CSS rgb() and rgba() functions - rgba(245,194,231,0.8)
|
||||
hsl_fn = true, -- CSS hsl() and hsla() functions - hsl(0.88,0.72,0.86)
|
||||
css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
||||
css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
||||
-- Available modes for `mode`: foreground, background, virtualtext
|
||||
mode = "background", -- Set the display mode.
|
||||
-- Available methods are false / true / "normal" / "lsp" / "both"
|
||||
-- True is same as normal
|
||||
tailwind = false, -- Enable tailwind colors
|
||||
-- parsers can contain values used in |user_default_options|
|
||||
sass = { enable = false, parsers = { "css" }, }, -- Enable sass colors
|
||||
virtualtext = "■",
|
||||
-- update color values even if buffer is not focused
|
||||
-- example use: cmp_menu, cmp_docs
|
||||
always_update = false
|
||||
},
|
||||
-- all the sub-options of filetypes apply to buftypes
|
||||
buftypes = {},
|
||||
}
|
||||
end,
|
||||
}
|
112
nvim/lua/plugins/colors.lua
Executable file
112
nvim/lua/plugins/colors.lua
Executable file
@ -0,0 +1,112 @@
|
||||
return {
|
||||
-- color theme
|
||||
"EdenEast/nightfox.nvim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
-- local Shade = require("nightfox.lib.shade")
|
||||
require("nightfox").setup({
|
||||
options = {
|
||||
transparent = true,
|
||||
},
|
||||
specs = {
|
||||
carbonfox = {
|
||||
comment = { fg = "#070707", italic = true },
|
||||
}
|
||||
},
|
||||
groups = {
|
||||
carbonfox = {
|
||||
bracket = { fg = "#FFFFFF" },
|
||||
builtin0 = { fg = "" },
|
||||
builtin1 = { fg = "" },
|
||||
builtin2 = { fg = "" },
|
||||
|
||||
keyword = { fg = "#8b009d", italic = true },
|
||||
|
||||
}
|
||||
},
|
||||
})
|
||||
-- palettes = {
|
||||
-- all = {
|
||||
-- black = Shade.new("#404944", 0.15, -0.15),
|
||||
-- white = Shade.new("#dee4df", 0.15, -0.15),
|
||||
-- red = Shade.new("#ffb4a9", 0.15, -0.15),
|
||||
-- orange = Shade.new("#e3c46d", 0.15, -0.15),
|
||||
-- green = Shade.new("#a3d397", 0.10, -0.15),
|
||||
-- darkgreen = Shade.new("#005602", 0.10, -0.15),
|
||||
-- yellow = Shade.new("#e3c46d", 0.15, -0.15),
|
||||
-- blue = Shade.new("#b7c4ff", 0.15, -0.15),
|
||||
-- magenta = Shade.new("#f5b2e2", 0.30, -0.15),
|
||||
-- pink = Shade.new("#f5b2e2", 0.15, -0.15),
|
||||
-- purple = Shade.new("#761464", 0.15, -0.15),
|
||||
-- cyan = Shade.new("#8ad6b6", 0.15, -0.15),
|
||||
-- lightblue = Shade.new("#5c77ff", 0.15, -0.15),
|
||||
--
|
||||
-- bg0 = "#0f1512", -- Dark bg (status line and float)
|
||||
-- bg1 = "#0f1512", -- Default bg
|
||||
-- bg2 = "#1b211e", -- Lighter bg (colorcolm folds)
|
||||
-- bg3 = "#252b28", -- Lighter bg (cursor line)
|
||||
-- bg4 = "#303633", -- Conceal, border fg
|
||||
--
|
||||
-- fg0 = "#dee4df", -- Lighter fg
|
||||
-- fg1 = "#dee4df", -- Default fg
|
||||
-- fg2 = "#dee4df", -- Darker fg (status line)
|
||||
-- fg3 = "#89938d", -- Darker fg (line numbers, fold colums)
|
||||
--
|
||||
-- sel0 = "#404944", -- Popup bg, visual selection
|
||||
-- sel1 = "#00513b", -- Popup sel bg, search bg
|
||||
--
|
||||
-- comment = "#89938d",
|
||||
-- },
|
||||
-- },
|
||||
-- groups = {
|
||||
-- all = {
|
||||
-- Cursor = { fg = "palette.white", bg = "palette.lightblue" }, -- character under the cursor
|
||||
-- WinSeparator = { fg = "palette.bg2" }, -- the column separating vertically split windows
|
||||
-- EndOfBuffer = { link = "WinSeparator" }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|.
|
||||
-- CursorLine = { bg = "palette.bg1" },
|
||||
-- CursorLineNr = { fg = "palette.lightblue", style = "bold" }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line.
|
||||
-- Search = { fg = "palette.lightblue", bg = "#00513b" }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out.
|
||||
-- IncSearch = { fg = "palette.lightblue", bg = "#1a6b51" }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c"
|
||||
-- ModeMsg = { fg = "palette.bg3", style = "bold" }, -- 'showmode' message (e.g., "-- INSERT --")
|
||||
--
|
||||
-- NvimTreeRootFolder = { fg = "palette.lightblue", style = "bold" },
|
||||
-- NvimTreeFolderName = { fg = "palette.lightblue" },
|
||||
-- NvimTreeFolderIcon = { fg = "palette.lightblue" },
|
||||
-- NvimTreeOpenedFolderName = { fg = "palette.lightblue" },
|
||||
-- NvimTreeSymlinkFolderName = { fg = "palette.magenta" },
|
||||
--
|
||||
-- NvimTreeExecFile = { fg = "palette.red" },
|
||||
-- NvimTreeImageFile = { fg = "palette.white" },
|
||||
-- NvimTreeSpecialFile = { fg = "palette.yellow" },
|
||||
-- NvimTreeSymlink = { fg = "palette.magenta" },
|
||||
-- },
|
||||
-- },
|
||||
-- spec = {
|
||||
-- syntax = {
|
||||
-- bracket = "palette.white",
|
||||
-- builtin0 = "palette.cyan",
|
||||
-- builtin1 = "palette.green",
|
||||
-- builtin2 = "palette.green",
|
||||
-- comment = { fg = "palette.comment", style = "italic" },
|
||||
-- conditional = "palette.pink",
|
||||
-- const = "palette.blue",
|
||||
-- dep = { fg = "palette.black", style = "strikethrough" },
|
||||
-- field = "palette.green",
|
||||
-- func = { fg ="palette.magenta", style = "italic" },
|
||||
-- ident = "palette.cyan",
|
||||
-- keywords = { fg = "palette.magenta", style = "italic" },
|
||||
-- number = "palette.purple",
|
||||
-- operator = "palette.white",
|
||||
-- preproc = "palette.black",
|
||||
-- regex = "palette.yellow",
|
||||
-- statement = "palette.darkgreen",
|
||||
-- string = "",
|
||||
-- }
|
||||
-- }
|
||||
-- })
|
||||
if not vim.g.vscode then
|
||||
vim.cmd([[colorscheme carbonfox]])
|
||||
end
|
||||
end,
|
||||
}
|
61
nvim/lua/plugins/comment-box.lua
Executable file
61
nvim/lua/plugins/comment-box.lua
Executable file
@ -0,0 +1,61 @@
|
||||
return {
|
||||
"LudoPinelli/comment-box.nvim",
|
||||
config = function()
|
||||
-- add custom commentstring to plugin source, since configuration is not yet supported
|
||||
local function insertlang(lang, commentstring)
|
||||
local filename = os.getenv("HOME")
|
||||
.. "/.local/share/nvim/lazy/comment-box.nvim/lua/comment-box/commentstrings.lua"
|
||||
local file = io.open(filename, "r")
|
||||
if not file then
|
||||
return
|
||||
end
|
||||
|
||||
local content = file:read("a")
|
||||
if string.match(content, lang) then
|
||||
return
|
||||
end
|
||||
|
||||
local lines = {}
|
||||
for line in content:gmatch("[^\r\n]+") do
|
||||
table.insert(lines, line)
|
||||
end
|
||||
file:close()
|
||||
|
||||
table.insert(lines, 24, " " .. lang .. ' = { "' .. commentstring .. '", "" },')
|
||||
|
||||
file = io.open(filename, "w")
|
||||
if not file then
|
||||
return
|
||||
end
|
||||
|
||||
file:write(table.concat(lines, "\n"))
|
||||
|
||||
file:close()
|
||||
end
|
||||
|
||||
insertlang("hyprlang", "#%s")
|
||||
|
||||
require("comment-box").setup({
|
||||
comment_style = "line",
|
||||
doc_width = 70,
|
||||
box_width = 50,
|
||||
line_width = 70,
|
||||
})
|
||||
|
||||
local opts = { silent = true }
|
||||
|
||||
opts.desc = "comment text box"
|
||||
vim.keymap.set({"n", "v"}, "<leader>cb", ":CBccbox<CR>", opts)
|
||||
opts.desc = "comment text line"
|
||||
vim.keymap.set({"n", "v"}, "<leader>cl", ":CBllline<CR>", opts)
|
||||
opts.desc = "comment line"
|
||||
vim.keymap.set({"n", "v"}, "<leader>ce", ":CBline<CR>", opts)
|
||||
opts.desc = "comment highlight"
|
||||
vim.keymap.set({"n", "v"}, "<leader>ch", ":CBlcbox18<CR>", opts)
|
||||
|
||||
opts.desc = "delete comment box"
|
||||
vim.keymap.set({"n", "v"}, "<leader>cd", ":CBd<CR>", opts)
|
||||
opts.desc = "yank comment box contents"
|
||||
vim.keymap.set({"n", "v"}, "<leader>cy", ":CBy<CR>", opts)
|
||||
end,
|
||||
}
|
10
nvim/lua/plugins/comment.lua
Executable file
10
nvim/lua/plugins/comment.lua
Executable file
@ -0,0 +1,10 @@
|
||||
return {
|
||||
-- add comment keybinds
|
||||
'numToStr/Comment.nvim',
|
||||
opts = {},
|
||||
lazy = false,
|
||||
config = function()
|
||||
require('Comment').setup()
|
||||
require('Comment.ft').set('hyprlang', '#%s')
|
||||
end
|
||||
}
|
4
nvim/lua/plugins/context.lua
Executable file
4
nvim/lua/plugins/context.lua
Executable file
@ -0,0 +1,4 @@
|
||||
return {
|
||||
-- similar to sticky scroll in vscode
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
}
|
103
nvim/lua/plugins/dap.lua
Executable file
103
nvim/lua/plugins/dap.lua
Executable file
@ -0,0 +1,103 @@
|
||||
return {
|
||||
"mfussenegger/nvim-dap",
|
||||
dependencies = {
|
||||
{ "nvim-neotest/nvim-nio" },
|
||||
{ "rcarriga/nvim-dap-ui" },
|
||||
{ "theHamsta/nvim-dap-virtual-text" },
|
||||
{ "nvim-telescope/telescope-dap.nvim" },
|
||||
},
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "<leader>bR", function() require("dap").run_to_cursor() end, desc = "Run to Cursor", },
|
||||
{ "<leader>bE", function() require("dapui").eval(vim.fn.input "[Expression] > ") end, desc = "Evaluate Input", },
|
||||
{ "<leader>bC", function() require("dap").set_breakpoint(vim.fn.input "[Condition] > ") end, desc = "Conditional Breakpoint", },
|
||||
{ "<leader>bU", function() require("dapui").toggle() end, desc = "Toggle UI", },
|
||||
{ "<leader>bb", function() require("dap").step_back() end, desc = "Step Back", },
|
||||
{ "<leader>bc", function() require("dap").continue() end, desc = "Continue", },
|
||||
{ "<leader>bd", function() require("dap").disconnect() end, desc = "Disconnect", },
|
||||
{ "<leader>be", function() require("dapui").eval() end, desc = "Evaluate", },
|
||||
{ "<leader>bg", function() require("dap").session() end, desc = "Get Session", },
|
||||
{ "<leader>bh", function() require("dap.ui.widgets").hover() end, desc = "Hover Variables", },
|
||||
{ "<leader>bS", function() require("dap.ui.widgets").scopes() end, desc = "Scopes", },
|
||||
{ "<leader>bi", function() require("dap").step_into() end, desc = "Step Into", },
|
||||
{ "<leader>bo", function() require("dap").step_over() end, desc = "Step Over", },
|
||||
{ "<leader>bp", function() require("dap").pause.toggle() end, desc = "Pause", },
|
||||
{ "<leader>bq", function() require("dap").close() end, desc = "Quit", },
|
||||
{ "<leader>br", function() require("dap").repl.toggle() end, desc = "Toggle REPL", },
|
||||
{ "<leader>bs", function() require("dap").continue() end, desc = "Start", },
|
||||
{ "<leader>bt", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint", },
|
||||
{ "<leader>bx", function() require("dap").terminate() end, desc = "Terminate", },
|
||||
{ "<leader>bu", function() require("dap").step_out() end, desc = "Step Out", },
|
||||
},
|
||||
config = function()
|
||||
require("nvim-dap-virtual-text").setup({
|
||||
commented = true,
|
||||
})
|
||||
|
||||
local dap, dapui = require("dap"), require("dapui")
|
||||
dapui.setup({})
|
||||
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
|
||||
vim.fn.sign_define("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = ""})
|
||||
vim.fn.sign_define("DapBreakpointCondition", { text = "●", texthl = "DapBreakpointCondition", linehl = "", numhl = ""})
|
||||
vim.fn.sign_define("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl = ""})
|
||||
vim.fn.sign_define('DapStopped', { text='', texthl='DapStopped', linehl='DapStopped', numhl= 'DapStopped' })
|
||||
|
||||
dap.configurations.python = {
|
||||
{
|
||||
type = "python",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
|
||||
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
|
||||
|
||||
program = "${file}", -- This configuration will launch the current file if used.
|
||||
pythonPath = function()
|
||||
local cwd = vim.fn.getcwd()
|
||||
if vim.fn.executable(cwd .. "/venv/bin/python") == 1 then
|
||||
return cwd .. "/venv/bin/python"
|
||||
elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then
|
||||
return cwd .. "/.venv/bin/python"
|
||||
else
|
||||
return "/usr/bin/python"
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
dap.adapters.python = function(cb, config)
|
||||
if config.request == "attach" then
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local port = (config.connect or config).port
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local host = (config.connect or config).host or "127.0.0.1"
|
||||
cb({
|
||||
type = "server",
|
||||
port = assert(port, "`connect.port` is required for a python `attach` configuration"),
|
||||
host = host,
|
||||
options = {
|
||||
source_filetype = "python",
|
||||
},
|
||||
})
|
||||
else
|
||||
cb({
|
||||
type = "executable",
|
||||
command = vim.fn.stdpath("data") .. '/mason/packages/debugpy/venv/bin/python',
|
||||
args = { "-m", "debugpy.adapter" },
|
||||
options = {
|
||||
source_filetype = "python",
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
5
nvim/lua/plugins/dressing.lua
Executable file
5
nvim/lua/plugins/dressing.lua
Executable file
@ -0,0 +1,5 @@
|
||||
return {
|
||||
-- prettier prompts
|
||||
'stevearc/dressing.nvim',
|
||||
event = 'VeryLazy',
|
||||
}
|
14
nvim/lua/plugins/fidget.lua
Executable file
14
nvim/lua/plugins/fidget.lua
Executable file
@ -0,0 +1,14 @@
|
||||
return {
|
||||
-- notifications && lsp progress msgs
|
||||
"j-hui/fidget.nvim",
|
||||
config = function()
|
||||
require("fidget").setup({
|
||||
notification = {
|
||||
window = {
|
||||
winblend = 0,
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
}
|
9
nvim/lua/plugins/indent-blankline.lua
Executable file
9
nvim/lua/plugins/indent-blankline.lua
Executable file
@ -0,0 +1,9 @@
|
||||
return {
|
||||
-- indent lines
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
opts = {},
|
||||
main = 'ibl',
|
||||
config = function()
|
||||
require('ibl').setup()
|
||||
end
|
||||
}
|
7
nvim/lua/plugins/lastplace.lua
Executable file
7
nvim/lua/plugins/lastplace.lua
Executable file
@ -0,0 +1,7 @@
|
||||
return {
|
||||
-- open file at previous position
|
||||
'ethanholz/nvim-lastplace',
|
||||
config = function()
|
||||
require('nvim-lastplace').setup{}
|
||||
end,
|
||||
}
|
16
nvim/lua/plugins/lsp-lines.lua
Executable file
16
nvim/lua/plugins/lsp-lines.lua
Executable file
@ -0,0 +1,16 @@
|
||||
return {
|
||||
---------- for lsp diagnostic lines ----------
|
||||
"https://git.sr.ht/~whynothugo/lsp_lines.nvim",
|
||||
event = "LspAttach",
|
||||
config = function()
|
||||
require("lsp_lines").setup()
|
||||
vim.diagnostic.config({ virtual_lines = false })
|
||||
|
||||
local lsplines = false
|
||||
vim.keymap.set("n", "<Leader>L", function ()
|
||||
lsplines = not lsplines
|
||||
vim.diagnostic.config({ virtual_text = not lsplines })
|
||||
vim.diagnostic.config({ virtual_lines = lsplines })
|
||||
end, { desc = "Toggle lsp_lines" })
|
||||
end,
|
||||
}
|
148
nvim/lua/plugins/lspconfig.lua
Executable file
148
nvim/lua/plugins/lspconfig.lua
Executable file
@ -0,0 +1,148 @@
|
||||
return {
|
||||
-- lsp configuration
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
{ "antosha417/nvim-lsp-file-operations", config = true },
|
||||
"mfussenegger/nvim-jdtls",
|
||||
},
|
||||
config = function()
|
||||
-- import lspconfig plugin
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
-- import cmp-nvim-lsp plugin
|
||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
|
||||
local keymap = vim.keymap
|
||||
|
||||
local opts = { silent = true }
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
opts.buffer = bufnr
|
||||
|
||||
-- set keybinds
|
||||
opts.desc = "Show LSP references"
|
||||
keymap.set("n", "gR", "<cmd>Telescope lsp_references<CR>", opts)
|
||||
|
||||
opts.desc = "Go to declaration"
|
||||
keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||
|
||||
opts.desc = "Show LSP definitions"
|
||||
keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
|
||||
|
||||
opts.desc = "Show LSP implementations"
|
||||
keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts)
|
||||
|
||||
opts.desc = "Show LSP type definitions"
|
||||
keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts)
|
||||
|
||||
opts.desc = "See available code actions"
|
||||
keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts)
|
||||
|
||||
opts.desc = "Format current file"
|
||||
keymap.set("n", "<leader>gf", vim.lsp.buf.format, opts)
|
||||
|
||||
opts.desc = "Smart rename"
|
||||
keymap.set("n", "<leader>n", vim.lsp.buf.rename, opts)
|
||||
|
||||
opts.desc = "Show buffer diagnostics"
|
||||
keymap.set("n", "ga", "<cmd>Telescope diagnostics bufnr=0<CR>", opts)
|
||||
|
||||
opts.desc = "Show line diagnostics"
|
||||
keymap.set("n", "gA", vim.diagnostic.open_float, opts)
|
||||
|
||||
opts.desc = "Go to previous diagnostic"
|
||||
keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
|
||||
|
||||
opts.desc = "Go to next diagnostic"
|
||||
keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
|
||||
|
||||
opts.desc = "Show documentation for what is under cursor"
|
||||
keymap.set("n", "<leader>k", vim.lsp.buf.hover, opts)
|
||||
|
||||
opts.desc = "Restart LSP"
|
||||
keymap.set("n", "<leader>rs", ":LspRestart<CR>", opts)
|
||||
|
||||
vim.opt.signcolumn = "yes" -- reserve space for diagnostics
|
||||
end
|
||||
|
||||
-- used to enable autocompletion (assign to every lsp server config)
|
||||
-- local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
-- Change the Diagnostic symbols in the sign column (gutter)
|
||||
local signs = { Error = " ", Warn = " ", Hint = "", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
|
||||
lspconfig.bashls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig.clangd.setup({
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--suggest-missing-includes",
|
||||
"--clang-tidy",
|
||||
},
|
||||
filetypes = { "c", "cpp", "objc", "objcpp", "cuda", "proto", "ino" },
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig.cssls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig.lua_ls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
Lua = {
|
||||
-- make the language server recognize "vim" global
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- make language server aware of runtime files
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lspconfig.pyright.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig.ts_ls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- done in ftplugin
|
||||
lspconfig.jdtls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig.texlab.setup{
|
||||
cmd = { "texlab" },
|
||||
filetypes = { "tex", "latex", "bib" },
|
||||
root_dir = function(fname)
|
||||
return vim.loop.cwd()
|
||||
end,
|
||||
}
|
||||
|
||||
end,
|
||||
}
|
55
nvim/lua/plugins/lualine.lua
Executable file
55
nvim/lua/plugins/lualine.lua
Executable file
@ -0,0 +1,55 @@
|
||||
return {
|
||||
-- status line
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
config = function()
|
||||
local function getWords()
|
||||
local wc = vim.api.nvim_eval("wordcount()")
|
||||
if wc["visual_words"] then
|
||||
return wc["visual_words"]
|
||||
else
|
||||
return wc["words"]
|
||||
end
|
||||
end
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "auto",
|
||||
component_separators = { left = '', right = ''},
|
||||
section_separators = { left = '', right = ''},
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = { 'NvimTree' },
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { { 'mode', separator = { left = '', right = '' }, } },
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = { getWords, 'encoding', 'fileformat', 'filetype'},
|
||||
lualine_y = { { 'progress', left_padding=0 } },
|
||||
lualine_z = { { 'location', separator = { left = '', right = '' }, padding=0} }
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'location'},
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {}
|
||||
}
|
||||
end,
|
||||
}
|
8
nvim/lua/plugins/luasnip.lua
Executable file
8
nvim/lua/plugins/luasnip.lua
Executable file
@ -0,0 +1,8 @@
|
||||
return {
|
||||
'L3MON4D3/LuaSnip',
|
||||
config = function()
|
||||
local luasnip = require('luasnip')
|
||||
|
||||
require("luasnip.loaders.from_vscode").load({paths = "~/.config/nvim/my_snippets"})
|
||||
end
|
||||
}
|
17
nvim/lua/plugins/markdown-preview.lua
Executable file
17
nvim/lua/plugins/markdown-preview.lua
Executable file
@ -0,0 +1,17 @@
|
||||
return {
|
||||
-- literally the name, previews md in browser
|
||||
"iamcco/markdown-preview.nvim",
|
||||
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
|
||||
ft = { "markdown" },
|
||||
build = function(plugin)
|
||||
if vim.fn.executable "npx" then
|
||||
vim.cmd("!cd " .. plugin.dir .. " && cd app && npx --yes yarn install")
|
||||
else
|
||||
vim.cmd [[Lazy load markdown-preview.nvim]]
|
||||
vim.fn["mkdp#util#install"]()
|
||||
end
|
||||
end,
|
||||
init = function()
|
||||
if vim.fn.executable "npx" then vim.g.mkdp_filetypes = { "markdown" } end
|
||||
end,
|
||||
}
|
40
nvim/lua/plugins/mason.lua
Executable file
40
nvim/lua/plugins/mason.lua
Executable file
@ -0,0 +1,40 @@
|
||||
return {
|
||||
-- lsp package manager
|
||||
"williamboman/mason.nvim",
|
||||
dependencies = {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
},
|
||||
config = function()
|
||||
-- import mason
|
||||
local mason = require("mason")
|
||||
|
||||
-- import mason-lspconfig
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
-- enable mason and configure icons
|
||||
mason.setup({
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✔",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
mason_lspconfig.setup({
|
||||
-- list of servers for mason to install
|
||||
ensure_installed = {
|
||||
-- "bashls",
|
||||
-- "clangd",
|
||||
-- "cssls",
|
||||
-- "jdtls",
|
||||
-- "lua_ls",
|
||||
-- "pyright",
|
||||
-- "tsserver",
|
||||
},
|
||||
-- auto-install configured servers (with lspconfig)
|
||||
automatic_installation = true,
|
||||
})
|
||||
end,
|
||||
}
|
17
nvim/lua/plugins/multicursors.lua
Executable file
17
nvim/lua/plugins/multicursors.lua
Executable file
@ -0,0 +1,17 @@
|
||||
return {
|
||||
"smoka7/multicursors.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
'nvimtools/hydra.nvim',
|
||||
},
|
||||
opts = {},
|
||||
cmd = { 'MCstart', 'MCvisual', 'MCclear', 'MCpattern', 'MCvisualPattern', 'MCunderCursor' },
|
||||
keys = {
|
||||
{
|
||||
mode = { 'v', 'n' },
|
||||
'<leader><leader>c',
|
||||
'<cmd>MCstart<cr>',
|
||||
desc = 'Create a selection for selected text or word under the cursor',
|
||||
},
|
||||
},
|
||||
}
|
146
nvim/lua/plugins/navbuddy.lua
Executable file
146
nvim/lua/plugins/navbuddy.lua
Executable file
@ -0,0 +1,146 @@
|
||||
return {
|
||||
"SmiteshP/nvim-navbuddy",
|
||||
dependencies = {
|
||||
"SmiteshP/nvim-navic",
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
opts = { lsp = { auto_attach = true } },
|
||||
config = function()
|
||||
local actions = require("nvim-navbuddy.actions")
|
||||
require("nvim-navbuddy").setup({
|
||||
window = {
|
||||
border = "rounded", -- "rounded", "double", "solid", "none"
|
||||
-- or an array with eight chars building up the border in a clockwise fashion
|
||||
-- starting with the top-left corner. eg: { "╔", "═" ,"╗", "║", "╝", "═", "╚", "║" }.
|
||||
size = "60%", -- Or table format example: { height = "40%", width = "100%"}
|
||||
position = "50%", -- Or table format example: { row = "100%", col = "0%"}
|
||||
scrolloff = nil, -- scrolloff value within navbuddy window
|
||||
sections = {
|
||||
left = {
|
||||
size = "20%",
|
||||
border = nil, -- You can set border style for each section individually as well.
|
||||
},
|
||||
mid = {
|
||||
size = "40%",
|
||||
border = nil,
|
||||
},
|
||||
right = {
|
||||
-- No size option for right most section. It fills to
|
||||
-- remaining area.
|
||||
border = nil,
|
||||
preview = "leaf", -- Right section can show previews too.
|
||||
-- Options: "leaf", "always" or "never"
|
||||
},
|
||||
},
|
||||
},
|
||||
node_markers = {
|
||||
enabled = true,
|
||||
icons = {
|
||||
leaf = " ",
|
||||
leaf_selected = " → ",
|
||||
branch = " ",
|
||||
},
|
||||
},
|
||||
icons = {
|
||||
File = " ",
|
||||
Module = " ",
|
||||
Namespace = " ",
|
||||
Package = " ",
|
||||
Class = " ",
|
||||
Method = " ",
|
||||
Property = " ",
|
||||
Field = " ",
|
||||
Constructor = " ",
|
||||
Enum = "",
|
||||
Interface = "",
|
||||
Function = " ",
|
||||
Variable = " ",
|
||||
Constant = " ",
|
||||
String = " ",
|
||||
Number = " ",
|
||||
Boolean = "◩ ",
|
||||
Array = " ",
|
||||
Object = " ",
|
||||
Key = " ",
|
||||
Null = " ",
|
||||
EnumMember = " ",
|
||||
Struct = " ",
|
||||
Event = " ",
|
||||
Operator = " ",
|
||||
TypeParameter = " ",
|
||||
},
|
||||
use_default_mappings = true, -- If set to false, only mappings set
|
||||
-- by user are set. Else default
|
||||
-- mappings are used for keys
|
||||
-- that are not set by user
|
||||
mappings = {
|
||||
["<esc>"] = actions.close(), -- Close and cursor to original location
|
||||
["q"] = actions.close(),
|
||||
|
||||
["j"] = actions.next_sibling(), -- down
|
||||
["k"] = actions.previous_sibling(), -- up
|
||||
|
||||
["h"] = actions.parent(), -- Move to left panel
|
||||
["l"] = actions.children(), -- Move to right panel
|
||||
["0"] = actions.root(), -- Move to first panel
|
||||
|
||||
["<C-S-v>"] = actions.visual_name(), -- Visual selection of name
|
||||
["<C-S-V>"] = actions.visual_scope(), -- Visual selection of scope
|
||||
|
||||
["y"] = actions.yank_name(), -- Yank the name to system clipboard "+
|
||||
["Y"] = actions.yank_scope(), -- Yank the scope to system clipboard "+
|
||||
|
||||
["i"] = actions.insert_name(), -- Insert at start of name
|
||||
["I"] = actions.insert_scope(), -- Insert at start of scope
|
||||
|
||||
["a"] = actions.append_name(), -- Insert at end of name
|
||||
["A"] = actions.append_scope(), -- Insert at end of scope
|
||||
|
||||
["r"] = actions.rename(), -- Rename currently focused symbol
|
||||
|
||||
["d"] = actions.delete(), -- Delete scope
|
||||
|
||||
["f"] = actions.fold_create(), -- Create fold of current scope
|
||||
["F"] = actions.fold_delete(), -- Delete fold of current scope
|
||||
|
||||
["c"] = actions.comment(), -- Comment out current scope
|
||||
|
||||
["<enter>"] = actions.select(), -- Goto selected symbol
|
||||
["o"] = actions.select(),
|
||||
|
||||
["J"] = actions.move_down(), -- Move focused node down
|
||||
["K"] = actions.move_up(), -- Move focused node up
|
||||
|
||||
["s"] = actions.toggle_preview(), -- Show preview of current node
|
||||
|
||||
["<C-v>"] = actions.vsplit(), -- Open selected node in a vertical split
|
||||
["<C-s>"] = actions.hsplit(), -- Open selected node in a horizontal split
|
||||
|
||||
["t"] = actions.telescope({ -- Fuzzy finder at current level.
|
||||
layout_config = { -- All options that can be
|
||||
height = 0.60, -- passed to telescope.nvim's
|
||||
width = 0.60, -- default can be passed here.
|
||||
prompt_position = "top",
|
||||
preview_width = 0.50,
|
||||
},
|
||||
layout_strategy = "horizontal",
|
||||
}),
|
||||
|
||||
["g?"] = actions.help(), -- Open mappings help window
|
||||
},
|
||||
lsp = {
|
||||
auto_attach = true, -- If set to true, you don't need to manually use attach function
|
||||
preference = nil, -- list of lsp server names in order of preference
|
||||
},
|
||||
source_buffer = {
|
||||
follow_node = true, -- Keep the current node in focus on the source buffer
|
||||
highlight = true, -- Highlight the currently focused node
|
||||
reorient = "smart", -- "smart", "top", "mid" or "none"
|
||||
scrolloff = nil, -- scrolloff value when navbuddy is open
|
||||
},
|
||||
custom_hl_group = nil, -- "Visual" or any other hl group to use instead of inverted colors
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>n", ":Navbuddy<CR>", { silent = true, desc = "open navbuddy menu" })
|
||||
end,
|
||||
}
|
15
nvim/lua/plugins/none-ls.lua
Executable file
15
nvim/lua/plugins/none-ls.lua
Executable file
@ -0,0 +1,15 @@
|
||||
return {
|
||||
"nvimtools/none-ls.nvim",
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.prettier,
|
||||
null_ls.builtins.formatting.shfmt,
|
||||
null_ls.builtins.formatting.black,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
22
nvim/lua/plugins/nvim-tree.lua
Executable file
22
nvim/lua/plugins/nvim-tree.lua
Executable file
@ -0,0 +1,22 @@
|
||||
return {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
version = "*",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
config = function()
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
require("nvim-tree").setup {
|
||||
sort = {
|
||||
folders_first = true,
|
||||
sorter = "name"
|
||||
}
|
||||
}
|
||||
|
||||
vim.keymap.set('n', '<leader>e', ":NvimTreeToggle<CR>", {silent = true})
|
||||
vim.keymap.set('n', '<leader><leader>e', ":NvimTreeFindFile<CR>", {silent = true})
|
||||
end,
|
||||
}
|
65
nvim/lua/plugins/startup.lua
Executable file
65
nvim/lua/plugins/startup.lua
Executable file
@ -0,0 +1,65 @@
|
||||
return {
|
||||
"startup-nvim/startup.nvim",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("startup").setup({
|
||||
title = {
|
||||
type = "text",
|
||||
align = "center",
|
||||
content = {
|
||||
[[ ]],
|
||||
[[ ██████ █████ █████ █████ ███ ]],
|
||||
[[ ░░██████ ░░███ ░░███ ░░███ ░░░ ]],
|
||||
[[ ░███░███ ░███ ██████ ██████ ░███ ░███ ████ █████████████ ]],
|
||||
[[ ░███░░███░███ ███░░███ ███░░███ ░███ ░███ ░░███ ░░███░░███░░███ ]],
|
||||
[[ ░███ ░░██████ ░███████ ░███ ░███ ░░███ ███ ░███ ░███ ░███ ░███ ]],
|
||||
[[ ░███ ░░█████ ░███░░░ ░███ ░███ ░░░█████░ ░███ ░███ ░███ ░███ ]],
|
||||
[[ █████ ░░█████░░██████ ░░██████ ░░███ █████ █████░███ █████ ]],
|
||||
[[ ░░░░░ ░░░░░ ░░░░░░ ░░░░░░ ░░░ ░░░░░ ░░░░░ ░░░ ░░░░░ ]],
|
||||
[[ ]],
|
||||
},
|
||||
highlight = "String",
|
||||
default_color = "#010155"
|
||||
},
|
||||
|
||||
quotes = {
|
||||
type = "text",
|
||||
align = "center",
|
||||
content = {[["It's not as hard as it looks..."]]},
|
||||
highlight = "String",
|
||||
default_color = "#FFFFFF"
|
||||
},
|
||||
|
||||
old = {
|
||||
type = "oldfiles",
|
||||
oldfiles_directory = true,
|
||||
align = "center",
|
||||
title = "Old files",
|
||||
oldfiles_amount = 10,
|
||||
highlight = "String",
|
||||
default_color = "#FFFFFF",
|
||||
content = "",
|
||||
},
|
||||
|
||||
options = {
|
||||
mapping_keys = false;
|
||||
},
|
||||
|
||||
colors = {
|
||||
background = "#000000",
|
||||
folded_section = "#100000"
|
||||
},
|
||||
|
||||
mappings = {
|
||||
execute_command = "<C-r>",
|
||||
open_file = "<CR>",
|
||||
},
|
||||
|
||||
parts = {"title", "quotes", "old"}
|
||||
})
|
||||
end,
|
||||
}
|
8
nvim/lua/plugins/surround.lua
Executable file
8
nvim/lua/plugins/surround.lua
Executable file
@ -0,0 +1,8 @@
|
||||
return {
|
||||
"kylechui/nvim-surround",
|
||||
version = "*",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("nvim-surround").setup()
|
||||
end
|
||||
}
|
40
nvim/lua/plugins/telescope.lua
Executable file
40
nvim/lua/plugins/telescope.lua
Executable file
@ -0,0 +1,40 @@
|
||||
return {
|
||||
-- fuzzy finder
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
config = function()
|
||||
local builtin = require("telescope.builtin")
|
||||
local actions = require("telescope.actions")
|
||||
local opts = { silent = true }
|
||||
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist, -- TODO investigate
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
opts.desc = "telescope find files"
|
||||
vim.keymap.set("n", "<leader>ff", builtin.find_files, opts)
|
||||
|
||||
opts.desc = "telescope live grep"
|
||||
vim.keymap.set("n", "<leader>fg", builtin.live_grep, opts)
|
||||
|
||||
opts.desc = "telescope buffers"
|
||||
vim.keymap.set("n", "<leader>fb", builtin.buffers, opts)
|
||||
|
||||
opts.desc = "telescope nvim functions"
|
||||
vim.keymap.set("n", "<leader>fh", builtin.help_tags, opts)
|
||||
|
||||
|
||||
-- Search and replace
|
||||
|
||||
end,
|
||||
}
|
17
nvim/lua/plugins/toggleterm.lua
Executable file
17
nvim/lua/plugins/toggleterm.lua
Executable file
@ -0,0 +1,17 @@
|
||||
return {
|
||||
-- literally the name, quick term toggle
|
||||
"akinsho/toggleterm.nvim",
|
||||
version = "*",
|
||||
config = function()
|
||||
require("toggleterm").setup({
|
||||
insert_mappings = false,
|
||||
terminal_mappings = false,
|
||||
open_mapping = "<leader>t",
|
||||
direction = "float",
|
||||
float_opts = {
|
||||
border = "curved",
|
||||
},
|
||||
})
|
||||
vim.keymap.set("t", "<S-Esc>", [[<cmd>ToggleTerm<CR>]], {}) -- close terminal wih esc
|
||||
end,
|
||||
}
|
26
nvim/lua/plugins/treesitter.lua
Executable file
26
nvim/lua/plugins/treesitter.lua
Executable file
@ -0,0 +1,26 @@
|
||||
return {
|
||||
-- syntax highlighting
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"cpp",
|
||||
"hyprlang",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"python",
|
||||
"typescript",
|
||||
},
|
||||
sync_install = false,
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = { "tex" }
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
15
nvim/lua/plugins/vimtex.lua
Executable file
15
nvim/lua/plugins/vimtex.lua
Executable file
@ -0,0 +1,15 @@
|
||||
return {
|
||||
"lervag/vimtex",
|
||||
config = function()
|
||||
-- vimtex settings
|
||||
-- vim.g.vimtex_view_method = 'startup' -- PDF viewer (example: zathura, or use 'skim' for macOS)
|
||||
vim.g.vimtex_compiler_method = 'latexmk' -- Use latexmk for compilation
|
||||
vim.g.vimtex_fold_enabled = 1 -- Enable folding for LaTeX sections
|
||||
vim.g.vimtex_quickfix_mode = 0 -- Disable quickfix mode for compilation errors
|
||||
-- Key Mappings for LaTeX workflow
|
||||
vim.api.nvim_set_keymap('n', '<leader>lc', ':VimtexCompile<CR>', {}) -- Compile LaTeX file
|
||||
vim.api.nvim_set_keymap('n', '<leader>lv', ':VimtexView<CR>', {}) -- View compiled PDF
|
||||
vim.api.nvim_set_keymap('n', '<leader>lq', ':VimtexStop<CR>', {}) -- Stop compilation
|
||||
|
||||
end
|
||||
}
|
12
nvim/lua/plugins/whichkey.lua
Executable file
12
nvim/lua/plugins/whichkey.lua
Executable file
@ -0,0 +1,12 @@
|
||||
return {
|
||||
-- keybinds popup
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 500
|
||||
end,
|
||||
opts = {
|
||||
|
||||
}
|
||||
}
|
14
nvim/lua/plugins/zen-mode.lua
Executable file
14
nvim/lua/plugins/zen-mode.lua
Executable file
@ -0,0 +1,14 @@
|
||||
return {
|
||||
-- view buffer w/o distractions
|
||||
"folke/zen-mode.nvim",
|
||||
config = function()
|
||||
require("zen-mode").setup({
|
||||
window = {
|
||||
width = 1,
|
||||
height = 1,
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>z", ":ZenMode<CR>", { silent = true, desc = "open current buffer in zen mode" })
|
||||
end,
|
||||
}
|
55
nvim/lua/utils.lua
Executable file
55
nvim/lua/utils.lua
Executable file
@ -0,0 +1,55 @@
|
||||
-- taken from https://github.com/ibhagwan/nvim-lua
|
||||
|
||||
local M = {}
|
||||
|
||||
M.opts = function(desc)
|
||||
if desc then
|
||||
return { silent = true, desc = desc}
|
||||
else
|
||||
return { silent = true }
|
||||
end
|
||||
end
|
||||
|
||||
M.sudo_exec = function(cmd, print_output)
|
||||
vim.fn.inputsave()
|
||||
local password = vim.fn.inputsecret("Password: ")
|
||||
vim.fn.inputrestore()
|
||||
if not password or #password == 0 then
|
||||
print("Invalid password, sudo aborted")
|
||||
return false
|
||||
end
|
||||
local out = vim.fn.system(string.format("sudo -p '' -S %s", cmd), password)
|
||||
if vim.v.shell_error ~= 0 then
|
||||
print("\r\n")
|
||||
print(out)
|
||||
return false
|
||||
end
|
||||
if print_output then print("\r\n", out) end
|
||||
return true
|
||||
end
|
||||
|
||||
M.sudo_write = function(tmpfile, filepath)
|
||||
if not tmpfile then tmpfile = vim.fn.tempname() end
|
||||
if not filepath then filepath = vim.fn.expand("%") end
|
||||
if not filepath or #filepath == 0 then
|
||||
print("E32: No file name")
|
||||
return
|
||||
end
|
||||
-- `bs=1048576` is equivalent to `bs=1M` for GNU dd or `bs=1m` for BSD dd
|
||||
-- Both `bs=1M` and `bs=1m` are non-POSIX
|
||||
local cmd = string.format("dd if=%s of=%s bs=1048576",
|
||||
vim.fn.shellescape(tmpfile),
|
||||
vim.fn.shellescape(filepath))
|
||||
-- no need to check error as this fails the entire function
|
||||
vim.api.nvim_exec(string.format("write! %s", tmpfile), true)
|
||||
if M.sudo_exec(cmd) then
|
||||
-- refreshes the buffer and prints the "written" message
|
||||
vim.cmd.checktime()
|
||||
-- exit command mode
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(
|
||||
"<Esc>", true, false, true), "n", true)
|
||||
end
|
||||
vim.fn.delete(tmpfile)
|
||||
end
|
||||
|
||||
return M
|
37
nvim/my_snippets/package.json
Normal file
37
nvim/my_snippets/package.json
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "example-snippets",
|
||||
"contributes": {
|
||||
"snippets": [
|
||||
{
|
||||
"language": [
|
||||
"all"
|
||||
],
|
||||
"path": "./snippets/docSetup.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"tex"
|
||||
],
|
||||
"path": "./snippets/tex.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"javascript"
|
||||
],
|
||||
"path": "./snippets/javascript.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"typescript"
|
||||
],
|
||||
"path": "./snippets/typescript.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"vue"
|
||||
],
|
||||
"path": "./snippets/vue.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
6
nvim/my_snippets/snippets/docSetup.json
Executable file
6
nvim/my_snippets/snippets/docSetup.json
Executable file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"docTitle": {
|
||||
"prefix": "prepareDoc",
|
||||
"body": "$BLOCK_COMMENT_START\n*\t\t\t\t$WORKSPACE_NAME - $TM_FILENAME\n*\n*\tCreated by Janis Hutz $CURRENT_MONTH/$CURRENT_DATE/$CURRENT_YEAR, Licensed under ${1|the GPL V3,the MIT,a proprietary,the BSD,the LGPL V3,the Apache|} License\n*\t\t\thttps://janishutz.com, development@janishutz.com\n*\n*\n$BLOCK_COMMENT_END"
|
||||
}
|
||||
}
|
45
nvim/my_snippets/snippets/html.json
Executable file
45
nvim/my_snippets/snippets/html.json
Executable file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"impress": {
|
||||
"prefix": "impress",
|
||||
"body": [
|
||||
"<!DOCTYPE html>",
|
||||
"<html>",
|
||||
"\t<head>\n\t\t<title>$1</title>\n\t\t<link rel=\"stylesheet\" href=\"style.css\">\n\t</head>",
|
||||
"\t<body class=\"impress-not-supported\">",
|
||||
"\t\t<div class=\"fallback-message\">\n\t\t\t<p>Your browser <b>doesn't support the features required</b> by impress.js, so you are presented with a simplified version of this presentation.</p>\n\t\t\t<p>For the best experience please use the latest <b>Chrome</b>, <b>Safari</b> or <b>Firefox</b> browser.</p>\n\t\t</div>",
|
||||
"\t\t<div id=\"impress\" data-width=\"1920\" data-height=\"1080\">",
|
||||
"\t\t\t<div id=\"title\" class=\"step\">\n\t\t\t\t<div class=\"content\">",
|
||||
"\t\t\t\t\t<h1>$2</h1>\n\t\t\t\t</div>",
|
||||
"\t\t\t</div>\n\t\t</div>",
|
||||
"\n\t\t<script src=\"https://cdn.jsdelivr.net/gh/impress/impress.js@2.0.0/js/impress.js\">\n\t\t</script><script>impress().init()</script>\n\t</body>",
|
||||
"</html>"
|
||||
]
|
||||
},
|
||||
"impress-step": {
|
||||
"prefix": "impressStep",
|
||||
"body": [
|
||||
"\n<div id=\"$1\" class=\"step\">",
|
||||
"\t<div class=\"content\">",
|
||||
"\t\t<h2>$2</h2>\n\t</div>",
|
||||
"</div>\n"
|
||||
]
|
||||
},
|
||||
"html-basic": {
|
||||
"prefix": "basic",
|
||||
"body": [
|
||||
"<!DOCTYPE html>",
|
||||
"<html>",
|
||||
"\t<head>\n\t\t<title>$1</title>\n\t\t<link rel=\"stylesheet\" href=\"/css/style.css\">\n\t\t<meta charset=\"utf-8\">\n\t\t<meta name=\"description\" content=\"$2\">\n\t</head>",
|
||||
"\t<body>\n\t\t<h1>$3</h1>",
|
||||
"\t</body>\n</html>"
|
||||
]
|
||||
},
|
||||
"impress-notes": {
|
||||
"prefix": "impressNotes",
|
||||
"body": "<div class=\"notes\">\n\t$1\n</div>"
|
||||
},
|
||||
"impress-substep": {
|
||||
"prefix": "impressSubstep",
|
||||
"body": "<div class=\"substep\">\n\t$1\n</div>"
|
||||
}
|
||||
}
|
93
nvim/my_snippets/snippets/javascript.json
Executable file
93
nvim/my_snippets/snippets/javascript.json
Executable file
@ -0,0 +1,93 @@
|
||||
{
|
||||
"JS-Class": {
|
||||
"prefix": "jsSetupClass",
|
||||
"body": "class $1 { \n\tconstructor () {} \n\n \t$2 () {\n\t$3\n\t}\n}",
|
||||
"description": "Setup the basic structure of a class in JS"
|
||||
},
|
||||
"ExpressJS": {
|
||||
"prefix": "jsExpressSetup",
|
||||
"body": [
|
||||
"const express = require( 'express' );",
|
||||
"let app = express();",
|
||||
"const path = require( 'path' );",
|
||||
"const expressSession = require( 'express-session' );",
|
||||
"const fs = require( 'fs' );",
|
||||
"const bodyParser = require( 'body-parser' );",
|
||||
"const cookieParser = require( 'cookie-parser' )",
|
||||
"const favicon = require( 'serve-favicon' );",
|
||||
"\napp.use( expressSession ( {\n\tsecret: $1,\n\tresave: true,\n\tsaveUninitialized: true\n} ) );",
|
||||
"app.use( bodyParser.urlencoded( { extended: false } ) );",
|
||||
"app.use( bodyParser.json() );",
|
||||
"app.use( cookieParser() );",
|
||||
"app.use( favicon( path.join( __dirname + '$2' ) ) );\n",
|
||||
"app.use( ( request, response, next ) => {\n\tresponse.sendFile( path.join( __dirname + '$3' ) ) \n} );",
|
||||
"\n\napp.get( '/', ( request, response ) => {\n$4\n} );",
|
||||
"\n\nconst PORT = process.env.PORT || 8080;",
|
||||
"http.createServer( app ).listen( PORT );"
|
||||
]
|
||||
},
|
||||
"ExpressJS-Route": {
|
||||
"prefix": "jsEjsRoute",
|
||||
"body": "\n\napp.get( '$1', ( request, response ) => {\n$4\n} );"
|
||||
},
|
||||
"JSAsync": {
|
||||
"prefix": "jsAsync",
|
||||
"body": "(async () => {\n$1\n} ) ();"
|
||||
},
|
||||
"JSpromiseReturnFunc": {
|
||||
"prefix": "jsPromise",
|
||||
"body": "function $1 () {\n\treturn new Promise( ( resolve, reject ) => {\n\t$2\n\t} );\n}"
|
||||
},
|
||||
"fetch from other url": {
|
||||
"prefix": "remoteURL",
|
||||
"body": [
|
||||
"localStorage.getItem( 'url' ) + '/$1'"
|
||||
],
|
||||
"description": "remote URL fetching (get from base address from local storage)"
|
||||
},
|
||||
"fetch post": {
|
||||
"prefix": "fetchPost",
|
||||
"body": [
|
||||
"const fetchOptions = {",
|
||||
"\tmethod: 'post',",
|
||||
"\tbody: JSON.stringify( $1 ),",
|
||||
"\tcredentials: 'include',",
|
||||
"\theaders: {",
|
||||
"\t\t'Content-Type': 'application/json',",
|
||||
"\t\t'charset': 'utf-8'",
|
||||
"\t}",
|
||||
"};",
|
||||
"fetch( $2, fetchOptions ).then( res => {",
|
||||
"\tif ( res.status === 200 ) {",
|
||||
"\t\tres.json().then( json => {",
|
||||
"\t\t\t$3",
|
||||
"\t\t} );",
|
||||
"\t}",
|
||||
"} );",
|
||||
"$4"
|
||||
],
|
||||
"description": "POST request using fetch"
|
||||
},
|
||||
"fetch get": {
|
||||
"prefix": "fetchGet",
|
||||
"body": [
|
||||
"fetch( $2, { credentials: 'include' } ).then( res => {",
|
||||
"\tif ( res.status === 200 ) {",
|
||||
"\t\tres.json().then( json => {",
|
||||
"\t\t\t$3",
|
||||
"\t\t} );",
|
||||
"\t}",
|
||||
"} );",
|
||||
"$4"
|
||||
],
|
||||
"description": "POST request using fetch"
|
||||
},
|
||||
"promise": {
|
||||
"prefix": "promise",
|
||||
"body": [
|
||||
"return new Promise( ( resolve, reject ) => {",
|
||||
"\t",
|
||||
"} );"
|
||||
]
|
||||
}
|
||||
}
|
336
nvim/my_snippets/snippets/tex.json
Executable file
336
nvim/my_snippets/snippets/tex.json
Executable file
@ -0,0 +1,336 @@
|
||||
{
|
||||
"Formula (old)": {
|
||||
"prefix": "formulaBare",
|
||||
"body": [
|
||||
"\\begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,title=Formula: $1]",
|
||||
"\t$2",
|
||||
"\\end{tcolorbox}"
|
||||
],
|
||||
"description": "Red tcolorbox to provide a formula (without the default setup)"
|
||||
},
|
||||
"Prepare Latex doc (old)": {
|
||||
"prefix": "LaTeX-Prepare-Old",
|
||||
"body": [
|
||||
"\\documentclass{article}\n",
|
||||
"% Imports %",
|
||||
"\\usepackage{amsmath}",
|
||||
"\\usepackage{graphicx}",
|
||||
"\\usepackage{subcaption}",
|
||||
"\\usepackage[export]{adjustbox}",
|
||||
"\\usepackage{tcolorbox}",
|
||||
"\\usepackage{xcolor}",
|
||||
"\\usepackage{cancel}",
|
||||
"\\usepackage{dsfont}",
|
||||
"\\usepackage{amssymb}",
|
||||
"\\usepackage[a4paper]{geometry}",
|
||||
"\\usepackage{parskip}\n",
|
||||
"% Setup %",
|
||||
"\\title{\\Huge \\textbf{$1}}",
|
||||
"\\author{Janis Hutz}\n",
|
||||
"% Configuring %",
|
||||
"\\addtolength{\\oddsidemargin}{-0.75in}",
|
||||
"\\addtolength{\\textwidth}{1.5in}",
|
||||
"\\addtolength{\\evensidemargin}{-0.75in}",
|
||||
"\\addtolength{\\topmargin}{-1in}",
|
||||
"\\addtolength{\\textheight}{2in}\n",
|
||||
"% Main doc %",
|
||||
"\\begin{document}",
|
||||
"\\maketitle",
|
||||
"$2",
|
||||
"\\end{document}"
|
||||
],
|
||||
"description": "Prepare a LaTeX Document with all relevant imports"
|
||||
},
|
||||
"prepare LaTeX Document (New)": {
|
||||
"prefix": "latex-prepare",
|
||||
"body": [
|
||||
"\\documentclass{article}\n",
|
||||
"\\newcommand{\\dir}{~/projects/latex} % IMPORTANT: No trailing slashes!",
|
||||
"\\input{\\dir/include.tex}",
|
||||
"\\load{recommended}\n",
|
||||
"\\setup{$1}\n",
|
||||
"\\begin{document}",
|
||||
"\\startDocument",
|
||||
"\\usetcolorboxes",
|
||||
"$2\n\n",
|
||||
"\\end{document}"
|
||||
],
|
||||
"description": "Prepares a full LaTeX Document for use and compiling"
|
||||
},
|
||||
"Fancy table": {
|
||||
"prefix": "table",
|
||||
"body": [
|
||||
"\\begin{tabular}[h!]{|$1|}",
|
||||
"\t\\hline",
|
||||
"\t\\rowcolor{$2}\\multicolumn{$3}{|c|}{$4}\\",
|
||||
"\t\\hline",
|
||||
"\t$5\\\\\\",
|
||||
"\t\\hline",
|
||||
"\\end{tabular}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to provide a formula (red)"
|
||||
},
|
||||
"Formula (new)": {
|
||||
"prefix": "formula",
|
||||
"body": [
|
||||
"\\begin{formula}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{formula}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to provide a formula (red)"
|
||||
},
|
||||
"Definition (new)": {
|
||||
"prefix": "definition",
|
||||
"body": [
|
||||
"\\begin{definition}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{definition}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to provide a definition (blue)"
|
||||
},
|
||||
"Recall (new)": {
|
||||
"prefix": "recall",
|
||||
"body": [
|
||||
"\\begin{recall}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{recall}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to provide a recall / revision of previous knowledge (yellow)"
|
||||
},
|
||||
"Important Remarks (new)": {
|
||||
"prefix": "remarks",
|
||||
"body": [
|
||||
"\\begin{remarks}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{remarks}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to provide remarks (green)"
|
||||
},
|
||||
"Guides (new)": {
|
||||
"prefix": "guides",
|
||||
"body": [
|
||||
"\\begin{guides}[]{$1}{${2:Usage}}",
|
||||
"\t$2",
|
||||
"\\end{guides}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to provide guides / instructions on how to use (purple)"
|
||||
},
|
||||
"Properties (new)": {
|
||||
"prefix": "properties",
|
||||
"body": [
|
||||
"\\begin{properties}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{properties}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to inform about properties / restrictions / limitations"
|
||||
},
|
||||
"Restrictions (new)": {
|
||||
"prefix": "restrictions",
|
||||
"body": [
|
||||
"\\begin{restrictions}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{restrictions}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to inform about restrictions"
|
||||
},
|
||||
"Limitations (new)": {
|
||||
"prefix": "limitations",
|
||||
"body": [
|
||||
"\\begin{limitations}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{limitations}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to inform about limitations"
|
||||
},
|
||||
"Theorem (new)": {
|
||||
"prefix": "theorem",
|
||||
"body": [
|
||||
"\\begin{theorem}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{theorem}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to inform about theorems"
|
||||
},
|
||||
"Lemma (new)": {
|
||||
"prefix": "lemma",
|
||||
"body": [
|
||||
"\\begin{lemma}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{lemma}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to inform about lemmas"
|
||||
},
|
||||
"Corollary (new)": {
|
||||
"prefix": "corollary",
|
||||
"body": [
|
||||
"\\begin{corollary}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{corollary}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to inform about corollaries"
|
||||
},
|
||||
"Terms (new)": {
|
||||
"prefix": "terms",
|
||||
"body": [
|
||||
"\\begin{terms}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{terms}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to inform about terms"
|
||||
},
|
||||
"Proof (new)": {
|
||||
"prefix": "proof",
|
||||
"body": [
|
||||
"\\begin{proof}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{proof}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to show a proof"
|
||||
},
|
||||
"Axiom (new)": {
|
||||
"prefix": "axiom",
|
||||
"body": [
|
||||
"\\begin{axiom}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{axiom}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to show an axiom"
|
||||
},
|
||||
"Notation (new)": {
|
||||
"prefix": "notation",
|
||||
"body": [
|
||||
"\\begin{notation}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{notation}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to show notation"
|
||||
},
|
||||
"Example (new)": {
|
||||
"prefix": "example",
|
||||
"body": [
|
||||
"\\begin{example}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{example}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to show example"
|
||||
},
|
||||
"Usage (languages, new)": {
|
||||
"prefix": "usage",
|
||||
"body": [
|
||||
"\\begin{usage}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{usage}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to inform about usage in a language context"
|
||||
},
|
||||
"Conjugation (languages, new)": {
|
||||
"prefix": "conjugation",
|
||||
"body": [
|
||||
"\\begin{conjugation}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{conjugation}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to inform about conjugation"
|
||||
},
|
||||
"Forms (languages, new)": {
|
||||
"prefix": "forms",
|
||||
"body": [
|
||||
"\\begin{forms}[]{$1}",
|
||||
"\t$2",
|
||||
"\\end{forms}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox to inform about forms of e.g. grammatical structures"
|
||||
},
|
||||
"General-Tcolorbox (new)": {
|
||||
"prefix": "general-tcb",
|
||||
"body": [
|
||||
"\\begin{general}[]{${1:title}}{${2:second title}}{${3|red,green,blue,cyan,magenta,yellow,black,gray,white,darkgray,lightgray,brown,lime,olive,orange,pink,purple,teal,violet|}}",
|
||||
"\t$4",
|
||||
"\\end{general}"
|
||||
],
|
||||
"description": "Inserts a tcolorbox for general purposes. First bracket is title, second one is second title, third one colour"
|
||||
},
|
||||
"Derivative": {
|
||||
"prefix": "derivative",
|
||||
"body": [
|
||||
"\\frac{\\mbox{d}}{\\mbox{d}x}$1"
|
||||
]
|
||||
},
|
||||
"Example (inline)": {
|
||||
"prefix": "example-inline",
|
||||
"body": [
|
||||
"\\inlineex"
|
||||
]
|
||||
},
|
||||
"bold": {
|
||||
"prefix": "#bold",
|
||||
"body": [
|
||||
"\\textbf{$1}"
|
||||
]
|
||||
},
|
||||
"italic": {
|
||||
"prefix": "#i",
|
||||
"body": [
|
||||
"\\textit{$1}"
|
||||
]
|
||||
},
|
||||
"bolditalic": {
|
||||
"prefix": "#bi",
|
||||
"body": [
|
||||
"\\textbf{\\textit{$1}}"
|
||||
]
|
||||
},
|
||||
"underlinie": {
|
||||
"prefix": "#u",
|
||||
"body": [
|
||||
"\\underbar{$1}"
|
||||
]
|
||||
},
|
||||
"algebra": {
|
||||
"prefix": "algebra",
|
||||
"body": [
|
||||
"\\langle $1 \\rangle"
|
||||
]
|
||||
},
|
||||
"fill-width": {
|
||||
"prefix": "#fill",
|
||||
"body": [
|
||||
"\\hspace{\\fill}$1"
|
||||
]
|
||||
},
|
||||
"Latex-Colour": {
|
||||
"prefix": "colour",
|
||||
"body": [
|
||||
"${1|red,green,blue,cyan,magenta,yellow,black,gray,white,darkgray,lightgray,brown,lime,olive,orange,pink,purple,teal,violet|}"
|
||||
]
|
||||
},
|
||||
"Latex-Text-Colour": {
|
||||
"prefix": "colour-text",
|
||||
"body": [
|
||||
"\\color{${1|red,green,blue,cyan,magenta,yellow,black,gray,white,darkgray,lightgray,brown,lime,olive,orange,pink,purple,teal,violet|}}"
|
||||
]
|
||||
},
|
||||
"German doc": {
|
||||
"prefix": "latex-german",
|
||||
"body": [
|
||||
"\\usepackage[ngerman]{babel}",
|
||||
"\\setcounter{lang}{2} % Move below \\begin{document}"
|
||||
]
|
||||
},
|
||||
"Letter": {
|
||||
"prefix": "latex-letter",
|
||||
"body": [
|
||||
"\\documentclass[12pt,a4paper]{scrlttr2}\n",
|
||||
"\\input{~/projects/generalSchool/letter-helpers.tex}\n",
|
||||
"% Subject",
|
||||
"\\setkomavar{subject}{$1}",
|
||||
"\\begin{document}\\raggedright",
|
||||
"\t\\begin{letter}{Company \\\\\\ Name \\\\\\ Address \\\\\\ CH-Place}",
|
||||
"\t\t\\opening{Intro}\n",
|
||||
"\t\t$2\n",
|
||||
"\t\t\\closing{Mit freundlichen Grüssen}",
|
||||
"\t\\end{letter}",
|
||||
"\\end{document}"
|
||||
]
|
||||
}
|
||||
}
|
93
nvim/my_snippets/snippets/typescript.json
Executable file
93
nvim/my_snippets/snippets/typescript.json
Executable file
@ -0,0 +1,93 @@
|
||||
{
|
||||
"JS-Class": {
|
||||
"prefix": "jsSetupClass",
|
||||
"body": "class $1 { \n\tconstructor () {} \n\n \t$2 () {\n\t$3\n\t}\n}",
|
||||
"description": "Setup the basic structure of a class in JS"
|
||||
},
|
||||
"ExpressJS": {
|
||||
"prefix": "jsExpressSetup",
|
||||
"body": [
|
||||
"const express = require( 'express' );",
|
||||
"let app = express();",
|
||||
"const path = require( 'path' );",
|
||||
"const expressSession = require( 'express-session' );",
|
||||
"const fs = require( 'fs' );",
|
||||
"const bodyParser = require( 'body-parser' );",
|
||||
"const cookieParser = require( 'cookie-parser' )",
|
||||
"const favicon = require( 'serve-favicon' );",
|
||||
"\napp.use( expressSession ( {\n\tsecret: $1,\n\tresave: true,\n\tsaveUninitialized: true\n} ) );",
|
||||
"app.use( bodyParser.urlencoded( { extended: false } ) );",
|
||||
"app.use( bodyParser.json() );",
|
||||
"app.use( cookieParser() );",
|
||||
"app.use( favicon( path.join( __dirname + '$2' ) ) );\n",
|
||||
"app.use( ( request, response, next ) => {\n\tresponse.sendFile( path.join( __dirname + '$3' ) ) \n} );",
|
||||
"\n\napp.get( '/', ( request, response ) => {\n$4\n} );",
|
||||
"\n\nconst PORT = process.env.PORT || 8080;",
|
||||
"http.createServer( app ).listen( PORT );"
|
||||
]
|
||||
},
|
||||
"ExpressJS-Route": {
|
||||
"prefix": "jsEjsRoute",
|
||||
"body": "\n\napp.get( '$1', ( request: express.Request, response: express.Response ) => {\n$4\n} );"
|
||||
},
|
||||
"JSAsync": {
|
||||
"prefix": "jsAsync",
|
||||
"body": "(async () => {\n$1\n} ) ();"
|
||||
},
|
||||
"JSpromiseReturnFunc": {
|
||||
"prefix": "jsPromise",
|
||||
"body": "function $1 () {\n\treturn new Promise( ( resolve, reject ) => {\n\t$2\n\t} );\n}"
|
||||
},
|
||||
"fetch from other url": {
|
||||
"prefix": "remoteURL",
|
||||
"body": [
|
||||
"localStorage.getItem( 'url' ) + '/$1'",
|
||||
],
|
||||
"description": "remote URL fetching (get from base address from local storage)"
|
||||
},
|
||||
"fetch post": {
|
||||
"prefix": "fetchPost",
|
||||
"body": [
|
||||
"const fetchOptions = {",
|
||||
"\tmethod: 'post',",
|
||||
"\tbody: JSON.stringify( $1 ),",
|
||||
"\tcredentials: 'include',",
|
||||
"\theaders: {",
|
||||
"\t\t'Content-Type': 'application/json',",
|
||||
"\t\t'charset': 'utf-8'",
|
||||
"\t}",
|
||||
"};",
|
||||
"fetch( $2, fetchOptions ).then( res => {",
|
||||
"\tif ( res.status === 200 ) {",
|
||||
"\t\tres.json().then( json => {",
|
||||
"\t\t\t$3",
|
||||
"\t\t} );",
|
||||
"\t}",
|
||||
"} );",
|
||||
"$4"
|
||||
],
|
||||
"description": "POST request using fetch"
|
||||
},
|
||||
"fetch get": {
|
||||
"prefix": "fetchGet",
|
||||
"body": [
|
||||
"fetch( $2, { credentials: 'include' } ).then( res => {",
|
||||
"\tif ( res.status === 200 ) {",
|
||||
"\t\tres.json().then( json => {",
|
||||
"\t\t\t$3",
|
||||
"\t\t} );",
|
||||
"\t}",
|
||||
"} );",
|
||||
"$4"
|
||||
],
|
||||
"description": "POST request using fetch"
|
||||
},
|
||||
"promise": {
|
||||
"prefix": "promise",
|
||||
"body": [
|
||||
"return new Promise( ( resolve, reject ) => {",
|
||||
"\t",
|
||||
"} );"
|
||||
]
|
||||
}
|
||||
}
|
11
nvim/my_snippets/snippets/vue.json
Executable file
11
nvim/my_snippets/snippets/vue.json
Executable file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"script:setup": {
|
||||
"prefix": "script:setup",
|
||||
"body": [
|
||||
"<script setup lang=\"ts\">",
|
||||
"\t$1",
|
||||
"</script>"
|
||||
],
|
||||
"description": "Setup the basic structure of a class in JS"
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user