diff --git a/README.md b/README.md deleted file mode 100644 index 4df5425..0000000 --- a/README.md +++ /dev/null @@ -1,127 +0,0 @@ -
- -

keycodex

- -

Your Personalized Dev Env ❤️👨‍💻

- -
- -Handcrafted Neovim setup for the ultimate CLI dev experience. - -## ✨ Features - -- **Fully configured LSP**: Out of the box LSP and completions, including Copilot (optional) -- **Awesome keybindings**: Intuitive and well documented keybindings with which-key -- **Blazingly fast**: Starts up in less than 30ms thanks to extensive lazy loading -- **Batteries included**: Has all the necessary plugins included out of the box -- **Git in there**: Powerful git integrations thanks to lazygit, fugitive, gitsigns and more -- **Pretty colors**: Comes with treesitter and onedark preconfigured with full transparency support -- **Tmux integration**: Works with your tmux configurations out of the box -- **Dev tools**: Comes with debugging, testing, database and REPL support, pick and choose -- **Auto install**: All necessary LSPs, Formatter, Linters, Treesitter Parsers etc. are auto installed -- **User module**: Configure keycodex according to your needs by using the `user` module! -- and some more - -Most importantly: - -**Built for extending**: keycodex has a easy to understand config structure that promotes personalization, so go ahead, bring your keybindings, functions and plugins over, and truly make **keycodex: Your Personalized Development Environment!** - -## ⚡ Setup - -### ⚙️ Requirements - -Before you begin, ensure you have met the following requirements: - -- You have installed the latest version of `neovim` -- Some command line tools: fd, ripgrep - -### 💻 Installation - -To install `keycodex` clone the repo and setup the symlink - -```bash -git clone https://github.com/S4NKALP/keycodex -``` - -On Linux and Mac - -```bash -ln -sfnv $PWD/keycodex $HOME/.config/nvim -``` - -On Windows Powershell - -```powershell -New-Item -ItemType SymbolicLink -Path "$env:LOCALAPPDATA\nvim" -Target "$PWD\keycodex" -Force -``` - -## 🚀 Usage - -### 🎨 User Configs - -`keycodex` supports a user module where you can store your custom configs and override any default configs. - -To use custom configs create the file `lua/user/init.lua` in keycodex, with the following structure: - -```lua --- lua/user/init.lua -local user = { - auto_install = true, -- enable auto install of LSPs, Treesitter parsers etc. - user_lsp_servers = { - -- Auto installed LSPs defined by user - }, - user_formatter_sources = { - -- Auto installed formatter sources defined by user - }, - user_linter_sources = { - -- Auto installed lintere sources defined by user - }, - user_treesitter_parsers = { - -- Auto installed Treesitter parsers defined by user - }, - - enable_db_explorer = false, -- enable dbee.nvim support - enable_debugger = false, -- enable dap.nvim support - enable_test_runner = false, -- enable neotest.nvim support - enable_trainer = false, -- enable hardtime.nvim support - user_plugins = { - -- Add your lazy plugin spec here - }, - - user_keybindings = { - -- Add your which-key bindings here - } -} - -return user -``` - -You can add and `require` any other custom modules and configurations you want in this file. - -`user` module is not part of the repo, you can set up `user` module as a separate git repository while continuing to receive `keycodex` updates. - -### Core - -Files in [lua/core](./lua/core/) control the core of neovim: - -- [options](./lua/core/options.lua), -- [functions](./lua/core/functions.lua) -- [autocmds](./lua/core/autocmd.lua) -- [core keybindings](./lua/core/keys.lua) - -### ⌨️ Keybindings - -Apart from [core/keys](./lua/core/keys.lua) most keybindings are configured using [which-key](./lua/plugins/tools/which-key.lua) - -### 📦 Plugins - -You can check out the [plugins list file](./lua/plugins/list.lua) file to see the plugins that are included in keycodex. - -- [lang](./lua/plugins/lang/): Plugins related to language features, completions, lsp, editing etc. -- [tools](./lua/plugins/tools/): Plugins that add tool integrations to the editor. -- [ui](./lua/plugins/ui/): Plugins that make improve Neovim user experience. - -## 🙏 Acknowledgments - -This project builds upon [nvim2k](https://github.com/2KAbhishek/nvim2k) by [2KAbhishek](https://github.com/2KAbhishek/), enhancing it with additional features and optimizations. - diff --git a/docs/img/screenshot.png b/docs/img/screenshot.png deleted file mode 100644 index e7b08ad..0000000 Binary files a/docs/img/screenshot.png and /dev/null differ diff --git a/docs/old_README.md b/docs/old_README.md deleted file mode 100644 index ccaade9..0000000 --- a/docs/old_README.md +++ /dev/null @@ -1,147 +0,0 @@ ---- - -these are the commands i am using recently: - -moving is easy u just use hlkj - -`$`: will always take you to the end of the line - -`0`: will take you always to the start of the line - -`^`: using caret will take you to the first not empty space or character in ur line - -`f`: to jump to the character you want to reach towards in the line - -`F`: (capital f) here u will be jumping backwords to the character u need. - -`t`: is to go towards the letter u want to jump but the cursor is just before it - -`T`: (you can think of it as till) works the same but backwards - -`w, b`: to navigate between the words and symbols - -`W, B`: to navigate between capital words - -`e`: to navigate through end of the words - -`ge`: to navigate through end of the words but backwords - -`gE`: to skip and navigate between words in all caps. - -`{}`: is to jump between paragraphs or between empty space blocks - -`G`: is to jump to end of the line. - -`gg`: is to go to the beginning of the file - -`17G`: will take u to the line of 17, also :17 will do the same - -`%`: if u are on the opening or closing parenthesis or bracket it will jump to the according closing bracket or parenthesis - -`[(`: to jump to the opening parenthesis if you are in the middle of them - -`ctrl + f`: will take u down to a full screen - -`ctrl + b`: will take u up to a full screen - -`ctrl + u`:, d will take u up and down resectively half a screen - -`zt, zb, zz`: to move respecivally to top, bottom and half screen with moving the cursor - -`ctrl + y`: and e is to scroll up and down without moving the cursor - -`/`: to execute a search, and enter to go and hop into it - -`:nohl`: is a command to undo a selection - -`n and N`: to move through your searches - -`(star\*)`: to execute a search on an exact word - -`ctrl + i`:, o will jump u between jumplists - -`d$ or D`: to delete from current cursor to end of the line - -`dG`: to delete until the end of the file - -`de`: to delete till the end of the word - -`dd`: to delete all line - -`u`: to undo for sure - -`ce, c`: short for change is to delete and move to insert mode after deleting - -`r,`: to replace a simple character - -`yf(character)`: you will copy until character and then p or P to paste - -`yy`: to copy the whole line - -`Y or y$`: is same to copy until end of the line - -`~`: to change case of a character - -`gU`: to change to uppercase - -`gu`: to change for lowercase - -`diw, d`: for delete, i for inside and w for word, this will do the magic to delete the word entirely when the cursor is inside - -`ciw`: is to change a word while the cursor is inside - -`yip`: to copy the paragraph you are inside - -`dip`: to delete the pragraph you are in - -`di(`: to delete inside the parenthesis - -`da(`: to delete outside the parenthesis which means including them - -`:%s/word/newword/g`: change word to newword - -`:%s/word/newword/gc`: to not prompt u for being sure or not - -check this guy's cheatsheet for more: - -`https://www.josean.com/posts/vim-essentials-cheatsheet` - ---- - -### advanced stuff - -`qa`: to start recording a couple of movements - -`q`: to quit recording and make sure you are in visual mode - -`@a`: to apply what you recorded on a - -`vap`: to select outside a whole paragraph - -`:%`: to start an operation on whole file - -`:%norm!`: to start an operation on norm mode - -`:'<,'>norm!`: @a is to start the operation of @a on the paragraph selected - -`ctrl + w` and how u can use s for split and closing with o - -`Marks` to add the m + a and m + b and then switch to marks with ' + a or ' + b - -`ctrl + f` and `ctrl + u` is to move cursor to last character of file or first line as well. - -`ctrl + n` and `ctrl + p` are for navigation - -`ctrl + d` and `ctrl + u` will jump certain number of phrases and make navigation easier for u - -`ctrl + a` to increment number and `ctrl + x` to decrement it - -`ctrl + shift + v` to paste to terminal from clipboard - -`ys-command` to surround certain word with whatever u write next for example "" - -`ds"` to delete surrounding double quote or if u replace " with `t` u will delete surrounding tag - -`cs"` to change surrounding character with whatever u want, in this case with quotes - -`"ay + command` will give u possibility to yank whatever u gave to register a diff --git a/init.lua b/init.lua index d7a1edc..4305870 100644 --- a/init.lua +++ b/init.lua @@ -1,14 +1,7 @@ -require('core.options') -require('core.functions') -require('core.keys') +-- load config +require("core.options") +require("core.functions") +require("core.keys") require('core.autocmd') -require('plugins.lazy') --- Add user configs to this module -pcall(require, 'user') - --- load theme -dofile(vim.g.base46_cache .. 'defaults') -dofile(vim.g.base46_cache .. 'statusline') - --- Run pywal chadwal script silently in background -os.execute('python3 ~/.config/nvim/pywal/chadwal.py &> /dev/null &') +require("core.lsp") +require("core.lazy") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..b6a97d4 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,45 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, + "Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" }, + "better-escape.nvim": { "branch": "master", "commit": "19a38aab94961016430905ebec30d272a01e9742" }, + "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, + "conform.nvim": { "branch": "master", "commit": "b4aab989db276993ea5dcb78872be494ce546521" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" }, + "gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" }, + "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lspsaga.nvim": { "branch": "main", "commit": "8efe00d6aed9db6449969f889170f1a7e43101a1" }, + "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "markview.nvim": { "branch": "main", "commit": "e6b0f5aee8105adab6077509c46459812db4cffa" }, + "mason-conform.nvim": { "branch": "main", "commit": "48da2ebd5efbaf8a99566eadc3ece82d523f03c5" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "5e085efe67fccb13372d54331d849219662a7e93" }, + "mason-nvim-lint": { "branch": "main", "commit": "767b8ccdddaa977bec8987fd7507b9865a279235" }, + "mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" }, + "mini.ai": { "branch": "main", "commit": "e139eb1101beb0250fea322f8c07a42f0f175688" }, + "mini.bracketed": { "branch": "main", "commit": "672b4e2fe9222fd4d5a104ff23217801bae37046" }, + "mini.files": { "branch": "main", "commit": "49c855977e9f4821d1ed8179ed44fe098b93ea2a" }, + "mini.indentscope": { "branch": "main", "commit": "9d9490c172a4718d7d1f20eaae668a28f160c2d7" }, + "mini.surround": { "branch": "main", "commit": "5aab42fcdcf31fa010f012771eda5631c077840a" }, + "neogen": { "branch": "main", "commit": "d7f9461727751fb07f82011051338a9aba07581d" }, + "neoscroll.nvim": { "branch": "master", "commit": "f957373912e88579e26fdaea4735450ff2ef5c9c" }, + "netrw.nvim": { "branch": "master", "commit": "90501c62b9b816ed3ed1e912ae9db9af5671a1b2" }, + "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, + "nvim-lint": { "branch": "master", "commit": "f126af5345c7472e9a0cdbe1d1a29209be72c4c4" }, + "nvim-lspconfig": { "branch": "master", "commit": "c8b90ae5cbe21d547b342b05c9266dcb8ca0de8f" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, + "smartcolumn.nvim": { "branch": "main", "commit": "b9cdbdf42f7ac5a659204cd5926017c7ff724a19" }, + "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, + "tiny-code-action.nvim": { "branch": "main", "commit": "2b3fa2fbd25496259eaf50987097982f8ad08d1b" }, + "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "f64efd33a51ea89bdb847fb3aaf716e96b83ba1a" }, + "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, + "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, + "uv.nvim": { "branch": "main", "commit": "be4a7d47a976249282bb2f71fc773ac2f5325973" }, + "vim-wakatime": { "branch": "master", "commit": "d7973b157a632d1edeff01818f18d67e584eeaff" }, + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }, + "windsurf.vim": { "branch": "main", "commit": "a8d47ec54fe82df920b2545559f767003e8a7f8d" } +} diff --git a/lsp/lua_ls.lua b/lsp/lua_ls.lua deleted file mode 100644 index 1db6fe0..0000000 --- a/lsp/lua_ls.lua +++ /dev/null @@ -1,34 +0,0 @@ -return { - cmd = { 'lua-language-server' }, - filetypes = { 'lua' }, - root_markers = { '.luarc.json', '.luarc.jsonc' }, - settings = { - Lua = { - diagnostics = { globals = { 'vim' } }, - telemetry = { enable = false }, - format = { - enable = true, - defaultConfig = { - align_continuous_assign_statement = false, - align_continuous_rect_table_field = false, - align_array_table = false, - }, - }, - runtime = { - version = 'LuaJIT', - path = { - 'lua/?.lua', - 'lua/?/init.lua', - }, - }, - workspace = { - checkThirdParty = false, - library = { - vim.env.VIMRUNTIME, - -- vim.api.nvim_get_runtime_file('', true), - -- '${3rd}/busted/library' - }, - }, - }, - }, -} diff --git a/lsp/python.lua b/lsp/python.lua deleted file mode 100644 index abf49c6..0000000 --- a/lsp/python.lua +++ /dev/null @@ -1,17 +0,0 @@ -return { - cmd = { 'pyright-langserver', '--stdio' }, - filetypes = { 'py', 'python' }, - root_markers = { 'pyproject.toml', 'setup.py', 'setup.cfg', 'requirements.txt' }, - settings = { - python = { - analysis = { - -- autoSearchPaths = true, - diagnosticMode = 'openFilesOnly', - -- useLibraryCodeForTypes = true, - }, - }, - }, - init_options = { - hostInfo = 'neovim', - }, -} diff --git a/lsp/qml.lua b/lsp/qml.lua deleted file mode 100644 index f6a73d5..0000000 --- a/lsp/qml.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - cmd = { "qmlls" }, - filetypes = { 'qml', 'qmljs' }, - root_markers = { '.git', 'shell.qml', '.qmlls.ini' }, - } \ No newline at end of file diff --git a/lsp/tailwindcss.lua b/lsp/tailwindcss.lua deleted file mode 100644 index 258ad2b..0000000 --- a/lsp/tailwindcss.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - cmd = { 'tailwindcss-language-server' }, - root_markers = { 'tsconfig.json', 'jsconfig.json', 'package.json', '.git' }, - filetypes = { 'javascript', 'javascriptreact', 'javascript.jsx', 'typescript', 'typescriptreact', 'typescript.tsx' }, - init_options = { - hostInfo = 'neovim', - }, -} diff --git a/lsp/ts_ls.lua b/lsp/ts_ls.lua deleted file mode 100644 index e997cf8..0000000 --- a/lsp/ts_ls.lua +++ /dev/null @@ -1,28 +0,0 @@ -return { - settings = { - typescript = { - inlayHints = { - includeInlayParameterNameHints = 'all', - includeInlayParameterNameHintsWhenArgumentMatchesName = false, - includeInlayFunctionParameterTypeHints = true, - includeInlayVariableTypeHints = true, - includeInlayVariableTypeHintsWhenTypeMatchesName = false, - includeInlayPropertyDeclarationTypeHints = true, - includeInlayFunctionLikeReturnTypeHints = true, - includeInlayEnumMemberValueHints = true, - }, - }, - javascript = { - inlayHints = { - includeInlayParameterNameHints = 'all', - includeInlayParameterNameHintsWhenArgumentMatchesName = false, - includeInlayFunctionParameterTypeHints = true, - includeInlayVariableTypeHints = true, - includeInlayVariableTypeHintsWhenTypeMatchesName = false, - includeInlayPropertyDeclarationTypeHints = true, - includeInlayFunctionLikeReturnTypeHints = true, - includeInlayEnumMemberValueHints = true, - }, - }, - }, -} diff --git a/lua/chadrc.lua b/lua/chadrc.lua deleted file mode 100644 index e02dc9b..0000000 --- a/lua/chadrc.lua +++ /dev/null @@ -1,8 +0,0 @@ ----@type ChadrcConfig -local M = {} - -M.base46 = { - theme = "chadwal", -} - -return M \ No newline at end of file diff --git a/lua/core/autocmd.lua b/lua/core/autocmd.lua index cb9ceae..6bab5c9 100644 --- a/lua/core/autocmd.lua +++ b/lua/core/autocmd.lua @@ -1,137 +1,129 @@ local function augroup(name) - return vim.api.nvim_create_augroup('keycodex' .. name, { clear = true }) + return vim.api.nvim_create_augroup("nvim" .. name, { clear = true }) end -- Strip trailing spaces before write -vim.api.nvim_create_autocmd({ 'BufWritePre' }, { - group = augroup('strip_space'), - pattern = { '*' }, - callback = function() - vim.cmd([[ %s/\s\+$//e ]]) - end, +vim.api.nvim_create_autocmd({ "BufWritePre" }, { + group = augroup("strip_space"), + pattern = { "*" }, + callback = function() + vim.cmd([[ %s/\s\+$//e ]]) + end, }) -- Check if we need to reload the file when it changed -vim.api.nvim_create_autocmd({ 'FocusGained', 'TermClose', 'TermLeave' }, { - group = augroup('checktime'), - command = 'checktime', +vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, { + group = augroup("checktime"), + command = "checktime", }) -- Highlight on yank -vim.api.nvim_create_autocmd('TextYankPost', { - group = augroup('highlight_yank'), - callback = function() - vim.highlight.on_yank() - end, +vim.api.nvim_create_autocmd("TextYankPost", { + group = augroup("highlight_yank"), + callback = function() + vim.highlight.on_yank() + end, }) -- resize splits if window got resized -vim.api.nvim_create_autocmd({ 'VimResized' }, { - group = augroup('resize_splits'), - callback = function() - vim.cmd('tabdo wincmd =') - end, +vim.api.nvim_create_autocmd({ "VimResized" }, { + group = augroup("resize_splits"), + callback = function() + vim.cmd("tabdo wincmd =") + end, }) -- go to last loc when opening a buffer -vim.api.nvim_create_autocmd('BufReadPost', { - group = augroup('last_loc'), - callback = function() - local mark = vim.api.nvim_buf_get_mark(0, '"') - local lcount = vim.api.nvim_buf_line_count(0) - if mark[1] > 0 and mark[1] <= lcount then - pcall(vim.api.nvim_win_set_cursor, 0, mark) - end - end, +vim.api.nvim_create_autocmd("BufReadPost", { + group = augroup("last_loc"), + callback = function() + local mark = vim.api.nvim_buf_get_mark(0, '"') + local lcount = vim.api.nvim_buf_line_count(0) + if mark[1] > 0 and mark[1] <= lcount then + pcall(vim.api.nvim_win_set_cursor, 0, mark) + end + end, }) -- close some filetypes with -vim.api.nvim_create_autocmd('FileType', { - group = augroup('close_with_q'), - pattern = { - 'Jaq', - 'PlenaryTestPopup', - 'Avante', - 'AvanteInput', - 'AvanteSelectedFiles', - 'fugitive', - 'git', - 'help', - 'lir', - 'lspinfo', - 'man', - 'netrw', - 'notify', - 'qf', - 'spectre_panel', - 'startuptime', - 'tsplayground', - }, - callback = function(event) - vim.bo[event.buf].buflisted = false - vim.keymap.set('n', 'q', 'close', { buffer = event.buf, silent = true }) - end, +vim.api.nvim_create_autocmd("FileType", { + group = augroup("close_with_q"), + pattern = { + "Jaq", + "PlenaryTestPopup", + "Avante", + "AvanteInput", + "AvanteSelectedFiles", + "fugitive", + "git", + "help", + "lir", + "lspinfo", + "man", + "netrw", + "notify", + "qf", + "spectre_panel", + "startuptime", + "tsplayground", + }, + callback = function(event) + vim.bo[event.buf].buflisted = false + vim.keymap.set("n", "q", "close", { buffer = event.buf, silent = true }) + end, }) -- wrap and check for spell in text filetypes -vim.api.nvim_create_autocmd('FileType', { - group = augroup('wrap_spell'), - pattern = { 'gitcommit', 'markdown' }, - callback = function() - vim.opt_local.wrap = true - vim.opt_local.spell = true - end, +vim.api.nvim_create_autocmd("FileType", { + group = augroup("wrap_spell"), + pattern = { "gitcommit", "markdown" }, + callback = function() + vim.opt_local.wrap = true + vim.opt_local.spell = true + end, }) -- Auto create dir when saving a file, in case some intermediate directory does not exist -vim.api.nvim_create_autocmd({ 'BufWritePre' }, { - group = augroup('auto_create_dir'), - callback = function(event) - local file = vim.loop.fs_realpath(event.match) or event.match - vim.fn.mkdir(vim.fn.fnamemodify(file, ':p:h'), 'p') - end, +vim.api.nvim_create_autocmd({ "BufWritePre" }, { + group = augroup("auto_create_dir"), + callback = function(event) + local file = vim.loop.fs_realpath(event.match) or event.match + vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") + end, }) -- Set arb filetype -vim.api.nvim_create_autocmd({ 'BufEnter' }, { - group = augroup('set_file_type'), - pattern = { '*.arb' }, - command = require('lib.util').get_file_type_cmd('arb'), +vim.api.nvim_create_autocmd({ "BufEnter" }, { + group = augroup("set_file_type"), + pattern = { "*.arb" }, + command = "setfiletype arb", }) -- Disable format options -vim.api.nvim_create_autocmd('FileType', { - group = augroup('disable_formatoptions'), - pattern = '*', - callback = function() - vim.opt_local.formatoptions:remove({ 'c', 'r', 'o' }) - end, +vim.api.nvim_create_autocmd("FileType", { + group = augroup("disable_formatoptions"), + pattern = "*", + callback = function() + vim.opt_local.formatoptions:remove({ "c", "r", "o" }) + end, }) local function enable_autoformat() - vim.api.nvim_create_autocmd({ 'BufWritePre' }, { - group = augroup('autoformat'), - pattern = { '*' }, - callback = function() - vim.lsp.buf.format() - end, - }) + vim.api.nvim_create_autocmd({ "BufWritePre" }, { + group = augroup("autoformat"), + pattern = { "*" }, + callback = function() + vim.lsp.buf.format() + end, + }) end enable_autoformat() -vim.api.nvim_create_user_command('WriteNoFormat', function() - -- Temporarily disable the autoformat autocmd - vim.api.nvim_del_augroup_by_name('keycodex_autoformat') - vim.cmd('write') - -- Re-enable the autoformat autocmd - enable_autoformat() +vim.api.nvim_create_user_command("WriteNoFormat", function() + -- Temporarily disable the autoformat autocmd + vim.api.nvim_del_augroup_by_name("keycodex_autoformat") + vim.cmd("write") + -- Re-enable the autoformat autocmd + enable_autoformat() end, {}) - -local autocmd = vim.api.nvim_create_autocmd -autocmd('Signal', { - pattern = 'SIGUSR1', - callback = function() - require('nvchad.utils').reload() - end, -}) diff --git a/lua/core/functions.lua b/lua/core/functions.lua index 9f197ae..a92c3cb 100644 --- a/lua/core/functions.lua +++ b/lua/core/functions.lua @@ -46,10 +46,23 @@ end, {}) -- Switch to git root or file parent dir vim.api.nvim_create_user_command('RootDir', function() - local root = require('lib.util').get_root_dir() - - if root == '' then + local bufname = vim.fn.expand('%:p') + if vim.fn.filereadable(bufname) == 0 then return end - vim.cmd('lcd ' .. root) + + local parent = vim.fn.fnamemodify(bufname, ':h') + local git_root = vim.fn.systemlist('git -C ' .. vim.fn.fnameescape(parent) .. ' rev-parse --show-toplevel') + local root = '' + if #git_root > 0 and git_root[1] ~= '' then + root = git_root[1] + else + root = parent + end + + if root ~= '' then + vim.cmd('lcd ' .. vim.fn.fnameescape(root)) + vim.notify('Changed directory to ' .. root, vim.log.levels.INFO) + end end, {}) + diff --git a/lua/core/keys.lua b/lua/core/keys.lua index 043edaf..63064b9 100644 --- a/lua/core/keys.lua +++ b/lua/core/keys.lua @@ -1,160 +1,102 @@ local function map(mode, lhs, rhs, opts) - opts = opts or {} - opts.silent = opts.silent ~= false - vim.keymap.set(mode, lhs, rhs, opts) + opts = opts or {} + opts.silent = opts.silent ~= false + vim.keymap.set(mode, lhs, rhs, opts) end local opts = { noremap = true, silent = true } -- Space as leader -map('n', '', '', opts) -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' +map("n", "", "", opts) +vim.g.mapleader = " " +vim.g.maplocalleader = " " -- Modes -- normal_mode = "n", insert_mode = "i", visual_mode = "v", -- visual_block_mode = "x", term_mode = "t", command_mode = "c", +-- Clear search, diff update and redraw +map({ "i", "n" }, "", "noh", { desc = "Escape and clear hlsearch" }) --- Use jj as escape -map('i', 'jj', '', opts) -map('i', 'jk', '', opts) -map('i', 'kj', '', opts) -map('t', 'JJ', '', opts) +map({ "i", "c" }, "", "") +map({ "i", "c" }, "", "") --- Terminal Mappings -map('t', 'jk', '') -map('t', 'kj', '') -map('t', '', '') +map("n", "r", vim.lsp.buf.rename) +map("n", "`", "'", { noremap = true }) -- better marks + +map("n", "H", "^", { desc = "Jump to line start" }) +map("n", "L", "$", { desc = "Jump to line end" }) -- Visual overwrite paste -map({ 'v', 'x' }, 'p', '"_dP', opts) +map({ "v", "x" }, "p", '"_dP', opts) -- Do not copy on x -map({ 'v', 'x' }, 'x', '"_x', opts) - --- VSCode style shortcuts --- File operations -map('n', '', ':w', { desc = 'Save file' }) -map('i', '', ':wa', { desc = 'Save file' }) -map('n', '', ':q', { desc = 'Quit' }) -map('n', '', ':bd', { desc = 'Close buffer' }) - --- Undo/Redo -map('n', '', 'u', { desc = 'Undo' }) -map('i', '', 'u', { desc = 'Undo' }) -map('n', '', '', { desc = 'Redo' }) -map('i', '', '', { desc = 'Redo' }) +map({ "v", "x" }, "x", '"_x', opts) +map("n", "X", '"_D', opts) +map({ "v", "x" }, "X", '"_d', opts) -- Select all -map('n', '', 'ggVG', { desc = 'Select all' }) -map('i', '', 'ggVG', { desc = 'Select all' }) - --- Copy/Cut -map('v', '', 'y', { desc = 'Copy' }) -map('v', '', 'd', { desc = 'Cut' }) - --- Line operations (VSCode style) -map('n', '', ':m .-2==', { desc = 'Move line up' }) -map('n', '', ':m .+1==', { desc = 'Move line down' }) -map('i', '', ':m .-2==gi', { desc = 'Move line up' }) -map('i', '', ':m .+1==gi', { desc = 'Move line down' }) -map('v', '', ":m '<-2gv=gv", { desc = 'Move selection up' }) -map('v', '', ":m '>+1gv=gv", { desc = 'Move selection down' }) - --- VSCode-style line operations -map('n', '', 'o', { desc = 'Insert line below' }) -map('i', '', 'o', { desc = 'Insert line below' }) - --- Quick word operations -map('n', '', 'db', { desc = 'Delete word backward' }) -map('i', '', '', { desc = 'Delete word backward' }) -map('n', '', 'dw', { desc = 'Delete word forward' }) -map('i', '', 'dw', { desc = 'Delete word forward' }) - --- Duplicate line -map('n', '', 'yykP', { desc = 'Duplicate line up' }) -map('n', '', 'yyp', { desc = 'Duplicate line down' }) -map('v', '', "y'', "y'>pgv", { desc = 'Duplicate selection down' }) - - --- Line manipulation -map('n', '', '>>', { desc = 'Indent line' }) -map('n', '', '<<', { desc = 'Unindent line' }) -map('i', '', '>>', { desc = 'Indent line' }) -map('i', '', '<<', { desc = 'Unindent line' }) - --- Visual overwrite paste -map({ 'v', 'x' }, 'p', '"_dP', opts) - --- Do not copy on x -map({ 'v', 'x' }, 'x', '"_x', opts) -map('n', 'X', '"_D', opts) -map({ 'v', 'x' }, 'X', '"_d', opts) - --- Increment/decrement -map({ 'n', 'v', 'x' }, '-', '', opts) -map({ 'n', 'v', 'x' }, '=', '', opts) - --- Move to line beginning and end -map({ 'n', 'v', 'x' }, 'gl', '$', { desc = 'End of line' }) -map({ 'n', 'v', 'x' }, 'gh', '^', { desc = 'Beginning of line' }) - --- Center Cursors -map('n', 'J', 'mzJ`z', opts) -map('n', '', 'zz', opts) -map('n', '', 'zz', opts) -map('n', 'n', 'nzzzv', opts) -map('n', 'N', 'Nzzzv', opts) - --- Better up/down -map('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) -map('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +map("n", "", "ggVG", { desc = "Select all" }) +map("i", "", "ggVG", { desc = "Select all" }) -- Move text up and down -map({ 'v', 'x' }, 'J', ":move '>+1gv-gv", opts) -map({ 'v', 'x' }, 'K', ":move '<-2gv-gv", opts) +map({ "v", "x" }, "K", ":move '<-2gv-gv", opts) +map({ "v", "x" }, "J", ":move '>+1gv-gv", opts) --- Clear search, diff update and redraw -map({ 'i', 'n' }, '', 'noh', { desc = 'Escape and clear hlsearch' }) +-- Line operations +map("n", "", ":m .-2==", { desc = "Move line up" }) +map("n", "", ":m .+1==", { desc = "Move line down" }) +map("i", "", ":m .-2==gi", { desc = "Move line up" }) +map("i", "", ":m .+1==gi", { desc = "Move line down" }) +map("v", "", ":m '<-2gv=gv", { desc = "Move selection up" }) +map("v", "", ":m '>+1gv=gv", { desc = "Move selection down" }) --- Consistent n/N search navigation -map('n', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' }) -map('x', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' }) -map('o', 'n', "'Nn'[v:searchforward]", { expr = true, desc = 'Next search result' }) -map('n', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev search result' }) -map('x', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev search result' }) -map('o', 'N', "'nN'[v:searchforward]", { expr = true, desc = 'Prev search result' }) +-- Line manipulation +map("n", "", ">>", { desc = "Indent line" }) +map("n", "", "<<", { desc = "Unindent line" }) +map("i", "", ">>", { desc = "Indent line" }) +map("i", "", "<<", { desc = "Unindent line" }) --- Better indenting -map('v', '<', '', '>gv') +-- Quick word operations +map("n", "", "db", { desc = "Delete word backward" }) +map("i", "", "", { desc = "Delete word backward" }) +map("n", "", "dw", { desc = "Delete word forward" }) +map("i", "", "dw", { desc = "Delete word forward" }) --- Add undo breakpoints -map('i', ',', ',u') -map('i', '.', '.u') -map('i', ';', ';u') - -map('n', 'd', '"_d', { desc = 'Delete without replacing clipboard' }) -map('n', 'x', '"_x', { desc = 'Cut without replacing clipboard' }) -map('n', 'c', '"_c', { desc = 'Change without replacing clipboard' }) -map('v', 'p', '"_dP', { desc = 'Paste without replacing clipboard' }) - --- Toggle relative numbers off or on (for code presentation) -map({ 'n', 'v' }, 'tn', 'set rnu!', {}) +map("n", "d", '"_d', { desc = "Delete without replacing clipboard" }) +map("n", "x", '"_x', { desc = "Cut without replacing clipboard" }) +map("n", "c", '"_c', { desc = "Change without replacing clipboard" }) +map("v", "p", '"_dP', { desc = "Paste without replacing clipboard" }) --insert the following characters around the visual selection -map('v', '(', 's()Pll', { desc = 'wrap selection with parens' }) -map('v', '[', 's[]Pll', { desc = 'wrap selection with square braces' }) -map('v', '{', 's{}Pll', { desc = 'wrap selection with curly braces' }) -map('v', "'", "s''Pll", { desc = 'wrap selection with single quotes' }) -map('v', '"', 's""Pll', { desc = 'wrap selection with double quotes' }) +map("v", "(", "s()Pll", { desc = "wrap selection with parens" }) +map("v", "[", "s[]Pll", { desc = "wrap selection with square braces" }) +map("v", "{", "s{}Pll", { desc = "wrap selection with curly braces" }) +map("v", "'", "s''Pll", { desc = "wrap selection with single quotes" }) +map("v", '"', 's""Pll', { desc = "wrap selection with double quotes" }) -- Insert mode cursor movement with Ctrl+hjkl -map('i', '', '', { desc = 'Move cursor left' }) -map('i', '', '', { desc = 'Move cursor down' }) -map('i', '', '', { desc = 'Move cursor up' }) -map('i', '', '', { desc = 'Move cursor right' }) +map("i", "", "", { desc = "Move to end of previous line" }) +map("i", "", "", { desc = "Move cursor down" }) +map("i", "", "", { desc = "Move cursor up" }) +map("i", "", "", { desc = "Move cursor right" }) +-- toggle inlay hints +vim.keymap.set("n", "th", function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) +end) +-- No arrow navigation +vim.api.nvim_set_keymap("n", "", "", opts) +vim.api.nvim_set_keymap("n", "", "", opts) +vim.api.nvim_set_keymap("n", "", "", opts) +vim.api.nvim_set_keymap("n", "", "", opts) +vim.api.nvim_set_keymap("v", "", "", opts) +vim.api.nvim_set_keymap("v", "", "", opts) +vim.api.nvim_set_keymap("v", "", "", opts) +vim.api.nvim_set_keymap("v", "", "", opts) + +vim.api.nvim_set_keymap("i", "", "", opts) +vim.api.nvim_set_keymap("i", "", "", opts) +vim.api.nvim_set_keymap("i", "", "", opts) +vim.api.nvim_set_keymap("i", "", "", opts) diff --git a/lua/core/lazy.lua b/lua/core/lazy.lua new file mode 100644 index 0000000..b2ef8ad --- /dev/null +++ b/lua/core/lazy.lua @@ -0,0 +1,37 @@ +-------------------------------------------------------------------------------- +-- Bootstrap lazy plugin manager +-------------------------------------------------------------------------------- +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- lazy config +require("lazy").setup({ + spec = { + { import = "plugins" }, + }, + install = { + missing = true, + colorscheme = { "onedark" }, + }, + change_detection = { + enable = true, + notify = false, + }, + ui = { + border = "rounded", + backdrop = 100, + }, +}) diff --git a/lua/core/lsp.lua b/lua/core/lsp.lua new file mode 100644 index 0000000..888195b --- /dev/null +++ b/lua/core/lsp.lua @@ -0,0 +1,135 @@ +-------------------------------------------------------------------------------- +-- LSP +-------------------------------------------------------------------------------- + +-- ts_ls +vim.lsp.config("ts_ls", { + settings = { + typescript = { + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + }, + }, + }, +}) +vim.lsp.enable("ts_ls") + +-- rust +vim.lsp.config("rust_analyzer", { + settings = { + ["rust-analyzer"] = { + diagnostics = { + enable = true, + experimental = { enable = true }, + }, + }, + }, +}) +vim.lsp.enable("rust_analyzer") + +-- lua +vim.lsp.config("lua_ls", { + settings = { + Lua = { + diagnostics = { + disable = { + "missing-fields", + "undefined-global", + }, + }, + }, + }, +}) +vim.lsp.enable("lua_ls") + +-- python +vim.lsp.config("basedpyright", { + settings = { + basedpyright = { + inlayHints = true, + disableDiagnostics = true, + disableOrganizeImports = true, + analysis = { + -- Ignore all files for analysis to exclusively use Ruff for linting + -- Enable diagnostics + -- ignore = { "*" }, + diagnosticSeverityOverrides = { + reportUnusedImport = "none", + reportUnusedVariable = "none", + reportAttributeAccessIssue = "none", + reportUnusedClass = "none", + reportUnusedFunction = "none", + reportDuplicateImport = "none", + reportArgumentType = "error", + }, + typeCheckingMode = "basic", + }, + }, + }, +}) +vim.lsp.enable("basedpyright") + +vim.lsp.config("pylsp", { + settings = { + pylsp = { + plugins = { + -- use black as default formatter + yapf = { enabled = false }, + autopep8 = { enabled = false }, + black = { enabled = true }, + pycodestyle = { + enabled = true, + ignore = { "E203", "E701", "W503" }, + maxLineLength = 88, + }, + }, + }, + }, +}) + +-- latex +vim.lsp.config("texlab", { + settings = { + texlab = { + build = { + executable = "latexmk", + args = { + "-lualatex", + "-interaction=nonstopmode", + "-outdir=build", + }, + onSave = true, + }, + }, + }, +}) +vim.lsp.enable("texlab") + +-- bash +vim.lsp.config("bashls", { + settings = { + bashIde = { + shellcheckArguments = { + "--exclude=SC1090,SC1091,SC2076,SC2164", + }, + }, + }, +}) +vim.lsp.enable("bashls") + +-- cpp +vim.lsp.config("clangd", { + cmd = { + "clangd", + "--fallback-style=llvm", + "--header-insertion=iwyu", + "-j=4", + }, +}) +vim.lsp.enable("clangd") diff --git a/lua/core/options.lua b/lua/core/options.lua index aa89df5..9402696 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -1,91 +1,64 @@ local options = { - ai = true, - autoindent = true, - autowrite = true, - backspace = 'indent,eol,start', - backup = false, -- creates a backup file - breakindent = true, - clipboard = 'unnamedplus', -- allows neovim to access the system clipboard - cmdheight = 1, -- more space in the neovim command line for displaying messages - completeopt = 'menu,menuone,noselect', -- mostly just for cmp - conceallevel = 0, -- so that `` is visible in markdown files - confirm = true, -- Confirm to save changes before exiting modified buffer - cursorline = true, -- highlight the current line - expandtab = true, -- convert tabs to spaces - fileencoding = 'utf-8', -- the encoding written to a file - formatoptions = 'jlnqt', -- set formatoptions, check help fo-table - grepformat = '%f:%l:%c:%m', - grepprg = 'rg --vimgrep', - hlsearch = true, -- highlight all matches on previous search pattern - ignorecase = true, -- ignore case in search patterns - inccommand = 'split', -- preview incremental substitute - laststatus = 3, - list = true, - -- listchars = { trail = '', tab = '', nbsp = '_', extends = '>', precedes = '<' }, -- highlight - mouse = 'a', -- allow the mouse to be used in neovim - number = true, -- set numbered lines - numberwidth = 4, -- set number column width to 2 {default 4} - pumblend = 10, -- Popup blen - pumheight = 10, -- pop up menu height - relativenumber = true, -- set relative numbered lines - scrolloff = 10, -- is one of my fav - sessionoptions = 'blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal', - shiftround = true, -- Round indent - shiftwidth = 4, -- the number of spaces inserted for each indentation - showcmd = false, - showmode = false, -- we don't need to see things like -- INSERT -- anymore - showtabline = 0, -- always show tabs - si = true, - sidescrolloff = 8, - signcolumn = 'yes', -- always show the sign column, otherwise it would shift the text each time - smartcase = true, -- smart case - smartindent = true, -- make indenting smarter again - smarttab = true, - splitbelow = true, -- force all horizontal splits to go below current window - splitright = true, -- force all vertical splits to go to the right of current window - swapfile = false, -- creates a swapfile - tabstop = 4, -- insert 2 spaces for a tab - termguicolors = true, -- set term gui colors (most terminals support this) - timeoutlen = 300, -- time to wait for a mapped sequence to complete (in milliseconds) - title = true, -- window titles - undofile = true, -- enable persistent undo - undodir = vim.fn.stdpath('cache') .. '/undo', - undolevels = 10000, - updatetime = 250, -- balance between responsiveness and performance - wildmenu = true, -- wildmenu - wildmode = 'longest:full,full', -- Command-line completion mode - winminwidth = 5, -- Minimum window width - wrap = false, -- display lines as one long line - writebackup = false, -- do not edit backups + ai = true, + clipboard = "unnamedplus", -- use system clipboard + number = true, + relativenumber = true, + undofile = true, -- save state of file on write + undodir = vim.fn.stdpath("cache") .. "/undo", + undolevels = 10000, + autoread = true, -- autoread changes from other sources + signcolumn = "yes", + cursorline = true, + cursorlineopt = "number", + wrap = false, + scrolloff = 3, + ruler = false, -- removes cursor position from lastline + pumheight = 10, -- size of completion window + showmode = false, -- do not show mode under statusline + swapfile = false, -- creates a swapfile + backup = false, -- creates a backup file + writebackup = false, -- do not edit backups + winminwidth = 5, -- Minimum window width + termguicolors = true, -- set term gui colors (most terminals support this) + showtabline = 0, -- always show tabs + showcmd = false, + mouse = "a", -- allow the mouse to be used in neovim + confirm = true, -- Confirm to save changes before exiting modified buffer + + -- tabs + smarttab = true, + tabstop = 4, -- 1 tab represented as 4 spaces + expandtab = true, -- key will create " " instead of "\t" + shiftwidth = 4, -- indent change after backspace and >> << + softtabstop = 4, -- number of spaces instead of tab + autoindent = true, -- auto indent + smartindent = true, -- make indenting smarter again + list = true, + -- listchars = { trail = "", tab = "", nbsp = "_", extends = ">", precedes = "<" }, -- highlight + showbreak = string.rep(" ", 3), + + -- Search + ignorecase = true, + smartcase = true, + hlsearch = true, + wildmenu = true, + wildmode = "longest:full,full", + wildoptions = "pum", + + -- Window + splitright = true, + splitbelow = true, + title = true, } for k, v in pairs(options) do - vim.opt[k] = v + vim.opt[k] = v end --- netrw file explorer settings -vim.g.netrw_winsize = 20 -vim.g.netrw_banner = 0 -vim.g.netrw_liststyle = 1 +vim.opt.path:append({ "**" }) +vim.opt.shortmess:append({ W = true, I = true, c = true }) -- disable greeting -- Fix markdown indentation settings vim.g.markdown_recommended_style = 0 -vim.opt.path:append({ '**' }) -vim.opt.shortmess:append({ W = true, I = true, c = true }) - --- hides `~` at the end of the buffer vim.cmd([[set fillchars+=eob:\ ]]) - -vim.cmd([[ - setlocal spell spelllang=en "Set spellcheck language to en - setlocal spell! "Disable spell checks by default - filetype plugin indent on - if has('win32') - let g:python3_host_prog = $HOME . '/scoop/apps/python/current/python.exe' - endif - let &t_Cs = "\e[4:3m" "Undercurl - let &t_Ce = "\e[4:0m" - set whichwrap+=<,>,[,],h,l - set iskeyword+=- - ]]) diff --git a/lua/lib/icons.lua b/lua/lib/icons.lua deleted file mode 100644 index d2f2d15..0000000 --- a/lua/lib/icons.lua +++ /dev/null @@ -1,167 +0,0 @@ -return { - diagnostics = { - Error = ' ', - Hint = '󰠠 ', - Information = ' ', - Question = ' ', - Warning = ' ', - }, - documents = { - File = ' ', - FileEmpty = ' ', - Files = ' ', - Folder = ' ', - FolderEmpty = ' ', - OpenFolder = ' ', - OpenFolderEmpty = ' ', - SymLink = ' ', - SymlinkFolder = ' ', - Import = ' ', - }, - git = { - Add = ' ', - AddAlt = ' ', - Branch = ' ', - Diff = ' ', - DiffAlt = ' ', - Ignore = '◌ ', - Mod = ' ', - Octoface = ' ', - Remove = ' ', - RemoveAlt = ' ', - Rename = ' ', - Repo = ' ', - Tag = ' ', - Untrack = ' ', - Directory = '', - }, - kind = { - Class = ' ', - Color = ' ', - Constant = ' ', - Constructor = '󰈏 ', - Copilot = ' ', - Enum = ' ', - EnumMember = ' ', - Event = ' ', - Field = ' ', - File = ' ', - Folder = ' ', - Function = '󰊕 ', - Interface = ' ', - Keyword = ' ', - Method = ' ', - Module = '', - Operator = ' ', - Property = ' ', - Reference = ' ', - Snippet = ' ', - Struct = ' ', - Text = ' ', - TypeParameter = ' ', - Unit = ' ', - Value = ' ', - Variable = ' ', - }, - type = { - Array = ' ', - Boolean = '⏻ ', - Number = ' ', - Object = ' ', - String = ' ', - }, - ui = { - Arrow = ' ', - ArrowClosed = ' ', - ArrowLeft = ' ', - ArrowOpen = ' ', - ArrowRight = ' ', - Bluetooth = ' ', - Bookmark = ' ', - Bug = ' ', - Calendar = ' ', - Camera = ' ', - Check = ' ', - ChevronRight = '', - Circle = ' ', - CircleSmall = '● ', - CircleSmallEmpty = '○ ', - Clipboard = ' ', - Close = ' ', - Code = ' ', - Collection = ' ', - Color = ' ', - Command = ' ', - Comment = ' ', - Copilot = ' ', - CopilotError = ' ', - Corner = '└ ', - Dashboard = ' ', - Database = ' ', - Download = ' ', - Edit = ' ', - Edge = '│ ', - Electric = ' ', - Eye = ' ', - Fire = ' ', - Firefox = ' ', - Flag = ' ', - Game = ' ', - Gear = ' ', - GitHub = ' ', - Heart = ' ', - History = ' ', - Home = ' ', - Incoming = ' ', - Jump = ' ', - Keyboard = ' ', - Ligthbulb = '󰌵 ', - List = '', - Lock = ' ', - Minus = '‒ ', - Music = '󰝚 ', - Neovim = ' ', - NewFile = ' ', - None = ' ', - Note = ' ', - Outgoing = ' ', - Package = ' ', - Paint = ' ', - Pause = ' ', - Pencil = ' ', - Person = ' ', - Pin = ' ', - Play = ' ', - Plug = ' ', - Plus = ' ', - Power = ' ', - PowerlineArrowLeft = '', - PowerlineArrowRight = '', - PowerlineLeftRound = '', - PowerlineRightRound = '', - Project = ' ', - Question = ' ', - Reload = ' ', - Rocket = ' ', - Save = '󰆓 ', - Search = ' ', - Separator = '▊ ', - SeparatorLight = '▍', - SeparatorDashed = '┆', - SignIn = ' ', - SignOut = ' ', - Sleep = '󰒲 ', - Star = ' ', - Table = ' ', - Telescope = ' ', - Terminal = ' ', - Test = ' ', - Time = ' ', - Topline = '‾', - Trash = ' ', - User = ' ', - Vim = ' ', - Wifi = ' ', - Windows = ' ', - }, -} diff --git a/lua/lib/prompts.lua b/lua/lib/prompts.lua deleted file mode 100644 index 725557f..0000000 --- a/lua/lib/prompts.lua +++ /dev/null @@ -1,21 +0,0 @@ -local prompts = { - docs = 'Generate comprehensive documentation for this code including parameters, return values, and usage examples.', - explain = 'Explain this code in detail, including its purpose, logic flow, and any algorithms used.', - fix = 'Identify and fix any bugs, errors, or code smells in this code.', - commit = 'Create a descriptive commit message following conventional commits format for these changes.', - optimize = 'Optimize this code for better performance, readability, and maintainability.', - review = 'Review this code for best practices, potential issues, and suggest improvements.', - tests = 'Write comprehensive unit tests covering all edge cases for this code.', -} - ----Returns a function that inserts the named prompt at cursor position ----@param prompt_name string Name of the prompt to insert ----@return function Function to execute in a keybinding -prompts.add_prompt = function(prompt_name) - local prompt_text = prompts[prompt_name] - return function() - vim.cmd("put ='" .. prompt_text:gsub("'", "''") .. "'") - end -end - -return prompts diff --git a/lua/lib/util.lua b/lua/lib/util.lua deleted file mode 100644 index 1687021..0000000 --- a/lua/lib/util.lua +++ /dev/null @@ -1,65 +0,0 @@ -local util = {} - -util.get_user_config = function(key, default) - local status_ok, user = pcall(require, 'user') - if not status_ok then - return default - end - - local user_config = user[key] - if user_config == nil then - return default - end - return user_config -end - -util.get_root_dir = function() - local bufname = vim.fn.expand('%:p') - if vim.fn.filereadable(bufname) == 0 then - return - end - - local parent = vim.fn.fnamemodify(bufname, ':h') - local git_root = vim.fn.systemlist('git -C ' .. parent .. ' rev-parse --show-toplevel') - if #git_root > 0 and git_root[1] ~= '' then - return git_root[1] - else - return parent - end -end - -util.get_file_path = function() - local buf_name = vim.api.nvim_buf_get_name(0) - if vim.fn.filereadable(buf_name) == 1 then - return buf_name - end - - local dir_name = vim.fn.fnamemodify(buf_name, ':p:h') - if vim.fn.isdirectory(dir_name) == 1 then - return dir_name - end - - return vim.loop.cwd() -end - -util.get_file_type_cmd = function(extension) - local root = util.get_root_dir() - - if extension == 'arb' and root then - local gemfile_exists = vim.fn.filereadable(root .. '/Gemfile') == 1 - local pubspec_exists = vim.fn.filereadable(root .. '/pubspec.yaml') == 1 - if gemfile_exists then - return 'setfiletype ruby' - end - if pubspec_exists then - return 'setfiletype json' - end - end - return '' -end - -util.is_present = function(bin) - return vim.fn.executable(bin) == 1 -end - -return util diff --git a/lua/plugins/ai.lua b/lua/plugins/ai.lua new file mode 100644 index 0000000..67a7e69 --- /dev/null +++ b/lua/plugins/ai.lua @@ -0,0 +1,14 @@ +return { + { + "Exafunction/windsurf.vim", + event = "VeryLazy", + config = function() + vim.keymap.set("i", "", function() + return vim.fn["codeium#Accept"]() + end, { expr = true, silent = true }) + vim.keymap.set("i", "", function() + return vim.fn["codeium#Clear"]() + end, { expr = true, silent = true }) + end, + }, +} diff --git a/lua/plugins/ai/avante.lua b/lua/plugins/ai/avante.lua deleted file mode 100644 index 254b35b..0000000 --- a/lua/plugins/ai/avante.lua +++ /dev/null @@ -1,166 +0,0 @@ -local avante = require('avante') - -local model_names = { - 'claude-3.5-sonnet', - 'claude-3.7-sonnet', - 'claude-3.7-sonnet-thought', - 'claude-sonnet-4', - 'gemini-2.0-flash-001', - 'gemini-2.5-pro', - 'gpt-4.1', - 'gpt-4o-2024-11-20', - 'o1', - 'o3-mini', - 'o4-mini', -} - -avante.setup({ - mode = 'agentic', - provider = 'copilot-gpt-4.1', - -- cursor_applying_provider = 'copilot-o3-mini', - -- auto_suggestions_provider = 'copilot-claude-3.7-sonnet', - - providers = (function() - local providers_table = { - copilot = { - endpoint = 'https://api.githubcopilot.com', - allow_insecure = false, - timeout = 10 * 60 * 1000, - extra_request_body = { - temperature = 0, - max_completion_tokens = 1000000, - reasoning_effort = 'high', - }, - }, - } - for _, model_name in ipairs(model_names) do - local provider_key = 'copilot-' .. model_name - providers_table[provider_key] = { - __inherited_from = 'copilot', - model = model_name, - display_name = provider_key, - } - end - - return providers_table - end)(), - - behaviour = { - auto_suggestions = false, - auto_set_highlight_group = true, - auto_set_keymaps = true, - auto_apply_diff_after_generation = false, - support_paste_from_clipboard = false, - minimize_diff = true, -- Whether to remove unchanged lines when applying a code block - enable_token_counting = true, - }, - hints = { enabled = false }, - mappings = { - ---@class AvanteConflictMappings - diff = { - ours = 'co', - theirs = 'ct', - all_theirs = 'ca', - both = 'cb', - cursor = 'cc', - next = ']x', - prev = '[x', - }, - suggestion = { - accept = '', - next = '', - prev = '', - dismiss = '', - }, - jump = { - next = ']]', - prev = '[[', - }, - submit = { - normal = '', - insert = '', - }, - cancel = { - normal = { '', '', 'q' }, - insert = { '' }, - }, - ask = 'aa', - edit = 'ae', - refresh = 'ar', - focus = 'af', - stop = 'as', - select_model = 'aM', - select_history = 'ah', - files = { - add_current = 'ac', - add_all_buffers = 'ab', - }, - toggle = { - default = 'at', - debug = 'ad', - hint = 'aH', - suggestion = 'aS', - repomap = 'aR', - }, - sidebar = { - apply_all = 'A', - apply_cursor = 'a', - retry_user_request = 'r', - edit_user_request = 'e', - switch_windows = '', - reverse_switch_windows = '', - remove_file = 'd', - add_file = 'a', - close = { 'q' }, - close_from_input = nil, -- e.g., { normal = "", insert = "" } - }, - }, - windows = { - ---@type "right" | "left" | "top" | "bottom" - position = 'right', - wrap = true, - width = 40, - sidebar_header = { - enabled = true, - align = 'center', - rounded = true, - }, - input = { - prefix = '> ', - height = 32, - }, - edit = { - border = 'rounded', - start_insert = true, - }, - ask = { - floating = false, - start_insert = true, - border = 'rounded', - ---@type "ours" | "theirs" - focus_on_apply = 'ours', - }, - }, - highlights = { - diff = { - current = 'DiffText', - incoming = 'DiffAdd', - }, - }, - --- @class AvanteConflictUserConfig - diff = { - autojump = true, - ---@type string | fun(): any - list_opener = 'copen', - override_timeoutlen = 500, - }, - suggestion = { - debounce = 600, - throttle = 600, - }, - disabled_tools = { - 'replace_in_file', - 'web_search', - }, - slash_commands = {}, -}) diff --git a/lua/plugins/ai/copilot.lua b/lua/plugins/ai/copilot.lua deleted file mode 100644 index 31ad413..0000000 --- a/lua/plugins/ai/copilot.lua +++ /dev/null @@ -1,45 +0,0 @@ -local copilot = require('copilot') - -copilot.setup({ - panel = { - enabled = true, - auto_refresh = false, - keymap = { - jump_prev = '[[', - jump_next = ']]', - accept = '', - refresh = 'gr', - open = '', - }, - layout = { - position = 'bottom', - ratio = 0.4, - }, - }, - suggestion = { - enabled = true, - auto_trigger = false, - debounce = 75, - keymap = { - accept = '', - accept_word = false, - accept_line = false, - next = '', - prev = '', - dismiss = '', - }, - }, - filetypes = { - yaml = true, - markdown = true, - help = true, - gitcommit = true, - gitrebase = true, - hgcommit = true, - svn = true, - cvs = true, - ['.'] = true, - }, - copilot_node_command = 'node', -- Node.js version must be > 16.x - server_opts_overrides = {}, -}) diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..4bf3efe --- /dev/null +++ b/lua/plugins/colorscheme.lua @@ -0,0 +1,39 @@ +return { + "ellisonleao/gruvbox.nvim", + priority = 1000, + config = function() + local palette = require("gruvbox").palette + require("gruvbox").setup({ + bold = false, + italic = { + strings = false, + emphasis = false, + comments = false, + folds = false, + }, + contrast = "hard", + transparent_mode = true, + overrides = { + -- builtin + SignColumn = { bg = "None" }, + CursorLineNr = { bg = "None" }, + Whitespace = { fg = palette.dark0 }, + EndOfBuffer = { fg = palette.dark0_hard }, + Visual = { fg = "None", bg = palette.dark1 }, + Label = { link = "GruvboxPurple" }, + + -- blink.cmp + BlinkCmpMenu = { link = "Normal" }, + BlinkCmpMenuBorder = { link = "BlinkCmpMenu" }, + BlinkCmpMenuSelection = { fg = "None", bg = palette.dark1 }, + BlinkCmpLabelMatch = { fg = palette.bright_green }, + BlinkCmpScrollBarGutter = { bg = palette.dark2 }, + BlinkCmpScrollBarThumb = { bg = palette.light1 }, + + -- indent guides + MiniIndentscopeSymbol = { fg = palette.dark1 }, + }, + }) + vim.cmd.colorscheme("gruvbox") + end, +} diff --git a/lua/plugins/completion.lua b/lua/plugins/completion.lua new file mode 100644 index 0000000..fe5384e --- /dev/null +++ b/lua/plugins/completion.lua @@ -0,0 +1,58 @@ +return { + -- snippets + { + "L3MON4D3/LuaSnip", + version = "*", + dependencies = { "rafamadriz/friendly-snippets" }, + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + end, + }, + + -- completion + { + "saghen/blink.cmp", + version = "*", + dependencies = { + "L3MON4D3/LuaSnip", + }, + config = function() + require("blink.cmp").setup({ + completion = { + list = { + selection = { + preselect = false, + auto_insert = true, + }, + }, + documentation = { + window = { border = "rounded" }, + auto_show = true, + auto_show_delay_ms = 50, + }, + menu = { + border = "rounded", + }, + }, + signature = { + window = { border = "rounded" }, + }, + sources = { + default = { "lsp", "path", "snippets", "buffer" }, + providers = {}, + }, + snippets = { preset = "luasnip" }, + keymap = { + preset = "none", + [""] = { "select_prev", "snippet_backward", "fallback" }, + [""] = { "select_next", "snippet_forward", "fallback" }, + [""] = { "accept", "fallback" }, + [""] = { "hide", "show" }, + [""] = { "show", "show_documentation", "hide_documentation" }, + [""] = { "scroll_documentation_up", "fallback" }, + [""] = { "scroll_documentation_down", "fallback" }, + }, + }) + end, + }, +} diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua new file mode 100644 index 0000000..3e7edeb --- /dev/null +++ b/lua/plugins/editor.lua @@ -0,0 +1,170 @@ +return { + -- surround actions + { + "nvim-mini/mini.surround", + version = "*", + config = function() + require("mini.surround").setup() + end, + }, + + -- indent guides + { + "nvim-mini/mini.indentscope", + event = "VeryLazy", + config = function() + require("mini.indentscope").setup({ + draw = { + delay = 50, + animation = require("mini.indentscope").gen_animation.linear({ + ease = "out", + duration = 15, + }), + }, + options = { + border = "top", + try_as_border = true, + indent_at_cursor = false, + }, + }) + + -- disable for certain filetypes + vim.api.nvim_create_autocmd("BufEnter", { + pattern = "*", + callback = function(args) + if vim.bo[args.buf].buftype ~= "" then + vim.b[args.buf].miniindentscope_disable = true + end + end, + }) + end, + }, + + -- Go forward/backward with square brackets + { + "echasnovski/mini.bracketed", + event = { "BufReadPost", "BufNewFile" }, + config = function() + require("mini.bracketed").setup() + end, + }, + + -- textobjects + { + "nvim-mini/mini.ai", + version = "*", + config = function() + require("mini.ai").setup({ + silent = true, + }) + end, + }, + + -- hiding colorcolumn when unneeded. + { + "m4xshen/smartcolumn.nvim", + opts = { + disabled_filetypes = { + "netrw", + "NvimTree", + "Lazy", + "mason", + "help", + "text", + "markdown", + "tex", + "html", + }, + custom_colorcolumn = { lua = "90", python = "100" }, + scope = "window", + }, + }, + + -- Dimming the highlights of unused functions, variables, parameters, and more. + { + "zbirenbaum/neodim", + enabled = false, + event = "LspAttach", + config = function() + require("neodim").setup({ + alpha = 0.5, + blend_color = nil, + hide = { + underline = true, + virtual_text = true, + signs = true, + }, + regex = { + "[uU]nused", + "[nN]ever [rR]ead", + "[nN]ot [rR]ead", + }, + priority = 128, + disable = {}, + }) + end, + }, + + { + "numToStr/Comment.nvim", + version = false, + dependencies = { + "JoosepAlviste/nvim-ts-context-commentstring", + }, + config = function() + require("Comment").setup({ + pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(), + mappings = { + basic = true, + extra = true, + }, + }) + end, + keys = { + { "gcc", mode = "n", desc = "Toggle comment line" }, + { "gc", mode = { "n", "o" }, desc = "Toggle comment linewise" }, + { "gc", mode = "x", desc = "Toggle comment linewise (visual)" }, + { "gbc", mode = "n", desc = "Toggle comment block" }, + { "gb", mode = { "n", "o" }, desc = "Toggle comment blockwise" }, + { "gb", mode = "x", desc = "Toggle comment blockwise (visual)" }, + { "/", "lua require('Comment.api').toggle.linewise.current()", desc = "Toggle comment" }, + { + "/", + "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", + desc = "Toggle comment", + mode = "v", + }, + }, + opts = {}, + }, + + -- Todo Comments + { + "folke/todo-comments.nvim", + event = "BufRead", + opts = {}, + }, + + -- inline diagnostic + { + "rachartier/tiny-inline-diagnostic.nvim", + event = "VeryLazy", + priority = 1000, + config = function() + require("tiny-inline-diagnostic").setup() + vim.diagnostic.config({ virtual_text = false }) -- Disable default virtual text + end, + }, + + -- multiple cursor + -- { + -- "terryma/vim-multiple-cursors", + -- config = function() + -- vim.g.multi_cursor_use_default_mapping = 0 + -- vim.g.multi_cursor_next_key = "" + -- vim.g.multi_cursor_prev_key = "" + -- vim.g.multi_cursor_skip_key = "" + -- vim.g.multi_cursor_quit_key = "mc" + -- end, + -- }, +} diff --git a/lua/plugins/editor/ai.lua b/lua/plugins/editor/ai.lua deleted file mode 100644 index 45f69d4..0000000 --- a/lua/plugins/editor/ai.lua +++ /dev/null @@ -1,35 +0,0 @@ -local ai = require('mini.ai') - -ai.setup({ - custom_textobjects = { - o = ai.gen_spec.treesitter({ - a = { '@block.outer', '@conditional.outer', '@loop.outer' }, - i = { '@block.inner', '@conditional.inner', '@loop.inner' }, - }, {}), - f = ai.gen_spec.treesitter({ a = '@function.outer', i = '@function.inner' }, {}), - c = ai.gen_spec.treesitter({ a = '@class.outer', i = '@class.inner' }, {}), - t = { '<([%p%w]-)%f[^<%w][^<>]->.-', '^<.->().*()$' }, - }, - - mappings = { - -- Main textobject prefixes - around = 'a', - inside = 'i', - - -- Next/last variants - around_next = 'an', - inside_next = 'in', - around_last = 'al', - inside_last = 'il', - - -- Move cursor to corresponding edge of `a` textobject - goto_left = 'g[', - goto_right = 'g]', - }, - - -- How to search for object - -- 'cover', 'cover_or_next', 'cover_or_prev','cover_or_nearest', 'next', 'previous', 'nearest'. - search_method = 'cover_or_next', - n_lines = 500, - silent = false, -}) diff --git a/lua/plugins/editor/bracketed.lua b/lua/plugins/editor/bracketed.lua deleted file mode 100644 index 24b3034..0000000 --- a/lua/plugins/editor/bracketed.lua +++ /dev/null @@ -1,18 +0,0 @@ -local bracketed = require('mini.bracketed') - -bracketed.setup({ - buffer = { suffix = 'b', options = {} }, - comment = { suffix = 'c', options = {} }, - conflict = { suffix = 'x', options = {} }, - diagnostic = { suffix = 'd', options = {} }, - file = { suffix = 'f', options = {} }, - indent = { suffix = 'i', options = {} }, - jump = { suffix = 'j', options = {} }, - location = { suffix = 'l', options = {} }, - oldfile = { suffix = 'r', options = {} }, - quickfix = { suffix = 'q', options = {} }, - treesitter = { suffix = 'n', options = {} }, - undo = { suffix = 'u', options = {} }, - window = { suffix = 'w', options = {} }, - yank = { suffix = 'y', options = {} }, -}) diff --git a/lua/plugins/editor/pairs.lua b/lua/plugins/editor/pairs.lua deleted file mode 100644 index 29b6351..0000000 --- a/lua/plugins/editor/pairs.lua +++ /dev/null @@ -1,18 +0,0 @@ -local pairs = require('mini.pairs') - -pairs.setup({ - modes = { insert = true, command = true, terminal = false }, - mappings = { - ['('] = { action = 'open', pair = '()', neigh_pattern = '[^\\].' }, - ['['] = { action = 'open', pair = '[]', neigh_pattern = '[^\\].' }, - ['{'] = { action = 'open', pair = '{}', neigh_pattern = '[^\\].' }, - - [')'] = { action = 'close', pair = '()', neigh_pattern = '[^\\].' }, - [']'] = { action = 'close', pair = '[]', neigh_pattern = '[^\\].' }, - ['}'] = { action = 'close', pair = '{}', neigh_pattern = '[^\\].' }, - - ['"'] = { action = 'closeopen', pair = '""', neigh_pattern = '[^\\].', register = { cr = false } }, - ["'"] = { action = 'closeopen', pair = "''", neigh_pattern = '[^%a\\].', register = { cr = false } }, - ['`'] = { action = 'closeopen', pair = '``', neigh_pattern = '[^\\].', register = { cr = false } }, - }, -}) diff --git a/lua/plugins/editor/spider.lua b/lua/plugins/editor/spider.lua deleted file mode 100644 index 77a12b0..0000000 --- a/lua/plugins/editor/spider.lua +++ /dev/null @@ -1,10 +0,0 @@ -local spider = require('spider') - -spider.setup({ - skipInsignificantPunctuation = true, -}) - -vim.keymap.set({ 'n', 'o', 'x' }, 'w', "lua require('spider').motion('w')", { desc = 'Spider-w' }) -vim.keymap.set({ 'n', 'o', 'x' }, 'e', "lua require('spider').motion('e')", { desc = 'Spider-e' }) -vim.keymap.set({ 'n', 'o', 'x' }, 'b', "lua require('spider').motion('b')", { desc = 'Spider-b' }) -vim.keymap.set({ 'n', 'o', 'x' }, 'ge', "lua require('spider').motion('ge')", { desc = 'Spider-ge' }) diff --git a/lua/plugins/editor/surround.lua b/lua/plugins/editor/surround.lua deleted file mode 100644 index 97a2f0d..0000000 --- a/lua/plugins/editor/surround.lua +++ /dev/null @@ -1,25 +0,0 @@ -local surround = require('mini.surround') - -surround.setup({ - custom_surroundings = nil, - mappings = { - add = 'gsa', - delete = 'gsd', - find = 'gsf', - find_left = 'gsF', - highlight = 'gsh', - replace = 'gsr', - update_n_lines = 'gsn', - - suffix_last = 'l', -- Suffix to search with "prev" method - suffix_next = 'n', -- Suffix to search with "next" method - }, - - -- How to search for surrounding - -- 'cover', 'cover_or_next', 'cover_or_prev','cover_or_nearest', 'next', 'previous', 'nearest'. - search_method = 'cover', - highlight_duration = 300, - n_lines = 20, - respect_selection_type = false, - silent = false, -}) diff --git a/lua/plugins/editor/textobjects.lua b/lua/plugins/editor/textobjects.lua deleted file mode 100644 index d7e565d..0000000 --- a/lua/plugins/editor/textobjects.lua +++ /dev/null @@ -1,116 +0,0 @@ -local textobjects = { - select = { - enable = true, - lookahead = true, - - keymaps = { - ['a='] = { query = '@assignment.outer', desc = 'Select outer part of an assignment' }, - ['i='] = { query = '@assignment.inner', desc = 'Select inner part of an assignment' }, - ['al='] = { query = '@assignment.lhs', desc = 'Select left hand side of an assignment' }, - ['ar='] = { - query = '@assignment.rhs', - desc = 'Select right hand side of an assignment', - }, - - ['a:'] = { query = '@property.outer', desc = 'Select outer part of an object property' }, - ['i:'] = { query = '@property.inner', desc = 'Select inner part of an object property' }, - ['l:'] = { query = '@property.lhs', desc = 'Select left part of an object property' }, - ['r:'] = { query = '@property.rhs', desc = 'Select right part of an object property' }, - - ['aa'] = { - query = '@parameter.outer', - desc = 'Select outer part of a parameter/argument', - }, - ['ia'] = { - query = '@parameter.inner', - desc = 'Select inner part of a parameter/argument', - }, - - ['ai'] = { query = '@conditional.outer', desc = 'Select outer part of a conditional' }, - ['ii'] = { query = '@conditional.inner', desc = 'Select inner part of a conditional' }, - - ['al'] = { query = '@loop.outer', desc = 'Select outer part of a loop' }, - ['il'] = { query = '@loop.inner', desc = 'Select inner part of a loop' }, - - ['af'] = { query = '@call.outer', desc = 'Select outer part of a function call' }, - ['if'] = { query = '@call.inner', desc = 'Select inner part of a function call' }, - - ['am'] = { - query = '@function.outer', - desc = 'Select outer part of a method/function definition', - }, - ['im'] = { - query = '@function.inner', - desc = 'Select inner part of a method/function definition', - }, - - ['ac'] = { query = '@class.outer', desc = 'Select outer part of a class' }, - ['ic'] = { query = '@class.inner', desc = 'Select inner part of a class' }, - }, - }, - swap = { - enable = true, - swap_next = { - ['rna'] = '@parameter.inner', -- swap object property with next - ['rn:'] = '@property.outer', -- swap parameters/argument with next - ['rnm'] = '@function.outer', -- swap function with next - }, - swap_previous = { - ['rpa'] = '@parameter.inner', -- swap parameters/argument with prev - ['rp:'] = '@property.outer', -- swap object property with prev - ['rpm'] = '@function.outer', -- swap function with previous - }, - }, - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_previous_start = { - ['[oc'] = { query = '@class.outer', desc = 'Prev class start' }, - ['[of'] = { query = '@call.outer', desc = 'Prev function call start' }, - ['[oi'] = { query = '@conditional.outer', desc = 'Prev conditional start' }, - ['[ol'] = { query = '@loop.outer', desc = 'Prev loop start' }, - ['[om'] = { query = '@function.outer', desc = 'Prev method def start' }, - ['[z'] = { query = '@fold', query_group = 'folds', desc = 'Prev fold' }, - -- You can pass a query group to use query from `queries//.scm file in your runtime path. - -- Above example nvim-treesitter's folds.scm`. They also provide locals.scm, highlights.scm and indent.scm. - }, - goto_previous_end = { - ['[oC'] = { query = '@class.outer', desc = 'Prev class end' }, - ['[oF'] = { query = '@call.outer', desc = 'Prev function call end' }, - ['[oI'] = { query = '@conditional.outer', desc = 'Prev conditional end' }, - ['[oL'] = { query = '@loop.outer', desc = 'Prev loop end' }, - ['[oM'] = { query = '@function.outer', desc = 'Prev method def end' }, - ['[Z'] = { query = '@fold', query_group = 'folds', desc = 'Prev fold end' }, - }, - goto_next_start = { - [']oc'] = { query = '@class.outer', desc = 'Next class start' }, - [']of'] = { query = '@call.outer', desc = 'Next function call start' }, - [']oi'] = { query = '@conditional.outer', desc = 'Next conditional start' }, - [']ol'] = { query = '@loop.outer', desc = 'Next loop start' }, - [']om'] = { query = '@function.outer', desc = 'Next method def start' }, - [']z'] = { query = '@fold', query_group = 'folds', desc = 'Next fold' }, - }, - goto_next_end = { - [']oC'] = { query = '@class.outer', desc = 'Next class end' }, - [']oF'] = { query = '@call.outer', desc = 'Next function call end' }, - [']oI'] = { query = '@conditional.outer', desc = 'Next conditional end' }, - [']oL'] = { query = '@loop.outer', desc = 'Next loop end' }, - [']oM'] = { query = '@function.outer', desc = 'Next method def end' }, - [']Z'] = { query = '@fold', query_group = 'folds', desc = 'Next fold end' }, - }, - }, -} - -local ts_repeat_move = require('nvim-treesitter.textobjects.repeatable_move') - --- vim way: ; goes to the direction you were moving. -vim.keymap.set({ 'n', 'x', 'o' }, ';', ts_repeat_move.repeat_last_move) -vim.keymap.set({ 'n', 'x', 'o' }, ',', ts_repeat_move.repeat_last_move_opposite) - --- Optionally, make builtin f, F, t, T also repeatable with ; and , -vim.keymap.set({ 'n', 'x', 'o' }, 'f', ts_repeat_move.builtin_f) -vim.keymap.set({ 'n', 'x', 'o' }, 'F', ts_repeat_move.builtin_F) -vim.keymap.set({ 'n', 'x', 'o' }, 't', ts_repeat_move.builtin_t) -vim.keymap.set({ 'n', 'x', 'o' }, 'T', ts_repeat_move.builtin_T) - -return textobjects diff --git a/lua/plugins/editor/treesitter.lua b/lua/plugins/editor/treesitter.lua deleted file mode 100644 index 29ad6dc..0000000 --- a/lua/plugins/editor/treesitter.lua +++ /dev/null @@ -1,81 +0,0 @@ -local treesitter = require('nvim-treesitter.configs') -local textobjects = require('plugins.editor.textobjects') - -local auto_install = require('lib.util').get_user_config('auto_install', true) -local installed_parsers = {} -if auto_install then - installed_parsers = require('plugins.list').ts_parsers -end - -treesitter.setup({ - ensure_installed = installed_parsers, - sync_install = false, - ignore_install = {}, - auto_install = true, - - textobjects = textobjects, - matchup = { enable = true }, - indent = { enable = true }, - - highlight = { - enable = true, - disable = function(lang, buf) - local max_filesize = 1000 * 1024 -- 1 MB instead of 100 KB - local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) - if ok and stats and stats.size > max_filesize then - return true - end - end, - additional_vim_regex_highlighting = false, - }, - - incremental_selection = { - enable = true, - keymaps = { - init_selection = '', - node_incremental = '', - scope_incremental = false, - node_decremental = '', - }, - }, - - textsubjects = { - enable = true, - prev_selection = ',', - keymaps = { - ['.'] = { 'textsubjects-smart', desc = 'Select the current text subject' }, - ['a;'] = { - 'textsubjects-container-outer', - desc = 'Select outer container (class, function, etc.)', - }, - ['i;'] = { - 'textsubjects-container-inner', - desc = 'Select inside containers (classes, functions, etc.)', - }, - }, - }, - - refactor = { - highlight_definitions = { - enable = true, - clear_on_cursor_move = true, - }, - highlight_current_scope = { enable = true }, - smart_rename = { - enable = true, - keymaps = { - smart_rename = 'rr', - }, - }, - navigation = { - enable = true, - keymaps = { - goto_definition = 'rd', - list_definitions = 'rl', - list_definitions_toc = 'rh', - goto_next_usage = 'rj', - goto_previous_usage = 'rk', - }, - }, - }, -}) diff --git a/lua/plugins/files.lua b/lua/plugins/files.lua new file mode 100644 index 0000000..8e1c6e4 --- /dev/null +++ b/lua/plugins/files.lua @@ -0,0 +1,55 @@ +return { + { + "echasnovski/mini.files", + version = "*", + event = { "BufReadPost", "BufNewFile" }, + config = function() + require("mini.files").setup({ + content = { + filter = nil, + prefix = nil, + sort = nil, + }, + mappings = { + close = "q", + go_in = "L", + go_in_plus = "l", + go_out = "h", + go_out_plus = "H", + mark_goto = "'", + mark_set = "m", + reset = "", + reveal_cwd = "@", + show_help = "g?", + synchronize = "", + trim_left = "<", + trim_right = ">", + }, + options = { + permanent_delete = true, + use_as_default_explorer = true, + }, + windows = { + max_number = math.huge, + preview = false, + width_focus = 30, + width_nofocus = 20, + width_preview = 80, + }, + }) + end, + }, + { + "prichrd/netrw.nvim", + config = function() + require("netrw").setup({ + icons = { + symlink = "", + directory = "", + file = "", + }, + use_devicons = true, + }) + end, + }, +} diff --git a/lua/plugins/format.lua b/lua/plugins/format.lua new file mode 100644 index 0000000..506c3bb --- /dev/null +++ b/lua/plugins/format.lua @@ -0,0 +1,37 @@ +return { + "stevearc/conform.nvim", + dependencies = { "zapling/mason-conform.nvim" }, + event = "BufWritePre", + cmd = "ConformInfo", + keys = { "tf" }, + config = function() + require("conform").setup({ + formatters_by_ft = { + lua = { "stylua" }, + python = { "black" }, + ["_"] = { "trim_whitespace" }, + }, + format_after_save = function(bufnr) + if not vim.b[bufnr].conform_disable then + return { + lsp_format = "fallback", + } + end + end, + }) + + vim.keymap.set("n", "tf", function() + vim.b.conform_disable = not vim.b.conform_disable + local status = vim.b.conform_disable and "disabled" or "enabled" + vim.notify("Autoformat " .. status, vim.log.levels.INFO) + end) + require("mason-conform").setup({ + ensure_installed = { + "black", + "stylua", + "prettier", + }, + automatic_installation = true, + }) + end, +} diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua new file mode 100644 index 0000000..61cb5dd --- /dev/null +++ b/lua/plugins/git.lua @@ -0,0 +1,63 @@ +return { + + -- git signs + { + "lewis6991/gitsigns.nvim", + opts = { + signs = { + add = { + text = "+", + }, + change = { + text = "▎", + }, + delete = { + text = "", + }, + topdelete = { + text = "▾", + }, + changedelete = { + text = "~", + }, + untracked = { + text = "┆", + }, + }, + signs_staged = { + add = { + text = "+", + }, + change = { + text = "▎", + }, + delete = { + text = "", + }, + topdelete = { + text = "▾", + }, + changedelete = { + text = "~", + }, + }, + }, + }, + + -- lazygit integration + { + "kdheepak/lazygit.nvim", + lazy = true, + enabled = false, + cmd = { + "LazyGit", + "LazyGitConfig", + "LazyGitCurrentFile", + "LazyGitFilter", + "LazyGitFilterCurrentFile", + }, + keys = { + { "lg", "LazyGit", desc = "LazyGit" }, + }, + }, +} diff --git a/lua/plugins/lang/blink.lua b/lua/plugins/lang/blink.lua deleted file mode 100644 index de36bd8..0000000 --- a/lua/plugins/lang/blink.lua +++ /dev/null @@ -1,84 +0,0 @@ -local blink = require('blink.cmp') -local icons = require('lib.icons') - -blink.setup({ - -- 'default', 'super-tab', 'enter' - keymap = { - preset = 'enter', - [''] = { 'select_next', 'snippet_forward', 'fallback' }, - [''] = { 'select_prev', 'snippet_backward', 'fallback' }, - [''] = { 'show', 'hide' }, - [''] = { 'show_documentation', 'hide_documentation' }, - }, - snippets = { preset = 'luasnip' }, - completion = { - list = { - selection = { - auto_insert = true, - preselect = true, - }, - }, - menu = { border = 'rounded' }, - documentation = { window = { border = 'rounded' } }, - }, - signature = { window = { border = 'rounded' } }, - appearance = { - -- Sets the fallback highlight groups to nvim-cmp's highlight groups - use_nvim_cmp_as_default = true, - -- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' - nerd_font_variant = 'normal', - kind_icons = icons.kind, - }, - sources = { - default = { 'avante', 'lazydev', 'lsp', 'path', 'snippets', 'buffer', 'copilot', 'spell' }, - providers = { - avante = { - module = 'blink-cmp-avante', - name = 'Avante', - opts = {}, - }, - copilot = { - name = 'copilot', - module = 'blink-cmp-copilot', - score_offset = 90, - async = true, - transform_items = function(_, items) - local CompletionItemKind = require('blink.cmp.types').CompletionItemKind - local kind_idx = #CompletionItemKind + 1 - CompletionItemKind[kind_idx] = 'Copilot' - for _, item in ipairs(items) do - item.kind = kind_idx - end - return items - end, - }, - lazydev = { - name = 'LazyDev', - module = 'lazydev.integrations.blink', - -- make lazydev completions top priority (see `:h blink.cmp`) - score_offset = 100, - }, - spell = { - name = 'Spell', - module = 'blink-cmp-spell', - opts = { - -- EXAMPLE: Only enable source in `@spell` captures, and disable it - -- in `@nospell` captures. - enable_in_context = function() - local curpos = vim.api.nvim_win_get_cursor(0) - local captures = vim.treesitter.get_captures_at_pos(0, curpos[1] - 1, curpos[2] - 1) - local in_spell_capture = false - for _, cap in ipairs(captures) do - if cap.capture == 'spell' then - in_spell_capture = true - elseif cap.capture == 'nospell' then - return false - end - end - return in_spell_capture - end, - }, - }, - }, - }, -}) diff --git a/lua/plugins/lang/conform.lua b/lua/plugins/lang/conform.lua deleted file mode 100644 index 4143048..0000000 --- a/lua/plugins/lang/conform.lua +++ /dev/null @@ -1,64 +0,0 @@ -local conform = require('conform') - --- Setup formatters -conform.setup({ - formatters_by_ft = { - lua = { 'stylua' }, - javascript = { 'prettier' }, - typescript = { 'prettier' }, - javascriptreact = { 'prettier' }, - typescriptreact = { 'prettier' }, - markdown = { 'prettier' }, - css = { 'prettier' }, - scss = { 'prettier' }, - html = { 'prettier' }, - json = { 'prettier' }, - yaml = { 'prettier' }, - sh = { 'shfmt', 'shellcheck' }, - ['_'] = { 'trim_whitespace', lsp_format = 'prefer' }, - }, - - -- Autoformat on save - format_on_save = { - timeout_ms = 1000, - lsp_fallback = true, - }, -}) - -vim.api.nvim_create_user_command('FormatDisable', function(args) - if args.bang then - -- FormatDisable! will disable formatting just for this buffer - vim.b.disable_autoformat = true - else - vim.g.disable_autoformat = true - vim.notify('Autoformat on save disabled', vim.log.levels.WARN) - end -end, { - desc = 'Disable autoformat-on-save', - bang = true, -}) -vim.api.nvim_create_user_command('FormatEnable', function() - vim.b.disable_autoformat = false - vim.g.disable_autoformat = false - vim.notify('Autoformat on save enabled', vim.log.levels.INFO) -end, { - desc = 'Re-enable autoformat-on-save', -}) - --- Add keymap to disable and enable format on save -vim.keymap.set('n', [[\f]], function() - if vim.b.disable_autoformat or vim.g.disable_autoformat then - vim.cmd('FormatEnable') - else - vim.cmd('FormatDisable') - end -end, { desc = 'Toggle auto-format' }) - --- Setup mason-conform -local auto_install = require('lib.util').get_user_config('auto_install', true) -local installed_formatters = require('plugins.list').formatter_sources or {} - -require('mason-conform').setup({ - ensure_installed = installed_formatters, - automatic_installation = auto_install, -}) diff --git a/lua/plugins/lang/lspconfig.lua b/lua/plugins/lang/lspconfig.lua deleted file mode 100644 index 9bf6d39..0000000 --- a/lua/plugins/lang/lspconfig.lua +++ /dev/null @@ -1,75 +0,0 @@ -local lspconfig = require('lspconfig') -local icons = require('lib.icons').diagnostics - -local auto_install = require('lib.util').get_user_config('auto_install', true) -local installed_servers = {} -if auto_install then - installed_servers = require('plugins.list').lsp_servers -end - -local capabilities = require('blink.cmp').get_lsp_capabilities() - --- Function to load LSP config from separate files -local function load_lsp_config(server_name) - local config_path = 'lsp.' .. server_name - local ok, config = pcall(require, config_path) - if ok then - return config - end - return nil -end - -local default_setup = function(server) - -- Check if there's a separate config file for this server - local custom_config = load_lsp_config(server) - - if custom_config then - -- Use the custom configuration and add capabilities - local config = vim.tbl_deep_extend('force', custom_config, { - capabilities = capabilities, - }) - lspconfig[server].setup(config) - else - lspconfig[server].setup({ - capabilities = capabilities, - }) - end -end - -require('mason-lspconfig').setup({ - ensure_installed = installed_servers, - handlers = { default_setup }, -}) - --- Setup servers that don't come from Mason --- Dart language server (comes with Dart SDK) -if vim.fn.executable('dart') == 1 then - local dart_config = load_lsp_config('dartls') - if dart_config then - local config = vim.tbl_deep_extend('force', dart_config, { - capabilities = capabilities, - }) - lspconfig.dartls.setup(config) - else - lspconfig.dartls.setup({ - capabilities = capabilities, - }) - end -end - -local signs = { Error = icons.Error, Warn = icons.Warning, Hint = icons.Hint, Info = icons.Information } -vim.diagnostic.config({ - underline = true, - update_in_insert = true, - severity_sort = true, - virtual_text = true, - float = true, - signs = { - text = { - [vim.diagnostic.severity.ERROR] = signs.Error, - [vim.diagnostic.severity.WARN] = signs.Warn, - [vim.diagnostic.severity.INFO] = signs.Info, - [vim.diagnostic.severity.HINT] = signs.Hint, - }, - }, -}) diff --git a/lua/plugins/lang/lspsaga.lua b/lua/plugins/lang/lspsaga.lua deleted file mode 100644 index 892e3b5..0000000 --- a/lua/plugins/lang/lspsaga.lua +++ /dev/null @@ -1,21 +0,0 @@ -local lspsaga = require('lspsaga') - -local icons = require('lib.icons') - -lspsaga.setup({ - ui = { - theme = 'round', - border = 'rounded', - devicon = true, - title = true, - winblend = 1, - expand = icons.ui.ArrowOpen, - collapse = icons.ui.ArrowClosed, - preview = icons.ui.List, - code_action = icons.diagnostics.Hint, - diagnostic = icons.ui.Bug, - incoming = icons.ui.Incoming, - outgoing = icons.ui.Outgoing, - hover = icons.ui.Comment, - }, -}) diff --git a/lua/plugins/lang/mason.lua b/lua/plugins/lang/mason.lua deleted file mode 100644 index aa10be6..0000000 --- a/lua/plugins/lang/mason.lua +++ /dev/null @@ -1,35 +0,0 @@ -local mason = require('mason') - -local icons = require('lib.icons') -mason.setup({ - -- - "prepend": Use mason binary, "append": Use system binary - PATH = 'append', - - log_level = vim.log.levels.INFO, - max_concurrent_installers = 8, - - ui = { - check_outdated_packages_on_open = true, - border = 'rounded', - width = 0.8, - height = 0.8, - - icons = { - package_installed = icons.ui.Gear, - package_pending = icons.ui.Download, - package_uninstalled = icons.ui.Plus, - }, - - keymaps = { - toggle_package_expand = '', - install_package = 'i', - update_package = 'u', - check_package_version = 'c', - update_all_packages = 'U', - check_outdated_packages = 'C', - uninstall_package = 'x', - cancel_installation = '', - apply_language_filter = '', - }, - }, -}) diff --git a/lua/plugins/lang/nvim-lint.lua b/lua/plugins/lang/nvim-lint.lua deleted file mode 100644 index fb143e9..0000000 --- a/lua/plugins/lang/nvim-lint.lua +++ /dev/null @@ -1,64 +0,0 @@ -local lint = require('lint') - --- Filetype to linters mapping -lint.linters_by_ft = { - javascript = { 'eslint_d' }, - typescript = { 'eslint_d' }, - javascriptreact = { 'eslint_d' }, - typescriptreact = { 'eslint_d' }, - dockerfile = { 'hadolint' }, - vim = { 'vint' }, - markdown = { 'write_good', 'markdownlint' }, - text = { 'write_good' }, - sh = { 'shellcheck' }, - yaml = { 'actionlint' }, -} - --- Generic lint function with global linters -local function lint_buffer(bufnr) - local ft = vim.bo[bufnr or 0].filetype - local linters = vim.list_extend( - { 'codespell', 'editorconfig-checker' }, -- global linters - require('lint')._resolve_linter_by_ft(ft) or {} - ) - - local ctx = { - filename = vim.api.nvim_buf_get_name(bufnr or 0), - } - ctx.dirname = vim.fn.fnamemodify(ctx.filename, ':h') - - -- Filter linters by executable availability - linters = vim.tbl_filter(function(name) - local linter = require('lint').linters[name] - return linter and vim.fn.executable(linter.cmd) == 1 and (not linter.condition or linter.condition(ctx)) - end, linters) - - if #linters > 0 then - require('lint').try_lint(linters) - end -end - --- Create one reusable timer -local uv = vim.loop -local timer = uv.new_timer() - -vim.api.nvim_create_autocmd({ 'BufReadPost', 'BufWritePost', 'InsertLeave' }, { - callback = function(args) - timer:stop() - timer:start(100, 0, function() - vim.schedule(function() - lint_buffer(args.buf) - end) - end) - end, - desc = 'Lint buffer with custom linters', -}) - --- Setup mason-nvim-lint to auto-install linters -local auto_install = require('lib.util').get_user_config('auto_install', true) -local installed_linters = require('plugins.list').linter_sources or {} - -require('mason-nvim-lint').setup({ - ensure_installed = installed_linters, - automatic_installation = auto_install, -}) diff --git a/lua/plugins/languages.lua b/lua/plugins/languages.lua new file mode 100644 index 0000000..41c4a50 --- /dev/null +++ b/lua/plugins/languages.lua @@ -0,0 +1,116 @@ +return { + -- treesitter + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + event = { "BufReadPost", "BufNewFile" }, + config = function() + require("nvim-treesitter").setup({ + ensure_installed = { + "c", + "markdown", + "python", + "java", + "cpp", + "bash", + "lua", + "make", + "latex", + "json", + "jsonc", + "sql", + "yaml", + "toml", + "javascript", + "ts_ls", + "gitignore", + "go", + "rust", + "html", + "css", + "scss", + "markdown_inline", + }, + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = true, + }, + indent = { + enable = true, + }, + }) + end, + }, + + -- rendering for html, latex, md + { + "OXY2DEV/markview.nvim", + lazy = false, + -- to load before treesitter + priority = 45, + config = function() + require("markview").setup({ + markdown = { + code_blocks = { sign = false }, + }, + }) + end, + }, + + -- markdown preview + { + "iamcco/markdown-preview.nvim", + build = "cd app && yarn install", + init = function() + vim.g.mkdp_filetypes = { "markdown" } + end, + ft = "markdown", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview" }, + }, + + { + "danymat/neogen", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + opts = { + snippet_engine = "luasnip", + languages = { + python = { + template = { + annotation_convention = "google_docstrings", + }, + }, + }, + }, + }, + + -- auto pairs + { + "windwp/nvim-autopairs", + event = "InsertEnter", + config = function() + require("nvim-autopairs").setup() + + -- add new rules + local pairs = require("nvim-autopairs") + local rule = require("nvim-autopairs.rule") + local cond = require("nvim-autopairs.conds") + pairs.add_rules({ + rule("$", "$", { "tex", "latex", "plaintex" }) + -- do not move right when repeat character + :with_move(cond.none()), + }) + end, + }, + + { + "windwp/nvim-ts-autotag", + event = "InsertEnter", + lazy = true, + opts = { + enable_close = true, + enable_rename = true, + enable_close_on_slash = true, + }, + }, +} diff --git a/lua/plugins/lazy.lua b/lua/plugins/lazy.lua deleted file mode 100644 index e9b2fe4..0000000 --- a/lua/plugins/lazy.lua +++ /dev/null @@ -1,131 +0,0 @@ --- put this in your main init.lua file ( before lazy setup ) -vim.g.base46_cache = vim.fn.stdpath('data') .. '/base46_cache/' - -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', - '--single-branch', - 'https://github.com/folke/lazy.nvim.git', - lazypath, - }) -end -vim.opt.runtimepath:prepend(lazypath) - -local status_ok, lazy = pcall(require, 'lazy') -if not status_ok then - return -end - -local icons = require('lib.icons') -local plugins = require('plugins.list').plugins - -lazy.setup({ - root = vim.fn.stdpath('data') .. '/lazy', - defaults = { lazy = true }, - spec = plugins, - lockfile = vim.fn.stdpath('config') .. '/lua/plugins/lock.json', - concurrency = 8, - dev = { path = '~/Projects/Github', patterns = { 'Projects' }, fallback = true }, - install = { missing = true, colorscheme = { 'nvchad' } }, - - git = { - log = { '--since=3 days ago' }, - timeout = 120, - url_format = 'https://github.com/%s.git', - filter = true, - }, - - ui = { - size = { width = 0.9, height = 0.8 }, - wrap = true, - border = 'rounded', - icons = { - cmd = icons.ui.Terminal, - config = icons.ui.Gear, - event = icons.ui.Electric, - ft = icons.documents.File, - init = icons.ui.Rocket, - import = icons.documents.Import, - keys = icons.ui.Keyboard, - lazy = icons.ui.Sleep, - loaded = icons.ui.CircleSmall, - not_loaded = icons.ui.CircleSmallEmpty, - plugin = icons.ui.Package, - runtime = icons.ui.Neovim, - source = icons.ui.Code, - start = icons.ui.Play, - task = icons.ui.Check, - list = { - icons.ui.CircleSmall, - icons.ui.Arrow, - icons.ui.Star, - icons.ui.Minus, - }, - }, - browser = nil, - throttle = 20, - custom_keys = { - ['l'] = function(plugin) - require('lazy.util').float_term({ 'lazygit', 'log' }, { - cwd = plugin.dir, - }) - end, - - ['t'] = function(plugin) - require('lazy.util').float_term(nil, { - cwd = plugin.dir, - }) - end, - }, - }, - - diff = { cmd = 'git' }, - checker = { enabled = false, concurrency = nil, notify = true, frequency = 3600 }, - change_detection = { enabled = true, notify = true }, - performance = { - cache = { enabled = true }, - reset_packpath = true, - rtp = { - reset = true, - paths = {}, - disabled_plugins = { - 'gzip', - 'tarPlugin', - 'zipPlugin', - 'tohtml', - -- 'tutor', - -- 'matchit', - -- 'matchparen', - -- 'netrwPlugin', - }, - }, - }, - readme = { - root = vim.fn.stdpath('state') .. '/lazy/readme', - files = { 'README.md', 'lua/**/README.md' }, - skip_if_doc_exists = true, - }, - state = vim.fn.stdpath('state') .. '/lazy/state.json', -}) - --- put this after lazy setup --- Load base46 cache files if they exist -local function load_base46_cache() - local cache_dir = vim.g.base46_cache - - -- Check if cache files exist, if not try to generate them - if not vim.loop.fs_stat(cache_dir .. 'defaults') then - pcall(function() - require('base46').load_all_highlights() - end) - end - - -- Load cache files - pcall(dofile, cache_dir .. 'defaults') - pcall(dofile, cache_dir .. 'statusline') -end - -load_base46_cache() diff --git a/lua/plugins/lint.lua b/lua/plugins/lint.lua new file mode 100644 index 0000000..692e169 --- /dev/null +++ b/lua/plugins/lint.lua @@ -0,0 +1,33 @@ +return { + "mfussenegger/nvim-lint", + dependencies = { "rshkarin/mason-nvim-lint" }, + event = { "BufReadPost", "BufNewFile" }, + config = function() + require("lint").linters_by_ft = { + javascript = { "eslint_d" }, + typescript = { "eslint_d" }, + javascriptreact = { "eslint_d" }, + typescriptreact = { "eslint_d" }, + dockerfile = { "hadolint" }, + markdown = { "write_good", "markdownlint" }, + text = { "write_good" }, + sh = { "shellcheck" }, + yaml = { "actionlint" }, + python = { "ruff" }, + } + require("mason-nvim-lint").setup({ + ensure_installed = { + "eslint_d", + "hadolint", + "write_good", + "markdownlint", + "shellcheck", + "actionlint", + "djlint", + "ruff", + "pylint", + }, + automatic_installation = true, + }) + end, +} diff --git a/lua/plugins/list.lua b/lua/plugins/list.lua deleted file mode 100644 index 908c81f..0000000 --- a/lua/plugins/list.lua +++ /dev/null @@ -1,599 +0,0 @@ -local util = require('lib.util') -local function load_config(package) - return function() - require('plugins.' .. package) - end -end - -local plugins = { - -- UI - { - 'nvchad/ui', - config = function() - require('nvchad') - end, - }, - { - 'nvchad/base46', - lazy = false, - priority = 1000, - build = function() - require('base46').load_all_highlights() - end, - config = function() - require('base46').load_all_highlights() - end, - }, - { 'nvim-tree/nvim-web-devicons' }, - { - 'folke/snacks.nvim', - priority = 1000, - lazy = false, - config = load_config('ui.snacks'), - }, - { - 'nvim-lualine/lualine.nvim', - config = load_config('ui.lualine'), - event = { 'BufReadPost', 'BufNewFile' }, - }, - { - 'folke/which-key.nvim', - config = load_config('ui.which-key'), - event = 'VeryLazy', - }, - { - 'lewis6991/gitsigns.nvim', - config = load_config('ui.gitsigns'), - cmd = 'Gitsigns', - event = { 'BufReadPost', 'BufNewFile' }, - }, - - -- Editor - { - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - dependencies = { - 'nvim-treesitter/nvim-treesitter-refactor', - 'nvim-treesitter/nvim-treesitter-textobjects', - 'RRethy/nvim-treesitter-textsubjects', - }, - config = load_config('editor.treesitter'), - event = { 'BufReadPost', 'BufNewFile' }, - }, - - { - 'echasnovski/mini.bracketed', - config = load_config('editor.bracketed'), - event = { 'BufReadPost', 'BufNewFile' }, - }, - { - 'echasnovski/mini.pairs', - config = load_config('editor.pairs'), - event = 'InsertEnter', - }, - { - 'echasnovski/mini.surround', - version = '*', - config = load_config('editor.surround'), - event = { 'BufReadPost', 'BufNewFile' }, - }, - { - 'echasnovski/mini.ai', - version = '*', - config = load_config('editor.ai'), - event = { 'BufReadPost', 'BufNewFile' }, - }, - { - 'Wansmer/treesj', - keys = { 'm', 'j', 's' }, - dependencies = { 'nvim-treesitter/nvim-treesitter' }, -- if you install parsers with `nvim-treesitter` - config = function() - require('treesj').setup() - end, - }, - { - 'chrisgrieser/nvim-spider', - config = load_config('editor.spider'), - event = { 'BufReadPost', 'BufNewFile' }, - }, - -- Language - { - 'neovim/nvim-lspconfig', - dependencies = { 'williamboman/mason-lspconfig.nvim' }, - config = load_config('lang.lspconfig'), - event = { 'BufReadPre', 'BufNewFile' }, - }, - { - 'folke/lazydev.nvim', - ft = 'lua', - }, - { - 'nvimdev/lspsaga.nvim', - config = load_config('lang.lspsaga'), - event = 'LspAttach', - }, - { - 'williamboman/mason.nvim', - config = load_config('lang.mason'), - cmd = 'Mason', - }, - { - 'stevearc/conform.nvim', - dependencies = { 'zapling/mason-conform.nvim' }, - config = load_config('lang.conform'), - event = { 'BufReadPre', 'BufNewFile' }, - }, - { - 'mfussenegger/nvim-lint', - dependencies = { 'rshkarin/mason-nvim-lint' }, - init = function() - if vim.fn.executable('codespell') == 1 then - vim.o.spell = false - end - end, - config = load_config('lang.nvim-lint'), - event = { 'BufReadPost', 'BufNewFile' }, - }, - { - 'saghen/blink.cmp', - dependencies = { - 'rafamadriz/friendly-snippets', - 'Kaiser-Yang/blink-cmp-avante', - 'ribru17/blink-cmp-spell', - { - 'L3MON4D3/LuaSnip', - config = function() - -- Lazy load VSCode-style snippets (including JSON) - require('luasnip.loaders.from_vscode').lazy_load({ - paths = { - vim.fn.stdpath('config') .. '/snippets', -- your custom snippets folder - }, - }) - end, - }, - }, - - version = '*', - config = load_config('lang.blink'), - opts_extend = { 'sources.default' }, - event = { 'InsertEnter' }, - }, - { - 'mg979/vim-visual-multi', - branch = 'master', -- Required to avoid loading the legacy branch - event = { 'BufReadPost', 'BufNewFile' }, -- Load earlier when buffer is ready - init = function() - vim.g.VM_leader = '\\' - vim.g.VM_maps = { - ['Find Under'] = '', -- Changed to match VSCode - ['Find Subword Under'] = '', -- Changed to match VSCode - ['Select All'] = '', - ['Add Cursor Down'] = '', -- More intuitive than - ['Add Cursor Up'] = '', -- More intuitive than - ['Select Cursor Down'] = '', - ['Select Cursor Up'] = '', - } - -- Keep default mappings for better functionality - vim.g.VM_default_mappings = 1 - end, - }, - - -- AI - { - 'zbirenbaum/copilot.lua', - dependencies = { 'giuxtaposition/blink-cmp-copilot' }, - config = load_config('ai.copilot'), - event = 'InsertEnter', - }, - { - 'yetone/avante.nvim', - version = false, - config = load_config('ai.avante'), - event = { 'BufReadPost', 'BufNewFile' }, - build = 'make', - -- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows - dependencies = { - 'MunifTanjim/nui.nvim', - 'nvim-lua/plenary.nvim', - }, - }, - - -- Tools - { - 'echasnovski/mini.files', - version = '*', - config = load_config('tools.files'), - event = { 'BufReadPost', 'BufNewFile' }, - keys = { - { - 'ee', - function() - require('mini.files').open(util.get_file_path(), true) - end, - desc = 'Explorer', - }, - }, - }, - { - 'michaelb/sniprun', - build = 'bash ./install.sh', - config = load_config('tools.sniprun'), - cmd = 'SnipRun', - }, - { - 'windwp/nvim-spectre', - config = load_config('tools.spectre'), - cmd = 'Spectre', - }, - { - 'folke/flash.nvim', - config = load_config('tools.flash'), - keys = { - { - 's', - mode = { 'n', 'x', 'o' }, - function() - require('flash').jump() - end, - desc = 'Flash', - }, - { - 'S', - mode = { 'n', 'x', 'o' }, - function() - require('flash').treesitter() - end, - desc = 'Flash Treesitter', - }, - }, - }, - { - 'windwp/nvim-ts-autotag', - ft = { - 'html', - 'javascriptreact', - 'typescriptreact', - 'svelte', - 'vue', - 'tsx', - 'jsx', - 'markdown', - 'handlebars', - 'hbs', - }, - opts = {}, - }, - { - 'gbprod/substitute.nvim', - event = { 'BufReadPre', 'BufNewFile' }, - config = function() - local substitute = require('substitute') - - substitute.setup() - - -- set keymaps - local keymap = vim.keymap -- for conciseness - - keymap.set('n', 's', substitute.operator, { desc = 'Substitute with motion' }) - keymap.set('n', 'ss', substitute.line, { desc = 'Substitute line' }) - keymap.set('n', 'S', substitute.eol, { desc = 'Substitute to end of line' }) - keymap.set('x', 's', substitute.visual, { desc = 'Substitute in visual mode' }) - end, - }, - { - 'davidmh/mdx.nvim', - config = true, - lazy = false, - }, - { - 'numToStr/Navigator.nvim', - config = load_config('tools.navigator'), - event = 'VeryLazy', - }, - { - 'iamcco/markdown-preview.nvim', - build = 'cd app && yarn install', - init = function() - vim.g.mkdp_filetypes = { 'markdown' } - end, - ft = 'markdown', - cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview' }, - }, - { - 'uga-rosa/ccc.nvim', - config = load_config('tools.ccc'), - cmd = { 'CccHighlighterToggle', 'CccConvert', 'CccPick' }, - }, - { - 'ruifm/gitlinker.nvim', - config = load_config('tools.gitlinker'), - keys = 'yg', - }, - { - 'tpope/vim-fugitive', - cmd = 'Git', - }, - { - - 'akinsho/toggleterm.nvim', - cmd = { 'ToggleTerm' }, - version = 'v2.*', - config = load_config('tools.toggleterm'), - }, - { - 'mistricky/codesnap.nvim', - lazy = true, - build = 'make', - opts = { - save_path = '~/Pictures/code-screenshots/', - has_breadcrumbs = false, - show_workspace = false, - bg_theme = 'default', - watermark = 'S4NKALP', - code_font_family = 'Iosevka NF', - code_font_size = 12, - }, - cmd = { 'CodeSnap', 'CodeSnapSave', 'CodeSnapHighlight', 'CodeSnapASCII' }, - }, - { - 'LudoPinelli/comment-box.nvim', - event = 'BufReadPre', - opts = { - box_width = 70, - }, - }, - { - 'mistricky/codesnap.nvim', - lazy = true, - build = 'make', - opts = { - save_path = '~/Pictures/screenshots/code', - has_breadcrumbs = false, - show_workspace = false, - bg_theme = 'default', - watermark = 'S4NKALP', - code_font_family = 'Iosevka NF', - code_font_size = 12, - }, - cmd = { 'CodeSnap', 'CodeSnapSave', 'CodeSnapHighlight', 'CodeSnapASCII' }, - }, - { - 'jeryldev/pyworks.nvim', - lazy = false, -- Load immediately for autocmds - config = function() - require('pyworks').setup({ - python = { - preferred_venv_name = '.venv', - use_uv = true, -- Use uv when available - }, - auto_activate_venv = true, - }) - end, - }, - { - 'folke/todo-comments.nvim', - event = { 'BufReadPre', 'BufNewFile' }, - dependencies = { 'nvim-lua/plenary.nvim' }, - keys = { - { - 'tt', - function() - require('snacks').picker.todo_comments({ keywords = { 'TODO' } }) - end, - desc = 'Todo', - }, - { - 'tf', - function() - require('snacks').picker.todo_comments({ - keywords = { 'FIX', 'FIXME' }, - }) - end, - desc = 'Fix/Fixme', - }, - { - 'tn', - function() - require('snacks').picker.todo_comments({ keywords = { 'NOTE' } }) - end, - desc = 'Note', - }, - }, - config = function() - local todo_comments = require('todo-comments') - - todo_comments.setup({ - 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 - -- signs = false, -- configure signs for some keywords individually - }, - TODO = { icon = ' ', color = 'info' }, - HACK = { icon = ' ', color = 'warning', alt = { 'DON SKIP' } }, - WARN = { icon = ' ', color = 'warning', alt = { 'WARNING', 'XXX' } }, - PERF = { icon = ' ', alt = { 'OPTIM', 'PERFORMANCE', 'OPTIMIZE' } }, - NOTE = { icon = ' ', color = 'hint', alt = { 'INFO', 'READ', 'COLORS' } }, - TEST = { icon = '⏲ ', color = 'test', alt = { 'TESTING', 'PASSED', 'FAILED' } }, - }, - }) - - -- keymaps - vim.keymap.set('n', ']t', function() - todo_comments.jump_next() - end, { desc = 'Next todo comment' }) - - vim.keymap.set('n', '[t', function() - todo_comments.jump_prev() - end, { desc = 'Previous todo comment' }) - end, - }, - { - '2kabhishek/pickme.nvim', - cmd = 'PickMe', - event = 'VeryLazy', - dependencies = { - 'folke/snacks.nvim', - }, - opts = { - picker_provider = 'snacks', - }, - }, - { - '2kabhishek/termim.nvim', - cmd = { 'Fterm', 'FTerm', 'Sterm', 'STerm', 'Vterm', 'VTerm' }, - }, - - -- Optional - { - 'sphamba/smear-cursor.nvim', - event = 'VeryLazy', - cond = vim.g.neovide == nil, - opts = { - stiffness = 0.5, - trailing_stiffness = 0.49, - }, - enabled = util.get_user_config('enable_smear_cursor', false), - }, - { - 'nvzone/showkeys', - cmd = 'ShowkeysToggle', - opts = { - timeout = 1, - maxkeys = 10, - -- more opts - }, - }, - { - 'wakatime/vim-wakatime', - event = { 'VimEnter' }, - lazy = false, - enabled = util.get_user_config('enable_wakatime', false), - }, - { - 'm4xshen/hardtime.nvim', - dependencies = { 'MunifTanjim/nui.nvim', 'nvim-lua/plenary.nvim' }, - cmd = 'Hardtime', - enabled = util.get_user_config('enable_trainer', false), - }, - { - 'kndndrj/nvim-dbee', - dependencies = { 'MunifTanjim/nui.nvim' }, - build = function() - -- "curl", "wget", "bitsadmin", "go" - require('dbee').install('curl') - end, - config = load_config('tools.dbee'), - cmd = 'DBToggle', - enabled = util.get_user_config('enable_db_explorer', false), - }, - { - 'mfussenegger/nvim-dap', - dependencies = { 'rcarriga/nvim-dap-ui' }, - config = load_config('tools.dap'), - cmd = { 'DapUIToggle', 'DapToggleRepl', 'DapToggleBreakpoint' }, - enabled = util.get_user_config('enable_debugger', false), - }, - { - 'nvim-neotest/neotest', - dependencies = { - 'nvim-neotest/nvim-nio', - 'olimorris/neotest-rspec', - 'nvim-neotest/neotest-jest', - 'nvim-neotest/neotest-python', - }, - config = load_config('tools.neotest'), - cmd = 'Neotest', - enabled = util.get_user_config('enable_test_runner', false), - }, -} - -local treesitter_parsers = { - 'bash', - 'css', - 'dart', - 'elixir', - 'gitcommit', - 'go', - 'html', - 'java', - 'javascript', - 'json', - 'lua', - 'markdown', - 'markdown_inline', -- markdown code blocks - 'python', - 'ruby', - 'rust', - 'typescript', - 'vim', - 'vimdoc', - 'yaml', -} - -local linter_sources = { - 'shellcheck', - 'write_good', - 'markdownlint', - 'eslint_d', - 'hadolint', - 'actionlint', - 'vint', - 'codespell', - 'editorconfig-checker', -} - -local formatter_sources = { - 'prettier', - 'shfmt', - 'stylua', -} - -local lsp_servers = { - 'bashls', - 'jsonls', - 'typos_lsp', - 'vimls', - 'lua_ls', - 'qmlls', - 'tailwindcss', - 'ts_ls', - 'pyright', -} - -if util.is_present('npm') then - table.insert(lsp_servers, 'eslint') - table.insert(lsp_servers, 'ts_ls') -end - -if util.is_present('go') then - table.insert(lsp_servers, 'gopls') -end - -if util.is_present('java') then - table.insert(lsp_servers, 'jdtls') -end - -if util.is_present('pip') then - table.insert(lsp_servers, 'ruff') - table.insert(lsp_servers, 'pylsp') -end - -if util.is_present('cargo') then - table.insert(lsp_servers, 'rust_analyzer') -end - -plugins = vim.tbl_extend('force', plugins, util.get_user_config('user_plugins', {})) -lsp_servers = vim.tbl_extend('force', lsp_servers, util.get_user_config('user_lsp_servers', {})) -formatter_sources = vim.tbl_extend('force', formatter_sources, util.get_user_config('user_formatter_sources', {})) -linter_sources = vim.tbl_extend('force', linter_sources, util.get_user_config('user_linter_sources', {})) -treesitter_parsers = vim.tbl_extend('force', treesitter_parsers, util.get_user_config('user_tresitter_parsers', {})) - -return { - plugins = plugins, - lsp_servers = lsp_servers, - formatter_sources = formatter_sources, - linter_sources = linter_sources, - ts_parsers = treesitter_parsers, -} diff --git a/lua/plugins/lock.json b/lua/plugins/lock.json deleted file mode 100644 index e767958..0000000 --- a/lua/plugins/lock.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "LuaSnip": { "branch": "master", "commit": "3d5bced1b9ae69fa3f9b1942e28af5dbc537f946" }, - "Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" }, - "avante.nvim": { "branch": "main", "commit": "bd69ae14f6f1f21642e16c16cbd18954f62365aa" }, - "base46": { "branch": "v3.0", "commit": "cee12a263602cc97652d3dd55f0fc5e171012967" }, - "blink-cmp-avante": { "branch": "master", "commit": "4f494c6e124acbe31a8f5d58effa0c14aa38a6d5" }, - "blink-cmp-copilot": { "branch": "main", "commit": "439cff78780c033aa23cf061d7315314b347e3c1" }, - "blink-cmp-spell": { "branch": "master", "commit": "2bd0e0d5e7735c047e72b6918a0458f3e8fadaba" }, - "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, - "ccc.nvim": { "branch": "main", "commit": "9d1a256e006decc574789dfc7d628ca11644d4c2" }, - "codesnap.nvim": { "branch": "main", "commit": "be6d6b9a3b5e6999edbda76b16dace03d9bfcd3d" }, - "comment-box.nvim": { "branch": "main", "commit": "06bb771690bc9df0763d14769b779062d8f12bc5" }, - "conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" }, - "copilot.lua": { "branch": "master", "commit": "64422b725c4ae102838f3efe832dafb68be2246d" }, - "flash.nvim": { "branch": "main", "commit": "3c942666f115e2811e959eabbdd361a025db8b63" }, - "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, - "gitsigns.nvim": { "branch": "main", "commit": "b01433169be710d6c69f7b4ee264d9670698b831" }, - "hardtime.nvim": { "branch": "main", "commit": "5d9adcbe2f12741de79e435c8b85dca69a3b22e4" }, - "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, - "lspsaga.nvim": { "branch": "main", "commit": "8efe00d6aed9db6449969f889170f1a7e43101a1" }, - "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, - "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, - "mason-conform.nvim": { "branch": "main", "commit": "f3b96fa2217fcb1513301eefbe10ea0e765e33eb" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "bb3a17efc797c34c054463174e5522442576ebd8" }, - "mason-nvim-lint": { "branch": "main", "commit": "767b8ccdddaa977bec8987fd7507b9865a279235" }, - "mason.nvim": { "branch": "main", "commit": "197f6352c276bbc2d25541dfce00ec50d1a4e88f" }, - "mdx.nvim": { "branch": "main", "commit": "464a74be368dce212cff02f6305845dc7f209ab3" }, - "mini.ai": { "branch": "main", "commit": "e139eb1101beb0250fea322f8c07a42f0f175688" }, - "mini.bracketed": { "branch": "main", "commit": "4a005a6e5aad58230b69f0f59df2cbb8b1c2e643" }, - "mini.files": { "branch": "main", "commit": "49c855977e9f4821d1ed8179ed44fe098b93ea2a" }, - "mini.pairs": { "branch": "main", "commit": "1e1ca3f60f58d4050bf814902b472eec9963a5dd" }, - "mini.surround": { "branch": "main", "commit": "5aab42fcdcf31fa010f012771eda5631c077840a" }, - "neotest": { "branch": "master", "commit": "d66cf4e05a116957f0d3a7755a24291c7d1e1f72" }, - "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, - "nvim-dap": { "branch": "master", "commit": "99807078c5089ed30e0547aa4b52c5867933f426" }, - "nvim-dbee": { "branch": "master", "commit": "9656fc59841291e9dbd2f3b50b1cb4c77d9fea79" }, - "nvim-lint": { "branch": "master", "commit": "9c6207559297b24f0b7c32829f8e45f7d65b991f" }, - "nvim-lspconfig": { "branch": "master", "commit": "4d3b3bb8815fbe37bcaf3dbdb12a22382bc11ebe" }, - "nvim-spectre": { "branch": "master", "commit": "72f56f7585903cd7bf92c665351aa585e150af0f" }, - "nvim-spider": { "branch": "main", "commit": "6da0307421bc4be6fe02815faabde51007c4ea1a" }, - "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-treesitter-refactor": { "branch": "master", "commit": "d8b74fa87afc6a1e97b18da23e762efb032dc270" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "89ebe73cd2836db80a22d9748999ace0241917a5" }, - "nvim-treesitter-textsubjects": { "branch": "master", "commit": "abcbb0e537c9c24800b03b9ca33bee5806604629" }, - "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, - "nvim-web-devicons": { "branch": "master", "commit": "0422a19d9aa3aad2c7e5cca167e5407b13407a9d" }, - "pickme.nvim": { "branch": "main", "commit": "55ca0f1889ea2a4df4b45c77941327a590e025c5" }, - "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, - "pyworks.nvim": { "branch": "main", "commit": "ecc25f9a524aef2b7a02255906cc5ffe7a11e5bb" }, - "showkeys": { "branch": "main", "commit": "cb0a50296f11f1e585acffba8c253b9e8afc1f84" }, - "smear-cursor.nvim": { "branch": "main", "commit": "1a3df9af4ed017fafecd93c6837956914f269472" }, - "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, - "sniprun": { "branch": "master", "commit": "a90c65846c3c18efc3f799d8b6dc26af9d4a69ed" }, - "substitute.nvim": { "branch": "main", "commit": "9db749a880e3dd3b0eb57f698aa8f1e1630e1f25" }, - "termim.nvim": { "branch": "main", "commit": "e4bcf977bef6f6c79996e38fcb9faeccd912007c" }, - "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, - "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, - "treesj": { "branch": "main", "commit": "3b4a2bc42738a63de17e7485d4cc5e49970ddbcc" }, - "ui": { "branch": "v3.0", "commit": "dc4950f5bd4117e2da108b681506c908b93d4a62" }, - "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, - "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, - "vim-wakatime": { "branch": "master", "commit": "f39c4a201ae350aaba713b59d4a4fdd88e0811aa" }, - "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } -} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..86e721c --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,70 @@ +return { + -- default lsp configs + { + "neovim/nvim-lspconfig", + config = function() end, + }, + + -- lsp installer + { + "williamboman/mason.nvim", + dependencies = { + "williamboman/mason-lspconfig.nvim", + }, + cmd = "Mason", + config = function() + -- mason + require("mason").setup({ + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + border = "rounded", + backdrop = 100, + }, + }) + require("mason-lspconfig").setup({ + -- list of servers for mason to install + ensure_installed = { + "ts_ls", + "html", + "cssls", + "tailwindcss", + "lua_ls", + "basedpyright", + "bashls", + "clangd", + "pylsp", + "rust_analyzer", + }, + -- auto-install configured servers (with lspconfig) + automatic_installation = true, -- not the same as ensure_installed + }) + end, + }, + { + "nvimdev/lspsaga.nvim", + event = "LspAttach", + config = function() + require("lspsaga").setup({ + ui = { + theme = "round", + border = "rounded", + devicon = true, + title = true, + winblend = 1, + expand = " ", + collapse = " ", + preview = "", + code_action = "󰠠 ", + diagnostic = " ", + incoming = " ", + outgoing = " ", + hover = " ", + }, + }) + end, + }, +} diff --git a/lua/plugins/picker.lua b/lua/plugins/picker.lua new file mode 100644 index 0000000..568c16e --- /dev/null +++ b/lua/plugins/picker.lua @@ -0,0 +1,362 @@ +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + -- opts = { + -- bigfile = { enabled = true }, + -- dashboard = { enabled = true }, + -- explorer = { enabled = true }, + -- indent = { enabled = true }, + -- input = { enabled = true }, + -- notifier = { + -- enabled = true, + -- timeout = 3000, + -- }, + -- picker = { enabled = true }, + -- quickfile = { enabled = true }, + -- scope = { enabled = true }, + -- scroll = { enabled = true }, + -- statuscolumn = { enabled = true }, + -- words = { enabled = true }, + -- styles = { + -- notification = { + -- -- wo = { wrap = true } -- Wrap notifications + -- }, + -- }, + -- }, + config = function() + local function files_layout(preview_width, height, width) + preview_width = preview_width or 0.6 + height = height or 0.8 + width = width or 0.9 + return { + layout = { + box = "horizontal", + width = width, + min_width = 120, + height = height, + { + box = "vertical", + border = "rounded", + title = "{title} {live} {flags}", + { win = "input", height = 1, border = "bottom" }, + { win = "list", border = "none" }, + }, + { win = "preview", title = "{preview}", border = "rounded", width = preview_width }, + }, + } + end + + local function palette_layout(height, width) + height = height or 0.4 + width = width or 0.6 + return { + preview = false, + layout = { + backdrop = false, + row = 1, + width = width, + min_width = 80, + height = height, + border = "rounded", + box = "vertical", + { + win = "input", + height = 1, + border = "rounded", + title = "{title} {live} {flags}", + title_pos = "center", + }, + { win = "list", border = "hpad" }, + { win = "preview", title = "{preview}", border = "rounded" }, + }, + } + end + + local Snacks = require("snacks") + Snacks.setup({ + animate = { + enabled = true, + duration = 20, -- ms per step + easing = "linear", + fps = 60, + }, + bigfile = { + enabled = true, + notify = true, + size = 1000 * 1024, -- 1 MB instead of 100 KB + }, + bufdelete = { enabled = true }, + dashboard = { + enabled = true, + sections = { + { section = "header" }, + { + icon = " ", + title = "Keymaps", + section = "keys", + indent = 2, + padding = 1, + }, + { + icon = " ", + title = "Recent Files", + section = "recent_files", + indent = 2, + padding = 1, + }, + { + icon = " ", + title = "Projects", + section = "projects", + indent = 2, + padding = 1, + }, + { section = "startup" }, + }, + }, + debug = { enabled = true }, + dim = { + enabled = true, + scope = { + min_size = 5, + max_size = 20, + siblings = true, + }, + }, + explorer = { enabled = false }, + git = { enabled = true }, + gitbrowse = { enabled = true }, + image = { enabled = true }, + indent = { + enabled = true, + priority = 1, + char = "▍", + only_scope = false, + only_current = false, + hl = { + "SnacksIndent1", + "SnacksIndent2", + "SnacksIndent3", + "SnacksIndent4", + "SnacksIndent5", + "SnacksIndent6", + "SnacksIndent7", + "SnacksIndent8", + }, + }, + input = { + enabled = true, + icon = " ", + icon_hl = "SnacksInputIcon", + icon_pos = "left", + prompt_pos = "title", + win = { style = "input" }, + expand = true, + }, + layout = { enabled = true }, + lazygit = { enabled = true }, + notifier = { + enabled = true, + timeout = 2000, + width = { min = 40, max = 0.4 }, + height = { min = 1, max = 0.6 }, + margin = { top = 0, right = 1, bottom = 0 }, + padding = true, + sort = { "level", "added" }, + level = vim.log.levels.TRACE, + icons = { + debug = " ", + error = " ", + info = " ", + trace = " ", + warn = " ", + }, + style = "compact", + top_down = true, + date_format = "%R", + more_format = " ↓ %d lines ", + refresh = 50, + }, + notify = { enabled = true }, + picker = { + enabled = true, + icon = " ", + icon_hl = "SnacksPickerIcon", + icon_pos = "left", + prompt_pos = "title", + win = { style = "picker" }, + expand = true, + matchers = { + frecency = true, + cwd_bonus = false, + }, + sources = { + -- layout options: dropdown, horizontal, vertical, vscode, ivy, ivy_split, telescope, top, left, right, bottom, sidebar + buffers = { layout = files_layout() }, + commands = { layout = palette_layout() }, + command_history = { layout = palette_layout() }, + files = { + hidden = true, + layout = files_layout(), + }, + icons = { + icon_sources = { "nerd_fonts", "emoji" }, + layout = palette_layout(), + }, + git_files = { layout = files_layout() }, + git_branches = { layout = { preset = "vertical" } }, + git_status = { layout = files_layout() }, + help = { layout = { preset = "ivy_split" } }, + man = { layout = { preset = "ivy_split" } }, + notifications = { layout = palette_layout() }, + projects = { layout = files_layout(0.8) }, + recent = { layout = files_layout() }, + search_history = { layout = palette_layout() }, + smart = { layout = files_layout() }, + undo = { layout = { preset = "ivy" } }, + zoxide = { layout = files_layout(0.7) }, + }, + }, + profiler = { enabled = true }, + quickfile = { enabled = true }, + rename = { enabled = true }, + scope = { + enabled = true, + keys = { + textobject = { + ii = { + min_size = 2, -- minimum size of the scope + edge = false, -- inner scope + cursor = false, + treesitter = { blocks = { enabled = false } }, + desc = "inner scope", + }, + ai = { + cursor = false, + min_size = 2, -- minimum size of the scope + treesitter = { blocks = { enabled = false } }, + desc = "full scope", + }, + }, + jump = { + ["[a"] = { + min_size = 1, -- allow single line scopes + bottom = false, + cursor = false, + edge = true, + treesitter = { blocks = { enabled = false } }, + desc = "jump to top edge of scope", + }, + ["]a"] = { + min_size = 1, -- allow single line scopes + bottom = true, + cursor = false, + edge = true, + treesitter = { blocks = { enabled = false } }, + desc = "jump to bottom edge of scope", + }, + }, + }, + }, + scratch = { + enabled = true, + name = "SCRATCH", + ft = function() + if vim.bo.buftype == "" and vim.bo.filetype ~= "" then + return vim.bo.filetype + end + return "markdown" + end, + icon = nil, + root = vim.fn.stdpath("data") .. "/scratch", + autowrite = true, + filekey = { + cwd = true, + branch = true, + count = true, + }, + win = { + width = 120, + height = 40, + bo = { buftype = "", buflisted = false, bufhidden = "hide", swapfile = false }, + minimal = false, + noautocmd = false, + zindex = 20, + wo = { winhighlight = "NormalFloat:Normal" }, + border = "rounded", + title_pos = "center", + footer_pos = "center", + + keys = { + ["execute"] = { + "", + function(_) + vim.cmd("%SnipRun") + end, + desc = "Execute buffer", + mode = { "n", "x" }, + }, + }, + }, + win_by_ft = { + lua = { + keys = { + ["source"] = { + "cr", + function(self) + local name = "scratch." + .. vim.fn.fnamemodify(vim.api.nvim_buf_get_name(self.buf), ":e") + Snacks.debug.run({ buf = self.buf, name = name }) + end, + desc = "Source buffer", + mode = { "n", "x" }, + }, + }, + }, + }, + }, + scroll = { enabled = false }, + statuscolumn = { + enabled = false, -- Change this to false + left = { "mark", "sign" }, + right = { "fold", "git" }, + folds = { + open = false, + git_hl = false, + }, + git = { + patterns = { "GitSign", "MiniDiffSign" }, + }, + refresh = 50, + }, + terminal = { enabled = false }, + toggle = { enabled = false }, + win = { enabled = true }, + words = { enabled = false }, + zen = { + enabled = true, + toggles = { + dim = true, + git_signs = false, + mini_diff_signs = false, + -- diagnostics = false, + -- inlay_hints = false, + }, + show = { + statusline = false, + tabline = false, + }, + win = { style = "zen" }, + zoom = { + toggles = {}, + show = { statusline = true, tabline = true }, + win = { + backdrop = false, + width = 0, + }, + }, + }, + }) + end, +} diff --git a/lua/plugins/statusline.lua b/lua/plugins/statusline.lua new file mode 100644 index 0000000..dcdaa20 --- /dev/null +++ b/lua/plugins/statusline.lua @@ -0,0 +1,254 @@ +return { + "nvim-lualine/lualine.nvim", + dependencies = { + "ellisonleao/gruvbox.nvim", + }, + config = function() + local lualine = require("lualine") + + -- Get gruvbox colors + local palette = require("gruvbox").palette + + local colors = { + bg = palette.dark0, + fg = palette.light1, + yellow = palette.bright_yellow, + cyan = palette.bright_aqua, + darkblue = palette.dark0_hard, + green = palette.bright_green, + orange = palette.bright_orange, + violet = palette.bright_purple, + magenta = palette.bright_purple, + blue = palette.bright_blue, + red = palette.bright_red, + } + + local mode_color = { + n = colors.green, + i = colors.blue, + v = colors.magenta, + [""] = colors.magenta, + V = colors.magenta, + c = colors.yellow, + t = colors.red, + R = colors.orange, + Rv = colors.orange, + no = colors.fg, + s = colors.violet, + S = colors.violet, + [""] = colors.violet, + ic = colors.yellow, + cv = colors.red, + ce = colors.red, + r = colors.cyan, + rm = colors.cyan, + ["r?"] = colors.cyan, + ["!"] = colors.red, + } + + local conditions = { + buffer_not_empty = function() + return vim.fn.empty(vim.fn.expand("%:t")) ~= 1 + end, + buffer_is_file = function() + return vim.bo.buftype == "" + end, + buffer_not_scratch = function() + return string.find(vim.fn.bufname(), "SCRATCH") == nil + end, + hide_in_width = function() + return vim.fn.winwidth(0) > 80 + end, + check_git_workspace = function() + local filepath = vim.fn.expand("%:p:h") + local gitdir = vim.fn.finddir(".git", filepath .. ";") + return gitdir and #gitdir > 0 and #gitdir < #filepath + end, + is_note = function() + local notes_dir = vim.env.NOTES_DIR + if not notes_dir then + return false + end + local current_file = vim.fn.expand("%:p") + return current_file:find(vim.fn.expand(notes_dir), 1, true) == 1 + end, + } + + local searchcount = { "searchcount", color = { fg = colors.fg, gui = "bold" } } + local selectioncount = { "selectioncount", color = { fg = colors.fg, gui = "bold" } } + local progress = { "progress", color = { fg = colors.fg, gui = "bold" } } + local filetype = { "filetype", color = { fg = colors.blue, gui = "bold" } } + local filesize = { "filesize", color = { fg = colors.fg, gui = "bold" }, cond = conditions.buffer_not_empty } + local fileformat = { "fileformat", icons_enabled = true, color = { fg = colors.fg, gui = "bold" } } + + local filename = { + "filename", + cond = conditions.buffer_not_empty and conditions.buffer_is_file and conditions.buffer_not_scratch, + color = { fg = colors.magenta, gui = "bold" }, + } + + local buffers = { + "buffers", + mode = 2, + cond = conditions.buffer_not_scratch, + filetype_names = { + NvimTree = " " .. "Files", + TelescopePrompt = " " .. "Telescope", + Avante = " " .. "Avante", + AvanteInput = " " .. "Avante", + AvanteSelectedFiles = " " .. "Avante", + dashboard = " " .. "Dashboard", + lazy = "󰒲 " .. "Lazy", + mason = " " .. "Mason", + minifiles = " " .. "Files", + snacks_picker_input = " " .. "Picker", + spectre_panel = " " .. "Spectre", + }, + use_mode_colors = true, + } + + local branch = { + "branch", + icon = " ", + fmt = function(str) + return str:sub(1, 32) + end, + color = { fg = colors.green, gui = "bold" }, + } + + local diff_icons = { + "diff", + symbols = { added = " ", modified = " ", removed = " " }, + diff_color = { + added = { fg = colors.green }, + modified = { fg = colors.orange }, + removed = { fg = colors.red }, + }, + cond = conditions.hide_in_width, + } + + local diagnostics = { + "diagnostics", + sources = { "nvim_lsp", "nvim_diagnostic", "nvim_workspace_diagnostic" }, + symbols = { + error = " ", + warn = " ", + info = " ", + hint = "󰠠 ", + }, + diagnostics_color = { + color_error = { fg = colors.red }, + color_warn = { fg = colors.yellow }, + color_info = { fg = colors.blue }, + color_hint = { fg = colors.yellow }, + }, + } + + local lsp = { + function() + local msg = "No LSP" + local buf_ft = vim.api.nvim_get_option_value("filetype", { buf = 0 }) + local clients = vim.lsp.get_clients() + if next(clients) == nil then + return msg + end + for _, client in ipairs(clients) do + local filetypes = client.config and client.config.filetypes or nil + if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + return client.name + end + end + return msg + end, + icon = " ", + color = { fg = colors.fg, gui = "bold" }, + } + + local tdo = { + function() + local update_frequency = 300 + if not vim.g.tdo_last_update or (os.time() - vim.g.tdo_last_update) > update_frequency then + vim.g.tdo_last_update = os.time() + local result = vim.fn.system("tdo pending") + vim.g.tdo_count = tonumber(result:match("%d+")) or 0 + end + return vim.g.tdo_count or 0 + end, + icon = " ", + color = { fg = "#8BCD5B", gui = "bold" }, + cond = conditions.is_note, + } + + local encoding = { + "o:encoding", + fmt = string.upper, + cond = conditions.hide_in_width, + color = { fg = colors.green, gui = "bold" }, + } + + local function mode(icon) + icon = icon or " " + return { + function() + return icon + end, + color = function() + return { fg = mode_color[vim.fn.mode()] } + end, + padding = { left = 1, right = 0 }, + } + end + + -- Create custom gruvbox theme + local function gruvbox_custom() + local function accent_status(accent) + return { + a = { bg = accent, fg = palette.dark0_hard }, + b = { bg = palette.dark1, fg = accent }, + c = { bg = palette.dark0, fg = palette.light1 }, + } + end + + return { + normal = accent_status(palette.bright_aqua), + insert = accent_status(palette.bright_green), + visual = accent_status(palette.bright_purple), + replace = accent_status(palette.bright_yellow), + command = accent_status(palette.bright_orange), + inactive = { + a = { bg = palette.dark1, fg = palette.light4 }, + b = { bg = palette.dark1, fg = palette.light4 }, + c = { bg = palette.dark1, fg = palette.light4 }, + }, + } + end + + lualine.setup({ + options = { + component_separators = "", + -- section_separators = '', + theme = gruvbox_custom(), + disabled_filetypes = { + "dashboard", + }, + }, + -- extensions = { 'quickfix', 'man', 'mason', 'lazy', 'toggleterm', 'nvim-tree' }, + tabline = { + lualine_a = {}, + lualine_b = { mode(), tdo, buffers }, + lualine_c = {}, + lualine_x = { diff_icons, branch }, + lualine_y = { searchcount, selectioncount }, + lualine_z = {}, + }, + sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { mode(" "), "location", progress, filename }, + lualine_x = { diagnostics, lsp, filetype, filesize, fileformat, encoding }, + lualine_y = {}, + lualine_z = {}, + }, + }) + end, +} diff --git a/lua/plugins/tools/ccc.lua b/lua/plugins/tools/ccc.lua deleted file mode 100644 index 580a9d3..0000000 --- a/lua/plugins/tools/ccc.lua +++ /dev/null @@ -1,10 +0,0 @@ -vim.opt.termguicolors = true - -local ccc = require('ccc') - -ccc.setup({ - highlighter = { - auto_enable = true, - lsp = true, - }, -}) diff --git a/lua/plugins/tools/dap.lua b/lua/plugins/tools/dap.lua deleted file mode 100644 index 0d54ed2..0000000 --- a/lua/plugins/tools/dap.lua +++ /dev/null @@ -1,107 +0,0 @@ -local dap = require('dap') -local dapui = require('dapui') -local icons = require('lib.icons') - -dapui.setup({ - icons = { expanded = icons.ui.ArrowClosed, collapsed = icons.ui.ArrowOpen }, - mappings = { - expand = { '', '<2-LeftMouse>' }, - open = 'o', - remove = 'd', - edit = 'e', - repl = 'r', - toggle = 't', - }, - expand_lines = vim.fn.has('nvim-0.7'), - layouts = { - { - elements = { - { id = 'scopes', size = 0.25 }, - 'breakpoints', - 'stacks', - 'watches', - }, - size = 40, - position = 'right', - }, - { - elements = { - 'repl', - 'console', - }, - size = 0.25, - position = 'bottom', - }, - }, - floating = { - max_height = nil, - max_width = nil, - border = 'rounded', - mappings = { - close = { 'q', '' }, - }, - }, - windows = { indent = 1 }, - render = { - max_type_length = nil, - }, -}) - -vim.fn.sign_define('DapBreakpoint', { text = icons.ui.Bug, texthl = 'DiagnosticSignError', linehl = '', numhl = '' }) - -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 - -dap.adapters.python = { - type = 'executable', - command = '/usr/bin/python', - args = { '-m', 'debugpy.adapter' }, -} - -dap.configurations.python = { - { - type = 'python', - request = 'launch', - name = 'Launch file', - - program = '${file}', - 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.ruby = { - type = 'executable', - command = 'bundle', - args = { 'exec', 'readapt', 'stdio' }, -} - -dap.configurations.ruby = { - { - type = 'ruby', - request = 'launch', - name = 'Rails', - program = 'bundle', - programArgs = { 'exec', 'rails', 's' }, - useBundler = true, - }, -} - -vim.api.nvim_create_user_command('DapUIToggle', function() - require('dapui').toggle() -end, {}) diff --git a/lua/plugins/tools/dbee.lua b/lua/plugins/tools/dbee.lua deleted file mode 100644 index 6b883e6..0000000 --- a/lua/plugins/tools/dbee.lua +++ /dev/null @@ -1,19 +0,0 @@ -local dbee = require('dbee') - -dbee.setup({ - sources = { - require('dbee.sources').EnvSource:new('NVIM_DB'), - -- require("dbee.sources").MemorySource:new({ - -- { - -- name = "dbname", - -- type = "postgres", - -- url = "postgres://pguser:pguser@localhost:5602/dbname?sslmode=disable" - -- }, - -- }), - -- require("dbee.sources").FileSource:new(vim.fn.stdpath("cache") .. "/dbee/config.json"), - }, -}) - -vim.api.nvim_create_user_command('DBToggle', function() - require('dbee').toggle() -end, {}) diff --git a/lua/plugins/tools/exercism.lua b/lua/plugins/tools/exercism.lua deleted file mode 100644 index 0b77676..0000000 --- a/lua/plugins/tools/exercism.lua +++ /dev/null @@ -1,7 +0,0 @@ -local exercism = require('exercism') - -exercism.setup({ - exercism_workspace = '~/Projects/2KAbhishek/exercism', - add_default_keybindings = true, - default_language = 'elixir', -}) diff --git a/lua/plugins/tools/files.lua b/lua/plugins/tools/files.lua deleted file mode 100644 index 71c5530..0000000 --- a/lua/plugins/tools/files.lua +++ /dev/null @@ -1,39 +0,0 @@ -local files = require('mini.files') - -files.setup({ - content = { - filter = nil, - prefix = nil, - sort = nil, - }, - mappings = { - close = 'q', - go_in = 'L', - go_in_plus = 'l', - go_out = 'h', - go_out_plus = 'H', - mark_goto = "'", - mark_set = 'm', - reset = '', - reveal_cwd = '@', - show_help = 'g?', - synchronize = '', - trim_left = '<', - trim_right = '>', - }, - options = { - permanent_delete = true, - use_as_default_explorer = true, - }, - windows = { - max_number = math.huge, - preview = false, - width_focus = 30, - width_nofocus = 20, - width_preview = 80, - }, -}) - -vim.api.nvim_set_hl(0, 'MiniFilesBorder', { bg = 'none' }) -vim.api.nvim_set_hl(0, 'MiniFilesNormal', { bg = 'none' }) -vim.api.nvim_set_hl(0, 'MiniFilesTitle', { bg = 'none' }) diff --git a/lua/plugins/tools/flash.lua b/lua/plugins/tools/flash.lua deleted file mode 100644 index f7cffa4..0000000 --- a/lua/plugins/tools/flash.lua +++ /dev/null @@ -1,57 +0,0 @@ -local flash = require('flash') -local icons = require('lib.icons') - -flash.setup({ - -- exact, fuzzy, regex, custom function - mode = 'fuzzy', - -- behave like `incsearch` - incremental = true, - - jump = { - -- save location in the jumplist - jumplist = true, - -- automatically jump when there is only one match - autojump = true, - }, - label = { - rainbow = { - enabled = true, - -- number between 1 and 9 - shade = 4, - }, - }, - prompt = { - enabled = true, - prefix = { { icons.ui.Separator .. icons.ui.Rocket .. icons.ui.ChevronRight .. ' ', 'FlashPromptIcon' } }, - win_config = { relative = 'editor', width = 1, height = 1, row = 1, col = 0, zindex = 1000 }, - }, - modes = { - search = { - enabled = true, - }, - char = { - enabled = false, - jump_labels = false, - }, - }, -}) - -vim.api.nvim_create_user_command('FlashDiagnostics', function() - require('flash').jump({ - matcher = function(win) - return vim.tbl_map(function(diag) - return { - pos = { diag.lnum + 1, diag.col }, - end_pos = { diag.end_lnum + 1, diag.end_col - 1 }, - } - end, vim.diagnostic.get(vim.api.nvim_win_get_buf(win))) - end, - action = function(match, state) - vim.api.nvim_win_call(match.win, function() - vim.api.nvim_win_set_cursor(match.win, match.pos) - vim.diagnostic.open_float() - end) - state:restore() - end, - }) -end, {}) diff --git a/lua/plugins/tools/gitlinker.lua b/lua/plugins/tools/gitlinker.lua deleted file mode 100644 index a16dbcd..0000000 --- a/lua/plugins/tools/gitlinker.lua +++ /dev/null @@ -1,24 +0,0 @@ -local gitlinker = require('gitlinker') - -gitlinker.setup({ - opts = { - remote = nil, - add_current_line_on_normal_mode = true, - action_callback = require('gitlinker.actions').copy_to_clipboard, - print_url = true, - }, - callbacks = { - ['github.com'] = require('gitlinker.hosts').get_github_type_url, - ['gitlab.com'] = require('gitlinker.hosts').get_gitlab_type_url, - ['try.gitea.io'] = require('gitlinker.hosts').get_gitea_type_url, - ['codeberg.org'] = require('gitlinker.hosts').get_gitea_type_url, - ['bitbucket.org'] = require('gitlinker.hosts').get_bitbucket_type_url, - ['try.gogs.io'] = require('gitlinker.hosts').get_gogs_type_url, - ['git.sr.ht'] = require('gitlinker.hosts').get_srht_type_url, - ['git.launchpad.net'] = require('gitlinker.hosts').get_launchpad_type_url, - ['repo.or.cz'] = require('gitlinker.hosts').get_repoorcz_type_url, - ['git.kernel.org'] = require('gitlinker.hosts').get_cgit_type_url, - ['git.savannah.gnu.org'] = require('gitlinker.hosts').get_cgit_type_url, - }, - mappings = 'yg', -}) diff --git a/lua/plugins/tools/navigator.lua b/lua/plugins/tools/navigator.lua deleted file mode 100644 index a16a9d7..0000000 --- a/lua/plugins/tools/navigator.lua +++ /dev/null @@ -1,8 +0,0 @@ -local navigator = require('Navigator') - -navigator.setup({ - auto_save = 'current', - disable_on_zoom = false, - mux = 'auto', -}) - diff --git a/lua/plugins/tools/neotest.lua b/lua/plugins/tools/neotest.lua deleted file mode 100644 index e5fc2c6..0000000 --- a/lua/plugins/tools/neotest.lua +++ /dev/null @@ -1,20 +0,0 @@ -local neotest = require('neotest') - -neotest.setup({ - adapters = { - require('neotest-rspec')({ - rspec_cmd = function() - return vim.tbl_flatten({ - 'bundle', - 'exec', - 'rspec', - }) - end, - }), - require('neotest-jest')({ - jestCommand = 'npx jest --', - jestConfigFile = 'jest.config.js', - }), - require('neotest-python'), - }, -}) diff --git a/lua/plugins/tools/octohub.lua b/lua/plugins/tools/octohub.lua deleted file mode 100644 index 0d2a26c..0000000 --- a/lua/plugins/tools/octohub.lua +++ /dev/null @@ -1,18 +0,0 @@ -local octohub = require('octohub') - -octohub.setup({ - per_user_dir = true, - projects_dir = '~/Projects/', - contribution_icons = { '', '', '', '', '', '', '' }, - sort_repos_by = '', - repo_type = '', - max_contributions = 50, - top_lang_count = 5, - event_count = 5, - window_width = 90, - window_height = 60, - show_recent_activity = true, - show_contributions = true, - show_repo_stats = true, - add_default_keybindings = true, -}) diff --git a/lua/plugins/tools/sniprun.lua b/lua/plugins/tools/sniprun.lua deleted file mode 100644 index 711b157..0000000 --- a/lua/plugins/tools/sniprun.lua +++ /dev/null @@ -1,27 +0,0 @@ -local sniprun = require('sniprun') -local sniprun_api = require('sniprun.api') - -sniprun.setup({ - display = { 'Api' }, - show_no_output = { 'Classic', 'TempFloatingWindow' }, - - display_options = { - terminal_width = 45, - notification_timeout = 5, - }, - - inline_messages = 0, - borders = 'single', -}) - -local api_listener = function(d) - if d.status == 'ok' then - vim.notify('Output: \n' .. d.message, vim.log.levels.INFO) - elseif d.status == 'error' then - vim.notify('Error: \n' .. d.message, vim.log.levels.ERROR) - else - vim.notify('Sniprun: ' .. d.message, vim.log.levels.INFO) - end -end - -sniprun_api.register_listener(api_listener) diff --git a/lua/plugins/tools/spectre.lua b/lua/plugins/tools/spectre.lua deleted file mode 100644 index 5100d02..0000000 --- a/lua/plugins/tools/spectre.lua +++ /dev/null @@ -1,125 +0,0 @@ -local spectre = require('spectre') - -spectre.setup({ - color_devicons = true, - highlight = { - ui = 'String', - search = 'DiffChange', - replace = 'DiffDelete', - }, - mapping = { - ['toggle_line'] = { - map = 't', - cmd = ":lua require('spectre').toggle_line()", - desc = 'toggle current item', - }, - ['enter_file'] = { - map = '', - cmd = ":lua require('spectre.actions').select_entry()", - desc = 'goto current file', - }, - ['send_to_qf'] = { - map = 'Q', - cmd = ":lua require('spectre.actions').send_to_qf()", - desc = 'send all item to quickfix', - }, - ['replace_cmd'] = { - map = 'c', - cmd = ":lua require('spectre.actions').replace_cmd()", - desc = 'input replace vim command', - }, - ['show_option_menu'] = { - map = 'o', - cmd = ":lua require('spectre').show_options()", - desc = 'show option', - }, - ['run_replace'] = { - map = 'R', - cmd = ":lua require('spectre.actions').run_replace()", - desc = 'replace all', - }, - ['change_view_mode'] = { - map = 'm', - cmd = ":lua require('spectre').change_view()", - desc = 'change result view mode', - }, - ['toggle_ignore_case'] = { - map = 'I', - cmd = ":lua require('spectre').change_options('ignore-case')", - desc = 'toggle ignore case', - }, - ['toggle_ignore_hidden'] = { - map = 'H', - cmd = ":lua require('spectre').change_options('hidden')", - desc = 'toggle search hidden', - }, - }, - find_engine = { - ['rg'] = { - cmd = 'rg', - args = { - '--color=never', - '--no-heading', - '--with-filename', - '--line-number', - '--column', - }, - options = { - ['ignore-case'] = { - value = '--ignore-case', - icon = '[I]', - desc = 'ignore case', - }, - ['hidden'] = { - value = '--hidden', - desc = 'hidden file', - icon = '[H]', - }, - }, - }, - ['ag'] = { - cmd = 'ag', - args = { - '--vimgrep', - '-s', - }, - options = { - ['ignore-case'] = { - value = '-i', - icon = '[I]', - desc = 'ignore case', - }, - ['hidden'] = { - value = '--hidden', - desc = 'hidden file', - icon = '[H]', - }, - }, - }, - }, - replace_engine = { - ['sed'] = { - cmd = 'sed', - args = nil, - }, - options = { - ['ignore-case'] = { - value = '--ignore-case', - icon = '[I]', - desc = 'ignore case', - }, - }, - }, - default = { - find = { - cmd = 'rg', - options = { 'ignore-case' }, - }, - replace = { - cmd = 'sed', - }, - }, - replace_vim_cmd = 'cdo', - is_open_target_win = true, - is_insert_mode = true, -}) diff --git a/lua/plugins/tools/toggleterm.lua b/lua/plugins/tools/toggleterm.lua deleted file mode 100644 index a59a984..0000000 --- a/lua/plugins/tools/toggleterm.lua +++ /dev/null @@ -1,23 +0,0 @@ -require('toggleterm').setup({ - size = 10, - open_mapping = [[]], - hide_numbers = true, - shade_filetypes = {}, - shade_terminals = true, - shading_factor = '2', - start_in_insert = true, - insert_mappings = true, - terminal_mappings = true, - persist_size = true, - direction = 'float', -- Use 'float' for floating terminal windows - close_on_exit = true, - shell = vim.o.shell, - float_opts = { - border = 'curved', -- or 'single', 'double', 'shadow', etc. - winblend = 0, -- Set to 0 for full transparency - highlights = { - border = 'Normal', - background = 'Normal', - }, - }, -}) diff --git a/lua/plugins/ui/gitsigns.lua b/lua/plugins/ui/gitsigns.lua deleted file mode 100644 index 54b6c91..0000000 --- a/lua/plugins/ui/gitsigns.lua +++ /dev/null @@ -1,63 +0,0 @@ -local gitsigns = require('gitsigns') -local icons = require('lib.icons') - -gitsigns.setup({ - signs = { - add = { text = icons.ui.SeparatorLight }, - change = { text = icons.ui.SeparatorLight }, - delete = { text = icons.ui.SeparatorLight }, - topdelete = { text = icons.ui.Topline }, - changedelete = { text = icons.ui.SeparatorLight }, - untracked = { text = icons.ui.SeparatorDashed }, - }, - signcolumn = true, - numhl = false, - linehl = false, - word_diff = false, - watch_gitdir = { interval = 1000, follow_files = true }, - attach_to_untracked = true, - current_line_blame = false, - current_line_blame_opts = { - virt_text = true, - virt_text_pos = 'eol', - delay = 0, - ignore_whitespace = false, - }, - current_line_blame_formatter = ', - ', - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, - max_file_length = 40000, - preview_config = { border = 'rounded', style = 'minimal', relative = 'cursor', row = 0, col = 1 }, - on_attach = function(bufnr) - local gs = package.loaded.gitsigns - - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end - - map('n', ']e', function() - if vim.wo.diff then - return ']e' - end - vim.schedule(function() - gs.next_hunk() - end) - return '' - end, { expr = true, desc = 'Next Change' }) - - map('n', '[e', function() - if vim.wo.diff then - return '[e' - end - vim.schedule(function() - gs.prev_hunk() - end) - return '' - end, { expr = true, desc = 'Prev Change' }) - - map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk') - end, -}) diff --git a/lua/plugins/ui/lualine.lua b/lua/plugins/ui/lualine.lua deleted file mode 100644 index 5a29dd0..0000000 --- a/lua/plugins/ui/lualine.lua +++ /dev/null @@ -1,221 +0,0 @@ -local lualine = require('lualine') -local icons = require('lib.icons') - --- Get colors from base46 theme (chadwal) -local colors = require("base46").get_theme_tb "base_30" - -local mode_color = { - n = colors.green, - i = colors.blue, - v = colors.pink, - [''] = colors.pink, - V = colors.pink, - c = colors.yellow, - t = colors.red, - R = colors.orange, - Rv = colors.orange, - no = colors.white, - s = colors.purple, - S = colors.purple, - [''] = colors.purple, - ic = colors.yellow, - cv = colors.red, - ce = colors.red, - r = colors.cyan, - rm = colors.cyan, - ['r?'] = colors.cyan, - ['!'] = colors.red, -} - -local conditions = { - buffer_not_empty = function() - return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 - end, - buffer_is_file = function() - return vim.bo.buftype == '' - end, - buffer_not_scratch = function() - return string.find(vim.fn.bufname(), 'SCRATCH') == nil - end, - hide_in_width = function() - return vim.fn.winwidth(0) > 80 - end, - check_git_workspace = function() - local filepath = vim.fn.expand('%:p:h') - local gitdir = vim.fn.finddir('.git', filepath .. ';') - return gitdir and #gitdir > 0 and #gitdir < #filepath - end, -} - -local searchcount = { 'searchcount', color = { fg = colors.white, gui = 'bold' } } -local selectioncount = { 'selectioncount', color = { fg = colors.white, gui = 'bold' } } -local progress = { 'progress', color = { fg = colors.white, gui = 'bold' } } -local filetype = { 'filetype', color = { fg = colors.blue, gui = 'bold' } } -local filesize = { 'filesize', color = { fg = colors.white, gui = 'bold' }, cond = conditions.buffer_not_empty } -local fileformat = { 'fileformat', icons_enabled = true, color = { fg = colors.white, gui = 'bold' } } - -local filename = { - 'filename', - cond = conditions.buffer_not_empty and conditions.buffer_is_file and conditions.buffer_not_scratch, - color = { fg = colors.pink, gui = 'bold' }, -} - -local buffers = { - 'buffers', - mode = 2, - cond = conditions.buffer_not_scratch, - filetype_names = { - NvimTree = icons.documents.OpenFolder .. 'Files', - TelescopePrompt = icons.ui.Telescope .. 'Telescope', - Avante = icons.ui.Copilot .. 'Avante', - AvanteInput = icons.ui.Pencil .. 'Avante', - AvanteSelectedFiles = icons.documents.File .. 'Avante', - dashboard = icons.ui.Dashboard .. 'Dashboard', - lazy = icons.ui.Sleep .. 'Lazy', - mason = icons.ui.Package .. 'Mason', - minifiles = icons.documents.OpenFolder .. 'Files', - snacks_picker_input = icons.ui.Telescope .. 'Picker', - spectre_panel = icons.ui.Search .. 'Spectre', - }, - use_mode_colors = true, -} - -local branch = { - 'branch', - icon = icons.git.Branch, - fmt = function(str) - return str:sub(1, 32) - end, - color = { fg = colors.green, gui = 'bold' }, -} - -local diff_icons = { - 'diff', - symbols = { added = icons.git.AddAlt, modified = icons.git.DiffAlt, removed = icons.git.RemoveAlt }, - diff_color = { - added = { fg = colors.green }, - modified = { fg = colors.orange }, - removed = { fg = colors.red }, - }, - cond = conditions.hide_in_width, -} - -local diagnostics = { - 'diagnostics', - sources = { 'nvim_lsp', 'nvim_diagnostic', 'nvim_workspace_diagnostic' }, - symbols = { - error = icons.diagnostics.Error, - warn = icons.diagnostics.Warning, - info = icons.diagnostics.Information, - hint = icons.diagnostics.Hint, - }, - diagnostics_color = { - color_error = { fg = colors.red }, - color_warn = { fg = colors.yellow }, - color_info = { fg = colors.blue }, - color_hint = { fg = colors.yellow }, - }, -} - -local lsp = { - function() - local msg = 'No LSP' - local buf_ft = vim.api.nvim_get_option_value('filetype', { buf = 0 }) - local clients = vim.lsp.get_clients() - if next(clients) == nil then - return msg - end - for _, client in ipairs(clients) do - local filetypes = client.config and client.config.filetypes or nil - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return client.name - end - end - return msg - end, - icon = icons.ui.Gear, - color = { fg = colors.white, gui = 'bold' }, -} - -local encoding = { - 'o:encoding', - fmt = string.upper, - cond = conditions.hide_in_width, - color = { fg = colors.green, gui = 'bold' }, -} - -local function mode(icon) - icon = icon or icons.ui.Neovim - return { - function() - return icon - end, - color = function() - return { fg = mode_color[vim.fn.mode()] } - end, - padding = { left = 1, right = 0 }, - } -end - --- Create a custom theme based on chadwal colors (onedark style) -local custom_theme = { - normal = { - a = { fg = colors.black, bg = colors.green, gui = 'bold' }, - b = { fg = colors.white, bg = colors.one_bg }, - c = { fg = colors.light_grey, bg = 'NONE' }, - }, - insert = { - a = { fg = colors.black, bg = colors.blue, gui = 'bold' }, - b = { fg = colors.white, bg = colors.one_bg }, - c = { fg = colors.light_grey, bg = 'NONE' }, - }, - visual = { - a = { fg = colors.black, bg = colors.pink, gui = 'bold' }, - b = { fg = colors.white, bg = colors.one_bg }, - c = { fg = colors.light_grey, bg = 'NONE' }, - }, - replace = { - a = { fg = colors.black, bg = colors.red, gui = 'bold' }, - b = { fg = colors.white, bg = colors.one_bg }, - c = { fg = colors.light_grey, bg = 'NONE' }, - }, - command = { - a = { fg = colors.black, bg = colors.yellow, gui = 'bold' }, - b = { fg = colors.white, bg = colors.one_bg }, - c = { fg = colors.light_grey, bg = 'NONE' }, - }, - inactive = { - a = { fg = colors.grey, bg = 'NONE' }, - b = { fg = colors.grey, bg = 'NONE' }, - c = { fg = colors.grey, bg = 'NONE' }, - }, -} - -lualine.setup({ - options = { - component_separators = '', - section_separators = { left = '', right = '' }, - theme = custom_theme, - disabled_filetypes = { - 'dashboard', - }, - globalstatus = true, - }, - -- extensions = { 'quickfix', 'man', 'mason', 'lazy', 'toggleterm', 'nvim-tree' }, - tabline = { - lualine_a = {}, - lualine_b = { mode(), buffers }, - lualine_c = {}, - lualine_x = { diff_icons, branch }, - lualine_y = { searchcount, selectioncount }, - lualine_z = {}, - }, - sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = { mode(icons.ui.Heart), 'location', progress, filename }, - lualine_x = { diagnostics, lsp, filetype, filesize, fileformat, encoding }, - lualine_y = {}, - lualine_z = {}, - }, -}) diff --git a/lua/plugins/ui/snacks.lua b/lua/plugins/ui/snacks.lua deleted file mode 100644 index 7c78df3..0000000 --- a/lua/plugins/ui/snacks.lua +++ /dev/null @@ -1,334 +0,0 @@ -local Snacks = require('snacks') -local icons = require('lib.icons') - -local function files_layout(preview_width, height, width) - preview_width = preview_width or 0.6 - height = height or 0.8 - width = width or 0.9 - return { - layout = { - box = 'horizontal', - width = width, - min_width = 120, - height = height, - { - box = 'vertical', - border = 'rounded', - title = '{title} {live} {flags}', - { win = 'input', height = 1, border = 'bottom' }, - { win = 'list', border = 'none' }, - }, - { win = 'preview', title = '{preview}', border = 'rounded', width = preview_width }, - }, - } -end - -local function palette_layout(height, width) - height = height or 0.4 - width = width or 0.6 - return { - preview = false, - layout = { - backdrop = false, - row = 1, - width = width, - min_width = 80, - height = height, - border = 'rounded', - box = 'vertical', - { - win = 'input', - height = 1, - border = 'rounded', - title = '{title} {live} {flags}', - title_pos = 'center', - }, - { win = 'list', border = 'hpad' }, - { win = 'preview', title = '{preview}', border = 'rounded' }, - }, - } -end - -Snacks.setup({ - animate = { - enabled = true, - duration = 20, -- ms per step - easing = 'linear', - fps = 60, - }, - bigfile = { - enabled = true, - notify = true, - size = 1000 * 1024, -- 1 MB instead of 100 KB - }, - bufdelete = { enabled = true }, - dashboard = { - enabled = true, - sections = { - { section = 'header' }, - { - icon = icons.ui.Keyboard, - title = 'Keymaps', - section = 'keys', - indent = 2, - padding = 1, - }, - { - icon = icons.documents.File, - title = 'Recent Files', - section = 'recent_files', - indent = 2, - padding = 1, - }, - { - icon = icons.documents.OpenFolder, - title = 'Projects', - section = 'projects', - indent = 2, - padding = 1, - }, - { section = 'startup' }, - }, - }, - debug = { enabled = true }, - dim = { - enabled = true, - scope = { - min_size = 5, - max_size = 20, - siblings = true, - }, - }, - explorer = { enabled = false }, - git = { enabled = true }, - gitbrowse = { enabled = true }, - image = { enabled = true }, - indent = { - enabled = true, - priority = 1, - char = icons.ui.SeparatorLight, - only_scope = false, - only_current = false, - hl = { - 'SnacksIndent1', - 'SnacksIndent2', - 'SnacksIndent3', - 'SnacksIndent4', - 'SnacksIndent5', - 'SnacksIndent6', - 'SnacksIndent7', - 'SnacksIndent8', - }, - }, - input = { - enabled = true, - icon = icons.ui.Edit, - icon_hl = 'SnacksInputIcon', - icon_pos = 'left', - prompt_pos = 'title', - win = { style = 'input' }, - expand = true, - }, - layout = { enabled = true }, - lazygit = { enabled = true }, - notifier = { - enabled = true, - timeout = 2000, - width = { min = 40, max = 0.4 }, - height = { min = 1, max = 0.6 }, - margin = { top = 0, right = 1, bottom = 0 }, - padding = true, - sort = { 'level', 'added' }, - level = vim.log.levels.TRACE, - icons = { - debug = icons.ui.Bug, - error = icons.diagnostics.Error, - info = icons.diagnostics.Information, - trace = icons.ui.Bookmark, - warn = icons.diagnostics.Warning, - }, - style = 'compact', - top_down = true, - date_format = '%R', - more_format = ' ↓ %d lines ', - refresh = 50, - }, - notify = { enabled = true }, - picker = { - enabled = true, - icon = icons.ui.Search, - icon_hl = 'SnacksPickerIcon', - icon_pos = 'left', - prompt_pos = 'title', - win = { style = 'picker' }, - expand = true, - matchers = { - frecency = true, - cwd_bonus = false, - }, - sources = { - -- layout options: dropdown, horizontal, vertical, vscode, ivy, ivy_split, telescope, top, left, right, bottom, sidebar - buffers = { layout = files_layout() }, - commands = { layout = palette_layout() }, - command_history = { layout = palette_layout() }, - files = { - hidden = true, - layout = files_layout(), - }, - icons = { - icon_sources = { 'nerd_fonts', 'emoji' }, - layout = palette_layout(), - }, - git_files = { layout = files_layout() }, - git_branches = { layout = { preset = 'vertical' } }, - git_status = { layout = files_layout() }, - help = { layout = { preset = 'ivy_split' } }, - man = { layout = { preset = 'ivy_split' } }, - notifications = { layout = palette_layout() }, - projects = { layout = files_layout(0.8) }, - recent = { layout = files_layout() }, - search_history = { layout = palette_layout() }, - smart = { layout = files_layout() }, - undo = { layout = { preset = 'ivy' } }, - zoxide = { layout = files_layout(0.7) }, - }, - }, - profiler = { enabled = true }, - quickfile = { enabled = true }, - rename = { enabled = true }, - scope = { - enabled = true, - keys = { - textobject = { - ii = { - min_size = 2, -- minimum size of the scope - edge = false, -- inner scope - cursor = false, - treesitter = { blocks = { enabled = false } }, - desc = 'inner scope', - }, - ai = { - cursor = false, - min_size = 2, -- minimum size of the scope - treesitter = { blocks = { enabled = false } }, - desc = 'full scope', - }, - }, - jump = { - ['[a'] = { - min_size = 1, -- allow single line scopes - bottom = false, - cursor = false, - edge = true, - treesitter = { blocks = { enabled = false } }, - desc = 'jump to top edge of scope', - }, - [']a'] = { - min_size = 1, -- allow single line scopes - bottom = true, - cursor = false, - edge = true, - treesitter = { blocks = { enabled = false } }, - desc = 'jump to bottom edge of scope', - }, - }, - }, - }, - scratch = { - enabled = true, - name = 'SCRATCH', - ft = function() - if vim.bo.buftype == '' and vim.bo.filetype ~= '' then - return vim.bo.filetype - end - return 'markdown' - end, - icon = nil, - root = vim.fn.stdpath('data') .. '/scratch', - autowrite = true, - filekey = { - cwd = true, - branch = true, - count = true, - }, - win = { - width = 120, - height = 40, - bo = { buftype = '', buflisted = false, bufhidden = 'hide', swapfile = false }, - minimal = false, - noautocmd = false, - zindex = 20, - wo = { winhighlight = 'NormalFloat:Normal' }, - border = 'rounded', - title_pos = 'center', - footer_pos = 'center', - - keys = { - ['execute'] = { - '', - function(_) - vim.cmd('%SnipRun') - end, - desc = 'Execute buffer', - mode = { 'n', 'x' }, - }, - }, - }, - win_by_ft = { - lua = { - keys = { - ['source'] = { - 'cr', - function(self) - local name = 'scratch.' .. vim.fn.fnamemodify(vim.api.nvim_buf_get_name(self.buf), ':e') - Snacks.debug.run({ buf = self.buf, name = name }) - end, - desc = 'Source buffer', - mode = { 'n', 'x' }, - }, - }, - }, - }, - }, - scroll = { enabled = false }, - statuscolumn = { - enabled = false, -- Change this to false - left = { 'mark', 'sign' }, - right = { 'fold', 'git' }, - folds = { - open = false, - git_hl = false, - }, - git = { - patterns = { 'GitSign', 'MiniDiffSign' }, - }, - refresh = 50, - }, - terminal = { enabled = false }, - toggle = { enabled = false }, - win = { enabled = true }, - words = { enabled = false }, - zen = { - enabled = true, - toggles = { - dim = true, - git_signs = false, - mini_diff_signs = false, - -- diagnostics = false, - -- inlay_hints = false, - }, - show = { - statusline = false, - tabline = false, - }, - win = { style = 'zen' }, - zoom = { - toggles = {}, - show = { statusline = true, tabline = true }, - win = { - backdrop = false, - width = 0, - }, - }, - }, -}) diff --git a/lua/plugins/ui/which-key.lua b/lua/plugins/ui/which-key.lua deleted file mode 100644 index 5f2435c..0000000 --- a/lua/plugins/ui/which-key.lua +++ /dev/null @@ -1,446 +0,0 @@ -local which_key = require('which-key') -local icons = require('lib.icons') -local util = require('lib.util') -local prompts = require('lib.prompts') - -local setup = { - preset = 'helix', - plugins = { - marks = true, - registers = true, - spelling = { - enabled = true, - suggestions = 30, - }, - presets = { - operators = true, - motions = true, - text_objects = true, - windows = true, - nav = true, - z = true, - g = true, - }, - }, - icons = { - breadcrumb = icons.ui.ArrowOpen, - separator = icons.ui.Arrow, - group = '', - keys = { - Space = icons.ui.Rocket, - }, - rules = false, -- enable auto icon rules - }, - show_help = false, - show_keys = true, - triggers = { - { '', mode = 'nvisoct' }, - { '', mode = { 'n', 'v' } }, - }, -} - -local normal_mappings = { - mode = 'n', - { 'x', ':x', desc = ' Save and Quit' }, - - { 'a', group = ' AI' }, - { 'aC', ':AvanteClear', desc = 'avante: clear' }, - { 'am', ':MCPHub', desc = 'MCPHub' }, - { 'an', ':AvanteChatNew', desc = 'avante: new' }, - { 'ap', group = 'Insert Prompt' }, - { 'apd', prompts.add_prompt('docs'), desc = 'Docs' }, - { 'ape', prompts.add_prompt('explain'), desc = 'Explain' }, - { 'apf', prompts.add_prompt('fix'), desc = 'Fix' }, - { 'apg', prompts.add_prompt('commit'), desc = 'Commit' }, - { 'apo', prompts.add_prompt('optimize'), desc = 'Optimize' }, - { 'apr', prompts.add_prompt('review'), desc = 'Review' }, - { 'apt', prompts.add_prompt('tests'), desc = 'Tests' }, - - { 'c', group = ' Code' }, - { 'cF', ':retab', desc = 'Fix Tabs' }, - { 'cP', ':CccConvert', desc = 'Convert Color' }, - { 'cR', ':ReloadConfig', desc = 'Reload Configs' }, - { 'cc', ':CccHighlighterToggle', desc = 'Highlight Colors' }, - { 'cd', ':RootDir', desc = 'Root Directory' }, - { 'ce', ':%SnipRun', desc = 'Execute File' }, - { 'cf', ':lua vim.lsp.buf.format({async = true})', desc = 'Format File' }, - { 'cl', '::g/^\\s*$/d', desc = 'Clean Empty Lines' }, - { 'cm', ':MarkdownPreviewToggle', desc = 'Markdown Preview' }, - { 'co', ':Dashboard', desc = 'Dashboard' }, - { 'cp', ':CccPick', desc = 'Pick Color' }, - { 'cs', ':source %', desc = 'Source File' }, - { 'cp', ':PyworksWeb', desc = 'Pyworks Setup' }, - - { 'C', group = ' Comment' }, - { 'Cb', 'CBccbox', desc = 'Comment Box' }, - { 'Ct', 'CBllline', desc = 'Tiled line' }, - { 'Cl', 'CBline', desc = 'Line' }, - { 'Cm', 'CBllbox14', desc = 'Marked' }, - { 'Cc', 'CBcatalog', desc = 'Catalog' }, - { 'Cd', 'CBd', desc = 'Delete Comment Style' }, - - { 'e', group = ' Edit' }, - { 'ea', ':b#', desc = 'Alternate File' }, - { 'ec', group = 'Edit Configs' }, - { 'ecg', ':e ~/.gitconfig', desc = 'Git Config' }, - { 'eck', ':e ~/.config/kitty/kitty.conf', desc = 'Kitty Config' }, - { 'ecn', ':e $MYVIMRC', desc = 'Neovim Init' }, - { 'ecp', ':e ~/.config/nvim/lua/plugins/list.lua', desc = 'Plugin List' }, - { 'ect', ':e ~/.config/tmux/tmux.conf', desc = 'Tmux Config' }, - { 'eE', ':lua Snacks.explorer()', desc = 'File Explorer' }, - { 'et', ':lua MiniFiles.open()', desc = 'Explore Tree' }, - { 'ef', 'gf', desc = 'File Under Cursor' }, - { 'em', ':e README.md', desc = 'Readme' }, - { 'en', ':enew', desc = 'New File' }, - - { 'f', group = ' Find' }, - { 'fx', ':%bd|e#|bd#', desc = 'Close except current' }, - - { 'g', group = ' Git' }, - { 'gA', ':Gitsigns stage_buffer', desc = 'Stage Buffer' }, - { 'gC', ':CoAuthor', desc = 'Co-Authors' }, - { 'gP', ':Git push', desc = 'Push' }, - { 'gR', ':Gitsigns reset_buffer', desc = 'Reset Buffer' }, - { 'ga', ':Gitsigns stage_hunk', desc = 'Stage Hunk' }, - { 'gb', ":lua require('gitsigns').blame_line({full = true})", desc = 'Blame' }, - { 'gc', ':Git commit', desc = 'Commit Staged' }, - { 'gB', ":lua require('snacks').git.blame_line()", desc = 'Detailed Blame' }, - { 'gd', ':Gitsigns diffthis HEAD', desc = 'Git Diff' }, - { 'gF', ':Git', desc = 'Fugitive Panel' }, - { 'gg', ':lua require("snacks").lazygit()', desc = 'Lazygit' }, - { 'gi', ':Gitsigns preview_hunk', desc = 'Hunk Info' }, - { 'gj', ':Gitsigns next_hunk', desc = 'Next Hunk' }, - { 'gk', ':Gitsigns prev_hunk', desc = 'Prev Hunk' }, - { 'gp', ':Git pull', desc = 'Pull' }, - { 'gr', ':Gitsigns reset_hunk', desc = 'Reset Hunk' }, - { 'gt', group = 'Toggle' }, - { 'gtb', ':Gitsigns toggle_current_line_blame', desc = 'Blame' }, - { 'gtd', ':Gitsigns toggle_deleted', desc = 'Deleted' }, - { 'gtl', ':Gitsigns toggle_linehl', desc = 'Line HL' }, - { 'gtn', ':Gitsigns toggle_numhl', desc = 'Number HL' }, - { 'gts', ':Gitsigns toggle_signs', desc = 'Signs' }, - { 'gtw', ':Gitsigns toggle_word_diff', desc = 'Word Diff' }, - { 'gu', ':Gitsigns undo_stage_hunk', desc = 'Undo Stage Hunk' }, - { 'gv', ':Gitsigns select_hunk', desc = 'Select Hunk' }, - { 'gw', ':lua require("snacks").gitbrowse()', desc = 'Git Browse' }, - - { 'i', group = ' Insert' }, - { 'id', ":put =strftime('## %a, %d %b, %Y, %r')", desc = 'Date' }, - { 'if', ":put =expand('%:t')", desc = 'File Name' }, - { 'ip', ':put %', desc = 'Relative Path' }, - { 'iP', ':put %:p', desc = 'Absolute Path' }, - { 'it', ":put =strftime('## %r')", desc = 'Time' }, - - { 'j', group = ' Jump' }, - { 'jc', '*', desc = 'Word' }, - { 'jd', ':FlashDiagnostics', desc = 'Diagnostics' }, - { 'jh', '', desc = 'Backward' }, - { 'jj', ":lua require('flash').remote()", desc = 'Remote' }, - { 'jk', ":lua require('flash').treesitter()", desc = 'Treesitter' }, - { 'jl', '', desc = 'Forward' }, - { 'jp', ":lua require('flash').jump({continue = true})", desc = 'Previous Jump' }, - { 'js', ":lua require('flash').jump()", desc = 'Search' }, - { 'jt', ":lua require('flash').treesitter_search()", desc = 'Remote Treesitter' }, - { - 'jn', - ":lua require('flash').jump({search = { forward = true, wrap = false, multi_window = false },})", - desc = 'Search Forward', - }, - { - 'jN', - ":lua require('flash').jump({search = { forward = false, wrap = false, multi_window = false },})", - desc = 'Search Backward', - }, - { - 'jw', - ':lua require("flash").jump({ pattern = vim.fn.expand("")})', - desc = 'Current Word', - }, - - { 'l', group = ' LSP' }, - { 'la', ':Lspsaga code_action', desc = 'Code Action' }, - { 'ld', ':Lspsaga goto_definition', desc = 'Goto Definition' }, - { 'lf', ':Lspsaga finder', desc = 'Finder' }, - { 'lh', ':Lspsaga hover_doc', desc = 'Hover' }, - { 'lI', ':LspInfo', desc = 'LSP Info' }, - { 'lj', ':Lspsaga diagnostic_jump_next', desc = 'Next Diagnostic' }, - { 'lk', ':Lspsaga diagnostic_jump_prev', desc = 'Prev Diagnostic' }, - { 'lo', ':Lspsaga outline', desc = 'Outline' }, - { 'lp', ':Lspsaga peek_definition', desc = 'Peek Definition' }, - { 'lq', ':LspStop', desc = 'Stop LSP' }, - { 'lQ', ':LspRestart', desc = 'Restart LSP' }, - { 'lr', ':Lspsaga rename', desc = 'Rename' }, - { 'lR', ':Lspsaga project_replace', desc = 'Replace' }, - { 'lt', ':Lspsaga goto_type_definition', desc = 'Goto Type Definition' }, - { 'lT', ':Lspsaga peek_type_definition', desc = 'Peek Type Definition' }, - - { 'o', group = ' Options' }, - { 'oi', 'vim.show_pos', desc = 'Inspect Position' }, - { 'oN', ':lua Snacks.notifier.show_history()', desc = 'Notification History' }, - { 'or', ':set relativenumber!', desc = 'Relative Numbers' }, - - { 'p', group = ' Packages' }, - { 'pc', ':Lazy check', desc = 'Check' }, - { 'pd', ':Lazy debug', desc = 'Debug' }, - { 'pe', ':lua require("snacks").profiler.scratch()', desc = 'Profiler Scratch' }, - { 'pf', ':lua require("snacks").profiler.pick()', desc = 'Profiler Pick' }, - { 'pi', ':Lazy install', desc = 'Install' }, - { 'pl', ':Lazy log', desc = 'Log' }, - { 'pm', ':Mason', desc = 'Mason' }, - { 'pp', ':Lazy', desc = 'Plugins' }, - { 'pP', ':Lazy profile', desc = 'Profile' }, - { 'pr', ':Lazy restore', desc = 'Restore' }, - { 'ps', ':Lazy sync', desc = 'Sync' }, - { 'pt', ':lua require("snacks").profiler.toggle()', desc = 'Profiler Toggle' }, - { 'pu', ':Lazy update', desc = 'Update' }, - { 'px', ':Lazy clean', desc = 'Clean' }, - - { 'q', group = ' Quit' }, - { 'qa', ':qall', desc = 'Quit All' }, - { 'qb', ':bw', desc = 'Close Buffer' }, - { 'qd', ':lua require("snacks").bufdelete()', desc = 'Delete Buffer' }, - { 'qf', ':qall!', desc = 'Force Quit' }, - { 'qo', ':%bdelete|b#|bdelete#', desc = 'Close Others' }, - { 'qq', ':q', desc = 'Quit' }, - { 'qs', 'c', desc = 'Close Split' }, - { 'qw', ':wq', desc = 'Write and Quit' }, - - { 'r', group = ' Refactor' }, - { 'ra', ":lua require('spectre').open()", desc = 'Replace All' }, - { 'rb', ":lua require('spectre').open_file_search()", desc = 'Replace Buffer' }, - { 'rd', '', desc = 'Go To Definition' }, -- treesitter navigation - { 'rh', '', desc = 'List Definition Head' }, - { 'rj', '', desc = 'Next Usage' }, - { 'rk', '', desc = 'Previous Usage' }, - { 'rl', '', desc = 'List Definition' }, - { 'rn', '', desc = 'Swap Next' }, - { 'rp', '', desc = 'Swap Previous' }, - { 'rr', '', desc = 'Smart Rename' }, - { 'rs', ':%s/\\<\\>//gI', desc = 'Replace Word Buffer' }, - { 'rw', ":lua require('spectre').open_visual({select_word=true})", desc = 'Replace Word Everywhere' }, - - { 's', group = ' Split' }, - { 's+', ':resize +10', desc = 'Increase window height' }, - { 's-', ':vertical resize -20', desc = 'Decrease window width' }, - { 's/', 's', desc = 'Split Below' }, - { 's=', ':vertical resize +20', desc = 'Increase window width' }, - { 'sH', ':vertical resize -10', desc = 'Decrease window width' }, - { 'sJ', ':resize -5', desc = 'Decrease window height' }, - { 'sK', ':resize +5', desc = 'Increase window height' }, - { 'sL', ':vertical resize +10', desc = 'Increase window width' }, - { 's\\', 'v', desc = 'Split Right' }, - { 's_', ':resize -10', desc = 'Decrease window height' }, - { 's`', 'p', desc = 'Previous Window' }, - { 'sa', ':split', desc = 'Horizontal Split' }, - { 'sc', ':tabclose', desc = 'Close Tab' }, - { 'sf', ':tabfirst', desc = 'First Tab' }, - { 'sh', 'h', desc = 'Move Left' }, - { 'sj', 'j', desc = 'Move Down' }, - { 'sk', 'k', desc = 'Move Up' }, - { 'sl', 'l', desc = 'Move Right' }, - { 'sp', ':NavigatorPrevious', desc = 'Previous Pane' }, - { 'sq', 'c', desc = 'Close Split' }, - { 'ss', ':vsplit', desc = 'Vertical Split' }, - - { 't', group = ' Terminal' }, - { 't1', '1ToggleTerm', desc = 'Toggle Terminal' }, - { 't2', '2ToggleTerm', desc = 'Toggle Terminal' }, - { 'th', 'Sterm', desc = 'Horizontal Terminal' }, - { 'tv', 'Vterm', desc = 'Vertical Terminal' }, - { 'tc', 'close', desc = 'Hide Terminal' }, - - { 'w', group = ' Writing' }, - { 'wc', ':set spell!', desc = 'Spellcheck' }, - { 'wd', ':lua require("snacks").dim.enable()', desc = 'Dim On' }, - { 'wD', ':lua require("snacks").dim.disable()', desc = 'Dim Off' }, - { 'wf', ":lua require'utils'.sudo_write()", desc = 'Force Write' }, - { 'wj', ']s', desc = 'Next Misspell' }, - { 'wk', '[s', desc = 'Prev Misspell' }, - { 'wn', ':WriteNoFormat', desc = 'Write Without Formatting' }, - { 'wq', ':wq', desc = 'Write and Quit' }, - { 'ww', ':w', desc = 'Write' }, - { 'wz', ':lua require("snacks").zen.zen()', desc = 'Zen' }, - { 'wZ', ':lua require("snacks").zen.zoom()', desc = 'Zoom' }, - - { 'y', group = ' Yank' }, - { 'yL', ':CopyAbsolutePathWithLine', desc = 'Absolute Path with Line' }, - { 'yP', ':CopyAbsolutePath', desc = 'Absolute Path' }, - { 'ya', ':%y+', desc = 'Copy Whole File' }, - { 'yf', ':CopyFileName', desc = 'File Name' }, - { 'yg', ':lua require"gitlinker".get_buf_range_url()', desc = 'Copy Git URL' }, - { 'yl', ':CopyRelativePathWithLine', desc = 'Relative Path with Line' }, - { 'yp', ':CopyRelativePath', desc = 'Relative Path' }, -} - --- Numerical mappings -for i = 1, 9 do - table.insert(normal_mappings, { - string.format('n%d', i), - string.format(':Tdo %d', i), - desc = string.format('Todo %d Days In Future', i), - }) - - table.insert(normal_mappings, { - string.format('np%d', i), - string.format(':Tdo -%d', i), - desc = string.format('Todo %d Days From Past', i), - }) - - table.insert(normal_mappings, { - string.format('f%d', i), - string.format(':LualineBuffersJump%d', i), - desc = string.format('File %d', i), - }) -end - -local visual_mappings = { - mode = 'v', - { 'a', group = ' AI' }, - - { 'c', group = ' Code' }, - { 'ce', ":'<,'>SnipRun", desc = 'Execute Selection' }, - { 'cS', ':sort!', desc = 'Sort Desc' }, - { 'ci', ':sort i', desc = 'Sort Case Insensitive' }, - { 'cs', ':sort', desc = 'Sort Asc' }, - { 'cu', ':!uniq', desc = 'Unique' }, - { 'cx', ':lua', desc = 'Execute Lua' }, - - { 'C', group = ' Comment' }, - { 'Cb', 'CBccbox', desc = 'Comment Box' }, - { 'Ct', 'CBllline', desc = 'Tiled line' }, - { 'Cl', 'CBline', desc = 'Line' }, - { 'Cm', 'CBllbox14', desc = 'Marked' }, - { 'Cc', 'CBcatalog', desc = 'Catalog' }, - { 'Cd', 'CBd', desc = 'Delete Comment Style' }, - - { 'g', group = ' Git' }, - { 'ga', ":'<,'>Gitsigns stage_hunk", desc = 'Stage Hunk' }, - { 'gr', ":'<,'>Gitsigns reset_hunk", desc = 'Reset Hunk' }, - { 'gu', ":'<,'>Gitsigns undo_stage_hunk", desc = 'Undo Stage Hunk' }, - - { 'j', group = ' Jump' }, - { - 'jN', - ":lua require('flash').jump({search = { forward = false, wrap = false, multi_window = false },})", - desc = 'Search Backward', - }, - { 'jd', ':FlashDiagnostics', desc = 'Diagnostics' }, - { 'jj', ":lua require('flash').remote()", desc = 'Remote' }, - { 'jk', ":lua require('flash').treesitter()", desc = 'Treesitter' }, - { - 'jn', - ":lua require('flash').jump({search = { forward = true, wrap = false, multi_window = false },})", - desc = 'Search Forward', - }, - { 'jp', ":lua require('flash').jump({continue = true})", desc = 'Previous Jump' }, - { 'js', ":lua require('flash').jump()", desc = 'Search' }, - { 'jt', ":lua require('flash').treesitter_search()", desc = 'Remote Treesitter' }, - { - 'jw', - ':lua require("flash").jump({ pattern = vim.fn.expand("")})', - desc = 'Current Word', - }, - - { 'l', group = ' LSP' }, - { 'la', ':Lspsaga range_code_action', desc = 'Code Action' }, - - { 'p', group = ' ScreenShot' }, - { 'py', 'CodeSnap', mode = 'x', desc = 'Save selected code snapshot into clipboard' }, - { 'ps', 'CodeSnapSave', mode = 'x', desc = 'Save selected code snapshot in ~/Pictures' }, - { - 'ph', - 'CodeSnapHighlight', - mode = 'x', - desc = 'Highlight and snapshot selected code into clipboard', - }, - { 'pi', 'CodeSnapASCII', mode = 'x', desc = 'Save ASCII code snapshot into clipboard' }, - - { 'y', group = ' Yank' }, - { 'yg', ':lua require"gitlinker".get_buf_range_url("v")', desc = 'Copy Git URL' }, -} - -local no_leader_mappings = { - mode = 'n', - { '', ':resize -10', desc = 'Decrease window height' }, - { '', ':vertical resize -10', desc = 'Decrease window width' }, - { '', ':vertical resize +10', desc = 'Increase window width' }, - { '', ':resize +10', desc = 'Increase window height' }, - { '', ':Fterm lazygit', desc = 'Lazygit' }, - - { '', ':NavigatorLeft', desc = 'Move Left' }, - { '', ':NavigatorDown', desc = 'Move Down' }, - { '', ':NavigatorUp', desc = 'Move Up' }, - { '', ':NavigatorRight', desc = 'Move Right' }, - { '', ':NavigatorPrevious', desc = 'Previous Pane' }, - - { '', ':bprevious', desc = 'Previous Buffer' }, - { '', ':bnext', desc = 'Next Buffer' }, - { '', ':bnext', desc = 'Next Buffer' }, - { '', ':bprevious', desc = 'Previous Buffer' }, - - { 'K', ':Lspsaga hover_doc', desc = 'LSP Hover' }, - { 'Q', ':qall!', desc = 'Force Quit!' }, - { 'U', ':redo', desc = 'Redo' }, - - { '[', group = ' Previous' }, - { '[g', ':Gitsigns prev_hunk', desc = 'Git Hunk' }, - { '[o', group = 'Textobjects' }, - - { ']', group = ' Next' }, - { ']g', ':Gitsigns next_hunk', desc = 'Git Hunk' }, - { ']o', group = 'Textobjects' }, - - { 'gd', ':Lspsaga goto_definition', desc = 'Goto Definition' }, -} - -which_key.setup(setup) -which_key.add(normal_mappings) -which_key.add(visual_mappings) -which_key.add(no_leader_mappings) - -if util.get_user_config('enable_test_runner', false) then - local test_runner_bindings = { - mode = 'n', - { 'u', group = ' Test' }, - { 'uc', ':lua require("neotest").run.run()', desc = 'Run Current Test' }, - { 'uf', ':lua require("neotest").run.run(vim.fn.expand("%"))', desc = 'Run Test File' }, - { 'uo', ':Neotest output-panel', desc = 'Test Output' }, - { 'us', ':Neotest summary', desc = 'Test Summary' }, - } - which_key.add(test_runner_bindings) -end - -if util.get_user_config('enable_db_explorer', false) then - local db_explorer_bindings = { - mode = 'n', - { 'd', group = ' Database' }, - { 'dS', ':lua require("dbee").store("json", "buffer", { extra_arg = 0 })', desc = 'To JSON' }, - { 'db', ':DBToggle', desc = 'DB Explorer' }, - { 'dj', ':lua require("dbee").next()', desc = 'DB Next' }, - { 'dk', ':lua require("dbee").prev()', desc = 'DB Prev' }, - { 'ds', ':lua require("dbee").store("csv", "buffer", { extra_arg = 0 })', desc = 'To CSV' }, - { 'dt', ':lua require("dbee").store("table", "buffer", { extra_arg = 0 })', desc = 'To Table' }, - } - which_key.add(db_explorer_bindings) -end - -if util.get_user_config('enable_debugger', false) then - local debugger_bindings = { - mode = 'n', - { 'b', group = ' Debug' }, - { 'bO', ':DapStepOut', desc = 'Out' }, - { 'bR', ':DapRestartFrame', desc = 'Restart Frame' }, - { 'bb', ':DapToggleBreakpoint', desc = 'Breakpoint' }, - { 'bc', ':DapContinue', desc = 'Continue' }, - { 'bi', ':DapStepInto', desc = 'Into' }, - { 'bl', ":lua require'dap'.run_last()", desc = 'Last' }, - { 'bo', ':DapStepOver', desc = 'Over' }, - { 'br', ':DapToggleRepl', desc = 'Repl' }, - { 'bt', ':DapUIToggle', desc = 'Debugger' }, - { 'bx', ':DapTerminate', desc = 'Exit' }, - } - which_key.add(debugger_bindings) -end - -local user_keybindings = require('lib.util').get_user_config('user_keybindings', {}) -which_key.add(user_keybindings) diff --git a/lua/plugins/utility.lua b/lua/plugins/utility.lua new file mode 100644 index 0000000..92ebacb --- /dev/null +++ b/lua/plugins/utility.lua @@ -0,0 +1,169 @@ +return { + + --harpoon + { + "ThePrimeagen/harpoon", + branch = "harpoon2", + keys = { + { + "", + function() + require("harpoon"):list():select(1) + end, + desc = "buffer j", + }, + { + "", + function() + require("harpoon"):list():select(2) + end, + desc = "buffer k", + }, + { + "", + function() + require("harpoon"):list():select(3) + end, + desc = "buffer l", + }, + { + "", + function() + require("harpoon"):list():select(4) + end, + desc = "buffer ;", + }, + }, + }, + + -- better escape + { + "max397574/better-escape.nvim", + config = function() + require("better_escape").setup({ + mappings = { + -- i for insert, other modes are the first letter too + i = { + -- map kj to exit insert mode + k = { + j = "", + }, + -- map jk and jj to exit insert mode + j = { + k = "", + j = "", + }, + -- disable jj + j = { + j = false, + }, + }, + }, + }) + end, + }, + + -- Navigator + { + "numToStr/Navigator.nvim", + event = "VeryLazy", + config = function() + require("Navigator").setup({ + auto_save = "current", + disable_on_zoom = false, + mux = "auto", + }) + end, + }, + + -- float terminal + { + "akinsho/toggleterm.nvim", + cmd = { "ToggleTerm" }, + version = "v2.*", + config = function() + require("toggleterm").setup({ + size = 10, + open_mapping = [[]], + hide_numbers = true, + shade_filetypes = {}, + shade_terminals = true, + shading_factor = "2", + start_in_insert = true, + insert_mappings = true, + terminal_mappings = true, + persist_size = true, + direction = "float", -- Use 'float' for floating terminal windows + close_on_exit = true, + shell = vim.o.shell, + float_opts = { + border = "curved", -- or 'single', 'double', 'shadow', etc. + winblend = 0, -- Set to 0 for full transparency + highlights = { + border = "Normal", + background = "Normal", + }, + }, + }) + end, + }, + + -- smooth scrolling + { + "karb94/neoscroll.nvim", + opts = {}, + }, + + -- discord presence + -- { + -- "vyfor/cord.nvim", + -- event = "VeryLazy", + -- }, + + { + "rachartier/tiny-code-action.nvim", + dependencies = { + { + "folke/snacks.nvim", + opts = { + terminal = {}, + }, + }, + }, + event = "LspAttach", + opts = {}, + vim.keymap.set({ "n", "x" }, "ca", function() + require("tiny-code-action").code_action() + end, { noremap = true, silent = true }), + }, + + -- uv + { + "benomahony/uv.nvim", + ft = "python", + event = "BufReadPre", + opts = { + picker_integration = true, + keymaps = { + prefix = "u", -- Main prefix for uv commands + commands = true, -- Show uv commands menu (x) + run_file = true, -- Run current file (xr) + run_selection = true, -- Run selected code (xs) + run_function = true, -- Run function (xf) + venv = true, -- Environment management (xe) + init = true, -- Initialize uv project (xi) + add = true, -- Add a package (xa) + remove = true, -- Remove a package (xd) + sync = true, -- Sync packages (xc) + sync_all = true, -- Sync all packages, extras and groups (xC) + }, + }, + }, + + { "wakatime/vim-wakatime", event = "VimEnter", lazy = false }, + -- { + -- "m4xshen/hardtime.nvim", + -- lazy = false, + -- opts = {}, + -- }, +} diff --git a/lua/plugins/whichkey.lua b/lua/plugins/whichkey.lua new file mode 100644 index 0000000..5ec4cde --- /dev/null +++ b/lua/plugins/whichkey.lua @@ -0,0 +1,307 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + config = function() + local wk = require("which-key") + wk.setup({ + preset = "helix", + plugins = { + marks = true, + registers = true, + spelling = { + enabled = true, + suggestions = 30, + }, + }, + presets = { + operators = true, + motions = true, + text_objects = true, + windows = true, + nav = true, + z = true, + g = true, + }, + icons = { + breadcrumb = " ", + separator = " ", + group = "", + keys = { + Space = " ", + }, + rules = false, -- enable auto icon rules + }, + show_help = false, + show_keys = true, + triggers = { + { "", mode = "nvisoct" }, + { "", mode = { "n", "v" } }, + }, + }) + + local normal_mappings = { + mode = "n", + { "x", ":x", desc = " Save and Quit" }, + + -- { "a", group = " AI" }, + + { "c", group = " Code" }, + { "cF", ":retab", desc = "Fix Tabs" }, + { "cd", ":RootDir", desc = "Root Directory" }, + { "cf", ":lua vim.lsp.buf.format({async = true})", desc = "Format File" }, + { "cl", "::g/^\\s*$/d", desc = "Clean Empty Lines" }, + { "cm", ":MarkdownPreviewToggle", desc = "Markdown Preview" }, + { + "ct", + function() + local curr_path = vim.fn.expand("%:p") + Snacks.picker.todo_comments({ + transform = function(item) + local item_path = vim.fn.fnamemodify(item.cwd .. "/" .. item.file, ":p") + return item_path == curr_path + end, + }) + end, + desc = "Todo", + }, + + { "e", group = " Edit" }, + { "ea", ":b#", desc = "Alternate File" }, + { "ec", group = "Edit Configs" }, + { "ee", ":lua MiniFiles.open()", desc = "Explore Tree" }, + { "eE", ":lua Snacks.explorer()", desc = "File Explorer" }, + { "ef", "gf", desc = "File Under Cursor" }, + { "em", ":e README.md", desc = "Readme" }, + { "en", ":enew", desc = "New File" }, + { "er", ":lua require('snacks').rename.rename_file()", desc = "Rename Current File" }, + + { "f", group = " Find" }, + { "fx", ":%bd|e#|bd#", desc = "Close except current" }, + { "ff", ":lua require('snacks').picker.files()", desc = "Find Files" }, + { "fg", ":lua require('snacks').picker.live_grep()", desc = "Live Grep" }, + + { "g", group = " Git" }, + { "gA", ":Gitsigns stage_buffer", desc = "Stage Buffer" }, + { "gR", ":Gitsigns reset_buffer", desc = "Reset Buffer" }, + { "ga", ":Gitsigns stage_hunk", desc = "Stage Hunk" }, + { "gb", ":lua require('gitsigns').blame_line({full = true})", desc = "Blame" }, + { "gB", ":lua require('snacks').git.blame_line()", desc = "Detailed Blame" }, + { "gd", ":Gitsigns diffthis HEAD", desc = "Git Diff" }, + { "gF", ":Git", desc = "Fugitive Panel" }, + { "gi", ":Gitsigns preview_hunk", desc = "Hunk Info" }, + { "gj", ":Gitsigns next_hunk", desc = "Next Hunk" }, + { "gk", ":Gitsigns prev_hunk", desc = "Prev Hunk" }, + { "gr", ":Gitsigns reset_hunk", desc = "Reset Hunk" }, + { "gu", ":Gitsigns undo_stage_hunk", desc = "Undo Stage Hunk" }, + { "gv", ":Gitsigns select_hunk", desc = "Select Hunk" }, + { "gw", ':lua require("snacks").gitbrowse()', desc = "Git Browse" }, + { + "gbr", + ":lua require('snacks').picker.git_branches()", + desc = "Pick and Switch Git Branches", + }, + + { "h", group = "Harpoon" }, + { + "ha", + function() + require("harpoon"):list():add() + end, + desc = "Harpoon add file", + }, + { + "hl", + function() + require("harpoon").ui:toggle_quick_menu(require("harpoon"):list()) + end, + desc = "Harpoon quick menu", + }, + + { "gt", group = "Toggle" }, + { "gtb", ":Gitsigns toggle_current_line_blame", desc = "Blame" }, + { "gtd", ":Gitsigns toggle_deleted", desc = "Deleted" }, + { "gtl", ":Gitsigns toggle_linehl", desc = "Line HL" }, + { "gtn", ":Gitsigns toggle_numhl", desc = "Number HL" }, + { "gts", ":Gitsigns toggle_signs", desc = "Signs" }, + { "gtw", ":Gitsigns toggle_word_diff", desc = "Word Diff" }, + + { "i", group = " Insert" }, + { "id", ":put =strftime('## %a, %d %b, %Y, %r')", desc = "Date" }, + { "if", ":put =expand('%:t')", desc = "File Name" }, + { "ip", ":put %", desc = "Relative Path" }, + { "iP", ":put %:p", desc = "Absolute Path" }, + { "it", ":put =strftime('## %r')", desc = "Time" }, + + { "l", group = " LSP" }, + { "la", ":Lspsaga code_action", desc = "Code Action" }, + { "ld", ":Lspsaga goto_definition", desc = "Goto Definition" }, + { "lf", ":Lspsaga finder", desc = "Finder" }, + { "lh", ":Lspsaga hover_doc", desc = "Hover" }, + { "lI", ":LspInfo", desc = "LSP Info" }, + { "lj", ":Lspsaga diagnostic_jump_next", desc = "Next Diagnostic" }, + { "lk", ":Lspsaga diagnostic_jump_prev", desc = "Prev Diagnostic" }, + { "lo", ":Lspsaga outline", desc = "Outline" }, + { "lp", ":Lspsaga peek_definition", desc = "Peek Definition" }, + { "lq", ":LspStop", desc = "Stop LSP" }, + { "lQ", ":LspRestart", desc = "Restart LSP" }, + { "lr", ":Lspsaga rename", desc = "Rename" }, + { "lR", ":Lspsaga project_replace", desc = "Replace" }, + { "lt", ":Lspsaga goto_type_definition", desc = "Goto Type Definition" }, + { "lT", ":Lspsaga peek_type_definition", desc = "Peek Type Definition" }, + + { "o", group = " Options" }, + { "oi", "vim.show_pos", desc = "Inspect Position" }, + { "oN", ":lua Snacks.notifier.show_history()", desc = "Notification History" }, + { "or", ":set relativenumber!", desc = "Relative Numbers" }, + + { "p", group = " Packages" }, + { "pc", ":Lazy check", desc = "Check" }, + { "pd", ":Lazy debug", desc = "Debug" }, + { "pe", ':lua require("snacks").profiler.scratch()', desc = "Profiler Scratch" }, + { "pf", ':lua require("snacks").profiler.pick()', desc = "Profiler Pick" }, + { "pi", ":Lazy install", desc = "Install" }, + { "pl", ":Lazy log", desc = "Log" }, + { "pm", ":Mason", desc = "Mason" }, + { "pp", ":Lazy", desc = "Plugins" }, + { "pP", ":Lazy profile", desc = "Profile" }, + { "pr", ":Lazy restore", desc = "Restore" }, + { "ps", ":Lazy sync", desc = "Sync" }, + { "pt", ':lua require("snacks").profiler.toggle()', desc = "Profiler Toggle" }, + { "pu", ":Lazy update", desc = "Update" }, + { "px", ":Lazy clean", desc = "Clean" }, + + { "q", group = " Quit" }, + { "qa", ":qall", desc = "Quit All" }, + { "qb", ":bw", desc = "Close Buffer" }, + { "qd", ':lua require("snacks").bufdelete()', desc = "Delete Buffer" }, + { "qf", ":qall!", desc = "Force Quit" }, + { "qo", ":%bdelete|b#|bdelete#", desc = "Close Others" }, + { "qq", ":q", desc = "Quit" }, + { "qs", "c", desc = "Close Split" }, + { "qw", ":wq", desc = "Write and Quit" }, + + { "r", group = " Refactor" }, + { "rd", "", desc = "Go To Definition" }, -- treesitter navigation + { "rh", "", desc = "List Definition Head" }, + { "rj", "", desc = "Next Usage" }, + { "rk", "", desc = "Previous Usage" }, + { "rl", "", desc = "List Definition" }, + { "rn", "", desc = "Swap Next" }, + { "rp", "", desc = "Swap Previous" }, + { "rr", "", desc = "Smart Rename" }, + { "rs", ":%s/\\<\\>//gI", desc = "Replace Word Buffer" }, + + { "s", group = " Split" }, + { "s+", ":resize +10", desc = "Increase window height" }, + { "s-", ":vertical resize -20", desc = "Decrease window width" }, + { "s/", "s", desc = "Split Below" }, + { "s=", ":vertical resize +20", desc = "Increase window width" }, + { "sH", ":vertical resize -10", desc = "Decrease window width" }, + { "sJ", ":resize -5", desc = "Decrease window height" }, + { "sK", ":resize +5", desc = "Increase window height" }, + { "sL", ":vertical resize +10", desc = "Increase window width" }, + { "s\\", "v", desc = "Split Right" }, + { "s_", ":resize -10", desc = "Decrease window height" }, + { "s`", "p", desc = "Previous Window" }, + { "sa", ":split", desc = "Horizontal Split" }, + { "sc", ":tabclose", desc = "Close Tab" }, + { "sf", ":tabfirst", desc = "First Tab" }, + { "sh", "h", desc = "Move Left" }, + { "sj", "j", desc = "Move Down" }, + { "sk", "k", desc = "Move Up" }, + { "sl", "l", desc = "Move Right" }, + { "sp", ":NavigatorPrevious", desc = "Previous Pane" }, + { "sq", "c", desc = "Close Split" }, + { "ss", ":vsplit", desc = "Vertical Split" }, + + { "t", group = " Terminal" }, + { "t1", "1ToggleTerm", desc = "Toggle Terminal" }, + { "t2", "2ToggleTerm", desc = "Toggle Terminal" }, + { "tc", "close", desc = "Hide Terminal" }, + + { "th", group = "Inlay Hints" }, + + { "w", group = " Writing" }, + { "wc", ":set spell!", desc = "Spellcheck" }, + { "wd", ':lua require("snacks").dim.enable()', desc = "Dim On" }, + { "wD", ':lua require("snacks").dim.disable()', desc = "Dim Off" }, + { "wf", ":lua require'utils'.sudo_write()", desc = "Force Write" }, + { "wj", "]s", desc = "Next Misspell" }, + { "wk", "[s", desc = "Prev Misspell" }, + { "wn", ":WriteNoFormat", desc = "Write Without Formatting" }, + { "wq", ":wq", desc = "Write and Quit" }, + { "ww", ":w", desc = "Write" }, + { "wz", ':lua require("snacks").zen.zen()', desc = "Zen" }, + { "wZ", ':lua require("snacks").zen.zoom()', desc = "Zoom" }, + + { "y", group = " Yank" }, + { "yL", ":CopyAbsolutePathWithLine", desc = "Absolute Path with Line" }, + { "yP", ":CopyAbsolutePath", desc = "Absolute Path" }, + { "ya", ":%y+", desc = "Copy Whole File" }, + { "yf", ":CopyFileName", desc = "File Name" }, + { "yg", ':lua require"gitlinker".get_buf_range_url()', desc = "Copy Git URL" }, + { "yl", ":CopyRelativePathWithLine", desc = "Relative Path with Line" }, + { "yp", ":CopyRelativePath", desc = "Relative Path" }, + } + + local visual_mappings = { + mode = "v", + -- { "a", group = " AI" }, + + { "c", group = " Code" }, + { "cS", ":sort!", desc = "Sort Desc" }, + { "ci", ":sort i", desc = "Sort Case Insensitive" }, + { "cs", ":sort", desc = "Sort Asc" }, + { "cu", ":!uniq", desc = "Unique" }, + { "cx", ":lua", desc = "Execute Lua" }, + + { "g", group = " Git" }, + { "ga", ":'<,'>Gitsigns stage_hunk", desc = "Stage Hunk" }, + { "gr", ":'<,'>Gitsigns reset_hunk", desc = "Reset Hunk" }, + { "gu", ":'<,'>Gitsigns undo_stage_hunk", desc = "Undo Stage Hunk" }, + + { "l", group = " LSP" }, + { "la", ":Lspsaga range_code_action", desc = "Code Action" }, + + { "y", group = " Yank" }, + { "yg", ':lua require"gitlinker".get_buf_range_url("v")', desc = "Copy Git URL" }, + } + + local no_leader_mappings = { + mode = "n", + { "", ":resize -10", desc = "Decrease window height" }, + { "", ":vertical resize -10", desc = "Decrease window width" }, + { "", ":vertical resize +10", desc = "Increase window width" }, + { "", ":resize +10", desc = "Increase window height" }, + + { "", ":NavigatorLeft", desc = "Move Left" }, + { "", ":NavigatorDown", desc = "Move Down" }, + { "", ":NavigatorUp", desc = "Move Up" }, + { "", ":NavigatorRight", desc = "Move Right" }, + { "", ":NavigatorPrevious", desc = "Previous Pane" }, + + { "", ":bprevious", desc = "Previous Buffer" }, + { "", ":bnext", desc = "Next Buffer" }, + { "", ":bnext", desc = "Next Buffer" }, + { "", ":bprevious", desc = "Previous Buffer" }, + + { "K", ":Lspsaga hover_doc", desc = "LSP Hover" }, + { "Q", ":qall!", desc = "Force Quit!" }, + { "U", ":redo", desc = "Redo" }, + + { "[", group = " Previous" }, + { "[g", ":Gitsigns prev_hunk", desc = "Git Hunk" }, + { "[o", group = "Textobjects" }, + + { "]", group = " Next" }, + { "]g", ":Gitsigns next_hunk", desc = "Git Hunk" }, + { "]o", group = "Textobjects" }, + + { "gd", ":Lspsaga goto_definition", desc = "Goto Definition" }, + } + + wk.add(normal_mappings) + wk.add(visual_mappings) + wk.add(no_leader_mappings) + end, +} diff --git a/plugin/after/highlights.lua b/plugin/after/highlights.lua deleted file mode 100644 index 24ac199..0000000 --- a/plugin/after/highlights.lua +++ /dev/null @@ -1,28 +0,0 @@ --- transparent background -vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' }) -vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'none' }) -vim.api.nvim_set_hl(0, 'FloatBorder', { bg = 'none' }) -vim.api.nvim_set_hl(0, 'Pmenu', { bg = 'none' }) -vim.api.nvim_set_hl(0, 'Terminal', { bg = 'none' }) -vim.api.nvim_set_hl(0, 'EndOfBuffer', { bg = 'none' }) -vim.api.nvim_set_hl(0, 'FoldColumn', { bg = 'none' }) -vim.api.nvim_set_hl(0, 'Folded', { bg = 'none' }) -vim.api.nvim_set_hl(0, 'SignColumn', { bg = 'none' }) - --- transparent background for nvim-tree -vim.api.nvim_set_hl(0, 'NvimTreeNormal', { bg = 'none' }) -vim.api.nvim_set_hl(0, 'NvimTreeVertSplit', { bg = 'none' }) -vim.api.nvim_set_hl(0, 'NvimTreeEndOfBuffer', { bg = 'none' }) - --- set hlsearch color -vim.api.nvim_set_hl(0, 'Search', { bg = '#8BCD5B', fg = '#202020' }) -vim.api.nvim_set_hl(0, 'CurSearch', { bg = '#EFBD5D', fg = '#000000' }) -vim.api.nvim_set_hl(0, 'IncSearch', { bg = '#F15664', fg = '#000000' }) - --- set cursorline color -vim.api.nvim_set_hl(0, 'CursorLine', { bg = '#1A1A1F' }) -vim.api.nvim_set_hl(0, 'CursorColumn', { bg = '#1A1A1F' }) - --- set visual highlight -vim.api.nvim_set_hl(0, 'Visual', { bg = '#103070' }) - diff --git a/pywal/.gitignore b/pywal/.gitignore deleted file mode 100644 index b0ac3ed..0000000 --- a/pywal/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.aider* diff --git a/pywal/LICENSE b/pywal/LICENSE deleted file mode 100644 index f288702..0000000 --- a/pywal/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/pywal/README.md b/pywal/README.md deleted file mode 100644 index e0bc5ef..0000000 --- a/pywal/README.md +++ /dev/null @@ -1,71 +0,0 @@ -

Base46: Pywal Edition

- -

Pywal and Matugen support for NvChad!

- -> [!NOTE] -> Support for Pywal requires these Python libraries to be installed: -> - `pywal` -> - `watchdog` - -## Installation -```bash -cd ~/.config/nvim -git clone https://github.com/NvChad/pywal -``` -Add this at the end of your `init.lua` file: -```lua -os.execute("python ~/.config/nvim/pywal/chadwal.py &> /dev/null &") - -local autocmd = vim.api.nvim_create_autocmd - -autocmd("Signal", { - pattern = "SIGUSR1", - callback = function() - require('nvchad.utils').reload() - end -}) -``` -Now you need to generate your Pywal theme again using `wal -i `. If not, `chadwal` will default to `gruvchad` colors. - -### Matugen support -Add this your `~/.config/matugen/config.toml` file: -```toml -[templates.nvim] -input_path = '~/.config/nvim/pywal/matugen.lua' -output_path = '~/.cache/wal/base46-dark.lua' - -[config.custom_colors.red] -color = "#FF0000" -blend = true - -[config.custom_colors.green] -color = "#00FF00" -blend = true - -[config.custom_colors.yellow] -color = "#FFFF00" -blend = true - -[config.custom_colors.blue] -color = "#0000FF" -blend = true - -[config.custom_colors.magenta] -color = "#FF00FF" -blend = true - -[config.custom_colors.cyan] -color = "#00FFFF" -blend = true - -[config.custom_colors.white] -color = "#FFFFFF" -blend = true -``` - -Just like with Pywal, you need to generate your theme again using `matugen image `. If not, `chadwal` will default to `gruvchad` colors. - -Select `chadwal` theme and enjoy! - -## Demo -https://github.com/user-attachments/assets/933c97f2-4566-406c-8c04-e2e9f0f3f6da diff --git a/pywal/chadwal.py b/pywal/chadwal.py deleted file mode 100644 index c676271..0000000 --- a/pywal/chadwal.py +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env python3 - -import os -import shutil -import sys -import time -import subprocess -from watchdog.observers import Observer -from watchdog.events import FileSystemEventHandler - -# Constants -SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) -HOME_DIR = os.path.expanduser("~") -TEMPLATE_SRC = { - "dark": os.path.join(SCRIPT_DIR, "dark.lua"), - "light": os.path.join(SCRIPT_DIR, "light.lua") -} -TEMPLATE_DST = { - "dark": f"{HOME_DIR}/.config/wal/templates/base46-dark.lua", - "light": f"{HOME_DIR}/.config/wal/templates/base46-light.lua" -} -CACHE_SRC = { - "dark": f"{HOME_DIR}/.cache/wal/base46-dark.lua", - "light": f"{HOME_DIR}/.cache/wal/base46-light.lua" -} -CACHE_DST = f"{HOME_DIR}/.local/share/nvim/lazy/base46/lua/base46/themes/chadwal.lua" -FALLBACK_THEME = f"{HOME_DIR}/.local/share/nvim/lazy/base46/lua/base46/themes/gruvchad.lua" -LOCK_FILE = "/tmp/wal_nvim_lock" -COLORS_FILE = f"{HOME_DIR}/.cache/wal/colors" - -# Utility functions -def is_dark(hex_color): - """Determine if the color is dark based on luminance.""" - hex_color = hex_color.lstrip('#') - r, g, b = (int(hex_color[i:i+2], 16) for i in (0, 2, 4)) - brightness = (r * 299 + g * 587 + b * 114) / 1000 - return brightness < 128 - -def get_hex_from_colors_file(): - """Read the first color from the colors file.""" - try: - with open(COLORS_FILE, 'r') as file: - return file.readline().strip() - except FileNotFoundError: - sys.exit(f"Error: Colors file not found: {COLORS_FILE}") - -def acquire_lock(): - """Create a lock file to prevent multiple instances.""" - if os.path.exists(LOCK_FILE): - sys.exit("Another instance is already running. Exiting...") - open(LOCK_FILE, 'w').close() - -def release_lock(): - """Remove the lock file.""" - if os.path.exists(LOCK_FILE): - os.remove(LOCK_FILE) - -def copy_file(src, dst, skip_if_exists=False): - """Copy a file from src to dst, optionally skipping if dst exists.""" - if skip_if_exists and os.path.exists(dst): - print(f"File already exists at {dst}, skipping copy.") - return - - try: - os.makedirs(os.path.dirname(dst), exist_ok=True) - shutil.copy(src, dst) - print(f"File copied from {src} to {dst}.") - except Exception as e: - sys.exit(f"Error copying file from {src} to {dst}: {e}") - -def on_file_modified(): - """Handle file modifications based on current color scheme.""" - is_dark_theme = is_dark(get_hex_from_colors_file()) - mode = "dark" if is_dark_theme else "light" - - copy_file(FALLBACK_THEME, CACHE_SRC[mode], skip_if_exists=True) - copy_file(TEMPLATE_SRC[mode], TEMPLATE_DST[mode]) - copy_file(CACHE_SRC[mode], CACHE_DST) - - # Signal running nvim instances, don't exit based on the result here. - subprocess.run(['killall', '-SIGUSR1', 'nvim']) - -# Watchdog event handler -class MyHandler(FileSystemEventHandler): - def on_modified(self, event): - if event.src_path == CACHE_SRC["dark"]: - on_file_modified() - -def monitor_file(file_path): - """Monitor the specified file for changes.""" - event_handler = MyHandler() - observer = Observer() - observer.schedule(event_handler, os.path.dirname(file_path), recursive=False) - observer.start() - - try: - while True: - # Check every 5 seconds if nvim is running - time.sleep(5) - # Use pgrep to check for exact process name 'nvim' - result = subprocess.run(['pgrep', '-x', 'nvim'], capture_output=True) - if result.returncode != 0: - print("No running nvim instances found. Exiting.") - observer.stop() # Stop the observer thread - break # Exit the loop - except KeyboardInterrupt: - print("\nKeyboard interrupt received. Exiting.") - observer.stop() - finally: - # Ensure the observer thread is joined before exiting - observer.join() - -if __name__ == "__main__": - on_file_modified() - acquire_lock() - try: - on_file_modified() - monitor_file(CACHE_SRC["dark"]) - finally: - release_lock() diff --git a/pywal/dark.lua b/pywal/dark.lua deleted file mode 100644 index 7837144..0000000 --- a/pywal/dark.lua +++ /dev/null @@ -1,70 +0,0 @@ -local M = {{}} - -local lighten = require("base46.colors").change_hex_lightness - -M.base_30 = {{ - white = "{color7}", - darker_black = lighten("{color0}", -3), - black = "{color0}", - black2 = lighten("{color0}", 6), - one_bg = lighten("{color0}", 10), - grey = lighten("{color0}", 40), - light_grey = "{color8}", - red = "{color1}", - baby_pink = "{color9}", - pink = "{color13}", - line = "{color8}", - green = "{color2}", - vibrant_green = "{color2}", - nord_blue = "{color4}", - blue = "{color4}", - yellow = "{color3}", - sun = lighten("{color3}", 6), - purple = "{color13}", - dark_purple = "{color13}", - teal = "{color4}", - orange = "{color1}", - cyan = "{color4}", - pmenu_bg = "{color8}", - folder_bg = "{color4}", -}} - -M.base_30.statusline_bg = M.base_30.black2 -M.base_30.lightbg = M.base_30.one_bg -M.base_30.one_bg2 = lighten(M.base_30.one_bg, 6) -M.base_30.one_bg3 = lighten(M.base_30.one_bg2, 6) -M.base_30.grey_fg = lighten(M.base_30.grey, 10) -M.base_30.grey_fg2 = lighten(M.base_30.grey, 5) - -M.base_16 = {{ - base00 = "{color0}", - base01 = "{color0}", - base02 = "{color8}", - base03 = "{color8}", - base04 = "{color7}", - base05 = "{color7}", - base06 = "{color15}", - base07 = "{color15}", - base08 = "{color1}", - base09 = "{color2}", - base0A = "{color3}", - base0B = "{color4}", - base0C = "{color5}", - base0D = "{color6}", - base0E = "{color1}", - base0F = "{color15}", -}} - -M.type = "dark" - -M.polish_hl = {{ - Operator = {{ - fg = M.base_30.nord_blue, - }}, - - ["@operator"] = {{ - fg = M.base_30.nord_blue, - }}, -}} - -return M diff --git a/pywal/light.lua b/pywal/light.lua deleted file mode 100644 index 3cb85a4..0000000 --- a/pywal/light.lua +++ /dev/null @@ -1,70 +0,0 @@ -local M = {{}} - -local lighten = require("base46.colors").change_hex_lightness - -M.base_30 = {{ - white = "{color7}", - darker_black = lighten("{color0}", -3), - black = "{color0}", - black2 = lighten("{color0}", -6), - one_bg = lighten("{color0}", -10), - grey = lighten("{color0}", -40), - light_grey = "{color8}", - red = "{color1}", - baby_pink = "{color9}", - pink = "{color13}", - line = "{color8}", - green = "{color2}", - vibrant_green = "{color2}", - nord_blue = "{color4}", - blue = "{color4}", - yellow = "{color3}", - sun = lighten("{color3}", -6), - purple = "{color13}", - dark_purple = "{color13}", - teal = "{color4}", - orange = "{color1}", - cyan = "{color4}", - pmenu_bg = "{color8}", - folder_bg = "{color4}", - }} - - M.base_30.statusline_bg = M.base_30.black2 - M.base_30.lightbg = M.base_30.one_bg - M.base_30.one_bg2 = lighten(M.base_30.one_bg, -6) - M.base_30.one_bg3 = lighten(M.base_30.one_bg2, -6) - M.base_30.grey_fg = lighten(M.base_30.grey, -10) - M.base_30.grey_fg2 = lighten(M.base_30.grey, -5) - -M.base_16 = {{ - base00 = "{color0}", - base01 = "{color0}", - base02 = "{color8}", - base03 = "{color8}", - base04 = "{color7}", - base05 = "{color7}", - base06 = "{color15}", - base07 = "{color15}", - base08 = "{color1}", - base09 = "{color2}", - base0A = "{color3}", - base0B = "{color4}", - base0C = "{color5}", - base0D = "{color6}", - base0E = "{color1}", - base0F = "{color15}", -}} - -M.type = "dark" - -M.polish_hl = {{ - Operator = {{ - fg = M.base_30.nord_blue, - }}, - - ["@operator"] = {{ - fg = M.base_30.nord_blue, - }}, -}} - -return M diff --git a/pywal/matugen.lua b/pywal/matugen.lua deleted file mode 100644 index 8755c2d..0000000 --- a/pywal/matugen.lua +++ /dev/null @@ -1,81 +0,0 @@ -local M = {} - -local lighten = require("base46.colors").change_hex_lightness - -M.base_30 = { - white = "{{colors.on_background.default.hex}}", - black = "{{colors.background.default.hex}}", - darker_black = lighten("{{colors.background.default.hex}}", -3), - black2 = lighten("{{colors.background.default.hex}}", 6), - one_bg = lighten("{{colors.background.default.hex}}", 10), - one_bg2 = lighten("{{colors.background.default.hex}}", 16), - one_bg3 = lighten("{{colors.background.default.hex}}", 22), - grey = "{{colors.surface_variant.default.hex}}", - grey_fg = lighten("{{colors.surface_variant.default.hex}}", -10), - grey_fg2 = lighten("{{colors.surface_variant.default.hex}}", -20), - light_grey = "{{colors.outline.default.hex}}", - red = "{{colors.red.default.hex}}", - baby_pink = lighten("{{colors.red.default.hex}}", 10), - pink = "{{colors.tertiary.default.hex}}", - line = "{{colors.outline.default.hex}}", - green = "{{colors.green.default.hex}}", - vibrant_green = lighten("{{colors.green.default.hex}}", 10), - blue = "{{colors.blue.default.hex}}", - nord_blue = lighten("{{colors.blue.default.hex}}", 10), - yellow = "{{colors.yellow.default.hex}}", - sun = lighten("{{colors.yellow.default.hex}}", 10), - purple = "{{colors.tertiary.default.hex}}", - dark_purple = lighten("{{colors.tertiary.default.hex}}", -10), - teal = "{{colors.secondary_container.default.hex}}", - orange = "{{colors.red.default.hex}}", - cyan = "{{colors.cyan.default.hex}}", - statusline_bg = lighten("{{colors.background.default.hex}}", 6), - pmenu_bg = "{{colors.surface_variant.default.hex}}", - folder_bg = lighten("{{colors.primary_fixed_dim.default.hex}}", 0), - lightbg = lighten("{{colors.background.default.hex}}", 10), -} - -M.base_16 = { - base00 = "{{colors.surface.default.hex}}", - base01 = lighten("{{colors.surface_variant.default.hex}}", 0), - base02 = lighten("{{colors.surface_variant.default.hex}}", 3), - base03 = lighten("{{colors.outline.default.hex}}", 0), - base04 = lighten("{{colors.on_surface_variant.default.hex}}", 0), - base05 = "{{colors.on_surface.default.hex}}", - base06 = lighten("{{colors.on_surface.default.hex}}", 0), - base07 = "{{colors.surface.default.hex}}", - base08 = "{{colors.red.default.hex}}", - base09 = "{{colors.yellow.default.hex}}", - base0A = "{{colors.blue.default.hex}}", - base0B = "{{colors.green.default.hex}}", - base0C = "{{colors.cyan.default.hex}}", - base0D = lighten("{{colors.blue.default.hex}}", 20), - base0E = "{{colors.tertiary.default.hex}}", - base0F = "{{colors.inverse_surface.default.hex}}", -} - -M.type = "dark" - -M.polish_hl = { - defaults = { - Comment = { - italic = true, - fg = M.base_16.base03, - }, - }, - Syntax = { - String = { - fg = "{{colors.tertiary.default.hex}}", - }, - }, - treesitter = { - ["@comment"] = { - fg = M.base_16.base03, - }, - ["@string"] = { - fg = "{{colors.tertiary.default.hex}}", - }, - }, -} - -return M diff --git a/snippets/c.json b/snippets/c.json deleted file mode 100644 index 96cbe4e..0000000 --- a/snippets/c.json +++ /dev/null @@ -1,360 +0,0 @@ -{ - "for": { - "prefix": "for", - "body": [ - "for (${1:size_t} ${2:i} = ${3:0}; $2 < ${4:length}; $2++) {", - "\t$0", - "}" - ], - "description": "Code snippet for 'for' loop" - }, - "_FOREACH": { - "prefix": "_FOREACH", - "body": [ - "#define foreach(item, array) \\", - "\tfor(int keep = 1, \\", - "\tcount = 0,\\", - "\tsize = sizeof (array) / sizeof *(array); \\", - "\tkeep && count != size; \\", - "\tkeep = !keep, count++) \\", - "\tfor(item = (array) + count; keep; keep = !keep)" - ], - "description": "foreach loop C" - }, - "*": { - "prefix": "*", - "body": ["/* $0 */"], - "description": "Block comment" - }, - "glfw330win": { - "prefix": "glfw330win", - "body": [ - "if (!glfwInit()) {", - "log_warn(\"GLFW failed\");", - "glfwTerminate();", - "return 1;", - "}", - "glfwWindowHint(GLFW_SAMPLES, 4);", - "glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);", - "glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);", - "glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);" - ], - "description": "Glfw window hint for opengl v3.3" - }, - "gl_vertex_arr": { - "prefix": "gl_vertex_arr", - "body": [ - "glGenVertexArrays(${1:size}, &$2);", - "glBindVertexArray($2);" - ], - "description": "GL generate vertex array" - }, - "gl_vertex_buffer": { - "prefix": "gl_vertex_buffer", - "body": [ - "glGenBuffers(${1:1}, &$2);", - "glBindBuffer(${3:buffer_type}, $2);", - "glBufferData($3, sizeof($4), $4, $5)" - ], - "description": "gl generate buffer" - }, - "DBG": { - "prefix": "DBG", - "body": ["#define WHERE fprintf(stderr,\"[LOG]%s:%d\\n\",__FILE__,__LINE__);"], - "description": "Debug code line" - }, - "forr": { - "prefix": "forr", - "body": [ - "for (${1:size_t} ${2:i} = ${3:length} - 1; $2 >= ${4:0}; $2--) {", - "\t$0", - "}" - ], - "description": "Code snippet for reverse 'for' loop" - }, - "mod": { - "prefix": "_MOD", - "body": ["#define MOD(N,M)\t((N)%(M) < 0 ? (N)%(M) + (M) : (N)%(M))\n"], - "description": "mod of N,M" - }, - "between": { - "prefix": "_BETWEEN", - "body": ["#define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b))\n"], - "description": "x is between a, b" - }, - "length" : { - "prefix": "_LENGTH", - "body": ["#define LENGTH(x) sizeof(x)/sizeof(x[0])\n"], - "description": "Array size macro" - }, - "max" : { - "prefix": "_MAX", - "body": ["#define MAX(x,y) (x) > (y) ? (x) : (y)","$0"], - "description": "Get max element" - }, - "min" : { - "prefix": "_MIN", - "body": ["#define MIN(x,y) (x) < (y) ? (x) : (y)","$0"], - "description": "Get min element" - }, - "getbit": { - "prefix": "_GETBIT", - "body": ["#define GETBIT(x,i) (x&(1<"], - "description": "Code snippet for #include < >" - }, - "#def": { - "prefix": "def", - "body": ["#define $0"], - "description": "Code snippet for #define \" \"" - }, - "Main function template": { - "prefix": "main", - "body": [ - "int main (int argc, char *argv[])", - "{", - "\t$0", - "\treturn 0;", - "}" - ], - "description": "A standard main function for a C program" - }, - "Standard Starter Template": { - "prefix": "sst", - "body": [ - "#include ", - "", - "int main ()", - "{", - "\t$0", - "\treturn 0;", - "}" - ], - "description": "A standard starter template for a C program" - }, - "Stdlib Variant Starter Template": { - "prefix": "libsst", - "body": [ - "#include ", - "#include ", - "", - "int main (int argc, char *argv[])", - "{", - "\t$0", - "\treturn 0;", - "}" - ], - "description": "A standard starter template for a C program with stdlib included" - }, - "Create linked list": { - "prefix": "clist", - "body": [ - "typedef struct _node * Link;", - "typedef struct _node node;", - "struct _node {", - "\tint value;", - "\tLink next;", - "};" - ], - "description": "Creates a linked list template" - }, - "Scan integer": { - "prefix": "sci", - "body": ["scanf(\"%d\", &$1);"], - "description": "Scan int" - }, - "Scan 2 integer": { - "prefix": "sci2", - "body": ["scanf(\"%d %d\", &$1, &$2);"], - "description": "Scan 2 int" - }, - "Scan unsigned integer": { - "prefix": "scui", - "body": ["scanf(\"%d\", &$1);"], - "description": "Scan unsigned int" - }, - "Scan float": { - "prefix": "scf", - "body": ["scanf(\"%f\", &$1);"], - "description": "Scan float" - }, - "Scan 2 float": { - "prefix": "scf2", - "body": ["scanf(\"%f %f\", &$1, &$2);"], - "description": "Scan 2 float" - }, - "Scan long": { - "prefix": "scl", - "body": ["scanf(\"%ld\", &$1);"], - "description": "Scan long" - }, - "Scan 2 long": { - "prefix": "scl2", - "body": ["scanf(\"%ld %ld\", &$1, &$2);"], - "description": "Scan 2 long" - }, - "Scan unsigned long": { - "prefix": "scul", - "body": ["scanf(\"%lu\", &$1);"], - "description": "Scan unsigned long" - }, - "Scan unsigned long long": { - "prefix": "scull", - "body": ["scanf(\"%llu\", &$1);"], - "description": "Scan unsigned long long" - }, - "Print variable of type float (2 decimal places)": { - "prefix": "pflo", - "body": ["printf(\"$1 :>> %.2f\\n\", $1);"], - "description": "Calls printf() to log value of variable of type float rounded to 2 decimal places" - }, - "Print variable of type integer": { - "prefix": "pint", - "body": ["printf(\"$1 : %d\\n\", $1);"], - "description": "Calls printf() to log value of variable of type signed integer" - }, - "Print variable of type char": { - "prefix": "pcha", - "body": ["printf(\"$1 : %c\\n\", $1);"], - "description": "Calls printf() to log value of variable of type char" - }, - "Print variable of type pointer": { - "prefix": "ppoint", - "body": ["printf(\"$1 : %p\\n\", (void *) $1);"], - "description": "Calls printf() to log value of variable of type pointer" - }, - "Print variable of type size_t": { - "prefix": "psiz", - "body": ["printf(\"$1 : %zu\\n\", $1);"], - "description": "Calls printf() to log value of variable of type size_t" - }, - "printf": { - "prefix": "printf", - "body": ["printf(\"$1\\n\"$0);"], - "description": "Generic printf() snippet" - }, - "sprintf": { - "prefix": "sprintf", - "body": ["sprintf($1, \"$2\\n\"$0);"], - "description": "Generic sprintf() snippet" - }, - "fprintf": { - "prefix": "fprintf", - "body": ["fprintf(${1:stderr}, \"$2\\n\"$0);"], - "description": "Generic fprintf() snippet" - }, - "scanf": { - "prefix": "scanf", - "body": ["scanf(\"$1\"$0);"], - "description": "Generic scanf() snippet" - }, - "sscanf": { - "prefix": "sscanf", - "body": ["sscanf($1, \"$2\"$0);"], - "description": "Generic sscanf() snippet" - }, - "fscanf": { - "prefix": "fscanf", - "body": ["fscanf($1, \"$2\"$0);"], - "description": "Generic fscanf() snippet" - }, - "Allocate memory using malloc": { - "prefix": "mal", - "body": [ - "${1:int} *${2:v} = malloc(${3:1} * sizeof($1));", - "", - "if (!$2) {", - "\tfprintf(stderr, \"Memory allocation failed!\\n\");", - "\t$4;", - "}", - "$0", - "free($2);" - ], - "description": "Allocates memory to a pointer variable using malloc(), then deallocates using free()." - }, - "Allocate memory using calloc": { - "prefix": "cal", - "body": [ - "${1:int} *${2:v} = calloc(${3:1}, sizeof($1));", - "", - "if (!$2) {", - "\tfprintf(stderr, \"Memory allocation failed!\\n\");", - "\t$4;", - "}", - "$0", - "free($2);" - ], - "description": "Allocates memory to a pointer variable using calloc(), then deallocates using free()." - }, - "X11 default incs": { - "prefix": "_X11", - "body": ["#include \n#include \n#include \n#include \n"], - "description": "X11 default library headers" - }, - "Primitive macros": { - "prefix": "_PRIMITIVE", - "body": [ - "#define i16 short", - "#define ui16 unsigned short", - "#define i32 int", - "#define ui32 unsigned int", - "#define i64 long long", - "#define ui64 unsigned long long" - ], - "description": "Primitive macros for int type" - } -} diff --git a/snippets/cpp.json b/snippets/cpp.json deleted file mode 100644 index c949464..0000000 --- a/snippets/cpp.json +++ /dev/null @@ -1,219 +0,0 @@ -{ - "for": { - "prefix": "for", - "body": [ - "for (${1:size_t} ${2:i} = ${3:0}; $2 < ${4:length}; $2++) {", - "\t$0", - "}" - ], - "description": "Code snippet for 'for' loop" - }, - "*": { - "prefix": "*", - "body": ["/* $0 */"], - "description": "Block comment" - }, - "forr": { - "prefix": "forr", - "body": [ - "for (${1:size_t} ${2:i} = ${3:length} - 1; $2 >= ${4:0}; $2--) {", - "\t$0", - "}" - ], - "description": "Code snippet for reverse 'for' loop" - }, - "mod": { - "prefix": "MOD", - "body": ["#define MOD(N,M)\t((N)%(M) < 0 ? (N)%(M) + (M) : (N)%(M))"], - "description": "mod of N,M" - }, - "between": { - "prefix": "between", - "body": ["#define BETWEEN(x, a, b)\t((a) <= (x) && (x) <= (b))"], - "description": "x is between a, b" - }, - "sze" : { - "prefix": "sze", - "body": ["#define SIZE(x) sizeof(x)/sizeof(x[0])","$0"], - "description": "Array size macro" - }, - "do": { - "prefix": "do", - "body": ["do", "{", "\t$1", "} while($2);"], - "description": "Code snippet for do...while loop" - }, - "while": { - "prefix": "while", - "body": ["while ($1) {", "\t$2", "}"], - "description": "" - }, - "foreach": { - "prefix": "foreach", - "body": ["for (${1:auto} ${2:var} : ${3:collection_to_loop}) {", "\t$0", "}"], - "description": "Code snippet for range-based for loop (c++11) statement" - }, - "enum": { - "prefix": "enum", - "body": ["enum ${1:MyEnum} {", "\t$0", "};"], - "description": "Code snippet for enum" - }, - "enum class": { - "prefix": "enum class", - "body": ["enum class ${1:MyClass} {$0};"], - "description": "Code snippet for enum class (c++11)" - }, - "class": { - "prefix": "class", - "body": [ - "class ${1:MyClass}", - "{", - "public:", - "\t$1();", - "\t$1($1 &&) = default;", - "\t$1(const $1 &) = default;", - "\t$1 &operator=($1 &&) = default;", - "\t$1 &operator=(const $1 &) = default;", - "\t~$1();", - "", - "private:", - "\t$2", - "};", - "", - "$1::$1()", - "{", - "}", - "", - "$1::~$1()", - "{", - "}" - ], - "description": "Code snippet for class" - }, - "classi": { - "prefix": "classi", - "body": [ - "class ${1:MyClass}", - "{", - "public:", - "\t$1() = default;", - "\t$1($1 &&) = default;", - "\t$1(const $1 &) = default;", - "\t$1 &operator=($1 &&) = default;", - "\t$1 &operator=(const $1 &) = default;", - "\t~$1() = default;", - "", - "private:", - "\t$2", - "};" - ], - "description": "Code snippet for class with inline constructor/destructor" - }, - "interface": { - "prefix": "interface", - "body": ["__interface I${1:Interface}", "{", "\t$0", "};"], - "description": "Code snippet for interface (Visual C++)" - }, - "namespace": { - "prefix": "namespace", - "body": ["namespace ${1:MyNamespace}", "{", "\t$0", "}"] - }, - "#ifdef": { - "prefix": "#ifdef", - "body": ["#ifdef ${1:DEBUG}", "$0", "#endif // ${DEBUG}"], - "description": "Code snippet for #ifdef" - }, - "#ifndef": { - "prefix": "#ifndef", - "body": ["#ifndef ${1:DEBUG}", "$0", "#endif // !$1"], - "description": "Code snippet for #ifndef" - }, - "#if": { - "prefix": "#if", - "body": ["#if ${1:0}", "$0", "#endif // $1"], - "description": "Code snippet for #if" - }, - "struct": { - "prefix": "struct", - "body": ["struct ${1:MyStruct}", "{", "\t$0", "};"], - "description": "Code snippet for struct" - }, - "switch": { - "prefix": "switch", - "body": ["switch (${1:switch_on}) {", "\tdefault:", "\t\t$0", "\t\tbreak;", "}"], - "description": "Code snippet for switch statement" - }, - "try": { - "prefix": "try", - "body": [ - "try {", - "\t", - "}", - "catch (const std::exception&)", - "{", - "\t$1", - "}" - ], - "description": "Code snippet for try catch" - }, - "union": { - "prefix": "union", - "body": ["union ${1:MyUnion}", "{", "\t$0", "};"], - "description": "Code snippet for union" - }, - "printf": { - "prefix": "printf", - "body": ["printf(\"$1\\n\"$0);"], - "description": "Generic printf() snippet" - }, - "sprintf": { - "prefix": "sprintf", - "body": ["sprintf($1, \"$2\\n\"$0);"], - "description": "Generic sprintf() snippet" - }, - "fprintf": { - "prefix": "fprintf", - "body": ["fprintf(${1:stderr}, \"$2\\n\"$0);"], - "description": "Generic fprintf() snippet" - }, - "scanf": { - "prefix": "scanf", - "body": ["scanf(\"$1\"$0);"], - "description": "Generic scanf() snippet" - }, - "sscanf": { - "prefix": "sscanf", - "body": ["sscanf($1, \"$2\"$0);"], - "description": "Generic sscanf() snippet" - }, - "fscanf": { - "prefix": "fscanf", - "body": ["fscanf($1, \"$2\"$0);"], - "description": "Generic fscanf() snippet" - }, - "#inc": { - "prefix": "#inc", - "body": ["#include \"$0\""], - "description": "Code snippet for #include \" \"" - }, - "#inc<": { - "prefix": "#inc<", - "body": ["#include <$0>"], - "description": "Code snippet for #include < >" - }, - "#def": { - "prefix": "def", - "body": ["#define $0"], - "description": "Code snippet for #define \" \"" - }, - "Main function template": { - "prefix": "main", - "body": [ - "int main (int argc, char *argv[])", - "{", - "\t$0", - "\treturn 0;", - "}" - ], - "description": "A standard main function for a C++ program" - } -} diff --git a/snippets/css.json b/snippets/css.json deleted file mode 100644 index 294af23..0000000 --- a/snippets/css.json +++ /dev/null @@ -1,651 +0,0 @@ -{ - "align-items": { - "prefix": "ai", - "body": "align-items: ${1|flex-start,flex-end,center,baseline,stretch,start,end,self-start,self-end|};", - "description": "initial value: stretch" - }, - "align-items: baseline": { - "prefix": "aib", - "body": "align-items: baseline;" - }, - "align-items: center": { - "prefix": "aic", - "body": "align-items: center;" - }, - "align-items: flex-start": { - "prefix": "aifs", - "body": "align-items: flex-start;" - }, - "align-items: flex-end": { - "prefix": "aife", - "body": "align-items: flex-end;" - }, - "align-items: stretch": { - "prefix": "ais", - "body": "align-items: stretch;" - }, - "align-self": { - "prefix": "as", - "body": "align-items: ${1|flex-start,flex-end,center,baseline,stretch,auto|};", - "description": "initial value: auto" - }, - "animation": { - "prefix": "ani", - "body": "animation: ${1:name} ${2:1s} ${3|linear,ease-in-out,ease,ease-in,ease-out,step-start,step-end,steps,cubic-bezier|};", - "description": "animation: name duration timing-function delay direction count fill-mode play-state" - }, - "animation-delay": { - "prefix": "anide", - "body": "animation-delay: ${0:1s};" - }, - "animation-direction": { - "prefix": "anidi", - "body": "animation-direction: ${1|alternate,alternate-reverse,reverse,normal|};", - "description": "initial value: normal" - }, - "animation-duratuion": { - "prefix": "anidu", - "body": "animation-duration: ${0:1s};" - }, - "animation-fill-mode": { - "prefix": "anifm", - "body": "animation-fill-mode: ${1|forwards,backwards,both,none|};", - "description": "initial value: none" - }, - "animation-iteration-count": { - "prefix": "aniic", - "body": "animation-iteration-count: ${0:infinite};", - "description": "initial value: 1" - }, - "animation-name": { - "prefix": "anin", - "body": "animation-name: ${0:name};" - }, - "animation-play-state": { - "prefix": "anips", - "body": "animation-play-state: ${1|paused,running|};", - "description": "initial value: running" - }, - "animation-timing-function": { - "prefix": "anitf", - "body": "animation-timing-function: ${1|linear,ease,ease-in-out,ease-in,ease-out,step-start,step-end,steps,cubic-bezier|};", - "description": "initial value: ease" - }, - "background": { - "prefix": "bg", - "body": "background: ${0:#fff};", - "description": "background: image position/size repeat attachment box box" - }, - "background-attachment": { - "prefix": "bga", - "body": "background-attachment: ${1|fixed,scroll,local|};", - "description": "initial value: scroll" - }, - "background-color": { - "prefix": "bgc", - "body": "background-color: ${0:#fff};" - }, - "background-clip": { - "prefix": "bgcl", - "body": "background-clip: ${1|border-box,padding-box,content-box,text|};", - "description": "initial value: border-box" - }, - "background-image": { - "prefix": "bgi", - "body": "background-image: url('${0:background.jpg}');" - }, - "background-origin": { - "prefix": "bgo", - "body": "background-origin: ${1|border-box,padding-box,content-box|};", - "description": "initial value: padding-box" - }, - "background-position": { - "prefix": "bgp", - "body": "background-position: ${1:left} ${2:top};" - }, - "background-repeat": { - "prefix": "bgr", - "body": "background-repeat: ${1|no-repeat,repeat-x,repeat-y,repeat,space,round|};", - "description": "initial value: repeat" - }, - "background-repeat: repeat": { - "prefix": "bgrr", - "body": "background-repeat: repeat;" - }, - "background-repeat: repeat-x": { - "prefix": "bgrx", - "body": "background-repeat: repeat-x;" - }, - "background-repeat: repeat-y": { - "prefix": "bgry", - "body": "background-repeat: repeat-y;" - }, - "background-repeat: no-repeat": { - "prefix": "bgrn", - "body": "background-repeat: no-repeat;" - }, - "background-size": { - "prefix": "bgs", - "body": "background-size: ${0:cover};" - }, - "border": { - "prefix": "bor", - "body": "border: ${1:1px} ${2|solid,dashed,dotted,double,groove,ridge,inset,outset,none,hidden|} ${0:#000};" - }, - "border: none": { - "prefix": "born", - "body": "border: none;" - }, - "border-color": { - "prefix": "borc", - "body": "border-color: ${0:#000};" - }, - "border-style": { - "prefix": "bors", - "body": "border-style: ${1|solid,dashed,dotted,double,groove,ridge,inset,outset,none,hidden|};" - }, - "border-width": { - "prefix": "borw", - "body": "border-width: ${0:1px};" - }, - "border-bottom": { - "prefix": "borb", - "body": "border-bottom: ${1:1px} ${2|solid,dashed,dotted,double,groove,ridge,inset,outset,none,hidden|} ${0:#000};" - }, - "border-left": { - "prefix": "borl", - "body": "border-left: ${1:1px} ${2|solid,dashed,dotted,double,groove,ridge,inset,outset,none,hidden|} ${0:#000};" - }, - "border-right": { - "prefix": "borr", - "body": "border-right: ${1:1px} ${2|solid,dashed,dotted,double,groove,ridge,inset,outset,none,hidden|} ${0:#000};" - }, - "border-top": { - "prefix": "bort", - "body": "border-top: ${1:1px} ${2|solid,dashed,dotted,double,groove,ridge,inset,outset,none,hidden|} ${0:#000};" - }, - "border-radius": { - "prefix": "br", - "body": "border-radius: ${0:2px};" - }, - "bottom": { - "prefix": "bot", - "body": "bottom: ${0:0};" - }, - "box-shadow": { - "prefix": "bos", - "body": "box-shadow: ${1:1px} ${2:1px} ${3:1px} ${4:1px} ${0:rgba(0, 0, 0, .5)};", - "description": "box-shadow: x-offset y-offset blur spread color" - }, - "box-sizing": { - "prefix": "boz", - "body": "box-sizing: ${1|border-box,content-box|};", - "description": "initial value: content-box" - }, - "clear": { - "prefix": "clr", - "body": "clear: ${1|both,left,right,none|};" - }, - "color": { - "prefix": "col", - "body": "color: ${0:#000};" - }, - "content": { - "prefix": "con", - "body": "content: '$0';" - }, - "cursor": { - "prefix": "cur", - "body": "cursor: ${1|auto,default,alias,cell,copy,crosshair,context-menu,help,grab,grabbing,move,none,no-drop,not-allowed,pointer,progress,e-resize,all-scroll,text,wait,vertical-text,zoom-in,zoom-out|};", - "description": "initial value: auto" - }, - "cursor: pointer": { - "prefix": "curp", - "body": "cursor: pointer;" - }, - "cursor: default": { - "prefix": "curd", - "body": "cursor: default;" - }, - "display": { - "prefix": "dis", - "body": "display: ${1|none,block,inline,inline-block,flex,inline-flex,list-item,table,inline-table,table-caption,table-cell,table-row,table-row-group,table-column|};" - }, - "display: block": { - "prefix": "disb", - "body": "display: block;" - }, - "display: inline-block": { - "prefix": "disi", - "body": "display: inline-block;" - }, - "display: none": { - "prefix": "disn", - "body": "display: none;" - }, - "display: flex": { - "prefix": "disf", - "body": "display: flex;" - }, - "flex": { - "prefix": "flex", - "body": "flex: ${1:1} ${2:1} ${3:auto};", - "description": "flex: grow shrink basis" - }, - "flex (alt)": { - "prefix": "fle", - "body": "flex: ${1:1} ${2:1} ${3:auto};" - }, - "flex-direction": { - "prefix": "fld", - "body": "flex-direction: ${1|row,row-reverse,column,column-reverse|};", - "description": "initial value: row" - }, - "flex-direction: row": { - "prefix": "fldr", - "body": "flex-direction: row;" - }, - "flex-direction: column": { - "prefix": "fldc", - "body": "flex-direction: column;" - }, - "flex-flow": { - "prefix": "flf", - "body": "flex-flow: ${1|row,row-reverse,column,column-reverse|} ${2|wrap,wrap-reverse,nowrap|};" - }, - "flex-wrap": { - "prefix": "flw", - "body": "flex-wrap: ${1|wrap,wrap-reverse,nowrap|};", - "description": "initial value: nowrap" - }, - "float": { - "prefix": "fl", - "body": "float: ${1|left,right,none|};" - }, - "float: left": { - "prefix": "fll", - "body": "float: left;" - }, - "float: right": { - "prefix": "flr", - "body": "float: right;" - }, - "float: none": { - "prefix": "fln", - "body": "float: none;" - }, - "font-family": { - "prefix": "ff", - "body": "font-family: ${0:arial};" - }, - "font-size": { - "prefix": "fz", - "body": "font-size: ${0:12px};" - }, - "font-style": { - "prefix": "fst", - "body": "font-style: ${1|italic,oblique,normal|};" - }, - "font-style: italic": { - "prefix": "fsti", - "body": "font-style: italic;" - }, - "font-style: normal": { - "prefix": "fstn", - "body": "font-style: normal;" - }, - "font-style: oblique": { - "prefix": "fsto", - "body": "font-style: oblique;" - }, - "font-weight": { - "prefix": "fw", - "body": "font-weight: ${0:bold};" - }, - "font-weight: bold": { - "prefix": "fwb", - "body": "font-weight: bold;" - }, - "font-weight: light": { - "prefix": "fwl", - "body": "font-weight: light;" - }, - "font-weight: normal": { - "prefix": "fwn", - "body": "font-weight: normal;" - }, - "font": { - "prefix": "ft", - "body": "font: ${0:12px/1.5};", - "description": "font: [weight style variant stretch] size/line-height family" - }, - "height": { - "prefix": "hei", - "body": "height: ${0:1px};" - }, - "justify-content": { - "prefix": "jc", - "body": "justify-content: ${1|flex-start,flex-end,center,space-between,space-around|};", - "description": "initial value: flex-start" - }, - "justify-content: flex-start": { - "prefix": "jcfs", - "body": "justify-content: flex-start;" - }, - "justify-content: flex-end": { - "prefix": "jcfe", - "body": "justify-content: flex-end;" - }, - "justify-content: center": { - "prefix": "jcc", - "body": "justify-content: center;" - }, - "justify-content: space-around": { - "prefix": "jcsa", - "body": "justify-content: space-around;" - }, - "justify-content: space-between": { - "prefix": "jcsb", - "body": "justify-content: space-between;" - }, - "list-style": { - "prefix": "lis", - "body": "list-style: ${1|disc,circle,square,decimal,lower-roman,upper-roman,lower-alpha,upper-alpha,none,armenian,cjk-ideographic,georgian,lower-greek,hebrew,hiragana,hiragana-iroha,katakana,katakana-iroha,lower-latin,upper-latin|} ${2|outside,inside|};", - "description": "list-style: type position image" - }, - "list-style-position": { - "prefix": "lisp", - "body": "${1|outside,inside|}", - "description": "initial value: outside" - }, - "list-style-type": { - "prefix": "list", - "body": "list-style-type: ${1|disc,circle,square,decimal,lower-roman,upper-roman,lower-alpha,upper-alpha,none,armenian,cjk-ideographic,georgian,lower-greek,hebrew,hiragana,hiragana-iroha,katakana,katakana-iroha,lower-latin,upper-latin|};", - "description": "initial value: disc" - }, - "list-style-type: circle": { - "prefix": "listc", - "body": "list-style-type: circle;" - }, - "list-style-type: disc": { - "prefix": "listd", - "body": "list-style-type: disc;" - }, - "list-style-type: none": { - "prefix": "listn", - "body": "list-style-type: none;" - }, - "list-style-type: square": { - "prefix": "lists", - "body": "list-style-type: square;" - }, - "list-style-type: lower-roman": { - "prefix": "listlr", - "body": "list-style-type: lower-roman;" - }, - "list-style-type: upper-roman": { - "prefix": "listur", - "body": "list-style-type: upper-roman;" - }, - "left": { - "prefix": "lef", - "body": "left: ${0:0};" - }, - "line-height": { - "prefix": "lh", - "body": "line-height: ${0:1.5};" - }, - "letter-spacing": { - "prefix": "ls", - "body": "letter-spacing: ${0:2px};" - }, - "letter-spacing: normal": { - "prefix": "lsn", - "body": "letter-spacing: normal;" - }, - "margin": { - "prefix": "mar", - "body": "margin: ${0:0};" - }, - "margin-bottom": { - "prefix": "marb", - "body": "margin-bottom: ${0:0};" - }, - "margin-left": { - "prefix": "marl", - "body": "margin-left: ${0:0};" - }, - "margin-right": { - "prefix": "marr", - "body": "margin-right: ${0:0};" - }, - "margin-top": { - "prefix": "mart", - "body": "margin-top: ${0:0};" - }, - "margin: 0 auto": { - "prefix": "mara", - "body": "margin: 0 auto;" - }, - "min-height": { - "prefix": "mih", - "body": "min-height: ${0:1px};" - }, - "min-width": { - "prefix": "miw", - "body": "min-width: ${0:1px};" - }, - "max-height": { - "prefix": "mah", - "body": "max-height: ${0:1px};" - }, - "max-width": { - "prefix": "maw", - "body": "max-width: ${0:1px};" - }, - "opacity": { - "prefix": "opa", - "body": "opacity: ${0:0};" - }, - "overflow": { - "prefix": "ov", - "body": "overflow: ${1|visible,hidden,scroll,auto,clip|};" - }, - "overflow: auto": { - "prefix": "ova", - "body": "overflow: auto;" - }, - "overflow: hidden": { - "prefix": "ovh", - "body": "overflow: hidden;" - }, - "overflow: scroll": { - "prefix": "ovs", - "body": "overflow: scroll;" - }, - "overflow: visible": { - "prefix": "ovv", - "body": "overflow: visible;" - }, - "padding": { - "prefix": "pad", - "body": "padding: ${0:0};" - }, - "padding-bottom": { - "prefix": "padb", - "body": "padding-bottom: ${0:0};" - }, - "padding-left": { - "prefix": "padl", - "body": "padding-left: ${0:0};" - }, - "padding-right": { - "prefix": "padr", - "body": "padding-right: ${0:0};" - }, - "padding-top": { - "prefix": "padt", - "body": "padding-top: ${0:0};" - }, - "position": { - "prefix": "pos", - "body": "position: ${1|relative,absolute,fixed,sticky,static|};" - }, - "position absolute": { - "prefix": "posa", - "body": "position: absolute;" - }, - "position fixed": { - "prefix": "posf", - "body": "position: fixed;" - }, - "position relative": { - "prefix": "posr", - "body": "position: relative;" - }, - "position sticky": { - "prefix": "poss", - "body": "position: sticky;" - }, - "right": { - "prefix": "rig", - "body": "right: ${0:0};" - }, - "text-align": { - "prefix": "ta", - "body": "text-align: ${1|center,left,right,justify,start,end|};" - }, - "text-align: center": { - "prefix": "tac", - "body": "text-align: center;" - }, - "text-align: left": { - "prefix": "tal", - "body": "text-align: left;" - }, - "text-align: right": { - "prefix": "tar", - "body": "text-align: right;" - }, - "text-decoration": { - "prefix": "td", - "body": "text-decoration: ${1|none,underline,overline,line-through|};" - }, - "text-decoration: underline": { - "prefix": "tdu", - "body": "text-decoration: underline;" - }, - "text-decoration: none": { - "prefix": "tdn", - "body": "text-decoration: none;" - }, - "text-decoration: line-through": { - "prefix": "tdl", - "body": "text-decoration: line-through;" - }, - "text-indent": { - "prefix": "ti", - "body": "text-indent: ${0:2em};" - }, - "text-shadow": { - "prefix": "ts", - "body": "text-shadow: ${1:1px} ${2:1px} ${3:1px} ${4:1px} ${0:rgba(0, 0, 0, .5)};", - "description": "text-shadow: x-offset y-offset blur spread color" - }, - "text-transform": { - "prefix": "tt", - "body": "text-transform: ${1|capitalize,uppercase,lowercase,full-width,none|};" - }, - "top": { - "prefix": "top", - "body": "top: ${0:0};" - }, - "vertical-align": { - "prefix": "va", - "body": "vertical-align: ${1|baseline,middle,top,bottom,sub,super,text-top,text-bottom|};" - }, - "vertical-align: bottom": { - "prefix": "vab", - "body": "vertical-align: bottom;" - }, - "vertical-align: middle": { - "prefix": "vam", - "body": "vertical-align: middle;" - }, - "vertical-align: top": { - "prefix": "vat", - "body": "vertical-align: top;" - }, - "visibility": { - "prefix": "vis", - "body": "visibility: ${1|visible,hidden,collapse|};" - }, - "visibility: visible": { - "prefix": "visv", - "body": "visibility: visible;" - }, - "visibility: hidden": { - "prefix": "vish", - "body": "visibility: hidden;" - }, - "word-break": { - "prefix": "wb", - "body": "word-break: ${1|break-all,keep-all,break-word,normal|};" - }, - "width": { - "prefix": "wid", - "body": "width: ${0:0};" - }, - "width: auto": { - "prefix": "wida", - "body": "width: auto;" - }, - "white-space": { - "prefix": "ws", - "body": "white-space: ${1|nowrap,pre,pre-wrap,pre-line,normal|};" - }, - "white-space: nowrap": { - "prefix": "wsn", - "body": "white-space: nowrap;" - }, - "white-space: pre": { - "prefix": "wsp", - "body": "white-space: pre;" - }, - "word-wrap": { - "prefix": "ww", - "body": "word-wrap: ${1|break-word,break-spaces,normal|};" - }, - "z-index": { - "prefix": "zi", - "body": "z-index: ${0:-1};" - }, - "@import": { - "prefix": "imp", - "body": "@import '${0:filename}';" - }, - "@mixin": { - "prefix": "mix", - "body": "@mixin ${1:name} {\n $0\n}" - }, - "@include": { - "prefix": "inc", - "body": "@include ${0:mixin};" - }, - "@keyframes": { - "prefix": "key", - "body": "@keyframes ${1:name} {\n $0\n}" - }, - "@media": { - "prefix": "med", - "body": "@media screen and (${1:max-width: 300px}) {\n $0\n}" - }, - "!important": { - "prefix": "!", - "body": "!important" - }, - "!important (alt)": { - "prefix": "i", - "body": "!important" - } -} diff --git a/snippets/django.json b/snippets/django.json deleted file mode 100644 index 0bb986f..0000000 --- a/snippets/django.json +++ /dev/null @@ -1,1052 +0,0 @@ -{ - "adminview": { - "prefix": "adminview", - "body": [ - "@admin.register(${1})", - "class ${1}Admin(admin.ModelAdmin):", - "\t'''Admin View for ${1}'''", - "", - "\tlist_display = ('${2}',)", - "\tlist_filter = ('${3}',)", - "\tinlines = [", - "\t\t${4}Inline,", - "\t]", - "\traw_id_fields = ('${5}',)", - "\treadonly_fields = ('${6}',)", - "\tsearch_fields = ('${7}',)", - "\tdate_hierarchy = '${8}'", - "\tordering = ('${9}',)" - ], - "description": "Model Admin View", - "scope": "source.python" - }, - "stackedinline": { - "prefix": "stackedinline", - "body": [ - "class ${1}Inline(admin.StackedInline):", - "\t'''Stacked Inline View for ${1}'''", - "", - "\tmodel = ${2:${1}}", - "\tmin_num = ${3:3}", - "\tmax_num = ${4:20}", - "\textra = ${5:1}", - "\traw_id_fields = (${6},)" - ], - "description": "Stacked Inline", - "scope": "source.python" - }, - "tabularinline": { - "prefix": "tabularinline", - "body": [ - "class ${1}Inline(admin.TabularInline):", - "\t'''Tabular Inline View for ${1}'''", - "", - "\tmodel = ${2:${1}}", - "\tmin_num = ${3:3}", - "\tmax_num = ${4:20}", - "\textra = ${5:1}", - "\traw_id_fields = (${6},)" - ], - "description": "Tabular Inline", - "scope": "source.python" - }, - "simplelistfilter": { - "prefix": "simplelistfilter", - "body": [ - "class ${1:NAME}Filter(admin.SimpleListFilter):", - "", - "\ttitle = '$2'", - "\tparameter_name = '$0'", - "", - "\tdef lookups(self, request, model_admin):", - "\t\tpass", - "", - "\tdef queryset(self, request, queryset):", - "\t\treturn queryset" - ], - "description": "Admin SimpleList Filter", - "scope": "source.python" - }, - "iadmin": { - "prefix": "iadmin", - "body": "from django.contrib import admin", - "description": "from ... import admin", - "scope": "source.python" - }, - "iadminsite": { - "prefix": "iadminsite", - "body": "from django.contrib.admin import AdminSite", - "description": "from ... import AdminSite", - "scope": "source.python" - }, - "register": { - "prefix": "register", - "body": "admin.site.register($1)", - "description": "register the model class without providing a ModelAdmin description.", - "scope": "source.python" - }, - "registermadmin": { - "prefix": "registermadmin", - "body": "admin.site.register($1, $1Admin)", - "description": "register the model class providing a ModelAdmin description", - "scope": "source.python" - }, - "fieldsets": { - "prefix": "fieldsets", - "body": [ - "fieldsets = (", - "\t(None, {", - "\t\t'fields': (", - "\t\t\t$1", - "\t\t),", - "\t}),", - ")" - ], - "description": "", - "scope": "source.python" - }, - "Form": { - "prefix": "Form", - "body": [ - "class ${1:FORMNAME}(forms.Form):", - "\t\"\"\"${2:$1 definition}.\"\"\"", - "", - "\t${3:# TODO: Define form fields here}", - "" - ], - "description": "Form", - "scope": "source.python" - }, - "ModelForm": { - "prefix": "ModelForm", - "body": [ - "class ${1:MODELNAME}Form(forms.ModelForm):", - "\t\"\"\"${2:Form definition for $1}.\"\"\"", - "", - "\tclass Meta:", - "\t\t\"\"\"Meta definition for ${1}form.\"\"\"", - "", - "\t\tmodel = $1", - "\t\tfields = ('$3',)", - "" - ], - "description": "ModelForm", - "scope": "source.python" - }, - "fbool": { - "prefix": "fbool", - "body": "${1:FIELDNAME} = forms.BooleanField($2, required=${3:False})", - "description": "BooleanField (fbool)", - "scope": "source.python" - }, - "fchar": { - "prefix": "fchar", - "body": "${1:FIELDNAME} = forms.CharField($2,${3: max_length=$4,} required=${5:False})", - "description": "CharField (fchar)", - "scope": "source.python" - }, - "fchoice": { - "prefix": "fchoice", - "body": "${1:FIELDNAME} = forms.ChoiceField($2, choices=[${3:CHOICES}], required=${4:False})", - "description": "ChoiceField (fchoice)", - "scope": "source.python" - }, - "fcombo": { - "prefix": "fcombo", - "body": "${1:FIELDNAME} = forms.ComboField($2)", - "description": "ComboField (fcombo)", - "scope": "source.python" - }, - "fdate": { - "prefix": "fdate", - "body": "${1:FIELDNAME} = forms.DateField($2, required=${3:False})", - "description": "DateField (fdate)", - "scope": "source.python" - }, - "fdatetime": { - "prefix": "fdatetime", - "body": "${1:FIELDNAME} = forms.DateTimeField($2, required=${3:False})", - "description": "DateTimeField (fdatetime)", - "scope": "source.python" - }, - "fdecimal": { - "prefix": "fdecimal", - "body": "${1:FIELDNAME} = forms.DecimalField($2, required=${3:False})", - "description": "DecimalField (fdecimal)", - "scope": "source.python" - }, - "fduration": { - "prefix": "fduration", - "body": "${1:FIELDNAME} = forms.DurationField($2, required=${3:False})", - "description": "DurationField (fduration)", - "scope": "source.python" - }, - "femail": { - "prefix": "femail", - "body": "${1:FIELDNAME} = forms.EmailField($2, required=${3:False})", - "description": "EmailField (femail)", - "scope": "source.python" - }, - "ffile": { - "prefix": "ffile", - "body": "${1:FIELDNAME} = forms.FileField($2,${3: max_length=$4,} required=${5:False})", - "description": "FileField (ffile)", - "scope": "source.python" - }, - "ffilepath": { - "prefix": "ffilepath", - "body": "${1:FIELDNAME} = forms.FilePathField($2, path=${3:/absolute_path/}, required=${4:False})", - "description": "FilePathField (ffilepath)", - "scope": "source.python" - }, - "ffloat": { - "prefix": "ffloat", - "body": "${1:FIELDNAME} = forms.FloatField($2, required=${3:False})", - "description": "FloatField (ffloat)", - "scope": "source.python" - }, - "fip": { - "prefix": "fip", - "body": "${1:FIELDNAME} = forms.IPAddressField($2)", - "description": "IPAddressField (fip).\n\nThis field has been deprecated since version 1.7 in favor of GenericIPAddressField.\n\n", - "scope": "source.python" - }, - "fgenericip": { - "prefix": "fip", - "body": "${1:FIELDNAME} = forms.GenericIPAddressField($2)", - "description": "IPAddressField (fgenericip)", - "scope": "source.python" - }, - "fimg": { - "prefix": "fimg", - "body": "${1:FIELDNAME} = forms.ImageField($2, required=${3:False})", - "description": "ImageField (fimg)", - "scope": "source.python" - }, - "fint": { - "prefix": "fint", - "body": "${1:FIELDNAME} = forms.IntegerField($2, required=${3:False})", - "description": "IntegerField (fint)", - "scope": "source.python" - }, - "fmochoice": { - "prefix": "fmochoice", - "body": "${1:FIELDNAME} = forms.ModelChoiceField($2)", - "description": "ModelChoiceField (fmochoice)", - "scope": "source.python" - }, - "fmomuchoice": { - "prefix": "fmomuchoice", - "body": "${1:FIELDNAME} = forms.ModelMultipleChoiceField($2)", - "description": "ModelMultipleChoiceField (fmomuchoice)", - "scope": "source.python" - }, - "fmuval": { - "prefix": "fmuval", - "body": "${1:FIELDNAME} = forms.MultiValueField($2)", - "description": "MultiValueField (fmuval)", - "scope": "source.python" - }, - "fmuchoice": { - "prefix": "fmuchoice", - "body": "${1:FIELDNAME} = forms.MultipleChoiceField($2, choices=[${3:CHOICES}], required=${4:False})", - "description": "MultipleChoiceField (fmuchoice)", - "scope": "source.python" - }, - "ftypedmuchoice": { - "prefix": "ftypedmuchoice", - "body": "${1:FIELDNAME} = forms.TypedMultipleChoiceField($2, choices=[${3:CHOICES}], coerce=${4:TYPE}, required=${5:False})", - "description": "TypedMultipleChoiceField (ftypedmuchoice)", - "scope": "source.python" - }, - "fnullbool": { - "prefix": "fnullbool", - "body": "${1:FIELDNAME} = forms.NullBooleanField($2, required=${3:False})", - "description": "NullBooleanField (fnullbool)", - "scope": "source.python" - }, - "fregex": { - "prefix": "fregex", - "body": "${1:FIELDNAME} = forms.RegexField($2, regex=${3:REGEX}, required=${4:False})", - "description": "RegexField (fregex)", - "scope": "source.python" - }, - "fslug": { - "prefix": "fslug", - "body": "${1:FIELDNAME} = forms.SlugField($2, allow_unicode=${3:False}, required=${4:False})", - "description": "SlugField (fslug)", - "scope": "source.python" - }, - "fsdatetime": { - "prefix": "fsdatetime", - "body": "${1:FIELDNAME} = forms.SplitDateTimeField($2)", - "description": "SplitDateTimeField (fsdatetime)", - "scope": "source.python" - }, - "ftime": { - "prefix": "ftime", - "body": "${1:FIELDNAME} = forms.TimeField($2, required=${3:False})", - "description": "TimeField (ftime)", - "scope": "source.python" - }, - "ftchoice": { - "prefix": "ftchoice", - "body": "${1:FIELDNAME} = forms.TypedChoiceField($2, required=${3:False})", - "description": "TypedChoiceField (ftchoice)", - "scope": "source.python" - }, - "ftmuchoice": { - "prefix": "ftmuchoice", - "body": "${1:FIELDNAME} = forms.TypedMultipleChoiceField($2)", - "description": "TypedMultipleChoiceField (ftmuchoice)", - "scope": "source.python" - }, - "furl": { - "prefix": "furl", - "body": "${1:FIELDNAME} = forms.URLField($2, required=${3:False})", - "description": "URLField (furl)", - "scope": "source.python" - }, - "fuuid": { - "prefix": "fuuid", - "body": "${1:FIELDNAME} = forms.UUIDField($2, required=${3:False})", - "description": "UUIDField (fuuid)", - "scope": "source.python" - }, - "fsimplearray": { - "prefix": "fsimplearray", - "body": "${1:FIELDNAME} = SimpleArrayField()", - "description": "SimpleArrayField (fsimplearray).\n\n*PostgreSQL specific form fields*.", - "scope": "source.python" - }, - "fsplitarray": { - "prefix": "fsplitarray", - "body": "${1:FIELDNAME} = SplitArrayField()", - "description": "SplitArrayField (fsplitarray).\n\n*PostgreSQL specific form fields*.", - "scope": "source.python" - }, - "fhstore": { - "prefix": "fhstore", - "body": "${1:FIELDNAME} = HStoreField()", - "description": "HStoreField (fhstore).\n\n*PostgreSQL specific form fields*.", - "scope": "source.python" - }, - "fjson": { - "prefix": "fjson", - "body": "${1:FIELDNAME} = JSONField()", - "description": "JSONField (fjson).\n\n*PostgreSQL specific form fields*.", - "scope": "source.python" - }, - "fintrange": { - "prefix": "fintrange", - "body": "${1:FIELDNAME} = IntegerRangeField()", - "description": "IntegerRangeField (fintrange).\n\n*PostgreSQL specific form fields*.", - "scope": "source.python" - }, - "ffloatrange": { - "prefix": "ffloatrange", - "body": "${1:FIELDNAME} = FloatRangeField()", - "description": "FloatRangeField (ffloatrange).\n\n*PostgreSQL specific form fields*.", - "scope": "source.python" - }, - "fdatetimerange": { - "prefix": "fdatetimerange", - "body": "${1:FIELDNAME} = DateTimeRangeField()", - "description": "DateTimeRangeField (fdatetimerange).\n\n*PostgreSQL specific form fields*.", - "scope": "source.python" - }, - "fdaterange": { - "prefix": "fdaterange", - "body": "${1:FIELDNAME} = DateRangeField()", - "description": "DateRangeField (fdaterange).\n\n*PostgreSQL specific form fields*.", - "scope": "source.python" - }, - "ffi": { - "prefix": "ffi", - "body": "from .forms import $1", - "description": "", - "scope": "source.python" - }, - "iforms": { - "prefix": "iforms", - "body": "from django import forms", - "description": "from ... import forms", - "scope": "source.python" - }, - "ipostgresff": { - "prefix": "ipostgresff", - "body": "from django.contrib.postgres.forms import ${1|SimpleArrayField,SplitArrayField,HStoreField,JSONField,IntegerRangeField,FloatRangeField,DateTimeRangeField,DateRangeField|}", - "description": "PostgreSQL specific forms fields", - "scope": "source.python" - }, - "clean_data": { - "prefix": "clean_data", - "body": [ - "def clean_${1:FIELD}(self):", - "\t${1:FIELD} = self.cleaned_data.get('${1:FIELD}')", - "\n\n\t # TODO Validation\n", - "\treturn ${1:FIELD}" - ], - "description": "", - "scope": "source.python" - }, - "Model_full": { - "prefix": "Model_full", - "body": [ - "class ${1:MODELNAME}(models.Model):", - "\t\"\"\"${2:Model definition for $1}.\"\"\"", - "", - "\t${3:# TODO: Define fields here}", - "", - "\tclass Meta:", - "\t\t\"\"\"Meta definition for $1.\"\"\"", - "", - "\t\tverbose_name = '$1'", - "\t\tverbose_name_plural = '$1s'", - "", - "\tdef ${4|__str__,__unicode__|}(self):", - "\t\t\"\"\"Unicode representation of $1.\"\"\"", - "\t\t${7|pass,return '{}'.format(self. ) # TODO,return f'{self. }' # TODO|}", - "", - "\tdef save(self):", - "\t\t\"\"\"Save method for $1.\"\"\"", - "\t\tpass", - "", - "\tdef get_absolute_url(self):", - "\t\t\"\"\"Return absolute url for $1.\"\"\"", - "\t\treturn ('')", - "", - "\t${6:# TODO: Define custom methods here}", - "" - ], - "description": "Model (full)", - "scope": "source.python" - }, - "Model": { - "prefix": "Model", - "body": [ - "class ${1:MODELNAME}(models.Model):", - "\t\"\"\"${2:Model definition for $1}.\"\"\"", - "", - "\t${3:# TODO: Define fields here}", - "", - "\tclass Meta:", - "\t\t\"\"\"Meta definition for $1.\"\"\"", - "", - "\t\tverbose_name = '$1'", - "\t\tverbose_name_plural = '$1s'", - "", - "\tdef ${4|__str__,__unicode__|}(self):", - "\t\t\"\"\"Unicode representation of $1.\"\"\"", - "\t\t${5|pass,return '{}'.format(self. ) # TODO,return f'{self. }' # TODO|}", - "" - ], - "description": "Model", - "scope": "source.python" - }, - "modelmixin": { - "prefix": "modelmixin", - "body": [ - "class $1Mixin(models.Model):", - "\t${2:# TODO}\r\n", - "\tclass Meta:", - "\t\tabstract = True" - ], - "description": "", - "scope": "source.python" - }, - "queryset": { - "prefix": "qs", - "body": ["class $1QuerySet(models.QuerySet):", "\tpass"], - "description": "", - "scope": "source.python" - }, - "manager": { - "prefix": "mngr", - "body": [ - "class $1Manager(models.Manager):", - "\tdef get_queryset(self):", - "\t\treturn super ($1Manager, self).get_queryset().${2|filter,exclude,order_by,distinct,reverse|}($3)" - ], - "description": "Add extra Manager methods", - "scope": "source.python" - }, - "queryset_from_manager": { - "prefix": "qs_mngr", - "body": [ - "class $1Manager(models.Manager):", - "\tdef get_queryset(self):", - "\t\treturn $1QuerySet(self.model, using=self._db)" - ], - "description": "Modify the initial QuerySet the Manager returns.", - "scope": "source.python" - }, - "mauto": { - "prefix": "mauto", - "body": "${1:FIELDNAME} = models.AutoField($2)", - "description": "AutoField (mauto).\n\nAn IntegerField that automatically increments according to available IDs.\n\n", - "scope": "source.python" - }, - "mbigauto": { - "prefix": "mbigauto", - "body": "${1:FIELDNAME} = models.BigAutoField($2)", - "description": "BigAutoField (mbigauto).\n\n[New in Django 1.10.]\n\nA 64-bit integer, much like an AutoField.\n\n", - "scope": "source.python" - }, - "mbigint": { - "prefix": "mbigint", - "body": "${1:FIELDNAME} = models.BigIntegerField($2)", - "description": "BigIntegerField (mbigint).\n\nA 64-bit integer, much like an IntegerField.\n\n", - "scope": "source.python" - }, - "mbinary": { - "prefix": "mbinary", - "body": "${1:FIELDNAME} = models.BinaryField($2)", - "description": "BinaryField (mbinary).\n\nA field to store raw binary data.\n\n", - "scope": "source.python" - }, - "mbool": { - "prefix": "mbool", - "body": "${1:FIELDNAME} = models.BooleanField($2)", - "description": "BooleanField (mbool).\n\nA true/false field.\n\n", - "scope": "source.python" - }, - "mchar": { - "prefix": "mchar", - "body": "${1:FIELDNAME} = models.CharField($2, max_length=${3:50})", - "description": "CharField (mchar)", - "scope": "source.python" - }, - "mcoseint": { - "prefix": "mcoseint", - "body": "${1:FIELDNAME} = models.CommaSeparatedIntegerField($2)", - "description": "CommaSeparatedIntegerField (mcoseint).\n\nThis field is deprecated since 1.9 in favor of CharField with validators.\n\n", - "scope": "source.python" - }, - "mdate": { - "prefix": "mdate", - "body": "${1:FIELDNAME} = models.DateField($2, auto_now=${3:False}, auto_now_add=${4:False})", - "description": "DateField (mdate).\n\nA date, represented in Python by a datetime.date instance.\n\n", - "scope": "source.python" - }, - "mdatetime": { - "prefix": "mdatetime", - "body": "${1:FIELDNAME} = models.DateTimeField($2, auto_now=${3:False}, auto_now_add=${4:False})", - "description": "DateTimeField (mdatetime).\n\nA date, represented in Python by a datetime.datetime instance.\n\n", - "scope": "source.python" - }, - "mdecimal": { - "prefix": "mdecimal", - "body": "${1:FIELDNAME} = models.DecimalField($2, max_digits=${3:5}, decimal_places=${4:2})", - "description": "DecimalField (mdecimal).\n\nA fixed-precision decimal number, represented in Python by a Decimal instance.\n\n", - "scope": "source.python" - }, - "mduration": { - "prefix": "mduration", - "body": "${1:FIELDNAME} = models.DurationField($2)", - "description": "DurationField (mduration).\n\nA field for storing periods of time - modeled in Python by timedelta.\n\n", - "scope": "source.python" - }, - "memail": { - "prefix": "memail", - "body": "${1:FIELDNAME} = models.EmailField($2, max_length=${3:254})", - "description": "EmailField (memail).\n\nA CharField that checks that the value is a valid email address.\n\n", - "scope": "source.python" - }, - "mfile": { - "prefix": "mfile", - "body": "${1:FIELDNAME} = models.FileField($2, upload_to=${3:None}, max_length=${4:100})", - "description": "FileField (mfile).\n\nA file-upload field.\n\n", - "scope": "source.python" - }, - "mfilepath": { - "prefix": "mfilepath", - "body": "${1:FIELDNAME} = models.FilePathField($2, path=${3:None}, match=${4:None}, recursive=${5:recursive}, max_length=${6:100})", - "description": "FilePathField (mfilepath).\n\nA CharField whose choices are limited to the filenames in a certain directory on the filesystem.\n\n", - "scope": "source.python" - }, - "mfloat": { - "prefix": "mfloat", - "body": "${1:FIELDNAME} = models.FloatField($2)", - "description": "FloatField (mfloat).\n\nA floating-point number represented in Python by a float instance.\n\n", - "scope": "source.python" - }, - "fk": { - "prefix": "fk", - "body": "${1:FIELDNAME} = models.ForeignKey(${2:OTHERMODEL}, on_delete=models.${3|CASCADE,PROTECT,SET_NULL,SET_DEFAULT,SET(),DO_NOTHING|})", - "description": "ForeignKey (fk).\n\nA many-to-one relationship.\n\non_delete will become a required argument in Django 2.0. In older versions it defaults to CASCADE.\n\n", - "scope": "source.python" - }, - "mip": { - "prefix": "mip", - "body": "${1:FIELDNAME} = models.IPAddressField($2)", - "description": "IPAddressField (mip).\n\nThis field has been deprecated since version 1.7 in favor of GenericIPAddressField.\n\n", - "scope": "source.python" - }, - "mimg": { - "prefix": "mimg", - "body": "${1:FIELDNAME} = models.ImageField($2, upload_to=${3:None}, height_field=${4:None}, width_field=${5:None}, max_length=${5:100})", - "description": "ImageField (mimg).\n\nInherits all attributes and methods from FileField, but also validates that the uploaded object is a valid image.\n\n", - "scope": "source.python" - }, - "mint": { - "prefix": "mint", - "body": "${1:FIELDNAME} = models.IntegerField($2)", - "description": "IntegerField (mint).\n\nAn integer. Values from -2147483648 to 2147483647 are safe in all databases supported by Django.\n\n", - "scope": "source.python" - }, - "mgenericip": { - "prefix": "mgenericip", - "body": "${1:FIELDNAME} = models.GenericIPAddressField($2, protocol=${3:'both'}, unpack_ipv4=${4:False})", - "description": "GenericIPAddressField (mimg).\n\nAn IPv4 or IPv6 address, in string format.\n\n", - "scope": "source.python" - }, - "m2m": { - "prefix": "m2m", - "body": "${1:FIELDNAME} = models.ManyToManyField(${2:OTHERMODEL})", - "description": "ManyToManyField (m2m).\n\nA many-to-many relationship.\n\n", - "scope": "source.python" - }, - "mnullbool": { - "prefix": "mnullbool", - "body": "${1:FIELDNAME} = models.NullBooleanField($2)", - "description": "NullBooleanField (mnullbool).\n\nLike a BooleanField, but allows NULL as one of the options.\n\n", - "scope": "source.python" - }, - "o2o": { - "prefix": "o2o", - "body": "${1:FIELDNAME} = models.OneToOneField(${2:OTHERMODEL}, on_delete=models.${3|CASCADE,PROTECT,SET_NULL,SET_DEFAULT,SET(),DO_NOTHING|})", - "description": "OneToOneField (o2o).\n\nA one-to-one relationship.\n\non_delete will become a required argument in Django 2.0. In older versions it defaults to CASCADE.\n\n", - "scope": "source.python" - }, - "mphone": { - "prefix": "mphone", - "body": "${1:FIELDNAME} = models.PhoneNumberField($2)", - "description": "PhoneNumberField (mphone).\n\n*external package: django-phonenumber-field*\n\n", - "scope": "source.python" - }, - "mposint": { - "prefix": "mposint", - "body": "${1:FIELDNAME} = models.PositiveIntegerField($2)", - "description": "PositiveIntegerField (mposint).\n\nLike an IntegerField, but must be either positive or zero (0).\n\n", - "scope": "source.python" - }, - "mpossmallint": { - "prefix": "mpossmallint", - "body": "${1:FIELDNAME} = models.PositiveSmallIntegerField($2)", - "description": "PositiveSmallIntegerField (mpossmallint).\n\nLike a PositiveIntegerField, but only allows values under a certain (database-dependent) point.\n\n", - "scope": "source.python" - }, - "mslug": { - "prefix": "mslug", - "body": "${1:FIELDNAME} = models.SlugField($2)", - "description": "SlugField (mslug).\n\nA slug is a short label for something, containing only letters, numbers, underscores or hyphens. They’re generally used in URLs.\n\n", - "scope": "source.python" - }, - "msmallint": { - "prefix": "msmallint", - "body": "${1:FIELDNAME} = models.SmallIntegerField($2)", - "description": "SmallIntegerField (msmallint).\n\nLike an IntegerField, but only allows values under a certain (database-dependent) point.\n\n", - "scope": "source.python" - }, - "mtext": { - "prefix": "mtext", - "body": "${1:FIELDNAME} = models.TextField($2)", - "description": "TextField (mtext).\n\nA large text field.\n\n", - "scope": "source.python" - }, - "mtime": { - "prefix": "mtime", - "body": "${1:FIELDNAME} = models.TimeField($2, auto_now=${4:False}, auto_now_add=${5:False})", - "description": "TimeField (mtime).\n\nA time, represented in Python by a datetime.time instance.\n\n", - "scope": "source.python" - }, - "murl": { - "prefix": "murl", - "body": "${1:FIELDNAME} = models.URLField($2, max_length=${3:200})", - "description": "URLField (murl).\n\nA CharField for a URL.\n\n", - "scope": "source.python" - }, - "musstate": { - "prefix": "musstate", - "body": "${1:FIELDNAME} = models.USStateField($2)", - "description": "USStateField (musstate).\n\n*external package: django-localflavor*\n\n", - "scope": "source.python" - }, - "muuid": { - "prefix": "muuid", - "body": "${1:FIELDNAME} = models.UUIDField($2)", - "description": "UUIDField (muuid).\n\nA field for storing universally unique identifiers. Uses Python’s UUID class.\n\n", - "scope": "source.python" - }, - "mxml": { - "prefix": "mxml", - "body": "${1:FIELDNAME} = models.XMLField($2)", - "description": "XMLField (mxml).\n\n*All uses of XMLField can be replaced with TextField. This field has been deprecated since version 1.3*\n\n", - "scope": "source.python" - }, - "mstore": { - "prefix": "mstore", - "body": "${1:FIELDNAME} = HStoreField()", - "description": "HStoreField (mstore).\n\n*PostgreSQL specific model fields*.\n\nA field for storing key-value pairs. The Python data type used is a dict.\n\n", - "scope": "source.python" - }, - "mjson": { - "prefix": "mjson", - "body": "${1:FIELDNAME} = JSONField()", - "description": "JSONField (mjson).\n\n*PostgreSQL specific model fields*.\n\n[New in Django 1.11.]\n\nA field for storing JSON encoded data.\n\n", - "scope": "source.python" - }, - "marray": { - "prefix": "marray", - "body": "${1:FIELDNAME} = ArrayField()", - "description": "ArrayField (marray).\n\n*PostgreSQL specific model fields*.\n\nA field for storing lists of data\n\n", - "scope": "source.python" - }, - "fmai": { - "prefix": "fmai", - "body": "from .managers import $1QuerySet", - "description": "", - "scope": "source.python" - }, - "fmi": { - "prefix": "fmi", - "body": "from .models import $1", - "description": "", - "scope": "source.python" - }, - "imodels": { - "prefix": "imodels", - "body": "from django.db import models", - "description": "from ... import models", - "scope": "source.python" - }, - "ipy2_unicode_compatible": { - "prefix": "iuc", - "body": "from django.utils.encoding import python_2_unicode_compatible", - "description": "For forwards compatibility, this decorator is available as of Django 1.4.2.", - "scope": "source.python" - }, - "ipostgresmf": { - "prefix": "ipostgresmf", - "body": "from django.contrib.postgres.fields import ${1|ArrayField,JSONField,HStoreField|}", - "description": "PostgreSQL specific model fields", - "scope": "source.python" - }, - "isignals": { - "prefix": "isignals", - "body": "from django.db.models.signals import ${1|pre_init,post_init,pre_save,post_save,pre_delete,post_delete,m2m_changed,class_prepared,Management signals,pre_migrate,post_migrate|}", - "description": "Signals for Django Model", - "scope": "source.python" - }, - "__str__": { - "prefix": "str", - "body": ["def __str__(self):", "\treturn self${1: # TODO}"], - "description": "", - "scope": "source.python" - }, - "get_absolute_url": { - "prefix": "get_absolute_url", - "body": [ - "def get_absolute_url(self):", - "\tfrom django.core.urlresolvers import reverse", - "\treturn reverse('$1', kwargs={'pk': self.pk})" - ], - "description": "", - "scope": "source.python" - }, - "receiver": { - "prefix": "receiver", - "body": [ - "def ${1:FUNCTIONNAME}_${2|pre_init,post_init,pre_save,post_save,pre_delete,post_delete,m2m_changed,class_prepared,Management signals,pre_migrate,post_migrate|}_receiver(sender, instance, *args, **kwargs):", - "\tpass", - "\n\n${2|pre_init,post_init,pre_save,post_save,pre_delete,post_delete,m2m_changed,class_prepared,Management signals,pre_migrate,post_migrate|}.connect(${1:name}_${2|pre_init,post_init,pre_save,post_save,pre_delete,post_delete,m2m_changed,class_prepared,Management signals,pre_migrate,post_migrate|}_receiver, sender=${3:MODELNAME})" - ], - "description": "", - "scope": "source.python" - }, - "__init__": { - "prefix": "__init__", - "body": "\r\ndef __init__(self, *args, **kwargs):\r\n super(${1:CLASS_NAME}, self).__init__(*args, **kwargs)\r\n", - "description": "", - "scope": "source.python" - }, - "ipdb": { - "prefix": "ipdb", - "body": "import ipdb; ipdb.set_trace()", - "description": "ipdb debug tool", - "scope": "source.python" - }, - "npdb": { - "prefix": "npdb", - "body": "from nose.tools import set_trace; set_trace()", - "description": "nose pdb debug tool", - "scope": "source.python" - }, - "pdb": { - "prefix": "pdb", - "body": "import pdb; pdb.set_trace()", - "description": "pdb debug tool", - "scope": "source.python" - }, - "traceback": { - "prefix": "traceback", - "body": "import traceback; traceback.print_exc();", - "description": "traceback print exception", - "scope": "source.python" - }, - "utfc": { - "prefix": "utfc", - "body": "# -*- coding: utf-8 -*-", - "description": "coding: utf-8", - "scope": "source.python" - }, - "iunicode_literals": { - "prefix": "iul", - "body": "from __future__ import unicode_literals", - "description": "In order to enable the same behavior in Python 2, every module must import: \n", - "scope": "source.python" - }, - "ilib": { - "prefix": "ilib", - "body": ["from django import template", "register = template.Library()"], - "description": "", - "scope": "source.python" - }, - "li18n": { - "prefix": "li18n", - "body": "{% load i18n %}", - "description": "", - "scope": "text.html.django" - }, - "lstatic": { - "prefix": "lstatic", - "body": "{% load staticfiles %}", - "description": "", - "scope": "text.html.django" - }, - "ltags": { - "prefix": "ltags", - "body": "{% load $SELECTION$1_tags %}", - "description": "", - "scope": "text.html.django" - }, - "register_assignment_tag": { - "prefix": "register_assignment_tag", - "body": [ - "def get_$1(context):", - "\trequest = context.get('request')", - "\t$1 = ${2:[]}", - "\treturn ${3:$1}" - ], - "description": "", - "scope": "source.python" - }, - "register_filter": { - "prefix": "register_filter", - "body": ["@register.filter", "def $1(value):", "\treturn value$2"], - "description": "", - "scope": "source.python" - }, - "register_inclusion_tag": { - "prefix": "register_inclusion_tag", - "body": [ - "@register.inclusion_tag(${2:'$1.html'}, takes_context=True)", - "def $1(context):", - "\trequest = context.get('request')", - "\t$3", - "\treturn {", - "\t\t'request': request,", - "\t\t$4", - "\t}" - ], - "description": "", - "scope": "source.python" - }, - "register_simple_tag": { - "prefix": "register_simple_tag", - "body": [ - "@register.simple_tag(takes_context=True)", - "def $1(context):", - "\trequest = context.get('request')", - "\treturn ${2:'It Works!'}" - ], - "description": "", - "scope": "source.python" - }, - "urlresolvers": { - "prefix": "iurlresolvers", - "body": "from django.core.urlresolvers import ${1|reverse,reverse_lazy,resolve,get_script_prefix|}", - "description": "*Deprecated since version 1.10*\n\nUtility functions.\n\n", - "scope": "source.python" - }, - "urls (≥1.10 & ≤1.11)": { - "prefix": "iurls", - "body": "from django.urls import ${1|reverse,reverse_lazy,resolve,get_script_prefix|}", - "description": "Utility functions for use in URLconfs.", - "scope": "source.python" - }, - "conf.urls (≤1.11)": { - "prefix": "iconf_urls", - "body": "from django.conf.urls import ${1|static,url,include,handler400,handler403,handler404,handler500|}", - "description": "Utility functions for use in URLconfs.", - "scope": "source.python" - }, - "urls (≥2.0)": { - "prefix": "iurls", - "body": "from django.urls import ${1|path,re_path,include,reverse,reverse_lazy,register_converter|}", - "description": "Utility functions for use in URLconfs.", - "scope": "source.python" - }, - "conf.urls (≥2.0)": { - "prefix": "iconf_urls", - "body": "from django.conf.urls import ${1|static,url,handler400,handler403,handler404,handler500|}", - "description": "Utilityfunctions for use in URLconfs.", - "scope": "source.python" - }, - "url_stack": { - "prefix": "url_stack", - "body": [ - "${1|url,re_path|}(", - "\tr'^${2:REGEX}/$',", - "\t${3:VIEW}${4:.as_view()},", - "\tname='$5'", - ")," - ], - "description": "url(regex, view, kwargs=None, name=None)\n\n*url is an alias to re_path*\n\n", - "scope": "source.python" - }, - "url_inline": { - "prefix": "url_inline", - "body": [ - "${1|url,re_path|}(r'^${2:REGEX}/$', ${3:VIEW}${4:.as_view()}, name='$5')," - ], - "description": "url(regex, view, kwargs=None, name=None)\n\n*url is an alias to re_path*\n\n", - "scope": "source.python" - }, - "path_stack": { - "prefix": "path_stack", - "body": [ - "path(", - "\t'${1:ROUTE}/',", - "\t${2:VIEW}${3:.as_view()},", - "\tname='$4'", - ")," - ], - "description": "path(route, view, kwargs=None, name=None)", - "scope": "source.python" - }, - "path_inline": { - "prefix": "path_inline", - "body": ["path('${1:ROUTE}/', ${2:VIEW}${3:.as_view()}, name='$4'),"], - "description": "path(route, view, kwargs=None, name=None)", - "scope": "source.python" - }, - "urlpatterns": { - "prefix": "urlpatterns", - "body": ["urlpatterns = [", "\t$0", "]"], - "description": "", - "scope": "source.python" - }, - "repk": { - "prefix": "repk", - "body": "r'^(?P<${1:pk}>d+)/$'", - "description": "PK URL regex", - "scope": "source.python" - }, - "reslug": { - "prefix": "reslug", - "body": "r'^(?P<${1:slug}>[-w]+)/$'", - "description": "Slug URL regex", - "scope": "source.python" - }, - "reusername": { - "prefix": "reusername", - "body": "r'^(?P[w.@+-]+)/$'", - "description": "Username regex", - "scope": "source.python" - }, - "createview": { - "prefix": "createview", - "body": "\r\nclass ${1:MODEL_NAME}CreateView(CreateView):\r\n model = ${1:MODEL_NAME}\r\n template_name = \"${2:TEMPLATE_NAME}\"\r\n", - "description": "", - "scope": "source.python" - }, - "deleteview": { - "prefix": "deleteview", - "body": "\r\nclass ${1:MODEL_NAME}DeleteView(DeleteView):\r\n model = ${1:MODEL_NAME}\r\n template_name = \"${2:TEMPLATE_NAME}\"\r\n", - "description": "", - "scope": "source.python" - }, - "detailview": { - "prefix": "detailview", - "body": "\r\nclass ${1:MODEL_NAME}DetailView(DetailView):\r\n model = ${1:MODEL_NAME}\r\n template_name = \"${2:TEMPLATE_NAME}\"\r\n", - "description": "", - "scope": "source.python" - }, - "listview": { - "prefix": "listview", - "body": "\r\nclass ${1:MODEL_NAME}ListView(ListView):\r\n model = ${1:MODEL_NAME}\r\n template_name = \"${2:TEMPLATE_NAME}\"\r\n", - "description": "", - "scope": "source.python" - }, - "templateview": { - "prefix": "templateview", - "body": "\r\nclass ${1:CLASS_NAME}(TemplateView):\r\n template_name = \"${2:TEMPLATE_NAME}\"\r\n", - "description": "", - "scope": "source.python" - }, - "updateview": { - "prefix": "updateview", - "body": "\r\nclass ${1:MODEL_NAME}UpdateView(UpdateView):\r\n model = ${1:MODEL_NAME}\r\n template_name = \"${2:TEMPLATE_NAME}\"\r\n", - "description": "", - "scope": "source.python" - }, - "from views import": { - "prefix": "fvi", - "body": "from . import $1", - "description": "", - "scope": "source.python" - }, - "igenericviews": { - "prefix": "igenericviews", - "body": "from django.views.generic import ${1|CreateView,DetailView,FormView,ListView,TemplateView,UpdateView|}", - "description": "Generic class-based views", - "scope": "source.python" - }, - "isettings": { - "prefix": "isettings", - "body": "from django.conf import settings", - "description": "from django.conf import settings", - "scope": "source.python" - }, - "view": { - "prefix": "view", - "body": "def ${1:VIEWNAME}(request):", - "description": "View", - "scope": "source.python" - }, - "dispatch": { - "prefix": "dispatch", - "body": "\r\ndef dispatch(self, request, *args, **kwargs):\r\n return super(${1:CLASS_NAME}, self).dispatch(request, *args, **kwargs)\r\n", - "description": "", - "scope": "source.python" - }, - "context": { - "prefix": "get_context_data", - "body": "\r\ndef get_context_data(self, **kwargs):\r\n context = super(${1:CLASS_NAME}, self).get_context_data(**kwargs)\r\n return context\r\n", - "description": "", - "scope": "source.python" - }, - "get_queryset": { - "prefix": "get_queryset", - "body": [ - "def get_queryset(self):", - "\tqueryset = super(${1:CLASS_NAME}, self).get_queryset()", - "\tqueryset = queryset${3: # TODO}", - "\treturn queryset" - ], - "description": "", - "scope": "source.python" - } -} diff --git a/snippets/frameworks/django/filetemplates.json b/snippets/frameworks/django/filetemplates.json deleted file mode 100644 index c6561f3..0000000 --- a/snippets/frameworks/django/filetemplates.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "Django URLFile Template":{ - "prefix": "fturl", - "body": [ - "from django.urls import path", - "from . import views as v", - "\n\napp_name = ${1:AppName}", - "urlpatterns = [", - "\t# TODO: Define $1 URLs here", - "\t${0}", - "]" - ], - "description": "Django File-Template Sinppet For ``URL`` File" - }, - "Django FormFile Template":{ - "prefix": "ftform", - "body": [ - "from django import forms", - "from ${1:.models} import ${2}", - "\n\n# TODO: Create your forms here", - "${0}" - ], - "description": "Django File-Template Sinppet For ``Form`` File" - }, - "Django CustomTagsFile Template":{ - "prefix": "ftcutomtags", - "body": [ - "from django import template", - "\nregister = template.Library()", - "\n# TODO: Create your custom tags here", - "${0}" - ], - "description": "Django File-Template Sinppet For ``CustomTags`` File" - } -} diff --git a/snippets/frameworks/django/forms.json b/snippets/frameworks/django/forms.json deleted file mode 100644 index 5b2c319..0000000 --- a/snippets/frameworks/django/forms.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "Django Simple Form ":{ - "prefix": "sform", - "body": [ - "class ${1:Name}Form(forms.Form):", - "\t# Define $1Form fields here", - "\t${0}" - ], - "description": "Django Simple Form" - }, - "Django Model Form ":{ - "prefix": "modelform", - "body": [ - "class ${1:ModelName}Form(forms.ModelForm):", - "\tclass Meta:", - "\t\tmodel = ${2:$1}", - "\t\tfields = (${3:\"__all__\"})", - "\t\t${0}" - ], - "description": "Django Model Form" - }, - "Forms BooleanField":{ - "prefix": "fbool", - "body": "${1:FIELDNAME} = forms.BooleanField(${2})", - "description": "Django forms ``BooleanField``" - }, - "Forms CharField":{ - "prefix": "fchar", - "body": "${1:FIELDNAME} = forms.CharField(${2})", - "description": "Django forms ``CharField``" - }, - "Forms ComboField":{ - "prefix": "fcombo", - "body": "${1:FIELDNAME} = forms.ComboField(${2})", - "description": "Django forms ``ComboField``" - }, - "Forms DateField":{ - "prefix": "fdate", - "body": "${1:FIELDNAME} = forms.DateField(${2})", - "description": "Django forms ``DateField``" - }, - "Forms DateTime":{ - "prefix": "fdatetime", - "body": "${1:FIELDNAME} = forms.DateTime(${2})", - "description": "Django forms ``DateTime``" - }, - "Forms DecimalField":{ - "prefix": "fdecimal", - "body": "${1:FIELDNAME} = forms.DecimalField(${2})", - "description": "Django forms ``DecimalField``" - }, - "Forms DurationField":{ - "prefix": "fduration", - "body": "${1:FIELDNAME} = forms.DurationField(${2})", - "description": "Django forms ``DurationField``" - }, - "Forms EmailField":{ - "prefix": "femail", - "body": "${1:FIELDNAME} = forms.EmailField(${2})", - "description": "Django forms ``EmailField``" - }, - "Forms FileField":{ - "prefix": "ffile", - "body": "${1:FIELDNAME} = forms.FileField(${2})", - "description": "Django forms ``FileField``" - }, - "Forms FilePathField":{ - "prefix": "ffilepath", - "body": "${1:FIELDNAME} = forms.FilePathField(${2})", - "description": "Django forms ``FilePathField``" - }, - "Forms FloatField":{ - "prefix": "ffloat", - "body": "${1:FIELDNAME} = forms.FloatField(${2})", - "description": "Django forms ``FloatField``" - }, - "Forms GenericIPAddressField":{ - "prefix": "fgip", - "body": "${1:FIELDNAME} = forms.GenericIPAddressField(${2})", - "description": "Django forms ``GenericIPAddressField``" - }, - "Forms GenericIPAddressField":{ - "prefix": "fgip", - "body": "${1:FIELDNAME} = forms.GenericIPAddressField(${2})", - "description": "Django forms ``GenericIPAddressField``" - }, - "Forms ImageField":{ - "prefix": "fimg", - "body": "${1:FIELDNAME} = forms.ImageField(${2})", - "description": "Django forms ``ImageField``" - }, - "Forms IntegerField":{ - "prefix": "fint", - "body": "${1:FIELDNAME} = forms.IntegerField(${2})", - "description": "Django forms ``IntegerField``" - }, - "Forms IPAddressField":{ - "prefix": "fip", - "body": "${1:FIELDNAME} = forms.IPAddressField(${2})", - "description": "Django forms ``IPAddressField``" - }, - "Forms ModelChoiceField":{ - "prefix": "fmochoice", - "body": "${1:FIELDNAME} = forms.ModelChoiceField(${2})", - "description": "Django forms ``ModelChoiceField``" - }, - "Forms ModelMultipleChoiceField":{ - "prefix": "fmomuchoice", - "body": "${1:FIELDNAME} = forms.ModelMultipleChoiceField(${2})", - "description": "Django forms ``ModelMultipleChoiceField``" - }, - "Forms MultipleChoiceField":{ - "prefix": "fmuchoice", - "body": "${1:FIELDNAME} = forms.MultipleChoiceField(${2})", - "description": "Django forms ``MultipleChoiceField``" - }, - "Forms MultipleValueField":{ - "prefix": "fmuvalue", - "body": "${1:FIELDNAME} = forms.MultipleValueField(${2})", - "description": "Django forms ``MultipleValueField``" - }, - "Forms NullBooleanField":{ - "prefix": "fnullbool", - "body": "${1:FIELDNAME} = forms.NullBooleanField(${2})", - "description": "Django forms ``NullBooleanField``" - }, - "Forms RegexField":{ - "prefix": "fregex", - "body": "${1:FIELDNAME} = forms.RegexField(${2})", - "description": "Django forms ``RegexField``" - }, - "Forms SlugField":{ - "prefix": "fslug", - "body": "${1:FIELDNAME} = forms.SlugField(${2})", - "description": "Django forms ``SlugField``" - }, - "Forms SplitDateTime":{ - "prefix": "fsdatetime", - "body": "${1:FIELDNAME} = forms.SplitDateTime(${2})", - "description": "Django forms ``SplitDateTime`` Field" - }, - "Forms TimeField":{ - "prefix": "ftime", - "body": "${1:FIELDNAME} = forms.TimeField(${2})", - "description": "Django forms ``TimeField``" - }, - "Forms TypedChoiceField":{ - "prefix": "ftchoice", - "body": "${1:FIELDNAME} = forms.TypedChoiceField(${2})", - "description": "Django forms ``TypedChoiceField``" - }, - "Forms TypedMultipleChoiceField":{ - "prefix": "ftmuchoice", - "body": "${1:FIELDNAME} = forms.TypedMultipleChoiceField(${2})", - "description": "Django forms ``TypedMultipleChoiceField``" - }, - "Forms URLField":{ - "prefix": "fulr", - "body": "${1:FIELDNAME} = forms.URLField(${2})", - "description": "Django forms ``URLField``" - }, - "Forms UUIDField":{ - "prefix": "fuuid", - "body": "${1:FIELDNAME} = forms.UUIDField(${2})", - "description": "Django forms ``UUIDField``" - } - -} diff --git a/snippets/frameworks/django/imports.json b/snippets/frameworks/django/imports.json deleted file mode 100644 index d099fb9..0000000 --- a/snippets/frameworks/django/imports.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "Import forms":{ - "prefix": "di-forms", - "body": "from django import forms", - "description": "Import Django ``forms``" - }, - "Import models":{ - "prefix": "di-model", - "body": "from django import models", - "description": "Import Django ``models``" - }, - "Import get_user_model":{ - "prefix": "di-getusermodel", - "body": "from django.contrib.auth import get_user_model", - "description": "Import Django ``get_user_model``" - }, - "Import generic views":{ - "prefix": "di-generic", - "body": "from django.views import generic", - "description": "Import Django ``generic``" - }, - "Import JsonResponse":{ - "prefix": "di-jsonresponse", - "body": "from django.http import JsonResponse", - "description": "Import Django ``JsonResponse``" - }, - "Import reverse":{ - "prefix": "di-reverse", - "body": "from django.urls import reverse", - "description": "Import Django ``reverse``" - }, - "Import reverse_lazy":{ - "prefix": "di-reverse_lazy", - "body": "from django.urls import revers_lazy", - "description": "Import Django ``revers_lazy``" - }, - - "Import messages":{ - "prefix": "di-messages", - "body": "from django.contrib import messages", - "description": "Import Django ``messages``" - } -} diff --git a/snippets/frameworks/django/models.json b/snippets/frameworks/django/models.json deleted file mode 100644 index c0b656c..0000000 --- a/snippets/frameworks/django/models.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "Django Simple Model": { - "prefix": "smodel", - "body": [ - "class ${1:ModelName}(models.Model):", - "\t# Define $1 fields here", - "\t${2}", - "\n\tclass Meta:", - "\t\tordering = [\"${3:-pk}\"]", - "\t\tverbose_name = \"${4:$1}\"", - "\t\tverbose_name_plural = \"${5:$1s}\"", - "\n\tdef __str__(self):", - "\t\treturn ${6:super().__str__()}", - "\n\t# Define $1 properties here", - "\t${0}" - ], - "description": "Django Simple Model with properties and attributes" - }, - "Django Full Model": { - "prefix": "model", - "body": [ - "class ${1:ModelName}(models.Model):", - "\t# Define $1 fields here", - "\t${2}", - "\n\tclass Meta:", - "\t\tordering = [\"${3:-pk}\"]", - "\t\tverbose_name = \"${4:$1}\"", - "\t\tverbose_name_plural = \"${5:$1s}\"", - "\n\tdef __str__(self):", - "\t\treturn ${6:super().__str__()}", - "\n\tdef save(self, *args, **kwargs):", - "\t\treturn ${7:super().save(*args, **kwargs)}", - "\n\tdef get_absolute_url(self):", - "\t\treturn reverse('${8:view_or_url_name}', kwargs={${9:'pk'}: ${10: self.pk}})", - "\n\t# Define $1 properties here", - "\t${0}" - ], - "description": "Django Full Model with properties and attributes" - }, - - "Models AutoField":{ - "prefix": "mauto", - "body": "${1:FIELDNAME} = models.AutoField(${2})", - "description": "Django model ``AutoField``" - }, - "Models BigIntegerField":{ - "prefix": "mbigint", - "body": "${1:FIELDNAME} = models.AutoField(${2})", - "description": "Django model ``AutoField``" - }, - "Models BinaryField":{ - "prefix": "mbinary", - "body": "${1:FIELDNAME} = models.BinaryField(${2})", - "description": "Django model ``BinaryField``" - }, - "Models Boolean":{ - "prefix": "mbool", - "body": "${1:FIELDNAME} = models.BooleanField(default=${2:False})", - "description": "Django model ``BooleanField``" - }, - "Models CharField":{ - "prefix": "mchar", - "body": "${1:FieldName} = models.CharField(max_length=${2:32})", - "description": "Django model ``CharField``" - }, - "Models CommaSeparatedIntegerField":{ - "prefix": "mcomma", - "body": "${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=${2})", - "description": "Django model ``CommaSeparatedIntegerField``" - }, - "Models DateField":{ - "prefix": "mdate", - "body": "${1:FIELDNAME} = models.DateField(auto_now_add=${2:True}, auto_now=${3:False}})", - "description": "Django model ``DateField``" - }, - "Models DateTimeField":{ - "prefix": "mdatetime", - "body": "${1:FIELDNAME} = models.DateTimeField(auto_now_add=${2:True}, auto_now=${3:False})", - "description": "Django model ``DateTimeField``" - }, - "Models DecimalField":{ - "prefix": "mdecimal", - "body": "${1:FIELDNAME} = models.DecimalField(max_digits=${2}, decimal_places=${3})", - "description": "Django model ``DecimalField``" - }, - "Models EmailField":{ - "prefix": "memail", - "body": "${1:FIELDNAME} = models.EmailField(${2})", - "description": "Django model ``EmailField``" - }, - "Models FileField":{ - "prefix": "mfile", - "body": "${1:FIELDNAME} = models.FileField(upload_to=${2:path/for/upload})", - "description": "Django model ``FileField``" - }, - "Models FilePathField":{ - "prefix": "mfilepath", - "body": "${1:FIELDNAME} = models.FilePathField(path=${2:\"/abs/path/to/dir\"}${3:, max_length=100}${4:, match=\"*.ext\"}${4:, recursive=True})", - "description": "Django model ``FilePathField``" - }, - "Models FloatField":{ - "prefix": "mfloat", - "body": "${1:FIELDNAME} = models.FloatField(${2})", - "description": "Django model ``FloatField``" - }, - "Models ImageField":{ - "prefix": "mimg", - "body": "${1:FIELDNAME} = models.ImageField(upload_to=${2:path/for/upload}${3:, height_field=height, width_field=width}${4:, max_length=100})", - "description": "Django model ``ImageField``" - }, - "Models IntegerField":{ - "prefix": "mint", - "body": "${1:FIELDNAME} = models.IntegerField(${2})", - "description": "Django model ``IntegerField``" - }, - "Models IPAddressField":{ - "prefix": "mip", - "body": "${1:FIELDNAME} = models.IPAddressField(${2})", - "description": "Django model ``IPAddressField``" - }, - "Models NullBooleanField":{ - "prefix": "mnullboolean", - "body": "${1:FIELDNAME} = models.NullBooleanField(${2})", - "description": "Django model ``NullBooleanField``" - }, - "Models PositiveIntegerField":{ - "prefix": "mposint", - "body": "${1:FIELDNAME} = models.PositiveIntegerField(${2})", - "description": "Django model ``PositiveIntegerField``" - }, - "Models PositiveSmallIntegerField":{ - "prefix": "mpossmallint", - "body": "${1:FIELDNAME} = models.PositiveSmallIntegerField(${2})", - "description": "Django model ``PositiveSmallIntegerField``" - }, - "Models SlugField":{ - "prefix": "mslug", - "body": "${1:FIELDNAME} = models.SlugField(${2})", - "description": "Django model ``SlugField``" - }, - "Models SmallIntegerField":{ - "prefix": "msmallint", - "body": "${1:FIELDNAME} = models.SmallIntegerField(${2})", - "description": "Django model ``SmallIntegerField``" - }, - "Models TextField":{ - "prefix": "mtext", - "body": "${1:FIELDNAME} = models.TextField(${2})", - "description": "Django model ``TextField``" - }, - "Models TimeField":{ - "prefix": "mtime", - "body": "${1:FIELDNAME} = models.TimeField(auto_now_add=${2:True}, auto_now=${3:False})", - "description": "Django model ``TimeField``" - }, - "Models URLField":{ - "prefix": "murl", - "body": "${1:FIELDNAME} = models.URLField(verify_exists=${2:False})", - "description": "Django model ``URLField``" - }, - "Models XMLField":{ - "prefix": "mxml", - "body": "${1:FIELDNAME} = models.XMLField(schema_path=${2:None})", - "description": "Django model ``XMLField``" - }, - - "Models ForeignKey":{ - "prefix": "fk", - "body": "${1:FIELDNAME} = models.ForeignKey(${2:OtherModel}, on_delete=models.${3:CASCADE}, related_name=\"${4:RelatedName}\" ${0:, limit_choices_to=})", - "description": "Django model ``ForeignKey``" - }, - "Models ManyToManyField":{ - "prefix": "m2m", - "body": "${1:FIELDNAME} = models.ManyToManyField(${2:OtherModel}, related_name=\"${3:RelatedName}\" ${0:, limit_choices_to=})", - "description": "Django model ``ManyToManyField``" - }, - "Models OneToOneField":{ - "prefix": "o2o", - "body": "${1:FIELDNAME} = models.OneToOneField(${2:OtherModel}, related_name=\"${4:RelatedName}\"${0:, to_field=''})", - "description": "Django model ``OneToOneField``" - } -} - diff --git a/snippets/frameworks/django/views.json b/snippets/frameworks/django/views.json deleted file mode 100644 index 4faa917..0000000 --- a/snippets/frameworks/django/views.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "Django CreateView":{ - "prefix": "createview", - "body": [ - "class ${1:ModelName}CreateView(generic.CreateView):", - "\tmodel = ${2:$1}", - "\ttemplate_name = \"${3:$1/$1_form.html}\"", - "\tform_class = ${4:forms.$1Form}", - "\tsuccess_url = \"${5:.}\"" - ], - "description": "Django CBV ``CreateView``" - }, - "Django UpdateView":{ - "prefix": "updateview", - "body": [ - "class ${1:ModelName}UpdateView(generic.UpdateView):", - "\tmodel = ${2:$1}", - "\ttemplate_name = \"${3:$1/$1_form.html}\"", - "\tform_class = ${4:forms.$1Form}", - "\tsuccess_url = \"${5:.}\"", - "\n\tdef get_object(self):", - "\t\treturn $1.objects.get(pk=${6:self.kwargs.get(\"pk\")})" - ], - "description": "Django CBV ``UpdateView``" - }, - "Django DeleteView":{ - "prefix": "deleteview", - "body": [ - "class ${1:ModelName}DeleteView(generic.DeleteView):", - "\tmodel = ${2:$1}", - "\n\tdef get_success_url(self):", - "\t\treturn reverse(\"${3:$1:list}\")", - "\n\tdef get(self, request, *args, **kwargs):", - "\t\treturn post(request, *args, **kwargs)" - ], - "description": "Django CBV ``DeleteView``" - }, - "Django DetailView":{ - "prefix": "detailview", - "body": [ - "class ${1:ModelName}DetailView(generic.DetailView):", - "\tmodel = ${2:$1}", - "\ttemplate_name = \"${3:$1/$1_detail.html}\"", - "\n\tdef get_object(self):", - "\t\treturn $1.objects.get(pk=${4:self.kwargs.get(\"pk\")})", - "\n\tdef get_queryset(self):", - "\t\treturn $1.objects.filter(${5})" - ], - "description": "Django CBV ``DetailView``" - }, - "Django ListView":{ - "prefix": "listview", - "body": [ - "class ${1:ModelName}ListView(generic.ListView):", - "\tmodel = ${2:$1}", - "\ttemplate_name = \"${3:$1/$1_list.html}\"", - "\n\tdef get_queryset(self):", - "\t\treturn $1.objects.filter(${4})" - ], - "description": "Django CBV ``ListView``" - }, - "Django TemplateView":{ - "prefix": "templateview", - "body": [ - "class ${1:ModelName}TemplateView(generic.TemplateView):", - "\ttemplate_name = \"${2:$1/$1_list.html}\"", - "\n${3}" - ], - "description": "Django CBV ``TemplateView``" - }, - "Django FormView":{ - "prefix": "formview", - "body": [ - "class ${1:ModelName}FormView(generic.FormView):", - "\tform_class = ${2:forms.$1Form}", - "\ttemplate_name = \"${3}\"" - ], - "description": "Django CBV ``FormView``" - }, - "Django AdminView":{ - "prefix": "adminview", - "body": [ - "@admin.register($1)", - "class ${1:ModelName}Admin(admin.ModelAdmin):", - "\tlist_display = ${2:\"pk\",}", - "\tsearch_fields = ${3:\"pk\",}", - "\tlist_filter = ${4:\"FilterFields\",}" - ], - "description": "Django AdminView for ``admin.py``" - }, - "Django AdminTabularInline":{ - "prefix": "tabularinline", - "body": [ - "class ${1:ModelName}Inline(admin.TabularInline):", - "\tmodel = ${2:$1}", - "\tmin_num = ${4:0}", - "\tmax_num = ${4:8}", - "\textra = ${5:1}" - ], - "description": "Django TabularInline for ``admin.py``" - }, - "Django AdminStackedInline":{ - "prefix": "stackedinline", - "body": [ - "class ${1:ModelName}Inline(admin.StackedInline):", - "\tmodel = ${2:$1}", - "\tmin_num = ${4:0}", - "\tmax_num = ${4:8}", - "\textra = ${5:1}" - ], - "description": "Django StackedInline for ``admin.py``" - }, - - "Django Views get_context_data":{ - "prefix": "getcontextdata", - "body": [ - "def get_context_data(self, *args, **kwargs):", - "\tcontext = super().get_context_data(*args, **kwargs)", - "\treturn context" - ], - "description": "Django Views ``get_context_data`` method" - }, - "Django Views get_success_url":{ - "prefix": "getsuccessurl", - "body": [ - "def get_success_url(self):", - "\treturn reverse(\"${1:ViewName}\", kwargs={${2:\"pk\": self.get_object().pk}})" - ], - "description": "Django Views ``get_success_url`` method" - }, - "Django Views get_queryset":{ - "prefix": "getqueryset", - "body": [ - "def get_queryset(self):", - "\treturn ${1:ModelName}.objects.filter(${2})" - ], - "description": "Django Views ``get_queryset`` method" - }, - "Django Views get_object":{ - "prefix": "getobject", - "body": [ - "def get_object(self):", - "\treturn ${1:ModelName}.objects.get(${2})" - ], - "description": "Django Views ``get_object`` method" - }, - "Django Views form_valid":{ - "prefix": "formvalid", - "body": [ - "def form_valid(self, form):", - "\treturn super().form_valid(form)" - ], - "description": "Django Views ``form_valid`` method" - }, - "Django Views form_invalid":{ - "prefix": "forminvalid", - "body": [ - "def form_invalid(self, form):", - "\treturn super().form_invalid(form)" - ], - "description": "Django Views ``form_invalid`` method" - }, - "Django Views get_form_kwargs":{ - "prefix": "getformkwargs", - "body": [ - "def get_form_kwargs(self, form):", - "\tkwargs = super().get_form_kwargs()", - "\treturn kwargs" - ], - "description": "Django Views ``get_form_kwargs`` method" - }, - "Django Views dispatch":{ - "prefix": "dispatch", - "body": [ - "def dispatch(self, request, *args, **kwargs):", - "\treturn super().dispatch(request, *args, **kwargs)" - ], - "description": "Django Views ``dispatch`` method" - }, - "Django Views get_initial":{ - "prefix": "getinitial", - "body": [ - "def get_initial(self):", - "\tinit = super().get_initial()", - "\treturn init" - ], - "description": "Django Views ``get_initial`` method" - }, - "Django Views post":{ - "prefix": "post", - "body": [ - "def post(self, request, *args, **kwargs):", - "\treturn super().post(request, *args, **kwargs)" - ], - "description": "Django Views ``post`` method" - }, - "Django Views get":{ - "prefix": "get", - "body": [ - "def get(self, request, *args, **kwargs):", - "\treturn super().get(request, *args, **kwargs)" - ], - "description": "Django Views ``post`` method" - }, - - - "Django Forms field_clean":{ - "prefix": "cleanf", - "body": [ - "def clean_${1:FieldName}(self):", - "\t$1 = self.cleaned_data[\"$1\"]", - "\t${0}", - "\treturn $1" - ], - "description": "Django Views ``field_clean`` method" - }, - "Django Forms clean":{ - "prefix": "cleanff", - "body": [ - "def clean(self):", - "\tcleaned_data = super().clean()", - "\t${0}" - ], - "description": "Django Views ``clean`` method" - }, - - - "Django FBV Path":{ - "prefix": "fpath", - "body": "path(\"${1:Path}\", v.${2:View}, name=${0:PathName})", - "description": "Django Path For ``Function Based Views``" - }, - "Django CBV Path":{ - "prefix": "cpath", - "body": "path(\"${1:Path}\", v.${2:View}.as_viewJ(), name=${0:PathName})", - "description": "Django Path For ``Class Based Views``" - }, - "Django Path as Include":{ - "prefix": "ipath", - "body": "path(\"${1:Path}\", include(\"${2}.urls\", namespace=${0:Name})", - "description": "Django Path as ``Include``" - } -} diff --git a/snippets/frameworks/ejs.json b/snippets/frameworks/ejs.json deleted file mode 100644 index 477ecf5..0000000 --- a/snippets/frameworks/ejs.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "EJS No Output": { - "prefix": "ejs", - "body": [ - "<% $1 %> $2" - ], - "description": "EJS No Output" - }, - "EJS Output Value": { - "prefix": "ejsout", - "body": [ - "<%= $1 %> $2" - ], - "description": "EJS outputs no value" - }, - "EJS Output Escaped": { - "prefix": "ejsesc", - "body": [ - "<%- $1 %> $2" - ], - "description": "EJS outputs value" - }, - "EJS Comment": { - "prefix": "ejscom", - "body": [ - "<%# $1 %> $2" - ], - "description": "EJS comment tag with no output" - }, - "EJS Literal": { - "prefix": "ejslit", - "body": [ - "<%% $1 %> $2" - ], - "description": "EJS outputs a literal '<%'" - }, - "EJS Include": { - "prefix": "ejsinc", - "body": [ - "<% include $1 %> $2" - ], - "description": "EJS include statement" - }, - "EJS For Loop": { - "prefix": "ejsfor", - "body": [ - "<% for( let ${1:index} = 0; ${1:index} < ${2:array}.length; ${1:index}++ ) { %>", - "$3", - "<% } %>" - ], - "description": "EJS For Loop" - }, - "EJS ForEach": { - "prefix": "ejseach", - "body": [ - "<% ${1:array}.forEach(${2:element} => { %>", - " $3", - "<% }) %>" - ], - "description": "EJS ForEach Loop" - }, - "EJS If Statement": { - "prefix": "ejsif", - "body": [ - "<% if (${1:condition}) { %>", - " $2", - "<% } %>" - ], - "description": "EJS if statement" - }, - "EJS Else Statement": { - "prefix": "ejselse", - "body": [ - "<% } else { %>", - " $1" - ], - "description": "EJS if statement" - }, - "EJS Else If Statement": { - "prefix": "ejselif", - "body": [ - "<% } else if ({$1:condition}) { %>", - " $2" - ], - "description": "EJS if statement" - } -} diff --git a/snippets/frameworks/flutter.json b/snippets/frameworks/flutter.json deleted file mode 100644 index 594eeba..0000000 --- a/snippets/frameworks/flutter.json +++ /dev/null @@ -1,498 +0,0 @@ -{ - "Stateless Widget": { - "prefix": "statelessW", - "body": [ - "class ${1:name} extends StatelessWidget {", - " const ${1:name}({Key? key}) : super(key: key);\n", - " @override", - " Widget build(BuildContext context) {", - " return Container(", - " child: ${2:null},", - " );", - " }", - "}" - ], - "description": "Create a Stateless widget" - }, - "Stateful Widget": { - "prefix": "statefulW", - "body": [ - "class ${1:name} extends StatefulWidget {", - " ${1:name}({Key? key}) : super(key: key);\n", - " @override", - " _${1:WidgetName}State createState() => _${1:WidgetName}State();", - "}\n", - "class _${1:index}State extends State<${1:index}> {", - " @override", - " Widget build(BuildContext context) {", - " return Container(", - " child: ${2:null},", - " );", - " }", - "}" - ], - "description": "Create a Stateful widget" - }, - "Build Method": { - "prefix": "build", - "body": [ - "@override", - "Widget build(BuildContext context) {", - " return ${0:};", - "}" - ], - "description": "Describes the part of the user interface represented by this widget." - }, - "Custom Painter ": { - "prefix": "customPainter", - "body": [ - "class ${0:name}Painter extends CustomPainter {", - "", - " @override", - " void paint(Canvas canvas, Size size) {", - " }", - "", - " @override", - " bool shouldRepaint(${0:name}Painter oldDelegate) => false;", - "", - " @override", - " bool shouldRebuildSemantics(${0:name}Painter oldDelegate) => false;", - "}" - ], - "description": "Used for creating custom paint" - }, - "Custom Clipper ": { - "prefix": "customClipper", - "body": [ - "class ${0:name}Clipper extends CustomClipper {", - "", - " @override", - " Path getClip(Size size) {", - " }", - "", - " @override", - " bool shouldReclip(CustomClipper oldClipper) => false;", - "}" - ], - "description": "Used for creating custom shapes" - }, - "InitState ": { - "prefix": "initS", - "body": [ - "@override", - "void initState() { ", - " super.initState();", - " ${0:}", - "}" - ], - "description": "Called when this object is inserted into the tree. The framework will call this method exactly once for each State object it creates." - }, - "Dispose": { - "prefix": "dis", - "body": [ - "@override", - "void dispose() { ", - " ${0:}", - " super.dispose();", - "}" - ], - "description": "Called when this object is removed from the tree permanently. The framework calls this method when this State object will never build again." - }, - "Reassemble": { - "prefix": "reassemble", - "body": [ - "@override", - "void reassemble(){", - " super.reassemble();", - " ${0:}", - "}" - ], - "description": "Called whenever the application is reassembled during debugging, for example during hot reload." - }, - "didChangeDependencies": { - "prefix": "didChangeD", - "body": [ - "@override", - "void didChangeDependencies() {", - " super.didChangeDependencies();", - " ${0:}", - "}" - ], - "description": "Called when a dependency of this State object changes" - }, - "didUpdateWidget": { - "prefix": "didUpdateW", - "body": [ - "@override", - "void didUpdateWidget (${1:Type} ${2:oldWidget}) {", - " super.didUpdateWidget(${2:oldWidget});", - " ${0:}", - "}" - ], - "description": "Called whenever the widget configuration changes." - }, - "ListView.Builder": { - "prefix": "listViewB", - "body": [ - "ListView.builder(", - " itemCount: ${1:1},", - " itemBuilder: (BuildContext context, int index) {", - " return ${2:};", - " },", - ")," - ], - "description": "Creates a scrollable, linear array of widgets that are created on demand.Providing a non-null `itemCount` improves the ability of the [ListView] to estimate the maximum scroll extent." - }, - "ListView.Separated": { - "prefix": "listViewS", - "body": [ - "ListView.separated(", - " itemCount: ${1:1},", - " separatorBuilder: (BuildContext context, int index) {", - " return ${2:};", - " },", - " itemBuilder: (BuildContext context, int index) {", - " return ${3:};", - " },", - ")," - ], - "description": "Creates a fixed-length scrollable linear array of list 'items' separated by list item 'separators'." - }, - "GridView.Builder": { - "prefix": "gridViewB", - "body": [ - "GridView.builder(", - " gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(", - " crossAxisCount: ${1:2},", - " ),", - " itemCount: ${2:2},", - " itemBuilder: (BuildContext context, int index) {", - " return ${3:};", - " },", - ")," - ], - "description": "Creates a scrollable, 2D array of widgets that are created on demand. Providing a non-null `itemCount` improves the ability of the [GridView] to estimate the maximum scroll extent." - }, - "GridView.Count": { - "prefix": "gridViewC", - "body": [ - "GridView.count(", - " crossAxisSpacing: ${1:1},", - " mainAxisSpacing: ${2:2},", - " crossAxisCount: ${3:2},", - " children: [", - " ${4:}", - " ],", - ")," - ], - "description": "Creates a scrollable, 2D array of widgets with a fixed number of tiles in the cross axis." - }, - "GridView.Extent": { - "prefix": "gridViewE", - "body": [ - "GridView.extent(", - " maxCrossAxisExtent: ${1:2},", - " children: [", - " ${2:}", - " ],", - ")," - ], - "description": "Creates a scrollable, 2D array of widgets with tiles that each have a maximum cross-axis extent." - }, - "Custom Scroll View": { - "prefix": "customScrollV", - "body": [ - "CustomScrollView(", - " slivers: [", - " ${0:}", - " ],", - ")," - ], - "description": "Creates a `ScrollView` that creates custom scroll effects using slivers. If the `primary` argument is true, the `controller` must be null." - }, - "Stream Builder": { - "prefix": "streamBldr", - "body": [ - "StreamBuilder(", - " stream: ${1:stream},", - " initialData: ${2:initialData},", - " builder: (BuildContext context, AsyncSnapshot snapshot) {", - " return Container(", - " child: ${3:child},", - " );", - " },", - ")," - ], - "description": "Creates a new `StreamBuilder` that builds itself based on the latest snapshot of interaction with the specified `stream`" - }, - "Animated Builder": { - "prefix": "animatedBldr", - "body": [ - "AnimatedBuilder(", - " animation: ${1:animation},", - " child: ${2:child},", - " builder: (BuildContext context, Widget child) {", - " return ${3:};", - " },", - ")," - ], - "description": "Creates an Animated Builder. The widget specified to `child` is passed to the `builder` " - }, - "Stateful Builder": { - "prefix": "statefulBldr", - "body": [ - "StatefulBuilder(", - " builder: (BuildContext context, setState) {", - " return ${0:};", - " },", - ")," - ], - "description": "Creates a widget that both has state and delegates its build to a callback. Useful for rebuilding specific sections of the widget tree." - }, - "Orientation Builder": { - "prefix": "orientationBldr", - "body": [ - "OrientationBuilder(", - " builder: (BuildContext context, Orientation orientation) {", - " return Container(", - " child: ${3:child},", - " );", - " },", - ")," - ], - "description": "Creates a builder which allows for the orientation of the device to be specified and referenced" - }, - "Layout Builder": { - "prefix": "layoutBldr", - "body": [ - "LayoutBuilder(", - " builder: (BuildContext context, BoxConstraints constraints) {", - " return ${0:};", - " },", - ")," - ], - "description": "Similar to the Builder widget except that the framework calls the builder function at layout time and provides the parent widget's constraints." - }, - "Single Child ScrollView": { - "prefix": "singleChildSV", - "body": [ - "SingleChildScrollView(", - " controller: ${1:controller,}", - " child: Column(", - " ${0:}", - " ),", - ")," - ], - "description": "Creates a scroll view with a single child" - }, - "Future Builder": { - "prefix": "futureBldr", - "body": [ - "FutureBuilder(", - " future: ${1:Future},", - " initialData: ${2:InitialData},", - " builder: (BuildContext context, AsyncSnapshot snapshot) {", - " return ${3:};", - " },", - ")," - ], - "description": "Creates a Future Builder. This builds itself based on the latest snapshot of interaction with a Future." - }, - "No Such Method": { - "prefix": "nosm", - "body": [ - "@override", - "dynamic noSuchMethod(Invocation invocation) {", - " ${1:}", - "}" - ], - "description": "This method is invoked when a non-existent method or property is accessed." - }, - "Inherited Widget": { - "prefix": "inheritedW", - "body": [ - "class ${1:Name} extends InheritedWidget {", - " ${1:Name}({Key? key, required this.child}) : super(key: key, child: child);", - "", - " final Widget child;", - "", - " static ${1:Name}? of(BuildContext context) {", - " return context.dependOnInheritedWidgetOfExactType<${1:Name}>();", - " }", - "", - " @override", - " bool updateShouldNotify(${1:Name} oldWidget) {", - " return ${2:true};", - " }", - "}" - ], - "description": "Class used to propagate information down the widget tree" - }, - "Mounted": { - "prefix": "mounted", - "body": [ - "@override", - "bool get mounted {", - " ${0:}", - "}" - ], - "description": "Whether this State object is currently in a tree." - }, - "Sink": { - "prefix": "snk", - "body": [ - "Sink<${1:type}> get ${2:name} => _${2:name}Controller.sink;", - "final _${2:name}Controller = StreamController<${1:type}>();" - ], - "description": "A Sink is the input of a stream." - }, - "Stream": { - "prefix": "strm", - "body": [ - "Stream<${1:type}> get ${2:name} => _${2:name}Controller.stream;", - "final _${2:name}Controller = StreamController<${1:type}>();" - ], - "description": "A source of asynchronous data events. A stream can be of any data type " - }, - "Subject": { - "prefix": "subj", - "body": [ - "Stream<${1:type}> get ${2:name} => _${2:name}Subject.stream;", - "final _${2:name}Subject = BehaviorSubject<${1:type}>();" - ], - "description": "A BehaviorSubject is also a broadcast StreamController which returns an Observable rather than a Stream." - }, - "toString": { - "prefix": "toStr", - "body": [ - "@override", - "String toString() {", - "return ${1:toString};", - " }" - ], - "description": "Returns a string representation of this object." - }, - "debugPrint": { - "prefix": "debugP", - "body": [ - "debugPrint(${1:statement});" - ], - "description": "Prints a message to the console, which you can access using the flutter tool's `logs` command (flutter logs)." - }, - "Material Package": { - "prefix": "importM", - "body": "import 'package:flutter/material.dart';", - "description": "Import flutter material package" - }, - "Cupertino Package": { - "prefix": "importC", - "body": "import 'package:flutter/cupertino.dart';", - "description": "Import Flutter Cupertino package" - }, - "flutter_test Package": { - "prefix": "importFT", - "body": "import 'package:flutter_test/flutter_test.dart';", - "description": "Import flutter_test package" - }, - "Material App": { - "prefix": "mateapp", - "description": "Create a MaterialApp", - "body": [ - "import 'package:flutter/material.dart';", - " ", - "void main() => runApp(MyApp());", - " ", - "class MyApp extends StatelessWidget {", - " @override", - " Widget build(BuildContext context) {", - " return MaterialApp(", - " title: 'Material App',", - " home: Scaffold(", - " appBar: AppBar(", - " title: Text('Material App Bar'),", - " ),", - " body: Center(", - " child: Container(", - " child: Text('Hello World'),", - " ),", - " ),", - " ),", - " );", - " }", - "}" - ] - }, - "Cupertino App": { - "prefix": "cupeapp", - "description": "Create a CupertinoApp", - "body": [ - "import 'package:flutter/cupertino.dart';", - " ", - "void main() => runApp(MyApp());", - " ", - "class MyApp extends StatelessWidget {", - " @override", - " Widget build(BuildContext context) {", - " return CupertinoApp(", - " title: 'Cupertino App',", - " home: CupertinoPageScaffold(", - " navigationBar: CupertinoNavigationBar(", - " middle: Text('Cupertino App Bar'),", - " ),", - " child: Center(", - " child: Container(", - " child: Text('Hello World'),", - " ),", - " ),", - " ),", - " );", - " }", - "}" - ] - }, - "Tween Animation Builder": { - "prefix": "tweenAnimationBuilder", - "body": [ - "TweenAnimationBuilder(", - " duration: ${1:const Duration(),}", - " tween: ${2:Tween(),}", - " builder: (BuildContext context, ${3:dynamic} value, Widget? child) {", - " return ${4:Container();}", - " },", - " ), " - ], - "description": "Widget builder that animates a property of a Widget to a target value whenever the target value changes." - }, - "Value Listenable Builder": { - "prefix": "valueListenableBuilder", - "body": [ - "ValueListenableBuilder(", - " valueListenable: ${1: null},", - " builder: (BuildContext context, ${2:dynamic} value, Widget? child) {", - " return ${3: Container();}", - " },", - " )," - ], - "description": "Given a ValueListenable and a builder which builds widgets from concrete values of T, this class will automatically register itself as a listener of the ValueListenable and call the builder with updated values when the value changes." - }, - "Test": { - "prefix": "f-test", - "body": [ - "test(", - " \"${1:test description}\",", - " () {},", - ");" - ], - "description": "Create a test function" - }, - "Test Widgets": { - "prefix": "widgetTest", - "body": [ - "testWidgets(", - " \"${1:test description}\",", - " (WidgetTester tester) async {},", - ");" - ], - "description": "Create a testWidgets function" - } -} \ No newline at end of file diff --git a/snippets/frameworks/jekyll.json b/snippets/frameworks/jekyll.json deleted file mode 100644 index 9a11714..0000000 --- a/snippets/frameworks/jekyll.json +++ /dev/null @@ -1,526 +0,0 @@ -{ - "Show": { - "prefix": "show", - "description": "Output markup: {{ }}", - "body": "{{ $1 }}" - }, - - "Execute": { - "prefix": "execute", - "description": "Tag markup: {%- -%}", - "body": "{%- $1 -%}" - }, - - "Tag assign": { - "prefix": "assign", - "description": "Variable tag: assign", - "body": [ - "{%- assign ${variable} = ${value} -%}" - ] - }, - - "Tag break": { - "prefix": "break", - "description": "Iteration tag: break", - "body": [ - "{%- break -%}" - ] - }, - - "Tag capture": { - "prefix": "capture", - "description": "Variable tag: capture", - "body": [ - "{%- capture ${variable} -%}${code:}{%- endcapture -%}" - ] - }, - - "Tag case": { - "prefix": "case", - "description": "Control flow tag: case", - "body": [ - "{%- case ${variable} -%}", - "\t{%- when ${condition} -%}", - "\t\t${code1:}", - "\t{%- else -%}", - "\t\t${code2:}", - "{%- endcase -%}" - ] - }, - - "Tag comment": { - "prefix": "comment", - "description": "Control flow tag: case", - "body": [ - "{%- comment -%}${description:}{%- endcomment -%}" - ] - }, - - "Tag context variable": { - "prefix": "convar", - "description": "Context Variable", - "body": [ - "{{ ${variable:} }}" - ] - }, - - "Tag continue": { - "prefix": "continue", - "description": "Iteration tag: continue", - "body": [ - "{%- continue -%}" - ] - }, - - "Tag cycle": { - "prefix": "cycle", - "description": "Iteration tag: cycle", - "body": [ - "{%- cycle '${0:odd}', '${1:even}' -%}" - ] - }, - - "Tag collection directory": { - "prefix": "cdirp", - "description": "The full path to the collection's source direcotry", - "body": [ - "{{ site.${my_collection}.directory }}" - ] - }, - - "Tag collection relative path": { - "prefix": "crelp", - "description": "The path to the document's source file realtive to the site source", - "body": [ - "{{ site.collections.${my_collection}.relative_path }}" - ] - }, - - "Tag decrement": { - "prefix": "decrement", - "description": "Variable tag: decrement", - "body": [ - "{%- decrement ${variable} -%}" - ] - }, - - "Tag for": { - "prefix": "for", - "description": "Iteration tag: for", - "body": [ - "{%- for ${item} in ${collection} -%}", - "\t${code:}", - "{%- endfor -%}" - ] - }, - - "Tag increment": { - "prefix": "increment", - "description": "Variable tag: increment", - "body": [ - "{%- increment ${variable} -%}" - ] - }, - - "Tag if": { - "prefix": "if", - "description": "Control flow tag: if", - "body": [ - "{%- if ${condition} -%}", - "\t${code:}", - "{%- endif -%}" - ] - }, - - "Tag else": { - "prefix": "else", - "description": "Control flow tag: else", - "body": [ - "{%- else -%}" - ] - }, - - "Tag elsif": { - "prefix": "elsif", - "description": "Control flow tag: elsif", - "body": [ - "{%- elsif ${condition} -%}" - ] - }, - - "Tag if else": { - "prefix": "ifelse", - "description": "Control flow tag: if else", - "body": [ - "{%- if ${condition} -%}", - "\t${code1:}", - "{%- else -%}", - "\t${code2:}", - "{%- endif -%}" - ] - }, - - "Tag gist": { - "prefix": "gist", - "description": "Add a gist code block", - "body": [ - "{%- gist ${gist:user/gist-id} -%}" - ] - }, - - "Tag highlight": { - "prefix": "highlight", - "description": "Syntax tag: highlight", - "body": [ - "{%- highlight ${lang:javascript} -%}", - "\t\t${code:}", - "{%- endhighlight -%}" - ] - }, - - "Tag include": { - "prefix": "include", - "description": "Tag: include", - "body": [ - "{%- include ${snippet} -%}" - ] - }, - - "Site Vairable Date": { - "prefix": "date", - "description": "Tag: site.date", - "body": [ - "{{ site.date | date: '${format: %b %d, %Y}' }}" - ] - }, - - "Tag include relative": { - "prefix": "increl", - "description": "Tag: include relative", - "body": [ - "{%- include_relative '${file:}' -%}" - ] - }, - - "Tag Post URL": { - "prefix": "posturl", - "description": "Tag: post_url", - "body": [ - "{%- post_url ${url:} -%}" - ] - }, - - "Tag unless": { - "prefix": "unless", - "description": "Control flow tag: unless", - "body": [ - "{%- unless ${condition} -%}", - "\t${code:}", - "{%- endunless -%}" - ] - }, - - "Tag when": { - "prefix": "when", - "description": "Control flow tag: when", - "body": [ - "{%- when ${condition} -%}", - "${code:}" - ] - }, - - "Tag Option limit": { - "prefix": "limit", - "description": "For loops option", - "body": [ - "limit: ${limit:5}" - ] - }, - - "Tag Option offset": { - "prefix": "offset", - "description": "For loops option", - "body": [ - "offset: ${offset:0}" - ] - }, - - "Tag Option reversed": { - "prefix": "reversed", - "description": "For loops option", - "body": [ - "reversed" - ] - }, - - "Tag raw": { - "prefix": "raw", - "description": "Tag: raw", - "body": [ - "{%- raw -%}${code:}{%- endraw -%}" - ] - }, - - "Tag paginate next or previous page": { - "prefix": "paginate", - "description": "Tag: paginate next or previous page", - "body": [ - "{{ paginator.${next:previous}_page }}" - ] - }, - - "Filter jsonify": { - "prefix": "json", - "description": "Array filter: jsonify", - "body": "| jsonify }}'" - }, - - "Filter join": { - "prefix": "join", - "description": "Array filter: join", - "body": "| join: '${seperator:, }}'" - }, - - "Filter first": { - "prefix": "first", - "description": "Array filter: first", - "body": "| first" - }, - - "Filter last": { - "prefix": "last", - "description": "Array filter: last", - "body": "| last" - }, - - "Filter map": { - "prefix": "map", - "description": "Array filter: map", - "body": "| map: '${key}'" - }, - - "Filter size": { - "prefix": "size", - "description": "Array filter: size", - "body": "| size" - }, - - "Filter sort": { - "prefix": "sort", - "description": "Array filter: sort", - "body": "| sort" - }, - - "Filter uniq": { - "prefix": "uniq", - "description": "Array filter: uniq", - "body": "| uniq" - }, - - "Filter ceil": { - "prefix": "ceil", - "description": "Math filter: ceil", - "body": "| ceil" - }, - - "Filter divided by": { - "prefix": "divided_by", - "description": "Math filter: divided by", - "body": "| divided_by: ${divided_by:2}" - }, - - "Filter floor": { - "prefix": "floor", - "description": "Math filter: floor", - "body": "| floor" - }, - - "Filter minus": { - "prefix": "minus", - "description": "Math filter: minus", - "body": "| minus: ${minus:1}" - }, - - "Filter modulo": { - "prefix": "modulo", - "description": "Math filter: modulo", - "body": "| modulo: ${modulo:2}" - }, - - "Filter plus": { - "prefix": "plus", - "description": "Math filter: plus", - "body": "| plus: ${plus:1}" - }, - - "Filter round": { - "prefix": "round", - "description": "Math filter: round", - "body": "| round: ${round:0}" - }, - - "Filter times": { - "prefix": "times", - "description": "Math filter: times", - "body": "| times: ${times:1}" - }, - - "Filter append": { - "prefix": "append", - "description": "String filter: append", - "body": "| append: '${string}' }}" - }, - - "Filter capitalize": { - "prefix": "capitalize", - "description": "String filter: capitalize", - "body": "| capitalize }}" - }, - - "Filter downcase": { - "prefix": "downcase", - "description": "String filter: downcase", - "body": "| downcase }}" - }, - - "Filter escape": { - "prefix": "escape", - "description": "String filter: escape", - "body": "| escape }}" - }, - - "Filter markdownify": { - "prefix": "markdown", - "description": "String filter: markdownify", - "body": "| markdownify }}" - }, - - "Filter prepend": { - "prefix": "prepend", - "description": "String filter: prepend", - "body": "| prepend: '${string}' }}" - }, - - "Filter remove": { - "prefix": "remove", - "description": "String filter: remove", - "body": "| remove: '${string}' }}" - }, - - "Filter remove first": { - "prefix": "remove_first", - "description": "String filter: remove first", - "body": "| remove_first: '${string}' }}" - }, - - "Filter replace": { - "prefix": "replace", - "description": "String filter: replace", - "body": "| replace: '${target}', '${replace}' }}" - }, - - "Filter replace first": { - "prefix": "replace_first", - "description": "String filter: replace first", - "body": "| replace_first: '${target}', '${replace}' }}" - }, - - "Filter slice": { - "prefix": "slice", - "description": "String filter: slice", - "body": "| slice: ${from:0}, ${to:5} }}" - }, - - "Filter slice single character": { - "prefix": "slice_single", - "description": "String filter: slice with single parameter", - "body": "| slice: ${at} }}" - }, - - "Filter split": { - "prefix": "split", - "description": "String filter: split", - "body": "| split: '${splitter:,}' }}" - }, - - "Filter strip": { - "prefix": "strip", - "description": "String filter: strip", - "body": "| strip }}" - }, - - "Filter lstrip": { - "prefix": "lstrip", - "description": "String filter: lstrip", - "body": "| lstrip }}" - }, - - "Filter rstrip": { - "prefix": "rstrip", - "description": "String filter: rstrip", - "body": "| rstrip }}" - }, - - "Filter strip html": { - "prefix": "strip_html", - "description": "String filter: strip html", - "body": "| strip_html }}" - }, - - "Filter strip newlines": { - "prefix": "strip_newlines", - "description": "String filter: strip newlines", - "body": "| strip_newlines }}" - }, - - "Filter truncate": { - "prefix": "truncate", - "description": "String filter: truncate", - "body": "| truncate: ${length:20}, '${ellipsis:...}' }}" - }, - - "Filter truncatewords": { - "prefix": "truncatewords", - "description": "String filter: truncatewords", - "body": "| truncatewords: ${length:5}, '${ellipsis:...}' }}" - }, - - "Filter upcase": { - "prefix": "upcase", - "description": "String filter: upcase }}", - "body": "| upcase }}" - }, - - "Filter url encode": { - "prefix": "url_encode", - "description": "String filter: url encode", - "body": "| url_encode }}" - }, - - "Filter uri escape": { - "prefix": "uri_escape", - "description": "String filter: uri escape", - "body": "| uri_escape }}" - }, - - "Filter xml escape": { - "prefix": "xml_escape", - "description": "String filter: xml escape", - "body": "| xml_escape }}" - }, - - "Front Matter": { - "prefix": "fm", - "description": "Add front matter", - "body": [ - "---", - "layout: ${layout:default}", - "title: ${title}", - "categories: ${category}", - "permalink: ${path}", - "tags: ${tag}", - "excerpt: ${description}", - "---" - ] - } -} diff --git a/snippets/frameworks/rails.json b/snippets/frameworks/rails.json deleted file mode 100644 index db095a9..0000000 --- a/snippets/frameworks/rails.json +++ /dev/null @@ -1,294 +0,0 @@ -{ - "Before action": { - "prefix": "ba", - "body": [ - "before_action :${0:method}" - ], - "description": "before_action" - }, - "Before validation": { - "prefix": "bv", - "body": [ - "before_validation :${0:method}" - ], - "description": "before_validation" - }, - "Before create": { - "prefix": "bc", - "body": [ - "before_create :${0:method}" - ], - "description": "before_create" - }, - "Before update": { - "prefix": "bu", - "body": [ - "before_update :${0:method}" - ], - "description": "before_update" - }, - "Before save": { - "prefix": "bs", - "body": [ - "before_save :${0:method}" - ], - "description": "before_save" - }, - "Before destroy": { - "prefix": "bd", - "body": [ - "before_destroy :${0:method}" - ], - "description": "before_destroy" - }, - "After create": { - "prefix": "ac", - "body": [ - "after_create :${0:method}" - ], - "description": "after_create" - }, - "After validation": { - "prefix": "av", - "body": [ - "after_validation :${0:method}" - ], - "description": "after_validation" - }, - " update": { - "prefix": "au", - "body": [ - "after_update :${0:method}" - ], - "description": "after_update" - }, - " save": { - "prefix": "as", - "body": [ - "after_save :${0:method}" - ], - "description": "after_create" - }, - " destroy": { - "prefix": "ad", - "body": [ - "after_destroy :${0:method}" - ], - "description": "after_destroy" - }, - "Belongs to": { - "prefix": "bt", - "body": [ - "belongs_to :${0:association}" - ], - "description": "belongs_to assocation" - }, - "Belongs to polymorphic": { - "prefix": "btp", - "body": [ - "belongs_to :${0:association}, polymorphic: true" - ], - "description": "belongs_to polymorphic assocation" - }, - "Create action": { - "prefix": "create", - "body": [ - "def create", - "\t@${1:model_class_name} = ${2:ModelClassName}.new($1_params)", - "\trespond_to do |format|", - "\t\tif @$1.save", - "\t\t\tformat.html { redirect_to @$1, notice: '$2 created' }", - "\t\telse", - "\t\t\tformat.html { render :new, status: :unprocessable_entity }", - "\t\tend", - "\tend", - "end" - ], - "description": "def create" - }, - "Destroy action": { - "prefix": "destroy", - "body": [ - "def destroy", - "\t@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])", - "\t@$1.destroy!", - "\tredirect_to $1s_path, notice: '$2 removed'", - "end" - ], - "description": "def destroy" - }, - "Edit action": { - "prefix": "edit", - "body": [ - "def edit", - "\t@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])", - "end" - ], - "description": "def edit" - }, - "Index action": { - "prefix": "index", - "body": [ - "def index", - "\t@${1:model_class_name} = ${2:ModelClassName}.all", - "end" - ], - "description": "def index" - }, - "New action": { - "prefix": "new", - "body": [ - "def new", - "\t@${1:model_class_name} = ${2:ModelClassName}.new", - "end" - ], - "description": "def new" - }, - "Show action": { - "prefix": "show", - "body": [ - "def show", - "\t@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])", - "end" - ], - "description": "def show" - }, - "Update action": { - "prefix": "update", - "body": [ - "def update", - "\t@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])", - "\trespond_to do |format|", - "\t\tif @$1.update($1_params)", - "\t\t\tformat.html { redirect_to @$1, notice: '$2 updated' }", - "\t\telse", - "\t\t\tformat.html { render :edit, status: :unprocessable_entity }", - "\t\tend", - "\tend", - "end" - ], - "description": "def update" - }, - "Model Params": { - "prefix": "params", - "body": [ - "def ${1:model_class_name}_params", - "\tparams.require(:$1).permit(${2:attributes})", - "end" - ], - "description": "def model_params" - }, - "Getting Params": { - "prefix": "pa", - "body": [ - "params[:${1:id}]" - ], - "description": "getting params using attribute" - }, - "Delegate to": { - "prefix": "dt", - "body": [ - "delegate: :${1:method}, to: :${0:object}" - ], - "description": "delegate to" - }, - "Delegate to with prefix": { - "prefix": "dtp", - "body": [ - "delegate: :${1:method}, to: :${2:object}, prefix: :${3:prefix}, allow_nil: ${0:allow_nil}" - ], - "description": "delegate to" - }, - "Scope": { - "prefix": "scope", - "body": [ - "scope :${1:name}, -> { where(${2:field}: ${0:value}) }" - ], - "description": "AR scope" - }, - "Validate presence": { - "prefix": "vp", - "body": [ - "validates :${1:attribute}, presence: true" - ], - "description": "validates presence" - }, - "Validate uniqueness": { - "prefix": "vu", - "body": [ - "validates :${1:attribute}, uniqueness: true" - ], - "description": "validates presence" - }, - "Migration add column": { - "prefix": "mac", - "body": [ - "add_column :${1:table_name}, :${2:column_name}, :${0:data_type}" - ], - "description": "Migration add column" - }, - "Migration add index": { - "prefix": "mai", - "body": [ - "add_index :${1:table_name}, :${0:column_name}" - ], - "description": "Migration add index" - }, - "Migration remove column": { - "prefix": "mrc", - "body": [ - "remove_column :${1:table_name}, :${0:column_name}" - ], - "description": "Migration remove column" - }, - "Migration rename column": { - "prefix": "mrnc", - "body": [ - "rename_column :${1:table_name}, :${2:old_column_name}, :${0:new_column_name}" - ], - "description": "Migration rename column" - }, - "Migration change column": { - "prefix": "mcc", - "body": [ - "change_column :${1:table_name}, :${2:old_column_name}, :${0:data_type}" - ], - "description": "Migration change column" - }, - "Has many dependent": { - "prefix": "hmd", - "body": [ - "has_many :${1:object}, dependent: :${0:destroy}" - ], - "description": "has_many dependent" - }, - "Has many": { - "prefix": "hm", - "body": [ - "has_many :${0:object}" - ], - "description": "has_many association" - }, - "Has many through": { - "prefix": "hmt", - "body": [ - "has_many :${1:object}, through: :${0:object}" - ], - "description": "has_many through association" - }, - "Has one": { - "prefix": "ho", - "body": [ - "has_one :${0:object}" - ], - "description": "has_one association" - }, - "Has one dependent": { - "prefix": "hod", - "body": [ - "has_one :${1:object}, dependent: :${0:destroy}" - ], - "description": "has_one dependent" - } -} - diff --git a/snippets/frameworks/twig.json b/snippets/frameworks/twig.json deleted file mode 100644 index b9a7469..0000000 --- a/snippets/frameworks/twig.json +++ /dev/null @@ -1,536 +0,0 @@ -{ - "asset": { - "prefix": "asset", - "body": - "{% set asset = ${1:entry.assetFieldHandle}.one() %}\n\n{% if asset %}\n\t\"{{\n{% endif %}", - "description": "asset" - }, - "assets": { - "prefix": "assets", - "body": - "{% for image in craft.assets.\n\t.sourceId(\"${1:1}\")\n\t.kind(\"${2:image}\")\n\t.limit(${3:10})\n}).all() %}\n\t\"{{\n{% endfor %}\n$0", - "description": "craft.assets" - }, - "autoescape": { - "prefix": "autoescape", - "body": "{% autoescape \"${1:type}\" %}\n\t$0\n{% endautoescape %}", - "description": "autoescape" - }, - "blockb": { - "prefix": "blockb", - "body": "{% block ${1:name} %}\n\t$0\n{% endblock %}", - "description": "block (block)" - }, - "block": { - "prefix": "block", - "body": "{% block ${1:name} %}$0{% endblock %}", - "description": "block" - }, - "blockf": { - "prefix": "blockf", - "body": "{{ block(\"${1:name}\") }}$0", - "description": "blockf" - }, - "cache": { - "prefix": "cache", - "body": "{% cache %}\n\t$1\n{% endcache %}\n$0", - "description": "cache" - }, - "case": { - "prefix": "case", - "body": "{% case \"${1:value}\" %}\n\t$0", - "description": "case" - }, - "children": { - "prefix": "children", - "body": "{% children %}$0", - "description": "children" - }, - "ceil": { - "prefix": "ceil", - "body": "ceil($1)$0", - "description": "ceil" - }, - "assetso": { - "prefix": "assetso", - "body": - "{% set assets = craft.assets({\n\tsourceId: \"${1:1}\",\n\tkind: \"${2:image}\",\n\tlimit: ${3:10}\n}).all() %}\n\n{% for image in assets %}\n\t\"{{\n{% endfor %}\n$0", - "description": "craft.assets - object syntax" - }, - "categorieso": { - "prefix": "categorieso", - "body": - "{% set categories = craft.categories({\n\tgroup: \"${1:categoryGroupHandle}\",\n\tlimit: \"${2:11}\"\n}).all() %}\n\n
    \n\t{% nav category in categories %}\n\t\t
  • \n\t\t\t{{ category.title }}\n\t\t\t{% ifchildren %}\n\t\t\t\t
      \n\t\t\t\t\t{% children %}\n\t\t\t\t
    \n\t\t\t{% endifchildren %}\n\t\t
  • \n\t{% endnav %}\n
", - "description": "craft.categories - object syntax" - }, - "categories": { - "prefix": "categories", - "body": - "
    \n\t{% nav category in craft.categories\n\t\t.group(\"${1:categoryGroupHandle}\")\n\t\t.limit(${2:11})\n\t\t.all()\n\t%}\n\t\t
  • \n\t\t\t{{ category.title }}\n\t\t\t{% ifchildren %}\n\t\t\t\t
      \n\t\t\t\t\t{% children %}\n\t\t\t\t
    \n\t\t\t{% endifchildren %}\n\t\t
  • \n\t{% endnav %}\n
", - "description": "craft.categories" - }, - "entrieso": { - "prefix": "entrieso", - "body": - "{% set entries = craft.entries({\n\tsection: \"${1:sectionName}\",\n\tlimit: \"${2:10}\"\n}).all() %}\n\n{% for entry in entries %}\n\t{{ entry.title }}\n{% endfor %}\n$0", - "description": "craft.entries - object syntax" - }, - "entries": { - "prefix": "entries", - "body": - "{% for entry in craft.entries\n\t.section(\"${1:sectionName}\")\n\t.limit(${2:10})\n\t.all()\n%}\n\t{{ entry.title }}\n{% endfor %}\n$0", - "description": "craft.entries" - }, - "t": { - "prefix": "t", - "body": "{{ $1 | t }}$0", - "description": "translate with | t" - }, - "replace": { - "prefix": "replace", - "body": "{{ ${1:$TM_SELECTED_TEXT} | replace(\"search\", \"replace\") }}$0", - "description": "replace with | replace(\"search\", \"replace\")" - }, - "replacex": { - "prefix": "replacex", - "body": - "{{ ${1:$TM_SELECTED_TEXT} | replace(\"/(search)/i\", \"replace\") }}$0", - "description": "replace regex with | replace(\"/(search)/i\", \"replace\")" - }, - "split": { - "prefix": "split", - "body": "{{ ${1:$TM_SELECTED_TEXT} | split(\"\\n\") }}$0", - "description": "split on | split (\"\\n\")" - }, - "tagso": { - "prefix": "tagso", - "body": - "{% set tags = craft.tags({\n\tgroup: \"${1:tagGroupHandle}\"\n}).all() %}\n\n
    \n\t{% for tag in tags %}\n\t\t
  • {{ tag }}
  • \n\t{% endfor %}\n
\n$0", - "description": "craft.tags - object syntax" - }, - "tags": { - "prefix": "tags", - "body": - "
    \n\t{% for tag in craft.tags.group(\"${1:tagGroupHandle}\").all() %}\n\t\t
  • {{ tag }}
  • \n\t{% endfor %}\n
\n$0", - "description": "craft.tags" - }, - "userso": { - "prefix": "userso", - "body": - "{% set users = craft.users({\n\tgroup: \"${1:userGroupHandle}\"\n}).all() %}\n\n{% for user in users %}\n\t{{ user.firstName }} {{ user.lastName }}\n{% endfor %}\n$0", - "description": "craft.users - object syntax" - }, - "users": { - "prefix": "users", - "body": - "{% for user in craft.users.group(\"${1:userGroupHandle}\").all() %}\n\t{{ user.firstName }} {{ user.lastName }}\n{% endfor %}\n$0", - "description": "craft.users" - }, - "csrf": { - "prefix": "csrf", - "body": "{{ csrfInput() }}\n$0", - "description": "csrf" - }, - "dd": { - "prefix": "dd", - "body": "
\n\t{{ dump($1) }}\n
\n{% exit %}$0", - "description": "dump and die" - }, - "do": { - "prefix": "do", - "body": "{% do $1 %}$0", - "description": "do" - }, - "dojs": { - "prefix": "dojs", - "body": "{% do view.registerJsFile \"${1:url}\" %}$0", - "description": "do js" - }, - "docss": { - "prefix": "docss", - "body": "{% do view.registerCssFile \"${1:url}\" %}$0", - "description": "do css" - }, - "dump": { - "prefix": "dump", - "body": "
\n\t{{ dump($1) }}\n
", - "description": "dump" - }, - "else": { - "prefix": "else", - "body": "{% else %}\n\t$0", - "description": "else" - }, - "embed": { - "prefix": "embed", - "body": "{% embed \"${1:template}\" %}\n\t$0\n{% endembed %}", - "description": "embed" - }, - "endautoescape": { - "prefix": "endautoescape", - "body": "{% endautoescape %}$0", - "description": "endautoescape" - }, - "endblock": { - "prefix": "endblock", - "body": "{% endblock %}$0", - "description": "endblock" - }, - "endcache": { - "prefix": "endcache", - "body": "{% endcache %}$0", - "description": "endcache" - }, - "endembed": { - "prefix": "endembed", - "body": "{% endembed %}$0", - "description": "endembed" - }, - "endfilter": { - "prefix": "endfilter", - "body": "{% endfilter %}$0", - "description": "endfilter" - }, - "endfor": { - "prefix": "endfor", - "body": "{% endfor %}$0", - "description": "endfor" - }, - "endif": { - "prefix": "endif", - "body": "{% endif %}$0", - "description": "endif" - }, - "endifchildren": { - "prefix": "endifchildren", - "body": "{% endifchildren %}$0", - "description": "endifchildren" - }, - "endcss": { - "prefix": "endcss", - "body": "{% endcss %}$0", - "description": "endcss" - }, - "endjs": { - "prefix": "endjs", - "body": "{% endjs %}$0", - "description": "endjs" - }, - "endmacro": { - "prefix": "endmacro", - "body": "{% endmacro %}$0", - "description": "endmacro" - }, - "endnav": { - "prefix": "endnav", - "body": "{% endnav %}$0", - "description": "endnav" - }, - "endset": { - "prefix": "endset", - "body": "{% endset %}$0", - "description": "endset" - }, - "endspaceless": { - "prefix": "endspaceless", - "body": "{% endspaceless %}$0", - "description": "endspaceless" - }, - "endswitch": { - "prefix": "endswitch", - "body": "{% endswitch %}$0", - "description": "endswitch" - }, - "endtrans": { - "prefix": "endtrans", - "body": "{% endtrans %}$0", - "description": "endtrans" - }, - "endverbatim": { - "prefix": "endverbatim", - "body": "{% endverbatim %}$0", - "description": "endverbatim" - }, - "exit": { - "prefix": "exit", - "body": "{% exit ${1:404} %}", - "description": "exit" - }, - "extends": { - "prefix": "extends", - "body": "{% extends \"${1:template}\" %}$0", - "description": "extends" - }, - "filterb": { - "prefix": "filterb", - "body": "{% filter ${1:name} %}\n\t$0\n{% endfilter %}", - "description": "filter (block)" - }, - "filter": { - "prefix": "filter", - "body": "{% filter ${1:name} %}$0{% endfilter %}", - "description": "filter" - }, - "floor": { - "prefix": "floor", - "body": "floor($1)$0", - "description": "floor" - }, - "fore": { - "prefix": "fore", - "body": - "{% for ${1:item} in ${2:items} %}\n\t$3\n{% else %}\n\t$0\n{% endfor %}", - "description": "for ... else" - }, - "for": { - "prefix": "for", - "body": "{% for ${1:item} in ${2:items} %}\n\t$0\n{% endfor %}", - "description": "for" - }, - "from": { - "prefix": "from", - "body": "{% from \"${1:template}\" import \"${2:macro}\" %}$0", - "description": "from" - }, - "endbody": { - "prefix": "endbody", - "body": "{{ endBody() }}\n$0", - "description": "endBody" - }, - "head": { - "prefix": "head", - "body": "{{ head() }}\n$0", - "description": "head" - }, - "if": { - "prefix": "if", - "body": "{% if ${1:condition} %}$2{% endif %}\n$0", - "description": "if" - }, - "ifb": { - "prefix": "ifb", - "body": "{% if ${1:condition} %}\n\t$0\n{% endif %}", - "description": "if (block)" - }, - "ife": { - "prefix": "ife", - "body": "{% if ${1:condition} %}\n\t$2\n{% else %}\n\t$0\n{% endif %}", - "description": "if ... else" - }, - "if1": { - "prefix": "if", - "body": "{% if ${1:condition} %}$0{% endif %}", - "description": "if" - }, - "ifchildren": { - "prefix": "ifchildren", - "body": "{% ifchildren %}\n\t$1\n{% endifchildren %}\n$0", - "description": "ifchildren" - }, - "import": { - "prefix": "import", - "body": "{% import \"${1:template}\" as ${2:name} %}$0", - "description": "import" - }, - "importself": { - "prefix": "importself", - "body": "{% import _self as ${1:name} %}$0", - "description": "importself" - }, - "inckv": { - "prefix": "inckv", - "body": - "{% include \"${1:template}\" with {\n\t${2:key}: ${3:\"${4:value}\"}\n} %}\n$0", - "description": "include w/ key/value" - }, - "include": { - "prefix": "include", - "body": "{% include \"${1:template}\" %}$0", - "description": "include" - }, - "inc": { - "prefix": "inc", - "body": "{% include \"${1:template}\" %}$0", - "description": "inc" - }, - "incp": { - "prefix": "incp", - "body": "{% include \"${1:template}\"${2: with ${3:params} }%}$0", - "description": "include w/ params" - }, - "css1": { - "prefix": "css", - "body": "{% do view.registerCssFile(\"${1:/resources/css/global.css}\") %}\n$0", - "description": "registerCssFile" - }, - "js": { - "prefix": "js", - "body": "{% js %}\n\t$1\n{% endjs %}\n$0", - "description": "js" - }, - "js1": { - "prefix": "js", - "body": "{% do view.registerJsFile(\"${1:/resources/js/global.js}\") %}\n$0", - "description": "registerJsFile" - }, - "css": { - "prefix": "css", - "body": "{% css %}\n\t$1\n{% endcss %}\n$0", - "description": "css" - }, - "macro": { - "prefix": "macro", - "body": "{% macro ${1:name}(${2:params}) %}\n\t$0\n{% endmacro %}", - "description": "macro" - }, - "matrix": { - "prefix": "matrix", - "body": - "{% for block in ${1:entry.matrixFieldHandle}.all() %}\n\n\t{% if block.type == \"${2:blockHandle}\" %}\n\t\t{{ block.${3:fieldHandle} }}\n\t{% endif %}\n\n\t{% if block.type == \"${4:blockHandle}\" %}\n\t\t{{ block.${5:fieldHandle} }}\n\t{% endif %}\n\n{% endfor %}\n$0", - "description": "matrix" - }, - "matrixif": { - "prefix": "matrixif", - "body": - "{% for block in ${1:entry.matrixFieldHandle}.all() %}\n\n\t{% if block.type == \"${2:blockHandle}\" %}\n\t\t{{ block.${3:fieldHandle} }}\n\t{% endif %}\n\n\t{% if block.type == \"${4:blockHandle}\" %}\n\t\t{{ block.${5:fieldHandle} }}\n\t{% endif %}\n\n{% endfor %}\n$0", - "description": "matrixif" - }, - "matrixifelse": { - "prefix": "matrixifelse", - "body": - "{% for block in ${1:entry.matrixFieldHandle}.all() %}\n\n\t{% if block.type == \"${2:blockHandle}\" %}\n\n\t\t{{ block.${3:fieldHandle} }}\n\n\t{% elseif block.type == \"${4:blockHandle}\" %}\n\n\t\t$0\n\t\n\t{% endif %}\n\n{% endfor %}", - "description": "matrixifelse" - }, - "matrixswitch": { - "prefix": "matrixswitch", - "body": - "{% for block in ${1:entry.matrixFieldHandle}.all() %}\n\n\t{% switch block.type %}\n\n\t\t{% case \"${2:blockHandle}\" %}\n\n\t\t\t{{ block.${3:fieldHandle} }}\n\n\t\t{% case \"${4:blockHandle}\" %}\n\n\t\t\t$0\n\n\t{% endswitch %}\n\n{% endfor %}", - "description": "matrixswitch" - }, - "max": { - "prefix": "max", - "body": "max(${1:$2, $3})$0", - "description": "max" - }, - "min": { - "prefix": "min", - "body": "min(${1:$2, $3})$0", - "description": "min" - }, - "nav": { - "prefix": "nav", - "body": "{% nav ${1:item} in ${2:items} %}\n\t$3\n{% endnav %}\n$0", - "description": "nav" - }, - "paginate": { - "prefix": "paginate", - "body": - "{% paginate ${1:elements} as ${2:pageInfo}, ${3:pageEntries} %}\n\n{% for item in ${3:pageEntries} %}\n\t$0\n{% endfor %}\n\n{% if ${2:pageInfo}.prevUrl %}Previous Page{% endif %}\n{% if ${2:pageInfo}.nextUrl %}Next Page{% endif %}", - "description": "paginate simple" - }, - "paginate1": { - "prefix": "paginate", - "body": - "{# PAGINATION\n\t\t\nFor this pagination to work properly, we need to be sure to set\nthe paginateBase variable in the template we are including the \npagination in.\n\n{% set paginateBase = \"/blog/p\" %}\n#}\n\n{% if pageInfo.totalPages > 1 %}\n
    \n\t{% if pageInfo.currentPage != \"1\" %}\n\t\t
  • First Page
  • \n\t{% endif %}\n\n\t{% if pageInfo.prevUrl %}\n\t\t
  • Previous Page
  • \n\t{% endif %}\n\n\t{% for pageNumber in 1..pageInfo.totalPages %}\n\t\t
  • \n\t\t\t{{ pageNumber }}\n\t\t
  • \n\t{% endfor %}\n\n\t{% if pageInfo.nextUrl %}\n\t\t
  • Next Page
  • \n\t{% endif %}\n\n\t{% if pageInfo.currentPage != pageInfo.total %}\n\t\t
  • Last Page
  • \n\t{% endif %}\n
\n{% endif %}\n$0", - "description": "paginate advanced" - }, - "redirect": { - "prefix": "redirect", - "body": - "{% redirect \"${1:template/path or http://straightupcraft.com}\" %}\n$0", - "description": "redirect" - }, - "getparam": { - "prefix": "getparam", - "body": - "craft.app.request.getParam(${1:\"Query String or Post Variable Name\"})\n$0", - "description": "request getParam" - }, - "getbodyparam": { - "prefix": "getbodyparam", - "body": "craft.app.request.getBodyParam(${1:\"postVariableName\"})\n$0", - "description": "request getBodyParam" - }, - "getqueryparam": { - "prefix": "getqueryparam", - "body": "craft.app.request.getQueryParam(${1:\"queryStringName\"})\n$0", - "description": "request getQueryParam" - }, - "getsegment": { - "prefix": "getsegment", - "body": "craft.app.request.getSegment(${1:2})\n$0", - "description": "request getSegment" - }, - "requirelogin": { - "prefix": "requirelogin", - "body": "{% requireLogin %}\n$0", - "description": "requireLogin" - }, - "requirepermission": { - "prefix": "requirepermission", - "body": "{% requirePermission \"${1:spendTheNight}\" %}\n$0", - "description": "requirePermission" - }, - "round": { - "prefix": "round", - "body": "{{ $1 | round(1, 'floor') }}$0", - "description": "round" - }, - "setb": { - "prefix": "setb", - "body": "{% set ${1:var} %}\n\t$0\n{% endset %}", - "description": "set (block)" - }, - "set": { - "prefix": "set", - "body": "{% set ${1:var} = ${2:value} %}$0", - "description": "set" - }, - "shuffle": { - "prefix": "shuffle", - "body": "shuffle($1)$0", - "description": "shuffle" - }, - "random": { - "prefix": "random", - "body": "random($1)$0", - "description": "random" - }, - "spaceless": { - "prefix": "spaceless", - "body": "{% spaceless %}\n\t$0\n{% endspaceless %}", - "description": "spaceless" - }, - "switch": { - "prefix": "switch", - "body": - "{% switch ${1:variable} %}\n\n\t{% case \"${2:value1}\" %}\n\t\n\n\t{% case \"${3:value2}\" %}\n\t\n\n\t{% default %}\n\t\n\n{% endswitch %}\n$0", - "description": "switch" - }, - "trans": { - "prefix": "trans", - "body": "{% trans %}$0{% endtrans %}", - "description": "trans" - }, - "urla": { - "prefix": "urla", - "body": - "url(\"${1:path}\", ${2:{foo:\"1\", bar:\"2\"\\}}, ${3:\"http\"}, ${4:false})$0", - "description": "url w/ arguments" - }, - "url": { - "prefix": "url", - "body": "url(\"${1:path}\")$0", - "description": "url" - }, - "use": { - "prefix": "use", - "body": "{% use \"${1:template}\" %}$0", - "description": "use" - }, - "verbatim": { - "prefix": "verbatim", - "body": "{% verbatim %}\n\t$0\n{% endverbatim %}", - "description": "verbatim" - } -} diff --git a/snippets/frameworks/vue/html.json b/snippets/frameworks/vue/html.json deleted file mode 100644 index 9cb50ff..0000000 --- a/snippets/frameworks/vue/html.json +++ /dev/null @@ -1,397 +0,0 @@ -{ - "template": { - "prefix": "template", - "body": [ - "" - ], - "description": "template element" - }, - "v-text": { - "prefix": "vText", - "body": [ - "v-text=\"${1:msg}\"" - ], - "description": "Expects: string. Updates the element’s textContent." - }, - "v-html": { - "prefix": "vHtml", - "body": [ - "v-html=\"${1:html}\"" - ], - "description": "Expects: string. Updates the element’s innerHTML." - }, - "v-show": { - "prefix": "vShow", - "body": [ - "v-show=\"${1:condition}\"" - ], - "description": "Expects: any" - }, - "v-if": { - "prefix": "vIf", - "body": [ - "v-if=\"${1:condition}\"" - ], - "description": "Expects: any" - }, - "v-else": { - "prefix": "vElse", - "body": [ - "v-else" - ], - "description": "Does not expect expression. previous sibling element must have v-if or v-else-if." - }, - "v-else-if": { - "prefix": "vElseIf", - "body": [ - "v-else-if=\"${1:condition}\"" - ], - "description": "Expects: any. previous sibling element must have v-if or v-else-if." - }, - "v-for-without-key": { - "prefix": "vForWithoutKey", - "body": [ - "v-for=\"${1:item} in ${2:items}\"" - ], - "description": "Expects: Array | Object | number | string" - }, - "v-for": { - "prefix": "vFor", - "body": [ - "v-for=\"(${1:item}, ${2:index}) in ${3:items}\" :key=\"${4:index}\"" - ], - "description": "Expects: Array | Object | number | string" - }, - "v-on": { - "prefix": "vOn", - "body": [ - "v-on:${1:event}=\"${2:handle}\"" - ], - "description": "Expects: Function | Inline Statement" - }, - "v-bind": { - "prefix": "vBind", - "body": [ - "v-bind$1=\"${2}\"" - ], - "description": "Expects: any (with argument) | Object (without argument)" - }, - "v-model": { - "prefix": "vModel", - "body": [ - "v-model=\"${1:something}\"" - ], - "description": "Expects: varies based on value of form inputs element or output of components" - }, - "v-slot": { - "prefix": "vSlot", - "body": [ - "v-slot$1=\"${2}\"" - ], - "description": "Expects: JavaScript expression that is valid in a function argument position (supports destructuring in supported environments). Optional - only needed if expecting props to be passed to the slot." - }, - "v-pre": { - "prefix": "vPre", - "body": [ - "v-pre" - ], - "description": "Does not expect expression" - }, - "v-cloak": { - "prefix": "vCloak", - "body": [ - "v-cloak" - ], - "description": "Does not expect expression" - }, - "v-once": { - "prefix": "vOnce", - "body": [ - "v-once" - ], - "description": "Does not expect expression" - }, - "key": { - "prefix": "key", - "body": [ - ":key=\"${1:key}\"" - ], - "description": "Expects: string. Children of the same common parent must have unique keys. Duplicate keys will cause render errors." - }, - "ref": { - "prefix": "ref", - "body": [ - "ref=\"${1:reference}\"$0" - ], - "description": "Expects: string. ref is used to register a reference to an element or a child component. The reference will be registered under the parent component’s $refs object. If used on a plain DOM element, the reference will be that element; if used on a child component, the reference will be component instance." - }, - "slotA": { - "prefix": "slotA", - "body": [ - "slot=\"$1\"$0" - ], - "description": "slot=''. Expects: string. Used on content inserted into child components to indicate which named slot the content belongs to." - }, - "slotE": { - "prefix": "slotE", - "body": [ - "$2$0" - ], - "description": ". Expects: string. Used on content inserted into child components to indicate which named slot the content belongs to." - }, - "slotScope": { - "prefix": "slotScope", - "body": [ - "slot-scope=\"$1\"$0" - ], - "description": "Used to denote an element or component as a scoped slot. The attribute’s value should be a valid JavaScript expression that can appear in the argument position of a function signature. This means in supported environments you can also use ES2015 destructuring in the expression. Serves as a replacement for scope in 2.5.0+." - }, - "scope": { - "prefix": "scope", - "body": [ - "scope=\"${1:this api replaced by slot-scope in 2.5.0+}\"$0" - ], - "description": "Used to denote a