init
This commit is contained in:
0
nvim/README.md
Normal file
0
nvim/README.md
Normal file
4
nvim/after/plugin/dap-view.lua
Normal file
4
nvim/after/plugin/dap-view.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
local dap_view = require("dap-view")
|
||||
dap_view.setup({})
|
||||
|
||||
vim.keymap.set("n", "<leader>mv", function() require 'dap-view'.toggle() end);
|
||||
77
nvim/after/plugin/dap.lua
Normal file
77
nvim/after/plugin/dap.lua
Normal file
@@ -0,0 +1,77 @@
|
||||
local dap = require('dap')
|
||||
dap.adapters.lldb = {
|
||||
type = 'executable',
|
||||
command = '/usr/bin/lldb-dap',
|
||||
}
|
||||
|
||||
dap.configurations.c = {
|
||||
{
|
||||
type = 'lldb',
|
||||
request = 'launch',
|
||||
name = "Launch file",
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "Attach to process",
|
||||
type = "lldb",
|
||||
request = "attach",
|
||||
|
||||
--original fallback
|
||||
-- pid = require('dap.utils').pick_process,
|
||||
|
||||
pid = function()
|
||||
return tonumber(vim.fn.input('PID: '))
|
||||
end,
|
||||
|
||||
|
||||
-- fix this
|
||||
-- pid = (function()
|
||||
-- local str = vim.fn.input('Use PID or see process list (l): ')
|
||||
-- if str == "l" or str == "" then
|
||||
-- return require('dap.utils').pick_process
|
||||
-- else
|
||||
-- return function()
|
||||
-- return tonumber(vim.fn.input('PID: '))
|
||||
-- end
|
||||
-- end
|
||||
-- end)()
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
type = 'lldb',
|
||||
request = 'launch',
|
||||
name = "Launch file",
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.rust = {
|
||||
{
|
||||
name = "Debug Cargo (manual command)",
|
||||
type = "lldb",
|
||||
request = "launch",
|
||||
|
||||
program = "cargo",
|
||||
|
||||
args = function()
|
||||
local input = vim.fn.input("cargo ", "")
|
||||
return vim.split(input, " ", { trimempty = true })
|
||||
end,
|
||||
|
||||
cwd = "${workspaceFolder}",
|
||||
runInTerminal = true,
|
||||
stopOnEntry = false,
|
||||
},
|
||||
}
|
||||
|
||||
vim.keymap.set('n', '<F5>', function() require('dap').continue() end)
|
||||
vim.keymap.set('n', '<F10>', function() require('dap').step_over() end)
|
||||
vim.keymap.set('n', '<F11>', function() require('dap').step_into() end)
|
||||
vim.keymap.set('n', '<F12>', function() require('dap').step_out() end)
|
||||
vim.keymap.set('n', '<Leader>b', function() require('dap').toggle_breakpoint() end)
|
||||
11
nvim/after/plugin/harpoon.lua
Normal file
11
nvim/after/plugin/harpoon.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
local mark = require("harpoon.mark")
|
||||
local ui = require("harpoon.ui")
|
||||
|
||||
vim.keymap.set("n", "<leader>a", mark.add_file)
|
||||
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
|
||||
|
||||
vim.keymap.set("n", "<C-h>", function() ui.nav_file(1) end)
|
||||
vim.keymap.set("n", "<C-t>", function() ui.nav_file(2) end)
|
||||
vim.keymap.set("n", "<C-n>", function() ui.nav_file(3) end)
|
||||
vim.keymap.set("n", "<C-s>", function() ui.nav_file(4) end)
|
||||
vim.keymap.set("n", "<C-z>", function() ui.nav_file(5) end)
|
||||
81
nvim/after/plugin/lsp.lua
Normal file
81
nvim/after/plugin/lsp.lua
Normal file
@@ -0,0 +1,81 @@
|
||||
vim.opt.signcolumn = 'yes'
|
||||
|
||||
-- Add cmp_nvim_lsp capabilities settings
|
||||
vim.lsp.config('*', {
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||
automatic_enable = true,
|
||||
})
|
||||
|
||||
-- This is where you enable features that only work
|
||||
-- if there is a language server active in the file
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
desc = 'LSP actions',
|
||||
callback = function(event)
|
||||
local opts = { buffer = event.buf }
|
||||
|
||||
vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)
|
||||
vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)
|
||||
vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts)
|
||||
vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts)
|
||||
vim.keymap.set('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts)
|
||||
vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts)
|
||||
vim.keymap.set('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)
|
||||
vim.keymap.set('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)
|
||||
vim.keymap.set({ 'n', 'x' }, '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', opts)
|
||||
vim.keymap.set('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts)
|
||||
vim.keymap.set('n', '<leader>d', '<cmd>lua vim.diagnostic.open_float()<cr>', opts)
|
||||
end,
|
||||
})
|
||||
|
||||
local cmp = require('cmp')
|
||||
|
||||
cmp.setup({
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' }, -- Ensure snippets work
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body) -- Use luasnip instead of vim.snippet
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
}),
|
||||
})
|
||||
|
||||
vim.lsp.config("clangd", {
|
||||
-- ain't working
|
||||
-- cmd = {"clangd", "-xc-header"}
|
||||
})
|
||||
|
||||
vim.lsp.config("rust_analyzer", {
|
||||
enabled = false,
|
||||
})
|
||||
|
||||
local mason_lspconfig = require('mason-lspconfig')
|
||||
|
||||
mason_lspconfig.setup {
|
||||
PATH = "append",
|
||||
}
|
||||
|
||||
vim.g.rustaceanvim = {
|
||||
server = {
|
||||
on_attach = function(client, bufnr)
|
||||
print("Loaded rustaceanvim")
|
||||
end,
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
enableExperimental = true,
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
vim.keymap.set('n', '<Leader>tt', '<cmd>lua vim.cmd("RustLsp testables")<cr>', {})
|
||||
26
nvim/after/plugin/nvimtree.lua
Normal file
26
nvim/after/plugin/nvimtree.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
local api = require("nvim-tree.api")
|
||||
|
||||
vim.keymap.set('n', '<leader>pv', ':NvimTreeToggle<CR>', { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "=", api.tree.change_root_to_node, {noremap = true, silent = true, nowait = true})
|
||||
|
||||
|
||||
require("nvim-tree").setup({
|
||||
view = {
|
||||
width = 50,
|
||||
side = "right",
|
||||
},
|
||||
renderer = {
|
||||
icons = {
|
||||
show = {
|
||||
file = false,
|
||||
folder = false,
|
||||
folder_arrow = false,
|
||||
git = false,
|
||||
modified = false,
|
||||
diagnostics = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
5
nvim/after/plugin/telescope.lua
Normal file
5
nvim/after/plugin/telescope.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>pf', builtin.find_files, {}) -- search files
|
||||
vim.keymap.set('n', '<leader>pw', function() -- search word in files
|
||||
builtin.grep_string({ search = vim.fn.input("Grep > ") })
|
||||
end)
|
||||
12
nvim/after/plugin/treesitter.lua
Normal file
12
nvim/after/plugin/treesitter.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
local ts = require('nvim-treesitter')
|
||||
|
||||
ts.setup {
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
||||
|
||||
ts.install { "c", "cpp", "lua", "rust", "python" }
|
||||
72
nvim/init.lua
Normal file
72
nvim/init.lua
Normal file
@@ -0,0 +1,72 @@
|
||||
vim.o.guicursor = "n-v-c-sm:block,i:ver25,r-cr-o:hor20"
|
||||
local function transparent_bg()
|
||||
vim.cmd([[
|
||||
highlight Normal guibg=NONE ctermbg=NONE
|
||||
highlight NormalNC guibg=NONE ctermbg=NONE
|
||||
highlight EndOfBuffer guibg=NONE ctermbg=NONE
|
||||
highlight LineNr guibg=NONE ctermbg=NONE
|
||||
highlight CursorLineNr guibg=NONE ctermbg=NONE
|
||||
]])
|
||||
end
|
||||
|
||||
-- One of the favorites
|
||||
-- vim.cmd.colorscheme('vague')
|
||||
vim.cmd.colorscheme('gruber-darker')
|
||||
vim.o.background = 'dark'
|
||||
transparent_bg()
|
||||
|
||||
vim.api.nvim_create_user_command('Dark', function()
|
||||
vim.o.background = 'dark'
|
||||
vim.cmd.colorscheme('gruber-darker')
|
||||
transparent_bg()
|
||||
end, {})
|
||||
|
||||
vim.api.nvim_create_user_command('Light', function()
|
||||
vim.o.background = 'light'
|
||||
vim.cmd.colorscheme('solarized')
|
||||
end, {})
|
||||
|
||||
-- Binds
|
||||
vim.g.mapleader = " "
|
||||
-- vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
|
||||
vim.keymap.set("n", "<A-j>", ":m .+1<CR>==", { noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<A-k>", ":m .-2<CR>==", { noremap = true, silent = true })
|
||||
vim.keymap.set("v", "<A-j>", ":m '>+1<CR>gv=gv", { noremap = true, silent = true })
|
||||
vim.keymap.set("v", "<A-k>", ":m '<-2<CR>gv=gv", { noremap = true, silent = true })
|
||||
|
||||
vim.keymap.set('i', '<C-S-v>', '<C-r>+', { noremap = true, silent = true })
|
||||
vim.keymap.set('x', '<C-y>', '"+y', { noremap = true, silent = true })
|
||||
vim.keymap.set('x', '<C-p>', '"+p', { noremap = true, silent = true })
|
||||
|
||||
vim.keymap.set("n", "<Leader>tt", ":split | resize 10 | terminal")
|
||||
vim.keymap.set("n", "q:", "<nop>", { noremap = true, silent = true })
|
||||
|
||||
-- Options
|
||||
vim.o.nu = true
|
||||
vim.o.relativenumber = true
|
||||
|
||||
vim.o.tabstop = 4
|
||||
vim.o.softtabstop = 4
|
||||
vim.o.shiftwidth = 4
|
||||
vim.o.expandtab = true
|
||||
|
||||
vim.o.si = true
|
||||
vim.o.wrap = false
|
||||
|
||||
vim.o.undofile = true
|
||||
|
||||
vim.o.hlsearch = false
|
||||
|
||||
vim.o.termguicolors = true
|
||||
|
||||
vim.o.scrolloff = 8
|
||||
vim.o.signcolumn = "yes"
|
||||
vim.opt.isfname:append("@-@")
|
||||
|
||||
vim.o.updatetime = 50
|
||||
|
||||
vim.opt.colorcolumn = "80"
|
||||
97
nvim/packer.lua
Normal file
97
nvim/packer.lua
Normal file
@@ -0,0 +1,97 @@
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
|
||||
return require('packer').startup(function(use)
|
||||
-- Packer can manage itself
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
-- Themes
|
||||
use 'sainnhe/gruvbox-material'
|
||||
use 'shaunsingh/nord.nvim'
|
||||
use 'dgox16/oldworld.nvim'
|
||||
use 'Mofiqul/vscode.nvim'
|
||||
use 'bluz71/vim-moonfly-colors'
|
||||
use 'kdheepak/monochrome.nvim'
|
||||
use 'catppuccin/nvim'
|
||||
use 'nyoom-engineering/oxocarbon.nvim'
|
||||
use 'vague2k/vague.nvim'
|
||||
use "blazkowolf/gruber-darker.nvim"
|
||||
use 'ericbn/vim-solarized'
|
||||
|
||||
-- TS, LSP
|
||||
use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' })
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim', branch = '0.1.x',
|
||||
requires = { { 'nvim-lua/plenary.nvim' } }
|
||||
}
|
||||
|
||||
use({ 'hrsh7th/nvim-cmp' })
|
||||
use({ 'neovim/nvim-lspconfig' })
|
||||
use({ 'hrsh7th/cmp-nvim-lsp' })
|
||||
|
||||
use "williamboman/mason-lspconfig.nvim"
|
||||
|
||||
use 'mfussenegger/nvim-dap'
|
||||
use {
|
||||
"igorlfs/nvim-dap-view",
|
||||
config = function()
|
||||
local dap_view = require("dap-view").setup({})
|
||||
end,
|
||||
}
|
||||
|
||||
use({
|
||||
'mrcjkb/rustaceanvim',
|
||||
version = "^6",
|
||||
lazy = false,
|
||||
["rust-analyzer"] = {
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
use {
|
||||
'norcalli/nvim-colorizer.lua',
|
||||
config = function()
|
||||
require 'colorizer'.setup()
|
||||
end
|
||||
}
|
||||
|
||||
-- use {
|
||||
-- 'nvim-flutter/flutter-tools.nvim',
|
||||
-- requires = {
|
||||
-- 'nvim-lua/plenary.nvim',
|
||||
-- 'stevearc/dressing.nvim', -- optional for vim.ui.select
|
||||
-- },
|
||||
-- }
|
||||
|
||||
|
||||
-- etc
|
||||
use {
|
||||
'williamboman/mason.nvim',
|
||||
config = function()
|
||||
require('mason').setup {
|
||||
registries = {
|
||||
"github:mason-org/mason-registry",
|
||||
"github:Crashdummyy/mason-registry",
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
use 'ThePrimeagen/harpoon'
|
||||
use {
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup {}
|
||||
end
|
||||
}
|
||||
use {
|
||||
'L3MON4D3/LuaSnip',
|
||||
requires = { 'rafamadriz/friendly-snippets' }
|
||||
}
|
||||
use 'andweeb/presence.nvim'
|
||||
use 'tikhomirov/vim-glsl'
|
||||
use 'nvim-tree/nvim-tree.lua'
|
||||
use 'lambdalisue/vim-suda' -- SudaWrite
|
||||
end)
|
||||
Reference in New Issue
Block a user