mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
add(nvim): nvim config rewrite (wip)
This commit is contained in:
parent
649ad5de0f
commit
f5a5fc368e
6 changed files with 163 additions and 513 deletions
43
.config/nvim/lua/core/bootstrap.lua
Normal file
43
.config/nvim/lua/core/bootstrap.lua
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim'
|
||||
local is_bootstrap = false
|
||||
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
||||
is_bootstrap = true
|
||||
vim.fn.system { 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
end
|
||||
|
||||
require('packer').startup(function(use)
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
-- Theme
|
||||
use 'Th3Whit3Wolf/one-nvim'
|
||||
|
||||
use 'lewis6991/gitsigns.nvim'
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = function()
|
||||
local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
|
||||
ts_update()
|
||||
end,
|
||||
}
|
||||
|
||||
use 'ThePrimeagen/vim-be-good'
|
||||
|
||||
if is_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end)
|
||||
|
||||
-- When we are bootstrapping a configuration, it doesn't
|
||||
-- make sense to execute the rest of the init.lua.
|
||||
--
|
||||
-- You'll need to restart nvim, and then it will work.
|
||||
if is_bootstrap then
|
||||
print '=================================='
|
||||
print ' Plugins are being installed'
|
||||
print ' Wait until Packer completes,'
|
||||
print ' then restart nvim'
|
||||
print '=================================='
|
||||
return
|
||||
end
|
||||
|
||||
3
.config/nvim/lua/core/init.lua
Normal file
3
.config/nvim/lua/core/init.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
require('core.settings')
|
||||
require('core.bootstrap')
|
||||
require('core.plugins')
|
||||
74
.config/nvim/lua/core/plugins.lua
Normal file
74
.config/nvim/lua/core/plugins.lua
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
require('gitsigns').setup {
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '-' },
|
||||
topdelete = { text = '-' },
|
||||
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 = {
|
||||
interval = 2500,
|
||||
follow_files = true
|
||||
},
|
||||
attach_to_untracked = true,
|
||||
current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
||||
delay = 500,
|
||||
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 = {
|
||||
-- Options passed to nvim_open_win
|
||||
border = 'single',
|
||||
style = 'minimal',
|
||||
relative = 'cursor',
|
||||
row = 0,
|
||||
col = 1
|
||||
},
|
||||
yadm = {
|
||||
enable = false
|
||||
},
|
||||
}
|
||||
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
-- A list of parser names, or "all" (the four listed parsers should always be installed)
|
||||
ensure_installed = { "c", "cpp", "lua", "vim", "help", "rust", "scala", "python"},
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||
auto_install = true,
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
-- set to `false` to disable one of the mappings
|
||||
init_selection = "false",
|
||||
scope_incremental = "false",
|
||||
node_incremental = "<A-Up>",
|
||||
node_decremental = "<A-Down>",
|
||||
},
|
||||
},
|
||||
}
|
||||
36
.config/nvim/lua/core/settings.lua
Normal file
36
.config/nvim/lua/core/settings.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
-- UI
|
||||
vim.o.hlsearch = false
|
||||
vim.o.relativenumber = true
|
||||
vim.o.mouse = 'a'
|
||||
vim.o.breakindent = true
|
||||
vim.o.undofile = true
|
||||
vim.o.ignorecase = true
|
||||
vim.o.smartcase = true
|
||||
vim.o.updatetime = 500
|
||||
vim.o.termguicolors = true
|
||||
vim.o.completeopt = "menu,preview"
|
||||
vim.o.scrolloff = 8
|
||||
|
||||
vim.wo.signcolumn = "yes"
|
||||
vim.wo.number = true
|
||||
|
||||
vim.opt.wrap = true
|
||||
vim.opt.backup = false
|
||||
|
||||
vim.cmd "colorscheme one-nvim"
|
||||
|
||||
-- Keymaps
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
|
||||
---- From THE one and only "Primeagen"
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
vim.keymap.set("n", "n", "nzzzv")
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
vim.keymap.set("n", "Q", "<nop>")
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue