Initial commit
parent
db14bb9ac4
commit
3a820d6b4d
173
dot_zshrc
173
dot_zshrc
|
|
@ -1,173 +0,0 @@
|
|||
export ZSH="/home/torrpenn/.oh-my-zsh"
|
||||
|
||||
ZSH_THEME="robbyrussell"
|
||||
|
||||
plugins=(git history zsh-autosuggestions)
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# nvim configuration
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
|
||||
alias vim="nvim"
|
||||
alias vi="nvim"
|
||||
alias ls="lsd -l"
|
||||
|
||||
# tmux config
|
||||
export TERM="xterm-256color"
|
||||
alias tmux="tmux -2"
|
||||
|
||||
# This alias runs the Cursor Setup Wizard, simplifying installation and configuration.
|
||||
# For more details, visit: https://github.com/jorcelinojunior/cursor-setup-wizard
|
||||
alias cursor-setup="/home/theodugautier/cursor-setup-wizard/cursor_setup.sh"
|
||||
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# Utility functions for zoxide.
|
||||
#
|
||||
|
||||
# pwd based on the value of _ZO_RESOLVE_SYMLINKS.
|
||||
function __zoxide_pwd() {
|
||||
\builtin pwd -L
|
||||
}
|
||||
|
||||
# cd + custom logic based on the value of _ZO_ECHO.
|
||||
function __zoxide_cd() {
|
||||
# shellcheck disable=SC2164
|
||||
\builtin cd -- "$@"
|
||||
}
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# Hook configuration for zoxide.
|
||||
#
|
||||
|
||||
# Hook to add new entries to the database.
|
||||
function __zoxide_hook() {
|
||||
# shellcheck disable=SC2312
|
||||
\command zoxide add -- "$(__zoxide_pwd)"
|
||||
}
|
||||
|
||||
# Initialize hook.
|
||||
\builtin typeset -ga precmd_functions
|
||||
\builtin typeset -ga chpwd_functions
|
||||
# shellcheck disable=SC2034,SC2296
|
||||
precmd_functions=("${(@)precmd_functions:#__zoxide_hook}")
|
||||
# shellcheck disable=SC2034,SC2296
|
||||
chpwd_functions=("${(@)chpwd_functions:#__zoxide_hook}")
|
||||
chpwd_functions+=(__zoxide_hook)
|
||||
|
||||
# Report common issues.
|
||||
function __zoxide_doctor() {
|
||||
[[ ${_ZO_DOCTOR:-1} -ne 0 ]] || return 0
|
||||
[[ ${chpwd_functions[(Ie)__zoxide_hook]:-} -eq 0 ]] || return 0
|
||||
|
||||
_ZO_DOCTOR=0
|
||||
\builtin printf '%s\n' \
|
||||
'zoxide: detected a possible configuration issue.' \
|
||||
'Please ensure that zoxide is initialized right at the end of your shell configuration file (usually ~/.zshrc).' \
|
||||
'' \
|
||||
'If the issue persists, consider filing an issue at:' \
|
||||
'https://github.com/ajeetdsouza/zoxide/issues' \
|
||||
'' \
|
||||
'Disable this message by setting _ZO_DOCTOR=0.' \
|
||||
'' >&2
|
||||
}
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# When using zoxide with --no-cmd, alias these internal functions as desired.
|
||||
#
|
||||
|
||||
# Jump to a directory using only keywords.
|
||||
function __zoxide_z() {
|
||||
__zoxide_doctor
|
||||
if [[ "$#" -eq 0 ]]; then
|
||||
__zoxide_cd ~
|
||||
elif [[ "$#" -eq 1 ]] && { [[ -d "$1" ]] || [[ "$1" = '-' ]] || [[ "$1" =~ ^[-+][0-9]$ ]]; }; then
|
||||
__zoxide_cd "$1"
|
||||
elif [[ "$#" -eq 2 ]] && [[ "$1" = "--" ]]; then
|
||||
__zoxide_cd "$2"
|
||||
else
|
||||
\builtin local result
|
||||
# shellcheck disable=SC2312
|
||||
result="$(\command zoxide query --exclude "$(__zoxide_pwd)" -- "$@")" && __zoxide_cd "${result}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Jump to a directory using interactive search.
|
||||
function __zoxide_zi() {
|
||||
__zoxide_doctor
|
||||
\builtin local result
|
||||
result="$(\command zoxide query --interactive -- "$@")" && __zoxide_cd "${result}"
|
||||
}
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# Commands for zoxide. Disable these using --no-cmd.
|
||||
#
|
||||
|
||||
function z() {
|
||||
__zoxide_z "$@"
|
||||
}
|
||||
|
||||
function zi() {
|
||||
__zoxide_zi "$@"
|
||||
}
|
||||
|
||||
# Completions.
|
||||
if [[ -o zle ]]; then
|
||||
__zoxide_result=''
|
||||
|
||||
function __zoxide_z_complete() {
|
||||
# Only show completions when the cursor is at the end of the line.
|
||||
# shellcheck disable=SC2154
|
||||
[[ "${#words[@]}" -eq "${CURRENT}" ]] || return 0
|
||||
|
||||
if [[ "${#words[@]}" -eq 2 ]]; then
|
||||
# Show completions for local directories.
|
||||
_cd -/
|
||||
|
||||
elif [[ "${words[-1]}" == '' ]]; then
|
||||
# Show completions for Space-Tab.
|
||||
# shellcheck disable=SC2086
|
||||
__zoxide_result="$(\command zoxide query --exclude "$(__zoxide_pwd || \builtin true)" --interactive -- ${words[2,-1]})" || __zoxide_result=''
|
||||
|
||||
# Set a result to ensure completion doesn't re-run
|
||||
compadd -Q ""
|
||||
|
||||
# Bind '\e[0n' to helper function.
|
||||
\builtin bindkey '\e[0n' '__zoxide_z_complete_helper'
|
||||
# Sends query device status code, which results in a '\e[0n' being sent to console input.
|
||||
\builtin printf '\e[5n'
|
||||
|
||||
# Report that the completion was successful, so that we don't fall back
|
||||
# to another completion function.
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
function __zoxide_z_complete_helper() {
|
||||
if [[ -n "${__zoxide_result}" ]]; then
|
||||
# shellcheck disable=SC2034,SC2296
|
||||
BUFFER="z ${(q-)__zoxide_result}"
|
||||
__zoxide_result=''
|
||||
\builtin zle reset-prompt
|
||||
\builtin zle accept-line
|
||||
else
|
||||
\builtin zle reset-prompt
|
||||
fi
|
||||
}
|
||||
\builtin zle -N __zoxide_z_complete_helper
|
||||
|
||||
[[ "${+functions[compdef]}" -ne 0 ]] && \compdef __zoxide_z_complete z
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
#
|
||||
# To initialize zoxide, add this to your shell configuration file (usually ~/.zshrc):
|
||||
#
|
||||
# eval "$(zoxide init zsh)"
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
local ok, autopairs = pcall(require, "nvim-autopairs")
|
||||
if (not ok) then return end
|
||||
|
||||
autopairs.setup({
|
||||
disable_filetype = { "TelescopePrompt" , "vim" },
|
||||
})
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
local ok, cmp = pcall(require, "cmp")
|
||||
if (not ok) then return end
|
||||
|
||||
local lspkind = require 'lspkind'
|
||||
local luasnip = require 'luasnip'
|
||||
|
||||
local has_words_before = function()
|
||||
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end
|
||||
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_text(0, line-1, 0, line-1, col, {})[1]:match("^%s*$") == nil
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<Tab>"] = vim.schedule_wrap(function(fallback)
|
||||
if cmp.visible() and has_words_before() then
|
||||
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<CR>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true
|
||||
}),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{
|
||||
name = 'buffer',
|
||||
option = {
|
||||
get_bufnrs = function ()
|
||||
return vim.api.nvim_list_bufs()
|
||||
end
|
||||
}
|
||||
},
|
||||
{ name = 'path' },
|
||||
{ name = 'luasnip' }
|
||||
}),
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({ with_text = false, maxwidth = 50 })
|
||||
}
|
||||
})
|
||||
|
||||
vim.cmd [[
|
||||
set completeopt=menuone,noinsert,noselect
|
||||
highlight! default link CmpItemKind CmpItemMenuDefault
|
||||
]]
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
local ok, comment = pcall(require, "Comment")
|
||||
if (not ok) then return end
|
||||
|
||||
comment.setup()
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
local ok, copilot = pcall(require, 'copilot')
|
||||
if (not ok) then return end
|
||||
|
||||
copilot.setup({
|
||||
panel = {
|
||||
enabled = true, -- false for copilot-cmp
|
||||
auto_refresh = false,
|
||||
keymap = {
|
||||
jump_prev = "[[",
|
||||
jump_next = "]]",
|
||||
accept = "<CR>",
|
||||
refresh = "gr",
|
||||
open = "<M-CR>"
|
||||
},
|
||||
layout = {
|
||||
position = "bottom", -- | top | left | right
|
||||
ratio = 0.4
|
||||
},
|
||||
},
|
||||
suggestion = {
|
||||
enabled = true, -- false for copilot-cmp
|
||||
auto_trigger = true,
|
||||
hide_during_completion = true,
|
||||
debounce = 75,
|
||||
keymap = {
|
||||
accept = "<C-J>",
|
||||
accept_word = false,
|
||||
accept_line = false,
|
||||
next = "<M-]>",
|
||||
prev = "<M-[>",
|
||||
dismiss = "<C-]>",
|
||||
},
|
||||
},
|
||||
filetypes = {
|
||||
yaml = true,
|
||||
markdown = false,
|
||||
help = false,
|
||||
gitcommit = false,
|
||||
gitrebase = false,
|
||||
hgcommit = false,
|
||||
svn = false,
|
||||
cvs = false,
|
||||
["."] = false,
|
||||
},
|
||||
copilot_node_command = 'node', -- Node.js version must be > 18.x
|
||||
server_opts_overrides = {},
|
||||
})
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
local ok, _ = pcall(require, 'formatter')
|
||||
if (not ok) then return end
|
||||
|
||||
local util = require "formatter.util"
|
||||
|
||||
-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
|
||||
require("formatter").setup {
|
||||
-- Enable or disable logging
|
||||
logging = true,
|
||||
-- Set the log level
|
||||
log_level = vim.log.levels.WARN,
|
||||
-- All formatter configurations are opt-in
|
||||
filetype = {
|
||||
ruby = {
|
||||
function()
|
||||
return {
|
||||
exe = 'bundle exec rubocop',
|
||||
args = {
|
||||
'--fix-layout',
|
||||
'--stdin',
|
||||
util.escape_path(util.get_current_buffer_file_name()),
|
||||
'--format',
|
||||
'files',
|
||||
'|',
|
||||
"awk 'f; /^====================$/{f=1}'",
|
||||
},
|
||||
stdin = true,
|
||||
}
|
||||
end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
local ok, _ = pcall(require, 'git-conflict')
|
||||
if (not ok) then return end
|
||||
|
||||
require'git-conflict'.setup {
|
||||
default_commands = true, -- disable commands created by this plugin
|
||||
disable_diagnostics = false, -- This will disable the diagnostics in a buffer whilst it is conflicted
|
||||
list_opener = 'copen', -- command or function to open the conflicts list
|
||||
highlights = { -- They must have background color, otherwise the default color will be used
|
||||
incoming = 'DiffAdd',
|
||||
current = 'DiffText',
|
||||
},
|
||||
default_mappings = {
|
||||
ours = 'o',
|
||||
theirs = 't',
|
||||
none = '0',
|
||||
both = 'b',
|
||||
next = 'n',
|
||||
prev = 'p',
|
||||
},
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
local ok, _ = pcall(require, "gitblame")
|
||||
if (not ok) then return end
|
||||
|
||||
require('gitblame').setup {
|
||||
--Note how the `gitblame_` prefix is omitted in `setup`
|
||||
enabled = false,
|
||||
display_virtual_text = false,
|
||||
message_template = '<author> • <date>',
|
||||
date_format = '%r'
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
local ok, gitsigns = pcall(require, "gitsigns")
|
||||
if (not ok) then return end
|
||||
|
||||
gitsigns.setup {}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
local ok, lspkind = pcall(require, "lspkind")
|
||||
if (not ok) then return end
|
||||
|
||||
lspkind.init({
|
||||
-- enables text annotations
|
||||
--
|
||||
-- default: true
|
||||
mode = 'symbol',
|
||||
|
||||
-- default symbol map
|
||||
-- can be either 'default' (requires nerd-fonts font) or
|
||||
-- 'codicons' for codicon preset (requires vscode-codicons font)
|
||||
--
|
||||
-- default: 'default'
|
||||
preset = 'codicons',
|
||||
|
||||
-- override preset symbols
|
||||
--
|
||||
-- default: {}
|
||||
symbol_map = {
|
||||
Text = "",
|
||||
Method = "",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "ﰠ",
|
||||
Variable = "",
|
||||
Class = "ﴯ",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "ﰠ",
|
||||
Unit = "塞",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "פּ",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = ""
|
||||
},
|
||||
})
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
local ok, lualine = pcall(require, "lualine")
|
||||
local git_blame = require('gitblame')
|
||||
if (not ok) then return end
|
||||
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'auto',
|
||||
component_separators = { left = '', right = ''},
|
||||
section_separators = { left = '', right = ''},
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'filename'},
|
||||
-- add git blame text
|
||||
lualine_c = {
|
||||
{ git_blame.get_current_blame_text, cond = git_blame.is_blame_text_available }
|
||||
},
|
||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'location'},
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
require('luasnip.loaders.from_snipmate').lazy_load()
|
||||
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
local ok, mason = pcall(require, "mason")
|
||||
if (not ok) then return end
|
||||
|
||||
mason.setup()
|
||||
|
||||
local ok, mason_lspconfig = pcall(require, "mason-lspconfig")
|
||||
if (not ok) then return end
|
||||
|
||||
mason_lspconfig.setup()
|
||||
|
||||
-- Fonction on_attach avec les raccourcis
|
||||
local on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- Raccourcis LSP
|
||||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
end
|
||||
|
||||
-- Configuration automatique pour TOUS les serveurs installés
|
||||
mason_lspconfig.setup({
|
||||
handlers = {
|
||||
-- Handler par défaut pour tous les serveurs
|
||||
function(server_name)
|
||||
require("lspconfig")[server_name].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||
})
|
||||
end,
|
||||
}
|
||||
})
|
||||
|
||||
-- Configuration globale des raccourcis LSP (au cas où on_attach ne fonctionne pas)
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
local bufnr = args.buf
|
||||
|
||||
print("LspAttach autocmd triggered for: " .. client.name) -- Debug
|
||||
|
||||
local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, opts)
|
||||
end,
|
||||
})
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
local status, neotree = pcall(require, "neo-tree")
|
||||
if not status then
|
||||
return
|
||||
end
|
||||
|
||||
neotree.setup({
|
||||
close_if_last_window = false,
|
||||
popup_border_style = "rounded",
|
||||
enable_git_status = true,
|
||||
enable_diagnostics = true,
|
||||
default_component_configs = {
|
||||
container = {
|
||||
enable_character_fade = true
|
||||
},
|
||||
indent = {
|
||||
indent_size = 2,
|
||||
padding = 1,
|
||||
with_markers = true,
|
||||
indent_marker = "│",
|
||||
last_indent_marker = "└",
|
||||
highlight = "NeoTreeIndentMarker",
|
||||
with_expanders = nil,
|
||||
expander_collapsed = "",
|
||||
expander_expanded = "",
|
||||
expander_highlight = "NeoTreeExpander",
|
||||
},
|
||||
icon = {
|
||||
folder_closed = "",
|
||||
folder_open = "",
|
||||
folder_empty = "",
|
||||
default = "",
|
||||
highlight = "NeoTreeFileIcon"
|
||||
},
|
||||
modified = {
|
||||
symbol = "[+]",
|
||||
highlight = "NeoTreeModified",
|
||||
},
|
||||
name = {
|
||||
trailing_slash = false,
|
||||
use_git_status_colors = true,
|
||||
highlight = "NeoTreeFileName",
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
added = "✚",
|
||||
modified = "",
|
||||
deleted = "✖",
|
||||
renamed = "",
|
||||
untracked = "",
|
||||
ignored = "",
|
||||
unstaged = "",
|
||||
staged = "",
|
||||
conflict = "",
|
||||
}
|
||||
},
|
||||
},
|
||||
window = {
|
||||
position = "left",
|
||||
width = 30,
|
||||
mapping_options = {
|
||||
noremap = true,
|
||||
nowait = true,
|
||||
},
|
||||
mappings = {
|
||||
["<space>"] = {
|
||||
"toggle_node",
|
||||
nowait = false,
|
||||
},
|
||||
["<2-LeftMouse>"] = "open",
|
||||
["<cr>"] = "open",
|
||||
["o"] = "open",
|
||||
["S"] = "open_split",
|
||||
["s"] = "open_vsplit",
|
||||
["t"] = "open_tabnew",
|
||||
["w"] = "open_with_window_picker",
|
||||
["C"] = "close_node",
|
||||
["z"] = "close_all_nodes",
|
||||
["a"] = {
|
||||
"add",
|
||||
config = {
|
||||
show_path = "none"
|
||||
}
|
||||
},
|
||||
["A"] = "add_directory",
|
||||
["d"] = "delete",
|
||||
["r"] = "rename",
|
||||
["y"] = "copy_to_clipboard",
|
||||
["x"] = "cut_to_clipboard",
|
||||
["p"] = "paste_from_clipboard",
|
||||
["c"] = "copy",
|
||||
["m"] = "move",
|
||||
["q"] = "close_window",
|
||||
["R"] = "refresh",
|
||||
["?"] = "show_help",
|
||||
["<"] = "prev_source",
|
||||
[">"] = "next_source",
|
||||
}
|
||||
},
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
visible = false,
|
||||
hide_dotfiles = false,
|
||||
hide_gitignored = false,
|
||||
hide_hidden = true,
|
||||
hide_by_name = {
|
||||
"node_modules"
|
||||
},
|
||||
hide_by_pattern = {
|
||||
"*.meta",
|
||||
"*/src/*/tsconfig.json",
|
||||
},
|
||||
always_show = {
|
||||
".gitignore"
|
||||
},
|
||||
never_show = {
|
||||
".DS_Store",
|
||||
"thumbs.db"
|
||||
},
|
||||
},
|
||||
follow_current_file = {
|
||||
enabled = true,
|
||||
leave_dirs_open = false,
|
||||
},
|
||||
group_empty_dirs = false,
|
||||
hijack_netrw_behavior = "open_default",
|
||||
use_libuv_file_watcher = false,
|
||||
window = {
|
||||
mappings = {
|
||||
["<bs>"] = "navigate_up",
|
||||
["."] = "set_root",
|
||||
["H"] = "toggle_hidden",
|
||||
["/"] = "fuzzy_finder",
|
||||
["D"] = "fuzzy_finder_directory",
|
||||
["f"] = "filter_on_submit",
|
||||
["<c-x>"] = "clear_filter",
|
||||
["[g"] = "prev_git_modified",
|
||||
["]g"] = "next_git_modified",
|
||||
}
|
||||
}
|
||||
},
|
||||
buffers = {
|
||||
follow_current_file = {
|
||||
enabled = true,
|
||||
leave_dirs_open = false,
|
||||
},
|
||||
group_empty_dirs = true,
|
||||
show_unloaded = true,
|
||||
window = {
|
||||
mappings = {
|
||||
["bd"] = "buffer_delete",
|
||||
["<bs>"] = "navigate_up",
|
||||
["."] = "set_root",
|
||||
}
|
||||
},
|
||||
},
|
||||
git_status = {
|
||||
window = {
|
||||
position = "float",
|
||||
mappings = {
|
||||
["A"] = "git_add_all",
|
||||
["gu"] = "git_unstage_file",
|
||||
["ga"] = "git_add_file",
|
||||
["gr"] = "git_revert_file",
|
||||
["gc"] = "git_commit",
|
||||
["gp"] = "git_push",
|
||||
["gg"] = "git_commit_and_push",
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
-- Raccourcis clavier
|
||||
vim.keymap.set('n', '<c-t>', ':Neotree toggle<CR>', { noremap = true, silent = true })
|
||||
vim.keymap.set('n', '<c-f>', ':Neotree focus<CR>', { noremap = true, silent = true })
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
local ok, stabilize = pcall(require, 'stabilize')
|
||||
if (not ok) then return end
|
||||
|
||||
stabilize.setup()
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
local ok, telescope = pcall(require, 'telescope')
|
||||
if (not ok) then return end
|
||||
|
||||
local actions = require('telescope.actions')
|
||||
local builtin = require('telescope.builtin')
|
||||
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
mappings = {
|
||||
n = {
|
||||
["q"] = actions.close
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
git_files = {
|
||||
theme = 'dropdown',
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
vim.keymap.set('n', '<C-p>', function()
|
||||
builtin.find_files({
|
||||
hidden = true
|
||||
})
|
||||
end)
|
||||
|
||||
vim.keymap.set('n', ';r', function()
|
||||
builtin.live_grep()
|
||||
end)
|
||||
|
||||
vim.keymap.set('n', '\\\\', function()
|
||||
builtin.buffers()
|
||||
end)
|
||||
|
||||
vim.keymap.set('n', ';g', function()
|
||||
builtin.git_status()
|
||||
end)
|
||||
|
||||
vim.keymap.set('n', ';;', function()
|
||||
builtin.resume()
|
||||
end)
|
||||
|
||||
vim.keymap.set('n', ';e', function()
|
||||
builtin.diagnostics()
|
||||
end)
|
||||
|
||||
telescope.load_extension("ag")
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
--vim.lsp.set_log_level("debug")
|
||||
|
||||
local status, nvim_lsp = pcall(require, "lspconfig")
|
||||
if (not status) then return end
|
||||
|
||||
local protocol = require('vim.lsp.protocol')
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
|
||||
--Enable completion triggered by <c-x><c-o>
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
--buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
end
|
||||
|
||||
protocol.CompletionItemKind = {
|
||||
'', -- Text
|
||||
'', -- Method
|
||||
'', -- Function
|
||||
'', -- Constructor
|
||||
'', -- Field
|
||||
'', -- Variable
|
||||
'', -- Class
|
||||
'ﰮ', -- Interface
|
||||
'', -- Module
|
||||
'', -- Property
|
||||
'', -- Unit
|
||||
'', -- Value
|
||||
'', -- Enum
|
||||
'', -- Keyword
|
||||
'', -- Snippet
|
||||
'', -- Color
|
||||
'', -- File
|
||||
'', -- Reference
|
||||
'', -- Folder
|
||||
'', -- EnumMember
|
||||
'', -- Constant
|
||||
'', -- Struct
|
||||
'', -- Event
|
||||
'ﬦ', -- Operator
|
||||
'', -- TypeParameter
|
||||
}
|
||||
|
||||
-- Set up completion using nvim_cmp with LSP source
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities(
|
||||
vim.lsp.protocol.make_client_capabilities()
|
||||
)
|
||||
|
||||
nvim_lsp.flow.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
-- nvim_lsp.solargraph.setup {}
|
||||
|
||||
nvim_lsp.ts_ls.setup {
|
||||
on_attach = on_attach,
|
||||
filetypes = { "typescript", "typescriptreact", "typescript.tsx", "javascript", "vue" },
|
||||
cmd = { "typescript-language-server", "--stdio" },
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
nvim_lsp.sourcekit.setup {
|
||||
on_attach = on_attach,
|
||||
}
|
||||
|
||||
nvim_lsp.lua_ls.setup {
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { 'vim' },
|
||||
},
|
||||
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
checkThirdParty = false
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
virtual_text = { spacing = 4, prefix = "●" },
|
||||
severity_sort = true,
|
||||
}
|
||||
)
|
||||
|
||||
-- Diagnostic symbols in the sign column (gutter)
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = {
|
||||
prefix = '●'
|
||||
},
|
||||
update_in_insert = true,
|
||||
float = {
|
||||
source = "always", -- Or "if_many"
|
||||
},
|
||||
})
|
||||
|
||||
_timers = {}
|
||||
local function setup_diagnostics(client, buffer)
|
||||
if require("vim.lsp.diagnostic")._enable then
|
||||
return
|
||||
end
|
||||
|
||||
local diagnostic_handler = function()
|
||||
local params = vim.lsp.util.make_text_document_params(buffer)
|
||||
client.request("textDocument/diagnostic", { textDocument = params }, function(err, result)
|
||||
if err then
|
||||
local err_msg = string.format("diagnostics error - %s", vim.inspect(err))
|
||||
vim.lsp.log.error(err_msg)
|
||||
end
|
||||
local diagnostic_items = {}
|
||||
if result then
|
||||
diagnostic_items = result.items
|
||||
end
|
||||
vim.lsp.diagnostic.on_publish_diagnostics(
|
||||
nil,
|
||||
vim.tbl_extend("keep", params, { diagnostics = diagnostic_items }),
|
||||
{ client_id = client.id }
|
||||
)
|
||||
end)
|
||||
end
|
||||
|
||||
diagnostic_handler() -- to request diagnostics on buffer when first attaching
|
||||
|
||||
vim.api.nvim_buf_attach(buffer, false, {
|
||||
on_lines = function()
|
||||
if _timers[buffer] then
|
||||
vim.fn.timer_stop(_timers[buffer])
|
||||
end
|
||||
_timers[buffer] = vim.fn.timer_start(200, diagnostic_handler)
|
||||
end,
|
||||
on_detach = function()
|
||||
if _timers[buffer] then
|
||||
vim.fn.timer_stop(_timers[buffer])
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
require("lspconfig").ruby_lsp.setup({
|
||||
on_attach = function(client, buffer)
|
||||
setup_diagnostics(client, buffer)
|
||||
end,
|
||||
})
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
local status, saga = pcall(require, "lspsaga")
|
||||
if (not status) then return end
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set('n', '<C-j>', '<Cmd>Lspsaga diagnostic_jump_next<CR>', opts)
|
||||
vim.keymap.set('n', 'K', '<Cmd>Lspsaga hover_doc<CR>', opts)
|
||||
-- vim.keymap.set('n', 'gd', '<Cmd>Lspsaga lsp_finder<CR>', opts)
|
||||
vim.keymap.set('i', '<C-k>', '<Cmd>Lspsaga signature_help<CR>', opts)
|
||||
vim.keymap.set('n', 'gp', '<Cmd>Lspsaga preview_definition<CR>', opts)
|
||||
vim.keymap.set('n', 'gr', '<Cmd>Lspsaga rename<CR>', opts)
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
local ensure_packer = function()
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
local packer_bootstrap = ensure_packer()
|
||||
|
||||
local status, packer = pcall(require, "packer")
|
||||
|
||||
if (not status) then
|
||||
print("Packer is not installed")
|
||||
return
|
||||
end
|
||||
|
||||
return packer.startup(function(use)
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
-- appearances
|
||||
use 'projekt0n/github-nvim-theme'
|
||||
use 'nvim-lualine/lualine.nvim' -- Statusline
|
||||
|
||||
-- LSP and completion
|
||||
use 'nvim-lua/plenary.nvim' -- Common utilities
|
||||
use 'neovim/nvim-lspconfig' -- LSP
|
||||
use 'onsails/lspkind-nvim' -- vscode-like pictograms
|
||||
use 'hrsh7th/cmp-buffer' -- nvim-cmp source for buffer words
|
||||
use 'hrsh7th/cmp-path' -- completion pathname
|
||||
use 'hrsh7th/cmp-nvim-lsp' -- nvim-cmp source for neovim's built-in LSP
|
||||
use 'hrsh7th/nvim-cmp' -- Completion
|
||||
use 'jose-elias-alvarez/null-ls.nvim' -- inject LSP diagnostics, code actions
|
||||
use 'glepnir/lspsaga.nvim' -- LSP UIs
|
||||
use 'mason-org/mason.nvim' -- manage lsp
|
||||
use "mason-org/mason-lspconfig.nvim" -- bridge mason with lspconfig
|
||||
|
||||
-- Snippets
|
||||
use 'L3MON4D3/LuaSnip'
|
||||
use 'honza/vim-snippets'
|
||||
|
||||
-- code fasters
|
||||
use 'Raimondi/delimitMate' -- auto close colon
|
||||
use 'mattn/emmet-vim' -- emmet for vim
|
||||
use 'tpope/vim-surround' -- just tpope the GOD OF VIM
|
||||
use 'ap/vim-css-color' -- colors display
|
||||
use 'numToStr/Comment.nvim' -- comments tools
|
||||
use 'mhartington/formatter.nvim' -- format code
|
||||
use 'AndrewRadev/splitjoin.vim' -- refactor plugin
|
||||
use 'RRethy/vim-illuminate' -- highlight other uses of the word under the cursor
|
||||
use 'folke/trouble.nvim' -- better diagnostics
|
||||
|
||||
-- Ruby development
|
||||
use 'vim-ruby/vim-ruby'
|
||||
use 'tpope/vim-rails'
|
||||
use 'tpope/vim-endwise' -- autoclose function
|
||||
|
||||
-- javacript development
|
||||
use 'peitalin/vim-jsx-typescript'
|
||||
use 'pangloss/vim-javascript'
|
||||
use 'leafgarland/typescript-vim'
|
||||
|
||||
-- GraphQl
|
||||
use 'jparise/vim-graphql'
|
||||
|
||||
-- Rust development
|
||||
use 'rust-lang/rust.vim'
|
||||
use { 'saecki/crates.nvim', requires = { 'nvim-lua/plenary.nvim' } }
|
||||
|
||||
-- IA
|
||||
use { "zbirenbaum/copilot.lua" }
|
||||
|
||||
-- Testing
|
||||
use { 'vim-test/vim-test' }
|
||||
|
||||
-- others utilities
|
||||
use 'nvim-telescope/telescope.nvim' -- equivalent ctrl-p, fzf
|
||||
use({ "kelly-lin/telescope-ag", requires = { { "nvim-telescope/telescope.nvim" } } }) -- silver search with telescope
|
||||
use 'windwp/nvim-autopairs' -- auto brackets pairing
|
||||
use 'lewis6991/gitsigns.nvim' -- git graphic helpers
|
||||
use 'bronson/vim-trailing-whitespace' -- detect trailing-whitespace
|
||||
use 'nvim-tree/nvim-web-devicons' -- use devicons
|
||||
-- File explorer moderne
|
||||
use {
|
||||
'nvim-neo-tree/neo-tree.nvim',
|
||||
branch = 'v3.x',
|
||||
requires = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
'MunifTanjim/nui.nvim',
|
||||
}
|
||||
}
|
||||
use "luukvbaal/stabilize.nvim" -- to fix my fucking headache when openclosed panes
|
||||
use 'f-person/git-blame.nvim'
|
||||
use {'akinsho/git-conflict.nvim', tag = "*", config = function() -- conflict management
|
||||
require('git-conflict').setup()
|
||||
end}
|
||||
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end)
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
if vim.fn.has("termguicolors") == 1 then
|
||||
vim.opt.termguicolors = true
|
||||
end
|
||||
|
||||
vim.opt.background = 'dark'
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
vim.cmd('filetype plugin indent on')
|
||||
|
||||
vim.api.nvim_exec([[
|
||||
autocmd BufNewFile,BufRead /tmp/mutt-* set filetype=mail
|
||||
autocmd BufNewFile,BufRead /*.rasi setf css
|
||||
autocmd BufNewFile,BufRead *.tsx,*.jsx set filetype=typescriptreact
|
||||
augroup ruby_subtypes
|
||||
autocmd!
|
||||
autocmd BufNewFile,BufRead *.pdf.erb let b:eruby_subtype='html'
|
||||
autocmd BufNewFile,BufRead *.pdf.erb set filetype=eruby
|
||||
augroup END
|
||||
au BufNewFile,BufRead *.arb set filetype=ruby
|
||||
au BufRead,BufNewFile *.ejs setfiletype html
|
||||
au FileType TelescopePrompt setlocal nocursorline
|
||||
au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
|
||||
au BufRead,BufNewFile *.eex,*.heex,*.leex,*.sface,*.lexs set filetype=eelixir
|
||||
au BufRead,BufNewFile mix.lock set filetype=elixir
|
||||
]], true)
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
vim.cmd("autocmd!")
|
||||
|
||||
vim.scriptencoding = 'utf-8'
|
||||
vim.opt.encoding = 'utf-8'
|
||||
vim.opt.fileencoding = 'utf-8'
|
||||
vim.opt.clipboard:append { 'unnamedplus' }
|
||||
|
||||
vim.opt.autoread = true
|
||||
vim.opt.showmatch = true -- show matching
|
||||
vim.opt.ignorecase = true -- case insensitive
|
||||
vim.opt.mouse = 'v' -- middle-click paste with
|
||||
vim.opt.hlsearch = true -- highlight search
|
||||
vim.opt.incsearch = true -- incremental search
|
||||
vim.opt.tabstop = 4 -- number of columns occupied by a tab
|
||||
vim.opt.softtabstop = 4 -- see multiple spaces as tabstops so <BS> does the right thing
|
||||
vim.opt.expandtab = true -- converts tabs to white space
|
||||
vim.opt.shiftwidth = 2 -- width for autoindents
|
||||
vim.opt.autoindent = true -- indent a new line the same amount as the line just typed
|
||||
vim.wo.number = true -- add line numbers
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.wildmode = 'longest,list' -- get bash-like tab completions
|
||||
vim.opt.cc = '80' -- set an 80 column border for good coding style
|
||||
vim.opt.clipboard = 'unnamedplus' -- using system clipboard
|
||||
vim.opt.cursorline = true -- highlight current cursorline
|
||||
vim.opt.ttyfast = true -- Speed up scrolling in Vim
|
||||
vim.opt.wildignore:append { '*/node_modules/*' }
|
||||
|
||||
vim.cmd('syntax on')
|
||||
|
||||
vim.opt.formatoptions:append { 'r' } -- Add asterisks in block comments
|
||||
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.winblend = 0
|
||||
vim.opt.wildoptions = 'pum'
|
||||
vim.opt.pumblend = 5
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
local keymap = vim.keymap
|
||||
|
||||
vim.g.mapleader = ','
|
||||
|
||||
keymap.set('n', 'x', '"_x')
|
||||
|
||||
-- no arrow keys
|
||||
keymap.set('i', '<up>', '<nop>')
|
||||
keymap.set('i', '<left>', '<nop>')
|
||||
keymap.set('i', '<right>', '<nop>')
|
||||
keymap.set('i', '<down>', '<nop>')
|
||||
keymap.set('', '<up>', '<nop>')
|
||||
keymap.set('', '<left>', '<nop>')
|
||||
keymap.set('', '<right>', '<nop>')
|
||||
keymap.set('', '<down>', '<nop>')
|
||||
|
||||
keymap.set('n', '<C-w><down>', '<C-w>-')
|
||||
|
||||
-- Indent all files
|
||||
keymap.set('n', '<leader>i', 'mmgg=G`m')
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
require('github-theme').setup({
|
||||
options = {
|
||||
styles = {
|
||||
functions = "NONE"
|
||||
},
|
||||
darken = { -- Darken floating windows and sidebar-like windows
|
||||
floats = false,
|
||||
sidebars = {
|
||||
enable = true,
|
||||
list = {"qf", "vista_kind", "terminal", "packer"}, -- Apply dark background to specific windows
|
||||
},
|
||||
},
|
||||
},
|
||||
palettes = {
|
||||
all = {
|
||||
hint = "orange",
|
||||
error = "#ff0000"
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd[[colorscheme github_dark_high_contrast]]
|
||||
|
|
@ -0,0 +1,329 @@
|
|||
-- Automatically generated packer.nvim plugin loader code
|
||||
|
||||
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
|
||||
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
|
||||
return
|
||||
end
|
||||
|
||||
vim.api.nvim_command('packadd packer.nvim')
|
||||
|
||||
local no_errors, error_msg = pcall(function()
|
||||
|
||||
_G._packer = _G._packer or {}
|
||||
_G._packer.inside_compile = true
|
||||
|
||||
local time
|
||||
local profile_info
|
||||
local should_profile = false
|
||||
if should_profile then
|
||||
local hrtime = vim.loop.hrtime
|
||||
profile_info = {}
|
||||
time = function(chunk, start)
|
||||
if start then
|
||||
profile_info[chunk] = hrtime()
|
||||
else
|
||||
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
||||
end
|
||||
end
|
||||
else
|
||||
time = function(chunk, start) end
|
||||
end
|
||||
|
||||
local function save_profiles(threshold)
|
||||
local sorted_times = {}
|
||||
for chunk_name, time_taken in pairs(profile_info) do
|
||||
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
|
||||
end
|
||||
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
|
||||
local results = {}
|
||||
for i, elem in ipairs(sorted_times) do
|
||||
if not threshold or threshold and elem[2] > threshold then
|
||||
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
||||
end
|
||||
end
|
||||
if threshold then
|
||||
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
|
||||
end
|
||||
|
||||
_G._packer.profile_output = results
|
||||
end
|
||||
|
||||
time([[Luarocks path setup]], true)
|
||||
local package_path_str = "/Users/torpenn/.cache/nvim/packer_hererocks/2.1.1744318430/share/lua/5.1/?.lua;/Users/torpenn/.cache/nvim/packer_hererocks/2.1.1744318430/share/lua/5.1/?/init.lua;/Users/torpenn/.cache/nvim/packer_hererocks/2.1.1744318430/lib/luarocks/rocks-5.1/?.lua;/Users/torpenn/.cache/nvim/packer_hererocks/2.1.1744318430/lib/luarocks/rocks-5.1/?/init.lua"
|
||||
local install_cpath_pattern = "/Users/torpenn/.cache/nvim/packer_hererocks/2.1.1744318430/lib/lua/5.1/?.so"
|
||||
if not string.find(package.path, package_path_str, 1, true) then
|
||||
package.path = package.path .. ';' .. package_path_str
|
||||
end
|
||||
|
||||
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
||||
package.cpath = package.cpath .. ';' .. install_cpath_pattern
|
||||
end
|
||||
|
||||
time([[Luarocks path setup]], false)
|
||||
time([[try_loadstring definition]], true)
|
||||
local function try_loadstring(s, component, name)
|
||||
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
|
||||
if not success then
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
|
||||
end)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
time([[try_loadstring definition]], false)
|
||||
time([[Defining packer_plugins]], true)
|
||||
_G.packer_plugins = {
|
||||
LuaSnip = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/LuaSnip",
|
||||
url = "https://github.com/L3MON4D3/LuaSnip"
|
||||
},
|
||||
["cmp-buffer"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
||||
url = "https://github.com/hrsh7th/cmp-buffer"
|
||||
},
|
||||
["cmp-nvim-lsp"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
["cmp-path"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/cmp-path",
|
||||
url = "https://github.com/hrsh7th/cmp-path"
|
||||
},
|
||||
["copilot.lua"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/copilot.lua",
|
||||
url = "https://github.com/zbirenbaum/copilot.lua"
|
||||
},
|
||||
["crates.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/crates.nvim",
|
||||
url = "https://github.com/saecki/crates.nvim"
|
||||
},
|
||||
delimitMate = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/delimitMate",
|
||||
url = "https://github.com/Raimondi/delimitMate"
|
||||
},
|
||||
["emmet-vim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/emmet-vim",
|
||||
url = "https://github.com/mattn/emmet-vim"
|
||||
},
|
||||
["formatter.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/formatter.nvim",
|
||||
url = "https://github.com/mhartington/formatter.nvim"
|
||||
},
|
||||
["git-blame.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/git-blame.nvim",
|
||||
url = "https://github.com/f-person/git-blame.nvim"
|
||||
},
|
||||
["git-conflict.nvim"] = {
|
||||
config = { "\27LJ\2\n:\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\17git-conflict\frequire\0" },
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/git-conflict.nvim",
|
||||
url = "https://github.com/akinsho/git-conflict.nvim"
|
||||
},
|
||||
["github-nvim-theme"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/github-nvim-theme",
|
||||
url = "https://github.com/projekt0n/github-nvim-theme"
|
||||
},
|
||||
["gitsigns.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
|
||||
url = "https://github.com/lewis6991/gitsigns.nvim"
|
||||
},
|
||||
["lspkind-nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/lspkind-nvim",
|
||||
url = "https://github.com/onsails/lspkind-nvim"
|
||||
},
|
||||
["lspsaga.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/lspsaga.nvim",
|
||||
url = "https://github.com/glepnir/lspsaga.nvim"
|
||||
},
|
||||
["lualine.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/lualine.nvim",
|
||||
url = "https://github.com/nvim-lualine/lualine.nvim"
|
||||
},
|
||||
["mason-lspconfig.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
|
||||
url = "https://github.com/mason-org/mason-lspconfig.nvim"
|
||||
},
|
||||
["mason.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/mason.nvim",
|
||||
url = "https://github.com/mason-org/mason.nvim"
|
||||
},
|
||||
["null-ls.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/null-ls.nvim",
|
||||
url = "https://github.com/jose-elias-alvarez/null-ls.nvim"
|
||||
},
|
||||
["nvim-autopairs"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
|
||||
url = "https://github.com/windwp/nvim-autopairs"
|
||||
},
|
||||
["nvim-cmp"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||
},
|
||||
["nvim-comment"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/nvim-comment",
|
||||
url = "https://github.com/terrortylor/nvim-comment"
|
||||
},
|
||||
["nvim-lspconfig"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||
url = "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
["nvim-tree.lua"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
|
||||
url = "https://github.com/nvim-tree/nvim-tree.lua"
|
||||
},
|
||||
["nvim-web-devicons"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
|
||||
url = "https://github.com/nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
["packer.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
||||
url = "https://github.com/wbthomason/packer.nvim"
|
||||
},
|
||||
["plenary.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
["rust.vim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/rust.vim",
|
||||
url = "https://github.com/rust-lang/rust.vim"
|
||||
},
|
||||
["splitjoin.vim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/splitjoin.vim",
|
||||
url = "https://github.com/AndrewRadev/splitjoin.vim"
|
||||
},
|
||||
["stabilize.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/stabilize.nvim",
|
||||
url = "https://github.com/luukvbaal/stabilize.nvim"
|
||||
},
|
||||
["telescope-ag"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/telescope-ag",
|
||||
url = "https://github.com/kelly-lin/telescope-ag"
|
||||
},
|
||||
["telescope.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||
},
|
||||
["trouble.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/trouble.nvim",
|
||||
url = "https://github.com/folke/trouble.nvim"
|
||||
},
|
||||
["typescript-vim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/typescript-vim",
|
||||
url = "https://github.com/leafgarland/typescript-vim"
|
||||
},
|
||||
["vim-css-color"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-css-color",
|
||||
url = "https://github.com/ap/vim-css-color"
|
||||
},
|
||||
["vim-endwise"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-endwise",
|
||||
url = "https://github.com/tpope/vim-endwise"
|
||||
},
|
||||
["vim-graphql"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-graphql",
|
||||
url = "https://github.com/jparise/vim-graphql"
|
||||
},
|
||||
["vim-illuminate"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-illuminate",
|
||||
url = "https://github.com/RRethy/vim-illuminate"
|
||||
},
|
||||
["vim-javascript"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-javascript",
|
||||
url = "https://github.com/pangloss/vim-javascript"
|
||||
},
|
||||
["vim-jsx-typescript"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-jsx-typescript",
|
||||
url = "https://github.com/peitalin/vim-jsx-typescript"
|
||||
},
|
||||
["vim-rails"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-rails",
|
||||
url = "https://github.com/tpope/vim-rails"
|
||||
},
|
||||
["vim-ruby"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-ruby",
|
||||
url = "https://github.com/vim-ruby/vim-ruby"
|
||||
},
|
||||
["vim-snippets"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-snippets",
|
||||
url = "https://github.com/honza/vim-snippets"
|
||||
},
|
||||
["vim-surround"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-surround",
|
||||
url = "https://github.com/tpope/vim-surround"
|
||||
},
|
||||
["vim-test"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-test",
|
||||
url = "https://github.com/vim-test/vim-test"
|
||||
},
|
||||
["vim-trailing-whitespace"] = {
|
||||
loaded = true,
|
||||
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-trailing-whitespace",
|
||||
url = "https://github.com/bronson/vim-trailing-whitespace"
|
||||
}
|
||||
}
|
||||
|
||||
time([[Defining packer_plugins]], false)
|
||||
-- Config for: git-conflict.nvim
|
||||
time([[Config for git-conflict.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n:\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\17git-conflict\frequire\0", "config", "git-conflict.nvim")
|
||||
time([[Config for git-conflict.nvim]], false)
|
||||
|
||||
_G._packer.inside_compile = false
|
||||
if _G._packer.needs_bufread == true then
|
||||
vim.cmd("doautocmd BufRead")
|
||||
end
|
||||
_G._packer.needs_bufread = false
|
||||
|
||||
if should_profile then save_profiles() end
|
||||
|
||||
end)
|
||||
|
||||
if not no_errors then
|
||||
error_msg = error_msg:gsub('"', '\\"')
|
||||
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
|
||||
end
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
{
|
||||
"HTML5 boilerplate": {
|
||||
"prefix": "html5",
|
||||
"body": [
|
||||
"<!DOCTYPE html>",
|
||||
"<html lang=\"$1\">",
|
||||
"<head>",
|
||||
" <meta charset=\"UTF-8\">",
|
||||
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">",
|
||||
" <title>$2</title>",
|
||||
"</head>",
|
||||
"<body>",
|
||||
" $3",
|
||||
"</body>",
|
||||
"</html>"
|
||||
],
|
||||
"description": "HTML5 boilerplate"
|
||||
},
|
||||
"Div with class": {
|
||||
"prefix": "div",
|
||||
"body": [
|
||||
"<div class=\"$1\">",
|
||||
" $2",
|
||||
"</div>"
|
||||
],
|
||||
"description": "Div with class"
|
||||
},
|
||||
"Div with id": {
|
||||
"prefix": "divid",
|
||||
"body": [
|
||||
"<div id=\"$1\">",
|
||||
" $2",
|
||||
"</div>"
|
||||
],
|
||||
"description": "Div with id"
|
||||
},
|
||||
"Link": {
|
||||
"prefix": "a",
|
||||
"body": ["<a href=\"$1\">$2</a>"],
|
||||
"description": "Link"
|
||||
},
|
||||
"Image": {
|
||||
"prefix": "img",
|
||||
"body": ["<img src=\"$1\" alt=\"$2\">"],
|
||||
"description": "Image"
|
||||
},
|
||||
"Button": {
|
||||
"prefix": "btn",
|
||||
"body": ["<button class=\"$1\">$2</button>"],
|
||||
"description": "Button"
|
||||
},
|
||||
"Input": {
|
||||
"prefix": "input",
|
||||
"body": ["<input type=\"$1\" name=\"$2\" placeholder=\"$3\">"],
|
||||
"description": "Input"
|
||||
},
|
||||
"Form": {
|
||||
"prefix": "form",
|
||||
"body": [
|
||||
"<form action=\"$1\" method=\"$2\">",
|
||||
" $3",
|
||||
"</form>"
|
||||
],
|
||||
"description": "Form"
|
||||
},
|
||||
"Unordered list": {
|
||||
"prefix": "ul",
|
||||
"body": [
|
||||
"<ul>",
|
||||
" <li>$1</li>",
|
||||
"</ul>"
|
||||
],
|
||||
"description": "Unordered list"
|
||||
},
|
||||
"Ordered list": {
|
||||
"prefix": "ol",
|
||||
"body": [
|
||||
"<ol>",
|
||||
" <li>$1</li>",
|
||||
"</ol>"
|
||||
],
|
||||
"description": "Ordered list"
|
||||
},
|
||||
"List item": {
|
||||
"prefix": "li",
|
||||
"body": ["<li>$1</li>"],
|
||||
"description": "List item"
|
||||
},
|
||||
"Table": {
|
||||
"prefix": "table",
|
||||
"body": [
|
||||
"<table>",
|
||||
" <thead>",
|
||||
" <tr>",
|
||||
" <th>$1</th>",
|
||||
" </tr>",
|
||||
" </thead>",
|
||||
" <tbody>",
|
||||
" <tr>",
|
||||
" <td>$2</td>",
|
||||
" </tr>",
|
||||
" </tbody>",
|
||||
"</table>"
|
||||
],
|
||||
"description": "Table"
|
||||
},
|
||||
"Paragraph": {
|
||||
"prefix": "p",
|
||||
"body": ["<p>$1</p>"],
|
||||
"description": "Paragraph"
|
||||
},
|
||||
"Heading 1": {
|
||||
"prefix": "h1",
|
||||
"body": ["<h1>$1</h1>"],
|
||||
"description": "Heading 1"
|
||||
},
|
||||
"Heading 2": {
|
||||
"prefix": "h2",
|
||||
"body": ["<h2>$1</h2>"],
|
||||
"description": "Heading 2"
|
||||
},
|
||||
"Heading 3": {
|
||||
"prefix": "h3",
|
||||
"body": ["<h3>$1</h3>"],
|
||||
"description": "Heading 3"
|
||||
},
|
||||
"Span": {
|
||||
"prefix": "span",
|
||||
"body": ["<span class=\"$1\">$2</span>"],
|
||||
"description": "Span"
|
||||
},
|
||||
"Section": {
|
||||
"prefix": "section",
|
||||
"body": [
|
||||
"<section>",
|
||||
" $1",
|
||||
"</section>"
|
||||
],
|
||||
"description": "Section"
|
||||
},
|
||||
"Article": {
|
||||
"prefix": "article",
|
||||
"body": [
|
||||
"<article>",
|
||||
" $1",
|
||||
"</article>"
|
||||
],
|
||||
"description": "Article"
|
||||
},
|
||||
"Header": {
|
||||
"prefix": "header",
|
||||
"body": [
|
||||
"<header>",
|
||||
" $1",
|
||||
"</header>"
|
||||
],
|
||||
"description": "Header"
|
||||
},
|
||||
"Footer": {
|
||||
"prefix": "footer",
|
||||
"body": [
|
||||
"<footer>",
|
||||
" $1",
|
||||
"</footer>"
|
||||
],
|
||||
"description": "Footer"
|
||||
},
|
||||
"Nav": {
|
||||
"prefix": "nav",
|
||||
"body": [
|
||||
"<nav>",
|
||||
" $1",
|
||||
"</nav>"
|
||||
],
|
||||
"description": "Navigation"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
{
|
||||
"Console log": {
|
||||
"prefix": "cl",
|
||||
"body": ["console.log($1)"],
|
||||
"description": "Console log"
|
||||
},
|
||||
"Function": {
|
||||
"prefix": "fn",
|
||||
"body": [
|
||||
"function $1($2) {",
|
||||
" $3",
|
||||
"}"
|
||||
],
|
||||
"description": "Function"
|
||||
},
|
||||
"Arrow function": {
|
||||
"prefix": "af",
|
||||
"body": ["const $1 = ($2) => {", " $3", "}"],
|
||||
"description": "Arrow function"
|
||||
},
|
||||
"Arrow function inline": {
|
||||
"prefix": "afi",
|
||||
"body": ["const $1 = ($2) => $3"],
|
||||
"description": "Arrow function inline"
|
||||
},
|
||||
"Import": {
|
||||
"prefix": "imp",
|
||||
"body": ["import $1 from '$2'"],
|
||||
"description": "Import statement"
|
||||
},
|
||||
"Import destructured": {
|
||||
"prefix": "impd",
|
||||
"body": ["import { $1 } from '$2'"],
|
||||
"description": "Import destructured"
|
||||
},
|
||||
"Export": {
|
||||
"prefix": "exp",
|
||||
"body": ["export const $1 = $2"],
|
||||
"description": "Export statement"
|
||||
},
|
||||
"Export default": {
|
||||
"prefix": "expd",
|
||||
"body": ["export default $1"],
|
||||
"description": "Export default"
|
||||
},
|
||||
"Try catch": {
|
||||
"prefix": "try",
|
||||
"body": [
|
||||
"try {",
|
||||
" $1",
|
||||
"} catch (error) {",
|
||||
" $2",
|
||||
"}"
|
||||
],
|
||||
"description": "Try catch block"
|
||||
},
|
||||
"For loop": {
|
||||
"prefix": "for",
|
||||
"body": [
|
||||
"for (let $1 = 0; $1 < $2; $1++) {",
|
||||
" $3",
|
||||
"}"
|
||||
],
|
||||
"description": "For loop"
|
||||
},
|
||||
"For of loop": {
|
||||
"prefix": "forof",
|
||||
"body": [
|
||||
"for (const $1 of $2) {",
|
||||
" $3",
|
||||
"}"
|
||||
],
|
||||
"description": "For of loop"
|
||||
},
|
||||
"Async function": {
|
||||
"prefix": "async",
|
||||
"body": [
|
||||
"async function $1($2) {",
|
||||
" $3",
|
||||
"}"
|
||||
],
|
||||
"description": "Async function"
|
||||
},
|
||||
"Async arrow function": {
|
||||
"prefix": "asyncaf",
|
||||
"body": ["const $1 = async ($2) => {", " $3", "}"],
|
||||
"description": "Async arrow function"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
{
|
||||
"Method": {
|
||||
"prefix": "def",
|
||||
"body": [
|
||||
"def $1($2)",
|
||||
" $3",
|
||||
"end"
|
||||
],
|
||||
"description": "Ruby method"
|
||||
},
|
||||
"Class": {
|
||||
"prefix": "class",
|
||||
"body": [
|
||||
"class $1",
|
||||
" def initialize($2)",
|
||||
" $3",
|
||||
" end",
|
||||
"",
|
||||
" $4",
|
||||
"end"
|
||||
],
|
||||
"description": "Ruby class"
|
||||
},
|
||||
"Each loop": {
|
||||
"prefix": "each",
|
||||
"body": [
|
||||
"$1.each do |$2|",
|
||||
" $3",
|
||||
"end"
|
||||
],
|
||||
"description": "Ruby each loop"
|
||||
},
|
||||
"Each with index": {
|
||||
"prefix": "eachi",
|
||||
"body": [
|
||||
"$1.each_with_index do |$2, $3|",
|
||||
" $4",
|
||||
"end"
|
||||
],
|
||||
"description": "Ruby each with index"
|
||||
},
|
||||
"Map": {
|
||||
"prefix": "map",
|
||||
"body": [
|
||||
"$1.map do |$2|",
|
||||
" $3",
|
||||
"end"
|
||||
],
|
||||
"description": "Ruby map"
|
||||
},
|
||||
"Select": {
|
||||
"prefix": "select",
|
||||
"body": [
|
||||
"$1.select do |$2|",
|
||||
" $3",
|
||||
"end"
|
||||
],
|
||||
"description": "Ruby select"
|
||||
},
|
||||
"If statement": {
|
||||
"prefix": "if",
|
||||
"body": [
|
||||
"if $1",
|
||||
" $2",
|
||||
"end"
|
||||
],
|
||||
"description": "Ruby if statement"
|
||||
},
|
||||
"Unless": {
|
||||
"prefix": "unless",
|
||||
"body": [
|
||||
"unless $1",
|
||||
" $2",
|
||||
"end"
|
||||
],
|
||||
"description": "Ruby unless statement"
|
||||
},
|
||||
"Case when": {
|
||||
"prefix": "case",
|
||||
"body": [
|
||||
"case $1",
|
||||
"when $2",
|
||||
" $3",
|
||||
"else",
|
||||
" $4",
|
||||
"end"
|
||||
],
|
||||
"description": "Ruby case when"
|
||||
},
|
||||
"Module": {
|
||||
"prefix": "module",
|
||||
"body": [
|
||||
"module $1",
|
||||
" $2",
|
||||
"end"
|
||||
],
|
||||
"description": "Ruby module"
|
||||
},
|
||||
"Puts": {
|
||||
"prefix": "puts",
|
||||
"body": ["puts $1"],
|
||||
"description": "Ruby puts"
|
||||
},
|
||||
"Print": {
|
||||
"prefix": "p",
|
||||
"body": ["p $1"],
|
||||
"description": "Ruby print"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
{
|
||||
"Function": {
|
||||
"prefix": "fn",
|
||||
"body": [
|
||||
"fn $1($2) -> $3 {",
|
||||
" $4",
|
||||
"}"
|
||||
],
|
||||
"description": "Rust function"
|
||||
},
|
||||
"Public function": {
|
||||
"prefix": "pubfn",
|
||||
"body": [
|
||||
"pub fn $1($2) -> $3 {",
|
||||
" $4",
|
||||
"}"
|
||||
],
|
||||
"description": "Rust public function"
|
||||
},
|
||||
"Main function": {
|
||||
"prefix": "main",
|
||||
"body": [
|
||||
"fn main() {",
|
||||
" $1",
|
||||
"}"
|
||||
],
|
||||
"description": "Rust main function"
|
||||
},
|
||||
"Struct": {
|
||||
"prefix": "struct",
|
||||
"body": [
|
||||
"struct $1 {",
|
||||
" $2",
|
||||
"}"
|
||||
],
|
||||
"description": "Rust struct"
|
||||
},
|
||||
"Public struct": {
|
||||
"prefix": "pubstruct",
|
||||
"body": [
|
||||
"pub struct $1 {",
|
||||
" $2",
|
||||
"}"
|
||||
],
|
||||
"description": "Rust public struct"
|
||||
},
|
||||
"Enum": {
|
||||
"prefix": "enum",
|
||||
"body": [
|
||||
"enum $1 {",
|
||||
" $2,",
|
||||
"}"
|
||||
],
|
||||
"description": "Rust enum"
|
||||
},
|
||||
"Impl block": {
|
||||
"prefix": "impl",
|
||||
"body": [
|
||||
"impl $1 {",
|
||||
" $2",
|
||||
"}"
|
||||
],
|
||||
"description": "Rust impl block"
|
||||
},
|
||||
"Match statement": {
|
||||
"prefix": "match",
|
||||
"body": [
|
||||
"match $1 {",
|
||||
" $2 => $3,",
|
||||
" _ => $4,",
|
||||
"}"
|
||||
],
|
||||
"description": "Rust match statement"
|
||||
},
|
||||
"If let": {
|
||||
"prefix": "iflet",
|
||||
"body": [
|
||||
"if let $1 = $2 {",
|
||||
" $3",
|
||||
"}"
|
||||
],
|
||||
"description": "Rust if let"
|
||||
},
|
||||
"While let": {
|
||||
"prefix": "whilelet",
|
||||
"body": [
|
||||
"while let $1 = $2 {",
|
||||
" $3",
|
||||
"}"
|
||||
],
|
||||
"description": "Rust while let"
|
||||
},
|
||||
"For loop": {
|
||||
"prefix": "for",
|
||||
"body": [
|
||||
"for $1 in $2 {",
|
||||
" $3",
|
||||
"}"
|
||||
],
|
||||
"description": "Rust for loop"
|
||||
},
|
||||
"Test function": {
|
||||
"prefix": "test",
|
||||
"body": [
|
||||
"#[test]",
|
||||
"fn $1() {",
|
||||
" $2",
|
||||
"}"
|
||||
],
|
||||
"description": "Rust test function"
|
||||
},
|
||||
"Derive": {
|
||||
"prefix": "derive",
|
||||
"body": ["#[derive($1)]"],
|
||||
"description": "Rust derive attribute"
|
||||
},
|
||||
"Println": {
|
||||
"prefix": "println",
|
||||
"body": ["println!(\"$1\");"],
|
||||
"description": "Rust println macro"
|
||||
},
|
||||
"Print": {
|
||||
"prefix": "print",
|
||||
"body": ["print!(\"$1\");"],
|
||||
"description": "Rust print macro"
|
||||
},
|
||||
"Vec": {
|
||||
"prefix": "vec",
|
||||
"body": ["let $1: Vec<$2> = vec![$3];"],
|
||||
"description": "Rust vector"
|
||||
},
|
||||
"Result": {
|
||||
"prefix": "result",
|
||||
"body": ["Result<$1, $2>"],
|
||||
"description": "Rust Result type"
|
||||
},
|
||||
"Option": {
|
||||
"prefix": "option",
|
||||
"body": ["Option<$1>"],
|
||||
"description": "Rust Option type"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
"Interface": {
|
||||
"prefix": "int",
|
||||
"body": [
|
||||
"interface $1 {",
|
||||
" $2",
|
||||
"}"
|
||||
],
|
||||
"description": "TypeScript interface"
|
||||
},
|
||||
"Type": {
|
||||
"prefix": "type",
|
||||
"body": ["type $1 = $2"],
|
||||
"description": "TypeScript type"
|
||||
},
|
||||
"Function with types": {
|
||||
"prefix": "fn",
|
||||
"body": [
|
||||
"function $1($2): $3 {",
|
||||
" $4",
|
||||
"}"
|
||||
],
|
||||
"description": "Function with types"
|
||||
},
|
||||
"Arrow function with types": {
|
||||
"prefix": "af",
|
||||
"body": ["const $1 = ($2): $3 => {", " $4", "}"],
|
||||
"description": "Arrow function with types"
|
||||
},
|
||||
"Async function with types": {
|
||||
"prefix": "async",
|
||||
"body": [
|
||||
"async function $1($2): Promise<$3> {",
|
||||
" $4",
|
||||
"}"
|
||||
],
|
||||
"description": "Async function with types"
|
||||
},
|
||||
"Enum": {
|
||||
"prefix": "enum",
|
||||
"body": [
|
||||
"enum $1 {",
|
||||
" $2",
|
||||
"}"
|
||||
],
|
||||
"description": "TypeScript enum"
|
||||
},
|
||||
"Class": {
|
||||
"prefix": "class",
|
||||
"body": [
|
||||
"class $1 {",
|
||||
" constructor($2) {",
|
||||
" $3",
|
||||
" }",
|
||||
"",
|
||||
" $4",
|
||||
"}"
|
||||
],
|
||||
"description": "TypeScript class"
|
||||
},
|
||||
"Generic function": {
|
||||
"prefix": "genfn",
|
||||
"body": [
|
||||
"function $1<$2>($3): $4 {",
|
||||
" $5",
|
||||
"}"
|
||||
],
|
||||
"description": "Generic function"
|
||||
},
|
||||
"Import type": {
|
||||
"prefix": "impt",
|
||||
"body": ["import type { $1 } from '$2'"],
|
||||
"description": "Import type"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue