[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
132
neovim/init.lua
132
neovim/init.lua
|
@ -6,8 +6,8 @@ vim.opt.clipboard = "unnamedplus,unnamed"
|
|||
|
||||
-- Spaces indentation
|
||||
vim.opt.expandtab = true -- converts tabs to spaces
|
||||
vim.opt.tabstop = 4 -- tab equals 4 spaces
|
||||
vim.opt.shiftwidth = 4 -- indent size in characters
|
||||
vim.opt.tabstop = 4 -- tab equals 4 spaces
|
||||
vim.opt.shiftwidth = 4 -- indent size in characters
|
||||
|
||||
-- Show whitespace (:list)
|
||||
vim.opt.listchars = "eol:¬,tab:>-,trail:~,extends:>,precedes:<,space:·"
|
||||
|
@ -40,7 +40,7 @@ vim.opt.directory = ".swp/," .. HOME .. "/.swp/,/tmp//"
|
|||
|
||||
-- netrw
|
||||
-- This is the workspace file explorer
|
||||
vim.g.netrw_winsize = 25 -- width of the file explorer
|
||||
vim.g.netrw_winsize = 25 -- width of the file explorer
|
||||
vim.g.netrw_liststyle = 3 -- tree style listing
|
||||
|
||||
-- Sane vim split naviagation (via Gaslight blog)
|
||||
|
@ -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(
|
||||
{"n", "t"},
|
||||
{ "n", "t" },
|
||||
"<leader>z",
|
||||
function ()
|
||||
function()
|
||||
-- This restores the UI to the saved layout 'idelayout' (if it exists)
|
||||
if vim.fn.exists("idelayout") ~= 0 then
|
||||
vim.cmd("exec idelayout")
|
||||
|
@ -70,7 +70,7 @@ vim.keymap.set(
|
|||
|
||||
local terminalgroup = vim.api.nvim_create_augroup("TerminalGroup", { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
{"TermOpen", "TermEnter"},
|
||||
{ "TermOpen", "TermEnter" },
|
||||
{
|
||||
group = terminalgroup,
|
||||
pattern = "*",
|
||||
|
@ -101,7 +101,7 @@ require("lazy").setup({
|
|||
name = "dracula",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function ()
|
||||
config = function()
|
||||
vim.cmd.colorscheme("dracula")
|
||||
end,
|
||||
},
|
||||
|
@ -115,7 +115,7 @@ require("lazy").setup({
|
|||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("nvim-surround").setup({
|
||||
-- Configuration here, or leave empty to use defaults
|
||||
-- Configuration here, or leave empty to use defaults
|
||||
})
|
||||
end
|
||||
},
|
||||
|
@ -137,9 +137,9 @@ require("lazy").setup({
|
|||
"ray-x/lsp_signature.nvim",
|
||||
event = "VeryLazy",
|
||||
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 = {} },
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" },
|
||||
|
@ -274,7 +274,8 @@ require("lazy").setup({
|
|||
{
|
||||
"microsoft/vscode-js-debug",
|
||||
-- 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.*",
|
||||
},
|
||||
{
|
||||
|
@ -318,10 +319,10 @@ require("lazy").setup({
|
|||
},
|
||||
},
|
||||
},
|
||||
{ "leoluz/nvim-dap-go", event = "VeryLazy" },
|
||||
{ "williamboman/mason.nvim", event = "VeryLazy" },
|
||||
{ "leoluz/nvim-dap-go", event = "VeryLazy" },
|
||||
{ "williamboman/mason.nvim", event = "VeryLazy" },
|
||||
{ "williamboman/mason-lspconfig.nvim", event = "VeryLazy" },
|
||||
{ "nvimdev/lspsaga.nvim", event = "VeryLazy" },
|
||||
{ "nvimdev/lspsaga.nvim", event = "VeryLazy" },
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
event = "VeryLazy",
|
||||
|
@ -330,7 +331,8 @@ require("lazy").setup({
|
|||
"nvim-lua/plenary.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",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -347,8 +349,20 @@ require("lazy").setup({
|
|||
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
},
|
||||
},
|
||||
{ "tpope/vim-fugitive", event = "VeryLazy" },
|
||||
{ "tpope/vim-fugitive", 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" },
|
||||
})
|
||||
|
||||
|
@ -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>fh', builtin.help_tags, { desc = 'Telescope: help tags' })
|
||||
|
||||
require"lsp_signature".setup()
|
||||
require "lsp_signature".setup()
|
||||
|
||||
--[[ nvim-cmp
|
||||
nvim-cmp is a text completion engine.
|
||||
]]
|
||||
|
||||
local cmp = require'cmp'
|
||||
local cmp = require 'cmp'
|
||||
|
||||
cmp.setup({
|
||||
sources = {
|
||||
|
@ -452,6 +466,11 @@ cmp.setup.cmdline(':', {
|
|||
})
|
||||
})
|
||||
|
||||
-- Neodev
|
||||
require("neodev").setup({
|
||||
library = { plugins = { "nvim-dap-ui" }, types = true },
|
||||
})
|
||||
|
||||
--[[ nvim-lspconfig
|
||||
--]]
|
||||
|
||||
|
@ -483,10 +502,10 @@ local lua_ls_setup = {
|
|||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
local lspconfig = require('lspconfig')
|
||||
lspconfig.gopls.setup {capabilities = capabilities}
|
||||
lspconfig.gopls.setup { capabilities = capabilities }
|
||||
lspconfig.lua_ls.setup(lua_ls_setup)
|
||||
lspconfig.pyright.setup {capabilities = capabilities}
|
||||
lspconfig.tsserver.setup {capabilities = capabilities}
|
||||
lspconfig.pyright.setup { capabilities = capabilities }
|
||||
lspconfig.tsserver.setup { capabilities = capabilities }
|
||||
lspconfig.rust_analyzer.setup {
|
||||
-- Server-specific settings. See `:help lspconfig-setup`
|
||||
capabilities = capabilities,
|
||||
|
@ -499,8 +518,8 @@ lspconfig.rust_analyzer.setup {
|
|||
local capabilities_html = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities_html.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
require'lspconfig'.html.setup {
|
||||
capabilities = capabilities_html,
|
||||
require 'lspconfig'.html.setup {
|
||||
capabilities = capabilities_html,
|
||||
}
|
||||
|
||||
-- Global mappings : Diagnostics
|
||||
|
@ -514,9 +533,9 @@ vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, { desc = 'Diagnostic:
|
|||
local _border = "single"
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
|
||||
vim.lsp.handlers.hover, {
|
||||
border = _border
|
||||
}
|
||||
vim.lsp.handlers.hover, {
|
||||
border = _border
|
||||
}
|
||||
)
|
||||
|
||||
-- TODO: Is this necessary? Or is signature help being handled with LSPSaga?
|
||||
|
@ -528,8 +547,8 @@ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
|
|||
)
|
||||
--]]
|
||||
|
||||
vim.diagnostic.config{
|
||||
float = { border = _border, max_width = 120 }
|
||||
vim.diagnostic.config {
|
||||
float = { border = _border, max_width = 120 }
|
||||
}
|
||||
-- Use LspAttach autocommand to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
|
@ -568,7 +587,7 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
|||
})
|
||||
|
||||
require('gitsigns').setup({
|
||||
signs = {
|
||||
signs = {
|
||||
add = { text = '│' },
|
||||
change = { text = '│' },
|
||||
delete = { text = '_' },
|
||||
|
@ -576,27 +595,27 @@ require('gitsigns').setup({
|
|||
changedelete = { text = '~' },
|
||||
untracked = { text = '┆' },
|
||||
},
|
||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||
watch_gitdir = {
|
||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||
watch_gitdir = {
|
||||
follow_files = true
|
||||
},
|
||||
attach_to_untracked = true,
|
||||
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||
current_line_blame_opts = {
|
||||
attach_to_untracked = true,
|
||||
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
||||
delay = 1000,
|
||||
ignore_whitespace = false,
|
||||
},
|
||||
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil, -- Use default
|
||||
max_file_length = 40000, -- Disable if file is longer than this (in lines)
|
||||
preview_config = {
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil, -- Use default
|
||||
max_file_length = 40000, -- Disable if file is longer than this (in lines)
|
||||
preview_config = {
|
||||
-- Options passed to nvim_open_win
|
||||
border = 'single',
|
||||
style = 'minimal',
|
||||
|
@ -604,10 +623,10 @@ require('gitsigns').setup({
|
|||
row = 0,
|
||||
col = 1
|
||||
},
|
||||
yadm = {
|
||||
yadm = {
|
||||
enable = false
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
|
@ -621,29 +640,30 @@ require('gitsigns').setup({
|
|||
if vim.wo.diff then return ']c' end
|
||||
vim.schedule(function() gs.next_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, {expr=true, desc='GitSigns: go to next hunk'})
|
||||
end, { expr = true, desc = 'GitSigns: go to next hunk' })
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then return '[c' end
|
||||
vim.schedule(function() gs.prev_hunk() end)
|
||||
return '<Ignore>'
|
||||
end, {expr=true, desc='GitSigns: go to previous hunk'})
|
||||
end, { expr = true, desc = 'GitSigns: go to previous hunk' })
|
||||
|
||||
-- Actions
|
||||
map('n', '<leader>hs', gs.stage_hunk, { desc = 'GitSigns: stage 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>hr', function() gs.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end, { 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>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>hu', gs.undo_stage_hunk, { desc = 'GitSigns: undo stage hunk' })
|
||||
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>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>hd', gs.diffthis, { 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' })
|
||||
|
||||
end
|
||||
})
|
||||
|
||||
|
@ -678,13 +698,13 @@ local dap, dapui = require("dap"), require("dapui")
|
|||
dapui.setup()
|
||||
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
dapui.close()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close()
|
||||
dapui.close()
|
||||
end
|
||||
|
||||
-- Handlebars: One way to get syntax highlighting in Handlebars files
|
||||
|
@ -721,12 +741,6 @@ require('nvim-treesitter.configs').setup({
|
|||
|
||||
vim.treesitter.language.register("html", "handlebars")
|
||||
|
||||
-- Neodev
|
||||
require("neodev").setup({
|
||||
library = { plugins = { "nvim-dap-ui" }, types = true },
|
||||
...
|
||||
})
|
||||
|
||||
-- Tweak GitSigns blame color
|
||||
-- This differentiates the cursorline from the git blame text
|
||||
vim.cmd("highlight GitSignsCurrentLineBlame gui=bold guifg=#339944")
|
||||
|
|
Loading…
Reference in a new issue