Skip to content

Instantly share code, notes, and snippets.

@anoduck
Created December 1, 2024 22:24
Show Gist options
  • Save anoduck/643c955ff98188b19e206d9ce34a1341 to your computer and use it in GitHub Desktop.
Save anoduck/643c955ff98188b19e206d9ce34a1341 to your computer and use it in GitHub Desktop.
Nvim Configuration file for remote installations.
-------------------------------------------
-- _ _ _ ___ ___ --
-- | \| |_ _(_)_ __ | _ \/ __| --
-- | .` \ V / | ' \| / (__ --
-- |_|\_|\_/|_|_|_|_|_|_\\___| --
-- ____ _ --
-- | _ \ ___ _ __ ___ ___ | |_ ___ --
-- | |_) / _ \ '_ ` _ \ / _ \| __/ _ \ --
-- | _ < __/ | | | | | (_) | || __/ --
-- |_| \_\___|_| |_| |_|\___/ \__\___| --
-------------------------------------------
--------------------------------------------------------------------
-- My custom init file for nvim on remote sessions
--------------------------------------------------------------------
---------------------------------------------------------------------------------------
-- https://vonheikemen.github.io/devlog/tools/build-your-first-lua-config-for-neovim/
---------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-- https://github.com/allen-mack/nvim-table-md <-- Needs filetype specific configuration
----------------------------------------------------------------------------------
if vim.g.neovide then
-- Put anything you want to happen only in Neovide here
vim.g.neovide_scale_factor = 1.0
vim.o.guifont = "BlexMono Nerd Font Mono:h9"
end
-----------------------------
-- Some Basic Configurations
-----------------------------
vim.opt.number = true
vim.opt.mouse = 'a'
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.hlsearch = false
vim.opt.autowrite = true
vim.opt.autochdir = true
vim.opt.breakindent = false
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.expandtab = false
vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
vim.opt.termguicolors = true
vim.opt.writebackup = false
vim.opt.smartindent = true
vim.opt.clipboard = 'unnamedplus'
vim.opt.fileencoding = 'utf-8'
vim.opt.wrap = true
vim.opt.ruler = true
vim.opt.textwidth = 90
vim.opt.timeoutlen = 500
vim.opt.undofile = true
vim.opt.updatetime = 300
vim.opt.signcolumn = 'yes'
vim.opt.splitright = true
vim.opt.splitbelow = true
vim.opt.backup = false
vim.opt.shell = '/usr/bin/zsh'
vim.opt.hidden = true
vim.opt.foldenable = false
vim.opt.background = "dark"
vim.g.mapleader = " "
vim.g.netrw_banner = 0
vim.g.netrw_winsize = 30
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.g.redrawtime = 1000
vim.g.skip_ts_context_commentstring_module = true
vim.opt.maxmempattern = 2000
-----------------------------
-- ___ _ _
-- | _ \__ _| |_| |_ ___
-- | _/ _` | _| ' \(_-<
-- |_| \__,_|\__|_||_/__/
-----------------------------
vim.env.PATH = '~/.cargo/bin:' ..
'~/.local/bin:' ..
'~/.yarn/bin:' ..
'~/node_modules/.bin' ..
'/usr/local/jdk-17/bin' ..
'~/go/bin/bin:' ..
'~/.yarn/bin:' ..
'~/bin:' ..
vim.env.PATH
-----------------------------
-- Preliminary Keymaps
-----------------------------
-- Set the leader key
vim.g.mapleader = ' '
-- copy to clipboard
vim.keymap.set({ 'n', 'x' }, 'cp', '"+y')
-- paste to clipboard
vim.keymap.set({ 'n', 'x' }, 'cv', '"+p')
-- delete without changing registers
vim.keymap.set({ 'n', 'x' }, 'x', '"_x')
-- select all text
vim.keymap.set('n', '<leader>a', ':keepjumps normal! ggVG<cr>')
-----------------------------------------------------------------
-- AutoCommands
-- --------------------------------------------------------------
local group = vim.api.nvim_create_augroup('user_cmds', { clear = true })
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight on yank',
group = group,
callback = function()
vim.highlight.on_yank({ higroup = 'Visual', timeout = 200 })
end,
})
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'help', 'man' },
group = group,
command = 'nnoremap <buffer> q <cmd>quit<cr>'
})
vim.api.nvim_create_autocmd('User', {
pattern = 'LspAttached',
desc = 'LSP actions',
callback = function()
local bufmap = function(mode, lhs, rhs)
local opts = { buffer = true }
vim.keymap.set(mode, lhs, rhs, opts)
end
bufmap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>')
bufmap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>')
bufmap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>')
bufmap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>')
bufmap('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>')
bufmap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>')
bufmap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<cr>')
bufmap('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>')
bufmap('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>')
bufmap('x', '<F4>', '<cmd>lua vim.lsp.buf.range_code_action()<cr>')
bufmap('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<cr>')
bufmap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>')
bufmap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<cr>')
end
})
--------------------------------------------------------------------------
-- Workaround for treesitter
--------------------------------------------------------------------------
-- Next two intentionally commented out.
-- -- vim.opt.foldmethod = 'expr'
-- -- vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
---WORKAROUND
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufAdd', 'BufNew', 'BufNewFile', 'BufWinEnter' }, {
group = vim.api.nvim_create_augroup('TS_FOLD_WORKAROUND', {}),
callback = function()
vim.opt.foldmethod = 'expr'
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
end
})
---ENDWORKAROUND
--------------------------------------------------------------------------
-- Setup Diagnostic actions
--------------------------------------------------------------------------
local sign = function(opts)
vim.fn.sign_define(opts.name, {
texthl = opts.name,
text = opts.text,
numhl = ''
})
end
sign({ name = 'DiagnosticSignError', text = '✘' })
sign({ name = 'DiagnosticSignWarn', text = '▲' })
sign({ name = 'DiagnosticSignHint', text = '⚑' })
sign({ name = 'DiagnosticSignInfo', text = '' })
vim.diagnostic.config({
virtual_text = false,
severity_sort = true,
float = {
border = 'rounded',
source = 'always',
header = '',
prefix = '',
},
})
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
vim.lsp.handlers.hover,
{ border = 'rounded' })
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
vim.lsp.handlers.signature_help,
{ border = 'rounded' })
-- ------------------------------------------------------------------------------
--
--[[ ____ _
-- | _ \ ___| | ___ __
-- | |_) / __| |/ / '__|
-- | __/ (__| <| |
-- |_| \___|_|\_\_|
--]]
-- -----------------------
-- Pckr.nvim
-- ------------------------------------------------------------------------------
local function bootstrap_pckr()
local pckr_path = vim.fn.stdpath("data") .. "/pckr/pckr.nvim"
if not (vim.uv or vim.loop).fs_stat(pckr_path) then
vim.fn.system({
'git',
'clone',
"--filter=blob:none",
'https://github.com/lewis6991/pckr.nvim',
pckr_path
})
end
vim.opt.rtp:prepend(pckr_path)
end
bootstrap_pckr()
-- --------------------------------------------------------------------------------
-- Pckr Specs
-- {
-- #: The plugin location string
-- ---------------------------
-- 'myusername/example',
--
-- __The following keys are all optional__
-- =======================================
-- #: Specifies a git branch to use
-- -------------------------------
-- branch: string?,
--
-- #: Specifies a git tag to use. Supports '*' for "latest tag"
-- ----------------------------------------------------------
-- tag: string?,
--
-- #: Specifies a git commit to use
-- ------------------------------
-- commit: string?,
--
-- #: Skip updating this plugin in updates/syncs. Still cleans.
-- ----------------------------------------------------------
-- lock: boolean?,
--
-- #: Post-update/install hook. See "update/install hooks".
-- ------------------------------------------------------
-- run: string|function,
--
-- #: Specifies plugin dependencies. See "dependencies".
-- ---------------------------------------------------
-- requires: string|string[],
--
-- #: Specifies code to run after this plugin is loaded. If string then require it.
-- #: E.g:
-- #: config = function() require('mod') end
-- #: is equivalent to:
-- #: config = 'mod'
-- -----------------
-- config: string|function,
--
-- #: Specifies code to run before this plugin is loaded. If string then require it.
-- -------------------------------------------------------------------------------
-- config_pre: string|function,
--
-- #: Specifies custom loader
-- --------------------------
-- cond: function|function[], -- Specifies custom loader
-- }
-- ------------------------------------------------------------------------------
--[[ ____ ___ ____ _____
-- / ___/ _ \| _ \| ____|
-- | | | | | | |_) | _|
-- | |__| |_| | _ <| |___
-- \____\___/|_| \_\_____|
--]]
-- -----------------------------------------------------------------------------
require('pckr').add{
{
'VonHeikemen/lsp-zero.nvim',
branch = 'v2.x',
requires = {
-- LSP Support
{'neovim/nvim-lspconfig'}, -- Required
{ -- Optional
'williamboman/mason.nvim',
run = function()
pcall(vim.cmd, 'MasonUpdate')
end,
},
{'williamboman/mason-lspconfig.nvim'}, -- Optional
-- Autocompletion
{'hrsh7th/nvim-cmp'}, -- Required
{'hrsh7th/cmp-nvim-lsp'}, -- Required
{'L3MON4D3/LuaSnip'}, -- Required
{'hrsh7th/cmp-path'},
{'hrsh7th/cmp-buffer'},
{'hrsh7th/cmp-cmdline'},
{'hrsh7th/cmp-emoji'},
}
};
--[[ { ]]
--[[ 'Exafunction/codeium.nvim', ]]
--[[ requires = { ]]
--[[ 'nvim-lua/plenary.nvim', ]]
--[[ 'hrsh7th/nvim-cmp', ]]
--[[ }, ]]
--[[ config = function () ]]
--[[ require("codeium").setup({ ]]
--[[ -- Change '<C-g>' here to any keycode you like. ]]
--[[ vim.keymap.set('i', '<C-g>', function () return vim.fn['codeium#Accept']() end, { expr = true, silent = true }), ]]
--[[ vim.keymap.set('i', '<c-;>', function() return vim.fn['codeium#CycleCompletions'](1) end, { expr = true, silent = true }), ]]
--[[ vim.keymap.set('i', '<c-,>', function() return vim.fn['codeium#CycleCompletions'](-1) end, { expr = true, silent = true }), ]]
--[[ vim.keymap.set('i', '<c-x>', function() return vim.fn['codeium#Clear']() end, { expr = true, silent = true }), ]]
--[[ }) ]]
--[[ end ]]
--[[ } ]]
-- be impatient
{ 'lewis6991/impatient.nvim' };
-- use alpha to startify
{
'goolord/alpha-nvim',
requires = { 'nvim-tree/nvim-web-devicons' },
config = function()
require 'alpha'.setup(require 'alpha.themes.startify'.config)
end
};
{'nvim-tree/nvim-web-devicons'};
{
"mskelton/termicons.nvim",
requires = { 'nvim-tree/nvim-web-devicons' },
config = function()
require('termicons').setup()
end
};
{"gennaro-tedesco/nvim-peekup"};
{
'vidocqh/data-viewer.nvim',
requires = {
"nvim-lua/plenary.nvim",
"kkharji/sqlite.lua", -- Optional, sqlite support
},
config = function ()
require('data-viewer').setup()
end
};
-- -------------------------------------------------------------------------------------------
--[[ ____ __ __ ____
-- / ___| \/ | _ \
-- | | | |\/| | |_) |
-- | |___| | | | __/
-- \____|_| |_|_|
--]]
-- --------------------------------------------------------------------------------------------
-- bootstrap
{
'rambhosale/cmp-bootstrap.nvim',
after = 'nvim-cmp',
};
{
'lukas-reineke/cmp-rg',
after = 'nvim-cmp',
};
({
"andrewferrier/wrapping.nvim",
opts = {
create_keymaps = false
},
config = function()
require("wrapping").setup()
end,
});
-- lspkind
{'onsails/lspkind.nvim'};
-- ---------------------------------------------------------------------------------------------
--[[ _____ _ _ _
-- |_ _| __ ___ ___ ___(_) |_| |_ ___ _ __
-- | || '__/ _ \/ _ \/ __| | __| __/ _ \ '__|
-- | || | | __/ __/\__ \ | |_| || __/ |
-- |_||_| \___|\___||___/_|\__|\__\___|_|
--]]
-- ----------------------------------------------------------------------------------------------
-- use treesitter
--[[ { ]]
--[[ 'nvim-treesitter/nvim-treesitter', ]]
--[[ run = function() require('nvim-treesitter.install').update({ with_sync = true }) end, ]]
--[[ }; ]]
{
'nvim-treesitter/nvim-treesitter',
run = function ()
local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
ts_update()
end
};
{'nvim-treesitter/nvim-treesitter-context'};
{'nvim-treesitter/nvim-treesitter-textobjects'};
-- use ts-context-commentstring
{
'JoosepAlviste/nvim-ts-context-commentstring',
config = function()
require('ts_context_commentstring').setup {}
end
};
-- -----------------------------------------------------------------------------------------------
--[[ _____ _
-- |_ _|__| | ___ ___ ___ ___ _ __ ___
-- | |/ _ \ |/ _ \/ __|/ __/ _ \| '_ \ / _ \
-- | | __/ | __/\__ \ (_| (_) | |_) | __/
-- |_|\___|_|\___||___/\___\___/| .__/ \___|
-- |_|
--]]
-- -----------------------------------------------------------------------------------------------
-- use telescope
{
'nvim-telescope/telescope.nvim',
branch = "0.1.x",
requires = { { 'nvim-lua/plenary.nvim' } }
};
{"nvim-telescope/telescope-project.nvim"};
-- use telescope-symbols
{"nvim-telescope/telescope-symbols.nvim"};
-- use telescope-luasnip
{"benfowler/telescope-luasnip.nvim"};
-- use telescope software licenses
{"chip/telescope-software-licenses.nvim"};
-- user telescope emoji
{"xiyaowong/telescope-emoji.nvim"};
-- use telescope filebrowser
{"nvim-telescope/telescope-file-browser.nvim"};
-- telescope fzf
{ 'nvim-telescope/telescope-fzf-native.nvim',
run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' };
-- telescope clipboard
{
"AckslD/nvim-neoclip.lua",
requires = {
{ 'kkharji/sqlite.lua', module = 'sqlite' },
{ 'nvim-telescope/telescope.nvim' },
{ 'ibhagwan/fzf-lua' },
},
config = function()
require("neoclip").setup()
end,
};
{
"stevearc/oil.nvim",
config = function()
require("oil").setup()
end,
};
-- -------------------------------------------------------------------------------------------------
--[[ ___ __ __ _
-- / _ \ _ __ __ _ | \/ | ___ __| | ___
-- | | | | '__/ _` |_____| |\/| |/ _ \ / _` |/ _ \
-- | |_| | | | (_| |_____| | | | (_) | (_| | __/
-- \___/|_| \__, | |_| |_|\___/ \__,_|\___|
-- |___/
--]]
-- --------------------------------------------------------------------------------------------------
-- org-bullets
{'akinsho/org-bullets.nvim'};
-- use orgmode
{
'nvim-orgmode/orgmode',
config = function()
require("orgmode").setup {
org_agenda_files = { '~/org/nvim.org' },
org_default_notes_file = '~/org/nvim.org',
}
end
};
-- ----------------------------------------------------------------------------------------------------
--[[ ____ _
-- / ___|___ _ __ ___ _ __ ___ ___ _ __ | |_
-- | | / _ \| '_ ` _ \| '_ ` _ \ / _ \ '_ \| __|
-- | |__| (_) | | | | | | | | | | | __/ | | | |_
-- \____\___/|_| |_| |_|_| |_| |_|\___|_| |_|\__|
--]]
-- -------------------------------------------------------------------------------------------------------
-- use comment.nvim
{
'numToStr/Comment.nvim',
config = function()
require('Comment').setup {
pre_hook = function(ctx)
local U = require "Comment.utils"
local location = nil
if ctx.ctype == U.ctype.block then
location = require("ts_context_commentstring.utils").get_cursor_location()
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
location = require("ts_context_commentstring.utils").get_visual_start_location()
end
return require("ts_context_commentstring.internal").calculate_commentstring {
key = ctx.ctype == U.ctype.line and "__default" or "__multiline",
location = location,
}
end
}
end
};
-- -----------------------------------------------------------------------------------------------------------
-- _ _ _ _ _
-- | \| |_ _| | |___| |___
-- | .` | || | | |___| (_-<
-- |_|\_|\_,_|_|_| |_/__/
-- -----------------------------------------------------------------------------------------------------------
-- null-ls
{
'nvimtools/none-ls.nvim',
requires = {
'nvim-lua/plenary.nvim',
},
event = { "BufReadPre", "BufNewFile" },
config = function ()
local nls = require("null-ls")
return {
root_dir = require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git"),
nls.setup {
sources = {
nls.builtins.formatting.shellharden,
nls.builtins.formatting.stylua,
nls.builtins.formatting.shellharden,
--[[ nls.builtins.formatting.beautysh, ]]
nls.builtins.formatting.black,
nls.builtins.code_actions.gitsigns,
--[[ nls.builtins.code_actions.shellcheck, ]]
--[[ nls.builtins.diagnostics.shellcheck, ]]
nls.builtins.diagnostics.zsh,
-- nls.builtins.diagnostics.flake8,
},
},
}
end
};
-- use prettier
{
'MunifTanjim/prettier.nvim',
config = function()
require("prettier").setup {
bin = 'prettierd',
filetypes = {
"css",
"graphql",
"html",
"javascript",
"javascriptreact",
"json",
"less",
"markdown",
"scss",
"typescript",
"typescriptreact",
"yaml",
}
}
end
};
-- -----------------------------------------
-- Deno
-- ----------------------------------------
{"sigmasd/deno-nvim"};
-- ----------------------------------------
-- Fer Flutter Dev
-- ----------------------------------------
{
'akinsho/flutter-tools.nvim',
requires = {
'nvim-lua/plenary.nvim',
'stevearc/dressing.nvim',
},
};
-- ----------------------------------------
-- Better lua syntax
-- ----------------------------------------
{'euclidianAce/BetterLua.vim'};
-- -----------------------------------------
-- Devicons
-- -----------------------------------------
--devicons
{"kyazdani42/nvim-web-devicons"};
{
"gorbit99/codewindow.nvim",
config = function()
require('codewindow').setup{
auto_enable = true
}
end
};
-- --------------------------------------------------------------------------------------------------
--[[_ _ _____
-- | \ | | ___ ___ |_ _| __ ___ ___
-- | \| |/ _ \/ _ \ _____| || '__/ _ \/ _ \
-- | |\ | __/ (_) |_____| || | | __/ __/
-- |_| \_|\___|\___/ |_||_| \___|\___|
--]]
-- --------------------------------------------------------------------------------------------------
{
'nvim-tree/nvim-tree.lua',
requires = { 'nvim-tree/nvim-web-devicons' },
config = function()
require('nvim-tree').setup {
sync_root_with_cwd = true,
respect_buf_cwd = true,
sort_by = "modification_time",
}
end
};
{"s1n7ax/nvim-window-picker"};
-- -----------------------------------------------------------------------------------------
-- gitsigns
{
'lewis6991/gitsigns.nvim',
};
-- use luasnip
{"saadparwaiz1/cmp_luasnip"};
{
"windwp/nvim-autopairs",
event = "InsertEnter",
config = function()
require("nvim-autopairs").setup {}
end
};
--use guess-indent
{
'nmac427/guess-indent.nvim',
config = function() require('guess-indent').setup {} end,
};
-- ----------------------------------------------------------------------------------------------
--[[_ _________ ______
-- | |/ / ____\ \ / / ___|
-- | ' /| _| \ V /\___ \
-- | . \| |___ | | ___) |
-- |_|\_\_____| |_| |____/
--]]
-- ----------------------------------------------------------------------------------------------
-- use which-key
{
'folke/which-key.nvim',
config = function()
require("which-key").setup()
end
};
-- use Legendary
{"mrjones2014/legendary.nvim"};
-- cmp-nvim-lsp
{
'hrsh7th/cmp-nvim-lsp',
config = function()
require("cmp_nvim_lsp").setup {}
end
};
-- -------------------------------------------------------------------------------------------------
-- use scope
{"tiagovla/scope.nvim"};
-- -------------------------------------------------------------------------------------------------
-- Beacon
{"DanilaMihailov/beacon.nvim"};
-- use indent-blankline
{"lukas-reineke/indent-blankline.nvim"};
{
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
};
{"arkav/lualine-lsp-progress"};
--------------------------------------------------------------------------
--[[
-- ____ _ _
-- / ___| _ __ (_)_ __ _ __ ___| |_ ___
-- \___ \| '_ \| | '_ \| '_ \ / _ \ __/ __|
-- ___) | | | | | |_) | |_) | __/ |_\__ \
-- |____/|_| |_|_| .__/| .__/ \___|\__|___/
-- |_| |_|
--]]
---------------------------------------------------------------------------
-- use friendly snippets
{"rafamadriz/friendly-snippets"};
-- Potentially more snippets in the below package
{"molleweide/LuaSnip-snippets.nvim"};
{
'utilyre/spoon.nvim',
requires = { 'L3MON4D3/LuaSnip' }
};
({
"filipgodlewski/luasnip-ts-snippets.nvim",
requires = { "neovim/nvim-lspconfig" },
branch = "main",
config = function()
local snips = require("luasnip-ts-snippets")
snips.setup({
-- your configuration
})
end
});
{
"smjonas/snippet-converter.nvim",
-- SnippetConverter uses semantic versioning. Example: use version = "1.*" to avoid breaking changes on version 1.
-- Uncomment the next line to follow stable releases only.
-- tag = "*",
config = function()
local template = {
-- name = "t1", (optionally give your template a name to refer to it in the `ConvertSnippets` command)
sources = {
ultisnips = {
-- Add snippets from (plugin) folders or individual files on your runtimepath...
"./vim-snippets/UltiSnips",
"./latex-snippets/tex.snippets",
-- ...or use absolute paths on your system.
vim.fn.stdpath("config") .. "/UltiSnips",
},
snipmate = {
"vim-snippets/snippets",
},
},
output = {
-- Specify the output formats and paths
vscode_luasnip = {
vim.fn.stdpath("config") .. "/luasnip_snippets",
},
},
}
require("snippet_converter").setup {
templates = { template },
-- To change the default settings (see configuration section in the documentation)
-- settings = {},
}
end
};
-- use ts-rainbow
{'p00f/nvim-ts-rainbow'};
---------------------------------------------------------------
--[[_ ____ ____ ____ __ _
-- | | / ___|| _ \ / ___|___ _ __ / _(_) __ _
-- | | \___ \| |_) | | / _ \| '_ \| |_| |/ _` |
-- | |___ ___) | __/| |__| (_) | | | | _| | (_| |
-- |_____|____/|_| \____\___/|_| |_|_| |_|\__, |
-- |___/
--]]
-----------------------------------------------------------------
-- use lsp-basics
{'nanotee/nvim-lsp-basics'};
-- use mkdir
{'jghauser/mkdir.nvim'};
-- use kitty-runner
--[[ use 'jghauser/kitty-runner.nvim' ]]
-- use lsp-colors
{'folke/lsp-colors.nvim'};
--user jqx
{'gennaro-tedesco/nvim-jqx'};
-- use trouble
{
'folke/trouble.nvim',
requires = {
"kyazdani42/nvim-web-devicons"
},
config = function ()
require('trouble').setup {}
end
};
-- use dressing UI decorations
{"stevearc/dressing.nvim"};
-- for schema store
{"b0o/schemastore.nvim"};
-- use langtool for grammar checking
{"rhysd/vim-grammarous"};
-- rofi config syntax
{"Fymyte/tree-sitter-rasi"};
-- use rafi for rofi config files
{
'Fymyte/rasi.vim',
ft = 'rasi',
run = ':TSInstall rasi',
requires = {
'ap/vim-css-color',
'nvim-treesitter/nvim-treesitter',
},
};
-- use glow for markdown preview
{
'ellisonleao/glow.nvim',
config = function()
require("glow").setup {
glow_path = vim.env.HOME .. "/go/bin/bin/glow",
style = 'dark',
width = 80,
}
end
};
-- use align
{'Vonr/align.nvim'};
-- use trim
{
'cappyzawa/trim.nvim',
config = function()
require("trim").setup {
ft_blocklist = {},
patterns = {
[[%s/\s\+$//e]], -- remove unwanted spaces
[[%s/\($\n\s*\)\+\%$//]], -- trim last line
[[%s/\%^\n\+//]], -- trim first line
-- [[%s/\(\n\n\)\n\+/\1/]], -- replace multiple blank lines with a single line
},
}
end
};
--use figban
{"thazelart/figban.nvim"};
-- --------------------------------------------------------------------------------------------------
--[[ __ __ _ _ __ __
-- | \/ (_)_ __ (_) \/ | __ _ _ __
-- | |\/| | | '_ \| | |\/| |/ _` | '_ \
-- | | | | | | | | | | | | (_| | |_) |
-- |_| |_|_|_| |_|_|_| |_|\__,_| .__/
-- |_|
--]]
-- --------------------------------------------------------------------------------------------------
-- use colorizer
{"NvChad/nvim-colorizer.lua"};
-- nvim-highlight-colors
{"brenoprata10/nvim-highlight-colors"};
-- use ToggleTerm
{ "akinsho/toggleterm.nvim",
tag = '*',
config = function()
require("toggleterm").setup({
autochdir = false,
start_in_insert = true
})
end
};
{
"https://git.sr.ht/~havi/telescope-toggleterm.nvim",
event = "TermOpen",
requires = {
"akinsho/nvim-toggleterm.lua",
"nvim-telescope/telescope.nvim",
"nvim-lua/popup.nvim",
"nvim-lua/plenary.nvim",
},
config = function()
require("telescope").load_extension "toggleterm"
end,
};
--use substitute
{"gbprod/substitute.nvim"};
--use marks
{
'chentoast/marks.nvim',
config = function()
require("marks").setup()
end
};
-- use Wakatime
{'wakatime/vim-wakatime'};
-- use poetry
{
"karloskar/poetry-nvim",
config = function()
require("poetry-nvim").setup()
end
};
--[[ use({ ]]
--[[ "jpfender/pipenv.nvim", ]]
--[[ requires = "nvim-lua/plenary.nvim", ]]
--[[ }); ]]
-- virt column
{"xiyaowong/virtcolumn.nvim"};
{
"jbyuki/venn.nvim",
requires = {
"anuvyklack/hydra.nvim",
}
};
{
"romgrk/barbar.nvim",
config = function ()
require('barbar').setup()
end
};
-- use tmux.nvim
({
"aserowy/tmux.nvim",
config = function() return require("tmux").setup() end
});
-- ----------------------------------------------
--[[ ____ _ _ _
-- | _ \| | __ _ _ __ | |_ _ _ _ __ ___ | |
-- | |_) | |/ _` | '_ \| __| | | | '_ ` _ \| |
-- | __/| | (_| | | | | |_| |_| | | | | | | |
-- |_| |_|\__,_|_| |_|\__|\__,_|_| |_| |_|_|
--]]
-- ---------------------------------------------
{"aklt/plantuml-syntax"};
{
'Sol-Ponz/plantuml-previewer.nvim',
config = function ()
require("plantuml-previewer").setup({
plantuml_jar = "~/bin/plantuml.jar",
java_command = "/usr/bin/java",
})
end
};
-- ---------------------------------------------
--[[ __ __ ___ ____ ____
-- | \/ |_ _/ ___| / ___|
-- | |\/| || |\___ \| |
-- | | | || | ___) | |___
-- |_| |_|___|____/ \____|
--]]
-- ---------------------------------------------
{"lambdalisue/suda.vim"};
{"mboughaba/i3config.vim"};
{"elkowar/yuck.vim"};
{"dpezto/gnuplot.vim"};
-- -----------------------------------------------------------------------------------------------
--[[ _ _ ____ _ ____ _
-- | | | |___ ___ / ___|___ | | ___ _ __/ ___| ___| |__ ___ _ __ ___ ___
-- | | | / __|/ _ \ | | / _ \| |/ _ \| '__\___ \ / __| '_ \ / _ \ '_ ` _ \ / _ \
-- | |_| \__ \ __/ | |__| (_) | | (_) | | ___) | (__| | | | __/ | | | | | __/
-- \___/|___/\___| \____\___/|_|\___/|_| |____/ \___|_| |_|\___|_| |_| |_|\___|
--]] -----------------------------------------------------------------------------------------------
------------------------------------------------------------------
-- OneDark Theme
------------------------------------------------------------------
{
'navarasu/onedark.nvim',
config = function ()
require('onedark').setup ({
style = 'deep'
})
require('onedark').load()
end
};
-- ---------------------------
} -- End of pckr Management
-- ============================================================================================================
-------------------------------------------------------------------------------------
-- Plugin Configuration
-------------------------------------------------------------------------------------
-- https://vonheikemen.github.io/devlog/tools/setup-nvim-lspconfig-plus-nvim-cmp/
-- https://github.com/neovim/nvim-lspconfig
--====================================================================================
-- ====================================================================================
--[[ ____ __ _ _ _
-- / ___|___ _ __ / _(_) __ _ _ _ _ __ __ _| |_(_) ___ _ __
-- | | / _ \| '_ \| |_| |/ _` | | | | '__/ _` | __| |/ _ \| '_ \
-- | |__| (_) | | | | _| | (_| | |_| | | | (_| | |_| | (_) | | | |
-- \____\___/|_| |_|_| |_|\__, |\__,_|_| \__,_|\__|_|\___/|_| |_|
-- |___/
--]]
-- ====================================================================================
---------------------------------------------------------
-- _ _ _
-- | | _ _ __ _| | (_)_ _ ___
-- | |_| || / _` | |__| | ' \/ -_)
-- |____\_,_\__,_|____|_|_||_\___|
---------------------------------------------------------
vim.opt.showmode = false
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'onedark',
component_separators = '|',
section_separators = '',
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_c = { 'filesize', 'filename', 'lsp_progress' },
--[[ lualine_x = { { "pipenv", icon = "?" }, 'encoding', 'fileformat', 'filetype' }, ]]
lualine_y = { 'progress' },
lualine_z = { 'location' },
},
tabline = {},
winbar = {},
extensions = {}
}
----------------------------------------------------------
-- __ __ _
-- | \/ (_)___ __
-- | |\/| | (_-</ _|
-- |_| |_|_/__/\__|
-- -------------------------------------------------------
require("colorizer").setup()
require("nvim-highlight-colors").setup()
---------------------------------------------------------------
--
----------------------------------------------------------------
-- venn.nvim: enable or disable keymappings
function _G.Toggle_venn()
local venn_enabled = vim.inspect(vim.b.venn_enabled)
if venn_enabled == "nil" then
vim.b.venn_enabled = true
vim.cmd [[setlocal ve=all]]
-- draw a line on HJKL keystokes
vim.api.nvim_buf_set_keymap(0, "n", "J", "<C-v>j:VBox<CR>", { noremap = true })
vim.api.nvim_buf_set_keymap(0, "n", "K", "<C-v>k:VBox<CR>", { noremap = true })
vim.api.nvim_buf_set_keymap(0, "n", "L", "<C-v>l:VBox<CR>", { noremap = true })
vim.api.nvim_buf_set_keymap(0, "n", "H", "<C-v>h:VBox<CR>", { noremap = true })
-- draw a box by pressing "f" with visual selection
vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox<CR>", { noremap = true })
else
vim.cmd [[setlocal ve=]]
vim.cmd [[mapclear <buffer>]]
vim.b.venn_enabled = nil
end
end
-- toggle keymappings for venn using <leader>v
vim.api.nvim_set_keymap('n', '<leader>v', ":lua Toggle_venn()<CR>", { noremap = true })
--------------------------------------------------------
-- _____ _
-- |_ _|__| |___ ___ __ ___ _ __ ___
-- | |/ -_) / -_|_-</ _/ _ \ '_ \/ -_)
-- |_|\___|_\___/__/\__\___/ .__/\___|
-- |_|
-- https://github.com/nvim-telescope/telescope.nvim
--------------------------------------------------------
require('telescope').setup {
defaults = {
-- Default configuration for telescope goes here:
-- config_key = value,
mappings = {
i = {
-- map actions.which_key to <C-h> (default: <C-/>)
-- actions.which_key shows the mappings for your picker,
-- e.g. git_{create, delete, ...}_branch for the git_branches picker
["<C-h>"] = "which_key"
},
--i = { ["<c-t>"] = trouble.open_with_trouble },
--n = { ["<c-t>"] = trouble.open_with_trouble },
}
},
pickers = {
-- Default configuration for builtin pickers goes here:
-- picker_name = {
-- picker_config_key = value,
-- }
-- Now the picker_config_key will be applied every time you call this
-- builtin picker
},
extensions = {
-- Your extension configuration goes here:
-- extension_name = {
-- extension_config_key = value,
-- }
-- please take a look at the readme of the extension you want to configure
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case"
},
neorg = {},
project = {
base_dirs = {
--[[ '~/norg', ]]
'~/Sandbox/wifipumpkin-extras',
'~/.config/sway',
},
hidden_files = false,
theme = "dropdown",
order_by = "asc"
},
file_browser = {
theme = "ivy",
hijack_netrw = true,
}
}
}
require('telescope').load_extension('fzf')
require("telescope").load_extension('project')
require('telescope').load_extension('software-licenses')
require("telescope").load_extension('luasnip')
require('telescope').load_extension('file_browser')
require('telescope').load_extension('emoji')
-- require('telescope').load_extension('neorg')
----------------------------------------------------------------------
-- _____ _ _ _
-- |_ _| _ ___ ___ __(_) |_| |_ ___ _ _
-- | || '_/ -_) -_|_-< | _| _/ -_) '_|
-- |_||_| \___\___/__/_|\__|\__\___|_|
----------------------------------------------------------------------
require('nvim-treesitter.configs').setup {
ensure_installed = { "norg",
"awk",
"bash",
"comment",
"diff",
"dockerfile",
"fish",
"git_rebase",
"gitignore",
"go",
"gomod",
"graphql",
"hjson",
"jsonnet",
"latex",
"make",
-- "markdown_inline",
"meson",
"ninja",
"ql",
"phpdoc",
"regex",
"rust",
"gitignore",
"markdown",
"ledger",
"toml",
"yaml",
"javascript",
"beancount",
"python",
"vim",
"php",
"lua",
"scss",
"sql",
"todotxt",
"toml",
"twig",
"tsx",
"typescript",
"vim",
"zig",
"json",
"json5",
"html",
"css",
"org",
--[[ other parsers you would wish to have ]] },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = true,
-- Automatically install missing parsers when entering buffer
auto_install = true,
highlight = { -- Be sure to enable highlights if you haven't!
enable = true,
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
-- disable = { "c", "rust" },
ft_blocklist = { "vim" },
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = { "org" },
},
rainbow = {
enable = true,
-- disable = { "jsx", "cpp" }, list of languages you want to disable the plugin for
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
-- max_file_lines = nil, -- Do not enable for files with more than n lines, int
-- colors = {}, -- table of hex strings
-- termcolors = {} -- table of colour name strings
},
context_commentstring = {
enable = true,
enable_autocmd = false,
},
autotag = {
enable = true,
},
}
----------------------------------------------------------------------------
-- ___ _ _
-- |_ _|_ _ __| |___ _ _| |_
-- | || ' \/ _` / -_) ' \ _|
-- |___|_||_\__,_\___|_||_\__|
-- ___ _ _ _ _
-- | _ ) |__ _ _ _ | |_| | (_)_ _ ___
-- | _ \ / _` | ' \| / / |__| | ' \/ -_)
-- |___/_\__,_|_||_|_\_\____|_|_||_\___|
----------------------------------------------------------------------------
local highlight = {
"RainbowRed",
"RainbowYellow",
"RainbowBlue",
"RainbowOrange",
"RainbowGreen",
"RainbowViolet",
"RainbowCyan",
}
local hooks = require "ibl.hooks"
-- create the highlight groups in the highlight setup hook, so they are reset
-- every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
end)
require("ibl").setup { indent = { highlight = highlight } }
-- -------------------------------------------------------------------------
--[[ _ ____ ____ __________ ____ ___
-- | | / ___|| _ \ |__ / ____| _ \ / _ \
-- | | \___ \| |_) |____ / /| _| | |_) | | | |
-- | |___ ___) | __/_____/ /_| |___| _ <| |_| |
-- |_____|____/|_| /____|_____|_| \_\\___/
--]]
-- -------------------------------------------------------------------------
local lsp = require("lsp-zero").preset {}
lsp.on_attach(function(client, bufnr)
lsp.default_keymaps { buffer = bufnr }
end)
-- (Optional) Configure lua language server for neovim
require("lspconfig").lua_ls.setup(lsp.nvim_lua_ls())
local lspconfig = require "lspconfig"
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
--[[ vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with( ]]
--[[ vim.lsp.diagnostic.on_publish_diagnostics, ]]
--[[ { ]]
--[[ underline = true, ]]
--[[ virtual_text = { ]]
--[[ spacing = 5, ]]
--[[ severity = 'WARN', ]]
--[[ }, ]]
--[[ update_in_insert = true, ]]
--[[ } ]]
--[[ ) ]]
lspconfig.jedi_language_server.setup {}
lspconfig.bashls.setup {}
-- --[[ lspconfig.ltex.setup({}) ]]
--[[ lspconfig.prosemd_lsp.setup {} ]]
lspconfig.pyright.setup({
settings = {
python = {
analysis = {
autoSearchPaths = true,
diagnosticMode = "workspace",
useLibraryCodeForTypes = true
}
}
},
single_file_support = true,
})
lspconfig.eslint.setup {}
lspconfig.cssls.setup {
capabilities = capabilities,
}
lspconfig.jsonls.setup {
capabilities = capabilities,
}
-- --[[ lspconfig.grammarly.setup({ ]]
-- --[[ clientId = "client_3xNi2ntM9Q1Z3foVBsqzUd", ]]
-- --[[ }) ]]
lspconfig.html.setup {
capabilities = capabilities,
cmd = { "vscode-html-language-server", "--stdio" },
init_options = {
configurationSection = { "html", "css", "javascript" },
embeddedLanguages = {
css = true,
javascript = true,
},
provideFormatter = true,
},
}
-- --[[ lspconfig.tailwindcss.setup({}) ]]
lspconfig.ts_ls.setup {}
lspconfig.taplo.setup {}
lspconfig.emmet_ls.setup {}
lspconfig.yamlls.setup {
settings = {
yaml = {
cmd = {
"~/.local/share/yarn/global/node_modules/yaml-language-server/bin/yaml-language-server",
"--stdio",
},
schemas = require("schemastore").json.schemas(),
},
},
}
lspconfig.lua_ls.setup({
single_file_support = true,
--[[ flags = { ]]
--[[ debounce_text_changes = 150, ]]
--[[ } ]]
})
lspconfig.dockerls.setup({})
--[[ lspconfig.docker_compose_language_server.setup({}) ]]
lspconfig.jedi_language_server.setup({})
lspconfig.bashls.setup({})
--[[ lspconfig.ltex.setup({}) ]]
--[[ lspconfig.prosemd_lsp.setup({}) ]]
lspconfig.pyright.setup({})
lspconfig.eslint.setup({})
lspconfig.cssls.setup({
capabilities = capabilities,
})
lspconfig.jsonls.setup({
capabilities = capabilities,
})
--[[ lspconfig.grammarly.setup({}) ]]
lspconfig.html.setup({
capabilities = capabilities,
cmd = { "vscode-html-language-server", "--stdio" },
init_options = {
configurationSection = { "html", "css", "javascript" },
embeddedLanguages = {
css = true,
javascript = true
},
provideFormatter = true
}
})
lspconfig.awk_ls.setup({
cmd = {"/usr/local/bin/awk-language-server"},
filetypes = { 'awk' },
root_dir = require('lspconfig.util').root_pattern(".awk"),
handlers = {
['workspace/workspaceFolders'] = function()
return {{
uri = 'file://' .. vim.fn.getcwd(),
name = 'current_dir',
}}
end
}
})
lsp.setup()
local cmp = require "cmp"
local cmp_action = require("lsp-zero").cmp_action()
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup {
sources = {
{ name = "path" },
{ name = "nvim_lsp" },
{ name = "buffer", keyword_length = 3 },
{ name = "luasnip", keyword_length = 2 },
--[[ { name = "codeium", keyword_length = 2 }, ]]
{ name = "nvim-lua" },
{ name = "cmdline" },
{ name = "emoji" },
{ name = "bootstrap" },
{ name = "rg" },
{ name = 'path' },
{ name = 'lspkind' },
{ name = 'neorg', keyword_length = 3 },
{ name = 'org', keyword_length = 3 },
},
formatting = {
fields = { "abbr", "menu" },
format = require("lspkind").cmp_format {
mode = "symbol", -- show only symbol annotations
maxwidth = 50, -- prevent the popup from showing more than provided characters
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead
--[[ symbol_map = { ]]
--[[ Codeium = "", ]]
--[[ }, ]]
before = function (entry, vim_item)
return vim_item
end
},
},
mapping = {
-- `Enter` key to confirm completion
["<CR>"] = cmp.mapping.confirm { select = false },
-- Ctrl+Space to trigger completion menu
["<C-Space>"] = cmp.mapping.complete(),
["<Tab>"] = cmp_action.luasnip_supertab(),
["<S-Tab>"] = cmp_action.luasnip_shift_supertab(),
["<C-f>"] = cmp_action.luasnip_jump_forward(),
["<C-b>"] = cmp_action.luasnip_jump_backward(),
},
}
-- ===========================================================================
-- _ __
-- | |/ /___ _ _ ___
-- | ' </ -_) || (_-<
-- |_|\_\___|\_, /__/
-- |__/
------------------------------------------------------------------------------
-- More Which Key Setup
-- https://github.com/folke/which-key.nvim
-- Fer Legendary
-- https://github.com/mrjones2014/legendary.nvim
------------------------------------------------------------------------------
local wk = require("which-key")
local setup = {
plugins = {
marks = true, -- shows a list of your marks on ' and `
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
spelling = {
enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
suggestions = 20, -- how many suggestions should be shown in the list?
},
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
-- No actual key bindings are created
presets = {
operators = false, -- adds help for operators like d, y, ... and registers them for motion / text object completion
motions = true, -- adds help for motions
text_objects = true, -- help for text objects triggered after entering an operator
windows = true, -- default bindings on <c-w>
nav = true, -- misc bindings to work with windows
z = true, -- bindings for folds, spelling and others prefixed with z
g = true, -- bindings for prefixed with g
},
},
-- add operators that will trigger motion and text object completion
-- to enable all native operators, set the preset / operators plugin above
operators = { gc = "Comments" },
key_labels = {
-- override the label used to display some keys. It doesn't effect WK in any other way.
-- For example:
["<space>"] = "SPC",
["<cr>"] = "RET",
["<tab>"] = "TAB",
},
icons = {
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
separator = "➜", -- symbol used between a key and it's label
group = "+", -- symbol prepended to a group
},
popup_mappings = {
scroll_down = "<c-d>", -- binding to scroll down inside the popup
scroll_up = "<c-u>", -- binding to scroll up inside the popup
},
window = {
border = "rounded", -- none, single, double, shadow
position = "bottom", -- bottom, top
margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
winblend = 0,
},
layout = {
height = { min = 4, max = 25 }, -- min and max height of the columns
width = { min = 20, max = 50 }, -- min and max width of the columns
spacing = 3, -- spacing between columns
align = "left", -- align columns left, center or right
},
ignore_missing = true, -- enable this to hide mappings for which you didn't specify a label
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
show_help = true, -- show help message on the command line when the popup is visible
triggers = "auto", -- automatically setup triggers
-- triggers = {"<leader>"} -- or specify a list manually
triggers_blacklist = {
-- list of mode / prefixes that should never be hooked by WhichKey
-- this is mostly relevant for key maps that start with a native binding
-- most people should not need to change this
i = { "j", "k" },
v = { "j", "k" },
},
}
-----------------------------------------------------------------------------------------------------
-- __ ___ __ _ __ ___ _
-- \ \ / / |/ / | |/ /___ _ _ / __|___ __| |___ ___
-- \ \/\/ /| ' < | ' </ -_) || | (__/ _ \/ _` / -_|_-<
-- \_/\_/ |_|\_\ |_|\_\___|\_, |\___\___/\__,_\___/__/
-- |__/
-----------------------------------------------------------------------------------------------------
--[[ local opts = { ]]
--[[ mode = "n", -- NORMAL mode ]]
--[[ prefix = "<leader>", ]]
--[[ buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings ]]
--[[ silent = true, -- use `silent` when creating keymaps ]]
--[[ noremap = true, -- use `noremap` when creating keymaps ]]
--[[ nowait = true, -- use `nowait` when creating keymaps ]]
--[[ } ]]
--[[]]
-- --------------------------------------------------------------------------
vim.g.mapleader = " "
require("legendary").setup({
extensions = {
lazy_nvim = false,
which_key = { auto_register = true},
},
})
local wk = require("which-key")
wk.add({
-- ======================= with leader ============================================
{ "<leader>a", "<cmd>Alpha<cr>", desc = "Alpha" },
{ "<leader>b", "<cmd>lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{previewer = false})<cr>", desc = "buffers" },
{ "<leader>|", "<cmd>peekup_open<cr>", desc = "Peekup Open" },
{ "<leader>M", "<cmd>Commentalist<cr>", desc = "Open Commentalist"},
{ "<leader>e", "<cmd>NvimTreeToggle<cr>", desc = "Explorer" },
{ "<leader>W", "<cmd>w!<CR>", desc = "Save" },
{ "<leader>Q", "<cmd>q!<CR>", desc = "Quit" },
{ "<leader>C", "<cmd>bdelete!<CR>", desc = "Close Buffer" },
{ "<leader>h", "<cmd>nohlsearch<CR>", desc = "No Highlight" },
{ "<leader>S", "<cmd>lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})<cr>", desc = "Find files"},
{ "<leader>F", "<cmd>Telescope live_grep theme=ivy<cr>", desc = "Find Text" },
{ "<leader>T", "<cmd>:ASToggle<cr>", desc = "Toggle auto save" },
{ "<leader>V", "<cmd>:HSHighlight<cr>", desc = "Highlight selection" },
{ "<leader>U", "<cmd>:HSRmHighlight<cr>", desc = "Remove highlight from selection" },
-- ========================= Groups ===================================================
-- name = "Align"
{ "<leader>A", group = "Align" },
{ "<leader>Aa", "<cmd>lua require('align').align_to_char(1, true)<cr>", desc = "align to 1 character left" },
{ "<leader>As", "<cmd>lua require('align').align_to_char(2, true, true)<cr>", desc = "alignt to 2 characters left" },
{ "<leader>Aw", "<cmd>lua require('align').align_to_string(false, true, true)<cr>", desc = "align to string left" },
{ "<leader>Ar", "<cmd>lua require('align').align_to_string(true, true, true)<cr>", desc = "align to lua pattern left" },
-- name = "Boxes"
{ "<leader>B", group = "Boxes" },
{ "<leader>Bm", "<cmd>vim.cmd[[!boxes -d sh-cmt]]<cr>", desc = "Insert Boxes Shell comment" },
{ "<leader>Bx", "<cmd>vim.cmd[[!boxes -s sh-cmt -r]]<cr>", desc = "Insert a different Shell Comment" },
-- name = "Files",
{ "<leader>f", group = "Files" },
{ "<leader>fw", "<cmd>hide edit ~/Sandbox/wiki/README.md<cr>", desc = "Open Wiki" },
{ "<leader>fi", "<cmd>hide edit ~/.config/nvim/init.lua<cr>", desc = "Open Nvim Init" },
-- name = "Pommodoro",
--[[ { "<leader>i", group = "Pomodoro" }, ]]
--[[ { "<leader>iw", "<cmd>lua require('pommodoro-clock').start('work')<cr>", desc = "Start Pommodoro" }, ]]
--[[ { "<leader>is", "<cmd>lua require('pommodoro-clock').start('short_break')<cr>", desc = "Short Break" }, ]]
--[[ { "<leader>il", "<cmd>lua require('pommodoro-clock').start('long_break')<cr>", desc = "Long Break" }, ]]
--[[ { "<leader>ip", "<cmd>lua require('pommodoro-clock').toggle_pause()<cr>", desc = "Toggle Pause" }, ]]
--[[ { "<leader>ic", "<cmd>lua require('pommodoro-clock').close()<cr>", desc = "Close" }, ]]
-- name = "LSP",
{ "<leader>l", group = "LSP" },
{ "<leader>la", "<cmd>lua vim.lsp.buf.code_action()<cr>", desc = "Code Action" },
{ "<leader>ld", "<cmd>Telescope lsp_document_diagnostics<cr>", desc = "Document Diagnostics" },
{ "<leader>lw", "<cmd>Telescope lsp_workspace_diagnostics<cr>", desc = "Workspace Diagnostics" },
{ "<leader>lf", "<cmd>lua vim.lsp.buf.format { async=true }<cr>", desc = "Format" },
{ "<leader>li", "<cmd>LspInfo<cr>", desc = "Info" },
{ "<leader>lI", "<cmd>LspInstallInfo<cr>", desc = "Installer Info" },
{ "<leader>lj", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", desc = "Next Diagnostic" },
{ "<leader>lk", "<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>", desc = "Prev Diagnostic" },
{ "<leader>ll", "<cmd>lua vim.lsp.codelens.run()<cr>", desc = "CodeLens Action" },
{ "<leader>lq", "<cmd>lua vim.lsp.diagnostic.set_loclist()<cr>", desc = "Quickfix" },
{ "<leader>lr", "<cmd>lua vim.lsp.buf.rename()<cr>", desc = "Rename" },
{ "<leader>ls", "<cmd>Telescope lsp_document_symbols<cr>", desc = "Document Symbols" },
{ "<leader>lS", "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>", desc = "Workspace Symbols" },
-- name = "Markdown Table",
--[[ { "<leader>m", group = "Markdown Table" }, ]]
--[[ { "<leader>mf", "<cmd>lua require('tablemd').format()<cr>", desc = "Format Table" }, ]]
--[[ { "<leader>mc", "<cmd>lua require('tablemd').insertColumn(false)<cr>", desc = "Insert Column" }, ]]
--[[ { "<leader>md", "<cmd>lua require('tablemd').deleteColumn()<cr>", desc = "Delete Current Column" }, ]]
--[[ { "<leader>mr", "<cmd>lua require('tablemd').insertRow(false)<cr>", desc = "Insert Row Below" }, ]]
--[[ { "<leader>mR", "<cmd>lua require('tablemd').insertRow(true)<cr>", desc = "Insert Row Above" }, ]]
--[[ { "<leader>mj", "<cmd>lua require('tablemd').alignColumn('left')<cr>", desc = "Align Left" }, ]]
--[[ { "<leader>mk", "<cmd>lua require('tablemd').alignColumn('center')<cr>", desc = "Align Center" }, ]]
--[[ { "<leader>ml", "<cmd>lua require('tablemd').alignColumn('right')<cr>", desc = "Alignt Right" }, ]]
-- name = "Neorg",
--[[ { "<leader>N", group = "Neorg" }, ]]
--[[ { "<leader>NS", "<cmd>NeorgStart<cr>", desc = "Neorg Start" }, ]]
--[[ { "<leader>Nc", "<cmd>Neorg gtd capture<cr>", desc = "Capture Task" }, ]]
--[[ { "<leader>Nv", "<cmd>Neorg gtd views<cr>", desc = "GTD Views" }, ]]
--[[ { "<leader>Ne", "<cmd>Neorg gtd edit<cr>", desc = "Edit Task" }, ]]
--[[ { "<leader>Np", "<cmd>Neorg gtd_project_tags<cr>", desc = "Project Tags" }, ]]
-- name = "org",
--[[ { "<leader>o", group = "Org" }, ]]
--[[ { "<leader>oa", "<cmd>lua require('orgmode').org.agenda<cr>", desc = "Org Agenda" }, ]]
--[[ { "<leader>oc", "<cmd>lua require('orgmode').org.capture<cr>", desc = "Org Capture" }, ]]
-- name = "Substitute" = r
{ "<leader>r", group = "Substitute" },
{ "<leader>ro", "<cmd>lua require('substitute').operator()<cr>", desc = "Substitute Operator" },
{ "<leader>rl", "<cmd>lua require('substitute').line()<cr>", desc = "Substitute Line" },
{ "<leader>re", "<cmd>lua require('substitute').eol()<cr>", desc = "Substitute EOL" },
{ "<leader>rv", "<cmd>lua require('substitute').visual()<cr>", desc = "Substitute Visual" },
-- name = "Telescope" = s
{ "<leader>s", group = "Telescope" },
{ "<leader>sB", "<cmd>Telescope git_branches<cr>", desc = "Checkout branch" },
{ "<leader>sc", "<cmd>Telescope colorscheme<cr>", desc = "Colorscheme" },
{ "<leader>sd", "<cmd>Telescope projections<cr>", desc = "Projections" },
{ "<leader>se", "<cmd>lua require('fzf-lua-p').projects()<cr>", desc = "fzf projections" },
{ "<leader>sx", "<cmd>Telescope file_browser<cr>", desc = "File Browser" },
{ "<leader>sh", "<cmd>Telescope help_tags<cr>", desc = "Find Help" },
{ "<leader>sl", "<cmd>Legendary<cr>", desc = "Legendar" },
{ "<leader>sM", "<cmd>Telescope man_pages<cr>", desc = "Man Pages" },
{ "<leader>sp", "<cmd>Telescope projects<cr>", desc = "Projects" },
{ "<leader>sr", "<cmd>Telescope oldfiles<cr>", desc = "Open Recent File" },
{ "<leader>sR", "<cmd>Telescope registers<cr>", desc = "Registers" },
{ "<leader>sk", "<cmd>Telescope keymaps<cr>", desc = "Keymaps" },
{ "<leader>sC", "<cmd>Telescope commands<cr>", desc = "Commands" },
{ "<leader>sf", "<cmd>lua require('telescope-builtin').find_files()<cr>", desc = "Find Files" },
{ "<leader>sg", "<cmd>lua require('telescope-builtin').live_grep()<cr>", desc = "Live Grep" },
{ "<leader>sb", "<cmd>lua require('telescope-builtin').buffers()<cr>", desc = "Show Buffers" },
{ "<leader>sn", "<cmd>lua require('telescope-builtin').help_tags()<cr>", desc = "Help tags" },
-- name = "Nvim-tree",
{ "<leader>t", group = "Nvim-tree" },
{ "<leader>tt", "<cmd>NvimTreeToggle<cr>", desc = "Open or Close tree" },
{ "<leader>tf", "<cmd>NvimTreeFocus<cr>", desc = "Open and Focus" },
{ "<leader>ts", "<cmd>NvimTreeFindFile<cr>", desc = "Traverse to Open File" },
{ "<leader>tc", "<cmd>NvimTreeCollapse<cr>", desc = "Collapse all" },
-- name = "Trouble",
{ "<leader>v", group = "Trouble" },
{ "<leader>vt", "<cmd>TroubleToggle<cr>", desc = "Toggle Trouble"},
{ "<leader>vo", "<cmd>Trouble<cr>", desc = "Open Trouble"},
{ "<leader>vr", "<cmd>TroubleRefresh<cr>", desc = "Trouble Refresh"},
{ "<leader>vq", "<cmd>TroubleClose<cr>", desc = "Trouble Close"},
-- name = "Terminal",
{ "<leader>x", group = "Terminal" },
{ "<leader>xn", "<cmd>lua _NODE_TOGGLE()<cr>", desc = "Node" },
{ "<leader>xu", "<cmd>lua _NCDU_TOGGLE()<cr>", desc = "NCDU" },
{ "<leader>xt", "<cmd>lua _HTOP_TOGGLE()<cr>", desc = "Htop" },
{ "<leader>xp", "<cmd>lua _PYTHON_TOGGLE()<cr>", desc = "Python" },
{ "<leader>xf", "<cmd>ToggleTerm direction=float<cr>", desc = "Float" },
{ "<leader>xh", "<cmd>ToggleTerm size=10 direction=horizontal<cr>", desc = "Horizontal" },
{ "<leader>xv", "<cmd>ToggleTerm size=80 direction=vertical<cr>", desc = "Vertical" },
-- name - "wrapping.nvim
{ "<leader>w", group = "Wrapping" },
{ "<leader>wh", "<cmd>lua require('wrapping').hard_wrap_mode()<cr>", desc = "Enable Hard Wrapping" },
{ "<leader>ws", "<cmd>lua require('wrapping').soft_wrap_mode()<cr>", desc = "Enable Soft Wrapping" },
{ "<leader>wt", "<cmd>lua require('wrapping').toggle_wrap_mode()<cr>", desc = "Toggle Wrapping Mode" },
-- name = "Web Tools",
--[[ { "<leader>w", group = "Web Tools" }, ]]
--[[ { "<leader>ws", "<cmd>BrowserSync<cr>", desc = "Start BrowserSync Server" }, ]]
--[[ { "<leader>wp", "<cmd>BrowserOpen<cr>", desc = "Preview file start server" }, ]]
--[[ { "<leader>wr", "<cmd>BrowserPreview<cr>", desc = "Preview file no start" }, ]]
--[[ { "<leader>wx", "<cmd>BrowserStop<cr>", desc = "Restart BrowserSync" }, ]]
--[[ { "<leader>wt", "<cmd>TagRename<cr>", desc = "Rename html tag" }, ]]
-- name = "Ascii Tools",
--[[ { "<leader>y", group = "Ascii Tools" }, ]]
--[[ { "<leader>yl", "<cmd>:call linebox#lines#line(g:linebox_marks[0], g:linebox_marks[1])<cr>", desc = "Draw a line with linebox"}, ]]
--[[ { "<leader>yb", "<cmd>:call linebox#boxes#box()<cr>", desc = "Make a box with linebox"}, ]]
--[[ { "<leader>yB", "<cmd>:call linebox#boxes#mbox()<cr>", desc = "Make a box to blend with other lines."}, ]]
--[[ { "<leader>yv", "<cmd>Toggle_venn()<cr>", desc = "Toggle venn" }, ]]
-- name = "True Zen",
--[[ { "<leader>z", group = "True Zen" }, ]]
--[[ { "<leader>zv", "<cmd>Toggle_venn()<cr>", desc = "Toggle venn" }, ]]
--[[ { "<leader>zn", "<cmd>TZNarrow<cr>", desc = "True Zen Narrow" }, ]]
--[[ { "<leader>zf", "<cmd>'<,'>TZNarrow<cr>", desc = "True Zen Fine Narrow" }, ]]
--[[ { "<leader>zF", "<cmd>TZFocus<cr>", desc = "True Zen Focus" }, ]]
--[[ { "<leader>zm", "<cmd>TZMinimalist<cr>", desc = "True Zen Minimalist" }, ]]
--[[ { "<leader>za", "<cmd>TZAtaraxis<cr>", desc = "True Zen Ataraxis" }, ]]
})
-- ---------------------------------------------------------------------------
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment