Migrate from .stow-rename to --dotfiles
This commit is contained in:
parent
0d1e22d515
commit
29e2176c68
11 changed files with 0 additions and 4 deletions
6
dot-config/ideavim/ideavimrc
Normal file
6
dot-config/ideavim/ideavimrc
Normal file
|
@ -0,0 +1,6 @@
|
|||
set hlsearch
|
||||
set ideajoin
|
||||
set surround
|
||||
|
||||
inoremap jj <Esc>
|
||||
nnoremap <C-l> :noh<CR><C-l>
|
5
dot-config/nvim/init.vim
Normal file
5
dot-config/nvim/init.vim
Normal file
|
@ -0,0 +1,5 @@
|
|||
set runtimepath+=$XDG_CONFIG_HOME/vim,$XDG_CACHE_HOME/vim,$XDG_CONFIG_HOME/vim/after,$XDG_CACHE_HOME/vim/after
|
||||
if exists('+packpath')
|
||||
set packpath^=$XDG_CONFIG_HOME/vim,$XDG_CACHE_HOME/vim
|
||||
endif
|
||||
source $XDG_CONFIG_HOME/vim/init.vim
|
87
dot-config/vim/autoload/crystalline/theme/gruvbox8.vim
Normal file
87
dot-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
|
1
dot-config/vim/ftplugin/crontab.vim
Normal file
1
dot-config/vim/ftplugin/crontab.vim
Normal file
|
@ -0,0 +1 @@
|
|||
set backupcopy=yes
|
118
dot-config/vim/init.vim
Normal file
118
dot-config/vim/init.vim
Normal file
|
@ -0,0 +1,118 @@
|
|||
vim9script
|
||||
set encoding=utf-8
|
||||
scriptencoding utf-8
|
||||
|
||||
def EnsureDir(dir: string): void
|
||||
mkdir(dir, "p", 0700)
|
||||
enddef
|
||||
|
||||
# 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.
|
||||
command! PackUpdate source $XDG_CONFIG_HOME/vim/plugins.vim | minpac#update()
|
||||
command! PackClean source $XDG_CONFIG_HOME/vim/plugins.vim | minpac#clean()
|
||||
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,
|
||||
# so let's call PackUpdate.
|
||||
if !isdirectory($XDG_CACHE_HOME .. '/vim/pack')
|
||||
PackUpdate
|
||||
endif
|
||||
|
||||
if has('gui_running') || has('termguicolors')
|
||||
if $COLORTERM == 'truecolor'
|
||||
&t_8f = "\<Esc>[38:2:%lu:%lu:%lum"
|
||||
&t_8b = "\<Esc>[48:2:%lu:%lu:%lum"
|
||||
endif
|
||||
set termguicolors
|
||||
endif
|
||||
|
||||
set background=dark
|
||||
g:gruvbox_transp_bg = 1
|
||||
g:gruvbox_italicize_strings = 0
|
||||
g:gruvbox_filetype_hi_groups = 1
|
||||
g:gruvbox_plugin_hi_groups = 1
|
||||
colorscheme gruvbox8
|
||||
|
||||
inoremap jj <Esc>
|
||||
nnoremap <C-t> :Files<CR>
|
||||
|
||||
packadd! editorconfig
|
||||
|
||||
if exists('+belloff')
|
||||
set belloff+=ctrlg
|
||||
endif
|
||||
|
||||
set completeopt+=menuone
|
||||
|
||||
set linebreak showbreak=↩
|
||||
set modelines=5
|
||||
set showcmd
|
||||
set wildmode=longest,full
|
||||
if has('patch-8.2.4325')
|
||||
set wildoptions+=pum
|
||||
endif
|
||||
|
||||
set tabstop=2 shiftwidth=2
|
||||
|
||||
if exists('+breakindent')
|
||||
set breakindent breakindentopt=sbr
|
||||
endif
|
||||
|
||||
if exists('+relativenumber')
|
||||
set relativenumber
|
||||
else
|
||||
set number
|
||||
endif
|
||||
|
||||
for dir_name in ['backup', 'swap', 'undo']
|
||||
EnsureDir($XDG_STATE_HOME .. '/vim/' .. dir_name)
|
||||
endfor
|
||||
|
||||
set backupdir=.,$XDG_STATE_HOME/vim/backup
|
||||
set directory=.,$XDG_STATE_HOME/vim/swap
|
||||
if exists('+undofile')
|
||||
set undofile
|
||||
set undodir=$XDG_STATE_HOME/vim/undo
|
||||
endif
|
||||
|
||||
# This setup installs both tpope/vim-sensible and tpope/vim-sleuth, so we
|
||||
# don't also need vim-polyglot to provide that same functionality.
|
||||
g:polyglot_disabled = ['sensible', 'autoindent']
|
||||
|
||||
g:csv_no_conceal = 1
|
||||
|
||||
g:vim_svelte_plugin_use_typescript = 1
|
||||
|
||||
g:LatexBox_Folding = 1
|
||||
|
||||
g:ale_set_balloons = 1
|
||||
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
|
||||
nmap <silent> <C-j> <Plug>(ale_next_wrap)
|
||||
|
||||
g:fern#renderer = 'nerdfont'
|
||||
augroup glyphPalette
|
||||
autocmd!
|
||||
autocmd FileType fern g:glyph_palette#apply()
|
||||
augroup END
|
||||
|
||||
g:mucomplete#can_complete = {
|
||||
default: {
|
||||
omni: (t) => strlen(&l:omnifunc) > 0 && t =~# '\m\k\%(\k\|\.\)$'
|
||||
}
|
||||
}
|
||||
|
||||
import "./statusline.vim"
|
||||
statusline.Init()
|
||||
|
||||
import "./lsp.vim"
|
||||
lsp.LazyConfigure()
|
||||
|
||||
set formatexpr=lsp#lsp#FormatExpr()
|
||||
set keywordprg=:LspHover
|
||||
nnoremap gD <Cmd>LspGotoDeclaration<CR>
|
||||
nnoremap gd <Cmd>LspGotoDefinition<CR>
|
||||
nnoremap gi <Cmd>LspGotoImpl<CR>
|
||||
nnoremap <C-k> <Cmd>LspShowSignature<CR>
|
||||
nnoremap gr <Cmd>LspShowReferences<CR>
|
||||
xnoremap <silent> <Leader>e <Cmd>LspSelectionExpand<CR>
|
||||
xnoremap <silent> <Leader>s <Cmd>LspSelectionShrink<CR>
|
164
dot-config/vim/lsp.vim
Normal file
164
dot-config/vim/lsp.vim
Normal file
|
@ -0,0 +1,164 @@
|
|||
vim9script
|
||||
|
||||
const lspServers = [
|
||||
{
|
||||
name: 'dockerfile-langserver',
|
||||
filetype: 'dockerfile',
|
||||
path: expand('~/.local/bin/docker-langserver'),
|
||||
args: ['--stdio'],
|
||||
install: 'npm install -g dockerfile-language-server-nodejs',
|
||||
},
|
||||
|
||||
{
|
||||
name: 'lua-language-server',
|
||||
filetype: 'lua',
|
||||
path: '/usr/local/bin/lua-language-server',
|
||||
args: [],
|
||||
install: 'brew install lua-language-server',
|
||||
},
|
||||
|
||||
{
|
||||
name: 'taplo',
|
||||
filetype: 'toml',
|
||||
path: '/usr/local/bin/taplo',
|
||||
args: ['lsp', 'stdio'],
|
||||
install: 'brew install taplo',
|
||||
},
|
||||
|
||||
{
|
||||
name: 'tilt-lsp',
|
||||
filetype: 'bzl',
|
||||
path: '/usr/local/bin/tilt',
|
||||
args: ['lsp', 'start'],
|
||||
install: 'brew install tilt',
|
||||
},
|
||||
|
||||
{
|
||||
name: 'typescript-language-server',
|
||||
filetype: ['javascript', 'typescript'],
|
||||
path: '/usr/local/bin/typescript-language-server',
|
||||
args: ['--stdio'],
|
||||
install: 'brew install typescript-language-server',
|
||||
},
|
||||
|
||||
{
|
||||
name: 'phpactor',
|
||||
filetype: 'php',
|
||||
path: expand('~/bin/phpactor'),
|
||||
args: ['language-server'],
|
||||
initializationOptions: {
|
||||
'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',
|
||||
},
|
||||
|
||||
{
|
||||
name: 'pylsp',
|
||||
filetype: 'python',
|
||||
path: '/usr/local/bin/pylsp',
|
||||
args: [],
|
||||
install: 'brew install python-lsp-server',
|
||||
},
|
||||
|
||||
{
|
||||
name: 'solargraph',
|
||||
filetype: 'ruby',
|
||||
path: '/usr/local/bin/solargraph',
|
||||
args: ['stdio'],
|
||||
install: 'brew install solargraph',
|
||||
},
|
||||
|
||||
{
|
||||
name: 'vim-language-server',
|
||||
filetype: 'vim',
|
||||
path: expand('~/.local/bin/vim-language-server'),
|
||||
args: ['--stdio'],
|
||||
install: 'npm install -g vim-language-server',
|
||||
},
|
||||
|
||||
{
|
||||
name: 'vscode-json-language-server',
|
||||
filetype: ['json', 'jsonc'],
|
||||
path: expand('~/.local/bin/vscode-json-language-server'),
|
||||
args: ['--stdio'],
|
||||
workspaceConfig: {json: {
|
||||
format: {enable: true},
|
||||
validate: {enable: true},
|
||||
schemas: g:SchemaStore#Schemata(),
|
||||
}},
|
||||
install: 'npm install -g vscode-langservers-extracted',
|
||||
},
|
||||
|
||||
{
|
||||
name: 'yaml-language-server',
|
||||
filetype: 'yaml',
|
||||
path: expand('~/.local/bin/yaml-language-server'),
|
||||
args: ['--stdio'],
|
||||
workspaceConfig: {yaml: {
|
||||
format: {enable: true, singleQuote: true},
|
||||
schemaStore: {enable: true, url: 'https://www.schemastore.org/api/json/catalog.json'},
|
||||
}},
|
||||
install: 'npm install -g yaml-language-server',
|
||||
},
|
||||
]
|
||||
|
||||
const lspOptions = {
|
||||
aleSupport: true,
|
||||
ignoreMissingServer: true,
|
||||
}
|
||||
|
||||
command! -nargs=0 -bar LspInstall Install()
|
||||
|
||||
def InstalledServers(): list<dict<any>>
|
||||
return lspServers->deepcopy()->filter((_, server): bool => executable(server.path) == 1)
|
||||
enddef
|
||||
|
||||
def MissingServers(): list<dict<any>>
|
||||
return lspServers->deepcopy()->filter((_, server): bool => executable(server.path) == 0)
|
||||
enddef
|
||||
|
||||
export def LazyConfigure(): void
|
||||
augroup lspLazyConfigure
|
||||
autocmd!
|
||||
autocmd VimEnter * ++once Configure()
|
||||
augroup END
|
||||
enddef
|
||||
|
||||
export def Configure(): void
|
||||
final installedServers = InstalledServers()
|
||||
if len(lspServers) != len(installedServers)
|
||||
echo $'{len(lspServers) - len(installedServers)} language servers are configured, but not installed. You may want to run :LspInstall.'
|
||||
endif
|
||||
g:LspAddServer(installedServers)
|
||||
g:LspOptionsSet(lspOptions)
|
||||
enddef
|
||||
|
||||
export def Install(): void
|
||||
const missingServers = MissingServers()
|
||||
if empty(missingServers)
|
||||
echo $"All {len(lspServers)} configured language servers are already installed."
|
||||
return
|
||||
endif
|
||||
|
||||
# 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 failed installations.
|
||||
const installScript = "failed=0\n" .. missingServers->copy()
|
||||
->map((_, server): string => $"\{ {server.install}; \} || failed=$((failed + 1))")
|
||||
->join("\n") .. "\nexit $failed\n"
|
||||
|
||||
const term = term_start('sh', {exit_cb: (job: job, status: number): void => {
|
||||
# If any installations failed, keep the terminal window open so we can
|
||||
# troubleshoot. If they all worked fine, close the terminal and reload the
|
||||
# LSP configuration.
|
||||
if status == 0
|
||||
execute 'bdelete' job->ch_getbufnr('out')
|
||||
Configure()
|
||||
endif
|
||||
}})
|
||||
|
||||
# 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
|
||||
# understand exactly what the install script is doing.
|
||||
term->term_sendkeys(installScript)
|
||||
enddef
|
96
dot-config/vim/plugins.vim
Normal file
96
dot-config/vim/plugins.vim
Normal file
|
@ -0,0 +1,96 @@
|
|||
vim9script
|
||||
silent! packadd minpac
|
||||
if !exists('g:loaded_minpac')
|
||||
silent !git clone https://github.com/k-takata/minpac.git $XDG_CACHE_HOME/vim/pack/minpac/opt/minpac
|
||||
augroup minpac
|
||||
autocmd!
|
||||
autocmd VimEnter * ++once minpac#update()
|
||||
augroup END
|
||||
endif
|
||||
packadd minpac
|
||||
|
||||
minpac#init({dir: $XDG_CACHE_HOME .. '/vim'})
|
||||
minpac#add('k-takata/minpac', {type: 'opt'})
|
||||
minpac#add('tpope/vim-sensible')
|
||||
minpac#add('prabirshrestha/async.vim')
|
||||
|
||||
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('godlygeek/tabular')
|
||||
minpac#add('jamessan/vim-gnupg')
|
||||
minpac#add('junegunn/vim-easy-align')
|
||||
minpac#add('lifepillar/vim-mucomplete')
|
||||
minpac#add('lotabout/skim')
|
||||
minpac#add('lotabout/skim.vim')
|
||||
minpac#add('mhinz/vim-signify')
|
||||
minpac#add('sjl/vitality.vim')
|
||||
minpac#add('tpope/vim-apathy')
|
||||
minpac#add('tpope/vim-commentary')
|
||||
minpac#add('tpope/vim-dadbod')
|
||||
minpac#add('tpope/vim-endwise')
|
||||
minpac#add('tpope/vim-eunuch')
|
||||
minpac#add('tpope/vim-fugitive')
|
||||
minpac#add('tpope/vim-repeat')
|
||||
minpac#add('tpope/vim-rhubarb')
|
||||
minpac#add('tpope/vim-sleuth')
|
||||
minpac#add('tpope/vim-surround')
|
||||
minpac#add('tpope/vim-unimpaired')
|
||||
|
||||
minpac#add('wincent/loupe')
|
||||
minpac#add('wincent/terminus')
|
||||
minpac#add('w0rp/ale')
|
||||
|
||||
minpac#add('yegappan/lsp')
|
||||
minpac#add('00dani/SchemaStore.vim')
|
||||
|
||||
minpac#add('rbong/vim-crystalline')
|
||||
minpac#add('lambdalisue/battery.vim')
|
||||
minpac#add('lambdalisue/glyph-palette.vim')
|
||||
minpac#add('lambdalisue/nerdfont.vim')
|
||||
|
||||
minpac#add('lambdalisue/fern.vim')
|
||||
minpac#add('lambdalisue/fern-hijack.vim')
|
||||
minpac#add('lambdalisue/fern-renderer-nerdfont.vim')
|
||||
minpac#add('lambdalisue/fern-git-status.vim')
|
||||
minpac#add('lambdalisue/fern-ssh')
|
||||
|
||||
minpac#add('alvan/vim-closetag')
|
||||
minpac#add('LaTeX-Box-Team/LaTeX-Box')
|
||||
minpac#add('vhda/verilog_systemverilog.vim')
|
||||
minpac#add('sheerun/vim-polyglot')
|
||||
|
||||
minpac#add('eipipuz/factor.vim')
|
||||
|
||||
minpac#add('ehamberg/vim-cute-python')
|
||||
minpac#add('Glench/Vim-Jinja2-Syntax')
|
||||
minpac#add('tweekmonster/braceless.vim')
|
||||
|
||||
minpac#add('vito-c/jq.vim')
|
||||
minpac#add('NoahTheDuke/vim-just')
|
||||
|
||||
minpac#add('fladson/vim-kitty')
|
||||
|
||||
minpac#add('fpob/nette.vim')
|
||||
|
||||
minpac#add('leafOfTree/vim-svelte-plugin')
|
||||
|
||||
if executable('task')
|
||||
minpac#add('farseer90718/vim-taskwarrior')
|
||||
endif
|
||||
|
||||
minpac#add('pedrohdz/vim-yaml-folds')
|
||||
|
||||
minpac#add('alx741/yesod.vim')
|
||||
minpac#add('pbrisbin/vim-syntax-shakespeare')
|
||||
|
||||
if has('macunix')
|
||||
minpac#add('rizzatti/dash.vim')
|
||||
# We rename this plugin to make sure it loads AFTER vim-polyglot,
|
||||
# since it won't work properly if it's loaded first.
|
||||
minpac#add('itspriddle/vim-marked', {name: 'zzvim-marked'})
|
||||
endif
|
131
dot-config/vim/statusline.vim
Normal file
131
dot-config/vim/statusline.vim
Normal file
|
@ -0,0 +1,131 @@
|
|||
vim9script
|
||||
|
||||
import autoload ($XDG_CACHE_HOME .. '/vim/pack/minpac/start/vim-crystalline/autoload/crystalline.vim') as cr
|
||||
|
||||
def DropIfDefault(status: string, default: string): string
|
||||
if status == default
|
||||
return ''
|
||||
endif
|
||||
return status
|
||||
enddef
|
||||
|
||||
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()->DropIfDefault(g:nerdfont#default)->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: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()->DropIfDefault(g:nerdfont#default)->PrependIfVisible(' ')
|
||||
const iconWidth = strchars(icon)
|
||||
if width + iconWidth >= maxWidth
|
||||
return [tabDisplay, width]
|
||||
endif
|
||||
|
||||
return [icon .. tabDisplay, width + iconWidth]
|
||||
enddef
|
||||
enddef
|
||||
|
||||
export def Init(): void
|
||||
InitStatus()
|
||||
InitTab()
|
||||
ConfigurePlugins()
|
||||
set noshowmode
|
||||
enddef
|
Loading…
Add table
Add a link
Reference in a new issue