Compare commits
3 commits
652817cca5
...
2dc8a5a61c
Author | SHA1 | Date | |
---|---|---|---|
2dc8a5a61c | |||
b006557730 | |||
ec664fd566 |
7 changed files with 387 additions and 199 deletions
6
.editorconfig
Normal file
6
.editorconfig
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
indent_style = tab
|
87
config/vim/autoload/crystalline/theme/gruvbox8.vim
Normal file
87
config/vim/autoload/crystalline/theme/gruvbox8.vim
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
vim9script
|
||||||
|
|
||||||
|
const dark = {
|
||||||
|
bg0: ['#282828', 235],
|
||||||
|
bg1: ['#3c3836', 237],
|
||||||
|
bg2: ['#504945', 239],
|
||||||
|
bg4: ['#7c6f64', 243],
|
||||||
|
|
||||||
|
fg1: ['#ebdbb2', 187],
|
||||||
|
fg4: ['#a89984', 137],
|
||||||
|
|
||||||
|
green: ['#98971a', 100],
|
||||||
|
yellow: ['#d79921', 172],
|
||||||
|
blue: ['#458588', 66],
|
||||||
|
aqua: ['#689d6a', 71],
|
||||||
|
orange: ['#d65d0e', 166],
|
||||||
|
red: ['#fb4934', 203],
|
||||||
|
}
|
||||||
|
|
||||||
|
const light = {
|
||||||
|
bg0: ['#fbf1c7', 230],
|
||||||
|
bg1: ['#ebdbb2', 187],
|
||||||
|
bg2: ['#d5c4a1', 187],
|
||||||
|
bg4: ['#a89984', 137],
|
||||||
|
|
||||||
|
fg1: ['#3c3836', 237],
|
||||||
|
fg4: ['#7c6f64', 243],
|
||||||
|
|
||||||
|
green: ['#98971a', 100],
|
||||||
|
yellow: ['#d79921', 172],
|
||||||
|
blue: ['#458588', 66],
|
||||||
|
aqua: ['#689d6a', 71],
|
||||||
|
orange: ['#d65d0e', 166],
|
||||||
|
red: ['#9d0006', 124],
|
||||||
|
}
|
||||||
|
|
||||||
|
def ToCrystalline(fg: list<any>, bg: list<any>): list<any>
|
||||||
|
return [
|
||||||
|
[fg[1], bg[1]],
|
||||||
|
[fg[0], bg[0]],
|
||||||
|
''
|
||||||
|
]
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def MakeTheme(c: dict<list<any>>): dict<list<any>>
|
||||||
|
var theme = {
|
||||||
|
A: ToCrystalline(c.bg0, c.bg4),
|
||||||
|
B: ToCrystalline(c.fg4, c.bg2),
|
||||||
|
Fill: ToCrystalline(c.fg4, c.bg1),
|
||||||
|
|
||||||
|
InactiveA: ToCrystalline(c.bg4, c.bg1),
|
||||||
|
InactiveB: ToCrystalline(c.bg4, c.bg1),
|
||||||
|
InactiveFill: ToCrystalline(c.bg4, c.bg1),
|
||||||
|
|
||||||
|
InsertModeA: ToCrystalline(c.bg0, c.blue),
|
||||||
|
InsertModeFill: ToCrystalline(c.fg4, c.bg2),
|
||||||
|
|
||||||
|
VisualModeA: ToCrystalline(c.bg0, c.orange),
|
||||||
|
ReplaceModeA: ToCrystalline(c.bg0, c.aqua),
|
||||||
|
ReplaceModeFill: ToCrystalline(c.fg4, c.bg2),
|
||||||
|
TerminalModeA: ToCrystalline(c.bg0, c.green),
|
||||||
|
|
||||||
|
Modified: ToCrystalline(c.red, c.bg1),
|
||||||
|
InsertModeModified: ToCrystalline(c.red, c.bg2),
|
||||||
|
|
||||||
|
TabSel: ToCrystalline(c.bg0, c.fg4),
|
||||||
|
ModifiedSel: ToCrystalline(c.bg1, c.fg4),
|
||||||
|
}
|
||||||
|
|
||||||
|
theme->extend({
|
||||||
|
Tab: theme.Fill,
|
||||||
|
NormalModeModified: theme.Modified,
|
||||||
|
CommandModeModified: theme.Modified,
|
||||||
|
VisualModeModified: theme.Modified,
|
||||||
|
ReplaceModeModified: theme.InsertModeModified,
|
||||||
|
})
|
||||||
|
|
||||||
|
return theme
|
||||||
|
enddef
|
||||||
|
|
||||||
|
export def GetThemeColours(): dict<list<any>>
|
||||||
|
return &background ==# 'dark' ? dark : light
|
||||||
|
enddef
|
||||||
|
|
||||||
|
export def SetTheme(): void
|
||||||
|
GetThemeColours()->MakeTheme()->g:crystalline#GenerateTheme()
|
||||||
|
enddef
|
|
@ -3,66 +3,29 @@ set encoding=utf-8
|
||||||
scriptencoding utf-8
|
scriptencoding utf-8
|
||||||
|
|
||||||
def EnsureDir(dir: string): void
|
def EnsureDir(dir: string): void
|
||||||
if filewritable(dir) != 2
|
mkdir(dir, "p", 0700)
|
||||||
mkdir(dir, "p", 0700)
|
|
||||||
endif
|
|
||||||
enddef
|
|
||||||
|
|
||||||
def PrependIfVisible(status: string, symbol: string): string
|
|
||||||
if empty(status)
|
|
||||||
return ''
|
|
||||||
endif
|
|
||||||
return symbol .. status
|
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
# These are really clever - minpac will actually be loaded on the fly only
|
# These are really clever - minpac will actually be loaded on the fly only
|
||||||
# when you need to update or clean your packages, rather than all the time.
|
# when you need to update or clean your packages, rather than all the time.
|
||||||
command! PackUpdate source $XDG_CONFIG_HOME/vim/plugins.vim | minpac#update()
|
command! PackUpdate source $XDG_CONFIG_HOME/vim/plugins.vim | minpac#update()
|
||||||
command! PackClean source $XDG_CONFIG_HOME/vim/plugins.vim | minpac#clean()
|
command! PackClean source $XDG_CONFIG_HOME/vim/plugins.vim | minpac#clean()
|
||||||
command! PackStatus source $XDG_CONFIG_HOME/vim/plugins.vim | minpac#status()
|
command! PackStatus source $XDG_CONFIG_HOME/vim/plugins.vim | minpac#status()
|
||||||
|
|
||||||
# If the pack directory doesn't exist, we haven't installed any packages yet,
|
# If the pack directory doesn't exist, we haven't installed any packages yet,
|
||||||
# so let's call PackUpdate.
|
# so let's call PackUpdate.
|
||||||
if !isdirectory($XDG_CACHE_HOME .. '/vim/pack')
|
if !isdirectory($XDG_CACHE_HOME .. '/vim/pack')
|
||||||
PackUpdate
|
PackUpdate
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if has('gui_running') || has('termguicolors')
|
if has('gui_running') || has('termguicolors')
|
||||||
if $COLORTERM == 'truecolor'
|
if $COLORTERM == 'truecolor'
|
||||||
&t_8f = "\<Esc>[38:2:%lu:%lu:%lum"
|
&t_8f = "\<Esc>[38:2:%lu:%lu:%lum"
|
||||||
&t_8b = "\<Esc>[48:2:%lu:%lu:%lum"
|
&t_8b = "\<Esc>[48:2:%lu:%lu:%lum"
|
||||||
endif
|
endif
|
||||||
set termguicolors
|
set termguicolors
|
||||||
endif
|
endif
|
||||||
|
|
||||||
g:battery#component_format = '%s %v%%'
|
|
||||||
|
|
||||||
set noshowmode
|
|
||||||
g:lightline = {
|
|
||||||
colorscheme: 'gruvbox8',
|
|
||||||
separator: {left: "\ue0b0", right: "\ue0b2"},
|
|
||||||
subseparator: {left: "\ue0b1", right: "\ue0b3"},
|
|
||||||
active: {
|
|
||||||
left: [['mode', 'paste'], ['git_branch', 'battery'], ['readonly', 'filename', 'modified']],
|
|
||||||
right: [['lineinfo'], ['percent'], ['fileencoding', 'filetype']],
|
|
||||||
},
|
|
||||||
component: {
|
|
||||||
filetype: '%{&ft}[%{&ff}]',
|
|
||||||
lineinfo: '%3l:%-2c',
|
|
||||||
},
|
|
||||||
component_function: {
|
|
||||||
battery: 'battery#component',
|
|
||||||
},
|
|
||||||
component_funcref: {
|
|
||||||
git_branch: () => g:FugitiveHead()->PrependIfVisible(' '),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Allow Funcrefs, especially lambdas, to be used as lightline components. :)
|
|
||||||
for k in keys(g:lightline.component_funcref)
|
|
||||||
g:lightline.component_function[k] = $'lightline.component_funcref.{k}'
|
|
||||||
endfor
|
|
||||||
|
|
||||||
set background=dark
|
set background=dark
|
||||||
g:gruvbox_transp_bg = 1
|
g:gruvbox_transp_bg = 1
|
||||||
g:gruvbox_italicize_strings = 0
|
g:gruvbox_italicize_strings = 0
|
||||||
|
@ -73,9 +36,10 @@ colorscheme gruvbox8
|
||||||
inoremap jj <Esc>
|
inoremap jj <Esc>
|
||||||
nnoremap <C-t> :Files<CR>
|
nnoremap <C-t> :Files<CR>
|
||||||
|
|
||||||
|
packadd! editorconfig
|
||||||
|
|
||||||
if exists('+belloff')
|
if exists('+belloff')
|
||||||
set belloff+=ctrlg
|
set belloff+=ctrlg
|
||||||
endif
|
endif
|
||||||
|
|
||||||
set completeopt+=menuone
|
set completeopt+=menuone
|
||||||
|
@ -85,30 +49,30 @@ set modelines=5
|
||||||
set showcmd
|
set showcmd
|
||||||
set wildmode=longest,full
|
set wildmode=longest,full
|
||||||
if has('patch-8.2.4325')
|
if has('patch-8.2.4325')
|
||||||
set wildoptions+=pum
|
set wildoptions+=pum
|
||||||
endif
|
endif
|
||||||
|
|
||||||
set tabstop=2 shiftwidth=2
|
set tabstop=2 shiftwidth=2
|
||||||
|
|
||||||
if exists('+breakindent')
|
if exists('+breakindent')
|
||||||
set breakindent breakindentopt=sbr
|
set breakindent breakindentopt=sbr
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if exists('+relativenumber')
|
if exists('+relativenumber')
|
||||||
set relativenumber
|
set relativenumber
|
||||||
else
|
else
|
||||||
set number
|
set number
|
||||||
endif
|
endif
|
||||||
|
|
||||||
for dir_name in ['backup', 'swap', 'undo']
|
for dir_name in ['backup', 'swap', 'undo']
|
||||||
EnsureDir($XDG_STATE_HOME .. '/vim/' .. dir_name)
|
EnsureDir($XDG_STATE_HOME .. '/vim/' .. dir_name)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
set backupdir=.,$XDG_STATE_HOME/vim/backup
|
set backupdir=.,$XDG_STATE_HOME/vim/backup
|
||||||
set directory=.,$XDG_STATE_HOME/vim/swap
|
set directory=.,$XDG_STATE_HOME/vim/swap
|
||||||
if exists('+undofile')
|
if exists('+undofile')
|
||||||
set undofile
|
set undofile
|
||||||
set undodir=$XDG_STATE_HOME/vim/undo
|
set undodir=$XDG_STATE_HOME/vim/undo
|
||||||
endif
|
endif
|
||||||
|
|
||||||
g:csv_no_conceal = 1
|
g:csv_no_conceal = 1
|
||||||
|
@ -123,11 +87,14 @@ nmap <silent> <C-k> <Plug>(ale_previous_wrap)
|
||||||
nmap <silent> <C-j> <Plug>(ale_next_wrap)
|
nmap <silent> <C-j> <Plug>(ale_next_wrap)
|
||||||
|
|
||||||
g:mucomplete#can_complete = {
|
g:mucomplete#can_complete = {
|
||||||
default: {
|
default: {
|
||||||
omni: (t) => strlen(&l:omnifunc) > 0 && t =~# '\m\k\%(\k\|\.\)$'
|
omni: (t) => strlen(&l:omnifunc) > 0 && t =~# '\m\k\%(\k\|\.\)$'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import "./statusline.vim"
|
||||||
|
statusline.Init()
|
||||||
|
|
||||||
import "./lsp.vim"
|
import "./lsp.vim"
|
||||||
lsp.LazyConfigure()
|
lsp.LazyConfigure()
|
||||||
|
|
||||||
|
|
|
@ -1,161 +1,161 @@
|
||||||
vim9script
|
vim9script
|
||||||
|
|
||||||
const lspServers = [
|
const lspServers = [
|
||||||
{
|
{
|
||||||
name: 'dockerfile-langserver',
|
name: 'dockerfile-langserver',
|
||||||
filetype: 'dockerfile',
|
filetype: 'dockerfile',
|
||||||
path: expand('~/.local/bin/docker-langserver'),
|
path: expand('~/.local/bin/docker-langserver'),
|
||||||
args: ['--stdio'],
|
args: ['--stdio'],
|
||||||
install: 'npm install -g dockerfile-language-server-nodejs',
|
install: 'npm install -g dockerfile-language-server-nodejs',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'lua-language-server',
|
name: 'lua-language-server',
|
||||||
filetype: 'lua',
|
filetype: 'lua',
|
||||||
path: '/usr/local/bin/lua-language-server',
|
path: '/usr/local/bin/lua-language-server',
|
||||||
args: [],
|
args: [],
|
||||||
install: 'brew install lua-language-server',
|
install: 'brew install lua-language-server',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'taplo',
|
name: 'taplo',
|
||||||
filetype: 'toml',
|
filetype: 'toml',
|
||||||
path: '/usr/local/bin/taplo',
|
path: '/usr/local/bin/taplo',
|
||||||
args: ['lsp', 'stdio'],
|
args: ['lsp', 'stdio'],
|
||||||
install: 'brew install taplo',
|
install: 'brew install taplo',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'tilt-lsp',
|
name: 'tilt-lsp',
|
||||||
filetype: 'bzl',
|
filetype: 'bzl',
|
||||||
path: '/usr/local/bin/tilt',
|
path: '/usr/local/bin/tilt',
|
||||||
args: ['lsp', 'start'],
|
args: ['lsp', 'start'],
|
||||||
install: 'brew install tilt',
|
install: 'brew install tilt',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'typescript-language-server',
|
name: 'typescript-language-server',
|
||||||
filetype: ['javascript', 'typescript'],
|
filetype: ['javascript', 'typescript'],
|
||||||
path: '/usr/local/bin/typescript-language-server',
|
path: '/usr/local/bin/typescript-language-server',
|
||||||
args: ['--stdio'],
|
args: ['--stdio'],
|
||||||
install: 'brew install typescript-language-server',
|
install: 'brew install typescript-language-server',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'phpactor',
|
name: 'phpactor',
|
||||||
filetype: 'php',
|
filetype: 'php',
|
||||||
path: expand('~/bin/phpactor'),
|
path: expand('~/bin/phpactor'),
|
||||||
args: ['language-server'],
|
args: ['language-server'],
|
||||||
initializationOptions: {
|
initializationOptions: {
|
||||||
'language_server_configuration.auto_config': false,
|
'language_server_configuration.auto_config': false,
|
||||||
},
|
},
|
||||||
install: 'curl -Lo phpactor https://github.com/phpactor/phpactor/releases/latest/download/phpactor.phar && chmod u+x phpactor && mv phpactor ~/bin',
|
install: 'curl -Lo phpactor https://github.com/phpactor/phpactor/releases/latest/download/phpactor.phar && chmod u+x phpactor && mv phpactor ~/bin',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'pylsp',
|
name: 'pylsp',
|
||||||
filetype: 'python',
|
filetype: 'python',
|
||||||
path: '/usr/local/bin/pylsp',
|
path: '/usr/local/bin/pylsp',
|
||||||
args: [],
|
args: [],
|
||||||
install: 'brew install python-lsp-server',
|
install: 'brew install python-lsp-server',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'solargraph',
|
name: 'solargraph',
|
||||||
filetype: 'ruby',
|
filetype: 'ruby',
|
||||||
path: '/usr/local/bin/solargraph',
|
path: '/usr/local/bin/solargraph',
|
||||||
args: ['stdio'],
|
args: ['stdio'],
|
||||||
install: 'brew install solargraph',
|
install: 'brew install solargraph',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'vim-language-server',
|
name: 'vim-language-server',
|
||||||
filetype: 'vim',
|
filetype: 'vim',
|
||||||
path: expand('~/.local/bin/vim-language-server'),
|
path: expand('~/.local/bin/vim-language-server'),
|
||||||
args: ['--stdio'],
|
args: ['--stdio'],
|
||||||
install: 'npm install -g vim-language-server',
|
install: 'npm install -g vim-language-server',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'vscode-json-language-server',
|
name: 'vscode-json-language-server',
|
||||||
filetype: ['json', 'jsonc'],
|
filetype: ['json', 'jsonc'],
|
||||||
path: expand('~/.local/bin/vscode-json-language-server'),
|
path: expand('~/.local/bin/vscode-json-language-server'),
|
||||||
args: ['--stdio'],
|
args: ['--stdio'],
|
||||||
workspaceConfig: {json: {
|
workspaceConfig: {json: {
|
||||||
format: {enable: true},
|
format: {enable: true},
|
||||||
validate: {enable: true},
|
validate: {enable: true},
|
||||||
schemas: g:SchemaStore#Schemata(),
|
schemas: g:SchemaStore#Schemata(),
|
||||||
}},
|
}},
|
||||||
install: 'npm install -g vscode-langservers-extracted',
|
install: 'npm install -g vscode-langservers-extracted',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'yaml-language-server',
|
name: 'yaml-language-server',
|
||||||
filetype: 'yaml',
|
filetype: 'yaml',
|
||||||
path: expand('~/.local/bin/yaml-language-server'),
|
path: expand('~/.local/bin/yaml-language-server'),
|
||||||
args: ['--stdio'],
|
args: ['--stdio'],
|
||||||
workspaceConfig: {yaml: {
|
workspaceConfig: {yaml: {
|
||||||
format: {enable: true, singleQuote: true},
|
format: {enable: true, singleQuote: true},
|
||||||
schemaStore: {enable: true, url: 'https://www.schemastore.org/api/json/catalog.json'},
|
schemaStore: {enable: true, url: 'https://www.schemastore.org/api/json/catalog.json'},
|
||||||
}},
|
}},
|
||||||
install: 'npm install -g yaml-language-server',
|
install: 'npm install -g yaml-language-server',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
const lspOptions = {
|
const lspOptions = {
|
||||||
aleSupport: true,
|
aleSupport: true,
|
||||||
ignoreMissingServer: true,
|
ignoreMissingServer: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
command! -nargs=0 -bar LspInstall Install()
|
command! -nargs=0 -bar LspInstall Install()
|
||||||
|
|
||||||
def InstalledServers(): list<dict<any>>
|
def InstalledServers(): list<dict<any>>
|
||||||
return lspServers->deepcopy()->filter((_, server): bool => executable(server.path) == 1)
|
return lspServers->deepcopy()->filter((_, server): bool => executable(server.path) == 1)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def MissingServers(): list<dict<any>>
|
def MissingServers(): list<dict<any>>
|
||||||
return lspServers->deepcopy()->filter((_, server): bool => executable(server.path) == 0)
|
return lspServers->deepcopy()->filter((_, server): bool => executable(server.path) == 0)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
export def LazyConfigure(): void
|
export def LazyConfigure(): void
|
||||||
autocmd VimEnter * ++once Configure()
|
autocmd VimEnter * ++once Configure()
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
export def Configure(): void
|
export def Configure(): void
|
||||||
final installedServers = InstalledServers()
|
final installedServers = InstalledServers()
|
||||||
if len(lspServers) != len(installedServers)
|
if len(lspServers) != len(installedServers)
|
||||||
echo $'{len(lspServers) - len(installedServers)} language servers are configured, but not installed. You may want to run :LspInstall.'
|
echo $'{len(lspServers) - len(installedServers)} language servers are configured, but not installed. You may want to run :LspInstall.'
|
||||||
endif
|
endif
|
||||||
g:LspAddServer(installedServers)
|
g:LspAddServer(installedServers)
|
||||||
g:LspOptionsSet(lspOptions)
|
g:LspOptionsSet(lspOptions)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
export def Install(): void
|
export def Install(): void
|
||||||
const missingServers = MissingServers()
|
const missingServers = MissingServers()
|
||||||
if empty(missingServers)
|
if empty(missingServers)
|
||||||
echo $"All {len(lspServers)} configured language servers are already installed."
|
echo $"All {len(lspServers)} configured language servers are already installed."
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# The installScript runs every missing server's install command, regardless
|
# The installScript runs every missing server's install command, regardless
|
||||||
# of whether any fail in the process. The script's exit status is the number
|
# of whether any fail in the process. The script's exit status is the number
|
||||||
# of failed installations.
|
# of failed installations.
|
||||||
const installScript = "failed=0\n" .. missingServers->copy()
|
const installScript = "failed=0\n" .. missingServers->copy()
|
||||||
->map((_, server): string => $"\{ {server.install}; \} || failed=$((failed + 1))")
|
->map((_, server): string => $"\{ {server.install}; \} || failed=$((failed + 1))")
|
||||||
->join("\n") .. "\nexit $failed\n"
|
->join("\n") .. "\nexit $failed\n"
|
||||||
|
|
||||||
const term = term_start('sh', {exit_cb: (job: job, status: number): void => {
|
const term = term_start('sh', {exit_cb: (job: job, status: number): void => {
|
||||||
# If any installations failed, keep the terminal window open so we can
|
# If any installations failed, keep the terminal window open so we can
|
||||||
# troubleshoot. If they all worked fine, close the terminal and reload the
|
# troubleshoot. If they all worked fine, close the terminal and reload the
|
||||||
# LSP configuration.
|
# LSP configuration.
|
||||||
if status == 0
|
if status == 0
|
||||||
execute 'bdelete' job->ch_getbufnr('out')
|
execute 'bdelete' job->ch_getbufnr('out')
|
||||||
Configure()
|
Configure()
|
||||||
endif
|
endif
|
||||||
}})
|
}})
|
||||||
|
|
||||||
# We prefer term_sendkeys() over sh -c because that will display each
|
# We prefer term_sendkeys() over sh -c because that will display each
|
||||||
# command in the terminal as it's being executed, making it easier to
|
# command in the terminal as it's being executed, making it easier to
|
||||||
# understand exactly what the install script is doing.
|
# understand exactly what the install script is doing.
|
||||||
term->term_sendkeys(installScript)
|
term->term_sendkeys(installScript)
|
||||||
enddef
|
enddef
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
vim9script
|
vim9script
|
||||||
silent! packadd minpac
|
silent! packadd minpac
|
||||||
if !exists('g:loaded_minpac')
|
if !exists('g:loaded_minpac')
|
||||||
silent !git clone https://github.com/k-takata/minpac.git $XDG_CACHE_HOME/vim/pack/minpac/opt/minpac
|
silent !git clone https://github.com/k-takata/minpac.git $XDG_CACHE_HOME/vim/pack/minpac/opt/minpac
|
||||||
augroup minpac {
|
augroup minpac {
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd VimEnter * call minpac#update()
|
autocmd VimEnter * call minpac#update()
|
||||||
}
|
}
|
||||||
endif
|
endif
|
||||||
packadd minpac
|
packadd minpac
|
||||||
|
|
||||||
|
@ -16,8 +16,11 @@ minpac#add('prabirshrestha/async.vim')
|
||||||
|
|
||||||
minpac#add('lifepillar/vim-gruvbox8')
|
minpac#add('lifepillar/vim-gruvbox8')
|
||||||
|
|
||||||
|
if !isdirectory($VIMRUNTIME .. '/pack/dist/opt/editorconfig')
|
||||||
|
minpac#add('editorconfig/editorconfig-vim')
|
||||||
|
endif
|
||||||
|
|
||||||
minpac#add('direnv/direnv.vim')
|
minpac#add('direnv/direnv.vim')
|
||||||
minpac#add('editorconfig/editorconfig-vim')
|
|
||||||
minpac#add('godlygeek/tabular')
|
minpac#add('godlygeek/tabular')
|
||||||
minpac#add('jamessan/vim-gnupg')
|
minpac#add('jamessan/vim-gnupg')
|
||||||
minpac#add('junegunn/vim-easy-align')
|
minpac#add('junegunn/vim-easy-align')
|
||||||
|
@ -46,8 +49,9 @@ minpac#add('w0rp/ale')
|
||||||
minpac#add('yegappan/lsp')
|
minpac#add('yegappan/lsp')
|
||||||
minpac#add('00dani/SchemaStore.vim')
|
minpac#add('00dani/SchemaStore.vim')
|
||||||
|
|
||||||
minpac#add('itchyny/lightline.vim')
|
minpac#add('rbong/vim-crystalline')
|
||||||
minpac#add('lambdalisue/battery.vim')
|
minpac#add('lambdalisue/battery.vim')
|
||||||
|
minpac#add('lambdalisue/nerdfont.vim')
|
||||||
|
|
||||||
minpac#add('alvan/vim-closetag')
|
minpac#add('alvan/vim-closetag')
|
||||||
minpac#add('LaTeX-Box-Team/LaTeX-Box')
|
minpac#add('LaTeX-Box-Team/LaTeX-Box')
|
||||||
|
@ -70,7 +74,7 @@ minpac#add('fpob/nette.vim')
|
||||||
minpac#add('leafOfTree/vim-svelte-plugin')
|
minpac#add('leafOfTree/vim-svelte-plugin')
|
||||||
|
|
||||||
if executable('task')
|
if executable('task')
|
||||||
minpac#add('farseer90718/vim-taskwarrior')
|
minpac#add('farseer90718/vim-taskwarrior')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
minpac#add('pedrohdz/vim-yaml-folds')
|
minpac#add('pedrohdz/vim-yaml-folds')
|
||||||
|
@ -79,8 +83,8 @@ minpac#add('alx741/yesod.vim')
|
||||||
minpac#add('pbrisbin/vim-syntax-shakespeare')
|
minpac#add('pbrisbin/vim-syntax-shakespeare')
|
||||||
|
|
||||||
if has('macunix')
|
if has('macunix')
|
||||||
minpac#add('rizzatti/dash.vim')
|
minpac#add('rizzatti/dash.vim')
|
||||||
# We rename this plugin to make sure it loads AFTER vim-polyglot,
|
# We rename this plugin to make sure it loads AFTER vim-polyglot,
|
||||||
# since it won't work properly if it's loaded first.
|
# since it won't work properly if it's loaded first.
|
||||||
minpac#add('itspriddle/vim-marked', {name: 'zzvim-marked'})
|
minpac#add('itspriddle/vim-marked', {name: 'zzvim-marked'})
|
||||||
endif
|
endif
|
||||||
|
|
124
config/vim/statusline.vim
Normal file
124
config/vim/statusline.vim
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
vim9script
|
||||||
|
|
||||||
|
import autoload ($XDG_CACHE_HOME .. '/vim/pack/minpac/start/vim-crystalline/autoload/crystalline.vim') as cr
|
||||||
|
|
||||||
|
def PrependIfVisible(status: string, prefix: string): string
|
||||||
|
if empty(status)
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
return prefix .. status
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def AppendIfVisible(status: string, affix: string): string
|
||||||
|
if empty(status)
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
return status .. affix
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def StatuslineSection(seps: number, group: string, components: list<string>): string
|
||||||
|
const hiGroup = cr.ModeGroup(group)
|
||||||
|
return components->copy()->filter((_, s) => s != '')
|
||||||
|
->join(' ' .. cr.Sep(seps, hiGroup, hiGroup) .. ' ')
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def GitStatus(): string
|
||||||
|
if empty(g:FugitiveGitDir())
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
const branch = g:FugitiveHead()->PrependIfVisible("\ue0a0 ") # nf-pl-branch
|
||||||
|
if !empty(branch)
|
||||||
|
return branch
|
||||||
|
endif
|
||||||
|
|
||||||
|
return g:FugitiveHead(7)
|
||||||
|
->PrependIfVisible("\Uf135e (") # nf-md-head
|
||||||
|
->AppendIfVisible(")")
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def StatuslineLeft(window: number, inactive: bool): string
|
||||||
|
const bufnr = window->winbufnr()
|
||||||
|
const b = bufnr->getbufvar('&')
|
||||||
|
const fileName = [
|
||||||
|
bufname(bufnr)->g:nerdfont#find()->AppendIfVisible(' '),
|
||||||
|
b.buftype == '' ? '%t' : '%f',
|
||||||
|
b.modifiable && b.modified ? cr.ModeHiItem('Modified') .. '+' .. cr.ModeHiItem('Fill') : '',
|
||||||
|
b.readonly ? " \uf023" : '', # nf-fa-lock
|
||||||
|
]->join('')
|
||||||
|
if inactive
|
||||||
|
return ' ' .. fileName
|
||||||
|
endif
|
||||||
|
|
||||||
|
const info = StatuslineSection(0, 'B', [
|
||||||
|
GitStatus(),
|
||||||
|
g:battery#component_escaped(),
|
||||||
|
])->AppendIfVisible(' ' .. cr.Sep(0, cr.ModeGroup('B'), cr.ModeGroup('Fill')))
|
||||||
|
const vimMode = cr.ModeSection(0, 'A', empty(info) ? 'Fill' : 'B')
|
||||||
|
|
||||||
|
return join([vimMode, info, fileName])
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def StatuslineRight(window: number, inactive: bool): string
|
||||||
|
const percent = '%3p%%'
|
||||||
|
const lineInfo = '%3l:%-2c'
|
||||||
|
const fileType = '%{&ft}[%{&ff}]'
|
||||||
|
if inactive
|
||||||
|
return StatuslineSection(1, 'Fill', [fileType, percent, lineInfo])
|
||||||
|
endif
|
||||||
|
|
||||||
|
const fileEncoding = &fileencoding
|
||||||
|
const fileInfo = StatuslineSection(1, 'Fill', [fileEncoding, fileType])
|
||||||
|
|
||||||
|
const prettyPercent = cr.Sep(1, cr.ModeGroup('Fill'), cr.ModeGroup('B')) .. ' ' .. percent
|
||||||
|
const prettyLineInfo = cr.Sep(1, cr.ModeGroup('B'), cr.ModeGroup('A')) .. lineInfo
|
||||||
|
|
||||||
|
return join([fileInfo, prettyPercent, prettyLineInfo])
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def ConfigurePlugins(): void
|
||||||
|
g:battery#component_format = '%s %v%%'
|
||||||
|
g:nerdfont#default = ''
|
||||||
|
g:crystalline_theme = 'gruvbox8'
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def InitStatus(): void
|
||||||
|
def g:CrystallineStatuslineFn(window: number): string
|
||||||
|
const inactive = window != winnr()
|
||||||
|
const statusLeft = StatuslineLeft(window, inactive)
|
||||||
|
const statusRight = StatuslineRight(window, inactive)
|
||||||
|
|
||||||
|
return $'{statusLeft}%={statusRight}'
|
||||||
|
enddef
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def InitTab()
|
||||||
|
g:crystalline_tab_mod = ''
|
||||||
|
def g:CrystallineTablineFn(): string
|
||||||
|
return cr.DefaultTabline({auto_prefix_groups: false})
|
||||||
|
enddef
|
||||||
|
|
||||||
|
def g:CrystallineTabFn(tabnr: number, bufnr: number, maxWidth: number, isSel: bool): list<any>
|
||||||
|
var [tabDisplay, width] = cr.DefaultTab(tabnr, bufnr, maxWidth, isSel)
|
||||||
|
|
||||||
|
if bufnr->getbufvar('&modified')
|
||||||
|
const sel = isSel ? 'Sel' : ''
|
||||||
|
tabDisplay ..= cr.HiItem($'Modified{sel}') .. '+' .. cr.HiItem($'Tab{sel}') .. ' '
|
||||||
|
width += 2
|
||||||
|
endif
|
||||||
|
|
||||||
|
const icon = bufname(bufnr)->g:nerdfont#find()->PrependIfVisible(' ')
|
||||||
|
if width + strchars(icon) >= maxWidth
|
||||||
|
return [tabDisplay, width]
|
||||||
|
endif
|
||||||
|
|
||||||
|
return [icon .. tabDisplay, width + strchars(icon)]
|
||||||
|
enddef
|
||||||
|
enddef
|
||||||
|
|
||||||
|
export def Init(): void
|
||||||
|
InitStatus()
|
||||||
|
InitTab()
|
||||||
|
ConfigurePlugins()
|
||||||
|
set noshowmode
|
||||||
|
enddef
|
16
vimrc
16
vimrc
|
@ -1,20 +1,20 @@
|
||||||
vim9script
|
vim9script
|
||||||
const xdg = {
|
const xdg = {
|
||||||
XDG_CONFIG_HOME: '~/.config',
|
XDG_CONFIG_HOME: '~/.config',
|
||||||
XDG_CACHE_HOME: '~/.cache',
|
XDG_CACHE_HOME: '~/.cache',
|
||||||
XDG_DATA_HOME: '~/.local/share',
|
XDG_DATA_HOME: '~/.local/share',
|
||||||
XDG_STATE_HOME: '~/.local/state',
|
XDG_STATE_HOME: '~/.local/state',
|
||||||
}
|
}
|
||||||
for [key, default] in items(xdg)
|
for [key, default] in items(xdg)
|
||||||
if !has_key(environ(), key)
|
if !has_key(environ(), key)
|
||||||
setenv(key, expand(default))
|
setenv(key, expand(default))
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
set runtimepath=$XDG_CONFIG_HOME/vim,$XDG_CACHE_HOME/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$XDG_CONFIG_HOME/vim/after,$XDG_CACHE_HOME/vim/after
|
set runtimepath=$XDG_CONFIG_HOME/vim,$XDG_CACHE_HOME/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$XDG_CONFIG_HOME/vim/after,$XDG_CACHE_HOME/vim/after
|
||||||
set viminfo+=n$XDG_STATE_HOME/vim/viminfo
|
set viminfo+=n$XDG_STATE_HOME/vim/viminfo
|
||||||
if exists('+packpath')
|
if exists('+packpath')
|
||||||
set packpath^=$XDG_CONFIG_HOME/vim,$XDG_CACHE_HOME/vim
|
set packpath^=$XDG_CONFIG_HOME/vim,$XDG_CACHE_HOME/vim
|
||||||
endif
|
endif
|
||||||
g:netrw_home = $XDG_CACHE_HOME .. '/vim/netrw'
|
g:netrw_home = $XDG_CACHE_HOME .. '/vim/netrw'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue