From 1ad2af5824f16b6d8167dea02cf82358bebf3d75 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Tue, 6 Jul 2021 00:53:57 -0500 Subject: [PATCH] Fix some things, mainly statusline and minor colorscheme tweaks --- common/bin/tenv | 4 ++-- common/bin/tmux-lyte-session | 1 + common/kitty/kitty.conf | 2 ++ common/neovim/coc-settings.json | 13 ------------- common/neovim/colors/donokai.vim | 33 ++++++++++++++++++++++++-------- common/neovim/init.lua | 19 ++++++++++++++++++ common/neovim/lua/statusline.lua | 30 ++++++++++++++++++----------- 7 files changed, 68 insertions(+), 34 deletions(-) delete mode 100644 common/neovim/coc-settings.json diff --git a/common/bin/tenv b/common/bin/tenv index 39fa9c8..49a4f7f 100755 --- a/common/bin/tenv +++ b/common/bin/tenv @@ -1,3 +1,3 @@ #!/usr/bin/env sh -d="$(command ls $ENV_PATH | fzf)" -tmux-lyte-session "env-$d" "$ENV_PATH/$d" +d="$(command ls $ENV_PATH | fzf)" && \ + tmux-lyte-session "env-$d" "$ENV_PATH/$d" diff --git a/common/bin/tmux-lyte-session b/common/bin/tmux-lyte-session index d3e67db..eb23a06 100755 --- a/common/bin/tmux-lyte-session +++ b/common/bin/tmux-lyte-session @@ -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 || \ diff --git a/common/kitty/kitty.conf b/common/kitty/kitty.conf index 16d8f6b..3901a49 100644 --- a/common/kitty/kitty.conf +++ b/common/kitty/kitty.conf @@ -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 diff --git a/common/neovim/coc-settings.json b/common/neovim/coc-settings.json deleted file mode 100644 index a80b71d..0000000 --- a/common/neovim/coc-settings.json +++ /dev/null @@ -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 -} diff --git a/common/neovim/colors/donokai.vim b/common/neovim/colors/donokai.vim index 7359a21..420776d 100644 --- a/common/neovim/colors/donokai.vim +++ b/common/neovim/colors/donokai.vim @@ -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 hi('Debug', s:gui08, '', s:cterm08, '', '', '') diff --git a/common/neovim/init.lua b/common/neovim/init.lua index e56ac36..add9d03 100644 --- a/common/neovim/init.lua +++ b/common/neovim/init.lua @@ -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, diff --git a/common/neovim/lua/statusline.lua b/common/neovim/lua/statusline.lua index 87522f8..5bc66c5 100644 --- a/common/neovim/lua/statusline.lua +++ b/common/neovim/lua/statusline.lua @@ -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