chore(nvim): cleanup, add fff.nvim

Signed-off-by: Ismo Vuorinen <ismo@ivuorinen.net>
This commit is contained in:
2025-12-22 16:16:15 +02:00
parent 5630200d95
commit 2979cc6cfc
13 changed files with 29 additions and 1717 deletions

View File

@@ -1,114 +0,0 @@
-- Everforest theme for Neovim
-- Generated from template - do not edit manually
local M = {}
M.colors = {
bg = '#2f383e',
bg1 = '#374247',
bg2 = '#404c51',
fg = '#d3c6aa',
red = '#e67e80',
orange = '#e69875',
yellow = '#dbbc7f',
green = '#a7c080',
aqua = '#83c092',
blue = '#7fbbb3',
purple = '#d699b6',
gray1 = '#7a8478',
gray2 = '#859289',
gray3 = '#9da9a0',
}
M.highlights = {
-- Editor highlights
Normal = { fg = M.colors.fg, bg = M.colors.bg },
NormalFloat = { fg = M.colors.fg, bg = M.colors.bg1 },
ColorColumn = { bg = M.colors.bg1 },
Conceal = { fg = M.colors.gray2 },
Cursor = { fg = M.colors.bg, bg = M.colors.fg },
lCursor = { fg = M.colors.bg, bg = M.colors.fg },
CursorIM = { fg = M.colors.bg, bg = M.colors.fg },
CursorColumn = { bg = M.colors.bg1 },
CursorLine = { bg = M.colors.bg1 },
Directory = { fg = M.colors.blue, bold = true },
DiffAdd = { fg = M.colors.green, bg = M.colors.bg },
DiffChange = { fg = M.colors.blue, bg = M.colors.bg },
DiffDelete = { fg = M.colors.red, bg = M.colors.bg },
DiffText = { fg = M.colors.yellow, bg = M.colors.bg },
EndOfBuffer = { fg = M.colors.gray2 },
ErrorMsg = { fg = M.colors.red, bold = true },
VertSplit = { fg = M.colors.gray2 },
Folded = { fg = M.colors.gray2, bg = M.colors.bg1 },
FoldColumn = { fg = M.colors.gray2, bg = M.colors.bg },
SignColumn = { fg = M.colors.fg, bg = M.colors.bg },
IncSearch = { fg = M.colors.bg, bg = M.colors.orange },
LineNr = { fg = M.colors.gray2 },
CursorLineNr = { fg = M.colors.yellow, bold = true },
MatchParen = { fg = M.colors.orange, bold = true },
ModeMsg = { fg = M.colors.fg, bold = true },
MoreMsg = { fg = M.colors.blue, bold = true },
NonText = { fg = M.colors.gray2 },
Pmenu = { fg = M.colors.fg, bg = M.colors.bg1 },
PmenuSel = { fg = M.colors.bg, bg = M.colors.blue },
PmenuSbar = { bg = M.colors.bg2 },
PmenuThumb = { bg = M.colors.gray2 },
Question = { fg = M.colors.yellow, bold = true },
QuickFixLine = { fg = M.colors.bg, bg = M.colors.yellow },
Search = { fg = M.colors.bg, bg = M.colors.yellow },
SpecialKey = { fg = M.colors.gray2 },
SpellBad = { fg = M.colors.red, undercurl = true },
SpellCap = { fg = M.colors.blue, undercurl = true },
SpellLocal = { fg = M.colors.aqua, undercurl = true },
SpellRare = { fg = M.colors.purple, undercurl = true },
StatusLine = { fg = M.colors.fg, bg = M.colors.bg1 },
StatusLineNC = { fg = M.colors.gray2, bg = M.colors.bg1 },
TabLine = { fg = M.colors.gray2, bg = M.colors.bg1 },
TabLineFill = { fg = M.colors.gray2, bg = M.colors.bg1 },
TabLineSel = { fg = M.colors.fg, bg = M.colors.bg },
Title = { fg = M.colors.orange, bold = true },
Visual = { bg = M.colors.bg2 },
VisualNOS = { fg = M.colors.gray2 },
WarningMsg = { fg = M.colors.yellow, bold = true },
Whitespace = { fg = M.colors.gray2 },
WildMenu = { fg = M.colors.bg, bg = M.colors.blue },
-- Syntax highlighting
Comment = { fg = M.colors.gray2 },
Constant = { fg = M.colors.purple },
String = { fg = M.colors.green },
Character = { fg = M.colors.green },
Number = { fg = M.colors.purple },
Boolean = { fg = M.colors.purple },
Float = { fg = M.colors.purple },
Identifier = { fg = M.colors.blue },
Function = { fg = M.colors.green },
Statement = { fg = M.colors.red },
Conditional = { fg = M.colors.red },
Repeat = { fg = M.colors.red },
Label = { fg = M.colors.orange },
Operator = { fg = M.colors.orange },
Keyword = { fg = M.colors.red },
Exception = { fg = M.colors.red },
PreProc = { fg = M.colors.aqua },
Include = { fg = M.colors.blue },
Define = { fg = M.colors.purple },
Macro = { fg = M.colors.purple },
PreCondit = { fg = M.colors.aqua },
Type = { fg = M.colors.yellow },
StorageClass = { fg = M.colors.orange },
Structure = { fg = M.colors.aqua },
Typedef = { fg = M.colors.yellow },
Special = { fg = M.colors.orange },
SpecialChar = { fg = M.colors.red },
Tag = { fg = M.colors.orange },
Delimiter = { fg = M.colors.gray2 },
SpecialComment = { fg = M.colors.aqua },
Debug = { fg = M.colors.red },
Underlined = { fg = M.colors.blue, underline = true },
Ignore = { fg = M.colors.gray2 },
Error = { fg = M.colors.red, bold = true },
Todo = { fg = M.colors.yellow, bold = true },
}
return M

View File

@@ -1,114 +0,0 @@
-- Everforest theme for Neovim
-- Generated from template - do not edit manually
local M = {}
M.colors = {
bg = '#f3ead3',
bg1 = '#ede6cf',
bg2 = '#e8e3cc',
fg = '#5c6a72',
red = '#e67e80',
orange = '#e69875',
yellow = '#dbbc7f',
green = '#a7c080',
aqua = '#83c092',
blue = '#7fbbb3',
purple = '#d699b6',
gray1 = '#a6b0a0',
gray2 = '#b3c0b0',
gray3 = '#c0cdb8',
}
M.highlights = {
-- Editor highlights
Normal = { fg = M.colors.fg, bg = M.colors.bg },
NormalFloat = { fg = M.colors.fg, bg = M.colors.bg1 },
ColorColumn = { bg = M.colors.bg1 },
Conceal = { fg = M.colors.gray2 },
Cursor = { fg = M.colors.bg, bg = M.colors.fg },
lCursor = { fg = M.colors.bg, bg = M.colors.fg },
CursorIM = { fg = M.colors.bg, bg = M.colors.fg },
CursorColumn = { bg = M.colors.bg1 },
CursorLine = { bg = M.colors.bg1 },
Directory = { fg = M.colors.blue, bold = true },
DiffAdd = { fg = M.colors.green, bg = M.colors.bg },
DiffChange = { fg = M.colors.blue, bg = M.colors.bg },
DiffDelete = { fg = M.colors.red, bg = M.colors.bg },
DiffText = { fg = M.colors.yellow, bg = M.colors.bg },
EndOfBuffer = { fg = M.colors.gray2 },
ErrorMsg = { fg = M.colors.red, bold = true },
VertSplit = { fg = M.colors.gray2 },
Folded = { fg = M.colors.gray2, bg = M.colors.bg1 },
FoldColumn = { fg = M.colors.gray2, bg = M.colors.bg },
SignColumn = { fg = M.colors.fg, bg = M.colors.bg },
IncSearch = { fg = M.colors.bg, bg = M.colors.orange },
LineNr = { fg = M.colors.gray2 },
CursorLineNr = { fg = M.colors.yellow, bold = true },
MatchParen = { fg = M.colors.orange, bold = true },
ModeMsg = { fg = M.colors.fg, bold = true },
MoreMsg = { fg = M.colors.blue, bold = true },
NonText = { fg = M.colors.gray2 },
Pmenu = { fg = M.colors.fg, bg = M.colors.bg1 },
PmenuSel = { fg = M.colors.bg, bg = M.colors.blue },
PmenuSbar = { bg = M.colors.bg2 },
PmenuThumb = { bg = M.colors.gray2 },
Question = { fg = M.colors.yellow, bold = true },
QuickFixLine = { fg = M.colors.bg, bg = M.colors.yellow },
Search = { fg = M.colors.bg, bg = M.colors.yellow },
SpecialKey = { fg = M.colors.gray2 },
SpellBad = { fg = M.colors.red, undercurl = true },
SpellCap = { fg = M.colors.blue, undercurl = true },
SpellLocal = { fg = M.colors.aqua, undercurl = true },
SpellRare = { fg = M.colors.purple, undercurl = true },
StatusLine = { fg = M.colors.fg, bg = M.colors.bg1 },
StatusLineNC = { fg = M.colors.gray2, bg = M.colors.bg1 },
TabLine = { fg = M.colors.gray2, bg = M.colors.bg1 },
TabLineFill = { fg = M.colors.gray2, bg = M.colors.bg1 },
TabLineSel = { fg = M.colors.fg, bg = M.colors.bg },
Title = { fg = M.colors.orange, bold = true },
Visual = { bg = M.colors.bg2 },
VisualNOS = { fg = M.colors.gray2 },
WarningMsg = { fg = M.colors.yellow, bold = true },
Whitespace = { fg = M.colors.gray2 },
WildMenu = { fg = M.colors.bg, bg = M.colors.blue },
-- Syntax highlighting
Comment = { fg = M.colors.gray2 },
Constant = { fg = M.colors.purple },
String = { fg = M.colors.green },
Character = { fg = M.colors.green },
Number = { fg = M.colors.purple },
Boolean = { fg = M.colors.purple },
Float = { fg = M.colors.purple },
Identifier = { fg = M.colors.blue },
Function = { fg = M.colors.green },
Statement = { fg = M.colors.red },
Conditional = { fg = M.colors.red },
Repeat = { fg = M.colors.red },
Label = { fg = M.colors.orange },
Operator = { fg = M.colors.orange },
Keyword = { fg = M.colors.red },
Exception = { fg = M.colors.red },
PreProc = { fg = M.colors.aqua },
Include = { fg = M.colors.blue },
Define = { fg = M.colors.purple },
Macro = { fg = M.colors.purple },
PreCondit = { fg = M.colors.aqua },
Type = { fg = M.colors.yellow },
StorageClass = { fg = M.colors.orange },
Structure = { fg = M.colors.aqua },
Typedef = { fg = M.colors.yellow },
Special = { fg = M.colors.orange },
SpecialChar = { fg = M.colors.red },
Tag = { fg = M.colors.orange },
Delimiter = { fg = M.colors.gray2 },
SpecialComment = { fg = M.colors.aqua },
Debug = { fg = M.colors.red },
Underlined = { fg = M.colors.blue, underline = true },
Ignore = { fg = M.colors.gray2 },
Error = { fg = M.colors.red, bold = true },
Todo = { fg = M.colors.yellow, bold = true },
}
return M

View File

@@ -32,24 +32,6 @@ K.nl('o', function() require('snacks').gitbrowse() end, 'Open repo in browser')
K.n('<C-s>', ':w!<cr>', { desc = 'Save', noremap = true })
K.n('<esc><esc>', ':nohlsearch<cr>', { desc = 'Clear Search Highlighting' })
-- ── ToggleTerm ──────────────────────────────────────────────────────
K.d('<F1>', 'n', ':FloatermToggle<CR>', 'Toggle Floaterm')
K.d('<F1>', 'i', '<Esc>:FloatermToggle<CR>', 'Toggle Floaterm')
K.d('<F1>', 't', '<C-\\><C-n>:FloatermToggle<CR>', 'Toggle Floaterm')
-- ── Test operations ─────────────────────────────────────────────────
K.nl('an', ':silent TestNearest<CR>', 'Test Nearest')
K.nl('af', ':silent TestFile<CR>', 'Test File')
K.nl('as', ':silent TestSuite<CR>', 'Test Suite')
K.nl('al', ':silent TestLast<CR>', 'Test Last')
K.nl('av', ':silent TestVisit<CR>', 'Test Visit')
-- ── PHPActor Operations ─────────────────────────────────────────────
K.nl('apm', ':PhpactorContextMenu<cr>', 'PHPactor: Context Menu')
K.nl('apn', ':PhpactorClassNew<cr>', 'PHPactor: Class New')
K.nl('aps', ':PhpactorClassSearch<cr>', 'PHPactor: Class Search')
K.nl('apt', ':PhpactorTransform<cr>', 'PHPactor: Transform')
-- ── Buffer operations ───────────────────────────────────────────────
-- Mappings for buffer management operations like switching, deleting, etc.
-- Convention: All mappings start with 'b' followed by the operation
@@ -100,32 +82,21 @@ K.nl('cbt', '<Cmd>CBllline<CR>', 'CB: Titled Line')
-- Convention: All mappings start with 's' followed by the operation
-- unless it's a generic operation like searching or finding buffers
local fuzzy_search = function()
require('telescope.builtin').find_files(require('telescope.themes').get_dropdown {
winblend = 20,
previewer = true,
})
end
local lazy_plugins = function()
return require('telescope').extensions.lazy_plugins.lazy_plugins()
end
K.nl('f', ':Telescope find_files<cr>', 'Find Files')
K.nl('f', function() require('fff').find_files() end, 'Find Files')
K.nl(',', ':Telescope buffers<cr>', 'Find existing buffers')
K.nl('/', function() fuzzy_search() end, 'Fuzzily search in current buffer')
K.nl('sc', ':Telescope commands<cr>', 'Commands')
K.nl('sd', ':Telescope diagnostics<cr>', 'Search Diagnostics')
K.nl('sg', ':Telescope live_grep<cr>', 'Search by Grep')
K.nl('sf', ':Telescope grep_string<cr>', 'Grep String')
K.nl('sh', ':Telescope help_tags<cr>', 'Help tags')
K.nl('sk', ':Telescope keymaps<cr>', 'Search Keymaps')
K.nl('sl', ':Telescope luasnip<CR>', 'Search LuaSnip')
K.nl('so', ':Telescope oldfiles<CR>', 'Old Files')
K.nl('sp', function() lazy_plugins() end, 'Lazy Plugins')
K.nl('sq', ':Telescope quickfix<cr>', 'Quickfix')
K.nl('ss', ':Telescope treesitter<cr>', 'Treesitter')
K.nl('sw', ':Telescope grep_string<cr>', 'Grep String')
K.nl('sx', ':Telescope import<cr>', 'Telescope: Import')
-- ── Trouble operations ──────────────────────────────────────────────
@@ -156,13 +127,4 @@ K.nl('qQ', function()
end
end, 'Force quit without saving')
-- ── Flash.nvim keymaps ──────────────────────────────────────────────
local nxo = { 'n', 'x', 'o' }
local fj = function() return require('flash').jump() end
local ft = function() return require('flash').treesitter() end
local fx = function() return require('flash').toggle() end
K.d('zk', nxo, fj, { desc = 'Flash' })
K.d('Zk', nxo, ft, { desc = 'Flash Treesitter' })
K.d('<m-s>', 'c', fx, { desc = 'Toggle Flash Search' })
-- That concludes the keymaps section of the config.

View File

@@ -3,7 +3,7 @@ return {
-- https:/github.com/saghen/blink.cmp
{
'saghen/blink.cmp',
version = '1.*',
version = '*',
lazy = false, -- lazy loading handled internally
dependencies = {
-- Compatibility layer for using nvim-cmp sources on blink.cmp
@@ -18,15 +18,6 @@ return {
},
},
{ 'L3MON4D3/LuaSnip', version = 'v2.*', build = 'make install_jsregexp' },
-- Set of preconfigured snippets for different languages.
-- https://github.com/rafamadriz/friendly-snippets
{
'rafamadriz/friendly-snippets',
config = function() require('luasnip.loaders.from_vscode').lazy_load() end,
},
-- Lua plugin to turn github copilot into a cmp source
-- https://github.com/giuxtaposition/blink-cmp-copilot
{
@@ -54,7 +45,6 @@ return {
},
---@module 'blink.cmp'
opts = {
snippets = { preset = 'luasnip' },
-- 'default' for mappings similar to built-in completion
-- 'super-tab' for mappings similar to vscode (tab to accept,
-- arrow keys to navigate)

View File

@@ -1,16 +1,4 @@
return {
-- Terminal manager for (neo)vim
-- https://github.com/voldikss/vim-floaterm
{
'voldikss/vim-floaterm',
lazy = true,
cmd = { 'FloatermToggle' },
init = function()
vim.g.floaterm_width = 0.8
vim.g.floaterm_height = 0.8
end,
},
{
'ivuorinen/nvim-shellspec',
ft = 'shellspec',
@@ -39,112 +27,6 @@ return {
config = function() end,
},
-- Run your tests at the speed of thought
-- https://github.com/vim-test/vim-test
{
'vim-test/vim-test',
dependencies = { 'voldikss/vim-floaterm' },
config = function()
vim.cmd [[
function! PhpUnitTransform(cmd) abort
return join(map(split(a:cmd), 'v:val == "--colors" ? "--colors=always" : v:val'))
endfunction
let g:test#custom_transformations = {'phpunit': function('PhpUnitTransform')}
let g:test#transformation = 'phpunit'
" let test#php#phpunit#options = '--colors=always'
let test#php#pest#options = '-v'
let test#javascript#jest#options = '--color'
function! FloatermStrategy(cmd)
execute 'silent FloatermSend q'
execute 'silent FloatermKill'
execute 'FloatermNew! '.a:cmd.' | less -X'
endfunction
let g:test#custom_strategies = {'floaterm': function('FloatermStrategy')}
let g:test#strategy = 'floaterm'
]]
end,
},
-- projectionist.vim: Granular project configuration
-- https://github.com/tpope/vim-projectionist
{
'tpope/vim-projectionist',
dependencies = 'tpope/vim-dispatch',
config = function()
vim.g.projectionist_heuristics = {
artisan = {
['*'] = {
start = 'php artisan serve',
console = 'php artisan tinker',
},
['app/*.php'] = {
type = 'source',
alternate = {
'tests/Unit/{}Test.php',
'tests/Feature/{}Test.php',
},
},
['tests/Feature/*Test.php'] = {
type = 'test',
alternate = 'app/{}.php',
},
['tests/Unit/*Test.php'] = {
type = 'test',
alternate = 'app/{}.php',
},
['app/Models/*.php'] = {
type = 'model',
},
['app/Http/Controllers/*.php'] = {
type = 'controller',
},
['routes/*.php'] = {
type = 'route',
},
['database/migrations/*.php'] = {
type = 'migration',
},
},
['src/&composer.json'] = {
['src/*.php'] = {
type = 'source',
alternate = {
'tests/{}Test.php',
},
},
['tests/*Test.php'] = {
type = 'test',
alternate = 'src/{}.php',
},
},
['app/&composer.json'] = {
['app/*.php'] = {
type = 'source',
alternate = {
'tests/{}Test.php',
},
},
['tests/*Test.php'] = {
type = 'test',
alternate = 'app/{}.php',
},
},
}
end,
},
-- A vim text object for XML/HTML attributes.
-- https://github.com/whatyouhide/vim-textobj-xmlattr
{
'whatyouhide/vim-textobj-xmlattr',
dependencies = { 'kana/vim-textobj-user' },
ft = { 'html', 'xml', 'javascriptreact', 'typescriptreact', 'vue' },
},
-- Clarify and beautify your comments using boxes and lines.
-- https://github.com/LudoPinelli/comment-box.nvim
{

View File

@@ -7,41 +7,19 @@ return {
cmd = 'Telescope',
dependencies = {
{ 'nvim-lua/plenary.nvim' },
{ 'nvim-telescope/telescope-symbols.nvim' },
-- Telescope plugin for file browsing
{ 'nvim-telescope/telescope-file-browser.nvim' },
-- A Telescope picker to quickly access configurations
-- of plugins managed by lazy.nvim.
-- https://github.com/polirritmico/telescope-lazy-plugins.nvim
{ 'polirritmico/telescope-lazy-plugins.nvim' },
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'make',
cond = vim.fn.executable 'make' == 1,
},
},
config = function()
local t = require 'telescope'
local a = require 'telescope.actions'
local c = require 'telescope.config'
local open_with_trouble = require('trouble.sources.telescope').open
local add_to_trouble = require('trouble.sources.telescope').add
-- Clone the default Telescope configuration
local vimgrep_arguments = { unpack(c.values.vimgrep_arguments) }
-- I want to search in hidden/dot files.
table.insert(vimgrep_arguments, '--hidden=true')
table.insert(vimgrep_arguments, '--glob')
-- I don't want to search in the `.git` directory.
table.insert(vimgrep_arguments, '!**/.git/*')
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
t.setup {
@@ -49,17 +27,8 @@ return {
preview = {
filesize_limit = 0.1, -- MB
},
-- `hidden = true` is not supported in text grep commands.
vimgrep_arguments = vimgrep_arguments,
layout_strategy = 'horizontal',
pickers = {
find_files = {
-- `hidden = true` will still show the inside of `.git/` as
-- it's not `.gitignore`d.
find_command = { 'rg', '--files', '--hidden', '--glob', '!**/.git/*' },
theme = 'dropdown',
},
mappings = {
i = {
['<C-s>'] = a.cycle_previewers_next,
@@ -86,19 +55,6 @@ return {
enable = true,
additional_vim_regex_highlighting = false,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<CR>',
node_incremental = '<CR>',
scope_incremental = '<TAB>',
node_decremental = '<S-TAB>',
},
},
context_commentstring = {
enable = true,
enable_autocmd = false,
},
extensions = {
lazy_plugins = {
-- Must be a valid path to the file containing the lazy spec and setup() call.
@@ -108,16 +64,7 @@ return {
}
-- Load extensions
pcall(t.load_extension, 'git_worktree')
pcall(t.load_extension, 'lazy_plugins')
pcall(t.load_extension, 'luasnip')
pcall(t.load_extension, 'import')
-- Enable telescope fzf native, if installed
pcall(t.load_extension, 'fzf')
-- [[ Telescope Keymaps ]]
-- See `:help telescope.builtin`
-- See `:help telescope.keymap`
end,
}

View File

@@ -18,17 +18,11 @@ return {
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = {
'bash',
'json',
'jsonc',
'lua',
'luadoc',
'markdown',
'markdown_inline',
'query',
'regex',
'vim',
'vimdoc',
'yaml',
},
@@ -54,9 +48,6 @@ return {
if require('nvim-treesitter.parsers').has_parser() then
vim.opt.foldmethod = 'expr'
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
else
-- Otherwise, set foldmethod to syntax
vim.opt.foldmethod = 'syntax'
end
vim.opt.foldlevel = 9 -- Open all folds by default

View File

@@ -80,33 +80,6 @@ return {
vim.cmd.colorscheme 'catppuccin'
end,
},
-- {
-- 'neanias/everforest-nvim',
-- version = false,
-- lazy = false,
-- priority = 1000, -- make sure to load this before all the other start plugins
-- config = function()
-- require('everforest').setup {
-- background = 'medium', -- hard, medium, soft
-- transparent_background_level = 2, -- 0, 1, 2
-- sign_column_background = 'grey', -- none, grey
-- disable_italic_comments = false,
-- diagnostic_virtual_text = 'coloured', -- coloured, gray, underline, none
-- diagnostic_line_highlight = true,
-- diagnostic_line_highlight_background = 'dimmed', -- dimmed, normal
-- diagnostic_text_highlight = true,
-- ui_contrast = 'low', -- high, low
-- italics = true,
-- spell_foreground = true,
-- show_eob = true,
-- colours_override = function() end,
-- float_style = 'dim',
-- on_highlights = function(_, _) end,
-- dim_inactive_windows = true,
-- inlay_hints_background = 'dimmed',
-- }
-- end,
-- },
-- Automatic dark mode
-- https://github.com/f-person/auto-dark-mode.nvim
@@ -139,39 +112,32 @@ return {
},
},
-- Remove all background colors to make nvim transparent
-- https://github.com/xiyaowong/nvim-transparent
-- {
-- 'xiyaowong/nvim-transparent',
-- lazy = false,
-- enabled = true,
-- config = function()
-- local t = require 'transparent'
-- t.setup {
-- extra_groups = {
-- 'NormalNC',
-- 'NormalFloat',
-- 'EndOfBuffer',
-- 'FloatTitle',
-- 'FloatBorder',
-- 'NotifyDEBUGBorder',
-- 'NotifyERRORBorder',
-- 'NotifyINFOBorder',
-- 'NotifyINFOBorder73',
-- 'NotifyINFOBorder75',
-- 'NotifyINFOBorder101',
-- 'NotifyTRACEBorder',
-- 'NotifyWARNBorder',
-- 'NotifyBackground',
-- 'TelescopeBorder',
-- 'TelescopePromptBorder',
-- 'TelescopeResultsBorder',
-- 'TelescopePreviewBorder',
-- },
-- }
-- t.clear_prefix 'NeoTree'
-- end,
-- },
{
'dmtrKovalenko/fff.nvim',
build = function()
-- this will download prebuild binary or try to use existing rustup toolchain to build from source
-- (if you are using lazy you can use gb for rebuilding a plugin if needed)
require('fff.download').download_or_build_binary()
end,
-- if you are using nixos
-- build = "nix run .#release",
opts = { -- (optional)
debug = {
enabled = true, -- we expect your collaboration at least during the beta
show_scores = true, -- to help us optimize the scoring system, feel free to share your scores!
},
},
-- No need to lazy-load with lazy.nvim.
-- This plugin initializes itself lazily.
lazy = false,
keys = {
{
'ff', -- try it if you didn't it is a banger keybinding for a picker
function() require('fff').find_files() end,
desc = 'FFFind files',
},
},
},
-- Display a character as the colorcolumn
-- https://github.com/lukas-reineke/virt-column.nvim

View File

@@ -1,462 +0,0 @@
{
"While ..": {
"body": [
"while (${1:condition}) {",
"\t$0",
"}"
],
"prefix": "while .."
},
"argv (node)": {
"body": "const argv = process.argv.slice(2);",
"description": "Arguments from the command line. [0] is the node executable path, [1] the path of the file being executed, making [2] the first positional argument.",
"prefix": "argv (node)"
},
"cast (JSDoc)": {
"body": "/** @type {${1:string}} */ (${2:bracketedVar})",
"prefix": "cast (JSDoc)"
},
"class (JSDoc) + typedef (JSDoc)": {
"body": [
"/** @typedef {Object} ${1:name}",
" * @property {${2:string}} ${3:prop1}",
" */"
],
"description": "https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#typedef-callback-and-param",
"prefix": [
"class (JSDoc)",
"typedef (JSDoc)"
]
},
"do .. while ..": {
"body": [
"do {",
"\t$0",
"} while (${1:condition});"
],
"prefix": [
"do .. while",
"repeat until"
]
},
"ec (export const)": {
"body": "export const ${1:CONSTANT}",
"prefix": "ec (export const)"
},
"ef (export function)": {
"body": [
"export function ${1:name}($2) {",
"\t$0",
"}"
],
"prefix": "ef (export function)"
},
"filter ( => )": {
"body": "filter(${1:item} => ${1:item}$0)",
"prefix": "filter ( => )"
},
"for (i++)": {
"body": [
"for (let i = 0; i < ${1:array}.length; i++) {",
"\tconst ${2:element} = ${1:array}[i];",
"\t$0",
"}"
],
"prefix": "for (i++)"
},
"for (i--)": {
"body": [
"for (let i = ${1:array}.length - 1; i >= 0; i--) {",
"\tconst ${2:element} = ${1:array}[i];",
"\t$0",
"}"
],
"prefix": "for (i--)"
},
"for (key, value)": {
"body": [
"for (const [key, value] of Object.entries(${1:dict})) {",
"\t$0",
"}"
],
"prefix": "for (key, value)"
},
"for .. in (key)": {
"body": [
"for (const ${1:key} in ${2:object}) {",
"\t$0",
"}"
],
"prefix": "for .. in (key)"
},
"for .. of (array)": {
"body": [
"for (const ${1:iterator} of ${2:array}) {",
"\t$0",
"}"
],
"prefix": "for .. of (array)"
},
"forEach": {
"body": [
"forEach(${1:item} => {",
"\t$0",
"});"
],
"prefix": "forEach =>"
},
"function_trad": {
"body": [
"function ${1:name}() {",
"\t$0",
"}"
],
"prefix": "function"
},
"if ..": {
"body": [
"if (${1:condition}) {",
"\t$0",
"}"
],
"prefix": "if"
},
"if .. else": {
"body": [
"if (${1:condition}) {",
"\t$0",
"} else {",
"\t",
"}"
],
"prefix": "if .. else"
},
"ignore (biome formatter)": {
"body": "// biome-ignore format: ${1:explanation}",
"description": "Ignores the next block of code.",
"prefix": "ignore (biome formatter)"
},
"ignore file (TypeScript) + nocheck (TypeScript)": {
"body": "// @ts-nocheck",
"prefix": [
"ignore file (TypeScript)",
"nocheck (TypeScript)"
]
},
"map ( () => {} )": {
"body": [
"map(${1:item} => {",
"\t$0",
"\treturn;",
"})"
],
"prefix": "map ( () => {} )"
},
"map ( => )": {
"body": "map(${1:item} => ${1:item}$0)",
"prefix": "map ( => )"
},
"reduce()": {
"body": [
".reduce((acc, ${1:item}) => {",
"\t$0",
"\treturn acc;",
"}, ${2:initialValue})"
],
"prefix": "reduce()"
},
"relative date": {
"body": [
"/**",
" * @param {string} absoluteDate string to be converted to a date",
" * @return {string} relative date",
" */",
"function relativeDate(absoluteDate) {",
"\tconst deltaSecs = (+new Date() - +new Date(absoluteDate)) / 1000;",
"\t/** @type {\"year\"|\"month\"|\"week\"|\"day\"|\"hour\"|\"minute\"|\"second\"} */",
"\tlet unit;",
"\tlet delta;",
"\tif (deltaSecs < 60) {",
"\t\tunit = \"second\";",
"\t\tdelta = deltaSecs;",
"\t} else if (deltaSecs < 60 * 60) {",
"\t\tunit = \"minute\";",
"\t\tdelta = Math.ceil(deltaSecs / 60);",
"\t} else if (deltaSecs < 60 * 60 * 24) {",
"\t\tunit = \"hour\";",
"\t\tdelta = Math.ceil(deltaSecs / 60 / 60);",
"\t} else if (deltaSecs < 60 * 60 * 24 * 7) {",
"\t\tunit = \"day\";",
"\t\tdelta = Math.ceil(deltaSecs / 60 / 60 / 24);",
"\t} else if (deltaSecs < 60 * 60 * 24 * 7 * 4) {",
"\t\tunit = \"week\";",
"\t\tdelta = Math.ceil(deltaSecs / 60 / 60 / 24 / 7);",
"\t} else if (deltaSecs < 60 * 60 * 24 * 7 * 4 * 12) {",
"\t\tunit = \"month\";",
"\t\tdelta = Math.ceil(deltaSecs / 60 / 60 / 24 / 7 / 4);",
"\t} else {",
"\t\tunit = \"year\";",
"\t\tdelta = Math.ceil(deltaSecs / 60 / 60 / 24 / 7 / 4 / 12);",
"\t}",
"\tconst formatter = new Intl.RelativeTimeFormat(\"en\", { style: \"long\", numeric: \"auto\" });",
"\treturn formatter.format(-delta, unit);",
"}"
],
"prefix": "relative date"
},
"replace": {
"body": "replace(/${1:regexp}/, \"$2\")",
"prefix": "replace"
},
"sort ( () => {} )": {
"body": [
"sort((a, b) => {",
"\treturn ${1:b - a};",
"})"
],
"description": "Sort Array with basic a-b-comparator function",
"prefix": "sort ( () => {} )"
},
"split by \\n": {
"body": ".split(\"\\n\")",
"prefix": ".split by \\n"
},
"split by \\r": {
"body": ".split(\"\\r\")",
"description": "required for output from app.doShellScript()",
"prefix": ".split by \\r"
},
"switch .. case": {
"body": [
"switch (${1:key}) {",
"\tcase ${2:value}:",
"\t\t$0",
"\t\tbreak;",
"\tdefault:",
"}"
],
"prefix": "switch .. case"
},
"ternary": {
"body": "${1:condition} ? ${2:value1} : ${3:value2}",
"prefix": "ternary"
},
"thousand separator": {
"body": ".toLocaleString(\"de-DE\")",
"description": "insert thousand separator into a digit string",
"prefix": "thousand separator"
},
"timeout + delay": {
"body": [
"setTimeout(() => {",
"\t$0",
"}, ${1:timeoutMs});"
],
"prefix": [
"timeout",
"delay"
]
},
"today as ISO 8601 string": {
"body": "new Date().toISOString().slice(0, 10);",
"prefix": "ISO date"
},
"today's date": {
"body": "const today = new Date();",
"prefix": [
"today",
"date"
]
},
"tomorrow's date": {
"body": [
"const tomorrow = new Date();",
"tomorrow.setDate(tomorrow.getDate() + 1);"
],
"prefix": [
"tomorrow",
"date"
]
},
"try .. catch": {
"body": [
"try {",
"\t$0",
"} catch (_error) {",
"\t",
"}"
],
"description": "leading underscore so the variable is ignored by biome when not used.",
"prefix": "try .. catch"
},
"type (JSDoc)": {
"body": "/** @type {${1:string}} */",
"prefix": "type (JSDoc)"
},
"type: Record (JSDoc)": {
"body": "/** @type {Record<string, string>} */",
"prefix": "type: Record (JSDoc)"
},
"unique items": {
"body": "${1:arr} = [...new Set(${2:arr})];",
"prefix": "unique items"
},
"Class": {
"prefix": [
"clax"
],
"body": [
"export class $1 ${2:extends ${3:Parent} }{",
"\tconstructor(${4:props}) {",
"\t\tthis.$4 = $4;",
"\t}",
"",
"\t$0",
"}"
],
"description": "Class definition template."
},
"test": {
"prefix": [
"it"
],
"body": [
"it('${1:should ${2}}', async () => {",
"\t$0",
"});"
],
"description": "Test template"
},
"method": {
"prefix": [
"mtd"
],
"body": [
"${1:async ${2:method}}(${3:params}) {",
"\t$0",
"}"
],
"description": "method"
},
"function": {
"prefix": [
"fun"
],
"body": [
"${1:async }${2:(${3:params})} => {$0}"
],
"description": "function"
},
"const": {
"prefix": [
"const"
],
"body": [
"const $1 = $0;"
],
"description": "const"
},
"let": {
"prefix": [
"let"
],
"body": [
"let $1 = $0;"
],
"description": "let"
},
"Console log": {
"prefix": [
"cl"
],
"body": [
"console.log($0);"
],
"description": "Console log"
},
"Console debug": {
"prefix": [
"cd"
],
"body": [
"console.debug($0);"
],
"description": "Console debug"
},
"Console log all": {
"prefix": [
"clj"
],
"body": [
"console.log(JSON.stringify($0, null, 2));"
],
"description": "Console log whole object"
},
"Console debug all": {
"prefix": [
"cdj"
],
"body": [
"console.debug(JSON.stringify($0, null, 2));"
],
"description": "Console debug whole object"
},
"If": {
"prefix": [
"if"
],
"body": [
"if (${1:condition}) {",
"\t$0",
"}"
],
"description": "Console debug whole object"
},
"If-else": {
"prefix": [
"ifelse"
],
"body": [
"if (${1:condition}) {",
"\t$2",
"} else {",
"\t$0",
"}"
],
"description": "Console debug whole object"
},
"docblock": {
"prefix": [
"/**"
],
"body": [
"/**",
" * $0",
" */"
]
},
"trycatch": {
"prefix": [
"tc"
],
"body": [
"try {",
"\t$0",
"} catch (e) {",
"\tthrow e;",
"}"
],
"description": "Try catch block"
},
"Describe test": {
"prefix": [
"desc"
],
"body": [
"describe('${1}', () => {",
"\t$0",
"})"
],
"description": "Describe test"
}
}

View File

@@ -1,262 +0,0 @@
{
"@class (LuaDoc)": {
"body": [
"---@class (exact) ${1:class_name}",
"---@field ${2:field_name} string"
],
"description": "https://github.com/LuaLS/lua-language-server/wiki/Annotations#class",
"prefix": "@class (LuaDoc)"
},
"@type (LuaDoc)": {
"body": "---@type ${1:string}",
"prefix": "@type (LuaDoc)"
},
"Record (type)": {
"body": "---@type table<string, string>",
"prefix": "Record (type)"
},
"count occurrences in string": {
"body": "local _, count = ${1:str}:gsub(\"${2:find}\", \"\")",
"prefix": "count occurrences in string"
},
"export module": {
"body": [
"local M = {}",
"--------------------------------------------------------------------------------",
"",
"$0--------------------------------------------------------------------------------",
"return M"
],
"prefix": "export module"
},
"find all in string": {
"body": [
"local ${1:matches} = {}",
"for match in ${2:str}:gmatch(${3:pattern}) do",
"\ttable.insert(${1:matches}, match)",
"end"
],
"prefix": "find all in string"
},
"for each (list)": {
"body": [
"for _, ${1:v} in pairs(${2:table}) do",
"\t$0",
"end"
],
"prefix": "for each (list)"
},
"for each line (of file)": {
"body": [
"for line in io.lines(${1:filepath}) do",
"\t$0",
"end"
],
"prefix": [
"for each line (file)",
"read file (as lines)"
]
},
"home": {
"body": "os.getenv(\"HOME\")",
"prefix": "home"
},
"if .. then .. else": {
"body": [
"if ${1:true} then",
"\t$2",
"else",
"\t$0",
"end"
],
"filetype": "lua",
"prefix": "if .. then .. else"
},
"nodiscard": {
"body": "---@nodiscard",
"description": "Luadoc Annotation that a function's return value should not be discarded. https://github.com/LuaLS/lua-language-server/wiki/Annotations#nodiscard",
"prefix": "nodiscard"
},
"path of this file": {
"body": "local pathOfThisFile = debug.getinfo(1).source:sub(2)",
"prefix": "path of this file"
},
"path separator (os-independent)": {
"body": "local osPathSep = package.config:sub(1, 1)",
"prefix": "path separator (os-independent)"
},
"pcall": {
"body": [
"local success = pcall(${1:func})",
"if not success then",
"\t$0",
"\treturn",
"end"
],
"prefix": [
"try",
"pcall"
]
},
"read file": {
"body": [
"---@param filePath string",
"---@return string? -- content or error message",
"---@return boolean success",
"local function readFile(filePath)",
"\tlocal file, err = io.open(filePath, \"r\")",
"\tif not file then return err, false end",
"\tlocal content = file:read(\"*a\")",
"\tfile:close()",
"\treturn content, true",
"end"
],
"prefix": "read file"
},
"redirect (metatable __index)": {
"body": [
"setmetatable(M, {",
"\t__index = function(_, key)",
"\t\treturn function(...)",
"\t\t\trequire(${1:moduleToRedirectTo})[key](...)",
"\t\tend",
"\tend,",
"})"
],
"prefix": "redirect (metatable __index)"
},
"round number": {
"body": "local roundedNum = tonumber(string.format(\"%.${1:decimals}f\", exactNum))",
"prefix": "round number"
},
"safe require": {
"body": [
"local ok, ${1:module} = require(\"${1:module}\")",
"if not (ok and ${1:module}) then return end",
"${1:module}.$0"
],
"prefix": "safe require"
},
"sort (table)": {
"body": "table.sort(${1:table}, function(a, b) return ${2:a} > ${3:b} end)",
"prefix": "sort (table)"
},
"split (gmatch)": {
"body": [
"local acc = {}",
"for part in ${1:str}:gmatch(\"(.-)\" .. ${2:delimiter}) do",
"\ttable.insert(acc, part)",
"end"
],
"filetype": "lua",
"prefix": "split (gmatch)"
},
"ternary": {
"body": "${1:condition} and ${2:value1} or ${3:value2}",
"prefix": "ternary"
},
"trim trailing line break": {
"body": ":gsub(\"\\n$\", \"\")",
"prefix": "trim"
},
"write file": {
"body": [
"---@param str string",
"---@param filePath string",
"---@return string|nil -- error message",
"local function overwriteFile(filePath, str)",
"\tlocal file, _ = io.open(filePath, \"w\")",
"\tif not file then return end",
"\tfile:write(str)",
"\tfile:close()",
"end"
],
"description": "Overwriting file, for appending use `a` instead of `w`.",
"prefix": "write file"
},
"Create Auto Command": {
"prefix": "autocmd",
"body": [
"vim.api.nvim_create_autocmd(\"${1:event}\", {",
" group = vim.api.nvim_create_augroup(\"${2:group}\", { clear = true }),",
" callback = function(ev)",
" ${0}",
" end",
"})"
]
},
"Create Auto Command Group": {
"prefix": "augroup",
"body": [
"vim.api.nvim_create_augroup(\"${1:group}\", { clear = true })$0"
]
},
"Current Win": {
"prefix": "win",
"body": "local win = vim.api.nvim_get_current_win()\n$0"
},
"Current Buf": {
"prefix": "buf",
"body": "local buf = vim.api.nvim_get_current_buf()\n$0"
},
"Buf Valid": {
"prefix": "bufvalid",
"body": "vim.api.nvim_buf_is_valid(${1:buf})"
},
"Win Valid": {
"prefix": "winvalid",
"body": "vim.api.nvim_win_is_valid(${1:win})"
},
"Win Call": {
"prefix": "wincall",
"body": [
"vim.api.nvim_win_call(${1:win}, function(win)",
" ${0}",
"end)"
]
},
"Buf Call": {
"prefix": "bufcall",
"body": [
"vim.api.nvim_buf_call(${1:buf}, function(buf)",
" ${0}",
"end)"
]
},
"Schedule": {
"prefix": "schedule",
"body": [
"vim.schedule(function()",
" ${0}",
"end)"
]
},
"Table Deep Extend": {
"prefix": "deepextend",
"body": "vim.tbl_deep_extend(\"force\", ${1:table}, ${2:table})$0"
},
"Table Filter": {
"prefix": "filter",
"body": [
"vim.tbl_filter(function()",
" $0",
"end, ${1:table})"
]
},
"Table Map": {
"prefix": "map",
"body": [
"vim.tbl_map(function()",
" $0",
"end, ${1:table})"
]
},
"Table Values": {
"prefix": "values",
"body": "vim.tbl_values(${1:table})"
},
"Table Keys": {
"prefix": "keys",
"body": "vim.tbl_keys(${1:table})"
}
}

View File

@@ -1,133 +0,0 @@
{
"Misc": {
"body": "Miscellaneous",
"prefix": "Misc"
},
"bash (Codeblock)": {
"body": [
"```bash",
"$CLIPBOARD$0",
"```"
],
"prefix": "bash (Codeblock)"
},
"caution (callout)": {
"body": [
"> [!CAUTION]",
"> $0"
],
"description": "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts",
"prefix": "caution (callout)"
},
"details & summary": {
"body": [
"<details>",
"<summary>${1:Text}</summary>",
"$0",
"</details>"
],
"description": "https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details",
"prefix": [
"toggle / fold",
"details & summary"
]
},
"ignore file (ltex)": {
"body": "<!-- LTeX: enabled=false -->",
"prefix": "ignore file (ltex)"
},
"image": {
"body": "<img src=\"${1:image_path}\" alt=\"${2:alt text}\" width=\"${3:50%}\">",
"description": "HTML syntax for images used to display images with reduced size",
"prefix": "image"
},
"important (callout)": {
"body": [
"> [!IMPORTANT]",
"> $0"
],
"description": "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts",
"prefix": "important (callout)"
},
"insert table 2x2": {
"body": [
"| ${1:Column1} | ${2:Column2} |",
"|--------------- | -------------- |",
"| ${3:Item1.1} | ${4:Item2.1} |"
],
"prefix": "table (2x2)"
},
"insert toc": {
"body": [
"## Table of Content",
"",
"<!-- toc -->"
],
"description": "https://github.com/jonschlinkert/markdown-toc#tocinsert",
"prefix": "insert toc"
},
"js (Codeblock)": {
"body": [
"```js",
"$CLIPBOARD$0",
"```"
],
"prefix": "js (Codeblock)"
},
"kbd": {
"body": "<kbd>$0</kbd>",
"description": "HTML tag for keys",
"prefix": "kbd"
},
"lua (Codeblock)": {
"body": [
"```lua",
"$CLIPBOARD$0",
"```"
],
"prefix": "lua (Codeblock)"
},
"note (GitHub callout)": {
"body": [
"> [!NOTE]",
"> $0"
],
"description": "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts",
"prefix": [
"info (callout)",
"note (callout)"
]
},
"py (Codeblock)": {
"body": [
"```py",
"$CLIPBOARD$0",
"```"
],
"prefix": "py (Codeblock)"
},
"tip (callout)": {
"body": [
"> [!TIP]",
"> $0"
],
"description": "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts",
"prefix": "tip (callout)"
},
"ts (Codeblock)": {
"body": [
"```ts",
"$CLIPBOARD$0",
"```"
],
"prefix": "ts (Codeblock)"
},
"warning (callout)": {
"body": [
"> [!WARNING]",
"> $0"
],
"description": "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts",
"prefix": "warning (callout)"
}
}

View File

@@ -1,334 +0,0 @@
{
"PATH (export)": {
"body": "export PATH=/usr/local/lib:/usr/local/bin:/opt/homebrew/bin/:\\$PATH",
"description": "Extends PATH in a way that homebrew installed CLIs are recognized in ARM and Intel Macs.",
"prefix": "PATH (export)"
},
"awk (get field)": {
"body": "awk '{ print $${1:1} }'",
"description": "Retrieve a field from the piped in string, with whitespace as the default field delimiter. `$n` means that the nth field will be used.",
"prefix": "awk (field)"
},
"check device name": {
"body": "scutil --get ComputerName | grep -q \"$0\"",
"prefix": "device name"
},
"check if dark mode (macOS)": {
"body": "defaults read -g AppleInterfaceStyle &>/dev/null; && echo 'isDark'",
"prefix": "check if dark mode (macOS)"
},
"check if in git repo": {
"body": "if ! git rev-parse --is-inside-work-tree &>/dev/null ; then print \"\\e[0;33mfile is not ins a git repository.\\e[0m\" && return 1 ; fi",
"prefix": "check if in git repo"
},
"check if installed": {
"body": [
"if [[ ! -x \"\\$(command -v ${1:cli})\" ]]; then print \"\\e[0;33m${1:cli} not installed.\\e[0m\" && return 1; fi",
"$0"
],
"description": "https://stackoverflow.com/a/26759734/22114136",
"prefix": "check if installed"
},
"check if on macOS": {
"body": "[[ \"\\$OSTYPE\" =~ \"darwin\" ]]",
"prefix": "check if on macOS"
},
"check if process is running": {
"body": "pgrep -xq \"${1:process}\" && $0",
"prefix": "check if process is running"
},
"check if sudo user": {
"body": "sudo -nv && ${1:some_sudo_action}",
"prefix": "check if sudo user"
},
"confirmation prompt": {
"body": [
"# confirmation prompt",
"print \"\\e[1;34m$0Proceed? (y/n)\\e[0m\"",
"read -rk pressed",
"echo",
"if [[ \"\\$pressed\" != \"y\" ]]; then",
"\techo \"Aborted.\"",
"\treturn 1",
"fi",
"echo"
],
"prefix": "confirmation prompt"
},
"default value": {
"body": "\\${${1:var}:-${2:default_value}}",
"prefix": "default value"
},
"directory of script": {
"body": "\"$(dirname \"$(readlink -f \"\\$0\")\")\"",
"prefix": "directory of this script"
},
"elseif": {
"body": "elif [[ ${1:condition} ]]; then\n\t${0}",
"description": "Add an elseif to an if statement.",
"prefix": "elseif"
},
"extension": {
"body": "ext=${${1:file_name}##*.}",
"prefix": "get extension"
},
"filename": {
"body": "file_name=$(basename \"$${1:file_path}\")",
"prefix": "filename"
},
"filename w/o ext": {
"body": "${1:file_name}=${${1:file_name}%.*}",
"prefix": "filename w/o ext"
},
"find & xargs": {
"body": "find . -print0 | xargs -0 -I '{}'",
"prefix": "find & xargs"
},
"find -exec": {
"body": "find . $0 -exec open '{}' \\;",
"prefix": "find -exec"
},
"for each file": {
"body": [
"for filename in *.txt; do",
"\techo \"\\$filename\"",
"done"
],
"prefix": "for each file"
},
"for each line (read)": {
"body": [
"while read -r line; do",
"\techo \"\\$line\"$0",
"done < \"\\$${1:input_file}\""
],
"prefix": "for each line (read)"
},
"for each line (variable)": {
"body": [
"echo \"\\$lines\" | while read -r line; do",
"\techo \"\\$line\"",
"done"
],
"prefix": "for each line (variable)"
},
"for i ..": {
"body": [
"for ((i = 0; i <= ${1:length}; i++)); do",
" echo \\$i$0",
"done"
],
"prefix": "for i .."
},
"function": {
"body": "function ${1:name} {\n\t${0}\n}",
"prefix": "function"
},
"get nth line from string": {
"body": "line=$(echo \"\\$${1:str}\" | sed -n \"${2:n}p\")",
"prefix": "get nth line from string"
},
"i++": {
"body": "((${1:i}++))",
"prefix": "i++"
},
"i--": {
"body": "((${1:i}--))",
"prefix": "i--"
},
"if (short)": {
"body": "[[ \"\\$${1:var}\" ]] && $0",
"prefix": "if (short)"
},
"if .. then": {
"body": [
"if [[ \"\\$${1:var}\" ]]; then",
"\t$0",
"fi"
],
"prefix": "if .. then"
},
"if .. then .. else": {
"body": [
"if [[ \"$${1:cond}\" ]]; then",
"\t$0",
"else",
"\t",
"fi"
],
"prefix": "if .. then .. else"
},
"input (stdin or $1)": {
"body": [
"if [[ $# -eq 0 ]]; then",
"\tinput=$(< /dev/stdin)",
"else",
"\tinput=\"$1\"",
"fi"
],
"description": "reads either from STDIN or $1. stdin may have unescaped newlines, which have to be removed, e.g. via `tr -d '\n'`.",
"prefix": "input (stdin or $1)"
},
"notify (msg)": {
"body": "osascript -e 'display notification \"\" with title \"${1:msg}\"'",
"prefix": "notify (msg)"
},
"notify (var)": {
"body": "osascript -e \"display notification \\\"\\\" with title \\\"$${1:var}\\\"\"",
"prefix": "notify (var)"
},
"null (pipe)": {
"body": "&> /dev/null",
"prefix": "null (pipe)"
},
"osascript jxa (run script)": {
"body": "osascript -l JavaScript \"${1:file}\"",
"prefix": [
"jxa (run script)",
"osascript -l JavaScript"
]
},
"plist: extract key": {
"body": "plutil -extract name.childkey xml1 -o - example.plist | sed -n 4p | cut -d'>' -f2 | cut -d'<' -f1",
"prefix": "plist: extract key"
},
"print in blue": {
"body": "print \"\\e[1;34m$0\\e[0m\"",
"prefix": "print in blue"
},
"progress bar": {
"body": [
"for _ in {1..100}; do",
"\tprintf \"\ud83e\udf0b\"",
"\tsleep 0.5",
"done"
],
"prefix": "progress bar"
},
"quicklook": {
"body": "qlmanage -p \"${1:filepath}\"",
"description": "QuickLook the file. MacOS only.",
"prefix": "quicklook"
},
"redirect to stderr": {
"body": ">&2",
"prefix": "redirect to stderr"
},
"resolve home": {
"body": "${1:path}=\"\\${${1:path}/#\\~/\\$HOME}\"",
"prefix": "resolve home"
},
"restart app": {
"body": [
"killall \"${1:app_name}\"",
"while pgrep -xq \"${1:app_name}\"; do sleep 0.1; done",
"open -a \"${1:app_name}\""
],
"description": "safely restart app, avoiding race condition",
"prefix": "restart app"
},
"sed substitution": {
"body": "sed 's/$0//'",
"prefix": "sed substitution"
},
"shebang": {
"body": "#!/usr/bin/env zsh",
"prefix": "shebang"
},
"slice": {
"body": "${1:var}=\"${${1:var}:${2:from}:${3:to}}\"",
"prefix": "slice"
},
"spinner": {
"body": [
"# spinner with 20s timeout",
"spinner=\"\u280b\u2819\u2839\u2838\u283c\u2834\u2826\u2827\u2807\u280f\"",
"for i in {1..100}; do",
"\tpos=\\$((i % \\${#spinner}))",
"\tprintf \"\\r%s\" \"\\${spinner:\\$pos:1}\"",
"\tsleep 0.2",
"done",
"printf \"\\r\" # remove spinner"
],
"prefix": "spinner"
},
"stderr (merge with stdout)": {
"body": "2>&1",
"prefix": "stderr (merge with stdout)"
},
"stdin": {
"body": "stdin=\\$(< /dev/stdin)",
"description": "$(cat) also works. See https://stackoverflow.com/questions/32363887/in-a-bash-function-how-do-i-get-stdin-into-a-variable",
"prefix": "stdin"
},
"stdout is to a terminal": {
"body": "[[ -t true ]]",
"prefix": "stdout is to a terminal"
},
"substitute": {
"body": "\\${${1:var}//${2:search}/${3:replace}}",
"description": "one slash for single substitution, two for global",
"prefix": "substitute (expansion)"
},
"suppress stderr": {
"body": "2>/dev/null",
"prefix": "suppress stderr"
},
"switch case": {
"body": [
"case $${1:var} in",
"\"one\" | \"two\")",
"\techo \"foo\"",
"\t;;",
"\"three\")",
"\techo \"bar\"",
"\t;;",
"*)",
"\techo \"default\"",
"\t;;",
"esac"
],
"description": "A case command first expands word, and tries to match it against each pattern in turn.",
"prefix": "switch case"
},
"ternary": {
"body": "\\$([[ \"${1:cond}\" ]] && echo \"${2:value1}\" || echo \"${3:value2}\")",
"prefix": "ternary"
},
"then": {
"body": "then\n\t$0\nfi",
"prefix": "then .. fi"
},
"today (ISO date) + now": {
"body": "${1:now}=\\$(date +\"%Y-%m-%d %H:%M:%S\")",
"prefix": [
"today (ISO date)",
"now"
]
},
"trim whitespace": {
"body": "${1:text}=$(echo -n \"$${1:text}\" | sed -e 's/^ *//' -e 's/ *$//')",
"prefix": "trim whitespace"
},
"urlEncode": {
"body": "osascript -l JavaScript -e \"encodeURIComponent('${1:text}')\"",
"prefix": "urlEncode"
},
"wait until app running": {
"body": "while ! pgrep -xq \"${1:app_name}\"; do sleep 0.1; done",
"prefix": "wait until app running"
},
"wait until app terminated": {
"body": "while pgrep -xq \"${1:app_name}\"; do sleep 0.1; done",
"prefix": "wait until app terminated"
},
"while": {
"body": "while [[ ${1:condition} ]]; do\n\t${0}\ndone\n",
"description": "A while loop by condition.",
"prefix": "while"
},
"xargs (for each line)": {
"body": "xargs -I {} ${1:some_cmd} '{}'",
"prefix": "xargs (for each line)"
}
}

View File

@@ -1,7 +0,0 @@
{
"schema (modeline)": {
"body": "# yaml-language-server: $$schema=${1:url}",
"description": "https://github.com/redhat-developer/yaml-language-server#using-inlined-schema",
"prefix": "schema (modeline)"
}
}