More WIP
This commit is contained in:
parent
780686f185
commit
aeddca41b1
|
@ -1,2 +1,2 @@
|
|||
#!/usr/bin/env sh
|
||||
tmux new-session -s dotfiles -c "$DOTFILES_PATH"
|
||||
#!/usr/bin/env fish
|
||||
tmux-lyte-session dotfiles $DOTFILES_PATH
|
||||
|
|
3
common/bin/tenv
Executable file
3
common/bin/tenv
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env sh
|
||||
d="$(command ls $ENV_PATH | fzf)"
|
||||
tmux-lyte-session "env-$d" "$ENV_PATH/$d"
|
5
common/bin/tmux-lyte-session
Executable file
5
common/bin/tmux-lyte-session
Executable file
|
@ -0,0 +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 || \
|
||||
tmux attach-session -d -t $session_name
|
2
common/neovim/.gitignore
vendored
2
common/neovim/.gitignore
vendored
|
@ -2,6 +2,6 @@
|
|||
!/.gitignore
|
||||
!/init.vim
|
||||
!/init.lua
|
||||
!/nvim_lsp.lua
|
||||
!/ftplugin
|
||||
!/lua
|
||||
!/coc-settings.json
|
||||
|
|
|
@ -228,6 +228,6 @@ require('telescope').setup{
|
|||
}
|
||||
}
|
||||
|
||||
require('fold').setup()
|
||||
require('statusline').setup()
|
||||
require('lsp').setup()
|
||||
require('./fold').setup()
|
||||
require('./statusline').setup()
|
||||
require('./lsp').setup()
|
||||
|
|
12
common/neovim/lua/fold.lua
Normal file
12
common/neovim/lua/fold.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
function NeatFoldText()
|
||||
-- TODO: finish this!
|
||||
-- local lines_count = vim.foldend - vim.foldstart + 1
|
||||
-- local foldchar = vim.fn.matchstr(vim.fillchars, 'fold:\\zs.')
|
||||
-- local foldtextstart = vim.fn.strpart('^' . repeat(foldchar, v:foldlevel*2) . line, 0, (winwidth(0)*2)/3)
|
||||
-- let foldtextend = printf("%s %".(winwidth(0)-20)."dL", foldtextstart, getline(v:foldstart), lines_count)
|
||||
-- let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn
|
||||
-- return printf("%s%d", substitute(getline(v:foldstart), "^.", ">"), lines_count)
|
||||
end
|
||||
-- set foldtext=NeatFoldText()
|
||||
|
||||
return {setup = function() end}
|
86
common/neovim/lua/lsp.lua
Normal file
86
common/neovim/lua/lsp.lua
Normal file
|
@ -0,0 +1,86 @@
|
|||
local opts = {noremap=true, silent=true}
|
||||
|
||||
vim.api.nvim_set_keymap('n', '[g', '<Plug>(coc-diagnostic-prev)', opts)
|
||||
vim.api.nvim_set_keymap('n', ']g', '<Plug>(coc-diagnostic-next)', opts)
|
||||
|
||||
vim.api.nvim_set_keymap('n', 'gd', '<Plug>(coc-definition)', opts)
|
||||
vim.api.nvim_set_keymap('n', 'gy', '<Plug>(coc-type-definition)', opts)
|
||||
|
||||
local nvim_lsp = require('lspconfig')
|
||||
local on_attach = function(_client, bufnr)
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
local kmaps = {
|
||||
['gD']='<Cmd>lua vim.lsp.buf.declaration()<CR>'
|
||||
}
|
||||
|
||||
for k,v in pairs(kmaps) do
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', k, v, opts)
|
||||
end
|
||||
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||
end
|
||||
|
||||
local servers = {'clangd', 'rust_analyzer', 'pyright', 'tsserver'}
|
||||
for _, lsp in ipairs(servers) do
|
||||
nvim_lsp[lsp].setup{on_attach=on_attach}
|
||||
end
|
||||
|
||||
local sumneko_root_path = vim.fn.getenv('HOME')..'/.local/bin/sumneko_lua'
|
||||
local sumneko_binary_path = '/bin/linux/lua-language-server'
|
||||
nvim_lsp.sumneko_lua.setup{
|
||||
cmd={sumneko_root_path .. sumneko_binary_path, '-E', sumneko_root_path..'/main.lua'};
|
||||
on_attach=on_attach,
|
||||
settings={
|
||||
Lua={
|
||||
runtime={
|
||||
version='LuaJIT',
|
||||
path=vim.split(package.path, ';'),
|
||||
},
|
||||
diagnostics={
|
||||
globals={'vim'},
|
||||
},
|
||||
workspace={
|
||||
library={
|
||||
[vim.fn.expand('$VIMRUNTIME/lua')] = true,
|
||||
[vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.cmd "command! Format execute 'lua vim.lsp.buf.formatting()'"
|
||||
vim.o.completeopt = 'menuone,noinsert'
|
||||
|
||||
-- Compe setup
|
||||
require'compe'.setup{
|
||||
enabled=true,
|
||||
autocomplete=true,
|
||||
debug=false,
|
||||
min_length=1,
|
||||
preselect='enable',
|
||||
throttle_time=80,
|
||||
source_timeout=200,
|
||||
incomplete_delay=400,
|
||||
max_abbr_width=100,
|
||||
max_kind_width=100,
|
||||
max_menu_width=100,
|
||||
documentation=true,
|
||||
source={path=true, nvim_lsp=true},
|
||||
}
|
||||
|
||||
return {
|
||||
setup=function()
|
||||
end
|
||||
}
|
72
common/neovim/lua/statusline.lua
Normal file
72
common/neovim/lua/statusline.lua
Normal file
|
@ -0,0 +1,72 @@
|
|||
-- TODO: make override-able
|
||||
vim.g.status_line_max_length = 5
|
||||
|
||||
-- TODO: only update this portion when needed instead of every render?
|
||||
|
||||
function StatusLineBufferByNum(bufnum)
|
||||
local bufinfo = vim.fn.getbufinfo(bufnum)
|
||||
local prefix = ' %#InactiveBuffer#'
|
||||
local suffix = '%* '
|
||||
|
||||
if bufinfo.changed then
|
||||
prefix = '%#DirtyBuffer# '
|
||||
suffix = ' %*'
|
||||
end
|
||||
|
||||
if bufinfo.hidden == 0 and vim.fn.index(bufinfo.windows, vim.g.statusline_winid) >= 0 then
|
||||
prefix = '%#ActiveBuffer# '
|
||||
suffix = ' %*'
|
||||
if bufinfo.changed then
|
||||
prefix = '%#ActiveBuffer# *'
|
||||
suffix = ' %*'
|
||||
end
|
||||
end
|
||||
|
||||
return prefix..vim.fn.fnamemodify(vim.fn.bufname(bufnum), ':t')..suffix
|
||||
end
|
||||
|
||||
function StatusLineBuffers()
|
||||
-- TODO: mark buffers with unsaved changes
|
||||
|
||||
local active_index = -1
|
||||
local acc = {}
|
||||
for _,bufnum in ipairs(vim.api.nvim_list_bufs()) do
|
||||
local bufinfo = vim.fn.getbufinfo(bufnum)
|
||||
if bufinfo.listed ~= 0 then
|
||||
local entry = StatusLineBufferByNum(bufnum)
|
||||
table.insert(acc, entry)
|
||||
if vim.fn.matchstr(entry, '^%#ActiveBuffer#') then
|
||||
active_index = vim.fn.index(acc, entry)
|
||||
end
|
||||
end
|
||||
end
|
||||
if active_index >= 0 then
|
||||
-- TODO: instead implement this as a wraparound carousel?
|
||||
local offset = vim.g.status_line_max_length / 2
|
||||
local min_buf_num = math.max(0, (active_index - offset))
|
||||
local max_buf_num = math.min(#acc - 1, min_buf_num + vim.g.status_line_max_length - 1)
|
||||
min_buf_num = math.max(0, max_buf_num - vim.g.status_line_max_length + 1)
|
||||
local buflist = table.concat({unpack(acc, min_buf_num, max_buf_num)}, '')
|
||||
local prefix = ''
|
||||
local suffix = ''
|
||||
if min_buf_num > 0 then
|
||||
prefix = '< '
|
||||
end
|
||||
if max_buf_num < (#acc - 1) then
|
||||
suffix = ' >'
|
||||
end
|
||||
return prefix..buflist..suffix
|
||||
else
|
||||
return table.concat(acc, '')
|
||||
end
|
||||
end
|
||||
|
||||
function StatusLine()
|
||||
return StatusLineBuffers()..'%*%=%c,%l/%L (%p%%)'
|
||||
end
|
||||
|
||||
return {
|
||||
setup=function()
|
||||
vim.o.statusline = ''..StatusLine()
|
||||
end
|
||||
}
|
|
@ -32,6 +32,12 @@ profile desktop-ultrawide {
|
|||
exec "$HOME/.config/lytedev-dotfiles/apps/de/kanshi/desktop-single-workspace.sh"
|
||||
}
|
||||
|
||||
profile laptop-with-display {
|
||||
output "Sharp Corporation 0x144A 0x00000000" enable mode 1920x1080@60Hz position 0,0 scale 1 transform normal
|
||||
output DP-1 enable mode 1920x1080@60Hz position 0,0 scale 1 transform normal
|
||||
exec "$HOME/.config/lytedev-dotfiles/apps/de/kanshi/laptop-single-workspace.bash"
|
||||
}
|
||||
|
||||
profile laptop {
|
||||
output "Sharp Corporation 0x144A 0x00000000" enable mode 3200x1800@60Hz position 0,0 scale 2 transform normal
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
#!/usr/bin/env bash
|
||||
|
||||
move_workspace() { swaymsg workspace "$1"; swaymsg move workspace to "'$2'"; }
|
||||
|
|
6
os/linux/kanshi/laptop-single-workspace.bash
Normal file
6
os/linux/kanshi/laptop-single-workspace.bash
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
#!/usr/bin/env bash
|
||||
|
||||
move_workspace() { swaymsg workspace "$1"; swaymsg move workspace to "'$2'"; }
|
||||
setup_output() { out="$1"; shift; while (($#)); do move_workspace "$1" "$out"; shift; done; }
|
||||
setup_output eDP-1 1 2 3 4 5 6 7 8 9
|
Reference in a new issue