Merge remote-tracking branch 'origin/develop' into psox/arch
This commit is contained in:
commit
e2df4d1e48
|
@ -1,7 +1,12 @@
|
|||
{
|
||||
"cSpell.words": [
|
||||
"Alacritty",
|
||||
"Coms",
|
||||
"Iosevka",
|
||||
"MYVIMRC",
|
||||
"Psox",
|
||||
"VIMHOME",
|
||||
"VIMINIT",
|
||||
"Xuyuanp",
|
||||
"adelarsq",
|
||||
"ansible",
|
||||
|
@ -10,7 +15,10 @@
|
|||
"junegunn",
|
||||
"luochen",
|
||||
"neoclide",
|
||||
"neovim",
|
||||
"nvim",
|
||||
"pearofducks",
|
||||
"psoxizsh",
|
||||
"rakr",
|
||||
"romainl",
|
||||
"roxma",
|
||||
|
@ -18,6 +26,7 @@
|
|||
"sheerun",
|
||||
"syntastic",
|
||||
"tpope",
|
||||
"vimrc",
|
||||
"yarp"
|
||||
]
|
||||
}
|
85
README.md
85
README.md
|
@ -2,11 +2,49 @@
|
|||
|
||||
## About this
|
||||
|
||||
Over the years I have collect various bits from various locations. I often share what I have done with work colleagues and
|
||||
finally made this repository so people can pull the latest. if you already have an installation cd to the `~/.psoxizsh`
|
||||
directory and make sure you have not make any changes. If you have stash them and then run the following commands.
|
||||
Over the years I have collect various bits from various locations. I often share
|
||||
what I have done with work colleagues and finally made this repository so people
|
||||
can pull the latest.
|
||||
|
||||
This is optimized by default for dark terminals, and contains configurations for
|
||||
use with
|
||||
|
||||
- zsh >= v5.8
|
||||
- neovim >= v0.6
|
||||
- tmux >= 3.2
|
||||
|
||||
All of these have standard setting but can be customized by using optional
|
||||
include files. Please read the following configs
|
||||
|
||||
- `vimrc`
|
||||
- `zshrc`
|
||||
- `tmux/tmux.conf`
|
||||
|
||||
and look at the include files to check for overrides.
|
||||
|
||||
## Looks
|
||||
|
||||
For the best appearance I have tested the latest versions of
|
||||
|
||||
- Konsole
|
||||
- Microsoft Terminal
|
||||
- WezTerm
|
||||
- Kitty (the Linux version, not the on based of putty)
|
||||
- Alacritty (Windows and Linux)
|
||||
|
||||
I have previously used this on iTerm2 on MacOS but not recently.
|
||||
|
||||
I also use the _Iosevka Term Curly_ font on both Linux and Windows with
|
||||
ligatures enabled where possible.
|
||||
|
||||
## Updates
|
||||
|
||||
If you already have an installation cd to the `~/.psoxizsh` or `/etc/psoxizsh`
|
||||
as root directory and make sure you have not make any changes. If you have stash
|
||||
them and then run the following commands.
|
||||
|
||||
```bash
|
||||
|
||||
(
|
||||
git pull --recurse-submodules=yes
|
||||
git submodule foreach git fetch --all --prune
|
||||
|
@ -25,8 +63,9 @@ src
|
|||
|
||||
```bash
|
||||
|
||||
git clone --recurse-submodules --recursive --config http.sslVerify=false https://github.com/psox/psoxizsh.git ~/.psoxizsh
|
||||
git clone --recurse-submodules --recursive https://github.com/psox/psoxizsh.git ~/.psoxizsh
|
||||
|
||||
# This should work on Linux. It is not tested on MacOS or Windows
|
||||
~/.psoxizsh/fresh-system
|
||||
|
||||
```
|
||||
|
@ -36,16 +75,23 @@ git clone --recurse-submodules --recursive --config http.sslVerify=false https:/
|
|||
```bash
|
||||
|
||||
# Make sure you are root
|
||||
git clone --recurse-submodules --recursive --config http.sslVerify=false https://github.com/psox/psoxizsh.git /etc/psoxizsh
|
||||
git clone --recurse-submodules --recursive https://github.com/psox/psoxizsh.git /etc/psoxizsh
|
||||
|
||||
# for each user that wants to use this
|
||||
# This should work on Linux. It is not tested on MacOS or Windows
|
||||
# for each user that wants to use this as the user run this command
|
||||
/etc/psoxizsh/fresh-system
|
||||
|
||||
```
|
||||
|
||||
## Configure Vim or NeoVim
|
||||
## Configure NeoVim
|
||||
|
||||
Make sure you have vim 8 installed and after starting zsh check that the following variable are set by typing
|
||||
Make sure you have neovim (tested on v0.6.1) installed and after starting zsh
|
||||
check that the following variable are set by typing
|
||||
|
||||
You will need to install `neovim`, `nodejs` and `npm` to get the full use of vim
|
||||
|
||||
Just start neovim (`nvim`) and wait for it to finish. After that quit and it
|
||||
should be ready to use.
|
||||
|
||||
```bash
|
||||
echo $VIMINIT
|
||||
|
@ -53,27 +99,4 @@ echo $MYVIMRC
|
|||
echo $VIMHOME
|
||||
```
|
||||
|
||||
Also check your `/etc/vimrc` or `/etc/vim/vimrc` to see if they do something funny. A good example of a
|
||||
`vimrc` that can be appended to the end of the `vimrc` file off the `/etc` directory
|
||||
can be found in `~/.psoxizsh/etc/`.
|
||||
|
||||
If these are not set try adding the following to the beginning of your `~/.zshrc` file.
|
||||
|
||||
```bash
|
||||
export VIMINIT='source $MYVIMRC'
|
||||
export MYVIMRC=$HOME/.psoxizsh/vimrc
|
||||
export VIMHOME=$HOME/.psoxizsh/vim
|
||||
```
|
||||
|
||||
Once these values are set in your environment you can start vim and type.
|
||||
|
||||
```viml
|
||||
:PlugInstall
|
||||
```
|
||||
|
||||
Exit vim and start again, if you get an error with the YouCompleteMe plugin, go to the
|
||||
[You Complete Me](https://github.com/Valloric/YouCompleteMe#full-installation-guide)
|
||||
page and see if you can fix it. Normally install a more complete version of vim will
|
||||
solve the problem.
|
||||
|
||||
Enjoy
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
(
|
||||
cd ~
|
||||
[[ ! -e ~/.zshrc ]] && touch ~/.zshrc
|
||||
install -v --mode=700 -d ~/.ssh
|
||||
install -v -m 0700 -d ~/.ssh
|
||||
grep -E '^source (/etc/psoxizsh|~/.psoxizsh)/zshrc' ~/.zshrc 2>/dev/null >/dev/null
|
||||
if [[ $? -ne 0 ]]
|
||||
then
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
vim.opt.rtp:append( os.getenv('PSOXIZSH') .. '/nvim' )
|
||||
|
||||
require 'psoxizsh'
|
|
@ -0,0 +1,126 @@
|
|||
|
||||
local M = { mt = {} }
|
||||
local Groups = {}
|
||||
local Group = { mt = {} }
|
||||
local AutoCmd = { mt = {} }
|
||||
|
||||
local __builtin_support = vim.fn.has('nvim-0.7') == 1
|
||||
|
||||
-- Use the recent builtin APIs provided by neovim itself
|
||||
local function builtin(group, autos)
|
||||
vim.api.nvim_create_augroup(group, {})
|
||||
|
||||
for _, auto in ipairs(autos) do
|
||||
local opts = auto.opts or {}
|
||||
opts.group = group
|
||||
opts.pattern = auto.pattern
|
||||
|
||||
if type(auto.command) == "string" then
|
||||
opts.command = auto.command
|
||||
elseif type(auto.command) == "function" then
|
||||
opts.callback = auto.command
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd(auto.event, opts)
|
||||
end
|
||||
end
|
||||
|
||||
-- Use an old library to make the autos
|
||||
-- Note that relies on the local package manager to ensure this plugin is available
|
||||
local function polyfill(group, autos)
|
||||
local poly = require 'autocmd-lua'
|
||||
local autocmds = {}
|
||||
|
||||
for _, auto in ipairs(autos) do
|
||||
local events = auto.event
|
||||
|
||||
if type(auto.event) == "string" then
|
||||
events = { auto.event }
|
||||
end
|
||||
|
||||
for _, e in ipairs(events) do
|
||||
table.insert(autocmds, { event = e, pattern = auto.pattern, cmd = auto.command })
|
||||
end
|
||||
end
|
||||
|
||||
poly.augroup {
|
||||
group = group,
|
||||
autocmds = autocmds,
|
||||
}
|
||||
end
|
||||
|
||||
local autocmd = __builtin_support and builtin or polyfill
|
||||
|
||||
function M.new()
|
||||
local m = {}
|
||||
setmetatable(m, M.mt)
|
||||
|
||||
return m
|
||||
end
|
||||
|
||||
function M.mt.__index(_, group)
|
||||
if Groups[group] ~= nil then
|
||||
return Groups[group]
|
||||
else
|
||||
-- Create a group object that uses the autocmd function on being called.
|
||||
-- This object should take the list of objects provided to it, insert
|
||||
-- them into it's local storage and then execute autocmd on them
|
||||
return Group.new(group)
|
||||
end
|
||||
end
|
||||
|
||||
-- Spawn a new Group with the given name
|
||||
function Group.new(name)
|
||||
local g = { __name = name, __autos = {} }
|
||||
setmetatable(g, Group.mt)
|
||||
Groups[name] = g
|
||||
|
||||
return g
|
||||
end
|
||||
|
||||
-- Insert a new auto command object spec into the provided Group's list
|
||||
function Group.insert(self, cmd)
|
||||
if not cmd.disable then
|
||||
table.insert(self.__autos, {
|
||||
command = table.remove(cmd, 3),
|
||||
pattern = table.remove(cmd, 2),
|
||||
event = table.remove(cmd, 1),
|
||||
opts = cmd
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
-- Spawn a new AutoCmd with the given event name, currying the parent group's name
|
||||
function Group.mt.__index(self, event)
|
||||
return AutoCmd.new(self, event)
|
||||
end
|
||||
|
||||
-- Allows module users to pass a Group a list of auto command parameters
|
||||
function Group.mt.__call(self, command_like)
|
||||
if type(command_like) == "function" then
|
||||
command_like(self)
|
||||
elseif type(command_like) == "table" then
|
||||
for _, auto in ipairs(command_like) do
|
||||
Group.insert(self, auto)
|
||||
end
|
||||
end
|
||||
|
||||
autocmd(self.__name, self.__autos)
|
||||
end
|
||||
|
||||
-- Create a new dummy object that stores its group and event
|
||||
-- Used to allow for currying of autocmd parameters
|
||||
function AutoCmd.new(group, event)
|
||||
local a = { __group = group, __event = event }
|
||||
setmetatable(a, AutoCmd.mt)
|
||||
|
||||
return a
|
||||
end
|
||||
|
||||
-- Add the given partial arg list passed to this AutoCmd to the correct group
|
||||
function AutoCmd.mt.__call(self, args)
|
||||
table.insert(args, 1, self.__event)
|
||||
Group.insert(self.__group, args)
|
||||
end
|
||||
|
||||
return M.new()
|
|
@ -0,0 +1,196 @@
|
|||
local o, g, fn, cmd = vim.opt, vim.g, vim.fn, vim.cmd
|
||||
local au, util = require 'psoxizsh.autocmd', require 'psoxizsh.util'
|
||||
|
||||
local function psoxizsh_early_config()
|
||||
-- Local early configuration
|
||||
util.try_mreload('early')
|
||||
|
||||
-- Set global color scheme var
|
||||
if not g.my_color_scheme then
|
||||
g.my_color_scheme = 'one'
|
||||
end
|
||||
|
||||
-- Hide buffers don't close them
|
||||
o.hidden = true
|
||||
|
||||
-- Sane pane opening
|
||||
o.splitbelow = true
|
||||
o.splitright = true
|
||||
|
||||
-- File indent opts
|
||||
o.encoding = "utf-8"
|
||||
|
||||
o.shiftwidth = 2
|
||||
o.tabstop = 8
|
||||
o.softtabstop = 2
|
||||
o.expandtab = true
|
||||
|
||||
o.list = true
|
||||
o.listchars:append {
|
||||
trail = '\u{02FD}',
|
||||
extends = '\u{22B3}',
|
||||
precedes = '\u{22B2}',
|
||||
nbsp = '\u{02EC}',
|
||||
conceal = '\u{2219}',
|
||||
tab = '\u{2559}\u{254C}\u{2556}',
|
||||
}
|
||||
|
||||
o.ignorecase = true
|
||||
o.infercase = true
|
||||
|
||||
cmd 'filetype plugin indent on'
|
||||
|
||||
-- Set completion messages off
|
||||
o.shortmess:append { c = true }
|
||||
|
||||
-- Preview window + menu for autocompletions
|
||||
o.completeopt:append {
|
||||
'preview',
|
||||
'menuone',
|
||||
'longest',
|
||||
}
|
||||
|
||||
-- Lower update time (Default 4000)
|
||||
o.updatetime = 300
|
||||
|
||||
-- Numbered lines
|
||||
o.number = true
|
||||
o.relativenumber = true
|
||||
|
||||
o.signcolumn = 'yes:1'
|
||||
|
||||
-- Disable '--INSERT--' and friends
|
||||
o.showmode = false
|
||||
|
||||
-- Use existing buffers
|
||||
o.switchbuf = { "useopen", "usetab" }
|
||||
|
||||
-- Set global statusline (0.7+ only)
|
||||
if fn.has('nvim-0.7') == 1 then o.laststatus = 3 end
|
||||
|
||||
-- Local pre plugin configuration
|
||||
util.try_mreload('pre')
|
||||
end
|
||||
|
||||
-- Load plugins
|
||||
|
||||
local function psoxizsh_post_config(plugs)
|
||||
local vimp = require 'vimp'
|
||||
-- Local post plugin configuration
|
||||
util.try_mreload('post')
|
||||
|
||||
-- Setup file backups
|
||||
cmd ':silent !mkdir -p ~/.vimbackup'
|
||||
o.backupdir = fn.expand('~') .. '/.vimbackup'
|
||||
o.directory = fn.expand('~') .. '/.vimbackup'
|
||||
|
||||
o.hlsearch = true
|
||||
|
||||
-- ripgrep settings
|
||||
g.rg_highlight = 'true'
|
||||
g.rg_derive_root = 'true'
|
||||
|
||||
-- Other
|
||||
g.rainbow_active = 1
|
||||
|
||||
au.PsoxFileAutos {
|
||||
{ 'FileType', 'yaml', 'setlocal indentkeys-=<:> ts=8 sts=2 sw=2 expandtab' },
|
||||
{ 'FileType', 'go', 'setlocal ts=8 sts=4 sw=4 noexpandtab' },
|
||||
{ 'FileType', 'quickfix,netrw', 'setlocal nobuflisted' },
|
||||
{ 'FileType', 'netrw', function() require('vimp').nmap({'buffer', 'silent'}, '<ESC>', ':call CloseNetrw()<CR>') end },
|
||||
}
|
||||
|
||||
cmd([[
|
||||
function! CloseNetrw() abort
|
||||
for bufn in range(1, bufnr('$'))
|
||||
if bufexists(bufn) && getbufvar(bufn, '&filetype') ==# 'netrw'
|
||||
silent! execute 'bwipeout ' . bufn
|
||||
if getline(2) =~# '^" Netrw '
|
||||
silent! bwipeout
|
||||
endif
|
||||
return
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
]])
|
||||
|
||||
if plugs:has('fzf') then
|
||||
if fn.executable('rg') == 1 then
|
||||
vimp.nnoremap('<A-g>', ':Rg ')
|
||||
vimp.nnoremap('<leader><A-g>', ':Rg! ')
|
||||
vimp.nnoremap({'silent'}, '<A-S-g>', ':Rg<CR>')
|
||||
vimp.nnoremap({'silent'}, '<leader><A-S-g>', ':Rg!<CR>')
|
||||
end
|
||||
|
||||
vimp.nnoremap('<A-f>', ':Files ')
|
||||
vimp.nnoremap('<leader><A-f>', ':Files! ')
|
||||
vimp.nnoremap({'silent'}, '<A-S-f>', ':Files<CR>')
|
||||
vimp.nnoremap({'silent'}, '<leader><A-S-f>', ':Files!<CR>')
|
||||
|
||||
vimp.nnoremap('<A-b>', ':Buffers ')
|
||||
vimp.nnoremap('<leader><A-b>', ':Buffers! ')
|
||||
vimp.nnoremap({'silent'}, '<A-S-b>', ':Buffers<CR>')
|
||||
vimp.nnoremap({'silent'}, '<leader><A-S-b>', ':Buffers!<CR>')
|
||||
end
|
||||
|
||||
-- Workaround for writing readonly files
|
||||
vimp.cnoremap({'silent'}, 'w!!', 'w !sudo tee % >/dev/null')
|
||||
|
||||
-- Open any known user configuration paths for editing
|
||||
vimp.nnoremap({'silent'}, '<leader>ve', function()
|
||||
local rtp = vim.fn.join(o.runtimepath:get(), ',')
|
||||
local files = {
|
||||
early = vim.fn.globpath(rtp, '/lua/early.lua', 0, 1)[1] or nil,
|
||||
pre = vim.fn.globpath(rtp, '/lua/pre.lua', 0, 1)[1] or nil,
|
||||
post = vim.fn.globpath(rtp, '/lua/post.lua', 0, 1)[1] or nil,
|
||||
late = vim.fn.globpath(rtp, '/lua/late.lua', 0, 1)[1] or nil,
|
||||
my = os.getenv("MYVIMRC") or nil,
|
||||
}
|
||||
|
||||
for _, file in pairs(files) do
|
||||
if vim.fn.filereadable(file) == 1 then
|
||||
cmd('edit ' .. file)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Toggles all gutter items
|
||||
vimp.nnoremap({'silent'}, '<leader>N', function()
|
||||
if o.number:get() then
|
||||
o.number = false
|
||||
o.relativenumber = false
|
||||
o.signcolumn = 'no'
|
||||
else
|
||||
o.number = true
|
||||
o.relativenumber = true
|
||||
o.signcolumn = 'yes:1'
|
||||
end
|
||||
end)
|
||||
|
||||
-- Reload configuration
|
||||
vimp.nnoremap('<leader>vs', function() vimp.unmap_all() plugs:reload() end)
|
||||
|
||||
o.background = 'dark'
|
||||
o.termguicolors = true
|
||||
g.one_allow_italics = 1
|
||||
cmd('highlight Comment term=italic cterm=italic gui=italic')
|
||||
end
|
||||
|
||||
local function psoxizsh_late_config(_)
|
||||
-- Local late configuration
|
||||
util.try_mreload('late')
|
||||
|
||||
-- Rest of config below is specifically not user override-able
|
||||
o.exrc = true
|
||||
o.secure = true
|
||||
o.modeline = true
|
||||
o.modelines = 7
|
||||
end
|
||||
|
||||
local hooks = {
|
||||
early = { 'PsoxConfigEarly', psoxizsh_early_config },
|
||||
post = { 'PsoxConfigPost', psoxizsh_post_config },
|
||||
late = { 'PsoxConfigLate', psoxizsh_late_config },
|
||||
}
|
||||
|
||||
return require('psoxizsh.plugins') { hooks = hooks }
|
|
@ -0,0 +1,24 @@
|
|||
local fn = vim.fn
|
||||
local install_path = fn.stdpath('data')..'/site/pack/packer/opt/packer.nvim'
|
||||
local repo_url = 'https://github.com/wbthomason/packer.nvim'
|
||||
local strapped = nil
|
||||
|
||||
-- Bootstraps our package manager, ensuring it is present on the local system
|
||||
local function bootstrap()
|
||||
local should_install = fn.empty(fn.glob(install_path)) > 0
|
||||
|
||||
if should_install then
|
||||
fn.system({'git', 'clone', '--depth', '1', repo_url, install_path})
|
||||
end
|
||||
|
||||
return should_install
|
||||
end
|
||||
|
||||
if not strapped then
|
||||
strapped = bootstrap()
|
||||
end
|
||||
|
||||
return function()
|
||||
return strapped
|
||||
end
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
return function()
|
||||
local bl, vimp, util = require 'bufferline', require 'vimp', require 'psoxizsh.util'
|
||||
|
||||
local defaults = {
|
||||
always_show_bufferline = true,
|
||||
numbers = "none",
|
||||
diagnostics = 'coc',
|
||||
offsets = {{
|
||||
filetype = 'neo-tree',
|
||||
text = 'File Explorer',
|
||||
text_align = 'center'
|
||||
}},
|
||||
show_buffer_close_icons = false,
|
||||
separator_style = { '\u{E0B0}', '\u{E0B1}' },
|
||||
sort_by = 'relative_directory',
|
||||
}
|
||||
|
||||
bl.setup { options = util.mconfig('config.bufferline', defaults) }
|
||||
|
||||
vimp.nnoremap({'silent'}, '<TAB>', ':BufferLineCycleNext<CR>')
|
||||
vimp.nnoremap({'silent'}, '<S-TAB>', ':BufferLineCyclePrev<CR>')
|
||||
vimp.nnoremap({'silent'}, '<leader><TAB>', ':BufferLinePick<CR>')
|
||||
end
|
|
@ -0,0 +1,103 @@
|
|||
return function()
|
||||
local fn, o, g = vim.fn, vim.opt, vim.g
|
||||
local vimp, au = require 'vimp', require 'psoxizsh.autocmd'
|
||||
|
||||
if fn.executable('node') == 0 then return end
|
||||
|
||||
local t = function(s)
|
||||
return vim.api.nvim_replace_termcodes(s, true, true, true)
|
||||
end
|
||||
local pumvisible = function()
|
||||
return fn.pumvisible() == 1
|
||||
end
|
||||
|
||||
g['coc_global_extensions'] = {
|
||||
'coc-yank',
|
||||
'coc-spell-checker',
|
||||
'coc-vimlsp',
|
||||
'coc-rust-analyzer',
|
||||
'coc-json',
|
||||
'coc-markdownlint',
|
||||
'coc-yaml'
|
||||
}
|
||||
|
||||
-- Do action on current word
|
||||
vimp.nmap({'silent'}, '<leader>.', '<Plug>(coc-codeaction-selected)w')
|
||||
|
||||
-- Do action on a selection
|
||||
vimp.nmap({'silent'}, '<leader>/', '<Plug>(coc-codeaction-selected)')
|
||||
vimp.xmap({'silent'}, '<leader>/', '<Plug>(coc-codeaction-selected)')
|
||||
|
||||
-- Rename symbol
|
||||
vimp.nmap({'silent'}, '<leader>rn', '<Plug>(coc-rename)')
|
||||
-- Goto definition / references
|
||||
vimp.nmap({'silent'}, '<leader>gd', '<Plug>(coc-definition)')
|
||||
vimp.nmap({'silent'}, '<leader>gr', '<Plug>(coc-references)')
|
||||
|
||||
-- Basically, we're checking to see if the column behind the current
|
||||
-- either doesn't exist or is whitespace
|
||||
local ck_backspace = function()
|
||||
local col = fn.col('.') - 1
|
||||
|
||||
return
|
||||
col == 0
|
||||
and true
|
||||
or fn.getline('.'):sub(col, col):match('%s')
|
||||
and true
|
||||
or false
|
||||
end
|
||||
|
||||
vimp.inoremap({'silent', 'expr'}, '<TAB>', function()
|
||||
return
|
||||
pumvisible()
|
||||
and t'<C-n>'
|
||||
or ck_backspace()
|
||||
and t'<TAB>'
|
||||
or fn['coc#refresh']()
|
||||
end)
|
||||
vimp.inoremap({'expr'}, '<S-TAB>', function()
|
||||
return pumvisible() and t'<C-p>' or t'<C-h>'
|
||||
end)
|
||||
|
||||
-- Use <c-space> to confirm completion, `<C-g>u` means break undo chain at current
|
||||
-- position. Coc only does snippet and additional edit on confirm.
|
||||
-- <c-space> could be remapped by other vim plugin, try `:verbose imap <CR>`.
|
||||
vimp.inoremap({'expr'}, '<C-Space>', function()
|
||||
local info =
|
||||
fn.exists('*complete_info') == 1
|
||||
and fn.complete_info().selected ~= -1
|
||||
or pumvisible()
|
||||
|
||||
return info and t'<C-y>' or t'<C-g>u<CR>'
|
||||
end)
|
||||
|
||||
-- Use `[g` and `]g` to navigate diagnostics
|
||||
vimp.nmap({'silent'}, '[g', '<Plug>(coc-diagnostic-prev)')
|
||||
vimp.nmap({'silent'}, ']g', '<Plug>(coc-diagnostic-next)')
|
||||
|
||||
if fn.has('nvim-0.4') then
|
||||
-- Remap PageUp and PageDown for scroll float windows/popups.
|
||||
vimp.nnoremap({'silent', 'nowait', 'expr'}, '<PageDown>', [[coc#float#has_scroll() ? coc#float#scroll(1) : "\<PageDown>"]])
|
||||
vimp.nnoremap({'silent', 'nowait', 'expr'}, '<PageUp>', [[coc#float#has_scroll() ? coc#float#scroll(0) : "\<PageUp>"]])
|
||||
end
|
||||
|
||||
-- Use K to show documentation in preview window.
|
||||
local show_documentation = function()
|
||||
if vim.tbl_contains({'vim', 'help'}, o.filetype:get()) then
|
||||
vim.cmd('help ' .. fn.expand(t'<cword>'))
|
||||
elseif vim.fn['coc#rpc#ready']() == 1 then
|
||||
vim.fn.CocActionAsync('doHover')
|
||||
else
|
||||
vim.cmd('!' .. o.keywordprg:get() .. ' ' .. fn.expand(t'<cword>'))
|
||||
end
|
||||
end
|
||||
vimp.nnoremap({'silent'}, 'K', show_documentation)
|
||||
|
||||
-- Open yank list
|
||||
vimp.nnoremap({'silent'}, '<C-Y>', t':<C-u>CocList -A --normal yank<CR>')
|
||||
|
||||
au.PsoxCocAutos {
|
||||
{ 'CursorHold', '*', function() fn.CocActionAsync('highlight') end },
|
||||
{ 'User', 'CocJumpPlaceholder', function() fn.CocActionAsync('showSignatureHelp') end },
|
||||
}
|
||||
end
|
|
@ -0,0 +1,35 @@
|
|||
return function()
|
||||
local fn, o, api = vim.fn, vim.o, vim.api
|
||||
|
||||
if fn.executable('rg') == 1 then
|
||||
-- Override the default grep implementation in vim
|
||||
o.grepprg = 'rg --vimgrep --smart-case --follow'
|
||||
|
||||
if fn.has('nvim-0.7') == 1 then
|
||||
-- Only search file contents, not file name
|
||||
-- We can use the stock :Files for that
|
||||
local rg_func = function(opts)
|
||||
return fn['fzf#vim#grep'](
|
||||
"rg --column --line-number --no-heading --color=always --smart-case " .. fn.shellescape(opts.args),
|
||||
true,
|
||||
fn['fzf#vim#with_preview']({options = '--delimiter : --nth 4..'}),
|
||||
opts.bang
|
||||
)
|
||||
end
|
||||
api.nvim_create_user_command('Rg', rg_func, { nargs = '*', bang = true })
|
||||
|
||||
-- If the user hasn't set a default FZF command, and has ripgrep installed,
|
||||
-- use it over find, otherwise defer to the user's preferred command
|
||||
if fn.empty(os.getenv('FZF_DEFAULT_COMMAND')) == 1 then
|
||||
local files_func = function(opts)
|
||||
return fn['fzf#vim#files'](
|
||||
opts.args,
|
||||
fn['fzf#vim#with_preview']({source = 'rg --files --hidden --glob "!**/.git/**" '}),
|
||||
opts.bang
|
||||
)
|
||||
end
|
||||
api.nvim_create_user_command('Files', files_func, { nargs = '?', bang = true, complete = 'dir' })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
return function()
|
||||
local gitsigns, util = require 'gitsigns', require 'psoxizsh.util'
|
||||
|
||||
local defaults = {
|
||||
sign_priority = 100,
|
||||
current_line_blame_formatter_opts = {
|
||||
relative_time = false
|
||||
},
|
||||
}
|
||||
|
||||
gitsigns.setup(util.mconfig('config.gitsigns', defaults))
|
||||
end
|
|
@ -0,0 +1,65 @@
|
|||
return function()
|
||||
local ll, util, nwd = require 'lualine', require 'psoxizsh.util', require("nvim-web-devicons")
|
||||
|
||||
local file_color = function()
|
||||
local _, color = nwd.get_icon_colors_by_filetype(vim.bo.filetype)
|
||||
|
||||
return { fg = color }
|
||||
end
|
||||
local diff_source = function()
|
||||
-- May be nil if gitsigns hasn't populated yet
|
||||
local gs = vim.b.gitsigns_status_dict or {}
|
||||
|
||||
return {
|
||||
added = gs.added,
|
||||
modified = gs.changed,
|
||||
removed = gs.removed,
|
||||
}
|
||||
end
|
||||
|
||||
local filename = {
|
||||
'filename',
|
||||
icon = 'ƒ',
|
||||
symbols = { modified = '|', readonly = '|', unnamed = '〜' },
|
||||
color = file_color,
|
||||
}
|
||||
local branch = { 'branch', icon = '', color = { gui = 'bold,italic' } }
|
||||
local diagnostics = { 'diagnostics', sources = { 'coc' }, update_in_insert = true }
|
||||
local diff = { 'diff', source = diff_source }
|
||||
|
||||
local defaults = {
|
||||
options = {
|
||||
theme = 'auto',
|
||||
icons_enabled = true,
|
||||
component_separators = { left = '', right = ''},
|
||||
section_separators = { left = '', right = ''},
|
||||
disabled_filetypes = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = true,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = { branch, diff, diagnostics },
|
||||
lualine_c = { filename },
|
||||
lualine_x = {'filetype', 'encoding', 'fileformat'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { filename },
|
||||
lualine_x = { 'location' },
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
extensions = { 'fugitive', 'quickfix', 'man', 'fzf', 'neo-tree' }
|
||||
}
|
||||
|
||||
ll.setup(util.mconfig('config.lualine', defaults))
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
return function()
|
||||
local g, fn = vim.g, vim.fn
|
||||
|
||||
-- Don't move cursor into qf/loc on open
|
||||
g.neomake_open_list = 2
|
||||
-- Allow multiple makers to resolve
|
||||
g.neomake_serialize = 1
|
||||
g.neomake_serialize_abort_on_error = 1
|
||||
|
||||
-- Let Neomake control window size
|
||||
g.qf_auto_resize = 0
|
||||
|
||||
fn['neomake#configure#automake']('rw', 800)
|
||||
end
|
|
@ -0,0 +1,162 @@
|
|||
return function()
|
||||
local g, fn = vim.g, vim.fn
|
||||
local neotree, util, vimp = require 'neo-tree', require 'psoxizsh.util', require 'vimp'
|
||||
|
||||
local defaults = {
|
||||
close_if_last_window = true,
|
||||
enable_git_status = true,
|
||||
default_component_configs = {
|
||||
container = {
|
||||
enable_character_fade = true
|
||||
},
|
||||
indent = {
|
||||
indent_size = 2,
|
||||
padding = 1, -- extra padding on left hand side
|
||||
-- indent guides
|
||||
with_markers = true,
|
||||
indent_marker = "│",
|
||||
last_indent_marker = "└",
|
||||
highlight = "NeoTreeIndentMarker",
|
||||
-- expander config, needed for nesting files
|
||||
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders
|
||||
expander_collapsed = "",
|
||||
expander_expanded = "",
|
||||
expander_highlight = "NeoTreeExpander",
|
||||
},
|
||||
icon = {
|
||||
folder_closed = "",
|
||||
folder_open = "",
|
||||
folder_empty = "ﰊ",
|
||||
-- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there
|
||||
-- then these will never be used.
|
||||
default = "*",
|
||||
highlight = "NeoTreeFileIcon"
|
||||
},
|
||||
modified = {
|
||||
symbol = "[+]",
|
||||
highlight = "NeoTreeModified",
|
||||
},
|
||||
name = {
|
||||
trailing_slash = false,
|
||||
use_git_status_colors = true,
|
||||
highlight = "NeoTreeFileName",
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
-- Change type
|
||||
added = "✚", -- or "✚", but this is redundant info if you use git_status_colors on the name
|
||||
modified = "~", -- or "", but this is redundant info if you use git_status_colors on the name
|
||||
deleted = "✖",-- this can only be used in the git_status source
|
||||
renamed = "",-- this can only be used in the git_status source
|
||||
-- Status type
|
||||
untracked = "",
|
||||
ignored = "",
|
||||
unstaged = "",
|
||||
staged = "",
|
||||
conflict = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
window = {
|
||||
position = "left",
|
||||
width = 40,
|
||||
mapping_options = {
|
||||
noremap = true,
|
||||
nowait = true,
|
||||
},
|
||||
mappings = {
|
||||
["?"] = "show_help",
|
||||
["q"] = "close_window",
|
||||
["R"] = "refresh",
|
||||
["<space>"] = { "toggle_node", nowait = false },
|
||||
["<cr>"] = "open",
|
||||
["S"] = "open_split",
|
||||
["s"] = "open_vsplit",
|
||||
["C"] = "close_node",
|
||||
["z"] = "close_all_nodes",
|
||||
["Z"] = "expand_all_nodes",
|
||||
["X"] = "delete",
|
||||
["r"] = "rename",
|
||||
["a"] = { "add", config = { show_path = "relative" } },
|
||||
["A"] = { "add_directory", config = { show_path = "relative" } },
|
||||
["c"] = { "copy", config = { show_path = "relative" } },
|
||||
["m"] = { "move", config = { show_path = "relative" } },
|
||||
["y"] = "copy_to_clipboard",
|
||||
["p"] = "paste_from_clipboard",
|
||||
},
|
||||
},
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
visible = false, -- when true, they will just be displayed differently than normal items
|
||||
hide_dotfiles = true,
|
||||
hide_gitignored = true,
|
||||
hide_hidden = true, -- only works on Windows for hidden files/directories
|
||||
hide_by_name = { --[[ Example: 'node_modules' ]] },
|
||||
hide_by_pattern = { --[[ Example '*.meta' ]] },
|
||||
never_show = { --[[ remains hidden even if visible is toggled to true ]] },
|
||||
},
|
||||
follow_current_file = true, -- This will find and focus the file in the active buffer every
|
||||
-- time the current file is changed while the tree is open.
|
||||
group_empty_dirs = false, -- when true, empty folders will be grouped together
|
||||
hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree
|
||||
-- in whatever position is specified in window.position
|
||||
-- "open_current", -- netrw disabled, opening a directory opens within the
|
||||
-- window like netrw would, regardless of window.position
|
||||
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
|
||||
use_libuv_file_watcher = true, -- This will use the OS level file watchers to detect changes
|
||||
-- instead of relying on nvim autocmd events.
|
||||
window = {
|
||||
mappings = {
|
||||
["<bs>"] = "navigate_up",
|
||||
["."] = "set_root",
|
||||
["H"] = "toggle_hidden",
|
||||
["/"] = "fuzzy_finder",
|
||||
["D"] = "fuzzy_finder_directory",
|
||||
["f"] = "filter_on_submit",
|
||||
["<c-x>"] = "clear_filter",
|
||||
["[g"] = "prev_git_modified",
|
||||
["]g"] = "next_git_modified",
|
||||
},
|
||||
},
|
||||
},
|
||||
buffers = {
|
||||
follow_current_file = true, -- This will find and focus the file in the active buffer every
|
||||
-- time the current file is changed while the tree is open.
|
||||
group_empty_dirs = true, -- when true, empty folders will be grouped together
|
||||
show_unloaded = true,
|
||||
window = {
|
||||
mappings = {
|
||||
["X"] = "buffer_delete",
|
||||
["<bs>"] = "navigate_up",
|
||||
["."] = "set_root",
|
||||
},
|
||||
},
|
||||
},
|
||||
git_status = {
|
||||
window = {
|
||||
position = "float",
|
||||
mappings = {
|
||||
["A"] = "git_add_all",
|
||||
["gu"] = "git_unstage_file",
|
||||
["ga"] = "git_add_file",
|
||||
["gr"] = "git_revert_file",
|
||||
["gc"] = "git_commit",
|
||||
["gp"] = "git_push",
|
||||
["gg"] = "git_commit_and_push",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
g['neo_tree_remove_legacy_commands'] = 1
|
||||
fn.sign_define("DiagnosticSignError", {text = " ", texthl = "DiagnosticSignError"})
|
||||
fn.sign_define("DiagnosticSignWarn", {text = " ", texthl = "DiagnosticSignWarn"})
|
||||
fn.sign_define("DiagnosticSignInfo", {text = " ", texthl = "DiagnosticSignInfo"})
|
||||
fn.sign_define("DiagnosticSignHint", {text = "", texthl = "DiagnosticSignHint"})
|
||||
|
||||
vimp.nnoremap({'silent'}, '<F2>', ':Neotree toggle reveal position=left<CR>')
|
||||
vimp.nnoremap({'silent'}, '<leader>gs', ':Neotree float git_status<CR>')
|
||||
vimp.nnoremap({'silent'}, '<leader><S-TAB>', ':Neotree toggle reveal float source=buffers<CR>')
|
||||
|
||||
neotree.setup(util.mconfig('config.neotree', defaults))
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
return function()
|
||||
local g = vim.g
|
||||
|
||||
-- Balance pairs when on open, close and delete
|
||||
g.pear_tree_smart_openers = 1
|
||||
g.pear_tree_smart_closers = 1
|
||||
g.pear_tree_smart_backspace = 1
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
return function()
|
||||
local g = vim.g
|
||||
|
||||
-- Don't force qf/loc windows to bottom
|
||||
g.qf_window_bottom = 0
|
||||
g.qf_loclist_window_bottom = 0
|
||||
|
||||
-- Let Neomake control window size
|
||||
g.qf_auto_resize = 0
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
return function()
|
||||
local g, vimp = vim.g, require 'vimp'
|
||||
|
||||
g['tmux_navigator_no_mappings'] = 1
|
||||
g['tmux_navigator_disable_when_zoomed'] = 1
|
||||
|
||||
vimp.nnoremap({'override', 'silent'}, '<C-h>', ':TmuxNavigateLeft<CR>')
|
||||
vimp.nnoremap({'override', 'silent'}, '<C-j>', ':TmuxNavigateDown<CR>')
|
||||
vimp.nnoremap({'override', 'silent'}, '<C-k>', ':TmuxNavigateUp<CR>')
|
||||
vimp.nnoremap({'override', 'silent'}, '<C-l>', ':TmuxNavigateRight<CR>')
|
||||
end
|
|
@ -0,0 +1,217 @@
|
|||
local cmd, bootstrap, util = vim.cmd, require 'psoxizsh.plugins.bootstrap', require 'psoxizsh.util'
|
||||
local cb_table = {}
|
||||
local packer = nil
|
||||
|
||||
-- Plugins provides a hook based wrapper around packer.nvim, allowing
|
||||
-- callers to register hooks at specific lifecycle events such as pre
|
||||
-- and post plugin load.
|
||||
--
|
||||
-- A new, uninitialized one is provided upon requiring this module,
|
||||
-- See :setup/1 and :init/0 for more on configuring and initializing
|
||||
-- this object
|
||||
local Plugins = { mt = {} }
|
||||
|
||||
-- Creates a new, uninitialized Plugins
|
||||
--
|
||||
-- You must call :init/0 (and likely :setup/1) before using this
|
||||
-- object, though you can directly invoke the Plugins object as
|
||||
-- you would :setup/1 as a convenience
|
||||
function Plugins.new()
|
||||
local m = {
|
||||
_list = {},
|
||||
_hooks = {},
|
||||
}
|
||||
setmetatable(m, Plugins.mt)
|
||||
|
||||
return m
|
||||
end
|
||||
|
||||
-- Configures this Plugins, with the provided opts
|
||||
--
|
||||
-- You can provide a tables of hooks by name or { name, callback }
|
||||
-- tuples.
|
||||
--
|
||||
-- In the former case, Plugins will create User <name> autocmds
|
||||
-- when the lifecycle stage is hit, which you can register arbitrary
|
||||
-- code to be invoked on.
|
||||
--
|
||||
-- In the latter, the provided callback fn will be invoked at the
|
||||
-- lifecycle stage, with 'post' and 'late' hooks being provided the
|
||||
-- current Plugins object as the first argument
|
||||
--
|
||||
-- @opts = {
|
||||
-- hooks = {
|
||||
-- early = name | { name, callback/0 }
|
||||
-- pre = name | { name, callback/0 }
|
||||
-- post = name | { name, callback/1 }
|
||||
-- late = name | { name, callback/1 }
|
||||
-- }
|
||||
-- }
|
||||
function Plugins.setup(self, opts)
|
||||
opts = opts or {}
|
||||
local hooks = opts.hooks or {}
|
||||
|
||||
self._hooks = vim.tbl_map(function(hk)
|
||||
local t = type(hk)
|
||||
if t == 'string' then return hk end
|
||||
if t == 'table' then return hk[1] end
|
||||
end, hooks)
|
||||
|
||||
local callbacks = vim.tbl_map(function(hk)
|
||||
local t = type(hk[2])
|
||||
if t == 'function' then return hk[2] end
|
||||
end, hooks)
|
||||
|
||||
self:list_regen()
|
||||
self:register_callbacks(callbacks)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
-- Invokes the plugin manager, and hooks any provided hooks as they become ready
|
||||
--
|
||||
-- Note, you shouldn't rerun this function, use :reload/0 instead if you want to
|
||||
-- reload an existing Plugins
|
||||
function Plugins.init(self)
|
||||
self:do_hook 'early'
|
||||
|
||||
if packer == nil then
|
||||
cmd [[packadd packer.nvim]]
|
||||
|
||||
packer = require 'packer'
|
||||
packer.init {
|
||||
max_jobs = 32
|
||||
}
|
||||
end
|
||||
|
||||
packer.reset()
|
||||
|
||||
self:do_hook 'pre'
|
||||
|
||||
for _, spec in ipairs(self:list()) do
|
||||
packer.use(spec)
|
||||
end
|
||||
|
||||
self:do_hook 'post'
|
||||
self:do_hook 'late'
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
-- Regenerate the plugin spec list, reloading the config if it has changed.
|
||||
--
|
||||
-- Note that this method *only* reloads the spec list, it does not reload
|
||||
-- plugins, see :reload/0 for that
|
||||
function Plugins.list_regen(self)
|
||||
local plugs = util.mreload('psoxizsh.plugins.plug')
|
||||
self._list = plugs(util.try_mconfig('plug'))
|
||||
|
||||
return self:list()
|
||||
end
|
||||
|
||||
-- Return the current plugin list
|
||||
function Plugins.list(self)
|
||||
return self._list
|
||||
end
|
||||
|
||||
-- Get the plugin spec for the provided @id.
|
||||
--
|
||||
-- The plugin id will be either the last component of the name, or if redefined by 'as',
|
||||
-- whatever 'as' is.
|
||||
--
|
||||
-- Returns the spec if it exists, nil otherwise
|
||||
function Plugins.get(self, id)
|
||||
local needle = function(p)
|
||||
local plugid = p.as and p.as or p[1] and p[1]:match("^.+/(.+)$")
|
||||
|
||||
return plugid == id
|
||||
end
|
||||
|
||||
return vim.tbl_filter(needle, self:list())[1]
|
||||
end
|
||||
|
||||
-- Check if the plugin @id exists in the current spec table
|
||||
--
|
||||
-- Returns true if it does, nil otherwise
|
||||
function Plugins.has(self, id)
|
||||
return self:get(id) and true or nil
|
||||
end
|
||||
|
||||
-- Reload plugins, and rerun any registered hooks
|
||||
function Plugins.reload(self)
|
||||
self:list_regen()
|
||||
self:init()
|
||||
packer.compile()
|
||||
end
|
||||
|
||||
-- Request the active Plugins to run the provided lifecycle's hook
|
||||
--
|
||||
-- Note that this may not run immediately, depending on current lifecycle
|
||||
-- of underlying plugin manager
|
||||
--
|
||||
-- @name { 'early' | 'pre' | 'post' | 'late' }
|
||||
function Plugins.do_hook(self, name)
|
||||
if name and name == 'post' or 'late' then
|
||||
self:_post_hook(self._hooks[name])
|
||||
else
|
||||
self:_pre_hook(self._hooks[name])
|
||||
end
|
||||
end
|
||||
|
||||
-- Manually (re)register callbacks for any configured lifecycle hooks
|
||||
--
|
||||
-- Note that any hooks that were not registered in :setup/1 will be
|
||||
-- silently ignored.
|
||||
--
|
||||
-- You may consider re-initializing the active Plugins via :setup/1:init/0
|
||||
function Plugins.register_callbacks(self, callbacks)
|
||||
_G._psoxizsh_plugins_cb = function(id) cb_table[id](self) end
|
||||
cb_table = {}
|
||||
|
||||
cmd [[augroup PsoxConfigCallbacks]]
|
||||
cmd [[autocmd!]]
|
||||
for n, fn in pairs(callbacks) do
|
||||
local id = self._hooks[n]
|
||||
cb_table[id] = fn
|
||||
cmd(string.format('autocmd User %s call v:lua._psoxizsh_plugins_cb("%s")', id, id))
|
||||
end
|
||||
cmd [[augroup END]]
|
||||
end
|
||||
|
||||
function Plugins._pre_hook(self, hook)
|
||||
self:_dispatch_autocmd(hook)
|
||||
end
|
||||
|
||||
function Plugins._post_hook(self, hook)
|
||||
if bootstrap() and hook then
|
||||
cmd [[augroup PsoxConfigBootstrap]]
|
||||
cmd [[autocmd!]]
|
||||
cmd [[autocmd VimEnter * ++once PackerSync]]
|
||||
cmd [[augroup END]]
|
||||
|
||||
cmd ('augroup PsoxConfigDeferHook_' .. hook)
|
||||
cmd ('autocmd!')
|
||||
cmd ('autocmd User PackerCompileDone doautocmd User ' .. hook)
|
||||
cmd ('augroup END')
|
||||
else
|
||||
self:_dispatch_autocmd(hook)
|
||||
end
|
||||
end
|
||||
|
||||
function Plugins._dispatch_autocmd(_, hook)
|
||||
if hook then cmd('doautocmd User ' .. hook) end
|
||||
end
|
||||
|
||||
-- Setup a convenience method for setting up + initializing a Plugins object
|
||||
-- via directly calling the object with the opts that would normally be
|
||||
-- provided to :setup/1
|
||||
function Plugins.mt.__call(self, opts)
|
||||
self:setup(opts):init()
|
||||
end
|
||||
|
||||
-- Allow callers to access the underlying packer object
|
||||
function Plugins.mt.__index(_, key)
|
||||
return Plugins[key] or packer[key]
|
||||
end
|
||||
|
||||
return Plugins.new()
|
|
@ -0,0 +1,142 @@
|
|||
|
||||
local plugins = {
|
||||
-- Allow packer to manage itself
|
||||
{ 'wbthomason/packer.nvim',
|
||||
opt = true,
|
||||
cmd = 'Packer*',
|
||||
module_pattern = { 'packer', 'packer%..*' }
|
||||
},
|
||||
|
||||
-- Community patch for Vim
|
||||
{ 'tpope/vim-sensible' },
|
||||
|
||||
-- Utils for wrapping vimscript in lua easier
|
||||
{ 'svermeulen/vimpeccable',
|
||||
as = 'vimp'
|
||||
},
|
||||
|
||||
-- Used for autocmds if we're not using a late enough version of neovim
|
||||
{ 'jakelinnzy/autocmd-lua',
|
||||
disable = vim.fn.has('nvim-0.7') == 1
|
||||
},
|
||||
|
||||
-- Text alignment
|
||||
{ 'junegunn/vim-easy-align' },
|
||||
{ 'tmsvg/pear-tree',
|
||||
config = require 'psoxizsh.plugins.config.pear-tree'
|
||||
},
|
||||
|
||||
-- Git integration
|
||||
{ 'tpope/vim-fugitive' },
|
||||
|
||||
-- File browser
|
||||
{ 'nvim-neo-tree/neo-tree.nvim',
|
||||
as = 'neo-tree',
|
||||
branch = 'v2.x',
|
||||
requires = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
'MunifTanjim/nui.nvim',
|
||||
},
|
||||
after = 'vimp',
|
||||
cmd = { 'Neotree', 'NeoTree*' },
|
||||
keys = { '<F2>', '<leader>gs', '<leader><S-TAB>' },
|
||||
config = require 'psoxizsh.plugins.config.neotree'
|
||||
},
|
||||
|
||||
-- Comment helpers
|
||||
{ 'scrooloose/nerdcommenter' },
|
||||
|
||||
-- Stat line integrations
|
||||
{ 'nvim-lualine/lualine.nvim',
|
||||
requires = {
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
'lewis6991/gitsigns.nvim'
|
||||
},
|
||||
config = require 'psoxizsh.plugins.config.lualine'
|
||||
},
|
||||
{ 'akinsho/bufferline.nvim',
|
||||
as = "bufferline",
|
||||
tag = "v1.*",
|
||||
requires = { 'kyazdani42/nvim-web-devicons' },
|
||||
after = 'vimp',
|
||||
config = require 'psoxizsh.plugins.config.bufferline'
|
||||
},
|
||||
{ 'lewis6991/gitsigns.nvim',
|
||||
tag = 'release',
|
||||
requires = { 'nvim-lua/plenary.nvim' },
|
||||
config = require 'psoxizsh.plugins.config.gitsigns'
|
||||
},
|
||||
|
||||
-- Buffer mangement
|
||||
{ 'qpkorr/vim-bufkill' },
|
||||
{ 'romainl/vim-qf',
|
||||
config = require 'psoxizsh.plugins.config.vim-qf'
|
||||
},
|
||||
|
||||
-- IDE stuff + language highlighting
|
||||
{ 'neoclide/coc.nvim',
|
||||
branch = 'release',
|
||||
after = 'vimp',
|
||||
config = require 'psoxizsh.plugins.config.coc'
|
||||
},
|
||||
{ 'neomake/neomake',
|
||||
config = require 'psoxizsh.plugins.config.neomake'
|
||||
},
|
||||
{ 'vim-perl/vim-perl',
|
||||
ft = 'perl',
|
||||
run = 'make clean carp dancer highlight-all-pragmas moose test-more try-tiny'
|
||||
},
|
||||
{ 'rust-lang/rust.vim',
|
||||
ft = 'rust'
|
||||
},
|
||||
{ 'pearofducks/ansible-vim',
|
||||
ft = {'yaml', 'yml'}
|
||||
},
|
||||
{ 'kevinoid/vim-jsonc' },
|
||||
{ 'luochen1990/rainbow' },
|
||||
{ 'sheerun/vim-polyglot' },
|
||||
|
||||
-- Fuzzy search helpers
|
||||
{ 'junegunn/fzf',
|
||||
cmd = 'FZF',
|
||||
fn = { 'fzf#run', 'fzf#wrap' }
|
||||
},
|
||||
{ 'junegunn/fzf.vim',
|
||||
config = require 'psoxizsh.plugins.config.fzf'
|
||||
},
|
||||
{ 'adelarsq/vim-matchit' },
|
||||
{ 'mox-mox/vim-localsearch' },
|
||||
|
||||
-- Color themes
|
||||
{ 'rakr/vim-one',
|
||||
config = function() vim.cmd(string.format('colorscheme %s', vim.g.my_color_scheme or 'one')) end
|
||||
},
|
||||
{ 'romainl/vim-cool' },
|
||||
|
||||
-- Tmux integration for pane movement
|
||||
{ 'christoomey/vim-tmux-navigator',
|
||||
keys = { '<C-h>', '<C-j>', '<C-k>', '<C-l>' },
|
||||
cmd = { 'TmuxNavigateLeft', 'TmuxNavigateDown', 'TmuxNavigateUp', 'TmuxNavigateRight', 'TmuxNavigatePrevious' },
|
||||
config = require 'psoxizsh.plugins.config.vim-tmux-navigator'
|
||||
},
|
||||
|
||||
-- Other
|
||||
{ 'roxma/nvim-yarp' },
|
||||
{ 'roxma/vim-hug-neovim-rpc' },
|
||||
}
|
||||
|
||||
local function concatArray(a, b)
|
||||
local result = {unpack(a)}
|
||||
for i = 1,#b do
|
||||
result[#a+i] = b[i]
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
return function(extra)
|
||||
extra = extra or {}
|
||||
|
||||
return concatArray(plugins, extra)
|
||||
end
|
|
@ -0,0 +1,68 @@
|
|||
|
||||
local Util = {}
|
||||
|
||||
-- Reload a given module, returning the result of loading it.
|
||||
function Util.mreload(module)
|
||||
if package.loaded[module] then
|
||||
package.loaded[module] = nil
|
||||
end
|
||||
|
||||
return require(module)
|
||||
end
|
||||
|
||||
-- Try reloading the given module, returning ok, module
|
||||
function Util.try_mreload(module)
|
||||
return pcall(Util.mreload, module)
|
||||
end
|
||||
|
||||
-- Try reloading the given config module, returning either
|
||||
-- its table or an empty one, if the module couldn't be loaded
|
||||
--
|
||||
-- The arguments can be:
|
||||
-- 1. module string --> table
|
||||
-- 2. module string --> fn() -> table
|
||||
-- 3. table
|
||||
-- 4. fn() --> table
|
||||
--
|
||||
-- It the latter cases, *configuration will not be reloaded*, this is
|
||||
-- primaraily meant for inline, static configuration
|
||||
function Util.try_mconfig(module)
|
||||
if type(module) ~= "string" then
|
||||
module = type(module) == "function" and module() or module
|
||||
module = type(module) == "table" and module or {}
|
||||
|
||||
return module
|
||||
end
|
||||
|
||||
local ok, config = Util.try_mreload(module)
|
||||
config = type(config) == "function" and config() or config
|
||||
|
||||
return (ok and type(config) == "table") and config or {}
|
||||
end
|
||||
|
||||
-- Retrieve the config table stored in the provided module,
|
||||
-- merged with default the config module, if one is provided
|
||||
--
|
||||
-- The arguments can be:
|
||||
-- 1. module string --> table
|
||||
-- 2. module string --> fn() -> table
|
||||
-- 3. table
|
||||
-- 4. fn() --> table
|
||||
--
|
||||
-- It the latter cases, *configuration will not be reloaded*, this is
|
||||
-- primaraily meant for inline, static configuration
|
||||
--
|
||||
-- Note: the config returned from the given module may optionally
|
||||
-- set 'no_defaults = true' to opt out of the merging
|
||||
function Util.mconfig(module, defaults)
|
||||
module = Util.try_mconfig(module)
|
||||
defaults = Util.try_mconfig(defaults)
|
||||
|
||||
if module.no_defaults then
|
||||
return module
|
||||
else
|
||||
return vim.tbl_deep_extend('keep', module, defaults)
|
||||
end
|
||||
end
|
||||
|
||||
return Util
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
# Integration with vim-tmux-navigator & fzf
|
||||
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
||||
<<<<<<< HEAD
|
||||
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
|
||||
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \
|
||||
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
|
||||
|
@ -26,6 +27,21 @@ bind -n C-M-Up run "($is_vim && tmux send-keys C-M-Up) \
|
|||
|| tmux select-pane -U"
|
||||
bind -n C-M-Right run "($is_vim && tmux send-keys C-M-Right) \
|
||||
|| tmux select-pane -R"
|
||||
=======
|
||||
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
|
||||
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \
|
||||
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
|
||||
bind -n C-M-Left run "($is_vim && tmux send-keys C-h) \
|
||||
|| tmux select-pane -L"
|
||||
bind -n C-M-Down run "($is_vim && tmux send-keys C-j) \
|
||||
|| ($is_fzf && tmux send-keys C-j) \
|
||||
|| tmux select-pane -D"
|
||||
bind -n C-M-Up run "($is_vim && tmux send-keys C-k) \
|
||||
|| ($is_fzf && tmux send-keys C-k) \
|
||||
|| tmux select-pane -U"
|
||||
bind -n C-M-Right run "($is_vim && tmux send-keys C-l) \
|
||||
|| tmux select-pane -R"
|
||||
>>>>>>> origin/develop
|
||||
bind-key -T copy-mode-vi 'C-M-Left' select-pane -L
|
||||
bind-key -T copy-mode-vi 'C-M-Down' select-pane -D
|
||||
bind-key -T copy-mode-vi 'C-M-Up' select-pane -U
|
||||
|
|
|
@ -7,10 +7,13 @@ if "test -f ~/.config/tmux/plugins.conf" {
|
|||
if "test -f ~/.config/tmux/early.conf" {
|
||||
source-file ~/.config/tmux/early.conf
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
if "test -f ~/.config/tmux/keys.conf" {
|
||||
source-file ~/.config/tmux/keys.conf
|
||||
}
|
||||
=======
|
||||
>>>>>>> origin/develop
|
||||
|
||||
set-option -g prefix C-a
|
||||
set-option -g set-titles on
|
||||
|
|
4
vimrc
4
vimrc
|
@ -378,7 +378,11 @@ if has_key(plugs, 'fzf.vim')
|
|||
nnoremap <silent> <A-S-f> :Files<CR>
|
||||
nnoremap <silent> <leader><A-S-f> :Files!<CR>
|
||||
|
||||
<<<<<<< HEAD
|
||||
nnoremap <A-b> :Buffers
|
||||
=======
|
||||
nnoremap <A-b> :Buffers
|
||||
>>>>>>> origin/develop
|
||||
nnoremap <leader><A-b> :Buffers!
|
||||
nnoremap <silent> <A-S-b> :Buffers<CR>
|
||||
nnoremap <silent> <leader><A-S-b> :Buffers!<CR>
|
||||
|
|
27
zshrc
27
zshrc
|
@ -108,7 +108,11 @@ plugins=(
|
|||
( [[ -e /etc/debian-release ]] ) && plugins+=( debian )
|
||||
( [[ -e /etc/suse-release ]] ) && plugins+=( suse )
|
||||
( [[ "$(uname)" == "Darwin" ]] ) && plugins+=( macos )
|
||||
<<<<<<< HEAD
|
||||
( which vim &>/dev/null ) && plugins+=( vim-interaction )
|
||||
=======
|
||||
#( which vim &>/dev/null ) && plugins+=( vim-interaction )
|
||||
>>>>>>> origin/develop
|
||||
( which ssh &>/dev/null ) && [[ -d ~/.ssh ]] && plugins+=( ssh-agent )
|
||||
plugins+=(
|
||||
zsh-completions
|
||||
|
@ -122,12 +126,20 @@ plugins+=(
|
|||
if [[ "$OSTYPE" =~ "linux*" || "$OSTYPE" =~ "darwin*" || "$OSTYPE" == "cygwin" ]]
|
||||
then
|
||||
export VIMINIT='source $MYVIMRC'
|
||||
export MYVIMRC=$PSOXIZSH/vimrc
|
||||
export VIMHOME=~/.vim
|
||||
|
||||
# Feature flag lua based Neovim config, until this is tested
|
||||
# (and we figure out how to detect if we're running nvim or vim)
|
||||
if [[ -n ${PSOXIZSH_EXPERIMENTAL_NEOVIM_LUA} ]]
|
||||
then
|
||||
export MYVIMRC=$PSOXIZSH/init.lua
|
||||
else
|
||||
export MYVIMRC=$PSOXIZSH/vimrc
|
||||
cmp $PSOXIZSH/vim/autoload/plug.vim $VIMHOME/autoload/plug.vim 2>/dev/null || (
|
||||
mkdir -vp $VIMHOME/autoload/
|
||||
cp -av $PSOXIZSH/vim/autoload/plug.vim $VIMHOME/autoload/plug.vim
|
||||
)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -d ~/.ssh ]]
|
||||
|
@ -162,20 +174,29 @@ then
|
|||
[ -z "$TMUX_PATH" ] && TMUX_PATH=~/.config/tmux
|
||||
|
||||
# Bootstrap the user's plugin directory, if required
|
||||
<<<<<<< HEAD
|
||||
[ -d "$TMUX_PATH/plugins" ] || {
|
||||
cp -r "$PSOXIZSH/tmux/plugins" "$TMUX_PATH"
|
||||
}
|
||||
=======
|
||||
[ -d "$TMUX_PATH/plugins" ] || { mkdir -vp "$TMUX_PATH/plugins" && cp -r "$PSOXIZSH/tmux/plugins" "$TMUX_PATH/plugins" }
|
||||
>>>>>>> origin/develop
|
||||
|
||||
# Both tmux and TPM are very opininated about where configs must live,
|
||||
# and TPM will only expand one layer of source-file directives, so we
|
||||
# symlink the base config to the user local config file, if it doesn't
|
||||
# exist.
|
||||
<<<<<<< HEAD
|
||||
[[ ! -f $TMUX_PATH/tmux.conf ]] && cp -r "$PSOXIZSH/tmux/tmux.conf" "$TMUX_PATH/tmux.conf"
|
||||
[[ ! -f ~/.tmux.conf ]] && ln -s $PSOXIZSH/tmux/tmux.conf ~/.tmux.conf
|
||||
[[ ! -f "$TMUX_PATH/plugins.conf" ]] && ln -vs "$PSOXIZSH/tmux/fragment/plugins.conf" "$TMUX_PATH/plugins.conf"
|
||||
[[ "$USER" == "astemmet" ]] && [[ ! -f $TMUX_PATH/keys.conf ]] && {
|
||||
cp -v "$PSOXIZSH/tmux/fragment/ctrl-alt-movement.conf" "$TMUX_PATH/keys.conf"
|
||||
}
|
||||
=======
|
||||
[ ! -f ~/.tmux.conf ] && ln -s $PSOXIZSH/tmux/tmux.conf ~/.tmux.conf
|
||||
[ ! -f "$TMUX_PATH/plugins.conf" ] && ln -s "$PSOXIZSH/tmux/fragment/plugins.conf" "$TMUX_PATH/plugins.conf"
|
||||
>>>>>>> origin/develop
|
||||
|
||||
export TMUX_PATH=$TMUX_PATH TMUX_PLUGINS="$TMUX_PATH/plugins" TMUX_CONFIG=~/.tmux.conf
|
||||
fi
|
||||
|
@ -193,8 +214,12 @@ alias curlj="curl -H 'Content-Type: application/json' "
|
|||
which nvim >/dev/null 2>&1 && alias vim="$(which nvim)"
|
||||
alias v=vim
|
||||
[[ -x /usr/bin/yay ]] && [[ "$(whoami)" != "pacman" ]] && alias yay='sudo -iupacman /usr/bin/yay'
|
||||
<<<<<<< HEAD
|
||||
[[ -x /usr/bin/paru ]] && [[ "$(whoami)" != "pacman" ]] && alias paru='sudo -iupacman /usr/bin/paru'
|
||||
[[ -x /usr/bin/bat ]] && export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||
=======
|
||||
[[ -x /usr/bin/paru ]] && [[ "$(whoami)" != "pacman" ]] && alias yay='sudo -iupacman /usr/bin/paru'
|
||||
>>>>>>> origin/develop
|
||||
|
||||
typeset -A key
|
||||
|
||||
|
|
Loading…
Reference in New Issue