commit
4e04b8b706
@ -0,0 +1 @@
|
||||
plugin/
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"Lua": {
|
||||
"runtime.version": "LuaJIT",
|
||||
"workspace.checkThirdParty": false
|
||||
},
|
||||
"Lua.diagnostics.globals": [
|
||||
"require"
|
||||
]
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
vim.g.python3_host_prog = '/usr/bin/python'
|
||||
vim.g.mapleader = ' '
|
||||
|
||||
-- Setup packer
|
||||
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'
|
||||
end
|
||||
|
||||
-- Source settings
|
||||
require('plugins')
|
||||
require('settings')
|
@ -0,0 +1,5 @@
|
||||
local utils = require('utils')
|
||||
|
||||
utils.opt('o', 'termguicolors', true)
|
||||
vim.g.tokyonight_style = 'night'
|
||||
vim.cmd('colorscheme tokyonight')
|
@ -0,0 +1,4 @@
|
||||
local utils = require("utils")
|
||||
utils.map("n", "<C-l>", "<cmd>noh<CR>") -- Clear highlights
|
||||
utils.map("n", "]q", "<cmd>cn<CR>")
|
||||
utils.map("n", "[q", "<cmd>cp<CR>")
|
@ -0,0 +1,153 @@
|
||||
local wk = require("which-key")
|
||||
|
||||
local wk_toggle_git_blame = { "<cmd>GitBlameToggle<CR>", "Toggle git blame" }
|
||||
wk.register({
|
||||
t = {
|
||||
b = wk_toggle_git_blame,
|
||||
},
|
||||
g = {
|
||||
n = { "<cmd>Neogit<CR>", "Neogit status" },
|
||||
f = { "<cmd>Git<CR>", "Fugitive status" },
|
||||
b = wk_toggle_git_blame,
|
||||
},
|
||||
}, {
|
||||
prefix = "<leader>",
|
||||
})
|
||||
|
||||
local neogit = require("neogit")
|
||||
neogit.setup()
|
||||
|
||||
-- gitsigns
|
||||
require("gitsigns").setup()
|
||||
|
||||
-- git-blame
|
||||
vim.g.gitblame_enabled = 0
|
||||
|
||||
-- octo
|
||||
require("octo").setup({
|
||||
default_remote = { "origin" }, -- order to try remotes
|
||||
ssh_aliases = {}, -- SSH aliases. e.g. `ssh_aliases = {["github.com-work"] = "github.com"}`
|
||||
reaction_viewer_hint_icon = "", -- marker for user reactions
|
||||
user_icon = " ", -- user icon
|
||||
timeline_marker = "", -- timeline marker
|
||||
timeline_indent = "2", -- timeline indentation
|
||||
right_bubble_delimiter = "", -- Bubble delimiter
|
||||
left_bubble_delimiter = "", -- Bubble delimiter
|
||||
snippet_context_lines = 4, -- number or lines around commented lines
|
||||
file_panel = {
|
||||
size = 10, -- changed files panel rows
|
||||
use_icons = true, -- use web-devicons in file panel (if false, nvim-web-devicons does not need to be installed)
|
||||
},
|
||||
mappings = {
|
||||
issue = {
|
||||
close_issue = { lhs = "<space>ic", desc = "close issue" },
|
||||
reopen_issue = { lhs = "<space>io", desc = "reopen issue" },
|
||||
list_issues = { lhs = "<space>il", desc = "list open issues on same repo" },
|
||||
reload = { lhs = "<C-r>", desc = "reload issue" },
|
||||
open_in_browser = { lhs = "<C-b>", desc = "open issue in browser" },
|
||||
copy_url = { lhs = "<C-y>", desc = "copy url to system clipboard" },
|
||||
add_assignee = { lhs = "<space>aa", desc = "add assignee" },
|
||||
remove_assignee = { lhs = "<space>ad", desc = "remove assignee" },
|
||||
create_label = { lhs = "<space>lc", desc = "create label" },
|
||||
add_label = { lhs = "<space>la", desc = "add label" },
|
||||
remove_label = { lhs = "<space>ld", desc = "remove label" },
|
||||
goto_issue = { lhs = "<space>gi", desc = "navigate to a local repo issue" },
|
||||
add_comment = { lhs = "<space>ca", desc = "add comment" },
|
||||
delete_comment = { lhs = "<space>cd", desc = "delete comment" },
|
||||
next_comment = { lhs = "]c", desc = "go to next comment" },
|
||||
prev_comment = { lhs = "[c", desc = "go to previous comment" },
|
||||
react_hooray = { lhs = "<space>rp", desc = "add/remove 🎉 reaction" },
|
||||
react_heart = { lhs = "<space>rh", desc = "add/remove ❤️ reaction" },
|
||||
react_eyes = { lhs = "<space>re", desc = "add/remove 👀 reaction" },
|
||||
react_thumbs_up = { lhs = "<space>r+", desc = "add/remove 👍 reaction" },
|
||||
react_thumbs_down = { lhs = "<space>r-", desc = "add/remove 👎 reaction" },
|
||||
react_rocket = { lhs = "<space>rr", desc = "add/remove 🚀 reaction" },
|
||||
react_laugh = { lhs = "<space>rl", desc = "add/remove 😄 reaction" },
|
||||
react_confused = { lhs = "<space>rc", desc = "add/remove 😕 reaction" },
|
||||
},
|
||||
pull_request = {
|
||||
checkout_pr = { lhs = "<space>po", desc = "checkout PR" },
|
||||
merge_pr = { lhs = "<space>pm", desc = "merge commit PR" },
|
||||
squash_and_merge_pr = { lhs = "<space>psm", desc = "squash and merge PR" },
|
||||
list_commits = { lhs = "<space>pc", desc = "list PR commits" },
|
||||
list_changed_files = { lhs = "<space>pf", desc = "list PR changed files" },
|
||||
show_pr_diff = { lhs = "<space>pd", desc = "show PR diff" },
|
||||
add_reviewer = { lhs = "<space>va", desc = "add reviewer" },
|
||||
remove_reviewer = { lhs = "<space>vd", desc = "remove reviewer request" },
|
||||
close_issue = { lhs = "<space>ic", desc = "close PR" },
|
||||
reopen_issue = { lhs = "<space>io", desc = "reopen PR" },
|
||||
list_issues = { lhs = "<space>il", desc = "list open issues on same repo" },
|
||||
reload = { lhs = "<C-r>", desc = "reload PR" },
|
||||
open_in_browser = { lhs = "<C-b>", desc = "open PR in browser" },
|
||||
copy_url = { lhs = "<C-y>", desc = "copy url to system clipboard" },
|
||||
goto_file = { lhs = "gf", desc = "go to file" },
|
||||
add_assignee = { lhs = "<space>aa", desc = "add assignee" },
|
||||
remove_assignee = { lhs = "<space>ad", desc = "remove assignee" },
|
||||
create_label = { lhs = "<space>lc", desc = "create label" },
|
||||
add_label = { lhs = "<space>la", desc = "add label" },
|
||||
remove_label = { lhs = "<space>ld", desc = "remove label" },
|
||||
goto_issue = { lhs = "<space>gi", desc = "navigate to a local repo issue" },
|
||||
add_comment = { lhs = "<space>ca", desc = "add comment" },
|
||||
delete_comment = { lhs = "<space>cd", desc = "delete comment" },
|
||||
next_comment = { lhs = "]c", desc = "go to next comment" },
|
||||
prev_comment = { lhs = "[c", desc = "go to previous comment" },
|
||||
react_hooray = { lhs = "<space>rp", desc = "add/remove 🎉 reaction" },
|
||||
react_heart = { lhs = "<space>rh", desc = "add/remove ❤️ reaction" },
|
||||
react_eyes = { lhs = "<space>re", desc = "add/remove 👀 reaction" },
|
||||
react_thumbs_up = { lhs = "<space>r+", desc = "add/remove 👍 reaction" },
|
||||
react_thumbs_down = { lhs = "<space>r-", desc = "add/remove 👎 reaction" },
|
||||
react_rocket = { lhs = "<space>rr", desc = "add/remove 🚀 reaction" },
|
||||
react_laugh = { lhs = "<space>rl", desc = "add/remove 😄 reaction" },
|
||||
react_confused = { lhs = "<space>rc", desc = "add/remove 😕 reaction" },
|
||||
},
|
||||
review_thread = {
|
||||
goto_issue = { lhs = "<space>gi", desc = "navigate to a local repo issue" },
|
||||
add_comment = { lhs = "<space>ca", desc = "add comment" },
|
||||
add_suggestion = { lhs = "<space>sa", desc = "add suggestion" },
|
||||
delete_comment = { lhs = "<space>cd", desc = "delete comment" },
|
||||
next_comment = { lhs = "]c", desc = "go to next comment" },
|
||||
prev_comment = { lhs = "[c", desc = "go to previous comment" },
|
||||
select_next_entry = { lhs = "]q", desc = "move to previous changed file" },
|
||||
select_prev_entry = { lhs = "[q", desc = "move to next changed file" },
|
||||
close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
|
||||
react_hooray = { lhs = "<space>rp", desc = "add/remove 🎉 reaction" },
|
||||
react_heart = { lhs = "<space>rh", desc = "add/remove ❤️ reaction" },
|
||||
react_eyes = { lhs = "<space>re", desc = "add/remove 👀 reaction" },
|
||||
react_thumbs_up = { lhs = "<space>r+", desc = "add/remove 👍 reaction" },
|
||||
react_thumbs_down = { lhs = "<space>r-", desc = "add/remove 👎 reaction" },
|
||||
react_rocket = { lhs = "<space>rr", desc = "add/remove 🚀 reaction" },
|
||||
react_laugh = { lhs = "<space>rl", desc = "add/remove 😄 reaction" },
|
||||
react_confused = { lhs = "<space>rc", desc = "add/remove 😕 reaction" },
|
||||
},
|
||||
submit_win = {
|
||||
approve_review = { lhs = "<C-a>", desc = "approve review" },
|
||||
comment_review = { lhs = "<C-m>", desc = "comment review" },
|
||||
request_changes = { lhs = "<C-r>", desc = "request changes review" },
|
||||
close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
|
||||
},
|
||||
review_diff = {
|
||||
add_review_comment = { lhs = "<space>ca", desc = "add a new review comment" },
|
||||
add_review_suggestion = { lhs = "<space>sa", desc = "add a new review suggestion" },
|
||||
focus_files = { lhs = "<leader>e", desc = "move focus to changed file panel" },
|
||||
toggle_files = { lhs = "<leader>b", desc = "hide/show changed files panel" },
|
||||
next_thread = { lhs = "]t", desc = "move to next thread" },
|
||||
prev_thread = { lhs = "[t", desc = "move to previous thread" },
|
||||
select_next_entry = { lhs = "]q", desc = "move to previous changed file" },
|
||||
select_prev_entry = { lhs = "[q", desc = "move to next changed file" },
|
||||
close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
|
||||
toggle_viewed = { lhs = "<leader><space>", desc = "toggle viewer viewed state" },
|
||||
},
|
||||
file_panel = {
|
||||
next_entry = { lhs = "j", desc = "move to next changed file" },
|
||||
prev_entry = { lhs = "k", desc = "move to previous changed file" },
|
||||
select_entry = { lhs = "<cr>", desc = "show selected changed file diffs" },
|
||||
refresh_files = { lhs = "R", desc = "refresh changed files panel" },
|
||||
focus_files = { lhs = "<leader>e", desc = "move focus to changed file panel" },
|
||||
toggle_files = { lhs = "<leader>b", desc = "hide/show changed files panel" },
|
||||
select_next_entry = { lhs = "]q", desc = "move to previous changed file" },
|
||||
select_prev_entry = { lhs = "[q", desc = "move to next changed file" },
|
||||
close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
|
||||
toggle_viewed = { lhs = "<leader><space>", desc = "toggle viewer viewed state" },
|
||||
},
|
||||
},
|
||||
})
|
@ -0,0 +1,41 @@
|
||||
vim.g.indent_blankline_use_treesitter = true
|
||||
vim.g.indent_blankline_filetype_exclude = {
|
||||
"help",
|
||||
"dashboard",
|
||||
"dashpreview",
|
||||
"coc-explorer",
|
||||
"startify",
|
||||
"vista",
|
||||
"sagahover",
|
||||
"lspinfo",
|
||||
}
|
||||
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars:append("space:⋅")
|
||||
vim.opt.listchars:append("eol:↴")
|
||||
|
||||
require("indent_blankline").setup({
|
||||
space_char_blankline = " ",
|
||||
show_current_context = true,
|
||||
show_current_context_start = true,
|
||||
})
|
||||
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.register({
|
||||
t = {
|
||||
i = {
|
||||
function()
|
||||
vim.cmd("IndentBlanklineToggle!")
|
||||
if vim.g.indent_blankline_enabled then
|
||||
vim.opt.list = true
|
||||
else
|
||||
vim.opt.list = false
|
||||
end
|
||||
end,
|
||||
"Indent guides",
|
||||
},
|
||||
},
|
||||
}, {
|
||||
prefix = "<leader>",
|
||||
})
|
@ -0,0 +1,315 @@
|
||||
---@diagnostic disable: undefined-global
|
||||
return require("packer").startup(function()
|
||||
use("wbthomason/packer.nvim")
|
||||
|
||||
use("antoinemadec/FixCursorHold.nvim")
|
||||
|
||||
-- Project management
|
||||
use({
|
||||
"ahmedkhalf/project.nvim",
|
||||
config = [[require('plugins.project-nvim')]],
|
||||
})
|
||||
|
||||
-- GUI
|
||||
use("stevearc/dressing.nvim")
|
||||
|
||||
-- Fuzzy finder
|
||||
use({
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
run = "make",
|
||||
},
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
requires = { "nvim-lua/plenary.nvim" },
|
||||
config = [[require('plugins.telescope-nvim')]],
|
||||
},
|
||||
})
|
||||
|
||||
-- File explorer
|
||||
use({
|
||||
"kevinhwang91/rnvimr",
|
||||
config = [[require('plugins.rnvimr')]],
|
||||
})
|
||||
|
||||
use({
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
config = [[require('plugins.nvim-tree')]],
|
||||
})
|
||||
|
||||
-- Refactor
|
||||
use({
|
||||
"ThePrimeagen/refactoring.nvim",
|
||||
requires = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "nvim-treesitter/nvim-treesitter" },
|
||||
},
|
||||
config = [[ require('refactoring').setup({}) ]],
|
||||
})
|
||||
|
||||
-- Tooling
|
||||
use({
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
config = [[ require('plugins.tooling') ]],
|
||||
},
|
||||
})
|
||||
|
||||
-- LSP
|
||||
use({
|
||||
"folke/lsp-colors.nvim", -- Color groups
|
||||
{
|
||||
-- Installer
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
require = "williamboman/mason.nvim",
|
||||
},
|
||||
"folke/neodev.nvim", -- Lua
|
||||
"jose-elias-alvarez/typescript.nvim", -- Typsecript
|
||||
"jose-elias-alvarez/null-ls.nvim", -- Tooling
|
||||
"stevearc/aerial.nvim", -- Outline
|
||||
"b0o/schemastore.nvim", -- JSON schemas
|
||||
"folke/trouble.nvim", -- Diagnostics
|
||||
"kosayoda/nvim-lightbulb", -- Lightbulb
|
||||
"j-hui/fidget.nvim", -- LSP Status indicator
|
||||
{
|
||||
"neovim/nvim-lspconfig", -- Config
|
||||
config = [[require('plugins.lsp')]],
|
||||
},
|
||||
})
|
||||
|
||||
-- Buffer line
|
||||
-- use {
|
||||
-- 'akinsho/bufferline.nvim',
|
||||
-- tag = "v2.*",
|
||||
-- requires = 'kyazdani42/nvim-web-devicons',
|
||||
-- config = function() require("bufferline").setup {} end
|
||||
-- }
|
||||
|
||||
-- Completion
|
||||
use({
|
||||
"onsails/lspkind-nvim", -- Pretty icons
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-omni",
|
||||
"petertriho/cmp-git",
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
config = [[require('plugins.nvim-cmp')]],
|
||||
},
|
||||
})
|
||||
|
||||
-- Snippets
|
||||
use("L3MON4D3/LuaSnip")
|
||||
use("saadparwaiz1/cmp_luasnip")
|
||||
use("rafamadriz/friendly-snippets")
|
||||
|
||||
-- Comments
|
||||
use({
|
||||
"numToStr/Comment.nvim",
|
||||
config = function()
|
||||
require("Comment").setup()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Autopairs
|
||||
use({
|
||||
"windwp/nvim-autopairs",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Tree-sitter
|
||||
use({
|
||||
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||
"windwp/nvim-ts-autotag", -- XML-like auto tags
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = ":TSUpdate",
|
||||
config = [[require('plugins.nvim-treesitter')]],
|
||||
},
|
||||
{
|
||||
"nvim-orgmode/orgmode",
|
||||
config = [[require('plugins.orgmode-nvim')]],
|
||||
},
|
||||
})
|
||||
|
||||
-- Note taking
|
||||
use({
|
||||
"jakewvincent/mkdnflow.nvim",
|
||||
"ekickx/clipboard-image.nvim",
|
||||
{
|
||||
"mickael-menu/zk-nvim",
|
||||
config = [[require('plugins.notes')]],
|
||||
},
|
||||
})
|
||||
|
||||
-- Terminal
|
||||
use({
|
||||
"akinsho/toggleterm.nvim",
|
||||
tag = "v2.*",
|
||||
config = [[require('plugins.term')]],
|
||||
})
|
||||
|
||||
-- Git
|
||||
use({
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
},
|
||||
"tpope/vim-fugitive",
|
||||
"TimUntersberger/neogit",
|
||||
"f-person/git-blame.nvim",
|
||||
{
|
||||
"sindrets/diffview.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
},
|
||||
{
|
||||
"pwntester/octo.nvim",
|
||||
requires = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"kyazdani42/nvim-web-devicons",
|
||||
},
|
||||
config = [[require('plugins.git')]],
|
||||
},
|
||||
})
|
||||
|
||||
-- Indent lines
|
||||
use({
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
config = [[require('plugins.indent-blankline-nvim')]],
|
||||
})
|
||||
|
||||
-- Handy stuff
|
||||
use({
|
||||
"echasnovski/mini.nvim",
|
||||
branch = "stable",
|
||||
config = function()
|
||||
require("mini.jump").setup({})
|
||||
require("mini.bufremove").setup({})
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"ggandor/leap.nvim",
|
||||
requires = {
|
||||
"tpope/vim-repeat",
|
||||
},
|
||||
config = function()
|
||||
require("leap").set_default_keymaps()
|
||||
end,
|
||||
})
|
||||
|
||||
use({
|
||||
"ygm2/rooter.nvim",
|
||||
config = function()
|
||||
vim.g.outermost_root = false
|
||||
end,
|
||||
})
|
||||
use({ "dhruvasagar/vim-table-mode" })
|
||||
use({ "tpope/vim-eunuch" })
|
||||
|
||||
use({
|
||||
"folke/which-key.nvim",
|
||||
config = [[require('plugins.which-key')]],
|
||||
})
|
||||
|
||||
use({
|
||||
"folke/zen-mode.nvim",
|
||||
config = [[require('plugins.zen-mode-nvim')]],
|
||||
})
|
||||
|
||||
use({
|
||||
"folke/twilight.nvim",
|
||||
config = [[require('plugins.twilight-nvim')]],
|
||||
})
|
||||
|
||||
use({
|
||||
"folke/todo-comments.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
config = function()
|
||||
require("todo-comments").setup()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Statusline
|
||||
-- use {
|
||||
-- 'ojroques/nvim-hardline',
|
||||
-- config = [[require('plugins.hardline')]]
|
||||
-- }
|
||||
|
||||
use({
|
||||
"b0o/incline.nvim",
|
||||
{
|
||||
"hoob3rt/lualine.nvim",
|
||||
requires = {
|
||||
"kyazdani42/nvim-web-devicons",
|
||||
opt = true,
|
||||
},
|
||||
config = [[require('plugins.lualine')]],
|
||||
},
|
||||
})
|
||||
|
||||
-- Folding
|
||||
-- use({
|
||||
-- "kevinhwang91/nvim-ufo",
|
||||
-- requires = "kevinhwang91/promise-async",
|
||||
-- config = [[require('plugins.nvim-ufo')]],
|
||||
-- })
|
||||
|
||||
-- Color highlighting
|
||||
use({
|
||||
"norcalli/nvim-colorizer.lua",
|
||||
config = function()
|
||||
require("colorizer").setup()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Colorschemes
|
||||
use({
|
||||
"Th3Whit3Wolf/onebuddy",
|
||||
requires = { "tjdevries/colorbuddy.vim" },
|
||||
})
|
||||
use({ "RRethy/nvim-base16" })
|
||||
use({ "NTBBloodbath/doom-one.nvim" })
|
||||
use({ "folke/tokyonight.nvim" })
|
||||
use({ "marko-cerovac/material.nvim" })
|
||||
|
||||
use({
|
||||
"kyazdani42/nvim-web-devicons",
|
||||
config = [[require('plugins.nvim-web-devicons')]],
|
||||
})
|
||||
|
||||
-- package.json
|
||||
use("vuki656/package-info.nvim")
|
||||
|
||||
-- Blade
|
||||
use({ "Eduruiz/vim-blade" })
|
||||
|
||||
-- DAP
|
||||
use("mfussenegger/nvim-dap")
|
||||
use("Pocco81/dap-buddy.nvim")
|
||||
use("rcarriga/nvim-dap-ui")
|
||||
|
||||
-- Test runner
|
||||
use({
|
||||
"haydenmeade/neotest-jest",
|
||||
"nvim-neotest/neotest-go",
|
||||
"nvim-neotest/neotest-python",
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
requires = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"antoinemadec/FixCursorHold.nvim",
|
||||
},
|
||||
config = [[require('plugins.testing')]],
|
||||
},
|
||||
})
|
||||
end)
|
@ -0,0 +1,9 @@
|
||||
local utils = require('utils')
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
utils.map('n', '<leader>gg', '<cmd>LazyGit<CR>', opts)
|
||||
utils.map('n', '<leader>gc', '<cmd>LazyGitConfig<CR>', opts)
|
||||
|
||||
vim.env.GIT_EDITOR = 'nvr --remote-wait'
|
||||
vim.g.lazygit_floating_window_use_plenary = 1
|
||||
vim.g.lazygit_use_neovim_remote = 1
|
@ -0,0 +1,243 @@
|
||||
local wk = require("which-key")
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = "rounded",
|
||||
close_events = { "CursorMoved", "BufHidden", "InsertCharPre" },
|
||||
})
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = "rounded",
|
||||
})
|
||||
|
||||
require("aerial").setup({})
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
|
||||
local lsp_rename_mapping = {
|
||||
function()
|
||||
vim.lsp.buf.rename()
|
||||
end,
|
||||
"Rename LSP symbol",
|
||||
}
|
||||
local lsp_references_mapping = {
|
||||
"<cmd>TroubleToggle lsp_references<CR>",
|
||||
"LSP references",
|
||||
}
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
-- Normal mappings
|
||||
wk.register({
|
||||
c = {
|
||||
a = { "<cmd>lua vim.lsp.buf.code_action()<CR>", "Code action" },
|
||||
r = lsp_rename_mapping,
|
||||
f = {
|
||||
"<cmd>lua vim.lsp.buf.format()<CR>",
|
||||
"Format file",
|
||||
},
|
||||
o = { "<cmd>AerialToggle!<CR>", "Toggle outline" },
|
||||
x = { "<cmd>lua vim.diagnostic.open_float({source= true})<CR>", "Show line diagnostics" },
|
||||
R = lsp_references_mapping,
|
||||
t = {
|
||||
name = "Trouble",
|
||||
t = { "<cmd>TroubleToggle<CR>", "Trouble Toggle" },
|
||||
r = lsp_references_mapping,
|
||||
w = { "<cmd>TroubleToggle lsp_workspace_diagnostics<CR>", "Workspace diagnostics" },
|
||||
d = { "<cmd>TroubleToggle lsp_document_diagnostics<CR>", "Document diagnostics" },
|
||||
q = { "<cmd>TroubleToggle quickfix<CR>", "Quickfix" },
|
||||
l = { "<cmd>TroubleToggle loclist<CR>", "Location list" },
|
||||
},
|
||||
g = {
|
||||
name = "Go to",
|
||||
D = { "<cmd>lua vim.lsp.buf.declaration()<CR>", "Go to declaration" },
|
||||
d = { "<cmd>lua vim.lsp.buf.definition()<CR>", "Go to definition" },
|
||||
i = { "<cmd>lua vim.lsp.buf.implementation()<CR>", "Go to implementation" },
|
||||
t = { "<cmd>lua vim.lsp.buf.type_definition()<CR>", "Go to type definition" },
|
||||
},
|
||||
},
|
||||
}, {
|
||||
prefix = "<leader>",
|
||||
buffer = bufnr,
|
||||
})
|
||||
|
||||
-- Visual mappings
|
||||
wk.register({
|
||||
c = {
|
||||
a = { "<cmd>lua vim.lsp.buf.code_action()<CR>", "Range code action" },
|
||||
f = {
|
||||
"<cmd>lua vim.lsp.buf.format()<CR>",
|
||||
"Range formatting",
|
||||
},
|
||||
},
|
||||
}, {
|
||||
mode = "v",
|
||||
prefix = "<leader>",
|
||||
buffer = bufnr,
|
||||
})
|
||||
|
||||
-- No leader mappings
|
||||
wk.register({
|
||||
gd = { "<cmd>lua vim.lsp.buf.definition()<CR>", "Go to definition" },
|
||||
K = { "<cmd>lua vim.lsp.buf.hover()<CR>", "LSP Hover" },
|
||||
["<C-k"] = { "<cmd>lua vim.lsp.buf.signature_help()<CR>", "LSP Signature" },
|
||||
["<f2>"] = lsp_rename_mapping,
|
||||
["[["] = { "<cmd>AerialPrevUp<CR>", "Outline previous" },
|
||||
["]]"] = { "<cmd>AerialNext<CR>", "Outline next" },
|
||||
}, {
|
||||
buffer = bufnr,
|
||||
})
|
||||
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
if vim.g.format_on_save == 1 then
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local settings = {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
}
|
||||
|
||||
-- Neovim
|
||||
require("neodev").setup({})
|
||||
|
||||
local servers = {
|
||||
"clangd",
|
||||
"pyright",
|
||||
"rust_analyzer",
|
||||
"gopls",
|
||||
"phpactor",
|
||||
"tailwindcss",
|
||||
"jsonls",
|
||||
"lua_ls",
|
||||
}
|
||||
|
||||
for _, lsp in pairs(servers) do
|
||||
require("lspconfig")[lsp].setup(settings)
|
||||
end
|
||||
|
||||
-- JSON
|
||||
require("lspconfig").jsonls.setup(vim.tbl_deep_extend("force", settings, {
|
||||
settings = {
|
||||
json = {
|
||||
schemas = require("schemastore").json.schemas(),
|
||||
validate = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}))
|
||||
|
||||
-- Typescript
|
||||
require("typescript").setup({
|
||||
disable_commands = false,
|
||||
debug = false,
|
||||
server = settings,
|
||||
})
|
||||
|
||||
-- null-ls
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
vim.g.format_on_save = 1
|
||||
|
||||
function _G.toggle_format_on_save()
|
||||
if vim.g.format_on_save == 1 then
|
||||
vim.g.format_on_save = 0
|
||||
print("Disabled format on save")
|
||||
else
|
||||
vim.g.format_on_save = 1
|
||||
print("Enabled format on save")
|
||||
end
|
||||
end
|
||||
|
||||
require("null-ls").setup({
|
||||
sources = {
|
||||
-- General
|
||||
null_ls.builtins.code_actions.refactoring,
|
||||
null_ls.builtins.completion.spell,
|
||||
null_ls.builtins.diagnostics.trail_space,
|
||||
null_ls.builtins.formatting.trim_newlines,
|
||||
null_ls.builtins.formatting.trim_whitespace,
|
||||
|
||||
-- Git
|
||||
null_ls.builtins.code_actions.gitrebase,
|
||||
null_ls.builtins.code_actions.gitsigns,
|
||||
|
||||
-- GitHub
|
||||
null_ls.builtins.diagnostics.actionlint,
|
||||
|
||||
-- Shell
|
||||
null_ls.builtins.code_actions.shellcheck,
|
||||
null_ls.builtins.diagnostics.shellcheck,
|
||||
null_ls.builtins.formatting.shfmt,
|
||||
|
||||
-- C/C++
|
||||
null_ls.builtins.formatting.clang_format,
|
||||
null_ls.builtins.formatting.cmake_format,
|
||||
|
||||
-- Web
|
||||
null_ls.builtins.formatting.prettier,
|
||||
-- null_ls.builtins.code_actions.eslint_d,
|
||||
null_ls.builtins.diagnostics.eslint,
|
||||
null_ls.builtins.formatting.eslint,
|
||||
null_ls.builtins.diagnostics.stylelint,
|
||||
null_ls.builtins.formatting.stylelint,
|
||||
null_ls.builtins.formatting.rustywind,
|
||||
|
||||
-- Markdown
|
||||
null_ls.builtins.formatting.remark,
|
||||
|
||||
-- Lua
|
||||
-- null_ls.builtins.diagnostics.luacheck,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
|
||||
-- Python
|
||||
null_ls.builtins.diagnostics.flake8,
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.formatting.isort,
|
||||
|
||||
-- PHP
|
||||
null_ls.builtins.diagnostics.phpstan,
|
||||
|
||||
-- Go
|
||||
null_ls.builtins.formatting.gofmt,
|
||||
|
||||
-- Rust
|
||||
null_ls.builtins.formatting.rustfmt,
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
vim.bo[args.buf].formatexpr = nil
|
||||
end,
|
||||
})
|
||||
|
||||
require("nvim-lightbulb").setup({
|
||||
autocmd = {
|
||||
enabled = false,
|
||||
},
|
||||
sign = {
|
||||
enabled = false,
|
||||
},
|
||||
virtual_text = {
|
||||
enabled = false,
|
||||
},
|
||||
})
|
||||
|
||||
require("fidget").setup({})
|
@ -0,0 +1,42 @@
|
||||
local lualine = require("lualine")
|
||||
|
||||
local conditions = {
|
||||
buffer_not_empty = function()
|
||||
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
|
||||
end,
|
||||
}
|
||||
|
||||
-- Config
|
||||
local config = {
|
||||
options = {
|
||||
-- Disable sections and component separators
|
||||
component_separators = "",
|
||||
section_separators = "",
|
||||
disabled_filetypes = { "NvimTree" },
|
||||
globalstatus = true,
|
||||
theme = tokyonight,
|
||||
},
|
||||
sections = {
|
||||
-- these are to remove the defaults
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff" },
|
||||
lualine_c = {},
|
||||
lualine_x = { "location", "progress" },
|
||||
lualine_y = { "diagnostics", "filetype" },
|
||||
lualine_z = {},
|
||||
},
|
||||
}
|
||||
|
||||
table.insert(config.sections.lualine_c, {
|
||||
"filename",
|
||||
condition = conditions.buffer_not_empty,
|
||||
path = 1,
|
||||
})
|
||||
|
||||
lualine.setup(config)
|
||||
|
||||
require("incline").setup({
|
||||
hide = {
|
||||
cursorline = true,
|
||||
},
|
||||
})
|
@ -0,0 +1,112 @@
|
||||
require("zk").setup()
|
||||
require("mkdnflow").setup({})
|
||||
require("clipboard-image").setup({
|
||||
default = {
|
||||
img_dir = { "%:p:h", "img" },
|
||||
img_name = function()
|
||||
vim.fn.inputsave()
|
||||
local name = vim.fn.input("Name: ")
|
||||
vim.fn.inputrestore()
|
||||
return name
|
||||
end,
|
||||
},
|
||||
})
|
||||
require("telescope").load_extension("zk")
|
||||
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.register({
|
||||
n = {
|
||||
n = {
|
||||
function()
|
||||
vim.ui.input({ prompt = "Note title: " }, function(input)
|
||||
require("zk.commands").get("ZkNew")({ title = input })
|
||||
end)
|
||||
end,
|
||||
"Create new note",
|
||||
},
|
||||
d = {
|
||||
function()
|
||||
require("zk.commands").get("ZkNew")({ dir = "journal" })
|
||||
end,
|
||||
"Create or edit daily note",
|
||||
},
|
||||
f = {
|
||||
function()
|
||||
require("zk.commands").get("ZkNotes")()
|
||||
end,
|
||||
"Find note",
|
||||
},
|
||||
i = {
|
||||
function()
|
||||
require("zk.commands").get("ZkIndex")()
|
||||
end,
|
||||
"Index notes",
|
||||
},
|
||||
t = {
|
||||
function()
|
||||
require("zk.commands").get("ZkTag")()
|
||||
end,
|
||||
"Search by tag",
|
||||
},
|
||||
},
|
||||
}, {
|
||||
prefix = "<leader>",
|
||||
})
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup("MarkdownZk", {})
|
||||
local ZK_NOTEBOOK_DIR = vim.env.ZK_NOTEBOOK_DIR
|
||||
local patt = { ZK_NOTEBOOK_DIR .. "/*.md" }
|
||||
|
||||
vim.api.nvim_clear_autocmds({ group = augroup })
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
group = augroup,
|
||||
pattern = patt,
|
||||
callback = function(bufnr)
|
||||
vim.cmd("lcd %:p:h")
|
||||
|
||||
wk.register({
|
||||
t = {
|
||||
function()
|
||||
require("zk.commands").get("ZkNewFromTitleSelection")()
|
||||
end,
|
||||
"New note (selected as title)",
|
||||
},
|
||||
c = {
|
||||
function()
|
||||
require("zk.commands").get("ZkNewFromContentSelection")()
|
||||
end,
|
||||
"New note (selected as content)",
|
||||
},
|
||||
m = {
|
||||
function()
|
||||
require("zk.commands").get("ZkMatch")()
|
||||
end,
|
||||
"Find note match",
|
||||
},
|
||||
}, {
|
||||
mode = "v",
|
||||
bufnr = bufnr,
|
||||
prefix = "<localleader>",
|
||||
})
|
||||
|
||||
wk.register({
|
||||
b = {
|
||||
function()
|
||||
require("zk.commands").get("ZkBacklinks")()
|
||||
end,
|
||||
"Show note backlinks",
|
||||
},
|
||||
l = {
|
||||
function()
|
||||
require("zk.commands").get("ZkLinks")()
|
||||
end,
|
||||
"Show note links",
|
||||
},
|
||||
}, {
|
||||
mode = "n",
|
||||
bufnr = bufnr,
|
||||
prefix = "<localleader>",
|
||||
})
|
||||
end,
|
||||
})
|
@ -0,0 +1,125 @@
|
||||
local utils = require("utils")
|
||||
local lspkind = require("lspkind")
|
||||
local luasnip = require("luasnip")
|
||||
local cmp = require("cmp")
|
||||
|
||||
local has_words_before = function()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
utils.opt("o", "completeopt", "menu,menuone,noselect")
|
||||
|
||||
cmp.setup({
|
||||
confirm_opts = {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = "symbol_text",
|
||||
maxwidth = 50,
|
||||
before = function(_, vim_item)
|
||||
return vim_item
|
||||
end,
|
||||
}),
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
native_menu = false,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
select = false,
|
||||
}),
|
||||
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
["<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" }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{
|
||||
name = "nvim_lsp",
|
||||
},
|
||||
{
|
||||
name = "luasnip",
|
||||
},
|
||||
{
|
||||
name = "nvim_lsp_signature_help",
|
||||
},
|
||||
{
|
||||
name = "nvim_lua",
|
||||
},
|
||||
{
|
||||
name = "orgmode",
|
||||
},
|
||||
}, {
|
||||
|
||||
{ name = "git" },
|
||||
}, {
|
||||
{
|
||||
name = "path",
|
||||
},
|
||||
}, {
|
||||
{
|
||||
name = "buffer",
|
||||
},
|
||||
}),
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ "/", "?" }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{
|
||||
name = "buffer",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{
|
||||
name = "path",
|
||||
},
|
||||
}, {
|
||||
{
|
||||
name = "cmdline",
|
||||
},
|
||||
}),
|
||||
})
|
||||
|
||||
require("cmp_git").setup()
|
@ -0,0 +1,89 @@
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.register({
|
||||
o = {
|
||||
p = { "<cmd>NvimTreeToggle<CR>", "Open project sidebar" },
|
||||
},
|
||||
}, {
|
||||
prefix = "<leader>",
|
||||
})
|
||||
|
||||
require("nvim-tree").setup({
|
||||
auto_reload_on_write = true,
|
||||
create_in_closed_folder = false,
|
||||
disable_netrw = false,
|
||||
hijack_netrw = true,
|
||||
hijack_unnamed_buffer_when_opening = false,
|
||||
ignore_buffer_on_setup = false,
|
||||
open_on_setup = false,
|
||||
open_on_setup_file = false,
|
||||
open_on_tab = false,
|
||||
sort_by = "name",
|
||||
update_cwd = true,
|
||||
reload_on_bufenter = false,
|
||||
respect_buf_cwd = true,
|
||||
ignore_ft_on_setup = {},
|
||||
hijack_cursor = false,
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = true,
|
||||
ignore_list = {},
|
||||
},
|
||||
system_open = {
|
||||
cmd = nil,
|
||||
args = {},
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
side = "left",
|
||||
signcolumn = "no",
|
||||
mappings = {
|
||||
custom_only = false,
|
||||
list = {},
|
||||
},
|
||||
},
|
||||
git = {
|
||||
ignore = false,
|
||||
},
|
||||
renderer = {
|
||||
special_files = {},
|
||||
group_empty = false,
|
||||
highlight_git = true,
|
||||
icons = {
|
||||
git_placement = "before",
|
||||
show = {
|
||||
file = true,
|
||||
folder = true,
|
||||
folder_arrow = true,
|
||||
git = true,
|
||||
},
|
||||
glyphs = {
|
||||
default = "",
|
||||
symlink = "",
|
||||
git = {
|
||||
unstaged = "",
|
||||
staged = "",
|
||||
unmerged = "",
|
||||
renamed = "",
|
||||
untracked = "",
|
||||
deleted = "",
|
||||
ignored = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
show_on_dirs = false,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
},
|
||||
},
|
||||
trash = {
|
||||
cmd = "trash",
|
||||
require_confirm = true,
|
||||
},
|
||||
})
|
@ -0,0 +1,34 @@
|
||||
local utils = require("utils")
|
||||
local tsconf = require("nvim-treesitter.configs")
|
||||
|
||||
require("orgmode").setup_ts_grammar()
|
||||
require("nvim-ts-autotag").setup()
|
||||
|
||||
if not tsconf then
|
||||
vim.cmd([[ echom 'Cannot load `nvim-treesitter.configs`' ]])
|
||||
return
|
||||
end
|
||||
|
||||
tsconf.setup({
|
||||
ensure_installed = "all",
|
||||
ignore_install = { "phpdoc" },
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = { "org" },
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "gnn",
|
||||
node_incremental = "grn",
|
||||
scope_incremental = "grc",
|
||||
node_decremental = "grm",
|
||||
},
|
||||
},
|
||||
context_commentstring = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
@ -0,0 +1,44 @@
|
||||
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
|
||||
|
||||
vim.o.foldenable = true
|
||||
vim.o.foldmethod = "manual"
|
||||
vim.o.foldcolumn = "1"
|
||||
vim.o.foldlevel = 99
|
||||
vim.o.foldlevelstart = 99
|
||||
|
||||
local handler = function(virtText, lnum, endLnum, width, truncate)
|
||||
local newVirtText = {}
|
||||
local suffix = (" %d "):format(endLnum - lnum)
|
||||
local sufWidth = vim.fn.strdisplaywidth(suffix)
|
||||
local targetWidth = width - sufWidth
|
||||
local curWidth = 0
|
||||
for _, chunk in ipairs(virtText) do
|
||||
local chunkText = chunk[1]
|
||||
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
if targetWidth > curWidth + chunkWidth then
|
||||
table.insert(newVirtText, chunk)
|
||||
else
|
||||
chunkText = truncate(chunkText, targetWidth - curWidth)
|
||||
local hlGroup = chunk[2]
|
||||
table.insert(newVirtText, { chunkText, hlGroup })
|
||||
chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
-- str width returned from truncate() may less than 2nd argument, need padding
|
||||
if curWidth + chunkWidth < targetWidth then
|
||||
suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth)
|
||||
end
|
||||
break
|
||||
end
|
||||
curWidth = curWidth + chunkWidth
|
||||
end
|
||||
table.insert(newVirtText, { suffix, "MoreMsg" })
|
||||
return newVirtText
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "zR", require("ufo").openAllFolds)
|
||||
vim.keymap.set("n", "zM", require("ufo").closeAllFolds)
|
||||
|
||||
require("ufo").setup({
|
||||
provider_selector = function()
|
||||
return { "treesitter", "indent" }
|
||||
end,
|
||||
})
|
@ -0,0 +1,3 @@
|
||||
require'nvim-web-devicons'.setup {
|
||||
default = true;
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
local wk = require("which-key")
|
||||
|
||||
require("orgmode").setup({
|
||||
org_agenda_files = {
|
||||
"~/.org/work/*",
|
||||
"~/org/learning/*",
|
||||
"~/.org/projects/*",
|
||||
"~/.org/calendars/*",
|
||||
"~/.org/conferences/*",
|
||||
},
|
||||
org_default_notes_file = "~/.org/refile.org",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
pattern = "*.org",
|
||||
callback = function()
|
||||
vim.wo.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
vim.wo.foldmethod = "expr"
|
||||
end,
|
||||
})
|
||||
|
||||
local wk_open_org_agenda = {
|
||||
[[<cmd>lua require('orgmode').action("agenda.prompt")<CR>]],
|
||||
"Org agenda",
|
||||
}
|
||||
|
||||
wk.register({
|
||||
O = {
|
||||
name = "Org mode",
|
||||
a = wk_open_org_agenda,
|
||||
f = {
|
||||
[[<cmd>lua require('telescope.builtin').find_files{ cwd = '~/.org' }<CR>]],
|
||||
"Find file in notes",
|
||||
},
|
||||
n = {
|
||||
[[<cmd>lua require('orgmode').action("capture.prompt")<CR>]],
|
||||
"Org capture",
|
||||
},
|
||||
s = {
|
||||
[[<cmd>lua require('telescope.builtin').live_grep{ cwd = '~/.org' }<CR>]],
|
||||
"Search notes",
|
||||
},
|
||||
},
|
||||
}, {
|
||||
prefix = "<leader>",
|
||||
})
|
@ -0,0 +1,20 @@
|
||||
require("project_nvim").setup({
|
||||
manual_mode = false,
|
||||
detection_methods = { "lsp", "pattern" },
|
||||
patterns = {
|
||||
".git",
|
||||
"_darcs",
|
||||
".hg",
|
||||
".bzr",
|
||||
".svn",
|
||||
"Makefile",
|
||||
"package.json",
|
||||
".luarc.json",
|
||||
".zk",
|
||||
},
|
||||
ignore_lsp = {},
|
||||
exclude_dirs = {},
|
||||
show_hidden = true,
|
||||
silent_chdir = true,
|
||||
datapath = vim.fn.stdpath("data"),
|
||||
})
|
@ -0,0 +1,13 @@
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.register({
|
||||
f = {
|
||||
r = {"<cmd>RnvimrToggle<CR>", "Toggle Ranger"}
|
||||
}
|
||||
}, {
|
||||
prefix = "<leader>"
|
||||
})
|
||||
|
||||
vim.g.rnvimr_enable_ex = 0
|
||||
vim.g.rnvimr_enable_picker = 1
|
||||
vim.g.rnvimr_enable_bw = 0
|
@ -0,0 +1,108 @@
|
||||
local wk = require("which-key")
|
||||
local actions = require("telescope.actions")
|
||||
|
||||
local M = {}
|
||||
|
||||
M.project_files = function()
|
||||
local opts = {}
|
||||
local ok = pcall(require("telescope.builtin").git_files, opts)
|
||||
if not ok then
|
||||
require("telescope.builtin").find_files(opts)
|
||||
end
|
||||
end
|
||||
|
||||
M.file_browser = function()
|
||||
require("telescope").extensions.file_browser.file_browser({
|
||||
cwd = vim.fn.expand("%:p:h"),
|
||||
})
|
||||
end
|
||||
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<esc>"] = actions.close,
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
git_files = {
|
||||
show_untracked = true,
|
||||
},
|
||||
find_files = {
|
||||
hidden = true,
|
||||
follow = true,
|
||||
},
|
||||
live_grep = {
|
||||
hidden = true,
|
||||
follow = true,
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
file_browser = {
|
||||
hidden = true,
|
||||
follow = true,
|
||||
},
|
||||
fzf = {
|
||||
fuzzy = true,
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
case_mode = "smart_case",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require("telescope").load_extension("file_browser")
|
||||
require("telescope").load_extension("ui-select")
|
||||
require("telescope").load_extension("fzf")
|
||||
require("telescope").load_extension("projects")
|
||||
|
||||
local browse_files = {
|
||||
function()
|
||||
M.file_browser()
|
||||
end,
|
||||
"Browse files",
|
||||
}
|
||||
local find_file_in_project = {
|
||||
function()
|
||||
M.project_files()
|
||||
end,
|
||||
"Find file in project",
|
||||
}
|
||||
|
||||
wk.register({
|
||||
f = {
|
||||
f = { "<cmd>Telescope find_files<cr>", "Find file" },
|
||||
p = {
|
||||
[[<cmd>lua require('telescope.builtin').find_files{ cwd = '~/.config/nvim/' }<CR>]],
|
||||
"Find config file",
|
||||
},
|
||||
o = { "<cmd>Telescope oldfiles<cr>", "Open recent file" },
|
||||
b = browse_files,
|
||||
},
|
||||
b = {
|
||||
b = { "<cmd>Telescope buffers<CR>", "Switch buffer" },
|
||||
},
|
||||
h = {
|
||||
h = { "<cmd>Telescope help_tags<CR>", "Vim help tags" },
|
||||
m = { "<cmd>Telescope man_pages<CR>", "Man pages" },
|
||||
},
|
||||
p = {
|
||||
p = { "<cmd>Telescope projects<CR>", "Switch to project" },
|
||||
f = find_file_in_project,
|
||||
},
|
||||
g = {
|
||||
c = { "<cmd>Telescope git_commits<CR>", "Checkout commit" },
|
||||
C = { "<cmd>Telescope git_bcommits<CR>", "Checkout buffer commit" },
|
||||
B = { "<cmd>Telescope git_branches<CR>", "Switch branch" },
|
||||
s = { "<cmd>Telescope git_stash<CR>", "Apply stash" },
|
||||
},
|
||||
["<space>"] = find_file_in_project,
|
||||
["."] = browse_files,
|
||||
[","] = { "<cmd>Telescope buffers<CR>", "Switch buffer" },
|
||||
["/"] = { "<cmd>Telescope live_grep<CR>", "Live grep" },
|
||||
}, {
|
||||
prefix = "<leader>",
|
||||
})
|
||||
|
||||
return M
|
@ -0,0 +1,41 @@
|
||||
require("toggleterm").setup({
|
||||
hide_numbers = true,
|
||||
shade_terminals = true,
|
||||
start_in_insert = true,
|
||||
direction = "horizontal",
|
||||
close_on_exit = false,
|
||||
})
|
||||
|
||||
local Terminal = require("toggleterm.terminal").Terminal
|
||||
local lazygit = Terminal:new({
|
||||
cmd = "lazygit",
|
||||
hidden = true,
|
||||
direction = "tab",
|
||||
on_open = function(term)
|
||||
vim.cmd("startinsert!")
|
||||
vim.api.nvim_buf_set_keymap(term.bufnr, "t", "<esc>", "<esc>", { noremap = true, silent = true })
|
||||
vim.api.nvim_buf_set_keymap(term.bufnr, "t", "<C-c>", "", {
|
||||
callback = function()
|
||||
term:toggle()
|
||||
end,
|
||||
noremap = true,
|
||||
silent = true,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.register({
|
||||
g = {
|
||||
g = {
|
||||
function()
|
||||
lazygit:toggle()
|
||||
end,
|
||||
"Open lazygit",
|
||||
},
|
||||
},
|
||||
o = {
|
||||
t = { '<cmd>exe v:count1 . "ToggleTerm"<CR>', "Open terminal" },
|
||||
},
|
||||
}, { prefix = "<leader>" })
|
@ -0,0 +1,57 @@
|
||||
local wk = require("which-key")
|
||||
|
||||
require("neotest").setup({
|
||||
adapters = {
|
||||
require("neotest-jest"),
|
||||
require("neotest-python"),
|
||||
require("neotest-go"),
|
||||
},
|
||||
})
|
||||
|
||||
local run_current_test_keybiding = {
|
||||
function()
|
||||
require("neotest").run.run()
|
||||
end,
|
||||
"Current test",
|
||||
}
|
||||
|
||||
local keybindings = {
|
||||
name = "Test",
|
||||
t = run_current_test_keybiding,
|
||||
T = {
|
||||
function()
|
||||
require("neotest").run.run(vim.fn.expand("%"))
|
||||
end,
|
||||
"Current file",
|
||||
},
|
||||
d = {
|
||||
function()
|
||||
require("neotest").run.run({ strategy = "dap" })
|
||||
end,
|
||||
"Debug current test",
|
||||
},
|
||||
s = {
|
||||
function()
|
||||
require("neotest").run.stop()
|
||||
end,
|
||||
"Stop running test",
|
||||
},
|
||||
a = {
|
||||
function()
|
||||
require("neotest").run.attach()
|
||||
end,
|
||||
"Attach to running test",
|
||||
},
|
||||
}
|
||||
|
||||
wk.register({
|
||||
r = {
|
||||
t = run_current_test_keybiding,
|
||||
T = keybindings,
|
||||
},
|
||||
c = {
|
||||
T = keybindings,
|
||||
},
|
||||
}, {
|
||||
prefix = "<leader>",
|
||||
})
|
@ -0,0 +1,14 @@
|
||||
require("mason").setup()
|
||||
|
||||
require("mason-tool-installer").setup({
|
||||
ensure_installed = {
|
||||
"stylua",
|
||||
"shellcheck",
|
||||
"shfmt",
|
||||
"editorconfig-checker",
|
||||
"eslint",
|
||||
"prettier",
|
||||
"flake8",
|
||||
"black",
|
||||
},
|
||||
})
|
@ -0,0 +1,19 @@
|
||||
require("twilight").setup({
|
||||
treesitter = true,
|
||||
expand = {
|
||||
"function",
|
||||
"method",
|
||||
"table",
|
||||
"if_statement",
|
||||
},
|
||||
})
|
||||
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.register({
|
||||
t = {
|
||||
t = { "<cmd>Twilight<CR>", "Twilight" },
|
||||
},
|
||||
}, {
|
||||
prefix = "<leader>",
|
||||
})
|
@ -0,0 +1,76 @@
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.setup()
|
||||
|
||||
wk.register({
|
||||
f = {
|
||||
name = "File",
|
||||
C = {
|
||||
function()
|
||||
vim.api.nvim_input(":Copy " .. vim.fn.expand("%"))
|
||||
end,
|
||||
"Copy file",
|
||||
},
|
||||
R = {
|
||||
function()
|
||||
vim.api.nvim_input(":Move " .. vim.fn.expand("%"))
|
||||
end,
|
||||
"Rename/move file",
|
||||
},
|
||||
D = {
|
||||
function()
|
||||
vim.api.nvim_input(":Delete")
|
||||
end,
|
||||
"Delete file",
|
||||
},
|
||||
P = {
|
||||
function()
|
||||
print(vim.fn.expand("%:p"))
|
||||
end,
|
||||
"Print absolute path",
|
||||
},
|
||||
},
|
||||
b = {
|
||||
name = "Buffer",
|
||||
d = { "<cmd>bdel<CR>", "Delete buffer" },
|
||||
s = { "<cmd>write<CR>", "Save buffer" },
|
||||
},
|
||||
c = {
|
||||
name = "Code",
|
||||
},
|
||||
h = {
|
||||
name = "Help",
|
||||
},
|
||||
p = {
|
||||
name = "Project",
|
||||
},
|
||||
n = {
|
||||
name = "Note",
|
||||
},
|
||||
t = {
|
||||
name = "Toggle",
|
||||
},
|
||||
g = {
|
||||
name = "Git",
|
||||
},
|
||||
r = {
|
||||
name = "Run",
|
||||
},
|
||||
o = {
|
||||
name = "Open",
|
||||
t = { '<cmd>exe v:count1 . "ToggleTerm"<CR>', "Open terminal" },
|
||||
T = { "<cmd>terminal<CR>", "Open terminal here" },
|
||||
},
|
||||
w = {
|
||||
name = "Window",
|
||||
d = { "<cmd>close<CR>", "Close window" },
|
||||
v = { "<cmd>vsplit<CR>", "Vertical split" },
|
||||
s = { "<cmd>split<CR>", "Horizontal split" },
|
||||
},
|
||||
q = {
|
||||
name = "Quit",
|
||||
q = { "<cmd>qa<CR>", "Quit nvim" },
|
||||
},
|
||||
}, {
|
||||
prefix = "<leader>",
|
||||
})
|
@ -0,0 +1,11 @@
|
||||
require("zen-mode").setup()
|
||||
|
||||
local wk = require('which-key')
|
||||
|
||||
wk.register({
|
||||
t = {
|
||||
z = {"<cmd>ZenMode<CR>", "Zen mode"}
|
||||
}
|
||||
}, {
|
||||
prefix = "<leader>"
|
||||
})
|
@ -0,0 +1,51 @@
|
||||
local utils = require("utils")
|
||||
|
||||
local cmd = vim.cmd
|
||||
local indent = 2
|
||||
|
||||
cmd("syntax enable")
|
||||
cmd("filetype plugin indent on")
|
||||
utils.opt("b", "expandtab", true)
|
||||
utils.opt("b", "shiftwidth", indent)
|
||||
utils.opt("b", "smartindent", false)
|
||||
utils.opt("b", "autoindent", true)
|
||||
utils.opt("b", "softtabstop", indent)
|
||||
utils.opt("b", "tabstop", indent)
|
||||
utils.opt("o", "hidden", true)
|
||||
utils.opt("w", "wrap", true)
|
||||
utils.opt("o", "ignorecase", true)
|
||||
utils.opt("o", "scrolloff", 10)
|
||||
utils.opt("o", "shiftround", true)
|
||||
utils.opt("o", "smartcase", true)
|
||||
utils.opt("o", "splitbelow", true)
|
||||
utils.opt("o", "splitright", true)
|
||||
utils.opt("w", "number", true)
|
||||
utils.opt("w", "relativenumber", true)
|
||||
utils.opt("w", "cursorline", true)
|
||||
utils.opt("o", "clipboard", "unnamed,unnamedplus")
|
||||
utils.opt("o", "lazyredraw", true)
|
||||
utils.opt("b", "undofile", true)
|
||||
utils.opt("o", "mouse", "a")
|
||||
utils.opt("o", "scrolloff", 10)
|
||||
utils.opt("o", "laststatus", 3)
|
||||
|
||||
vim.g.maplocalleader = ","
|
||||
|
||||
-- Highlight on yank
|
||||
vim.cmd("au TextYankPost * lua vim.highlight.on_yank {on_visual = false}")
|
||||
|
||||
-- Terminal
|
||||
vim.api.nvim_create_augroup("Terminal", { clear = true })
|
||||
vim.api.nvim_create_autocmd("TermOpen", {
|
||||
group = "Terminal",
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.wo.number = false
|
||||
vim.wo.relativenumber = false
|
||||
vim.api.nvim_buf_set_keymap(0, "t", "<esc>", [[<C-\><C-n>]], { noremap = true })
|
||||
vim.cmd("startinsert")
|
||||
end,
|
||||
})
|
||||
|
||||
require("keybindings")
|
||||
require("colorscheme")
|
@ -0,0 +1,15 @@
|
||||
local utils = { }
|
||||
|
||||
local scopes = {o = vim.o, b = vim.bo, w = vim.wo}
|
||||
|
||||
function utils.opt(scope, key, value)
|
||||
scopes[scope][key] = value
|
||||
if scope ~= 'o' then scopes['o'][key] = value end
|
||||
end
|
||||
|
||||
function utils.map(mode, lhs, rhs, opts)
|
||||
opts = opts or { noremap = true }
|
||||
vim.api.nvim_set_keymap(mode, lhs, rhs, opts)
|
||||
end
|
||||
|
||||
return utils
|
Loading…
Reference in new issue