Added lazy.nvim and treesitter
This commit is contained in:
@@ -1,60 +1,4 @@
|
|||||||
-- Enable relative line numbers
|
require("settings")
|
||||||
vim.opt.number = true
|
|
||||||
vim.opt.relativenumber = true
|
|
||||||
|
|
||||||
-- GUI stuff
|
require("lazy-nvim")
|
||||||
vim.opt.cursorline = true -- Highlight the current line
|
|
||||||
vim.opt.colorcolumn = "80,120" -- Show vertical ruler
|
|
||||||
vim.opt.scrolloff = 8 -- Keep at least 8 lines between the cursor and the borders
|
|
||||||
vim.opt.wrap = false -- Don't wrap long lines
|
|
||||||
|
|
||||||
-- Show whitespace characters (tabs, trailing spaces, etc.)
|
|
||||||
vim.opt.list = true
|
|
||||||
vim.opt.listchars = { tab = '» ', trail = '·', multispace = '·', nbsp = '␣' }
|
|
||||||
|
|
||||||
-- Strip trailing whitespace and extra blank lines at end of file on save
|
|
||||||
local trim_group = vim.api.nvim_create_augroup('TrimOnSave', { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
|
||||||
group = trim_group,
|
|
||||||
pattern = '*',
|
|
||||||
callback = function()
|
|
||||||
local save_view = vim.fn.winsaveview()
|
|
||||||
vim.cmd([[%s/\s\+$//e]]) -- Remove trailing whitespace on every line
|
|
||||||
vim.cmd([[%s/\n\+\%$//e]]) -- Remove all trailing blank lines
|
|
||||||
vim.fn.append(vim.fn.line('$'), '') -- Always append exactly one blank line at the end
|
|
||||||
vim.fn.setpos('.', save_cursor) -- Restore the window to where it was before the edits
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Remove background opacity
|
|
||||||
vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' })
|
|
||||||
vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'none' })
|
|
||||||
|
|
||||||
-- Remember old sessions
|
|
||||||
vim.opt.undofile = true
|
|
||||||
local restore_cursor_group = vim.api.nvim_create_augroup('RestoreCursor', { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd('BufReadPost', {
|
|
||||||
group = restore_cursor_group,
|
|
||||||
callback = function()
|
|
||||||
local mark = vim.api.nvim_buf_get_mark(0, '"')
|
|
||||||
local last_line = vim.api.nvim_buf_line_count(0)
|
|
||||||
if mark[1] > 0 and mark[1] <= last_line then
|
|
||||||
vim.schedule(function()
|
|
||||||
vim.api.nvim_win_set_cursor(0, mark)
|
|
||||||
vim.cmd.normal({ 'zz', bang = true })
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Indentation
|
|
||||||
vim.opt.tabstop = 4 -- Visual width of a tab character
|
|
||||||
vim.opt.softtabstop = 4 -- Spaces inserted/deleted per Tab/Backspace in insert mode
|
|
||||||
vim.opt.shiftwidth = 4 -- Width used by >>, <<, and autoindent
|
|
||||||
vim.opt.expandtab = true -- Typed tabs become spaces
|
|
||||||
vim.opt.smartindent = true -- Auto-indent new lines based on syntax (e.g. after '{')
|
|
||||||
|
|
||||||
-- Search
|
|
||||||
vim.opt.ignorecase = true -- Case-insensitive search...
|
|
||||||
vim.opt.smartcase = true -- ...unless you type an explicit uppercase letter
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
-- https://lazy.folke.io/installation
|
||||||
|
|
||||||
|
-- Bootstrap lazy.nvim
|
||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
|
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||||
|
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
vim.api.nvim_echo({
|
||||||
|
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||||
|
{ out, "WarningMsg" },
|
||||||
|
{ "\nPress any key to exit..." },
|
||||||
|
}, true, {})
|
||||||
|
vim.fn.getchar()
|
||||||
|
os.exit(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
-- Setup lazy.nvim
|
||||||
|
require("lazy").setup({
|
||||||
|
spec = {
|
||||||
|
-- Import `plugins/` dir
|
||||||
|
{ import = "plugins" },
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Automatically check for plugin updates
|
||||||
|
checker = { enabled = true },
|
||||||
|
})
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
return {
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
lazy = false,
|
||||||
|
build = ':TSUpdate'
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
-- Leader key
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
vim.g.maplocalleader = "\\"
|
||||||
|
|
||||||
|
-- Enable relative line numbers
|
||||||
|
vim.opt.number = true
|
||||||
|
vim.opt.relativenumber = true
|
||||||
|
|
||||||
|
-- GUI stuff
|
||||||
|
vim.opt.cursorline = true -- Highlight the current line
|
||||||
|
vim.opt.colorcolumn = "80,120" -- Show vertical ruler
|
||||||
|
vim.opt.scrolloff = 8 -- Keep at least 8 lines between the cursor and the borders
|
||||||
|
vim.opt.wrap = false -- Don't wrap long lines
|
||||||
|
|
||||||
|
-- Show whitespace characters (tabs, trailing spaces, etc.)
|
||||||
|
vim.opt.list = true
|
||||||
|
vim.opt.listchars = { tab = '» ', trail = '·', multispace = '·', nbsp = '␣' }
|
||||||
|
|
||||||
|
-- Strip trailing whitespace and extra blank lines at end of file on save
|
||||||
|
local trim_group = vim.api.nvim_create_augroup('TrimOnSave', { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||||
|
group = trim_group,
|
||||||
|
pattern = '*',
|
||||||
|
callback = function()
|
||||||
|
local save_view = vim.fn.winsaveview()
|
||||||
|
vim.cmd([[%s/\s\+$//e]]) -- Remove trailing whitespace on every line
|
||||||
|
vim.cmd([[%s/\n\+\%$//e]]) -- Remove all trailing blank lines
|
||||||
|
vim.fn.append(vim.fn.line('$'), '') -- Always append exactly one blank line at the end
|
||||||
|
vim.fn.setpos('.', save_cursor) -- Restore the window to where it was before the edits
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Remove background opacity
|
||||||
|
vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' })
|
||||||
|
vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'none' })
|
||||||
|
|
||||||
|
-- Remember old sessions
|
||||||
|
vim.opt.undofile = true
|
||||||
|
local restore_cursor_group = vim.api.nvim_create_augroup('RestoreCursor', { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd('BufReadPost', {
|
||||||
|
group = restore_cursor_group,
|
||||||
|
callback = function()
|
||||||
|
local mark = vim.api.nvim_buf_get_mark(0, '"')
|
||||||
|
local last_line = vim.api.nvim_buf_line_count(0)
|
||||||
|
if mark[1] > 0 and mark[1] <= last_line then
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.api.nvim_win_set_cursor(0, mark)
|
||||||
|
vim.cmd.normal({ 'zz', bang = true })
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Indentation
|
||||||
|
vim.opt.tabstop = 4 -- Visual width of a tab character
|
||||||
|
vim.opt.softtabstop = 4 -- Spaces inserted/deleted per Tab/Backspace in insert mode
|
||||||
|
vim.opt.shiftwidth = 4 -- Width used by >>, <<, and autoindent
|
||||||
|
vim.opt.expandtab = true -- Typed tabs become spaces
|
||||||
|
vim.opt.smartindent = true -- Auto-indent new lines based on syntax (e.g. after '{')
|
||||||
|
|
||||||
|
-- Search
|
||||||
|
vim.opt.ignorecase = true -- Case-insensitive search...
|
||||||
|
vim.opt.smartcase = true -- ...unless you type an explicit uppercase letter
|
||||||
|
|
||||||
Reference in New Issue
Block a user