Compare commits
12 Commits
zsh
..
8e59d295e5
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e59d295e5 | |||
| 18c35c87ef | |||
| 7fd13c6e7a | |||
| 76d71b91c3 | |||
| 4c68d97cda | |||
| 060fe95fc5 | |||
| cd6c9e23ce | |||
| 71c7e986a5 | |||
| b24b91367c | |||
| 85c5bad010 | |||
| e80a93bc0d | |||
| 33c40f9b4d |
@@ -0,0 +1,7 @@
|
|||||||
|
[submodule "pack/plugins/start/nvim-treesitter"]
|
||||||
|
path = pack/plugins/start/nvim-treesitter
|
||||||
|
url = https://github.com/nvim-treesitter/nvim-treesitter
|
||||||
|
[submodule "pack/plugins/start/mini.nvim"]
|
||||||
|
path = pack/plugins/start/mini.nvim
|
||||||
|
url = https://github.com/echasnovski/mini.nvim.git
|
||||||
|
branch = stable
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# Disable global autocomplete
|
|
||||||
skip_global_compinit=1
|
|
||||||
|
|
||||||
# Set ZFS Directory
|
|
||||||
ZDOTDIR=~/.config/zsh
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
# History
|
|
||||||
export HISTFILE=$XDG_CACHE_HOME/zsh/.zsh_history
|
|
||||||
export HISTSIZE=10000
|
|
||||||
export SAVEHIST=10000
|
|
||||||
setopt HIST_IGNORE_ALL_DUPS
|
|
||||||
setopt HIST_FIND_NO_DUPS
|
|
||||||
|
|
||||||
# Bitwarden ssh agent
|
|
||||||
export SSH_AUTH_SOCK=/home/lumen/.bitwarden-ssh-agent.sock
|
|
||||||
|
|
||||||
# Editors
|
|
||||||
export EDITOR="nvim"
|
|
||||||
export VISUAL="nvim"
|
|
||||||
|
|
||||||
# Disable Global autocomplete
|
|
||||||
export skip_global_compinit=1
|
|
||||||
|
|
||||||
# Autocomplete
|
|
||||||
source $ZDOTDIR/modules/completion.zsh
|
|
||||||
|
|
||||||
# Allow CTRL+Arrow move
|
|
||||||
bindkey "^[[1;5C" forward-word
|
|
||||||
bindkey "^[[1;5D" backward-word
|
|
||||||
|
|
||||||
# Prompt
|
|
||||||
prompt_builder() {
|
|
||||||
local EXITCODE=$?
|
|
||||||
if [ $UID = 0 ] && [ $EXITCODE = 0 ]; then
|
|
||||||
PROMPT=$'%F{red}%~ %B%F{red}#%F{red}>%f%b '
|
|
||||||
RPROMPT='%F{white}%? %F{red}%n'
|
|
||||||
elif [ $UID = 0 ]; then
|
|
||||||
PROMPT=$'%F{red}%~ %B%F{red}#%F{red}>%f%b '
|
|
||||||
RPROMPT=$'%F{red}%? %F{red}%n'
|
|
||||||
elif [ $UID != 0 ] && [ $EXITCODE = 0 ]; then
|
|
||||||
PROMPT=$'%F{white}%~ %B%F{blue}>%f%b '
|
|
||||||
RPROMPT='%F{white}%? %F{white}%n'
|
|
||||||
else
|
|
||||||
PROMPT=$'%F{white}%~ %B%F{blue}>%f%b '
|
|
||||||
RPROMPT=$'%F{red}%? %F{white}%n'
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
precmd_functions+=(prompt_builder)
|
|
||||||
|
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
-- Set Language {{{
|
||||||
|
vim.api.nvim_exec2('language POSIX', {})
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- Source plugins if they exist {{{
|
||||||
|
pcall(require, 'mini-pick')
|
||||||
|
pcall(require, 'treesitter')
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- General Editor Settings {{{
|
||||||
|
vim.opt.number = true
|
||||||
|
vim.opt.relativenumber = true
|
||||||
|
vim.opt.cursorline = true
|
||||||
|
vim.opt.tabstop = 4
|
||||||
|
vim.opt.shiftwidth = 4
|
||||||
|
vim.opt.expandtab = false
|
||||||
|
vim.opt.list = true
|
||||||
|
vim.opt.listchars:append 'space:·'
|
||||||
|
vim.opt.wildmenu = true
|
||||||
|
vim.opt.wrap = false
|
||||||
|
vim.opt.clipboard = 'unnamedplus'
|
||||||
|
vim.opt.ignorecase = true
|
||||||
|
vim.opt.smartcase = true
|
||||||
|
vim.opt.updatetime = 250
|
||||||
|
vim.opt.timeoutlen = 300
|
||||||
|
vim.opt.inccommand = 'split'
|
||||||
|
vim.opt.foldmethod = 'marker'
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- Setup (Disable) Netrw {{{
|
||||||
|
vim.g.loaded_netrw = 1
|
||||||
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
--[[
|
||||||
|
vim.g.netrw_banner = 0
|
||||||
|
vim.g.netrw_sort_sequence = '[\\/]$'
|
||||||
|
vim.g.netrw_sort_options = 'i'
|
||||||
|
vim.g.netrw_silent = 1
|
||||||
|
]]
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- WriteSudo and ReadSudo hacks {{{
|
||||||
|
vim.api.nvim_create_user_command('WriteSudo', 'w !sudo tee %', {})
|
||||||
|
vim.api.nvim_create_user_command('ReadSudo', function(opts)
|
||||||
|
vim.cmd('r !sudo cat ' .. opts['args'])
|
||||||
|
end, { nargs = 1 })
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- Statusbar {{{
|
||||||
|
vim.opt.statusline = ' #%n %f %h%w%m%r %= %{&fileformat} %y %l:%c %p%% '
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- Toggle Terminal Script {{{
|
||||||
|
local term_buf = nil
|
||||||
|
local term_winid = nil
|
||||||
|
|
||||||
|
local function openTerminal()
|
||||||
|
if vim.fn.bufexists(term_buf) ~= 1 then
|
||||||
|
vim.api.nvim_command('autocmd TermOpen * setlocal nonumber norelativenumber signcolumn=no')
|
||||||
|
vim.api.nvim_command('split | wincmd J | resize 10 | term')
|
||||||
|
term_winid = vim.fn.win_getid()
|
||||||
|
term_buf = vim.fn.bufnr('%')
|
||||||
|
elseif vim.fn.win_gotoid(term_winid) ~= 1 then
|
||||||
|
vim.api.nvim_command('sbuffer ' .. term_buf .. '| wincmd J | resize 10')
|
||||||
|
term_winid = vim.fn.win_getid()
|
||||||
|
end
|
||||||
|
vim.api.nvim_command('startinsert')
|
||||||
|
end
|
||||||
|
|
||||||
|
local function hideTerminal()
|
||||||
|
if vim.fn.win_gotoid(term_winid) == 1 then
|
||||||
|
vim.api.nvim_command('hide')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function ToggleTerminal()
|
||||||
|
if vim.fn.win_gotoid(term_winid) == 1 then
|
||||||
|
hideTerminal()
|
||||||
|
else
|
||||||
|
openTerminal()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- Automatic insertmode in Terminal Mode {{{
|
||||||
|
vim.api.nvim_create_autocmd({ 'TermOpen' }, {
|
||||||
|
pattern = { 'term://*' },
|
||||||
|
command = 'startinsert',
|
||||||
|
})
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- Keymaps {{{
|
||||||
|
vim.keymap.set('n', '<F6>', ':b#<CR>', { noremap = true, silent = true })
|
||||||
|
vim.keymap.set('n', '<F7>', ':bprevious<CR>', { noremap = true, silent = true })
|
||||||
|
vim.keymap.set('n', '<F8>', ':bnext<CR>', { noremap = true, silent = true })
|
||||||
|
vim.keymap.set('n', '<leader>f', ':Pick files<CR>', { noremap = true })
|
||||||
|
vim.keymap.set('n', '<leader>g', ':Pick grep_live<CR>', { noremap = true })
|
||||||
|
vim.keymap.set('n', '<leader>b', ':Pick buffers<CR>', { noremap = true })
|
||||||
|
vim.keymap.set('n', '<leader>t', ToggleTerminal)
|
||||||
|
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>')
|
||||||
|
vim.keymap.set('n', 'x', '"_x')
|
||||||
|
-- }}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
require('mini.pick').setup()
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
require('nvim-treesitter.install').prefer_git = true
|
||||||
|
require('nvim-treesitter.configs').setup {
|
||||||
|
auto_install = true,
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true }
|
||||||
|
}
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
# +---------+
|
|
||||||
# | General |
|
|
||||||
# +---------+
|
|
||||||
|
|
||||||
# Load more completions
|
|
||||||
fpath=($ZSH/plugins/completions $fpath)
|
|
||||||
|
|
||||||
# Should be called before compinit
|
|
||||||
zmodload zsh/complist
|
|
||||||
|
|
||||||
# Use hjlk in menu selection (during completion)
|
|
||||||
# Doesn't work well with interactive mode
|
|
||||||
bindkey -M menuselect 'h' vi-backward-char
|
|
||||||
bindkey -M menuselect 'k' vi-up-line-or-history
|
|
||||||
bindkey -M menuselect 'j' vi-down-line-or-history
|
|
||||||
bindkey -M menuselect 'l' vi-forward-char
|
|
||||||
|
|
||||||
bindkey -M menuselect '^xg' clear-screen
|
|
||||||
bindkey -M menuselect '^xi' vi-insert # Insert
|
|
||||||
bindkey -M menuselect '^xh' accept-and-hold # Hold
|
|
||||||
bindkey -M menuselect '^xn' accept-and-infer-next-history # Next
|
|
||||||
bindkey -M menuselect '^xu' undo # Undo
|
|
||||||
|
|
||||||
autoload -U compinit; compinit -d $XDG_CACHE_HOME/zsh/.zcompdump
|
|
||||||
_comp_options+=(globdots) # With hidden files
|
|
||||||
|
|
||||||
# Only work with the Zsh function vman
|
|
||||||
# See $DOTFILES/zsh/scripts.zsh
|
|
||||||
compdef vman="man"
|
|
||||||
|
|
||||||
# +---------+
|
|
||||||
# | Options |
|
|
||||||
# +---------+
|
|
||||||
|
|
||||||
# setopt GLOB_COMPLETE # Show autocompletion menu with globs
|
|
||||||
setopt MENU_COMPLETE # Automatically highlight first element of completion menu
|
|
||||||
setopt AUTO_LIST # Automatically list choices on ambiguous completion.
|
|
||||||
setopt COMPLETE_IN_WORD # Complete from both ends of a word.
|
|
||||||
|
|
||||||
# +---------+
|
|
||||||
# | zstyles |
|
|
||||||
# +---------+
|
|
||||||
|
|
||||||
# Ztyle pattern
|
|
||||||
# :completion:<function>:<completer>:<command>:<argument>:<tag>
|
|
||||||
|
|
||||||
# Define completers
|
|
||||||
zstyle ':completion:*' completer _extensions _complete _approximate
|
|
||||||
|
|
||||||
# Use cache for commands using cache
|
|
||||||
zstyle ':completion:*' use-cache on
|
|
||||||
zstyle ':completion:*' cache-path "$XDG_CACHE_HOME/zsh/.zcompcache"
|
|
||||||
# Complete the alias when _expand_alias is used as a function
|
|
||||||
zstyle ':completion:*' complete true
|
|
||||||
|
|
||||||
zle -C alias-expension complete-word _generic
|
|
||||||
bindkey '^Xa' alias-expension
|
|
||||||
zstyle ':completion:alias-expension:*' completer _expand_alias
|
|
||||||
|
|
||||||
# Use cache for commands which use it
|
|
||||||
|
|
||||||
# Allow you to select in a menu
|
|
||||||
zstyle ':completion:*' menu select
|
|
||||||
|
|
||||||
# Autocomplete options for cd instead of directory stack
|
|
||||||
zstyle ':completion:*' complete-options true
|
|
||||||
|
|
||||||
zstyle ':completion:*' file-sort modification
|
|
||||||
|
|
||||||
|
|
||||||
zstyle ':completion:*:*:*:*:corrections' format '%F{yellow}!- %d (errors: %e) -!%f'
|
|
||||||
zstyle ':completion:*:*:*:*:descriptions' format '%F{blue}-- %D %d --%f'
|
|
||||||
zstyle ':completion:*:*:*:*:messages' format ' %F{purple} -- %d --%f'
|
|
||||||
zstyle ':completion:*:*:*:*:warnings' format ' %F{red}-- no matches found --%f'
|
|
||||||
# zstyle ':completion:*:default' list-prompt '%S%M matches%s'
|
|
||||||
# Colors for files and directory
|
|
||||||
zstyle ':completion:*:*:*:*:default' list-colors ${(s.:.)LS_COLORS}
|
|
||||||
|
|
||||||
# Only display some tags for the command cd
|
|
||||||
zstyle ':completion:*:*:cd:*' tag-order local-directories directory-stack path-directories
|
|
||||||
# zstyle ':completion:*:complete:git:argument-1:' tag-order !aliases
|
|
||||||
|
|
||||||
# Required for completion to be in good groups (named after the tags)
|
|
||||||
zstyle ':completion:*' group-name ''
|
|
||||||
|
|
||||||
zstyle ':completion:*:*:-command-:*:*' group-order aliases builtins functions commands
|
|
||||||
|
|
||||||
# See ZSHCOMPWID "completion matching control"
|
|
||||||
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
|
||||||
|
|
||||||
zstyle ':completion:*' keep-prefix true
|
|
||||||
|
|
||||||
zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'
|
|
||||||
|
|
||||||
## For kubernetes
|
|
||||||
#source $DOTFILES/zsh/plugins/kubectl-completion/_kubectl
|
|
||||||
#zstyle ':completion:*:*:kubectl:*' list-grouped false
|
|
||||||
Submodule
+1
Submodule pack/plugins/start/mini.nvim added at 94cae4660a
Submodule
+1
Submodule pack/plugins/start/nvim-treesitter added at 42fc28ba91
@@ -0,0 +1 @@
|
|||||||
|
git submodule update --init --remote --recursive
|
||||||
Reference in New Issue
Block a user