initial
This commit is contained in:
commit
8cc59af68e
37 changed files with 72435 additions and 0 deletions
20
.neoconf.json
Normal file
20
.neoconf.json
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"neodev": {
|
||||
"library": {
|
||||
"enabled": true,
|
||||
"plugins": true
|
||||
}
|
||||
},
|
||||
"neoconf": {
|
||||
"plugins": {
|
||||
"lua_ls": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"lspconfig": {
|
||||
"lua_ls": {
|
||||
"Lua.format.enable": false
|
||||
}
|
||||
}
|
||||
}
|
||||
7
.stylua.toml
Normal file
7
.stylua.toml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
column_width = 120
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
quote_style = "AutoPreferDouble"
|
||||
call_parentheses = "None"
|
||||
collapse_simple_statement = "Always"
|
||||
34
README.md
Normal file
34
README.md
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# AstroNvim Template
|
||||
|
||||
**NOTE:** This is for AstroNvim v4+
|
||||
|
||||
A template for getting started with [AstroNvim](https://github.com/AstroNvim/AstroNvim)
|
||||
|
||||
## 🛠️ Installation
|
||||
|
||||
#### Make a backup of your current nvim and shared folder
|
||||
|
||||
```shell
|
||||
mv ~/.config/nvim ~/.config/nvim.bak
|
||||
mv ~/.local/share/nvim ~/.local/share/nvim.bak
|
||||
mv ~/.local/state/nvim ~/.local/state/nvim.bak
|
||||
mv ~/.cache/nvim ~/.cache/nvim.bak
|
||||
```
|
||||
|
||||
#### Create a new user repository from this template
|
||||
|
||||
Press the "Use this template" button above to create a new repository to store your user configuration.
|
||||
|
||||
You can also just clone this repository directly if you do not want to track your user configuration in GitHub.
|
||||
|
||||
#### Clone the repository
|
||||
|
||||
```shell
|
||||
git clone https://git.lucasf.dev/public/kurunvim.git ~/.config/nvim
|
||||
```
|
||||
|
||||
#### Start Neovim
|
||||
|
||||
```shell
|
||||
nvim
|
||||
```
|
||||
4
after/ftplugin/lua.lua
Normal file
4
after/ftplugin/lua.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
local set = vim.opt_local
|
||||
|
||||
set.shiftwidth = 2
|
||||
|
||||
19
init.lua
Normal file
19
init.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
-- This file simply bootstraps the installation of Lazy.nvim and then calls other files for execution
|
||||
-- This file doesn't necessarily need to be touched, BE CAUTIOUS editing this file and proceed at your own risk.
|
||||
local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
|
||||
if not (vim.env.LAZY or (vim.uv or vim.loop).fs_stat(lazypath)) then
|
||||
-- stylua: ignore
|
||||
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- validate that lazy is available
|
||||
if not pcall(require, "lazy") then
|
||||
-- stylua: ignore
|
||||
vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {})
|
||||
vim.fn.getchar()
|
||||
vim.cmd.quit()
|
||||
end
|
||||
|
||||
require "lazy_setup"
|
||||
require "polish"
|
||||
76
lazy-lock.json
Normal file
76
lazy-lock.json
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
"AstroNvim": { "branch": "main", "commit": "c82ef216d0776b19cd7229fb916c4b30fbe3484c" },
|
||||
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
|
||||
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
||||
"aerial.nvim": { "branch": "master", "commit": "9c29a1a66eb31384888e413e510ba72496e06770" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" },
|
||||
"astrocore": { "branch": "main", "commit": "0fcaac66d115948605c14eaf45a41d3923eaafeb" },
|
||||
"astrolsp": { "branch": "main", "commit": "2f6b0a4059775a1dac011d2944dd41fd4a8fe7a8" },
|
||||
"astrotheme": { "branch": "main", "commit": "e612ee356bbf42dc28f181cb966730ed3befb1ab" },
|
||||
"astroui": { "branch": "main", "commit": "58c4130bd15c28827eab19dcc20fb9483bf5cad8" },
|
||||
"better-escape.nvim": { "branch": "master", "commit": "199dcc2643dec5d8dbdab4ec672cf405224dcb3b" },
|
||||
"cloak.nvim": { "branch": "main", "commit": "648aca6d33ec011dc3166e7af3b38820d01a71e4" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-dap": { "branch": "master", "commit": "ea92773e84c0ad3288c3bc5e452ac91559669087" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"dial.nvim": { "branch": "master", "commit": "46b4375e84e8eb771129bff6b2b1e47746601ef9" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"django.nvim": { "branch": "master", "commit": "5931cb012f7bcbed7935cb69f70e608acda1ff4b" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "43b8f74e0b1e3f41e51f640f8efa3bcd401cea0d" },
|
||||
"emmet-vim": { "branch": "master", "commit": "6c511a8d7d2863066f32e25543e2bb99d505172c" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "0b04035bb7b3c83e999b9676e2fb46fd0aa9f910" },
|
||||
"guess-indent.nvim": { "branch": "main", "commit": "6cd61f7a600bb756e558627cd2e740302c58e32d" },
|
||||
"heirline.nvim": { "branch": "master", "commit": "cc359b628266cb9a84b2d71c883f2b99e16473a0" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "7c493713bc2cb392706866eeba53aaef6c8e9fc6" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "a700f1436d4a938b1a1a93c9962dc796afbaef4d" },
|
||||
"luvit-meta": { "branch": "main", "commit": "57d464c4acb5c2e66bd4145060f5dc9e96a7bbb7" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "43894adcf10bb1190c2184bd7c1750e8ea2b3dce" },
|
||||
"mason-null-ls.nvim": { "branch": "main", "commit": "2b8433f76598397fcc97318d410e0c4f7a4bea6a" },
|
||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" },
|
||||
"mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" },
|
||||
"mini.bufremove": { "branch": "main", "commit": "1ee294a97e091d3cf967974df622c0d887890dc2" },
|
||||
"neo-tree.nvim": { "branch": "main", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" },
|
||||
"neoconf.nvim": { "branch": "main", "commit": "24db302fe23c4c07233e4b9d79ebe1dd2d3c975b" },
|
||||
"neotest": { "branch": "master", "commit": "6d3d22cdad49999ef774ebe1bc250a4994038964" },
|
||||
"neotest-python": { "branch": "master", "commit": "a2861ab3c9a0bf75a56b11835c2bfc8270f5be7e" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "1f2bf17eddfdd45aed254b6922c6c68b933dba9e" },
|
||||
"nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "be7bd4c5f860c79da97af3a26d489af50babfd4b" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "4acf88d31b3a7a1a7f31e9c30bf2b23c6313abdb" },
|
||||
"nvim-dap": { "branch": "master", "commit": "cc92b054720a96170eca6bd9bdedd43d2b0a7a8a" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "dafd61d6533bd90ecf6e2a3a972298fdddc74d82" },
|
||||
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
|
||||
"nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" },
|
||||
"nvim-tabletops": { "branch": "master", "commit": "746b7c7812a2c5bfb5c358fe9d54666eb091cb56" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "7930b5f983c37bb07c9af27274334a7adcb3e5af" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "a5390706f510d39951dd581f6d2a972741b3fa26" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "f09be61d05bebcba85bb47be1931322d51b95644" },
|
||||
"nvim-window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
||||
"promise-async": { "branch": "main", "commit": "38a4575da9497326badd3995e768b4ccf0bb153e" },
|
||||
"resession.nvim": { "branch": "master", "commit": "cc819b0489938d03e4f3532a583354f0287c015b" },
|
||||
"smart-splits.nvim": { "branch": "master", "commit": "00fba7a0e912a8d82da91a3b6b11d641fa500bd8" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "022ff5594acccc8d90d2e46dc43994f7722ebdf7" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "46cf952fc115f4c2b98d4e208ed1e2dce08c9bf6" },
|
||||
"undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" },
|
||||
"vim-dadbod": { "branch": "master", "commit": "fe5a55e92b2dded7c404006147ef97fb073d8b1b" },
|
||||
"vim-dadbod-ui": { "branch": "master", "commit": "7f89265a84fc003ccfa500fd99b9fea9db2c75c7" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
|
||||
"vim-test": { "branch": "master", "commit": "8872ec0f788af934386b2aef0cd28a5c2b923146" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "9b365a6428a9633e3eeb34dbef1b791511c54f70" }
|
||||
}
|
||||
3
lua/.editorconfig
Normal file
3
lua/.editorconfig
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[*.lua]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
12
lua/community.lua
Normal file
12
lua/community.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
|
||||
|
||||
-- AstroCommunity: import any community modules here
|
||||
-- We import this file in `lazy_setup.lua` before the `plugins/` folder.
|
||||
-- This guarantees that the specs are processed before any user plugins.
|
||||
|
||||
---@type LazySpec
|
||||
return {
|
||||
"AstroNvim/astrocommunity",
|
||||
{ import = "astrocommunity.pack.lua" },
|
||||
-- import/override with your plugins folder
|
||||
}
|
||||
163
lua/helpers.lua
Normal file
163
lua/helpers.lua
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
local tele_status_ok, _ = pcall(require, "telescope")
|
||||
if not tele_status_ok then return end
|
||||
|
||||
local plen_status_ok, _ = pcall(require, "plenary")
|
||||
if not plen_status_ok then return end
|
||||
|
||||
local term_status_ok, _ = pcall(require, "toggleterm")
|
||||
if not term_status_ok then return end
|
||||
|
||||
local M = {}
|
||||
M.terminals = {}
|
||||
|
||||
local utils = require "telescope.utils"
|
||||
local pickers = require "telescope.pickers"
|
||||
local finders = require "telescope.finders"
|
||||
local make_entry = require "telescope.make_entry"
|
||||
local conf = require("telescope.config").values
|
||||
local Path = require "plenary.path"
|
||||
local toggleterm = require "toggleterm"
|
||||
local terms = require "toggleterm.terminal"
|
||||
|
||||
local function GetBaseDir(filePath)
|
||||
local sep = Path.path.sep
|
||||
if filePath:sub(1, #sep) == sep then
|
||||
return ""
|
||||
else
|
||||
return filePath:sub(1, string.find(filePath, sep))
|
||||
end
|
||||
end
|
||||
|
||||
local function file_exists(name)
|
||||
local f = io.open(name, "r")
|
||||
if f ~= nil then
|
||||
io.close(f)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function GetBaseName(filePath)
|
||||
if filePath:sub(-1) == Path.path.sep then filePath = filePath:sub(1, -2) end
|
||||
local pos = string.find(filePath, Path.path.sep)
|
||||
while pos ~= nil do
|
||||
filePath = string.sub(filePath, pos + 1)
|
||||
pos = string.find(filePath, Path.path.sep)
|
||||
end
|
||||
return filePath
|
||||
end
|
||||
|
||||
local function buf_in_cwd(bufname, cwd)
|
||||
if cwd:sub(-1) ~= Path.path.sep then cwd = cwd .. Path.path.sep end
|
||||
local bufname_prefix = bufname:sub(1, #cwd)
|
||||
return bufname_prefix == cwd
|
||||
end
|
||||
|
||||
M.oldfiles = function(opts)
|
||||
local current_buffer = vim.api.nvim_get_current_buf()
|
||||
local current_file = vim.api.nvim_buf_get_name(current_buffer)
|
||||
local results = {}
|
||||
|
||||
for _, buffer in ipairs(vim.split(vim.fn.execute ":buffers! t", "\n")) do
|
||||
local match = tonumber(string.match(buffer, "%s*(%d+)"))
|
||||
local open_by_lsp = string.match(buffer, "line 0$")
|
||||
if match and not open_by_lsp then
|
||||
local file = vim.api.nvim_buf_get_name(match)
|
||||
if vim.loop.fs_stat(file) and match ~= current_buffer then table.insert(results, file) end
|
||||
end
|
||||
end
|
||||
|
||||
for _, file in ipairs(vim.v.oldfiles) do
|
||||
local file_stat = vim.loop.fs_stat(file)
|
||||
if file_stat and file_stat.type == "file" and not vim.tbl_contains(results, file) and file ~= current_file then
|
||||
if GetBaseName(file) ~= ".env" then table.insert(results, file) end
|
||||
end
|
||||
end
|
||||
|
||||
local cwd = vim.loop.cwd()
|
||||
cwd = cwd .. utils.get_separator()
|
||||
results = vim.tbl_filter(function(file) return buf_in_cwd(file, cwd) end, results)
|
||||
|
||||
pickers
|
||||
.new(opts, {
|
||||
prompt_title = "Oldfiles from " .. GetBaseName(cwd),
|
||||
finder = finders.new_table {
|
||||
results = results,
|
||||
entry_maker = make_entry.gen_from_file(opts),
|
||||
},
|
||||
sorter = conf.file_sorter(opts),
|
||||
previewer = conf.file_previewer(opts),
|
||||
})
|
||||
:find()
|
||||
end
|
||||
|
||||
function M.select_terminal()
|
||||
local terminals = terms.get_all()
|
||||
if #terminals > 0 then
|
||||
vim.ui.select(terminals, {
|
||||
prompt = "Please select a terminal to open (or focus): ",
|
||||
format_item = function(term) return term.id .. ": " .. term:_display_name() end,
|
||||
}, function(term)
|
||||
if not term then return end
|
||||
if term:is_open() then
|
||||
term:focus()
|
||||
else
|
||||
term:open()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function M.toggle_term()
|
||||
if #terms.get_all() > 0 then terms.get_last_focused():toggle() end
|
||||
end
|
||||
|
||||
function M.term_horizontal()
|
||||
local term, _ = terms.get_or_create_term(8, "horizontal", "horizontal")
|
||||
term:toggle(8, "horizontal")
|
||||
end
|
||||
|
||||
function M.term_vertical()
|
||||
local term, _ = terms.get_or_create_term(9, "vertical", "vertical")
|
||||
term:toggle(80, "vertical")
|
||||
end
|
||||
|
||||
function M.term_float()
|
||||
local term, _ = terms.get_or_create_term(11, "float", "float")
|
||||
term:toggle(0, "float")
|
||||
end
|
||||
|
||||
function M.openMDfile(executable)
|
||||
local file = vim.api.nvim_buf_get_name(0)
|
||||
if executable then M.MDexecutable = executable end
|
||||
vim.api.nvim_command("terminal flatpak run " .. M.MDexecutable .. " " .. file)
|
||||
end
|
||||
|
||||
function M.compile_sass()
|
||||
local term_num = 12
|
||||
local term = terms.get(term_num, true)
|
||||
local dist = "dist/css"
|
||||
local file_name = "compile_at"
|
||||
|
||||
if file_exists(file_name) then
|
||||
local file_ = io.open(file_name, "r")
|
||||
|
||||
if file_ ~= nil then
|
||||
dist = file_:read()
|
||||
file_:close()
|
||||
end
|
||||
end
|
||||
|
||||
local cmd = "node ~/.local/lib/node_modules/sass/sass.js --watch sass:" .. dist .. " -s compressed --no-source-map"
|
||||
|
||||
if term then
|
||||
term:toggle()
|
||||
else
|
||||
toggleterm.exec(cmd, term_num, 100, ".", "float", "compile_sass")
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
-- vim: ts=4 sts=4 sw=4 expandtab
|
||||
32
lua/lazy_setup.lua
Normal file
32
lua/lazy_setup.lua
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
require("lazy").setup({
|
||||
{
|
||||
"AstroNvim/AstroNvim",
|
||||
version = "^4", -- Remove version tracking to elect for nightly AstroNvim
|
||||
import = "astronvim.plugins",
|
||||
opts = { -- AstroNvim options must be set here with the `import` key
|
||||
mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up
|
||||
maplocalleader = ",", -- This ensures the localleader key must be configured before Lazy is set up
|
||||
icons_enabled = true, -- Set to false to disable icons (if no Nerd Font is available)
|
||||
pin_plugins = nil, -- Default will pin plugins when tracking `version` of AstroNvim, set to true/false to override
|
||||
update_notifications = true, -- Enable/disable notification about running `:Lazy update` twice to update pinned plugins
|
||||
},
|
||||
},
|
||||
{ import = "community" },
|
||||
{ import = "plugins" },
|
||||
} --[[@as LazySpec]], {
|
||||
-- Configure any other `lazy.nvim` configuration options here
|
||||
install = { colorscheme = { "astrotheme", "habamax" } },
|
||||
ui = { backdrop = 100 },
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins, add more to your liking
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
} --[[@as LazyConfig]])
|
||||
89
lua/plugins/astrocore.lua
Normal file
89
lua/plugins/astrocore.lua
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
local listchars = function() vim.opt.listchars:append "space:⋅" end
|
||||
|
||||
---@type LazySpec
|
||||
return {
|
||||
"AstroNvim/astrocore",
|
||||
---@type AstroCoreOpts
|
||||
opts = {
|
||||
features = {
|
||||
large_buf = { size = 1024 * 256, lines = 10000 }, -- set global limits for large files for disabling features like treesitter
|
||||
autopairs = true, -- enable autopairs at start
|
||||
cmp = true, -- enable completion at start
|
||||
diagnostics_mode = 3, -- diagnostic mode on start (0 = off, 1 = no signs/virtual text, 2 = no virtual text, 3 = on)
|
||||
highlighturl = true, -- highlight URLs at start
|
||||
notifications = true, -- enable notifications at start
|
||||
},
|
||||
diagnostics = {
|
||||
virtual_text = true,
|
||||
underline = true,
|
||||
},
|
||||
options = {
|
||||
opt = { -- vim.opt.<key>
|
||||
relativenumber = true, -- sets vim.opt.relativenumber
|
||||
number = true, -- sets vim.opt.number
|
||||
spell = false, -- sets vim.opt.spell
|
||||
signcolumn = "yes", -- sets vim.opt.signcolumn to yes
|
||||
wrap = false, -- sets vim.opt.wrap
|
||||
rnu = true,
|
||||
autoindent = true,
|
||||
list = true,
|
||||
timeoutlen = 100,
|
||||
updatetime = 50,
|
||||
tabstop = 4,
|
||||
softtabstop = 4,
|
||||
shiftwidth = 4,
|
||||
},
|
||||
g = { -- vim.g.<key>
|
||||
autoformat_enabled = true, -- enable or disable auto formatting at start (lsp.formatting.format_on_save must be enabled)
|
||||
cmp_enabled = true, -- enable completion at start
|
||||
autopairs_enabled = true, -- enable autopairs at start
|
||||
diagnostics_mode = 3, -- set the visibility of diagnostics in the UI (0=off, 1=only show in status line, 2=virtual text off, 3=all on)
|
||||
icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available, requires :PackerSync after changing)
|
||||
ui_notifications_enabled = true, -- disable notifications when toggling UI elements
|
||||
},
|
||||
listchars(), -- comment this line if you don't want to render dots for empty spaces
|
||||
},
|
||||
mappings = {
|
||||
-- first key is the mode
|
||||
n = {
|
||||
-- navigate buffer tabs
|
||||
["]b"] = { function() require("astrocore.buffer").nav(vim.v.count1) end, desc = "Next buffer" },
|
||||
["[b"] = { function() require("astrocore.buffer").nav(-vim.v.count1) end, desc = "Previous buffer" },
|
||||
["<Leader>bd"] = {
|
||||
function()
|
||||
require("astroui.status.heirline").buffer_picker(
|
||||
function(bufnr) require("astrocore.buffer").close(bufnr) end
|
||||
)
|
||||
end,
|
||||
desc = "Close buffer from tabline",
|
||||
},
|
||||
|
||||
},
|
||||
},
|
||||
autocmds = {
|
||||
set_templ_to_format = {
|
||||
{
|
||||
event = { "BufEnter" },
|
||||
desc = "Set templ filetype to format",
|
||||
pattern = "*.templ",
|
||||
callback = function() vim.bo.filetype = "templ" end,
|
||||
},
|
||||
},
|
||||
set_html_to_format = {
|
||||
{
|
||||
event = { "BufReadPost" },
|
||||
desc = "Set html filetype to htmldjango format",
|
||||
pattern = "*.html",
|
||||
callback = function() vim.bo.filetype = "htmldjango" end,
|
||||
},
|
||||
},
|
||||
highlight_yank = {
|
||||
{
|
||||
event = { "TextYankPost" },
|
||||
desc = "Highlight on yank",
|
||||
callback = function() vim.highlight.on_yank() end,
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
99
lua/plugins/astrolsp.lua
Normal file
99
lua/plugins/astrolsp.lua
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
---@type LazySpec
|
||||
return {
|
||||
"AstroNvim/astrolsp",
|
||||
---@type AstroLSPOpts
|
||||
opts = {
|
||||
-- Configuration table of features provided by AstroLSP
|
||||
features = {
|
||||
autoformat = true, -- enable or disable auto formatting on start
|
||||
codelens = true, -- enable/disable codelens refresh on start
|
||||
inlay_hints = false, -- enable/disable inlay hints on start
|
||||
semantic_tokens = true, -- enable/disable semantic token highlighting
|
||||
},
|
||||
-- customize lsp formatting options
|
||||
formatting = {
|
||||
-- control auto formatting on save
|
||||
format_on_save = {
|
||||
enabled = true, -- enable or disable format on save globally
|
||||
allow_filetypes = { -- enable format on save for specified filetypes only
|
||||
"go",
|
||||
"python",
|
||||
"rust",
|
||||
},
|
||||
ignore_filetypes = { -- disable format on save for specified filetypes
|
||||
-- "python",
|
||||
"htmldjango",
|
||||
"html",
|
||||
},
|
||||
},
|
||||
disabled = { -- disable formatting capabilities for the listed language servers
|
||||
-- disable lua_ls formatting capability if you want to use StyLua to format your lua code
|
||||
-- "lua_ls",
|
||||
},
|
||||
timeout_ms = 10000, -- default format timeout
|
||||
-- filter = function(client) -- fully override the default formatting function
|
||||
-- return true
|
||||
-- end
|
||||
},
|
||||
-- enable servers that you already have installed without mason
|
||||
servers = {
|
||||
-- "pyright"
|
||||
},
|
||||
-- customize language server configuration options passed to `lspconfig`
|
||||
---@diagnostic disable: missing-fields
|
||||
config = {
|
||||
-- clangd = { capabilities = { offsetEncoding = "utf-8" } },
|
||||
},
|
||||
-- customize how language servers are attached
|
||||
handlers = {
|
||||
-- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server
|
||||
-- function(server, opts) require("lspconfig")[server].setup(opts) end
|
||||
|
||||
-- the key is the server that is being setup with `lspconfig`
|
||||
-- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server
|
||||
-- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed
|
||||
},
|
||||
autocmds = {
|
||||
lsp_document_highlight = {
|
||||
cond = "textDocument/documentHighlight",
|
||||
{
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
desc = "Document Highlighting",
|
||||
callback = function() vim.lsp.buf.document_highlight() end,
|
||||
},
|
||||
{
|
||||
event = { "CursorMoved", "CursorMovedI", "BufLeave" },
|
||||
desc = "Document Highlighting Clear",
|
||||
callback = function() vim.lsp.buf.clear_references() end,
|
||||
},
|
||||
},
|
||||
lsp_codelens_refresh = {
|
||||
cond = "textDocument/codeLens",
|
||||
{
|
||||
event = { "InsertLeave", "BufEnter" },
|
||||
desc = "Refresh codelens (buffer)",
|
||||
callback = function(args)
|
||||
if require("astrolsp").config.features.codelens then vim.lsp.codelens.refresh { bufnr = args.buf } end
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
mappings = {
|
||||
n = {
|
||||
gD = {
|
||||
function() vim.lsp.buf.declaration() end,
|
||||
desc = "Declaration of current symbol",
|
||||
cond = "textDocument/declaration",
|
||||
},
|
||||
["<Leader>uY"] = {
|
||||
function() require("astrolsp.toggles").buffer_semantic_tokens() end,
|
||||
desc = "Toggle LSP semantic highlight (buffer)",
|
||||
cond = function(client)
|
||||
return client.supports_method "textDocument/semanticTokens/full" and vim.lsp.semantic_tokens ~= nil
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
on_attach = function(client, bufnr) end,
|
||||
},
|
||||
}
|
||||
31
lua/plugins/astroui.lua
Normal file
31
lua/plugins/astroui.lua
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
return {
|
||||
"AstroNvim/astroui",
|
||||
---@type AstroUIOpts
|
||||
opts = {
|
||||
-- change colorscheme
|
||||
colorscheme = "astrodark",
|
||||
-- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes
|
||||
highlights = {
|
||||
init = { -- this table overrides highlights in all themes
|
||||
-- Normal = { bg = "#000000" },
|
||||
},
|
||||
astrodark = { -- a table of overrides/changes when applying the astrotheme theme
|
||||
-- Normal = { bg = "#000000" },
|
||||
},
|
||||
},
|
||||
-- Icons can be configured throughout the interface
|
||||
icons = {
|
||||
-- configure the loading of the lsp in the status line
|
||||
LSPLoading1 = "⠋",
|
||||
LSPLoading2 = "⠙",
|
||||
LSPLoading3 = "⠹",
|
||||
LSPLoading4 = "⠸",
|
||||
LSPLoading5 = "⠼",
|
||||
LSPLoading6 = "⠴",
|
||||
LSPLoading7 = "⠦",
|
||||
LSPLoading8 = "⠧",
|
||||
LSPLoading9 = "⠇",
|
||||
LSPLoading10 = "⠏",
|
||||
},
|
||||
},
|
||||
}
|
||||
10
lua/plugins/dadbod.lua
Normal file
10
lua/plugins/dadbod.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
"kristijanhusak/vim-dadbod-ui",
|
||||
dependencies = {
|
||||
{ "tpope/vim-dadbod", lazy = true },
|
||||
-- { "kristijanhusak/vim-dadbod-completion", lazy = true },
|
||||
},
|
||||
init = function()
|
||||
vim.g.db_ui_use_nerd_fonts = 1
|
||||
end,
|
||||
}
|
||||
57
lua/plugins/dial.lua
Normal file
57
lua/plugins/dial.lua
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
return {
|
||||
{
|
||||
"monaqa/dial.nvim",
|
||||
config = function()
|
||||
local augend = require "dial.augend"
|
||||
require("dial.config").augends:register_group {
|
||||
default = {
|
||||
augend.constant.new {
|
||||
elements = { "and", "or" },
|
||||
word = true,
|
||||
cyclic = true,
|
||||
},
|
||||
augend.constant.new {
|
||||
elements = { "true", "false" },
|
||||
word = true,
|
||||
cyclic = true,
|
||||
},
|
||||
augend.constant.new {
|
||||
elements = { "True", "False" },
|
||||
word = true,
|
||||
cyclic = true,
|
||||
},
|
||||
augend.constant.new {
|
||||
elements = { "&&", "||" },
|
||||
word = false,
|
||||
cyclic = true,
|
||||
},
|
||||
augend.constant.new {
|
||||
elements = { "&", "|" },
|
||||
word = false,
|
||||
cyclic = true,
|
||||
},
|
||||
augend.constant.new {
|
||||
elements = { "y/n", "n/y" },
|
||||
word = false,
|
||||
cyclic = true,
|
||||
},
|
||||
augend.constant.new {
|
||||
elements = { "yes", "no" },
|
||||
word = false,
|
||||
cyclic = true,
|
||||
},
|
||||
augend.constant.new {
|
||||
elements = { "get", "post", "put", "patch", "delete" },
|
||||
word = false,
|
||||
cyclic = true,
|
||||
},
|
||||
augend.constant.new {
|
||||
elements = { "GET", "POST", "PUT", "PATCH", "DELETE" },
|
||||
word = false,
|
||||
cyclic = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
8
lua/plugins/django.lua
Normal file
8
lua/plugins/django.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
{
|
||||
"https://git.lucasf.dev/public/django.nvim",
|
||||
config = function()
|
||||
local django = require("django").setup()
|
||||
end
|
||||
}
|
||||
}
|
||||
133
lua/plugins/mappings.lua
Normal file
133
lua/plugins/mappings.lua
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
local astro = require "astrocore"
|
||||
|
||||
return {
|
||||
{
|
||||
"AstroNvim/astrocore",
|
||||
---@type AstroCoreOpts
|
||||
opts = {
|
||||
mappings = {
|
||||
n = {
|
||||
--essentials
|
||||
["d"] = { "_d" },
|
||||
["<esc>"] = { "<Nop>" },
|
||||
["<C-z>"] = { "<Nop>" },
|
||||
["G"] = { "Gzz" },
|
||||
["<C-t>"] = { "ggVG<cr>", desc = "select all" },
|
||||
["<leader>W"] = { "<cmd>w<cr>", desc = "Save" },
|
||||
["<S-s>"] = { "ciw", desc = "replace word" },
|
||||
["<S-r>"] = { "cc", desc = "replace line" },
|
||||
["<M-s>"] = { "viw", desc = "select word" },
|
||||
["<M-y>"] = { "viwy", desc = "copy word" },
|
||||
["<M-p>"] = { "viwpgvy", desc = "replace word by copied word" },
|
||||
["<C-n>"] = { require("dial.map").inc_normal(), desc = "dial increment" },
|
||||
["<A-j>"] = { ":m .+1<CR>==" },
|
||||
["<A-k>"] = { ":m .-2<CR>==" },
|
||||
["<M-o>"] = { "o<esc>p" },
|
||||
["<S-y>"] = { "0v$y", desc = "copy entire row" },
|
||||
["<C-]>"] = { "<cmd>tabNext<cr>", desc = "move to next Tab" },
|
||||
["<C-[>"] = { "<cmd>tabprevious<cr>", desc = "move to previous Tab" },
|
||||
["<CS-]>"] = { "<cmd>cnext<cr>", desc = "next quickfix" },
|
||||
["<leader>fl"] = { function() require('helpers').oldfiles({}) end, desc = "find oldfiles" },
|
||||
--git
|
||||
["<leader>gy"] = { "<cmd>DiffviewFileHistory %<cr>", desc = "Git file diff history" },
|
||||
["<leader>gY"] = { "<cmd>DiffviewFileHistory<cr>", desc = "Git diff history" },
|
||||
--tabs
|
||||
["<tab>"] = { function() require("astrocore.buffer").nav(vim.v.count1) end, desc = "Next buffer" },
|
||||
["<S-tab>"] = { function() require("astrocore.buffer").nav(-vim.v.count1) end, desc = "Previous buffer" },
|
||||
["<leader>bt"] = { "<cmd>tabclose<cr>", desc = "Close tab" },
|
||||
--window moviment
|
||||
["<C-h>"] = { "<C-w>h", desc = "Go to left window" },
|
||||
["<C-l>"] = { "<C-w>l", desc = "Go to right window" },
|
||||
["<C-j>"] = { "<C-w>j", desc = "Go to lower window" },
|
||||
["<C-k>"] = { "<C-w>k", desc = "Go to upper window" },
|
||||
-- split window
|
||||
["|"] = { "<C-w>v", desc = "Vertical Split" },
|
||||
["\\"] = { "<C-w>s", desc = "Horizontal Split" },
|
||||
--terminals get or create
|
||||
-- ["<C-\\>"] = { "<cmd>ToggleTerm<cr>" },
|
||||
["<C-\\>"] = { function() require("helpers").toggle_term() end, desc = "Toggle Terminal" },
|
||||
["<c-;>"] = { function() require("helpers").select_terminal() end, desc = "List All opened terminals" },
|
||||
["<M-1>"] = {
|
||||
function() require("helpers").term_horizontal() end,
|
||||
desc = "Horizontal Terminal",
|
||||
},
|
||||
["<M-2>"] = {
|
||||
function() require("helpers").term_vertical() end,
|
||||
desc = "Vertical Terminal",
|
||||
},
|
||||
["<M-3>"] = {
|
||||
function() require("helpers").term_float() end,
|
||||
desc = "Float Terminal",
|
||||
},
|
||||
--buffers
|
||||
["<leader>b"] = { name = "Buffers" },
|
||||
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
|
||||
-- navigate buffer tabs with `H` and `L`
|
||||
L = { function() require("astrocore.buffer").nav(vim.v.count1) end, desc = "Next buffer" },
|
||||
H = { function() require("astrocore.buffer").nav(-vim.v.count1) end, desc = "Previous buffer" },
|
||||
["<Leader>bD"] = {
|
||||
function()
|
||||
require("astroui.status.heirline").buffer_picker(
|
||||
function(bufnr) require("astrocore.buffer").close(bufnr) end
|
||||
)
|
||||
end,
|
||||
desc = "Pick to close",
|
||||
},
|
||||
--user extra commands
|
||||
["<leader>kd"] = {desc =" Database commands"},
|
||||
["<leader>kdu"] = {"<cmd>DBUIToggle<cr>",desc ="Toggle ui"},
|
||||
["<leader>kda"] = {"<cmd>DBUIAddConnection<cr>",desc ="Add connection"},
|
||||
["<leader>k"] = { desc = " User extra commands" },
|
||||
["<leader>kr"] = { "<cmd>lua require('helpers').openMDfile()<cr>", desc = "Open md file in glow" },
|
||||
["<leader>km"] = {
|
||||
"<cmd>lua require('helpers').openMDfile(\"com.github.marktext.marktext\")<cr>",
|
||||
desc = "Open md file in MarkText",
|
||||
},
|
||||
["<leader>kj"] = { "<cmd>set ft=htmldjango<cr>", desc = "set ft=htmldjango" },
|
||||
["<leader>kh"] = { "<cmd>set ft=html<cr>", desc = "set ft=html" },
|
||||
["<leader>kt"] = { "<cmd>set ft=templ<cr>", desc = "set ft=templ" },
|
||||
["<leader>ke"] = {"<cmd>redir! > error_messages | silent messages | redir END | edit!<CR>", desc = "Create error_messages file with vim messages"},
|
||||
--terminal compile sass to css
|
||||
["<leader>ts"] = {
|
||||
function() require("helpers").compile_sass() end,
|
||||
desc = "compile sass to css.",
|
||||
},
|
||||
--python test
|
||||
["<leader>T"] = { desc = " Tests" },
|
||||
["<leader>Tr"] = { "<cmd>lua require('neotest').run.run()<cr>", desc = "Run test" },
|
||||
["<leader>Tf"] = { "<cmd>lua require('neotest').run.run(vim.fn.expand('%'))<cr>", desc = "Run test expand" },
|
||||
["<leader>Td"] = { "<cmd>lua require('neotest').run.run({strategy = 'dap'})<cr>", desc = "Run test dap" },
|
||||
["<leader>Ts"] = { "<cmd>lua require('neotest').summary.toggle()<cr>", desc = "Toggle test summary" },
|
||||
["<leader>Tp"] = { "<cmd>lua require('neotest').output_panel.toggle()<cr>", desc = "Toggle output panel" },
|
||||
--trouble
|
||||
["<leader>xx"] = { function() require("trouble").toggle() end, desc = "Trouble toggle" },
|
||||
["<leader>xw"] = {
|
||||
function() require("trouble").toggle "workspace_diagnostics" end,
|
||||
desc = "Trouble Workspace",
|
||||
},
|
||||
["<leader>xd"] = {
|
||||
function() require("trouble").toggle "document_diagnostics" end,
|
||||
desc = "Trouble Document",
|
||||
},
|
||||
["<leader>xq"] = { function() require("trouble").toggle "quickfix" end, desc = "Trouble Quickfix" },
|
||||
["<leader>xl"] = { function() require("trouble").toggle "loclist" end, desc = "Trouble Location" },
|
||||
["gR"] = { function() require("trouble").toggle "lsp_references" end, desc = "Trouble LSP References" },
|
||||
},
|
||||
t = {
|
||||
["<C-\\>"] = { "<cmd>ToggleTerm<cr>" },
|
||||
},
|
||||
v = {
|
||||
["<S-s>"] = { "ciw", desc = "select word" },
|
||||
["<"] = { "<gv" },
|
||||
[">"] = { ">gv" },
|
||||
["p"] = { "pgvy" },
|
||||
["d"] = { "_d" },
|
||||
},
|
||||
x = {
|
||||
["<A-j>"] = { ":m '>+1<CR>gv-gv" },
|
||||
["<A-k>"] = { ":m '<-2<CR>gv-gv" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
56
lua/plugins/mason.lua
Normal file
56
lua/plugins/mason.lua
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
---@type LazySpec
|
||||
return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
require("lspconfig").pyright.setup {
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
autoSearchPaths = true,
|
||||
diagnosticMode = "workspace",
|
||||
useLibraryCodeForTypes = true,
|
||||
typeCheckingMode = "off",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"pyright",
|
||||
"html",
|
||||
"jsonls",
|
||||
"cssls",
|
||||
"gopls",
|
||||
"bashls",
|
||||
"tailwindcss",
|
||||
"templ",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"jay-babu/mason-null-ls.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"prettier",
|
||||
"stylua",
|
||||
"djlint",
|
||||
"isort",
|
||||
"black",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"python",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
152
lua/plugins/neotree.lua
Normal file
152
lua/plugins/neotree.lua
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
local get_icon = require("astroui").get_icon
|
||||
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
dependencies = { "MunifTanjim/nui.nvim" },
|
||||
cmd = "Neotree",
|
||||
opts = {
|
||||
auto_clean_after_session_restore = true,
|
||||
close_if_last_window = false,
|
||||
source_selector = {
|
||||
winbar = false,
|
||||
content_layout = "center",
|
||||
},
|
||||
default_component_configs = {
|
||||
indent = {
|
||||
indent_size = 2,
|
||||
padding = 1, -- extra padding on left hand side
|
||||
with_markers = true,
|
||||
indent_marker = "│",
|
||||
last_indent_marker = "└",
|
||||
highlight = "NeoTreeIndentMarker",
|
||||
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders
|
||||
expander_collapsed = "",
|
||||
expander_expanded = "",
|
||||
expander_highlight = "NeoTreeExpander",
|
||||
},
|
||||
modified = { symbol = get_icon "FileModified" },
|
||||
name = {
|
||||
trailing_slash = false,
|
||||
use_git_status_colors = true,
|
||||
highlight = "NeoTreeFileName",
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
added = get_icon "GitAdd",
|
||||
deleted = get_icon "GitDelete",
|
||||
modified = get_icon "GitChange",
|
||||
renamed = get_icon "GitRenamed",
|
||||
untracked = "",
|
||||
ignored = get_icon "GitIgnored",
|
||||
unstaged = get_icon "GitUnstaged",
|
||||
staged = get_icon "GitStaged",
|
||||
conflict = get_icon "GitConflict",
|
||||
},
|
||||
},
|
||||
},
|
||||
window = {
|
||||
width = 35,
|
||||
mappings = {
|
||||
["<space>"] = false, -- disable space until we figure out which-key disabling
|
||||
["[b"] = "prev_source",
|
||||
["]b"] = "next_source",
|
||||
o = "open",
|
||||
O = "system_open",
|
||||
h = "parent_or_close",
|
||||
l = "child_or_open",
|
||||
Y = "copy_selector",
|
||||
},
|
||||
},
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
visible = true, -- when true, they will just be displayed differently than normal items
|
||||
hide_dotfiles = false,
|
||||
hide_gitignored = false,
|
||||
hide_hidden = false, -- only works on Windows for hidden files/directories
|
||||
hide_by_name = {
|
||||
--"node_modules"
|
||||
},
|
||||
hide_by_pattern = { -- uses glob style patterns
|
||||
--"*.meta",
|
||||
--"*/src/*/tsconfig.json",
|
||||
"*_templ.go",
|
||||
},
|
||||
always_show = { -- remains visible even if other settings would normally hide it
|
||||
--".gitignored",
|
||||
},
|
||||
never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show
|
||||
--".DS_Store",
|
||||
--"thumbs.db"
|
||||
},
|
||||
never_show_by_pattern = { -- uses glob style patterns
|
||||
--".null-ls_*",
|
||||
},
|
||||
},
|
||||
follow_current_file = {
|
||||
enabled = true,
|
||||
},
|
||||
hijack_netrw_behavior = "open_current",
|
||||
use_libuv_file_watcher = true,
|
||||
commands = {
|
||||
delete = function(state)
|
||||
local tree = state.tree
|
||||
local node = tree:get_node()
|
||||
local log = require "neo-tree.log"
|
||||
local inputs = require "neo-tree.ui.inputs"
|
||||
|
||||
local msg = string.format("Are you sure you want to delete '%s'?", node.name)
|
||||
local do_delete_ = function(confirmed)
|
||||
if not confirmed then return end
|
||||
vim.fn.system { "gio", "trash", node.path }
|
||||
end
|
||||
|
||||
if node.type == "file" or node.type == "directory" then
|
||||
inputs.confirm(msg, do_delete_)
|
||||
else
|
||||
log.warn "The `delete` command can only be used on files and directories"
|
||||
end
|
||||
end,
|
||||
delete_visual = function(state, selected_nodes)
|
||||
local paths_to_delete = {}
|
||||
local inputs = require "neo-tree.ui.inputs"
|
||||
|
||||
for _, node_to_delete in pairs(selected_nodes) do
|
||||
if node_to_delete.type == "file" or node_to_delete.type == "directory" then
|
||||
table.insert(paths_to_delete, node_to_delete.path)
|
||||
end
|
||||
end
|
||||
|
||||
local msg = "Are you sure you want to delete " .. #paths_to_delete .. " items?"
|
||||
local do_delete_ = function(confirmed)
|
||||
if not confirmed then return end
|
||||
for _, path in pairs(paths_to_delete) do
|
||||
vim.fn.system { "gio", "trash", path }
|
||||
end
|
||||
end
|
||||
inputs.confirm(msg, do_delete_)
|
||||
end,
|
||||
},
|
||||
},
|
||||
buffers = {
|
||||
follow_current_file = {
|
||||
enabled = true,
|
||||
}, -- This will find and focus the file in the active buffer every
|
||||
-- time the current file is changed while the tree is open.
|
||||
group_empty_dirs = true, -- when true, empty folders will be grouped together
|
||||
show_unloaded = true,
|
||||
window = {
|
||||
mappings = {
|
||||
["bd"] = "buffer_delete",
|
||||
["<bs>"] = "navigate_up",
|
||||
["."] = "set_root",
|
||||
},
|
||||
},
|
||||
},
|
||||
event_handlers = {
|
||||
{
|
||||
event = "neo_tree_buffer_enter",
|
||||
handler = function(_) vim.opt_local.signcolumn = "auto" end,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
24
lua/plugins/none-ls.lua
Normal file
24
lua/plugins/none-ls.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
|
||||
|
||||
-- Customize None-ls sources
|
||||
|
||||
---@type LazySpec
|
||||
return {
|
||||
"nvimtools/none-ls.nvim",
|
||||
opts = function(_, opts)
|
||||
-- opts variable is the default configuration table for the setup function call
|
||||
-- local null_ls = require "null-ls"
|
||||
|
||||
-- Check supported formatters and linters
|
||||
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||
|
||||
-- Only insert new sources, do not replace the existing ones
|
||||
-- (If you wish to replace, use `opts.sources = {}` instead of the `list_insert_unique` function)
|
||||
opts.sources = require("astrocore").list_insert_unique(opts.sources, {
|
||||
-- Set a formatter
|
||||
-- null_ls.builtins.formatting.stylua,
|
||||
-- null_ls.builtins.formatting.prettier,
|
||||
})
|
||||
end,
|
||||
}
|
||||
31
lua/plugins/treesitter.lua
Normal file
31
lua/plugins/treesitter.lua
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
---@type LazySpec
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"lua",
|
||||
"vim",
|
||||
"python",
|
||||
"comment",
|
||||
"dockerfile",
|
||||
"bash",
|
||||
"css",
|
||||
"scss",
|
||||
"gitcommit",
|
||||
"gitignore",
|
||||
"gitattributes",
|
||||
"html",
|
||||
"htmldjango",
|
||||
"javascript",
|
||||
"json",
|
||||
"markdown",
|
||||
"mermaid",
|
||||
"sql",
|
||||
"toml",
|
||||
"vim",
|
||||
"yaml",
|
||||
"go",
|
||||
"templ",
|
||||
},
|
||||
},
|
||||
}
|
||||
252
lua/plugins/user.lua
Normal file
252
lua/plugins/user.lua
Normal file
|
|
@ -0,0 +1,252 @@
|
|||
---@type LazySpec
|
||||
return {
|
||||
{
|
||||
"goolord/alpha-nvim",
|
||||
opts = function(_, opts)
|
||||
opts.section.header.val = {
|
||||
|
||||
" .-=*##%%+=* **+@@%%#+-: ",
|
||||
" -%@@@@@@@%++--: ---++#@@@@@@@@+ ",
|
||||
" *@@@@@@@@@@@@@@@%- =%@@@@@@@@@@@@@@@* ",
|
||||
" .@@@@@@@@#@@@@@@@@#. .#@@@@@@@@#@@@@@@@@: ",
|
||||
" =@@@@@@%=-*@@@%%@@@- -@@@%%@@@*-=#@@@@@@* ",
|
||||
" %@@@@@%-+--*%+--*@@+ +@@*=-=%*--+=*@@@@@@. ",
|
||||
" -@@@@@@--*+-------+#* *%+-------=*--#@@@@@= ",
|
||||
" +@@@%=---++--------=- ==--------++----#@@@# ",
|
||||
" #@@------=+---------.=---------+=------@@% ",
|
||||
" #@--------+--------=---------+=-------%%. ",
|
||||
" +*----=+**#=------=--------#**++----+* ",
|
||||
" -#+-------==-----=------=+-------=#= ",
|
||||
" +%=------=+----------==-------## ",
|
||||
" -%+------=*---.:---+=------=@= ",
|
||||
" : :-----*-. .-*=----:. .. ",
|
||||
" ..:::::.-: .-.:::::.. ",
|
||||
" ",
|
||||
"██╗ ██╗██╗ ██╗██████╗ ██╗ ██╗███╗ ██╗██╗ ██╗██╗███╗ ███╗",
|
||||
"██║ ██╔╝██║ ██║██╔══██╗██║ ██║████╗ ██║██║ ██║██║████╗ ████║",
|
||||
"█████╔╝ ██║ ██║██████╔╝██║ ██║██╔██╗ ██║██║ ██║██║██╔████╔██║",
|
||||
"██╔═██╗ ██║ ██║██╔══██╗██║ ██║██║╚██╗██║╚██╗ ██╔╝██║██║╚██╔╝██║",
|
||||
"██║ ██╗╚██████╔╝██║ ██║╚██████╔╝██║ ╚████║ ╚████╔╝ ██║██║ ╚═╝ ██║",
|
||||
"╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═══╝ ╚═╝╚═╝ ╚═╝",
|
||||
}
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
config = function(plugin, opts)
|
||||
require "astronvim.plugins.configs.luasnip"(plugin, opts)
|
||||
local luasnip = require "luasnip"
|
||||
luasnip.filetype_extend("javascript", { "javascriptreact" })
|
||||
require("luasnip.loaders.from_lua").lazy_load()
|
||||
require("luasnip.loaders.from_vscode").lazy_load {
|
||||
paths = vim.fn.stdpath "config" .. "/lua/snippets",
|
||||
}
|
||||
require("luasnip.loaders.from_snipmate").lazy_load()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
config = function(plugin, opts)
|
||||
require "astronvim.plugins.configs.nvim-autopairs"(plugin, opts)
|
||||
local npairs = require "nvim-autopairs"
|
||||
local Rule = require "nvim-autopairs.rule"
|
||||
local cond = require "nvim-autopairs.conds"
|
||||
npairs.add_rules(
|
||||
{
|
||||
Rule("$", "$", { "tex", "latex" })
|
||||
-- don't add a pair if the next character is %
|
||||
:with_pair(cond.not_after_regex "%%")
|
||||
-- don't add a pair if the previous character is xxx
|
||||
:with_pair(
|
||||
cond.not_before_regex("xxx", 3)
|
||||
)
|
||||
-- don't move right when repeat character
|
||||
:with_move(cond.none())
|
||||
-- don't delete if the next character is xx
|
||||
:with_del(cond.not_after_regex "xx")
|
||||
-- disable adding a newline when you press <cr>
|
||||
:with_cr(cond.none()),
|
||||
},
|
||||
-- disable for .vim files, but it work for another filetypes
|
||||
Rule("a", "a", "-vim")
|
||||
)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
dependencies = { "nvim-dap" },
|
||||
opts = function(_, opts)
|
||||
local venv_path = os.getenv "VIRTUAL_ENV" or os.getenv "CONDA_PREFIX"
|
||||
require "astronvim."
|
||||
opts.ensure_installed = require("astrocore").extend_tbl(opts.ensure_installed, {
|
||||
"python",
|
||||
"stylua",
|
||||
"delve",
|
||||
})
|
||||
opts.handlers = {
|
||||
function(config)
|
||||
require("mason-nvim-dap").default_setup(config)
|
||||
end,
|
||||
python = function(config)
|
||||
config.adapters = {
|
||||
type = "executable",
|
||||
command = vim.fn.exepath "debugpy-adapter",
|
||||
}
|
||||
config.configurations = {
|
||||
{
|
||||
type = "python",
|
||||
request = "launch",
|
||||
name = "Python: Django",
|
||||
program = "${workspaceFolder}/manage.py",
|
||||
pythonPath = venv_path and (venv_path .. "/bin/python") or nil,
|
||||
console = "integratedTerminal",
|
||||
args = { "runserver", "--noreload", "--nothreading" },
|
||||
django = true,
|
||||
justMyCode = false,
|
||||
},
|
||||
{
|
||||
type = "python",
|
||||
request = "launch",
|
||||
name = "Python: Launch file",
|
||||
program = "${file}",
|
||||
pythonPath = venv_path and (venv_path .. "/bin/python") or nil,
|
||||
console = "integratedTerminal",
|
||||
},
|
||||
{
|
||||
type = "python",
|
||||
request = "launch",
|
||||
name = "Python: Launch package",
|
||||
program = "${workspaceFolder}/main.py",
|
||||
pythonPath = venv_path and (venv_path .. "/bin/python") or nil,
|
||||
console = "integratedTerminal",
|
||||
},
|
||||
}
|
||||
require("mason-nvim-dap").default_setup(config) -- don't forget this!
|
||||
end,
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mattn/emmet-vim",
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
"vim-test/vim-test",
|
||||
},
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
dependencies = {
|
||||
"vim-test/vim-test",
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"antoinemadec/FixCursorHold.nvim",
|
||||
"nvim-neotest/neotest-python",
|
||||
},
|
||||
opts = function(_, opts)
|
||||
local venv_path = os.getenv "VIRTUAL_ENV" or os.getenv "CONDA_PREFIX"
|
||||
opts.adapters = {
|
||||
require "neotest-python" {
|
||||
dap = {
|
||||
justMyCode = false,
|
||||
program = "${workspaceFolder}/manage.py",
|
||||
python = venv_path and (venv_path .. "/bin/python") or nil,
|
||||
args = { "test" },
|
||||
},
|
||||
runner = "pytest",
|
||||
is_test_file = function(file_path)
|
||||
if file_path:match "tests.py" or file_path:match "test_.+.py$" or file_path:match "^.+_tests.py$" then
|
||||
return file_path
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<M-t>",
|
||||
function() require("neotest").summary.toggle() end,
|
||||
desc = "Toggle test summary",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = function(_, opts)
|
||||
opts.keywords = {
|
||||
FIX = {
|
||||
icon = " ", -- icon used for the sign, and in search results
|
||||
color = "error", -- can be a hex color, or a named color (see below)
|
||||
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
|
||||
},
|
||||
TODO = { icon = " ", color = "info" },
|
||||
HACK = { icon = " ", color = "warning" },
|
||||
WARN = { icon = " ", color = "warning", alt = { "XXX" } },
|
||||
PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
|
||||
NOTE = { icon = " ", color = "hint", alt = { "NOTE" } },
|
||||
TEST = { icon = " ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
|
||||
}
|
||||
opts.signs = true
|
||||
opts.sign_priority = 8
|
||||
opts.merge_keywords = true
|
||||
opts.pattern = [[(KEYWORDS):]]
|
||||
return opts
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>xt", "<cmd>TodoTrouble<cr>", desc = "Todo (Trouble)" },
|
||||
},
|
||||
},
|
||||
{ "ralismark/nvim-tabletops", lazy = false },
|
||||
{ "sindrets/diffview.nvim", lazy = false },
|
||||
{ "theHamsta/nvim-dap-virtual-text" },
|
||||
{
|
||||
"laytan/cloak.nvim",
|
||||
lazy = false,
|
||||
opts = {
|
||||
enabled = true,
|
||||
cloak_character = "🔐",
|
||||
highlight_group = "Comment",
|
||||
cloak_length = 1,
|
||||
try_all_patterns = true,
|
||||
patterns = {
|
||||
{
|
||||
|
||||
file_pattern = ".env*",
|
||||
cloak_pattern = "=.+",
|
||||
replace = nil,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"Exafunction/codeium.vim",
|
||||
enabled=false,
|
||||
event = "BufEnter",
|
||||
config = function()
|
||||
vim.keymap.set("i", "<C-g>", function() return vim.fn["codeium#Accept"]() end, { expr = true, silent = true })
|
||||
vim.keymap.set(
|
||||
"i",
|
||||
"<c-;>",
|
||||
function() return vim.fn["codeium#CycleCompletions"](1) end,
|
||||
{ expr = true, silent = true }
|
||||
)
|
||||
vim.keymap.set(
|
||||
"i",
|
||||
"<c-,>",
|
||||
function() return vim.fn["codeium#CycleCompletions"](-1) end,
|
||||
{ expr = true, silent = true }
|
||||
)
|
||||
vim.keymap.set("i", "<c-x>", function() return vim.fn["codeium#Clear"]() end, { expr = true, silent = true })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"mbbill/undotree",
|
||||
config = function() vim.keymap.set("n", "<leader>ku", vim.cmd.UndotreeToggle) end,
|
||||
}
|
||||
}
|
||||
18
lua/polish.lua
Normal file
18
lua/polish.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
if true then return end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
|
||||
|
||||
-- This will run last in the setup process and is a good place to configure
|
||||
-- things like custom filetypes. This is just pure lua so anything that doesn't
|
||||
-- fit in the normal config locations above can go here
|
||||
|
||||
-- Set up custom filetypes
|
||||
vim.filetype.add {
|
||||
extension = {
|
||||
foo = "fooscript",
|
||||
},
|
||||
filename = {
|
||||
["Foofile"] = "fooscript",
|
||||
},
|
||||
pattern = {
|
||||
["~/%.config/foo/.*"] = "fooscript",
|
||||
},
|
||||
}
|
||||
13673
lua/snippets/bootstrap.json
Normal file
13673
lua/snippets/bootstrap.json
Normal file
File diff suppressed because it is too large
Load diff
512
lua/snippets/django-python.json
Executable file
512
lua/snippets/django-python.json
Executable file
|
|
@ -0,0 +1,512 @@
|
|||
{
|
||||
"mauto": {
|
||||
"prefix": "mauto",
|
||||
"description": "AutoField (mauto) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.AutoField()"
|
||||
]
|
||||
},
|
||||
"mbigint": {
|
||||
"prefix": "mbigint",
|
||||
"description": "BigIntegerField (mbigint) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.BigIntegerField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mbool": {
|
||||
"prefix": "mbool",
|
||||
"description": "BooleanField (mbool) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.BooleanField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mchar": {
|
||||
"prefix": "mchar",
|
||||
"description": "CharField (mchar) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.CharField(${DESCRICAO}, max_length=50)"
|
||||
]
|
||||
},
|
||||
"mcoseint": {
|
||||
"prefix": "mcoseint",
|
||||
"description": "CommaSeparatedIntegerField (mcoseint) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.CommaSeparatedIntegerField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mdate": {
|
||||
"prefix": "mdate",
|
||||
"description": "DateField (mdate) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.DateField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mdatetime": {
|
||||
"prefix": "mdatetime",
|
||||
"description": "DateTimeField (mdatetime) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.DateTimeField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mdecimal": {
|
||||
"prefix": "mdecimal",
|
||||
"description": "DecimalField (mdecimal) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.DecimalField(${DESCRICAO}, max_digits=5, decimal_places=2)"
|
||||
]
|
||||
},
|
||||
"mduration": {
|
||||
"prefix": "mduration",
|
||||
"description": "DurationField (mduration) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.DurationField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"memail": {
|
||||
"prefix": "memail",
|
||||
"description": "EmailField (memail) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.EmailField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mfile": {
|
||||
"prefix": "mfile",
|
||||
"description": "FileField (mfile) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.FileField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mfilepath": {
|
||||
"prefix": "mfilepath",
|
||||
"description": "FilePathField (mfilepath) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.FilePathField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mfloat": {
|
||||
"prefix": "mfloat",
|
||||
"description": " (mfloat) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.FloatField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mimg": {
|
||||
"prefix": "mimg",
|
||||
"description": "ImageField (mimg) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.ImageField(${DESCRICAO}, upload_to='${SUBPASTA}')"
|
||||
]
|
||||
},
|
||||
"mint": {
|
||||
"prefix": "mint",
|
||||
"description": "IntegerField (mint) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.IntegerField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mip": {
|
||||
"prefix": "mip",
|
||||
"description": "IPAddressField (mip) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.IPAddressField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mnullbool": {
|
||||
"prefix": "mnullbool",
|
||||
"description": "NullBooleanField (mnullbool) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.NullBooleanField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mphone": {
|
||||
"prefix": "mphone",
|
||||
"description": "PhoneNumberField (mphone) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.PhoneNumberField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mposint": {
|
||||
"prefix": "mposint",
|
||||
"description": "PositiveIntegerField (mposint) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.PositiveIntegerField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mpossmallint": {
|
||||
"prefix": "mpossmallint",
|
||||
"description": "PositiveSmallIntegerField (mpossmallint) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.PositiveSmallIntegerField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mslug": {
|
||||
"prefix": "mslug",
|
||||
"description": "SlugField (mslug) model Field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.SlugField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"msmallint": {
|
||||
"prefix": "msmallint",
|
||||
"description": "SmallIntegerField (msmallint) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.SmallIntegerField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mtext": {
|
||||
"prefix": "mtext",
|
||||
"description": "TextField (mtext) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.TextField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mtime": {
|
||||
"prefix": "mtime",
|
||||
"description": "TimeField (mtime) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.TimeField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"murl": {
|
||||
"prefix": "murl",
|
||||
"description": "URLField (murl) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.URLField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"musstate": {
|
||||
"prefix": "musstate",
|
||||
"description": "USStateField (musstate) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.USStateField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"mxml": {
|
||||
"prefix": "mxml",
|
||||
"description": "XMLField (mxml) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.XMLField(${DESCRICAO})"
|
||||
]
|
||||
},
|
||||
"fk": {
|
||||
"prefix": "mfo",
|
||||
"description": "ForeignKey (fk) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.ForeignKey(${FKNAME}, on_delete=models.${PROTECT}, verbose_name='${DESCRICAO}', related_name='${RELACAO}')"
|
||||
]
|
||||
},
|
||||
"m2m": {
|
||||
"prefix": "m2m",
|
||||
"description": "ManyToManyField (m2m) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.ManyToManyField(${FKNAME}, verbose_name='${DESCRICAO}', related_name='${RELACAO}')"
|
||||
]
|
||||
},
|
||||
"o2o": {
|
||||
"prefix": "o2o",
|
||||
"description": "OneToOneField (o2o) model field",
|
||||
"body": [
|
||||
"${FIELDNAME} = models.OneToOneField(${DESCRICAO}, on_delete=models.${PROTECT})"
|
||||
]
|
||||
},
|
||||
"mserializer": {
|
||||
"prefix": "mserializer",
|
||||
"description": "ModelSerializer (mserializer) Rest Framework",
|
||||
"body": [
|
||||
"class ${ModelName}Serializer(serializers.ModelSerializer):",
|
||||
"",
|
||||
"\tclass Meta:",
|
||||
"\t\tmodel = ${ModelName}",
|
||||
"\t\tfields = '__all__'"
|
||||
]
|
||||
},
|
||||
"mviewset": {
|
||||
"prefix": "mviewset",
|
||||
"description": "ModelViewSet (mviewset) Rest Framework",
|
||||
"body": [
|
||||
"class ${ModelName}ViewSet(viewsets.ModelViewSet):",
|
||||
"",
|
||||
"\tqueryset = ${ModelName}.objects.all()",
|
||||
"\tserializer_class = ${ModelName}Serializer"
|
||||
]
|
||||
},
|
||||
"ronlymviewset": {
|
||||
"prefix": "ronlymviewset",
|
||||
"description": "ReadOnlyModelViewSet (ronlymviewset) Rest Framework",
|
||||
"body": [
|
||||
"class ${ModelName}ViewSet(viewsets.ReadOnlyModelViewSet):",
|
||||
"",
|
||||
"\tqueryset = ${ModelName}.objects.all()",
|
||||
"\tserializer_class = ${ModelName}Serializer"
|
||||
]
|
||||
},
|
||||
"Model": {
|
||||
"prefix": "mmodel",
|
||||
"description": "models.Model (Model) Class Model of Django",
|
||||
"body": [
|
||||
"class ${ModelName}(models.Model):",
|
||||
"",
|
||||
"\tdef __str__(self):",
|
||||
"\t\tpass",
|
||||
"",
|
||||
"\tclass Meta:",
|
||||
"\t\tdb_table = ''",
|
||||
"\t\tmanaged = True",
|
||||
"\t\tverbose_name = '${ModelName}'",
|
||||
"\t\tverbose_name_plural = '${ModelName}s'"
|
||||
]
|
||||
},
|
||||
"Meta": {
|
||||
"prefix": "mmeta",
|
||||
"description": "Meta (Meta) Meta Class of Model",
|
||||
"body": [
|
||||
"class Meta:",
|
||||
"\tdb_table = ''",
|
||||
"\tmanaged = True",
|
||||
"\tverbose_name = '${ModelName}'",
|
||||
"\tverbose_name_plural = '${ModelName}s'"
|
||||
]
|
||||
},
|
||||
"adminRegister": {
|
||||
"prefix": "adr",
|
||||
"description": "Create admin site resgister for app",
|
||||
"body": [
|
||||
"from .models import ${AppName}",
|
||||
"",
|
||||
"admin.site.register(${AppName})"
|
||||
]
|
||||
},
|
||||
"ondelete": {
|
||||
"prefix": "ond",
|
||||
"description": "on_delete option",
|
||||
"body": [
|
||||
"on_delete=models.${PROTECT}"
|
||||
]
|
||||
},
|
||||
"null&blank": {
|
||||
"prefix": "nbl",
|
||||
"description": "null=True, blank=True option",
|
||||
"body": [
|
||||
"null=True, blank=True"
|
||||
]
|
||||
},
|
||||
"Django CRUD Views": {
|
||||
"prefix": "dcv",
|
||||
"description": "Create CRUD views",
|
||||
"body": [
|
||||
"from django.views.generic import ListView, CreateView, UpdateView, DeleteView",
|
||||
"from django.contrib.auth.mixins import LoginRequiredMixin",
|
||||
"from django.urls import reverse_lazy",
|
||||
"from .models import ${ClasseObjeto}",
|
||||
"",
|
||||
"class ${ClasseObjeto}List(LoginRequiredMixin, ListView):",
|
||||
"\tmodel = ${ClasseObjeto}",
|
||||
"",
|
||||
"class ${ClasseObjeto}Create(LoginRequiredMixin, CreateView):",
|
||||
"\tmodel = ${ClasseObjeto}",
|
||||
"\tform_class = None",
|
||||
"\tsuccess_url = reverse_lazy('${ClasseObjeto}_list')",
|
||||
"",
|
||||
"class ${ClasseObjeto}Update(LoginRequiredMixin, UpdateView):",
|
||||
"\tmodel = ${ClasseObjeto}",
|
||||
"\tform_class = None",
|
||||
"\tsuccess_url = reverse_lazy('${ClasseObjeto}_list')",
|
||||
"",
|
||||
"class ${ClasseObjeto}Delete(LoginRequiredMixin, DeleteView):",
|
||||
"\tmodel = ${ClasseObjeto}",
|
||||
"\tsuccess_url = reverse_lazy('${ClasseObjeto}_list')"
|
||||
]
|
||||
},
|
||||
"Django TemplateView": {
|
||||
"prefix": "dtv",
|
||||
"description": "Create a TemplateView",
|
||||
"body": [
|
||||
"from django.views.generic import TemplateView",
|
||||
"from django.contrib.auth.mixins import LoginRequiredMixin",
|
||||
"",
|
||||
"class ${NomeClasse}(LoginRequiredMixin, TemplateView):",
|
||||
"\ttemplate_name = \"${arquivo}.html\"",
|
||||
"",
|
||||
"\tdef get_context_data(self, **kwargs):",
|
||||
"\t\tcontext = super().get_context_data(**kwargs)",
|
||||
"\t\tcontext['${var}'] = \"\"",
|
||||
"\t\treturn context"
|
||||
]
|
||||
},
|
||||
"Django ListView": {
|
||||
"prefix": "dclv",
|
||||
"description": "Create a ListView",
|
||||
"body": [
|
||||
"class ${ClasseObjeto}Create(LoginRequiredMixin, ListView):",
|
||||
"\tmodel = ${ClasseObjeto}",
|
||||
"",
|
||||
"\tdef get_context_data(self, **kwargs):",
|
||||
"\t\tcontext = super().get_context_data(**kwargs)",
|
||||
"\t\tcontext['minha_variavel'] = 'Pode ser qualquer coisa'",
|
||||
"\t\treturn context"
|
||||
]
|
||||
},
|
||||
"Django CreateView": {
|
||||
"prefix": "dccv",
|
||||
"description": "Create a CreateView",
|
||||
"body": [
|
||||
"class ${ClasseObjeto}Create(LoginRequiredMixin, CreateView):",
|
||||
"\tmodel = ${ClasseObjeto}",
|
||||
"\tform_class = None",
|
||||
"\tsuccess_url = reverse_lazy('${ClasseObjeto}_list')"
|
||||
]
|
||||
},
|
||||
"Django UpdateView": {
|
||||
"prefix": "dcuv",
|
||||
"description": "Create a UpdateView",
|
||||
"body": [
|
||||
"class ${ClasseObjeto}Update(LoginRequiredMixin, UpdateView):",
|
||||
"\tmodel = ${ClasseObjeto}",
|
||||
"\tform_class = None",
|
||||
"\tsuccess_url = reverse_lazy('${ClasseObjeto}_list')"
|
||||
]
|
||||
},
|
||||
"Django DeleteView": {
|
||||
"prefix": "dcdv",
|
||||
"description": "Create a DeleteView",
|
||||
"body": [
|
||||
"class ${ClasseObjeto}Delete(LoginRequiredMixin, DeleteView):",
|
||||
"\tmodel = ${ClasseObjeto}",
|
||||
"\tsuccess_url = reverse_lazy('${ClasseObjeto}_list')"
|
||||
]
|
||||
},
|
||||
"Django Settings Internationalization and Static": {
|
||||
"prefix": "dss",
|
||||
"description": "Create Internationalization and staticfolders settings",
|
||||
"body": [
|
||||
"# Internationalization",
|
||||
"# https://docs.djangoproject.com/en/2.1/topics/i18n/",
|
||||
"",
|
||||
"LANGUAGE_CODE = 'pt-br'",
|
||||
"",
|
||||
"TIME_ZONE = 'America/Sao_Paulo'",
|
||||
"",
|
||||
"USE_I18N = True",
|
||||
"",
|
||||
"USE_L10N = True",
|
||||
"",
|
||||
"USE_TZ = True",
|
||||
"",
|
||||
"",
|
||||
"# Static files (CSS, JavaScript, Images)",
|
||||
"# https://docs.djangoproject.com/en/2.1/howto/static-files/",
|
||||
"",
|
||||
"STATIC_URL = '/static/'",
|
||||
"",
|
||||
"STATICFILES_DIRS = [",
|
||||
"\tos.path.join(BASE_DIR, \"staticfiles\"),",
|
||||
"]",
|
||||
"",
|
||||
"MEDIA_URL = '/media/'",
|
||||
"",
|
||||
"MEDIA_ROOT = os.path.join(BASE_DIR,'media')",
|
||||
"",
|
||||
"STATIC_ROOT = os.path.join(BASE_DIR,\"static/\")",
|
||||
"",
|
||||
"LOGIN_REDIRECT_URL = 'home'",
|
||||
"",
|
||||
"LOGOUT_REDIRECT_URL = 'login'"
|
||||
]
|
||||
},
|
||||
"Django Settings Template": {
|
||||
"prefix": "dst",
|
||||
"description": "Create template settings",
|
||||
"body": [
|
||||
"TEMPLATES = [",
|
||||
"\t{",
|
||||
"\t\t'BACKEND': 'django.template.backends.django.DjangoTemplates',",
|
||||
"\t\t'DIRS': ['templates', os.path.join(BASE_DIR,'templates')],",
|
||||
"\t\t'APP_DIRS': True,",
|
||||
"\t\t'OPTIONS': {",
|
||||
"\t\t\t'context_processors': [",
|
||||
"\t\t\t\t'django.template.context_processors.debug',",
|
||||
"\t\t\t\t'django.template.context_processors.request',",
|
||||
"\t\t\t\t'django.contrib.auth.context_processors.auth',",
|
||||
"\t\t\t\t'django.contrib.messages.context_processors.messages',",
|
||||
"\t\t\t],",
|
||||
"\t\t},",
|
||||
"\t},",
|
||||
"]"
|
||||
]
|
||||
},
|
||||
"Django middleware": {
|
||||
"prefix": "middlweware",
|
||||
"description": "Create a middleware",
|
||||
"body": [
|
||||
"def ${nome}_middleware(get_response):",
|
||||
"\tdef middleware(request):",
|
||||
"\t\tresponse = get_response(request)",
|
||||
"\t\treturn response",
|
||||
"\treturn middleware"
|
||||
]
|
||||
},
|
||||
"Django get_context_data": {
|
||||
"prefix": "dgetc",
|
||||
"description": "Create a get_context_data function",
|
||||
"body": [
|
||||
"def get_context_data(self, **kwargs):",
|
||||
"\tcontext = super().get_context_data(**kwargs)",
|
||||
"\tcontext[\"${variavel}\"] = \"${valor}\"",
|
||||
"\treturn context"
|
||||
]
|
||||
},
|
||||
"Django post": {
|
||||
"prefix": "dpos",
|
||||
"description": "Create a post function",
|
||||
"body": [
|
||||
"def post(self, request, *args, **kwargs):",
|
||||
"\treturn super().post(request, *args, **kwargs)"
|
||||
]
|
||||
},
|
||||
"Django get": {
|
||||
"prefix": "dget",
|
||||
"description": "Create a get function",
|
||||
"body": [
|
||||
"def get(self, request, *args, **kwargs):",
|
||||
"\treturn super().get(request, *args, **kwargs)"
|
||||
]
|
||||
},
|
||||
"Django constraints": {
|
||||
"prefix": "dcons",
|
||||
"description": "Create a constraint for Meta Models",
|
||||
"body": [
|
||||
"constraints = [",
|
||||
"\tmodels.UniqueConstraint(",
|
||||
"\t\tfields=[\"${cons1}\", \"${cons2}\"], name=\"${model}_${cons1}_${cons2}\",",
|
||||
"\t)",
|
||||
"]"
|
||||
]
|
||||
},
|
||||
"Pyhton def __str__": {
|
||||
"prefix": "defs",
|
||||
"description": "Create a __str__ function",
|
||||
"body": [
|
||||
"def __str__(self):",
|
||||
"\treturn self.${NOME}"
|
||||
]
|
||||
},
|
||||
"Python encode": {
|
||||
"prefix": "enc",
|
||||
"description": "coding utf-8",
|
||||
"body": [
|
||||
"# coding=utf-8"
|
||||
]
|
||||
},
|
||||
"Python Try/Except/Finally": {
|
||||
"prefix": "try",
|
||||
"description": "Command try/except/finally",
|
||||
"body": [
|
||||
"try:",
|
||||
"\t${pass}",
|
||||
"except Exception as e:",
|
||||
"\tprint(\"{}\".format(e))",
|
||||
"finally:",
|
||||
"\tpass"
|
||||
]
|
||||
}
|
||||
}
|
||||
231
lua/snippets/django.json
Executable file
231
lua/snippets/django.json
Executable file
|
|
@ -0,0 +1,231 @@
|
|||
{
|
||||
"autoescape": {
|
||||
"prefix": "autoescape",
|
||||
"description": "autoescape tag django template",
|
||||
"body": ["{% autoescape ${off} %}", " ", "{% autoescape %}"]
|
||||
},
|
||||
"block": {
|
||||
"prefix": "block",
|
||||
"description": "block tag django template",
|
||||
"body": [
|
||||
"{% block $1 %}",
|
||||
" ",
|
||||
"{% endblock $1 %}"
|
||||
]
|
||||
},
|
||||
"comment": {
|
||||
"prefix": "comment",
|
||||
"description": "Comment tag django template",
|
||||
"body": ["{% comment %}", " $1", "{% endcomment %}"]
|
||||
},
|
||||
"csrf": {
|
||||
"prefix": "csrf",
|
||||
"description": "csrf token django template",
|
||||
"body": ["{% csrf_token %}"]
|
||||
},
|
||||
"cycle": {
|
||||
"prefix": "cycle",
|
||||
"description": "cycle tag django template",
|
||||
"body": ["{% cycle %}"]
|
||||
},
|
||||
"debug": {
|
||||
"prefix": "debug",
|
||||
"description": "debug tag django template",
|
||||
"body": ["{% debug %}"]
|
||||
},
|
||||
"ext": {
|
||||
"prefix": "ext",
|
||||
"description": "extends tag django template",
|
||||
"body": ["{% extends \"$1\" %}"]
|
||||
},
|
||||
"extends": {
|
||||
"prefix": "extends",
|
||||
"description": "extends tag django template",
|
||||
"body": ["{% extends \"$1\" %}"]
|
||||
},
|
||||
"filter": {
|
||||
"prefix": "filter",
|
||||
"description": "filter tag django template",
|
||||
"body": ["{% filter $1 %}", " ", "{% endfilter %}"]
|
||||
},
|
||||
"firstof": {
|
||||
"prefix": "firstof",
|
||||
"description": "firstof tag django template",
|
||||
"body": ["{% firstof %}"]
|
||||
},
|
||||
"for": {
|
||||
"prefix": "for",
|
||||
"description": "for tag django template",
|
||||
"body": ["{% for $1 in %}", " ", "{% endfor %}"]
|
||||
},
|
||||
"fore": {
|
||||
"prefix": "fore",
|
||||
"description": "foreach with empty tag django template",
|
||||
"body": ["{% for $1 in %}", " ", "{% empty %}", " ", "{% endfor %}"]
|
||||
},
|
||||
"if": {
|
||||
"prefix": "if",
|
||||
"description": "if tag django template",
|
||||
"body": ["{% if $1 %}", " ", "{% endif %}"]
|
||||
},
|
||||
"ifchanged": {
|
||||
"prefix": "ifchanged",
|
||||
"description": "ifchanged tag django template",
|
||||
"body": ["{% ifchanged $1 %}", " ", "{% endifchanged %}"]
|
||||
},
|
||||
"ife": {
|
||||
"prefix": "ife",
|
||||
"description": "if else tag django template",
|
||||
"body": ["{% if $1 %}", " ", "{% else %}", " ", "{% endif %}", ""]
|
||||
},
|
||||
"ifelse": {
|
||||
"prefix": "ifelse",
|
||||
"description": "if else tag django template",
|
||||
"body": ["{% if $1 %}", " ", "{% else %}", " ", "{% endif %}", ""]
|
||||
},
|
||||
"ifeq": {
|
||||
"prefix": "ifeq",
|
||||
"description": "ifequal tag django template",
|
||||
"body": ["{% ifequal $1 %}", " ", "{% endifequal %}"]
|
||||
},
|
||||
"ifequal": {
|
||||
"prefix": "ifeq",
|
||||
"description": "ifequal tag django template",
|
||||
"body": ["{% ifequal $1 %}", " ", "{% endifequal %}"]
|
||||
},
|
||||
"ifnotequal": {
|
||||
"prefix": "ifnotequal",
|
||||
"description": "ifnotequal tag django template",
|
||||
"body": ["{% ifnotequal $1 %}", " ", "{% ifnotequal %}"]
|
||||
},
|
||||
"inc": {
|
||||
"prefix": "inc",
|
||||
"description": "include tag django template",
|
||||
"body": ["{% include \"$1\" %}"]
|
||||
},
|
||||
"include": {
|
||||
"prefix": "include",
|
||||
"description": "include tag django template",
|
||||
"body": ["{% include \"$1\" %}"]
|
||||
},
|
||||
"load": {
|
||||
"prefix": "load",
|
||||
"description": "load tag django template",
|
||||
"body": ["{% load $1 %}"]
|
||||
},
|
||||
"now": {
|
||||
"prefix": "now",
|
||||
"description": "now tag django template",
|
||||
"body": ["{% now \"$1\" %}"]
|
||||
},
|
||||
"regroup": {
|
||||
"prefix": "regroup",
|
||||
"description": "regroup tag django template",
|
||||
"body": ["{% regroup $1 by as %}"]
|
||||
},
|
||||
"spaceless": {
|
||||
"prefix": "spaceless",
|
||||
"description": "spaceless tag django template",
|
||||
"body": ["{% spaceless %}", " $1", "{% endspaceless %}"]
|
||||
},
|
||||
"ssi": {
|
||||
"prefix": "ssi",
|
||||
"description": "ssi tag django template",
|
||||
"body": ["{% ssi $1 parsed %}"]
|
||||
},
|
||||
"static": {
|
||||
"prefix": "static",
|
||||
"description": "static tag django template",
|
||||
"body": ["{% static '$1' %}"]
|
||||
},
|
||||
"templatetag": {
|
||||
"prefix": "templatetag",
|
||||
"description": "templatetag tag django template",
|
||||
"body": ["{% templatetag $1 %}"]
|
||||
},
|
||||
"url": {
|
||||
"prefix": "url",
|
||||
"description": "url tag django template",
|
||||
"body": ["{% url $1 %}"]
|
||||
},
|
||||
"verbatim": {
|
||||
"prefix": "verbatim",
|
||||
"description": "verbatim tag django template",
|
||||
"body": ["{% verbatim %}", " $1", "{% endverbatim %}"]
|
||||
},
|
||||
"widthratio": {
|
||||
"prefix": "widthratio",
|
||||
"description": "widthratio tag django template",
|
||||
"body": ["{% widthratio ${this_value} max_value 100 %}"]
|
||||
},
|
||||
"with": {
|
||||
"prefix": "with",
|
||||
"description": "with tag django template",
|
||||
"body": ["{% with $1 as %}", " ", "{% endwith %}"]
|
||||
},
|
||||
"trans": {
|
||||
"prefix": "trans",
|
||||
"description": "translate tag django template",
|
||||
"body": ["{% translate \"$1\" %}"]
|
||||
},
|
||||
"blocktrans": {
|
||||
"prefix": "blocktrans",
|
||||
"description": "blocktrans tag django template",
|
||||
"body": ["{% blocktrans %}", " $1", "{% endblocktrans %}"]
|
||||
},
|
||||
"super": {
|
||||
"prefix": "super",
|
||||
"description": "Block super",
|
||||
"body": ["{{ block.super }}"]
|
||||
},
|
||||
"extrahead": {
|
||||
"prefix": "extrahead",
|
||||
"description": "Extrahead no oficial tag",
|
||||
"body": ["{% block extrahead %}", " $1", "{% endblock extrahead %}"]
|
||||
},
|
||||
"extrastyle": {
|
||||
"prefix": "extrastyle",
|
||||
"description": "Extrastyle no oficial Tag",
|
||||
"body": ["{% block extrahead %}", " $1", "{% endblock extrahead %}"]
|
||||
},
|
||||
"var": {
|
||||
"prefix": "var",
|
||||
"description": "Variable autocomplete",
|
||||
"body": ["{{ $1 }}"]
|
||||
},
|
||||
"tag": {
|
||||
"prefix": "tag",
|
||||
"description": "tag autocomplete no oficial",
|
||||
"body": ["{% $1 %}"]
|
||||
},
|
||||
"staticurl": {
|
||||
"prefix": "staticurl",
|
||||
"description": "STATIC_URL no oficial var",
|
||||
"body": ["{{ STATIC_URL }}"]
|
||||
},
|
||||
"mediaurl": {
|
||||
"prefix": "mediaurl",
|
||||
"description": "",
|
||||
"body": ["{{ MEDIA_URL }}"]
|
||||
},
|
||||
"template_tag": {
|
||||
"prefix": "dtt",
|
||||
"description": "Django template tag",
|
||||
"body": ["{% $1 %}"]
|
||||
},
|
||||
"csrfmiddlewaretoken": {
|
||||
"prefix": "csrfmiddlewaretoken",
|
||||
"description": "Django csrf token",
|
||||
"body": ["csrfmiddlewaretoken: $(\"input[name='csrfmiddlewaretoken']\").val()"]
|
||||
},
|
||||
"render_form": {
|
||||
"prefix": "render_form",
|
||||
"description": "Django render form",
|
||||
"body": ["{% render_form $1 %}"]
|
||||
},
|
||||
"render_table": {
|
||||
"prefix": "render_table",
|
||||
"description": "Django render table",
|
||||
"body": ["{% render_table $1 %}"]
|
||||
}
|
||||
}
|
||||
1395
lua/snippets/dripicons.json
Normal file
1395
lua/snippets/dripicons.json
Normal file
File diff suppressed because it is too large
Load diff
122
lua/snippets/golang.json
Normal file
122
lua/snippets/golang.json
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
{
|
||||
"main": {
|
||||
"prefix": "fmain",
|
||||
"description": "main function",
|
||||
"body": ["package main\n", "func main() {", "\t$1", "}"]
|
||||
},
|
||||
"basicmainfile": {
|
||||
"prefix": "basic",
|
||||
"description": "basic main file",
|
||||
"body": [
|
||||
"package main\n",
|
||||
"import (",
|
||||
"\t\"log\"",
|
||||
"\t\"net/http\"",
|
||||
"\t\"os\"\n",
|
||||
"\t\"github.com/go-chi/chi\"",
|
||||
"\t\"github.com/go-chi/cors\"",
|
||||
"\t\"github.com/joho/godotenv\"",
|
||||
")\n",
|
||||
"func main() {",
|
||||
"\tgodotenv.Load(\".env\")\n",
|
||||
"\tport := os.Getenv(\"PORT\")",
|
||||
"\tif port == \"\" {",
|
||||
"\t\tlog.Fatal(\"PORT environment variable is not set\")",
|
||||
"\t}\n",
|
||||
"\trouter := chi.NewRouter()\n",
|
||||
"\trouter.Use(cors.Handler(cors.Options{",
|
||||
"\t\tAllowedOrigins: []string{\"https://*\", \"http://*\"},",
|
||||
"\t\tAllowedMethods: []string{\"GET\", \"POST\", \"PUT\", \"DELETE\", \"OPTIONS\"},",
|
||||
"\t\tAllowedHeaders: []string{\"*\"},",
|
||||
"\t\tExposedHeaders: []string{\"Link\"},",
|
||||
"\t\tAllowCredentials: false,",
|
||||
"\t\tMaxAge: 300,",
|
||||
"\t}))\n",
|
||||
"\tv1Router := chi.NewRouter()",
|
||||
"\tv1Router.Get(\"/healthz\", handlerReadiness)",
|
||||
"\tv1Router.Get(\"/err\", handlerErr)\n",
|
||||
"\trouter.Mount(\"/v1\", v1Router)",
|
||||
"\tsrv := &http.Server{",
|
||||
"\t\tAddr: \":\" + port,",
|
||||
"\t\tHandler: router,",
|
||||
"\t}\n",
|
||||
"\tfileServer := http.FileServer(http.Dir(\"./static/\"))",
|
||||
"\tmux.Handle(\"/static/*\", http.StripPrefix(\"/static\", fileServer))\n",
|
||||
"\tlog.Printf(\"Serving on port: %s\\n\", port)",
|
||||
"\tlog.Fatal(srv.ListenAndServe())",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
"error": {
|
||||
"prefix": "ife",
|
||||
"description": "if statment for error",
|
||||
"body": ["if err != nil {", "\t$1", "}"]
|
||||
},
|
||||
"println": {
|
||||
"prefix": "pl",
|
||||
"description": "fmt.Println",
|
||||
"body": ["fmt.Println(\"$1\")"]
|
||||
},
|
||||
"sprintf": {
|
||||
"prefix": "spf",
|
||||
"description": "fmt.Sprintf",
|
||||
"body": ["fmt.Sprintf(\"$1\")"]
|
||||
},
|
||||
"handler": {
|
||||
"prefix": "hand",
|
||||
"description": "http.Handler",
|
||||
"body": ["func $1(w http.ResponseWriter, r *http.Request) {", "\t", "}"]
|
||||
},
|
||||
"chirouter": {
|
||||
"prefix": "chi",
|
||||
"description": "import for chi router",
|
||||
"body": ["github.com/go-chi/chi/v5"]
|
||||
},
|
||||
"godotenv": {
|
||||
"prefix": "godotenv",
|
||||
"description": "Go dot env",
|
||||
"body": ["\"github.com/joho/godotenv\""]
|
||||
},
|
||||
"potgresdriver": {
|
||||
"prefix": "postgresdriver",
|
||||
"description": "Postgres Driver",
|
||||
"body": ["\"https://github.com/lib/pq\""]
|
||||
},
|
||||
"import": {
|
||||
"prefix": "impt",
|
||||
"description": "import tag",
|
||||
"body": ["import (", "\t\"$1\"", ")\n"]
|
||||
},
|
||||
"funcwithreceiver": {
|
||||
"prefix": "fr",
|
||||
"description": "Function with some receiver",
|
||||
"body": ["func ($1 *$2) $3 {", "\t", "}"]
|
||||
},
|
||||
"sqlcontext": {
|
||||
"prefix": "ctx",
|
||||
"description": "context with timeout",
|
||||
"body": [
|
||||
"ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\n",
|
||||
"defer cancel()\n"
|
||||
]
|
||||
},
|
||||
"fecho": {
|
||||
"prefix": "fecho",
|
||||
"description": "echo with fasthttp",
|
||||
"body": [
|
||||
"package main\n",
|
||||
"import (",
|
||||
"\t\"net/http\"",
|
||||
"\t\"github.com/labstack/echo/v4\"",
|
||||
")\n",
|
||||
"func main() {",
|
||||
"\te := echo.New()\n",
|
||||
"\te.GET(\"/\", func(c echo.Context) error {",
|
||||
"\t\treturn c.String(http.StatusOK, \"Hello, World!\")",
|
||||
"\t})\n",
|
||||
"\te.Static(\"/static\", \"static\")",
|
||||
"\te.Logger.Fatal(e.Start(\":8000\"))",
|
||||
"}"
|
||||
]
|
||||
}
|
||||
}
|
||||
1457
lua/snippets/hero_outline.json
Normal file
1457
lua/snippets/hero_outline.json
Normal file
File diff suppressed because it is too large
Load diff
1457
lua/snippets/hero_solid.json
Normal file
1457
lua/snippets/hero_solid.json
Normal file
File diff suppressed because it is too large
Load diff
52131
lua/snippets/material.json
Normal file
52131
lua/snippets/material.json
Normal file
File diff suppressed because it is too large
Load diff
20
lua/snippets/md.json
Normal file
20
lua/snippets/md.json
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"command": {
|
||||
"prefix": "cmd",
|
||||
"description": "create command tag",
|
||||
"body": [
|
||||
"```$1",
|
||||
"$2",
|
||||
"```"
|
||||
]
|
||||
},
|
||||
"bashcommand": {
|
||||
"prefix": "bash",
|
||||
"description": "create bash command tag",
|
||||
"body": [
|
||||
"```bash",
|
||||
"$1",
|
||||
"```"
|
||||
]
|
||||
}
|
||||
}
|
||||
55
lua/snippets/package.json
Executable file
55
lua/snippets/package.json
Executable file
|
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
"name": "nvim-snippets",
|
||||
"author": "LucasF",
|
||||
"engines": {
|
||||
"vscode": "^1.11.0"
|
||||
},
|
||||
"contributes": {
|
||||
"snippets": [
|
||||
{
|
||||
"language": "python",
|
||||
"path": "./python.json"
|
||||
},
|
||||
{
|
||||
"language": "python",
|
||||
"path": "./django-python.json"
|
||||
},
|
||||
{
|
||||
"language": "htmldjango",
|
||||
"path": "./django.json"
|
||||
},
|
||||
{
|
||||
"language": "htmldjango",
|
||||
"path": "./bootstrap.json"
|
||||
},
|
||||
{
|
||||
"language": "htmldjango",
|
||||
"path": "./dripicons.json"
|
||||
},
|
||||
{
|
||||
"language": "htmldjango",
|
||||
"path": "./hero_outline.json"
|
||||
},
|
||||
{
|
||||
"language": "htmldjango",
|
||||
"path": "./material.json"
|
||||
},
|
||||
{
|
||||
"language": "htmldjango",
|
||||
"path": "./hero_solid.json"
|
||||
},
|
||||
{
|
||||
"language": "go",
|
||||
"path": "./golang.json"
|
||||
},
|
||||
{
|
||||
"language": "sql",
|
||||
"path": "./sql.json"
|
||||
},
|
||||
{
|
||||
"language": "markdown",
|
||||
"path": "./md.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
13
lua/snippets/python.json
Normal file
13
lua/snippets/python.json
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ifmain": {
|
||||
"prefix": "ifmain",
|
||||
"description": "create basic function with if __name__ == \"__main__\"",
|
||||
"body": [
|
||||
"def execute():",
|
||||
"\t${1}",
|
||||
"\n\n",
|
||||
"if __name__ == \"__main__\":",
|
||||
"\texecute()"
|
||||
]
|
||||
}
|
||||
}
|
||||
25
lua/snippets/sql.json
Normal file
25
lua/snippets/sql.json
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"goosesql": {
|
||||
"prefix": "goosesql",
|
||||
"description": "create up and down comments",
|
||||
"body": [
|
||||
"-- +goose Up\n",
|
||||
"-- +goose Down\n"
|
||||
]
|
||||
},
|
||||
"goosetable": {
|
||||
"prefix": "goosetable",
|
||||
"description": "create sql table",
|
||||
"body": [
|
||||
"-- +goose Up\n",
|
||||
"CREATE TABLE $1 (",
|
||||
"\tid UUID PRIMARY KEY,",
|
||||
"\tcreated_at TIMESTAMP NOT NULL,",
|
||||
"\tupdated_at TIMESTAMP NOT NULL,",
|
||||
"\tname TEXT NOT NULL",
|
||||
");\n",
|
||||
"-- +goose Down\n",
|
||||
"DROP TABLE $1;"
|
||||
]
|
||||
}
|
||||
}
|
||||
6
neovim.yml
Normal file
6
neovim.yml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
base: lua51
|
||||
|
||||
globals:
|
||||
vim:
|
||||
any: true
|
||||
8
selene.toml
Normal file
8
selene.toml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
std = "neovim"
|
||||
|
||||
[rules]
|
||||
global_usage = "allow"
|
||||
if_same_then_else = "allow"
|
||||
incorrect_standard_library_use = "allow"
|
||||
mixed_table = "allow"
|
||||
multiple_statements = "allow"
|
||||
Loading…
Add table
Add a link
Reference in a new issue