Migrate to lazy.nvim
This commit is contained in:
parent
4567232315
commit
a3072e86e3
4 changed files with 136 additions and 67 deletions
76
nvim/.config/nvim/init.lua
Normal file
76
nvim/.config/nvim/init.lua
Normal file
|
@ -0,0 +1,76 @@
|
|||
-- Plugins
|
||||
require('config.lazy');
|
||||
|
||||
-- Color scheme and syntax highlighting
|
||||
vim.cmd('syntax on')
|
||||
vim.cmd('colorscheme solarized-osaka')
|
||||
vim.o.background = 'dark'
|
||||
|
||||
-- Ensures misspellings are highlighted
|
||||
vim.cmd('highlight SpellBad ctermfg=white ctermbg=red')
|
||||
|
||||
-- Global settings
|
||||
vim.o.autoindent = true
|
||||
vim.o.colorcolumn = '80,100,120'
|
||||
vim.o.expandtab = true
|
||||
vim.o.hidden = true
|
||||
vim.o.hlsearch = true
|
||||
vim.o.ignorecase = true
|
||||
vim.o.incsearch = true
|
||||
vim.o.laststatus = 2
|
||||
vim.o.number = true
|
||||
vim.o.relativenumber = true
|
||||
vim.o.shiftwidth = 2
|
||||
vim.o.smartindent = true
|
||||
vim.o.softtabstop = 2
|
||||
vim.o.tabstop = 2
|
||||
vim.o.undofile = true
|
||||
|
||||
-- Filetype-specific settings
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'gitcommit',
|
||||
callback = function()
|
||||
vim.opt_local.colorcolumn = '50,72'
|
||||
vim.opt_local.textwidth = 72
|
||||
end
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = {'gitcommit', 'markdown', 'text'},
|
||||
callback = function()
|
||||
vim.opt_local.smartindent = false
|
||||
vim.opt_local.spell = true
|
||||
end
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = {'markdown', 'text'},
|
||||
callback = function()
|
||||
vim.opt_local.textwidth = 80
|
||||
vim.opt_local.wrapmargin = 2
|
||||
end
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = {'php', 'python'},
|
||||
callback = function()
|
||||
vim.opt_local.shiftwidth = 4
|
||||
vim.opt_local.softtabstop = 4
|
||||
vim.opt_local.tabstop = 4
|
||||
end
|
||||
})
|
||||
|
||||
-- Strip trailing whitespace on save
|
||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
pattern = '*',
|
||||
command = [[%s/\s\+$//e]]
|
||||
})
|
||||
|
||||
-- Set runtime path for fzf based on the operating system
|
||||
if vim.fn.has('macunix') == 1 then
|
||||
vim.opt.rtp:append('/opt/homebrew/opt/fzf')
|
||||
elseif vim.fn.executable('apt') == 1 then
|
||||
vim.opt.rtp:append('/usr/share/doc/fzf/examples')
|
||||
elseif vim.fn.executable('pacman') == 1 then
|
||||
vim.opt.rtp:append('~/.fzf')
|
||||
end
|
|
@ -1,67 +0,0 @@
|
|||
" Download vim-plug if it's not already present
|
||||
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
|
||||
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
|
||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
endif
|
||||
|
||||
" A humble list of plugins
|
||||
call plug#begin()
|
||||
" Solarized Osaka
|
||||
Plug 'craftzdog/solarized-osaka.nvim'
|
||||
" File exploration and navigation
|
||||
Plug 'junegunn/fzf.vim'
|
||||
" Languages and syntax
|
||||
Plug 'sheerun/vim-polyglot'
|
||||
" Style guide and linting
|
||||
Plug 'dense-analysis/ale'
|
||||
Plug 'editorconfig/editorconfig-vim'
|
||||
" TypeScript
|
||||
Plug 'leafgarland/typescript-vim'
|
||||
Plug 'Quramy/tsuquyomi'
|
||||
Plug 'Shougo/vimproc.vim', {'do' : 'make'}
|
||||
" GitHub integration
|
||||
Plug 'github/copilot.vim'
|
||||
Plug 'ruanyl/vim-gh-line'
|
||||
call plug#end()
|
||||
|
||||
" Color scheme and syntax highlighting
|
||||
syntax on
|
||||
colorscheme solarized-osaka
|
||||
set background=dark
|
||||
" Ensures misspellings are highlighted
|
||||
highlight SpellBad ctermfg=white ctermbg=red
|
||||
|
||||
" Global settings
|
||||
set autoindent
|
||||
set colorcolumn=80,100,120
|
||||
set expandtab
|
||||
set hidden
|
||||
set hlsearch
|
||||
set ignorecase
|
||||
set incsearch
|
||||
set laststatus=2
|
||||
set number
|
||||
set relativenumber
|
||||
set shiftwidth=2
|
||||
set smartindent
|
||||
set softtabstop=2
|
||||
set tabstop=2
|
||||
set undofile
|
||||
|
||||
" Filetype-specific settings
|
||||
autocmd FileType gitcommit setl colorcolumn=50,72 textwidth=72
|
||||
autocmd FileType gitcommit,markdown,text setl nosmartindent spell
|
||||
autocmd FileType markdown,text setl textwidth=80 wrapmargin=2
|
||||
autocmd FileType php,python setl shiftwidth=4 softtabstop=4 tabstop=4
|
||||
|
||||
" Strip trailing whitespace on save
|
||||
autocmd BufWritePre * :%s/\s\+$//e
|
||||
|
||||
" Set the runtime path for fzf based on OS
|
||||
if has('mac')
|
||||
set rtp+=/opt/homebrew/opt/fzf
|
||||
elseif executable('apt')
|
||||
set rtp+=/usr/share/doc/fzf/examples
|
||||
elseif executable('pacman')
|
||||
set rtp+=~/.fzf
|
||||
endif
|
13
nvim/.config/nvim/lazy-lock.json
Normal file
13
nvim/.config/nvim/lazy-lock.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ale": { "branch": "master", "commit": "2e5f135836a700dcc6b787f10097ebdeb8e22abb" },
|
||||
"copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" },
|
||||
"editorconfig-vim": { "branch": "master", "commit": "ba2ce027c5b0e523e658d24657ce3ae3306c9fe0" },
|
||||
"fzf.vim": { "branch": "master", "commit": "ec75ffbfd50630bf2b8d444d89487e149bacf7f3" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
|
||||
"solarized-osaka.nvim": { "branch": "main", "commit": "126d394c0c979a99206214a2b6b8c86e456c9c0f" },
|
||||
"tsuquyomi": { "branch": "master", "commit": "e1afca562d46907bf63270157c88b7ec8f66e46b" },
|
||||
"typescript-vim": { "branch": "master", "commit": "8d169e16b5487771f6568125d4c63e6086e524d9" },
|
||||
"vim-gh-line": { "branch": "master", "commit": "731751fdfa4f64a061dbc7088cb7b2f12e0828ad" },
|
||||
"vim-polyglot": { "branch": "master", "commit": "bc8a81d3592dab86334f27d1d43c080ebf680d42" },
|
||||
"vimproc.vim": { "branch": "master", "commit": "63a4ce0768c7af434ac53d37bdc1e7ff7fd2bece" }
|
||||
}
|
47
nvim/.config/nvim/lua/config/lazy.lua
Normal file
47
nvim/.config/nvim/lua/config/lazy.lua
Normal file
|
@ -0,0 +1,47 @@
|
|||
-- 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)
|
||||
|
||||
-- Make sure to setup `mapleader` and `maplocalleader` before loading lazy.nvim
|
||||
-- so that mappings are correct. This is also a good place to setup other
|
||||
-- settings (vim.opt)
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = '\\'
|
||||
|
||||
require('lazy').setup({
|
||||
spec = {
|
||||
-- Solarized Osaka
|
||||
{ 'craftzdog/solarized-osaka.nvim' },
|
||||
-- File exploration and navigation
|
||||
{ 'junegunn/fzf.vim' },
|
||||
-- Languages and syntax
|
||||
{ 'sheerun/vim-polyglot' },
|
||||
-- Style guide and linting
|
||||
{ 'dense-analysis/ale' },
|
||||
{ 'editorconfig/editorconfig-vim' },
|
||||
-- TypeScript
|
||||
{ 'leafgarland/typescript-vim' },
|
||||
{ 'Quramy/tsuquyomi' },
|
||||
{ 'Shougo/vimproc.vim', build = 'make' },
|
||||
-- GitHub integration
|
||||
{ 'github/copilot.vim' },
|
||||
{ 'ruanyl/vim-gh-line' },
|
||||
},
|
||||
install = { colorscheme = { 'solarized-osaka' } },
|
||||
checker = { enabled = true },
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue