[neovim] Install octo.nvim (and some formatting)
This commit is contained in:
parent
1f3249a316
commit
6f83e32406
1 changed files with 75 additions and 61 deletions
|
@ -57,9 +57,9 @@ vim.keymap.set("t", "<c-h>", "<c-\\><c-n><c-w>h", { noremap = true, desc = 'Go t
|
||||||
vim.keymap.set("t", "<c-l>", "<c-\\><c-n><c-w>l", { noremap = true, desc = 'Go to window to the right' })
|
vim.keymap.set("t", "<c-l>", "<c-\\><c-n><c-w>l", { noremap = true, desc = 'Go to window to the right' })
|
||||||
|
|
||||||
vim.keymap.set(
|
vim.keymap.set(
|
||||||
{"n", "t"},
|
{ "n", "t" },
|
||||||
"<leader>z",
|
"<leader>z",
|
||||||
function ()
|
function()
|
||||||
-- This restores the UI to the saved layout 'idelayout' (if it exists)
|
-- This restores the UI to the saved layout 'idelayout' (if it exists)
|
||||||
if vim.fn.exists("idelayout") ~= 0 then
|
if vim.fn.exists("idelayout") ~= 0 then
|
||||||
vim.cmd("exec idelayout")
|
vim.cmd("exec idelayout")
|
||||||
|
@ -70,7 +70,7 @@ vim.keymap.set(
|
||||||
|
|
||||||
local terminalgroup = vim.api.nvim_create_augroup("TerminalGroup", { clear = true })
|
local terminalgroup = vim.api.nvim_create_augroup("TerminalGroup", { clear = true })
|
||||||
vim.api.nvim_create_autocmd(
|
vim.api.nvim_create_autocmd(
|
||||||
{"TermOpen", "TermEnter"},
|
{ "TermOpen", "TermEnter" },
|
||||||
{
|
{
|
||||||
group = terminalgroup,
|
group = terminalgroup,
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
|
@ -101,7 +101,7 @@ require("lazy").setup({
|
||||||
name = "dracula",
|
name = "dracula",
|
||||||
lazy = false,
|
lazy = false,
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
config = function ()
|
config = function()
|
||||||
vim.cmd.colorscheme("dracula")
|
vim.cmd.colorscheme("dracula")
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
@ -137,7 +137,7 @@ require("lazy").setup({
|
||||||
"ray-x/lsp_signature.nvim",
|
"ray-x/lsp_signature.nvim",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
opts = {},
|
opts = {},
|
||||||
config = function(_, opts) require'lsp_signature'.setup(opts) end
|
config = function(_, opts) require 'lsp_signature'.setup(opts) end
|
||||||
},
|
},
|
||||||
{ "folke/neodev.nvim", opts = {} },
|
{ "folke/neodev.nvim", opts = {} },
|
||||||
{
|
{
|
||||||
|
@ -274,7 +274,8 @@ require("lazy").setup({
|
||||||
{
|
{
|
||||||
"microsoft/vscode-js-debug",
|
"microsoft/vscode-js-debug",
|
||||||
-- After install, build it and rename the dist directory to out
|
-- After install, build it and rename the dist directory to out
|
||||||
build = "npm install --legacy-peer-deps --no-save && npx gulp vsDebugServerBundle && rm -rf out && mv dist out",
|
build =
|
||||||
|
"npm install --legacy-peer-deps --no-save && npx gulp vsDebugServerBundle && rm -rf out && mv dist out",
|
||||||
version = "1.*",
|
version = "1.*",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -330,7 +331,8 @@ require("lazy").setup({
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope-fzf-native.nvim",
|
"nvim-telescope/telescope-fzf-native.nvim",
|
||||||
build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
|
build =
|
||||||
|
"cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -349,6 +351,18 @@ require("lazy").setup({
|
||||||
},
|
},
|
||||||
{ "tpope/vim-fugitive", event = "VeryLazy" },
|
{ "tpope/vim-fugitive", event = "VeryLazy" },
|
||||||
{ "lewis6991/gitsigns.nvim", event = "VeryLazy" },
|
{ "lewis6991/gitsigns.nvim", event = "VeryLazy" },
|
||||||
|
{
|
||||||
|
"pwntester/octo.nvim",
|
||||||
|
requires = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
"nvim-tree/nvim-web-devicons",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("octo").setup()
|
||||||
|
end,
|
||||||
|
event = "VeryLazy",
|
||||||
|
},
|
||||||
{ "famiu/bufdelete.nvim", event = "VeryLazy" },
|
{ "famiu/bufdelete.nvim", event = "VeryLazy" },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -385,13 +399,13 @@ vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope: live g
|
||||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope: buffers' })
|
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope: buffers' })
|
||||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope: help tags' })
|
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope: help tags' })
|
||||||
|
|
||||||
require"lsp_signature".setup()
|
require "lsp_signature".setup()
|
||||||
|
|
||||||
--[[ nvim-cmp
|
--[[ nvim-cmp
|
||||||
nvim-cmp is a text completion engine.
|
nvim-cmp is a text completion engine.
|
||||||
]]
|
]]
|
||||||
|
|
||||||
local cmp = require'cmp'
|
local cmp = require 'cmp'
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
sources = {
|
sources = {
|
||||||
|
@ -452,6 +466,11 @@ cmp.setup.cmdline(':', {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Neodev
|
||||||
|
require("neodev").setup({
|
||||||
|
library = { plugins = { "nvim-dap-ui" }, types = true },
|
||||||
|
})
|
||||||
|
|
||||||
--[[ nvim-lspconfig
|
--[[ nvim-lspconfig
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
|
@ -483,10 +502,10 @@ local lua_ls_setup = {
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
|
||||||
local lspconfig = require('lspconfig')
|
local lspconfig = require('lspconfig')
|
||||||
lspconfig.gopls.setup {capabilities = capabilities}
|
lspconfig.gopls.setup { capabilities = capabilities }
|
||||||
lspconfig.lua_ls.setup(lua_ls_setup)
|
lspconfig.lua_ls.setup(lua_ls_setup)
|
||||||
lspconfig.pyright.setup {capabilities = capabilities}
|
lspconfig.pyright.setup { capabilities = capabilities }
|
||||||
lspconfig.tsserver.setup {capabilities = capabilities}
|
lspconfig.tsserver.setup { capabilities = capabilities }
|
||||||
lspconfig.rust_analyzer.setup {
|
lspconfig.rust_analyzer.setup {
|
||||||
-- Server-specific settings. See `:help lspconfig-setup`
|
-- Server-specific settings. See `:help lspconfig-setup`
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
|
@ -499,7 +518,7 @@ lspconfig.rust_analyzer.setup {
|
||||||
local capabilities_html = vim.lsp.protocol.make_client_capabilities()
|
local capabilities_html = vim.lsp.protocol.make_client_capabilities()
|
||||||
capabilities_html.textDocument.completion.completionItem.snippetSupport = true
|
capabilities_html.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
|
||||||
require'lspconfig'.html.setup {
|
require 'lspconfig'.html.setup {
|
||||||
capabilities = capabilities_html,
|
capabilities = capabilities_html,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,7 +547,7 @@ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
|
||||||
)
|
)
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
vim.diagnostic.config{
|
vim.diagnostic.config {
|
||||||
float = { border = _border, max_width = 120 }
|
float = { border = _border, max_width = 120 }
|
||||||
}
|
}
|
||||||
-- Use LspAttach autocommand to only map the following keys
|
-- Use LspAttach autocommand to only map the following keys
|
||||||
|
@ -621,29 +640,30 @@ require('gitsigns').setup({
|
||||||
if vim.wo.diff then return ']c' end
|
if vim.wo.diff then return ']c' end
|
||||||
vim.schedule(function() gs.next_hunk() end)
|
vim.schedule(function() gs.next_hunk() end)
|
||||||
return '<Ignore>'
|
return '<Ignore>'
|
||||||
end, {expr=true, desc='GitSigns: go to next hunk'})
|
end, { expr = true, desc = 'GitSigns: go to next hunk' })
|
||||||
|
|
||||||
map('n', '[c', function()
|
map('n', '[c', function()
|
||||||
if vim.wo.diff then return '[c' end
|
if vim.wo.diff then return '[c' end
|
||||||
vim.schedule(function() gs.prev_hunk() end)
|
vim.schedule(function() gs.prev_hunk() end)
|
||||||
return '<Ignore>'
|
return '<Ignore>'
|
||||||
end, {expr=true, desc='GitSigns: go to previous hunk'})
|
end, { expr = true, desc = 'GitSigns: go to previous hunk' })
|
||||||
|
|
||||||
-- Actions
|
-- Actions
|
||||||
map('n', '<leader>hs', gs.stage_hunk, { desc = 'GitSigns: stage hunk' })
|
map('n', '<leader>hs', gs.stage_hunk, { desc = 'GitSigns: stage hunk' })
|
||||||
map('n', '<leader>hr', gs.reset_hunk, { desc = 'GitSigns: reset hunk' })
|
map('n', '<leader>hr', gs.reset_hunk, { desc = 'GitSigns: reset hunk' })
|
||||||
map('v', '<leader>hs', function() gs.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end, { desc = 'GitSigns: stage hunk' })
|
map('v', '<leader>hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end,
|
||||||
map('v', '<leader>hr', function() gs.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end, { desc = 'GitSigns: reset hunk' })
|
{ desc = 'GitSigns: stage hunk' })
|
||||||
|
map('v', '<leader>hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end,
|
||||||
|
{ desc = 'GitSigns: reset hunk' })
|
||||||
map('n', '<leader>hS', gs.stage_buffer, { desc = 'GitSigns: stage buffer' })
|
map('n', '<leader>hS', gs.stage_buffer, { desc = 'GitSigns: stage buffer' })
|
||||||
map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'GitSigns: undo stage hunk' })
|
map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'GitSigns: undo stage hunk' })
|
||||||
map('n', '<leader>hR', gs.reset_buffer, { desc = 'GitSigns: reset_buffer' })
|
map('n', '<leader>hR', gs.reset_buffer, { desc = 'GitSigns: reset_buffer' })
|
||||||
map('n', '<leader>hp', gs.preview_hunk, { desc = 'GitSigns: preview hunk' })
|
map('n', '<leader>hp', gs.preview_hunk, { desc = 'GitSigns: preview hunk' })
|
||||||
map('n', '<leader>hb', function() gs.blame_line{full=true} end, { desc = 'GitSigns: blame line' })
|
map('n', '<leader>hb', function() gs.blame_line { full = true } end, { desc = 'GitSigns: blame line' })
|
||||||
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'GitSigns: toggle current line blame' })
|
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'GitSigns: toggle current line blame' })
|
||||||
map('n', '<leader>hd', gs.diffthis, { desc = 'GitSigns: diff this' })
|
map('n', '<leader>hd', gs.diffthis, { desc = 'GitSigns: diff this' })
|
||||||
map('n', '<leader>hD', function() gs.diffthis('~') end, { desc = 'GitSigns: diff this' })
|
map('n', '<leader>hD', function() gs.diffthis('~') end, { desc = 'GitSigns: diff this' })
|
||||||
map('n', '<leader>td', gs.toggle_deleted, { desc = 'GitSigns: toggle deleted' })
|
map('n', '<leader>td', gs.toggle_deleted, { desc = 'GitSigns: toggle deleted' })
|
||||||
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -721,12 +741,6 @@ require('nvim-treesitter.configs').setup({
|
||||||
|
|
||||||
vim.treesitter.language.register("html", "handlebars")
|
vim.treesitter.language.register("html", "handlebars")
|
||||||
|
|
||||||
-- Neodev
|
|
||||||
require("neodev").setup({
|
|
||||||
library = { plugins = { "nvim-dap-ui" }, types = true },
|
|
||||||
...
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Tweak GitSigns blame color
|
-- Tweak GitSigns blame color
|
||||||
-- This differentiates the cursorline from the git blame text
|
-- This differentiates the cursorline from the git blame text
|
||||||
vim.cmd("highlight GitSignsCurrentLineBlame gui=bold guifg=#339944")
|
vim.cmd("highlight GitSignsCurrentLineBlame gui=bold guifg=#339944")
|
||||||
|
|
Loading…
Reference in a new issue