Skip to content

Instantly share code, notes, and snippets.

View Mr-Jack82's full-sized avatar
💭
Learning to code

Виталий Шевченко Mr-Jack82

💭
Learning to code
  • Russia
View GitHub Profile
@Mr-Jack82
Mr-Jack82 / normalize.css
Created September 27, 2025 20:24
Reset default web browsers styles
/**
Нормализация блочной модели
*/
*,
::before,
::after {
box-sizing: border-box;
}
/**
-- show cursor line only in active window
vim.api.nvim_create_autocmd({ "InsertLeave", "WinEnter" }, {
callback = function()
local ok, cl = pcall(vim.api.nvim_win_get_var, 0, "auto-cursorline")
if ok and cl then
vim.wo.cursorline = true
vim.api.nvim_win_del_var(0, "auto-cursorline")
end
end,
})
-- Fix conceallevel for json & help files
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "json", "jsonc" },
callback = function()
vim.wo.spell = false
vim.wo.conceallevel = 0
end,
})
@Mr-Jack82
Mr-Jack82 / autocmds.lua
Created November 19, 2023 20:04
Autocmd for auto save in Neovim like variant instead of use 907th/vim-auto-save
-- Taken from: https://github.com/LintaoAmons/CoolStuffes/blob/5b117d662f1f64e528545d584f5781f4522092c7/lazyvim/.config/nvim/lua/config/autocmds.lua#L5
-- HACK: Autosave
local function save()
local buf = vim.api.nvim_get_current_buf()
vim.api.nvim_buf_call(buf, function()
vim.cmd("silent! write")
end)
end
@Mr-Jack82
Mr-Jack82 / input_method.lua
Created November 19, 2023 16:53
Autocmd for Neovim to be able to change keyboard layout automatically
-- Take from here: https://github.com/LazyVim/LazyVim/discussions/1346
-- Auto change input method between Normal and Insert mode
vim.api.nvim_create_autocmd({ "InsertLeave" }, {
pattern = "*",
callback = function()
-- record the input method in Insert mode
local f_input = vim.fn.stdpath("state") .. "/last_input.tmp"
os.execute("im-select > " .. f_input)
-- switch back to `ABC` input method in Normal mode
@Mr-Jack82
Mr-Jack82 / inline_edit.lua
Created November 19, 2023 16:50
Allow edit for embedded languages like JavaScript in HTML in Neovim which do not support by default in the editor
-- That code taken from here:
-- https://github.com/dpetka2001/dotfiles/blob/3cd9413e1f32589b6bb7a090006f70677379d987/dot_config/nvim/lua/plugins/inline_edit.lua
return {
-- Plugin for editing <script> tags in html files in proxy buffer
-- which also provides support for correct attach `typescript` LSP
{
"AndrewRadev/inline_edit.vim",
lazy = true,
cmd = { "InlineEdit" },
keys = {
@Mr-Jack82
Mr-Jack82 / incline.lua
Created November 19, 2023 16:48
Floating statuslines for Neovim
-- Recipe taken from: https://github.com/LazyVim/LazyVim/discussions/1188
return {
"b0o/incline.nvim",
event = "BufReadPre",
enabled = true,
config = function()
local colors = require("tokyonight.colors").setup()
require("incline").setup({
highlight = {
groups = {
@Mr-Jack82
Mr-Jack82 / assign_map.lua
Created November 19, 2023 16:45
Some map fabric for Neovim usage
-- That snippet is used to assign mappings in neovim
local function map(modes, lhs, rhs, opts)
if type(modes) == "string" then
modes = { modes }
end
local keys = require("lazy.core.handler").handlers.keys
for _, mode in pairs(modes) do
if not keys.active[keys.parse({ lhs, mode = mode }).id] then
opts = opts or {}
opts.silent = opts.silent ~= false
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday;
# │ │ │ │ │ 7 is also Sunday on some systems)
# │ │ │ │ │
# │ │ │ │ │
# * * * * * command_to_execute
@Mr-Jack82
Mr-Jack82 / wireguard.md
Created May 27, 2023 13:53
Инструкция по нрастройке своего VPN сервера на облаке DigitalOcean