Compare commits
11 Commits
9b4fbc5021
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| a07f128628 | |||
|
|
cfdc17be3a | ||
|
|
a5d4d12c8c | ||
|
|
174b5fa2b1 | ||
|
|
2fccee4349 | ||
|
|
2e8d5b17cb | ||
|
|
a42ed30a09 | ||
|
|
716d7465c0 | ||
|
|
c4605421e5 | ||
|
|
cd7adee3ce | ||
|
|
4b065ad2f7 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -6,9 +6,9 @@ nvim
|
||||
spell/
|
||||
|
||||
# In your personal fork, you likely want to comment this, since it's recommended to track
|
||||
# lazy-lock.json in version control - see https://lazy.folke.io/usage/lockfile
|
||||
# nvim-pack-lock.json in version control - see :help vim.pack-lockfile
|
||||
# For the official `nvim-lua/kickstart.nvim` git repository, we leave it ignored to avoid unneeded
|
||||
# merge conflicts.
|
||||
lazy-lock.json
|
||||
nvim-pack-lock.json
|
||||
|
||||
.DS_Store
|
||||
|
||||
44
README.md
44
README.md
@@ -69,9 +69,9 @@ fork to your machine using one of the commands below, depending on your OS.
|
||||
> Your fork's URL will be something like this:
|
||||
> `https://github.com/<your_github_username>/kickstart.nvim.git`
|
||||
|
||||
You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file
|
||||
too - it's ignored in the kickstart repo to make maintenance easier, but it's
|
||||
[recommended to track it in version control](https://lazy.folke.io/usage/lockfile).
|
||||
You likely want to remove `nvim-pack-lock.json` from your fork's `.gitignore`
|
||||
file too - it's ignored in the kickstart repo to make maintenance easier, but
|
||||
it's recommended to track it in version control (see `:help vim.pack-lockfile`).
|
||||
|
||||
#### Clone kickstart.nvim
|
||||
|
||||
@@ -111,8 +111,10 @@ Start Neovim
|
||||
nvim
|
||||
```
|
||||
|
||||
That's it! Lazy will install all the plugins you have. Use `:Lazy` to view
|
||||
the current plugin status. Hit `q` to close the window.
|
||||
That's it! `vim.pack` will install all the plugins from your config. Use
|
||||
`:lua vim.pack.update(nil, { offline = true })` to inspect plugin state and
|
||||
`:lua vim.pack.update()` to fetch updates (`:write` applies updates, `:quit`
|
||||
cancels them).
|
||||
|
||||
#### Read The Friendly Documentation
|
||||
|
||||
@@ -146,7 +148,8 @@ examples of adding popularly requested plugins.
|
||||
`~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim
|
||||
distribution that you would like to try out.
|
||||
* What if I want to "uninstall" this configuration:
|
||||
* See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information
|
||||
* Remove your config directory and local data directory (for example,
|
||||
`~/.config/nvim` and `~/.local/share/nvim`).
|
||||
* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files?
|
||||
* The main purpose of kickstart is to serve as a teaching tool and a reference
|
||||
configuration that someone can easily use to `git clone` as a basis for their own.
|
||||
@@ -167,17 +170,36 @@ After installing all the dependencies continue with the [Install Kickstart](#ins
|
||||
#### Windows Installation
|
||||
|
||||
<details><summary>Windows with Microsoft C++ Build Tools and CMake</summary>
|
||||
Installation may require installing build tools and updating the run command for `telescope-fzf-native`
|
||||
Kickstart's default config is make-only for `telescope-fzf-native.nvim`.
|
||||
If `make` is unavailable, the plugin is skipped.
|
||||
|
||||
See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation)
|
||||
Recommended: install `make` (see the chocolatey section below).
|
||||
|
||||
This requires:
|
||||
If you want a CMake-only setup, customize `init.lua` in two places:
|
||||
|
||||
- Install CMake and the Microsoft C++ Build Tools on Windows
|
||||
1. Include `telescope-fzf-native.nvim` when `cmake` is available:
|
||||
|
||||
```lua
|
||||
{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
|
||||
if vim.fn.executable 'make' == 1 or vim.fn.executable 'cmake' == 1 then
|
||||
table.insert(plugins, gh 'nvim-telescope/telescope-fzf-native.nvim')
|
||||
end
|
||||
```
|
||||
|
||||
2. In the `PackChanged` hook, use CMake when `make` is unavailable:
|
||||
|
||||
```lua
|
||||
if name == 'telescope-fzf-native.nvim' then
|
||||
if vim.fn.executable 'make' == 1 then
|
||||
run_build(name, { 'make' }, ev.data.path)
|
||||
elseif vim.fn.executable 'cmake' == 1 then
|
||||
run_build(name, { 'cmake', '-S.', '-Bbuild', '-DCMAKE_BUILD_TYPE=Release' }, ev.data.path)
|
||||
run_build(name, { 'cmake', '--build', 'build', '--config', 'Release', '--target', 'install' }, ev.data.path)
|
||||
end
|
||||
return
|
||||
end
|
||||
```
|
||||
|
||||
See `telescope-fzf-native` documentation for [build details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation).
|
||||
</details>
|
||||
<details><summary>Windows with gcc/make using chocolatey</summary>
|
||||
Alternatively, one can install gcc and make which don't require changing the config,
|
||||
|
||||
122
lua/custom/plugins/buffertabs.lua
Normal file
122
lua/custom/plugins/buffertabs.lua
Normal file
@@ -0,0 +1,122 @@
|
||||
-- ============================================================
|
||||
-- BUFFERLINE
|
||||
-- Buffer tabs
|
||||
-- ============================================================
|
||||
|
||||
local plugins = {
|
||||
{
|
||||
src = 'https://github.com/akinsho/bufferline.nvim',
|
||||
version = vim.version.range '*',
|
||||
},
|
||||
}
|
||||
|
||||
if vim.g.have_nerd_font then table.insert(plugins, 'https://github.com/nvim-tree/nvim-web-devicons') end
|
||||
|
||||
vim.pack.add(plugins)
|
||||
|
||||
-- ============================================================
|
||||
-- SETUP
|
||||
-- ============================================================
|
||||
|
||||
require('bufferline').setup {
|
||||
options = {
|
||||
mode = 'buffers',
|
||||
|
||||
numbers = 'none',
|
||||
|
||||
close_command = 'bdelete! %d',
|
||||
right_mouse_command = 'bdelete! %d',
|
||||
|
||||
left_mouse_command = 'buffer %d',
|
||||
middle_mouse_command = nil,
|
||||
|
||||
indicator = {
|
||||
style = 'underline',
|
||||
},
|
||||
|
||||
buffer_close_icon = '',
|
||||
modified_icon = '●',
|
||||
close_icon = '',
|
||||
left_trunc_marker = '',
|
||||
right_trunc_marker = '',
|
||||
|
||||
max_name_length = 24,
|
||||
max_prefix_length = 18,
|
||||
tab_size = 20,
|
||||
|
||||
diagnostics = 'nvim_lsp',
|
||||
|
||||
diagnostics_indicator = function(_, _, diagnostics_dict)
|
||||
local s = ' '
|
||||
for e, n in pairs(diagnostics_dict) do
|
||||
local sym = e == 'error' and ' ' or (e == 'warning' and ' ') or ' '
|
||||
|
||||
s = s .. n .. sym
|
||||
end
|
||||
return s
|
||||
end,
|
||||
|
||||
offsets = {
|
||||
{
|
||||
filetype = 'neo-tree',
|
||||
text = 'File Explorer',
|
||||
highlight = 'Directory',
|
||||
text_align = 'left',
|
||||
},
|
||||
},
|
||||
|
||||
show_buffer_icons = true,
|
||||
show_buffer_close_icons = false,
|
||||
show_close_icon = false,
|
||||
|
||||
show_tab_indicators = true,
|
||||
|
||||
persist_buffer_sort = true,
|
||||
separator_style = 'slant',
|
||||
|
||||
enforce_regular_tabs = false,
|
||||
always_show_bufferline = true,
|
||||
|
||||
hover = {
|
||||
enabled = true,
|
||||
delay = 200,
|
||||
reveal = { 'close' },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- ============================================================
|
||||
-- KEYMAPS
|
||||
-- ============================================================
|
||||
|
||||
-- Next buffer
|
||||
vim.keymap.set('n', '<Tab>', '<Cmd>BufferLineCycleNext<CR>', {
|
||||
desc = 'Next Buffer',
|
||||
silent = true,
|
||||
})
|
||||
|
||||
-- Previous buffer
|
||||
vim.keymap.set('n', '<S-Tab>', '<Cmd>BufferLineCyclePrev<CR>', {
|
||||
desc = 'Previous Buffer',
|
||||
silent = true,
|
||||
})
|
||||
|
||||
-- Pin buffer
|
||||
vim.keymap.set('n', '<leader>bp', '<Cmd>BufferLineTogglePin<CR>', {
|
||||
desc = 'Pin Buffer',
|
||||
silent = true,
|
||||
})
|
||||
|
||||
-- Close buffer
|
||||
vim.keymap.set('n', '<leader>bc', '<Cmd>bdelete<CR>', {
|
||||
desc = 'Close Buffer',
|
||||
silent = true,
|
||||
})
|
||||
|
||||
-- Go to buffer by number
|
||||
for i = 1, 9 do
|
||||
vim.keymap.set('n', '<leader>' .. i, function() require('bufferline').go_to(i, true) end, {
|
||||
desc = 'Go to buffer ' .. i,
|
||||
silent = true,
|
||||
})
|
||||
end
|
||||
@@ -3,6 +3,11 @@
|
||||
--
|
||||
-- See the kickstart.nvim README for more information
|
||||
|
||||
---@module 'lazy'
|
||||
---@type LazySpec
|
||||
return {}
|
||||
-- Iterate over all Lua files in the plugins directory and load them
|
||||
local plugins_dir = vim.fs.joinpath(vim.fn.stdpath 'config', 'lua', 'custom', 'plugins')
|
||||
for file_name, type in vim.fs.dir(plugins_dir) do
|
||||
if type == 'file' and file_name:match '%.lua$' and file_name ~= 'init.lua' then
|
||||
local module = file_name:gsub('%.lua$', '')
|
||||
require('custom.plugins.' .. module)
|
||||
end
|
||||
end
|
||||
|
||||
104
lua/custom/plugins/lualine.lua
Normal file
104
lua/custom/plugins/lualine.lua
Normal file
@@ -0,0 +1,104 @@
|
||||
-- ============================================================
|
||||
-- LUALINE
|
||||
-- Statusline
|
||||
-- ============================================================
|
||||
|
||||
vim.pack.add {
|
||||
{
|
||||
src = 'https://github.com/nvim-lualine/lualine.nvim',
|
||||
},
|
||||
|
||||
{
|
||||
src = 'https://github.com/nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
}
|
||||
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
theme = 'onedark',
|
||||
|
||||
icons_enabled = true,
|
||||
|
||||
component_separators = {
|
||||
left = '│',
|
||||
right = '│',
|
||||
},
|
||||
|
||||
section_separators = {
|
||||
left = '',
|
||||
right = '',
|
||||
},
|
||||
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
|
||||
ignore_focus = {},
|
||||
|
||||
always_divide_middle = true,
|
||||
|
||||
globalstatus = true,
|
||||
|
||||
refresh = {
|
||||
statusline = 100,
|
||||
tabline = 100,
|
||||
winbar = 100,
|
||||
},
|
||||
},
|
||||
|
||||
sections = {
|
||||
lualine_a = { {
|
||||
'mode',
|
||||
upper = true,
|
||||
} },
|
||||
|
||||
lualine_b = {
|
||||
'branch',
|
||||
'diff',
|
||||
'diagnostics',
|
||||
},
|
||||
|
||||
lualine_c = {
|
||||
{
|
||||
'filename',
|
||||
path = 1,
|
||||
},
|
||||
},
|
||||
|
||||
lualine_x = {
|
||||
{
|
||||
'encoding',
|
||||
show_bomb = true,
|
||||
},
|
||||
|
||||
'fileformat',
|
||||
'filetype',
|
||||
},
|
||||
|
||||
lualine_y = {
|
||||
'progress',
|
||||
},
|
||||
|
||||
lualine_z = {
|
||||
'location',
|
||||
},
|
||||
},
|
||||
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = { 'location' },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
|
||||
extensions = {
|
||||
'trouble',
|
||||
'quickfix',
|
||||
'fzf',
|
||||
'lazy',
|
||||
'mason',
|
||||
},
|
||||
}
|
||||
65
lua/custom/plugins/toggleterm.lua
Normal file
65
lua/custom/plugins/toggleterm.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
-- ============================================================
|
||||
-- TOGGLETERM
|
||||
-- Floating terminal
|
||||
-- ============================================================
|
||||
|
||||
vim.pack.add {
|
||||
{
|
||||
src = 'https://github.com/akinsho/toggleterm.nvim',
|
||||
version = vim.version.range '*',
|
||||
},
|
||||
}
|
||||
|
||||
require('toggleterm').setup {
|
||||
size = 20,
|
||||
|
||||
open_mapping = [[<leader>tt]],
|
||||
|
||||
hide_numbers = true,
|
||||
|
||||
shade_filetypes = {},
|
||||
|
||||
shade_terminals = true,
|
||||
|
||||
start_in_insert = true,
|
||||
|
||||
insert_mappings = true,
|
||||
|
||||
terminal_mappings = true,
|
||||
|
||||
persist_size = true,
|
||||
|
||||
persist_mode = true,
|
||||
|
||||
direction = 'float',
|
||||
|
||||
close_on_exit = true,
|
||||
|
||||
shell = vim.o.shell,
|
||||
|
||||
float_opts = {
|
||||
border = 'rounded',
|
||||
|
||||
winblend = 0,
|
||||
},
|
||||
}
|
||||
|
||||
-- ============================================================
|
||||
-- TERMINAL KEYMAPS
|
||||
-- ============================================================
|
||||
|
||||
vim.api.nvim_create_autocmd('TermOpen', {
|
||||
pattern = 'term://*',
|
||||
callback = function()
|
||||
local opts = { buffer = 0 }
|
||||
|
||||
-- ESC exits terminal insert mode
|
||||
vim.keymap.set('t', '<Esc>', [[<C-\><C-n>]], opts)
|
||||
|
||||
-- Better window navigation
|
||||
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
|
||||
end,
|
||||
})
|
||||
67
lua/custom/plugins/trouble.lua
Normal file
67
lua/custom/plugins/trouble.lua
Normal file
@@ -0,0 +1,67 @@
|
||||
-- ============================================================
|
||||
-- TROUBLE.NVIM
|
||||
-- Better diagnostics / references / quickfix UI
|
||||
-- ============================================================
|
||||
|
||||
vim.pack.add {
|
||||
{
|
||||
src = 'https://github.com/folke/trouble.nvim',
|
||||
},
|
||||
}
|
||||
|
||||
require('trouble').setup {
|
||||
auto_close = false,
|
||||
auto_open = false,
|
||||
auto_preview = true,
|
||||
|
||||
focus = true,
|
||||
|
||||
modes = {
|
||||
diagnostics = {
|
||||
auto_open = false,
|
||||
},
|
||||
},
|
||||
|
||||
icons = {
|
||||
indent = {
|
||||
top = '│ ',
|
||||
middle = '├╴',
|
||||
last = '└╴',
|
||||
fold_open = ' ',
|
||||
fold_closed = ' ',
|
||||
ws = ' ',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local trouble = require 'trouble'
|
||||
|
||||
-- ============================================================
|
||||
-- KEYMAPS
|
||||
-- ============================================================
|
||||
|
||||
-- General diagnostics
|
||||
vim.keymap.set('n', '<leader>xx', function() trouble.toggle 'diagnostics' end, { desc = 'Trouble: Diagnostics' })
|
||||
|
||||
-- Workspace diagnostics
|
||||
vim.keymap.set('n', '<leader>xw', function() trouble.toggle 'workspace_diagnostics' end, { desc = 'Trouble: Workspace Diagnostics' })
|
||||
|
||||
-- Current buffer diagnostics
|
||||
vim.keymap.set('n', '<leader>xd', function() trouble.toggle 'document_diagnostics' end, { desc = 'Trouble: Document Diagnostics' })
|
||||
|
||||
-- Quickfix
|
||||
vim.keymap.set('n', '<leader>xq', function() trouble.toggle 'quickfix' end, { desc = 'Trouble: Quickfix' })
|
||||
|
||||
-- Location list
|
||||
vim.keymap.set('n', '<leader>xl', function() trouble.toggle 'loclist' end, { desc = 'Trouble: Location List' })
|
||||
|
||||
-- LSP references
|
||||
vim.keymap.set('n', 'gr', function() trouble.toggle 'lsp_references' end, { desc = 'Trouble: References' })
|
||||
|
||||
-- Symbols
|
||||
vim.keymap.set('n', '<leader>xs', function() trouble.toggle 'symbols' end, { desc = 'Trouble: Symbols' })
|
||||
|
||||
-- Toggle previous/next diagnostics
|
||||
vim.keymap.set('n', '[x', function() trouble.prev { skip_groups = true, jump = true } end, { desc = 'Previous Trouble Item' })
|
||||
|
||||
vim.keymap.set('n', ']x', function() trouble.next { skip_groups = true, jump = true } end, { desc = 'Next Trouble Item' })
|
||||
@@ -12,7 +12,7 @@ local check_version = function()
|
||||
return
|
||||
end
|
||||
|
||||
if vim.version.ge(vim.version(), '0.11') then
|
||||
if vim.version.ge(vim.version(), '0.12') then
|
||||
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
|
||||
else
|
||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
-- autopairs
|
||||
-- https://github.com/windwp/nvim-autopairs
|
||||
|
||||
---@module 'lazy'
|
||||
---@type LazySpec
|
||||
return {
|
||||
'windwp/nvim-autopairs',
|
||||
event = 'InsertEnter',
|
||||
opts = {},
|
||||
}
|
||||
vim.pack.add { 'https://github.com/windwp/nvim-autopairs' }
|
||||
require('nvim-autopairs').setup {}
|
||||
|
||||
@@ -6,105 +6,90 @@
|
||||
-- be extended to other languages as well. That's why it's called
|
||||
-- kickstart.nvim and not kitchen-sink.nvim ;)
|
||||
|
||||
---@module 'lazy'
|
||||
---@type LazySpec
|
||||
return {
|
||||
-- NOTE: Yes, you can install new plugins here!
|
||||
'mfussenegger/nvim-dap',
|
||||
-- NOTE: And you can specify dependencies as well
|
||||
dependencies = {
|
||||
-- Creates a beautiful debugger UI
|
||||
'rcarriga/nvim-dap-ui',
|
||||
|
||||
-- Required dependency for nvim-dap-ui
|
||||
'nvim-neotest/nvim-nio',
|
||||
|
||||
-- Installs the debug adapters for you
|
||||
'mason-org/mason.nvim',
|
||||
'jay-babu/mason-nvim-dap.nvim',
|
||||
|
||||
-- Add your own debuggers here
|
||||
'leoluz/nvim-dap-go',
|
||||
},
|
||||
keys = {
|
||||
-- Basic debugging keymaps, feel free to change to your liking!
|
||||
{ '<F5>', function() require('dap').continue() end, desc = 'Debug: Start/Continue' },
|
||||
{ '<F1>', function() require('dap').step_into() end, desc = 'Debug: Step Into' },
|
||||
{ '<F2>', function() require('dap').step_over() end, desc = 'Debug: Step Over' },
|
||||
{ '<F3>', function() require('dap').step_out() end, desc = 'Debug: Step Out' },
|
||||
{ '<leader>b', function() require('dap').toggle_breakpoint() end, desc = 'Debug: Toggle Breakpoint' },
|
||||
{ '<leader>B', function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, desc = 'Debug: Set Breakpoint' },
|
||||
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||
{ '<F7>', function() require('dapui').toggle() end, desc = 'Debug: See last session result.' },
|
||||
},
|
||||
config = function()
|
||||
local dap = require 'dap'
|
||||
local dapui = require 'dapui'
|
||||
|
||||
require('mason-nvim-dap').setup {
|
||||
-- Makes a best effort to setup the various debuggers with
|
||||
-- reasonable debug configurations
|
||||
automatic_installation = true,
|
||||
|
||||
-- You can provide additional configuration to the handlers,
|
||||
-- see mason-nvim-dap README for more information
|
||||
handlers = {},
|
||||
|
||||
-- You'll need to check that you have the required things installed
|
||||
-- online, please don't ask me how to install them :)
|
||||
ensure_installed = {
|
||||
-- Update this to ensure that you have the debuggers for the langs you want
|
||||
'delve',
|
||||
},
|
||||
}
|
||||
|
||||
-- Dap UI setup
|
||||
-- For more information, see |:help nvim-dap-ui|
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
dapui.setup {
|
||||
-- Set icons to characters that are more likely to work in every terminal.
|
||||
-- Feel free to remove or use ones that you like more! :)
|
||||
-- Don't feel like these are good choices.
|
||||
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
controls = {
|
||||
icons = {
|
||||
pause = '⏸',
|
||||
play = '▶',
|
||||
step_into = '⏎',
|
||||
step_over = '⏭',
|
||||
step_out = '⏮',
|
||||
step_back = 'b',
|
||||
run_last = '▶▶',
|
||||
terminate = '⏹',
|
||||
disconnect = '⏏',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Change breakpoint icons
|
||||
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
|
||||
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
|
||||
-- local breakpoint_icons = vim.g.have_nerd_font
|
||||
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
|
||||
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
|
||||
-- for type, icon in pairs(breakpoint_icons) do
|
||||
-- local tp = 'Dap' .. type
|
||||
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
|
||||
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
|
||||
-- end
|
||||
|
||||
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
||||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||
|
||||
-- Install golang specific config
|
||||
require('dap-go').setup {
|
||||
delve = {
|
||||
-- On Windows delve must be run attached or it crashes.
|
||||
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
|
||||
detached = vim.fn.has 'win32' == 0,
|
||||
},
|
||||
}
|
||||
end,
|
||||
vim.pack.add {
|
||||
'https://github.com/mfussenegger/nvim-dap',
|
||||
'https://github.com/rcarriga/nvim-dap-ui',
|
||||
'https://github.com/nvim-neotest/nvim-nio',
|
||||
'https://github.com/mason-org/mason.nvim',
|
||||
'https://github.com/jay-babu/mason-nvim-dap.nvim',
|
||||
'https://github.com/leoluz/nvim-dap-go',
|
||||
}
|
||||
|
||||
-- Basic debugging keymaps, feel free to change to your liking!
|
||||
vim.keymap.set('n', '<F5>', function() require('dap').continue() end, { desc = 'Debug: Start/Continue' })
|
||||
vim.keymap.set('n', '<F1>', function() require('dap').step_into() end, { desc = 'Debug: Step Into' })
|
||||
vim.keymap.set('n', '<F2>', function() require('dap').step_over() end, { desc = 'Debug: Step Over' })
|
||||
vim.keymap.set('n', '<F3>', function() require('dap').step_out() end, { desc = 'Debug: Step Out' })
|
||||
vim.keymap.set('n', '<leader>b', function() require('dap').toggle_breakpoint() end, { desc = 'Debug: Toggle Breakpoint' })
|
||||
vim.keymap.set('n', '<leader>B', function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, { desc = 'Debug: Set Breakpoint' })
|
||||
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||
vim.keymap.set('n', '<F7>', function() require('dapui').toggle() end, { desc = 'Debug: See last session result.' })
|
||||
|
||||
local dap = require 'dap'
|
||||
local dapui = require 'dapui'
|
||||
|
||||
require('mason-nvim-dap').setup {
|
||||
-- Makes a best effort to setup the various debuggers with
|
||||
-- reasonable debug configurations
|
||||
automatic_installation = true,
|
||||
|
||||
-- You can provide additional configuration to the handlers,
|
||||
-- see mason-nvim-dap README for more information
|
||||
handlers = {},
|
||||
|
||||
-- You'll need to check that you have the required things installed
|
||||
-- online, please don't ask me how to install them :)
|
||||
ensure_installed = {
|
||||
-- Update this to ensure that you have the debuggers for the langs you want
|
||||
'delve',
|
||||
},
|
||||
}
|
||||
|
||||
-- Dap UI setup
|
||||
-- For more information, see |:help nvim-dap-ui|
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
dapui.setup {
|
||||
-- Set icons to characters that are more likely to work in every terminal.
|
||||
-- Feel free to remove or use ones that you like more! :)
|
||||
-- Don't feel like these are good choices.
|
||||
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
controls = {
|
||||
icons = {
|
||||
pause = '⏸',
|
||||
play = '▶',
|
||||
step_into = '⏎',
|
||||
step_over = '⏭',
|
||||
step_out = '⏮',
|
||||
step_back = 'b',
|
||||
run_last = '▶▶',
|
||||
terminate = '⏹',
|
||||
disconnect = '⏏',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Change breakpoint icons
|
||||
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
|
||||
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
|
||||
-- local breakpoint_icons = vim.g.have_nerd_font
|
||||
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
|
||||
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
|
||||
-- for type, icon in pairs(breakpoint_icons) do
|
||||
-- local tp = 'Dap' .. type
|
||||
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
|
||||
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
|
||||
-- end
|
||||
|
||||
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
||||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||
|
||||
-- Install golang specific config
|
||||
require('dap-go').setup {
|
||||
delve = {
|
||||
-- On Windows delve must be run attached or it crashes.
|
||||
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
|
||||
detached = vim.fn.has 'win32' == 0,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -2,62 +2,56 @@
|
||||
-- NOTE: gitsigns is already included in init.lua but contains only the base
|
||||
-- config. This will add also the recommended keymaps.
|
||||
|
||||
---@module 'lazy'
|
||||
---@type LazySpec
|
||||
return {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
---@module 'gitsigns'
|
||||
---@type Gitsigns.Config
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
opts = {
|
||||
on_attach = function(bufnr)
|
||||
local gitsigns = require 'gitsigns'
|
||||
vim.pack.add { 'https://github.com/lewis6991/gitsigns.nvim' }
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
require('gitsigns').setup {
|
||||
on_attach = function(bufnr)
|
||||
local gitsigns = require 'gitsigns'
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { ']c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'next'
|
||||
end
|
||||
end, { desc = 'Jump to next git [c]hange' })
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { ']c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'next'
|
||||
end
|
||||
end, { desc = 'Jump to next git [c]hange' })
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { '[c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'prev'
|
||||
end
|
||||
end, { desc = 'Jump to previous git [c]hange' })
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { '[c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'prev'
|
||||
end
|
||||
end, { desc = 'Jump to previous git [c]hange' })
|
||||
-- Actions
|
||||
-- visual mode
|
||||
map('v', '<leader>hs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [s]tage hunk' })
|
||||
map('v', '<leader>hr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk' })
|
||||
-- normal mode
|
||||
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
||||
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
||||
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
|
||||
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
|
||||
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
||||
map('n', '<leader>hi', gitsigns.preview_hunk_inline, { desc = 'git preview hunk [i]nline' })
|
||||
map('n', '<leader>hb', function() gitsigns.blame_line { full = true } end, { desc = 'git [b]lame line' })
|
||||
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
||||
map('n', '<leader>hD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' })
|
||||
map('n', '<leader>hQ', function() gitsigns.setqflist 'all' end, { desc = 'git hunk [Q]uickfix list (all files in repo)' })
|
||||
map('n', '<leader>hq', gitsigns.setqflist, { desc = 'git hunk [q]uickfix list (all changes in this file)' })
|
||||
-- Toggles
|
||||
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
||||
map('n', '<leader>tw', gitsigns.toggle_word_diff, { desc = '[T]oggle git intra-line [w]ord diff' })
|
||||
|
||||
-- Actions
|
||||
-- visual mode
|
||||
map('v', '<leader>hs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [s]tage hunk' })
|
||||
map('v', '<leader>hr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk' })
|
||||
-- normal mode
|
||||
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
||||
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
||||
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
|
||||
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
|
||||
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
||||
map('n', '<leader>hi', gitsigns.preview_hunk_inline, { desc = 'git preview hunk [i]nline' })
|
||||
map('n', '<leader>hb', function() gitsigns.blame_line { full = true } end, { desc = 'git [b]lame line' })
|
||||
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
||||
map('n', '<leader>hD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' })
|
||||
map('n', '<leader>hQ', function() gitsigns.setqflist 'all' end, { desc = 'git hunk [Q]uickfix list (all files in repo)' })
|
||||
map('n', '<leader>hq', gitsigns.setqflist, { desc = 'git hunk [q]uickfix list (all changes in this file)' })
|
||||
-- Toggles
|
||||
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
||||
map('n', '<leader>tw', gitsigns.toggle_word_diff, { desc = '[T]oggle git intra-line [w]ord diff' })
|
||||
|
||||
-- Text object
|
||||
map({ 'o', 'x' }, 'ih', gitsigns.select_hunk)
|
||||
end,
|
||||
},
|
||||
-- Text object
|
||||
map({ 'o', 'x' }, 'ih', gitsigns.select_hunk)
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
-- Add indentation guides even on blank lines
|
||||
|
||||
---@module 'lazy'
|
||||
---@type LazySpec
|
||||
return {
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||
-- See `:help ibl`
|
||||
main = 'ibl',
|
||||
---@module 'ibl'
|
||||
---@type ibl.config
|
||||
opts = {},
|
||||
}
|
||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||
-- See `:help ibl`
|
||||
vim.pack.add { 'https://github.com/lukas-reineke/indent-blankline.nvim' }
|
||||
require('ibl').setup {}
|
||||
|
||||
@@ -1,59 +1,53 @@
|
||||
-- Linting
|
||||
|
||||
---@module 'lazy'
|
||||
---@type LazySpec
|
||||
return {
|
||||
'mfussenegger/nvim-lint',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
config = function()
|
||||
local lint = require 'lint'
|
||||
lint.linters_by_ft = {
|
||||
markdown = { 'markdownlint' }, -- Make sure to install `markdownlint` via mason / npm
|
||||
}
|
||||
vim.pack.add { 'https://github.com/mfussenegger/nvim-lint' }
|
||||
|
||||
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
||||
-- instead set linters_by_ft like this:
|
||||
-- lint.linters_by_ft = lint.linters_by_ft or {}
|
||||
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
|
||||
--
|
||||
-- However, note that this will enable a set of default linters,
|
||||
-- which will cause errors unless these tools are available:
|
||||
-- {
|
||||
-- clojure = { "clj-kondo" },
|
||||
-- dockerfile = { "hadolint" },
|
||||
-- inko = { "inko" },
|
||||
-- janet = { "janet" },
|
||||
-- json = { "jsonlint" },
|
||||
-- markdown = { "vale" },
|
||||
-- rst = { "vale" },
|
||||
-- ruby = { "ruby" },
|
||||
-- terraform = { "tflint" },
|
||||
-- text = { "vale" }
|
||||
-- }
|
||||
--
|
||||
-- You can disable the default linters by setting their filetypes to nil:
|
||||
-- lint.linters_by_ft['clojure'] = nil
|
||||
-- lint.linters_by_ft['dockerfile'] = nil
|
||||
-- lint.linters_by_ft['inko'] = nil
|
||||
-- lint.linters_by_ft['janet'] = nil
|
||||
-- lint.linters_by_ft['json'] = nil
|
||||
-- lint.linters_by_ft['markdown'] = nil
|
||||
-- lint.linters_by_ft['rst'] = nil
|
||||
-- lint.linters_by_ft['ruby'] = nil
|
||||
-- lint.linters_by_ft['terraform'] = nil
|
||||
-- lint.linters_by_ft['text'] = nil
|
||||
|
||||
-- Create autocommand which carries out the actual linting
|
||||
-- on the specified events.
|
||||
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
||||
group = lint_augroup,
|
||||
callback = function()
|
||||
-- Only run the linter in buffers that you can modify in order to
|
||||
-- avoid superfluous noise, notably within the handy LSP pop-ups that
|
||||
-- describe the hovered symbol using Markdown.
|
||||
if vim.bo.modifiable then lint.try_lint() end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
local lint = require 'lint'
|
||||
lint.linters_by_ft = {
|
||||
markdown = { 'markdownlint' }, -- Make sure to install `markdownlint` via mason / npm
|
||||
}
|
||||
|
||||
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
||||
-- instead set linters_by_ft like this:
|
||||
-- lint.linters_by_ft = lint.linters_by_ft or {}
|
||||
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
|
||||
--
|
||||
-- However, note that this will enable a set of default linters,
|
||||
-- which will cause errors unless these tools are available:
|
||||
-- {
|
||||
-- clojure = { "clj-kondo" },
|
||||
-- dockerfile = { "hadolint" },
|
||||
-- inko = { "inko" },
|
||||
-- janet = { "janet" },
|
||||
-- json = { "jsonlint" },
|
||||
-- markdown = { "vale" },
|
||||
-- rst = { "vale" },
|
||||
-- ruby = { "ruby" },
|
||||
-- terraform = { "tflint" },
|
||||
-- text = { "vale" }
|
||||
-- }
|
||||
--
|
||||
-- You can disable the default linters by setting their filetypes to nil:
|
||||
-- lint.linters_by_ft['clojure'] = nil
|
||||
-- lint.linters_by_ft['dockerfile'] = nil
|
||||
-- lint.linters_by_ft['inko'] = nil
|
||||
-- lint.linters_by_ft['janet'] = nil
|
||||
-- lint.linters_by_ft['json'] = nil
|
||||
-- lint.linters_by_ft['markdown'] = nil
|
||||
-- lint.linters_by_ft['rst'] = nil
|
||||
-- lint.linters_by_ft['ruby'] = nil
|
||||
-- lint.linters_by_ft['terraform'] = nil
|
||||
-- lint.linters_by_ft['text'] = nil
|
||||
|
||||
-- Create autocommand which carries out the actual linting
|
||||
-- on the specified events.
|
||||
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
||||
group = lint_augroup,
|
||||
callback = function()
|
||||
-- Only run the linter in buffers that you can modify in order to
|
||||
-- avoid superfluous noise, notably within the handy LSP pop-ups that
|
||||
-- describe the hovered symbol using Markdown.
|
||||
if vim.bo.modifiable then lint.try_lint() end
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -1,28 +1,82 @@
|
||||
-- Neo-tree is a Neovim plugin to browse the file system
|
||||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||
-- ============================================================
|
||||
-- NEO-TREE
|
||||
-- File explorer
|
||||
-- ============================================================
|
||||
|
||||
---@module 'lazy'
|
||||
---@type LazySpec
|
||||
return {
|
||||
'nvim-neo-tree/neo-tree.nvim',
|
||||
version = '*',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
||||
'MunifTanjim/nui.nvim',
|
||||
local plugins = {
|
||||
{
|
||||
src = 'https://github.com/nvim-neo-tree/neo-tree.nvim',
|
||||
version = vim.version.range '*',
|
||||
},
|
||||
lazy = false,
|
||||
keys = {
|
||||
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
|
||||
|
||||
'https://github.com/nvim-lua/plenary.nvim',
|
||||
'https://github.com/MunifTanjim/nui.nvim',
|
||||
}
|
||||
|
||||
if vim.g.have_nerd_font then table.insert(plugins, 'https://github.com/nvim-tree/nvim-web-devicons') end
|
||||
|
||||
vim.pack.add(plugins)
|
||||
|
||||
-- ============================================================
|
||||
-- KEYMAPS
|
||||
-- ============================================================
|
||||
|
||||
vim.keymap.set('n', '<leader>e', '<Cmd>Neotree toggle<CR>', {
|
||||
desc = 'Toggle NeoTree',
|
||||
silent = true,
|
||||
})
|
||||
|
||||
-- ============================================================
|
||||
-- SETUP
|
||||
-- ============================================================
|
||||
|
||||
require('neo-tree').setup {
|
||||
close_if_last_window = true,
|
||||
|
||||
popup_border_style = 'rounded',
|
||||
|
||||
enable_git_status = true,
|
||||
enable_diagnostics = true,
|
||||
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
visible = false,
|
||||
hide_dotfiles = false,
|
||||
hide_gitignored = false,
|
||||
},
|
||||
|
||||
follow_current_file = {
|
||||
enabled = true,
|
||||
},
|
||||
|
||||
use_libuv_file_watcher = true,
|
||||
|
||||
window = {
|
||||
width = 32,
|
||||
|
||||
mappings = {
|
||||
['<leader>e'] = 'close_window',
|
||||
},
|
||||
},
|
||||
},
|
||||
---@module 'neo-tree'
|
||||
---@type neotree.Config
|
||||
opts = {
|
||||
filesystem = {
|
||||
window = {
|
||||
mappings = {
|
||||
['\\'] = 'close_window',
|
||||
},
|
||||
|
||||
default_component_configs = {
|
||||
indent = {
|
||||
with_markers = true,
|
||||
indent_size = 2,
|
||||
},
|
||||
|
||||
git_status = {
|
||||
symbols = {
|
||||
added = '✚',
|
||||
modified = '',
|
||||
deleted = '✖',
|
||||
renamed = '',
|
||||
untracked = '',
|
||||
ignored = '',
|
||||
unstaged = '',
|
||||
staged = '',
|
||||
conflict = '',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user