Fix some things, mainly statusline and minor colorscheme tweaks

This commit is contained in:
Daniel Flanagan 2021-07-06 00:53:57 -05:00
parent 291e531f87
commit 1ad2af5824
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
7 changed files with 68 additions and 34 deletions

View file

@ -1,3 +1,3 @@
#!/usr/bin/env sh
d="$(command ls $ENV_PATH | fzf)"
d="$(command ls $ENV_PATH | fzf)" && \
tmux-lyte-session "env-$d" "$ENV_PATH/$d"

View file

@ -1,4 +1,5 @@
#!/usr/bin/env fish
set session_name $argv[1]
set dir (set -q $argv[2] && echo $argv2 || pwd)
tmux new-session -D -s $session_name -c $dir || \

View file

@ -2,6 +2,8 @@ font_family Iosevka
bold_font Iosevka Heavy
font_size 11.0
font_features Iosevka -calt +FSTA +MTLB +HSKL +JSPT +dlig
allow_remote_control yes
repaint_delay 5
input_delay 5

View file

@ -1,13 +0,0 @@
{
"coc.preferences.formatOnSaveFiletypes": ["ex", "exs", "elixir"],
"diagnostic-languageserver.filetypes": {
"elixir": ["mix_credo", "mix_credo_compile"],
"eelixir": ["mix_credo", "mix_credo_compile"],
"sh": "shellcheck"
},
"diagnostic-languageserver.formatFiletypes": {
"sh": "shfmt"
},
"elixir.pathToElixirLS": "~/.elixir-ls/release/language_server.sh",
"codeLens.enable": true
}

View file

@ -22,15 +22,20 @@ syntax reset
hi normal cterm=none ctermfg=7
hi bold cterm=bold
" hi statusline cterm=none ctermfg=7 ctermbg=18
hi statusline cterm=none ctermfg=7 ctermbg=18
hi activebuffer cterm=none ctermfg=7 ctermbg=18
hi statuslinenc cterm=none ctermfg=18 ctermbg=0
hi inactivebuffer cterm=none ctermbg=18 ctermfg=7
hi activebuffer cterm=none ctermfg=0 ctermbg=4
hi dirtybuffer cterm=none ctermfg=0 ctermbg=1
hi activedirtybuffer cterm=none ctermfg=0 ctermbg=3
hi linenr cterm=none ctermfg=18
hi indentblanklinechar cterm=none ctermfg=18
hi signcolumn cterm=none ctermfg=18 ctermbg=0
hi matchparen cterm=none ctermbg=5 ctermfg=0
hi search cterm=bold ctermbg=4
hi LspDiagnosticsSignWarning cterm=none ctermfg=1 ctermbg=0
hi lspdiagnosticsvirtualtextwarning cterm=none ctermfg=1 ctermbg=0
hi todo cterm=none ctermfg=7 ctermbg=18
hi comment cterm=none ctermfg=18
hi keyword cterm=none ctermfg=7
hi operator cterm=none ctermfg=7
@ -43,15 +48,27 @@ hi conditional cterm=none ctermfg=1 ctermbg=0
hi structure cterm=none ctermfg=4 ctermbg=0
hi special cterm=none ctermfg=5 ctermbg=0
hi preproc cterm=none ctermfg=1 ctermbg=0
hi identifier cterm=none ctermfg=6 ctermbg=0
hi identifier cterm=none ctermfg=4 ctermbg=0
hi constant cterm=none ctermfg=1
hi nontext ctermfg=0 ctermbg=0
" TODO: diagnostics popups, telescope dialogs
hi matchparen cterm=reverse ctermfg=7 ctermbg=0
hi search cterm=reverse ctermfg=7 ctermbg=0
hi LspDiagnosticsSignWarning cterm=none ctermfg=1 ctermbg=0
hi lspdiagnosticsvirtualtextwarning cterm=none ctermfg=1 ctermbg=0
hi todo cterm=none ctermfg=7 ctermbg=18
hi TelescopeBorder ctermfg=18
hi TelescopePromptBorder ctermfg=18
hi TelescopeResultsBorder ctermfg=18
hi TelescopePreviewBorder ctermfg=18
hi TelescopeSelection ctermbg=18 ctermfg=7
hi TelescopeSelectionCaret ctermfg=7
hi TelescopeMultiSelection ctermfg=7
hi TelescopeNormal ctermfg=7
hi TelescopeMatching ctermfg=0 ctermbg=4
hi TelescopePromptPrefix guifg=red
" vim tui elements
" call <sid>hi('Debug', s:gui08, '', s:cterm08, '', '', '')

View file

@ -10,9 +10,28 @@ require('fold').setup()
-- require('lsp').setup()
require('statusline').setup()
function Dbg(a, d)
if d == nil then d = 0 end
if type(a) == 'table' then
local s = '{\n'
local indent = string.rep(' ', d)
for k,v in pairs(a) do
s = s .. ' ' .. indent .. tostring(k) .. '=' .. Dbg(v, d+1) .. '\n'
end
return s .. '\n' .. indent .. '}'
elseif type(a) == 'string' then
return a
elseif type(a) == 'number' then
return tostring(a)
else
return 'type:'..type(a)..',tostring:'..tostring(a)
end
end
local plugin_setups = {
telescope = {
defaults = {
prompt_prefix = "",
mappings = {i = {['c-u'] = false, ['c-d'] = false}},
generic_sorter = require('telescope.sorters').get_fzy_sorter,
file_sorter = require('telescope.sorters').get_fzy_sorter,

View file

@ -4,25 +4,28 @@ local status_line_max_length = 5
-- TODO: only update this portion when needed instead of every render?
local status_line_buffer_by_num = function(bufnum)
local bufinfo = fn.getbufinfo(bufnum)
local is_active = false
local bufinfo = fn.getbufinfo(bufnum)[1]
local prefix = ' %#InactiveBuffer#'
local suffix = '%* '
if bufinfo.changed then
if bufinfo.changed == 1 then
prefix = '%#DirtyBuffer# '
suffix = ' %*'
end
if bufinfo.hidden == 0 and fn.index(bufinfo.windows, vim.g.statusline_winid) >= 0 then
local windex = fn.index(bufinfo.windows, vim.g.statusline_winid)
if bufinfo.hidden and windex >= 0 then
is_active = true
prefix = '%#ActiveBuffer# '
suffix = ' %*'
if bufinfo.changed then
prefix = '%#ActiveBuffer# *'
if bufinfo.changed == 1 then
prefix = '%#ActiveDirtyBuffer# *'
suffix = ' %*'
end
end
return prefix .. fn.fnamemodify(fn.bufname(bufnum), ':t') .. suffix
return (prefix .. fn.fnamemodify(fn.bufname(bufnum), ':t') .. suffix), is_active
end
local status_line_buffers = function()
@ -31,12 +34,12 @@ local status_line_buffers = function()
local active_index = -1
local acc = {}
for _,bufnum in ipairs(api.nvim_list_bufs()) do
local bufinfo = fn.getbufinfo(bufnum)
local bufinfo = fn.getbufinfo(bufnum)[1]
if bufinfo.listed ~= 0 then
local entry = status_line_buffer_by_num(bufnum)
local entry, is_active = status_line_buffer_by_num(bufnum)
table.insert(acc, entry)
if fn.matchstr(entry, '^%#ActiveBuffer#') then
active_index = fn.index(acc, entry)
if is_active then
active_index = #acc
end
end
end
@ -57,7 +60,12 @@ local status_line_buffers = function()
end
return prefix .. buflist .. suffix
else
return table.concat(acc, '')
local suffix = ''
if #acc - 1 >status_line_max_length then
suffix = ' >'
end
local buflist = table.concat({unpack(acc, 1, math.min(#acc, status_line_max_length))}, '')
return buflist .. suffix .. active_index
end
end