1
0
Fork 0

nvim: finally move all the plugin setup to "grouped" files

This commit is contained in:
Pratham Patel 2023-06-04 19:14:40 +05:30
parent c605a72036
commit 6f57f97a84
10 changed files with 581 additions and 599 deletions

View File

@ -13,11 +13,7 @@ vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- initialize the package manager
require('plugins/init')
-- setup the plugins
require('plug-setup')
-- load the options, autocmds, key bindings and statusline
require('vim-options')
require('autocmds')
require('key-mappings')

View File

@ -1,595 +0,0 @@
--------------------------------------------------------------------------------
-- nvim-tree
--------------------------------------------------------------------------------
require('nvim-tree').setup({
auto_reload_on_write = true,
disable_netrw = false,
hijack_netrw = true,
sort_by = 'case_sensitive',
view = {
width = 30,
number = true,
relativenumber = true,
},
renderer = {
group_empty = false,
highlight_git = true,
icons = {
symlink_arrow = '',
glyphs = {
modified = '',
git = {
unstaged = '',
staged = '',
unmerged = '',
renamed = '',
untracked = '[ ]',
deleted = '',
ignored = '',
},
},
},
special_files = { 'Cargo.toml', 'README.md', 'Readme.md', 'readme.md' },
symlink_destination = true,
},
filters = {
dotfiles = true,
},
})
--------------------------------------------------------------------------------
-- nvim-cmp
--------------------------------------------------------------------------------
--[[
local cmp = require'cmp'
cmp.setup({
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn['vsnip#anonymous'](args.body) -- for `vsnip` users
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
-- accept currently selected item
-- set `select` to `false` to only confirm explicitly selected items
['<Tab>'] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
}, {
{ name = 'buffer' },
})
})
local capabilities = require('cmp_nvim_lsp').default_capabilities()
require('lspconfig')['rust_analyzer'].setup {
cmd = {'rust-analyzer'},
filetypes = {'rust'},
capabilities = capabilities,
}
--]]
--------------------------------------------------------------------------------
-- rust-tools.nvim
--------------------------------------------------------------------------------
local opts = {
tools = { -- rust-tools options
-- how to execute terminal commands
-- options right now: termopen / quickfix
executor = require('rust-tools/executors').termopen,
-- callback to execute once rust-analyzer is done initializing the workspace
-- the callback receives one parameter indicating the `health` of the server: 'ok' | 'warning' | 'error'
on_initialized = nil,
-- automatically call RustReloadWorkspace when writing to a Cargo.toml file
reload_workspace_from_cargo_toml = true,
-- these apply to the default RustSetInlayHints command
inlay_hints = {
-- automatically set inlay hints (type hints)
-- default: true
auto = true,
-- only show inlay hints for the current line
only_current_line = false,
-- whether to show parameter hints with the inlay hints or not
-- default: true
show_parameter_hints = true,
-- prefix for parameter hints
-- default: '<-'
parameter_hints_prefix = '<- ',
-- prefix for all the other hints (type, chaining)
-- default: '=>'
other_hints_prefix = '=> ',
-- whether to align to the length of the longest line in the file
max_len_align = false,
-- padding from the left if max_len_align is true
max_len_align_padding = 1,
-- whether to align to the extreme right or not
right_align = false,
-- padding from the right if right_align is true
right_align_padding = 7,
-- the color of the hints
highlight = 'Comment',
},
-- options same as lsp hover / vim.lsp.util.open_floating_preview()
hover_actions = {
-- the border that is used for the hover window
-- see vim.api.nvim_open_win()
border = {
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
},
-- whether the hover action window gets automatically focused
-- default: false
auto_focus = true,
},
-- settings for showing the crate graph based on graphviz and the dot
-- command
crate_graph = {
-- backend used for displaying the graph
-- see: https://graphviz.org/docs/outputs/
-- default: x11
backend = 'x11',
-- where to store the output, nil for no output stored (relative
-- path from pwd)
-- default: nil
output = nil,
-- true for all crates.io and external crates, false only the local
-- crates
-- default: true
full = true,
-- list of backends found on: https://graphviz.org/docs/outputs/
-- is used for input validation and autocompletion
-- last updated: 2021-08-26
enabled_graphviz_backends = {
'bmp',
'cgimage',
'canon',
'dot',
'gv',
'xdot',
'xdot1.2',
'xdot1.4',
'eps',
'exr',
'fig',
'gd',
'gd2',
'gif',
'gtk',
'ico',
'cmap',
'ismap',
'imap',
'cmapx',
'imap_np',
'cmapx_np',
'jpg',
'jpeg',
'jpe',
'jp2',
'json',
'json0',
'dot_json',
'xdot_json',
'pdf',
'pic',
'pct',
'pict',
'plain',
'plain-ext',
'png',
'pov',
'ps',
'ps2',
'psd',
'sgi',
'svg',
'svgz',
'tga',
'tiff',
'tif',
'tk',
'vml',
'vmlz',
'wbmp',
'webp',
'xlib',
'x11',
},
},
},
-- all the opts to send to nvim-lspconfig
-- these override the defaults set by rust-tools.nvim
-- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer
server = {
-- standalone file support
-- setting it to false may improve startup time
standalone = true,
}, -- rust-analyzer options
-- debugging stuff
dap = {
adapter = {
type = 'executable',
command = 'lldb-vscode',
name = 'rt_lldb',
},
},
}
require('rust-tools').setup(opts)
-- set inlay hints for the current buffer
require('rust-tools').inlay_hints.set()
-- enable inlay hints auto update and set them for all the buffers
require('rust-tools').inlay_hints.enable()
-- RustRunnables
require('rust-tools').runnables.runnables()
-- RustExpandMacro
require'rust-tools'.expand_macro.expand_macro()
--------------------------------------------------------------------------------
-- telescope
--------------------------------------------------------------------------------
require('telescope').setup {
defaults = {
mappings = {
i = {
['<C-u>'] = false,
['<C-d>'] = false,
},
},
},
}
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>/', function()
-- you can pass additional configuration to telescope to change theme, layout, etc
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
})
end, { desc = '[/] Fuzzily search in current buffer' })
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
--------------------------------------------------------------------------------
-- treesitter
--------------------------------------------------------------------------------
require('nvim-treesitter.configs').setup {
-- add languages to be installed here that you want installed for treesitter
-- https://github.com/nvim-treesitter/nvim-treesitter#supported-languages
ensure_installed = { 'bash', 'c', 'cmake', 'comment', 'cpp', 'devicetree', 'diff', 'git_rebase', 'gitignore', 'go', 'html', 'make', 'markdown', 'nix', 'python', 'regex', 'rust', 'toml', 'tsx', 'typescript', 'vim', 'yaml' },
--
-- autoinstall languages that are not installed
-- defaults to false (but you can change for yourself!)
auto_install = false,
highlight = { enable = true },
indent = { enable = true, disable = { 'python' } },
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<M-space>',
},
},
textobjects = {
select = {
enable = true,
lookahead = true, -- automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- you can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
},
}
-- diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
-- LSP settings
-- this function gets run when an LSP connects to a particular buffer
local on_attach = function(_, bufnr)
-- NOTE: remember that lua is a real programming language, and as such it is possible
-- to define small helper and utility functions so you don't have to repeat yourself
-- many times
--
-- in this case, we create a function that lets us more easily define
-- mappings specific for LSP related items
-- it sets the mode, buffer and description for us each time
local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
end
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-- see `:help K` for why this keymap
nmap(')', vim.lsp.buf.hover, 'Hover Documentation')
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
-- lesser used LSP functionality
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
nmap('<leader>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, '[W]orkspace [L]ist Folders')
-- create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
vim.lsp.buf.format()
end, { desc = 'Format current buffer with LSP' })
end
-- enable the following language servers
-- feel free to add/remove any LSPs that you want here they will automatically be installed
--
-- add any additional override configuration in the following tables
-- they will be passed to the `settings` field of the server config
-- you must look up that documentation yourself
local servers = {
-- clangd = {},
-- gopls = {},
-- pyright = {},
-- rust_analyzer = {},
-- tsserver = {},
}
-- setup neovim lua configuration
require('neodev').setup()
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
-- setup mason so it can manage external tooling
require('mason').setup()
-- ensure the servers above are installed
local mason_lspconfig = require 'mason-lspconfig'
mason_lspconfig.setup {
ensure_installed = vim.tbl_keys(servers),
}
mason_lspconfig.setup_handlers {
function(server_name)
require('lspconfig')[server_name].setup {
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
}
end,
}
--------------------------------------------------------------------------------
-- nvim-cmp
--------------------------------------------------------------------------------
local cmp = require 'cmp'
local luasnip = require 'luasnip'
luasnip.config.setup {}
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert {
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete {},
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
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 = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
}
--------------------------------------------------------------------------------
-- catppuccin.nvim
--------------------------------------------------------------------------------
require("catppuccin").setup {
flavour = "mocha", -- latte, frappe, macciato, mocha
background = {
light = "latte",
dark = "mocha",
},
transparent_background = false,
show_end_of_buffer = false,
term_colors = false,
dim_inactive = {
enabled = false,
shade = "dark",
percentage = 0.15,
},
no_italic = false, -- force no_italic
no_bold = false,
styles = {
comments = { "italic" },
conditionals = { "italic" },
loops = {},
functions = {},
keywords = {},
strings = {},
variables = { "bold" },
numbers = {},
booleans = { "italic" },
properties = {},
types = {},
operators = { "bold" },
},
color_overrides = {
mocha = {
base = "#000000",
mantle = "#000000",
crust = "#000000",
},
},
highlight_overrides = {
mocha = function(C)
return {
TabLineSel = { bg = C.pink },
CmpBorder = {fg = C.surface },
Pmenu = { bg = C.none },
TelescopeBorder = { link = "FloatBorder" },
}
end,
},
custom_highlights = {},
integrations = {
cmp = true,
gitsigns = true,
nvimtree = false,
telescope = true,
--markdown = true,
mason = true,
},
}
--------------------------------------------------------------------------------
-- indent-blankline.nvim
--------------------------------------------------------------------------------
require('indent_blankline').setup {
show_current_context = true,
show_current_context_start = true,
space_char_blankline = ' ',
char_highlight_list = {
'IndentBlanklineIndent1',
'IndentBlanklineIndent2',
'IndentBlanklineIndent3',
'IndentBlanklineIndent4',
'IndentBlanklineIndent5',
'IndentBlanklineIndent6',
},
}

View File

@ -0,0 +1,286 @@
--------------------------------------------------------------------------------
-- the "spinny-snake" thingy at the bottom-right corner
-- https://github.com/j-hui/fidget.nvim
--------------------------------------------------------------------------------
require('fidget').setup({})
--------------------------------------------------------------------------------
-- tools for better development in Rust using Neovim's built-in LSP
-- https://github.com/simrat39/rust-tools.nvim
--------------------------------------------------------------------------------
require('rust-tools').setup({
tools = {
executor = require('rust-tools.executors').termopen, -- termopen, quickfix
on_initialized = nil,
reload_workspace_from_cargo_toml = true,
inlay_hints = {
auto = true,
only_current_line = false,
show_parameter_hits = true,
parameter_hits_prefix = '<- ',
other_hints_prefix = '=> ',
max_len_align = false, -- whether to align to the length of the longest line in the file
max_len_align_padding = 1, -- padding from the left if mex_len_align is true
right_align = false, -- whether to align to the extreme right or not
right_align_padding = 7, -- padding from the right if right_align is true
highlight = 'comment', -- the color of the hints
},
hover_actions = {
-- the border that is used for the hover window
-- see vim.api.nvim_open_win()
border = {
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
{ '', 'FloatBorder' },
},
max_width = nil, -- nil means no max
max_height = nil,
auto_focus = false, -- whether the hover action window gets automatically focused
},
server = {
standalone = true,
},
dap = {
adapter = {
type = 'executable',
-- command = 'lldb',
command = 'lldb-vscode',
name = 'rt_lldb'
},
},
},
})
require('rust-tools').inlay_hints.set()
require('rust-tools').inlay_hints.enable()
require('rust-tools').runnables.runnables()
require('rust-tools').expand_macro.expand_macro()
--------------------------------------------------------------------------------
-- a powerful fuzzy finder
-- https://github.com/nvim-telescope/telescope.nvim
--------------------------------------------------------------------------------
require('telescope').setup({
defaults = {
mappings = {
i = {
['C-u'] = false,
['C-d'] = false,
}
}
},
})
require('nvim-mapper').setup({
no_map = true, -- assign the default keymap '<leader>MM'
search_path = os.getenv("HOME") .. '/.config/nvim/lua',
action_on_enter = 'definition', -- definition, execute
})
require('telescope').load_extension('mapper')
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = 'Telescope: [?] find recently opened files' })
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = 'Telescope: [ ] ind existing buffers' })
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = 'Telescope: [s]earch [f]iles' })
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = 'Telescope: [s]earch [h]elp' })
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = 'Telescope: [s]earch current [w]ord' })
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = 'Telescope: [s]earch by [g]rep' })
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = 'Telescope: [s]earch [d]iagnostics' })
vim.keymap.set('n', '<leader>/', function()
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown({
windblend = 10,
previewer = false,
}))
end, { desc = 'Telescope: [/] Fuzzily search in the current buffer' })
--------------------------------------------------------------------------------
-- incremental parsing system for programming tools
-- https://github.com/nvim-treesitter/nvim-treesitter
--------------------------------------------------------------------------------
require('nvim-treesitter.configs').setup({
ensure_installed = {
'bash',
'c',
'cpp',
'lua',
'make',
'markdown',
'markdown_inline',
'nix',
'python',
'regex',
'rust',
'toml',
'vim',
'yaml',
},
auto_install = false,
highlight = {
enable = true,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<C-Space>',
node_incremental = '<C-Space>',
scope_incremental = '<C-s>',
node_decremental = '<M-space>',
},
},
textobjects = {
select = {
enable = true,
lookahead = true, -- automatically jump forward to the textobj
keymaps = {
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
},
})
-- diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go-to the previous diagnostic message' })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go-to the next diagnostic message' })
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
--------------------------------------------------------------------------------
-- LSP
--------------------------------------------------------------------------------
-- for Neovim's internal Lua "autocomplete"
require('neodev').setup({})
local lspconfig = require('lspconfig')
--[[
lspconfig.lua_ls.setup({
settings = {
Lua = {
runtime = {
version = 'LuaJIT',
},
diagnostics = {
globals = {'vim'},
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
},
telemetry = {
enable = false,
},
},
},
})
--]]
lspconfig.pylsp.setup({
settings = {
pylsp = {
plugins = {
pycodestyle = {
ignore = { 'W391' },
maxLineLength = 100,
},
},
},
},
})
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabalities)
--------------------------------------------------------------------------------
-- the actual completion plugin
-- https://github.com/hrsh7th/nvim-cmp
--------------------------------------------------------------------------------
local luasnip = require('luasnip')
luasnip.config.setup({})
local cmp = require('cmp')
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert {
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-Space>'] = cmp.mapping.complete({}),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.expand_or_jumpable(-1) then
luasnip.expand_or_jump(-1)
else
fallback()
end
end, { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
})

View File

@ -0,0 +1,33 @@
local dap = require('dap')
dap.adapters.lldb = {
type = 'executable',
command = '/usr/bin/lldb-vscode', -- yes, this binary is provided by 'lldb'
name = 'lldb',
}
dap.configurations.rust = {
name = 'Launch lldb',
type = 'lldb',
request = 'launch',
program = function()
return vm.fn.input(
'Path to executable: ',
vim.fn.getcwd() .. '/',
'file'
)
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
args = {},
runInTerminal = false,
}
vim.keymap.set('n', '<leader>c', dap.continue, { desc = 'DAP: [c]ontinue' })
vim.keymap.set('n', '<leader>so', dap.step_over, { desc = 'DAP: [s]tep [o]ver' })
vim.keymap.set('n', '<leader>si', dap.step_into, { desc = 'DAP: [s]tep [i]nto' })
vim.keymap.set('n', '<leader>sO', dap.step_out, { desc = 'DAP: [s]tep [O]ut' })
vim.keymap.set('n', '<leader>tb', dap.toggle_breakpoint, { desc = 'DAP: [t]oogle [b]reakpoint' })
vim.keymap.set('n', '<leader>sb', dap.set_breakpoint, { desc = 'DAP: [s]et [b]reakpoint' })
vim.keymap.set('n', '<leader>ro', dap.repl.open, { desc = 'DAP: [r]epl [o]pen' })
vim.keymap.set('n', '<leader>rl', dap.run_last, { desc = 'DAP: [r]un [l]ast' })

View File

@ -0,0 +1,12 @@
require('gitsigns').setup({
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
untracked = { text = '' },
},
signcolumn = true, -- show the sings (set above) in the "gutter" (before the numbers in the numberline)
numhl = true, -- highlight the numbers for lines that are modified
})

View File

@ -0,0 +1,47 @@
require('lualine').setup({
options = {
icons_enabled = true,
theme = 'nightfly',
globalstatus = true,
component_separators = {
left = '',
right = ''
},
section_separators = {
left = '',
right = ''
},
always_divide_middle = false,
refres = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
},
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff' },
lualine_c = {
{
'filename',
file_status = true,
icon_only = true,
symbols = {
modified = '[+]',
readonly = '[RO]',
unnamed = '[NO NAME]',
newfile = '[NEW FILE]',
},
}, {
'diagnostics',
sources = { 'nvim_lsp' },
sections = { 'error', 'warn', 'info', 'hint' },
colored = true,
always_visible = true,
}
},
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'searchcount', 'progress' },
lualine_z = { 'location' },
}
})

View File

@ -0,0 +1,42 @@
vim.opt.termguicolors = true -- needs to be pre-loaded for 'rcarriga/nvim-notify'
require('notify').setup({
background_color = '#000000',
render = 'compact',
stages = 'static',
timeout = -1,
icons = {
DEBUG = '',
ERROR = '',
INFO = '',
TRACE = '',
WARN = '',
},
})
local noice = require('noice')
noice.setup({
lsp = {
override = {
-- override the default lsp markdown formatter with noice
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
-- override the lsp markdown formatter with noice
['vim.lsp.util.stylize_markdown'] = true,
-- override cmp documentation with noice
['cmp.entry.get_documentation'] = true,
},
},
presets = {
bottom_search = false, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and pop-up menu together
long_message_to_split = true, -- long messages be sent to a split
inc_rename = true, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = true, -- add a border to hover docs and signature help
},
popupmenu = {
enabled = true,
backend = 'nui'
},
})
vim.keymap.set('n', '<C-c>', function() noice.cmd('dismiss') end, { desc = 'Noice: Dismiss notifications' })

View File

@ -0,0 +1,73 @@
require('Comment').setup({
padding = true, -- add a space between the comment and the line
sticky = true, -- weather the cursor should stay at its position
ignore = nil, -- lines to be ignored while (un)commenting
toggler = {
line = 'gcc', -- line comment toggle keymap
block = 'gbc', -- block comment toggle keymap
},
opleader = {
-- LHS of operator-padding mappings in NORMAL and VISUAL modes
line = 'gc',
block = 'gb',
},
extra = {
-- LHS of the extra mapping
above = 'gcO',
below = 'gco',
eol = 'gcA',
},
mappings = {
-- enable keymappings
basic = true,
extra = true,
},
pre_hook = nil, -- function to call before (un)comment
post_hook = nil, -- function to call after (un)comment
})
require('indent_blankline').setup({
show_current_context = true,
show_current_context_start = true,
space_char_blankline = ' ',
char_highlight_list = {
'IndentBlanklineIndent1',
'IndentBlanklineIndent2',
'IndentBlanklineIndent3',
'IndentBlanklineIndent4',
'IndentBlanklineIndent5',
'IndentBlanklineIndent6',
},
})
require('autoclose').setup({
keys = {
["*"] = {
escape = true,
close = true,
pair = "**",
},
["^"] = {
escape = true,
close = true,
pair = "^^",
},
["~"] = {
escape = true,
close = true,
pair = "~~",
},
--[[ remove escape for '<>'
["<"] = {
escape = false,
close = false,
pair = "<>",
},
[">"] = {
escape = false,
close = false,
pair = "<>",
},
-- ]]
},
})

View File

@ -0,0 +1,52 @@
require('catppuccin').setup({
flavour = 'mocha', -- latte, frappe, macciato, mocha
background = {
light = 'latte',
dark = 'mocha',
},
transparent_background = false,
show_end_of_buffer = false,
term_colors = false,
dim_inactive = {
enabled = false,
shade = 'dark',
percentage = 0.15,
},
no_italic = false, -- force no_italic
no_bold = false,
styles = {
-- `:h highlight-args`
comments = { 'italic' },
conditionals = { 'italic' },
loops = {},
functions = {},
keywords = {},
strings = {},
variables = { 'bold' },
numbers = {},
booleans = { 'italic', 'bold' },
properties = {},
types = {},
operators = { 'bold' },
},
color_overrides = {},
highlight_overrides = {
mocha = function(C)
return {
TabLineSel = { bg = C.pink },
CmpBorder = {fg = C.surface },
Pmenu = { bg = C.none },
TelescopeBorder = { link = 'FloatBorder' },
}
end,
},
custom_highlights = {},
integrations = {
cmp = true,
gitsigns = true,
nvimtree = false,
telescope = true,
--markdown = true,
mason = true,
},
})

View File

@ -0,0 +1,36 @@
require('nvim-tree').setup({
auto_reload_on_write = true,
disable_netrw = false,
hijack_netrw = true,
sort_by = 'case_sensitive',
view = {
width = 30,
number = true,
relativenumber = true,
},
renderer = {
group_empty = false,
highlight_git = true,
icons = {
symlink_arrow = '',
glyphs = {
modified = '',
git = {
unstaged = '',
staged = '',
unmerged = '',
renamed = '',
untracked = '[ ]',
deleted = '',
ignored = '',
},
},
},
special_files = { 'Cargo.toml', 'README.md' },
symlink_destination = true,
},
filters = {
dotfiles = true,
},
})