Compare commits

..

10 Commits

Author SHA1 Message Date
acb6c6ed59 chore: update gitconfig 2025-09-27 19:08:27 +03:00
e383101b63 chore: update nvim/bash/alacritty 2025-09-27 19:08:08 +03:00
6602c4da84 dotfiles: sync 2025-03-20 15:59:13 +02:00
24411364af nvim: update 2024-12-16 17:27:04 +02:00
65c7027985 nvim: switch to lazy 2024-12-06 11:36:33 +02:00
65a6a5c334 dotfile: sync 2024-03-19 11:47:31 +02:00
1d791dee9b nvim: update 2023-10-11 11:29:46 +03:00
79eeb16be7 dotfiles: update readme 2023-10-05 23:16:54 +03:00
95642f0874 nvim: simplify rspec mapping 2023-10-05 22:31:35 +03:00
a2a3dde5e7 dotfiles: update 2023-10-05 16:51:17 +03:00
43 changed files with 1337 additions and 1704 deletions

View File

@@ -27,6 +27,7 @@ brew 'jq'
brew 'kubectl'
brew 'kubectx'
brew 'mas'
brew 'ncdu'
brew 'neovim'
brew 'nmap'
brew 'node'

View File

@@ -1 +1,22 @@
# DOTFILES
## macOS
https://gist.github.com/sarthakpranesh/c4ba43a2f8e75518acedb9480087a3ee
```bash
# cli tools + rosetta
xcode-select --install
sudo softwareupdate --install-rosetta
# brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew bundle install
# tmux plugins
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
$(brew --prefix)/opt/fzf/install # fzf ctrl + r
```
## Arch
TBD

View File

@@ -0,0 +1,136 @@
[colors]
draw_bold_text_with_bright_colors = true
[colors.bright]
black = "0x4C566A"
blue = "0x81A1C1"
cyan = "0x8FBCBB"
green = "0xA3BE8C"
magenta = "0xB48EAD"
red = "0xBF616A"
white = "0xECEFF4"
yellow = "0xEBCB8B"
[colors.cursor]
cursor = "0xD8DEE9"
text = "0x2E3440"
[colors.normal]
black = "0x3B4252"
blue = "0x81A1C1"
cyan = "0x88C0D0"
green = "0xA3BE8C"
magenta = "0xB48EAD"
red = "0xBF616A"
white = "0xE5E9F0"
yellow = "0xEBCB8B"
[colors.primary]
background = "0x2E3440"
foreground = "0xD8DEE9"
[cursor]
style = "Block"
unfocused_hollow = true
[env]
TERM = "xterm-256color"
[font]
size = 20.0
[font.bold]
family = "Fira Code"
style = "Bold"
[font.glyph_offset]
x = 0
y = 0
[font.italic]
family = "Fira Code"
style = "Light"
[font.normal]
family = "Fira Code"
style = "Medium"
[font.offset]
x = 0
y = 0
[[keyboard.bindings]]
action = "Paste"
key = "V"
mods = "Command"
[[keyboard.bindings]]
action = "Copy"
key = "C"
mods = "Command"
[[keyboard.bindings]]
action = "Paste"
key = "Paste"
[[keyboard.bindings]]
action = "Copy"
key = "Copy"
[[keyboard.bindings]]
action = "Quit"
key = "Q"
mods = "Command"
[[keyboard.bindings]]
action = "Quit"
key = "W"
mods = "Command"
[[keyboard.bindings]]
action = "ResetFontSize"
key = "Key0"
mods = "Command"
[[keyboard.bindings]]
action = "IncreaseFontSize"
key = "Equals"
mods = "Command"
[[keyboard.bindings]]
action = "DecreaseFontSize"
key = "Minus"
mods = "Command"
[[keyboard.bindings]]
chars = "\u0002"
key = "F18"
[mouse]
hide_when_typing = true
[selection]
semantic_escape_chars = ",│`|:\"' ()[]{}<>"
[terminal.shell]
args = ["-l", "-c", "tmux attach || tmux"]
program = "/bin/bash"
[window]
decorations = "none"
dynamic_title = true
startup_mode = "Maximized"
[window.dimensions]
columns = 80
lines = 24
[window.padding]
x = 0
y = 0
[general]
live_config_reload = true
[terminal]

View File

@@ -1,83 +0,0 @@
env:
TERM: xterm-256color
window:
dimensions:
columns: 80
lines: 24
padding:
x: 0
y: 0
decorations: none
startup_mode: Maximized
dynamic_title: true
draw_bold_text_with_bright_colors: true
font:
normal:
family: Fira Code
style: Medium
bold:
family: Fira Code
style: Bold
italic:
family: Fira Code
style: Light
size: 24.0
offset:
x: 0
y: 0
glyph_offset:
x: 0
y: 0
colors:
primary:
background: "0x2E3440"
foreground: "0xD8DEE9"
cursor:
text: "0x2E3440"
cursor: "0xD8DEE9"
normal:
black: "0x3B4252"
red: "0xBF616A"
green: "0xA3BE8C"
yellow: "0xEBCB8B"
blue: "0x81A1C1"
magenta: "0xB48EAD"
cyan: "0x88C0D0"
white: "0xE5E9F0"
bright:
black: "0x4C566A"
red: "0xBF616A"
green: "0xA3BE8C"
yellow: "0xEBCB8B"
blue: "0x81A1C1"
magenta: "0xB48EAD"
cyan: "0x8FBCBB"
white: "0xECEFF4"
mouse:
hide_when_typing: true
selection:
semantic_escape_chars: ',│`|:"'' ()[]{}<>'
cursor:
style: Block
unfocused_hollow: true
live_config_reload: true
shell:
program: /bin/bash
args:
- -l
- -c
- "/opt/homebrew/bin/tmux attach || /opt/homebrew/bin/tmux"
key_bindings:
- { key: V, mods: Command, action: Paste }
- { key: C, mods: Command, action: Copy }
- { key: Paste, action: Paste }
- { key: Copy, action: Copy }
- { key: Q, mods: Command, action: Quit }
- { key: W, mods: Command, action: Quit }
- { key: Key0, mods: Command, action: ResetFontSize }
- { key: Equals, mods: Command, action: IncreaseFontSize }
- { key: Minus, mods: Command, action: DecreaseFontSize }
- { key: F18, chars: "\x02" } # Ctrl + B

View File

@@ -1,12 +1,12 @@
[ -f /opt/homebrew/opt/asdf/libexec/asdf.sh ] \
&& . /opt/homebrew/opt/asdf/libexec/asdf.sh
[ -f /opt/homebrew/opt/asdf/libexec/asdf.sh ] &&
. /opt/homebrew/opt/asdf/libexec/asdf.sh
[ -f /etc/bash_completion ] && . /etc/bash_completion
[ -f ~/.fzf.bash ] && . ~/.fzf.bash
[ -f ~/.cargo/env ] && . ~/.cargo/env
[ -f ~/Syncthing/secrets.sh ] && . ~/Syncthing/secrets.sh
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
eval $(/usr/libexec/path_helper -s)
fi
# Save 10,000 lines of history in memory
@@ -19,7 +19,7 @@ HISTCONTROL=ignoreboth
HISTIGNORE='ls:ll:ls -alh:pwd:clear:history'
HISTIGNORE=$HISTIGNORE':gcom:gcob:gd:gdc:gc:gca:gcw:gs:ga:grm:gup:gp:gpf:gpt:gb:gg:gl:gr:gr1:gh'
HISTIGNORE=$HISTIGNORE':v:vi:nvim'
HISTIGNORE=$HISTIGNORE':k:kp:ks:kl:kgp:d:dc:dcu:dcd:dcr:dcl:dcs'
HISTIGNORE=$HISTIGNORE':k:s:p:y:kp:ks:kl:kgp:d:dc:dcu:dcd:dcr:dcl:dcs'
# Immediately store command to the history
PROMPT_COMMAND='history -a'
@@ -36,7 +36,11 @@ export KUBE_TMUX_NS_ENABLE=false
export BASH_SILENCE_DEPRECATION_WARNING=1
export HOMEBREW_NO_ENV_HINTS=true
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=/opt/homebrew/opt/openssl@1.1"
# Fix for the following error in some Ruby version
# objc[12590]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.:/usr/local/lib
# export LIBRARY_PATH="$LIBRARY_PATH:$(brew --prefix)/lib"
export EDITOR=nvim
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
@@ -50,10 +54,10 @@ export FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS
--bind=ctrl-u:preview-page-up"
alias ~='cd ~'
alias l='exa'
alias ls='exa'
alias ll='exa -l'
alias tree='exa --tree'
alias l='eza'
alias ls='eza'
alias ll='eza -l'
alias tree='eza --tree'
alias vim='nvim'
alias vi='nvim'
alias v='nvim'
@@ -64,14 +68,24 @@ alias ..='cd ..'
alias ...='cd ../..'
alias md='mkdir -p'
alias pacman='sudo pacman'
alias p='sudo pacman'
alias s='sudo systemctl'
alias y='yay --noconfirm --answerdiff=None --answeredit=None'
alias yay='yay --noconfirm --answerdiff=None --answeredit=None'
alias gco='git checkout'
alias gcom='git checkout master'
alias gcob='git checkout -b'
# TODO: git checkout --track origin/$1^W man git-switch --guess
# alias gcot='git checkout'
alias gd='git diff'
alias gdc='git diff --cached'
alias gdn='git diff --no-index'
alias gc='git commit'
alias gca='git commit --amend'
alias gcw='git commit -m "wip"'
alias gcw='git commit --no-verify -m "wip"'
alias gs='git status -sb'
alias ga='git add'
alias grm='git rm'
@@ -80,13 +94,13 @@ alias gp='git push'
alias gpf='git push -f'
alias gpt='git push origin --tags'
alias gb='git branch'
alias gg='git go'
alias gg='git go' # checkout or create
alias gl='git lg'
alias gr='git reset'
alias gr1='git reset HEAD~1'
# alias gh='git lg -1'
function gcm () {
git commit -m "$*"
function gcm() {
git commit --no-verify -m "$*"
}
alias fs='foreman start'
@@ -106,6 +120,11 @@ alias dcr='docker-compose restart'
alias dcl='docker-compose logs -tf --tail="50"'
alias dcs='docker-compose ps'
alias tf='tofu'
alias tfp='tofu plan'
alias tfa='tofu apply'
alias tff='tofu fmt'
alias k='kubectl'
alias kp='kubectx matic-production'
alias ks='kubectx matic-staging'
@@ -132,7 +151,80 @@ alias oclean="fd . '/Users/madundead/Syncthing/Obsidian/Personal' | rg sync-conf
alias proxy='kubectl port-forward -n staging svc/tinyproxy-svc 8888:8888'
fzf_kill() {
# Experimental
alias ports='lsof -iTCP -sTCP:LISTEN -n -P'
alias ssn='sudo shutdown now'
o() {
files="$(fzf --print0 --preview "bat --theme ansi --color always {}")"
if [ -z "$files" ]; then
return
fi
echo -n "$files" | xargs -0 -o "$EDITOR"
}
man() {
env \
LESS_TERMCAP_mb=$(printf "\\e[1;31m") \
LESS_TERMCAP_md=$(printf "\\e[1;31m") \
LESS_TERMCAP_me=$(printf "\\e[0m") \
LESS_TERMCAP_se=$(printf "\\e[0m") \
LESS_TERMCAP_so=$(printf "\\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\\e[0m") \
LESS_TERMCAP_us=$(printf "\\e[0;32m") \
man "$@"
}
function ex {
if [ $# -eq 0 ]; then
# display usage if no parameters given
echo "Usage: ex <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz|.zlib|.cso|.zst>"
echo " ex <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
fi
for n in "$@"; do
if [ ! -f "$n" ]; then
echo "'$n' - file doesn't exist"
return 1
fi
case "${n%,}" in
*.cbt | *.tar.bz2 | *.tar.gz | *.tar.xz | *.tbz2 | *.tgz | *.txz | *.tar)
tar zxvf "$n"
;;
*.lzma) unlzma ./"$n" ;;
*.bz2) bunzip2 ./"$n" ;;
*.cbr | *.rar) unrar x -ad ./"$n" ;;
*.gz) gunzip ./"$n" ;;
*.cbz | *.epub | *.zip) unzip ./"$n" ;;
*.z) uncompress ./"$n" ;;
*.7z | *.apk | *.arj | *.cab | *.cb7 | *.chm | *.deb | *.iso | *.lzh | *.msi | *.pkg | *.rpm | *.udf | *.wim | *.xar | *.vhd)
7z x ./"$n"
;;
*.xz) unxz ./"$n" ;;
*.exe) cabextract ./"$n" ;;
*.cpio) cpio -id <./"$n" ;;
*.cba | *.ace) unace x ./"$n" ;;
*.zpaq) zpaq x ./"$n" ;;
*.arc) arc e ./"$n" ;;
*.cso) ciso 0 ./"$n" ./"$n.iso" &&
extract "$n.iso" && \rm -f "$n" ;;
*.zlib) zlib-flate -uncompress <./"$n" >./"$n.tmp" &&
mv ./"$n.tmp" ./"${n%.*zlib}" && rm -f "$n" ;;
*.dmg)
hdiutil mount ./"$n" -mountpoint "./$n.mounted"
;;
*.tar.zst) tar -I zstd -xvf ./"$n" ;;
*.zst) zstd -d ./"$n" ;;
*)
echo "ex: '$n' - unknown archive method"
return 1
;;
esac
done
}
fkill() {
local pids=$(
ps -f -u $USER | sed 1d | fzf --multi | tr -s [:blank:] | cut -d' ' -f3
)
@@ -140,8 +232,7 @@ fzf_kill() {
echo "$pids" | xargs kill -9 "$@"
fi
}
alias fkill='fzf_kill'
alias fk='fkill'
# Homebrew stuff
export MANPATH=/usr/local/share/man:$MANPATH
@@ -156,6 +247,13 @@ export PATH="/opt/homebrew/opt/arm-gcc-bin@8/bin:$PATH"
export PATH="/usr/local/sbin:$PATH"
export PATH="/usr/local/opt/avr-gcc@8/bin:$PATH"
export PATH="/usr/local/opt/arm-gcc-bin@8/bin:$PATH"
export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"
# bun
export BUN_INSTALL="$HOME/.bun"
export PATH=$BUN_INSTALL/bin:$PATH
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"
eval "$(zoxide init bash)"

View File

@@ -1,6 +1,6 @@
[user]
email = madundead@gmail.com
name = Konstantin Bukley
name = Kostiantyn Bukliei
[includeIf "gitdir:~/Development/work/"]
path = ~/Development/work/.gitconfig
@@ -83,6 +83,8 @@
excludesfile = ~/.gitignore_global
attributesfile = ~/.gitattributes
ignorecase = false
# Treat spaces before tabs and all kinds of trailing whitespace as an error
# [default] trailing-space: looks for spaces at the end of a line
# [default] space-before-tab: looks for spaces before tabs at the beginning of a line
@@ -143,6 +145,7 @@
[push]
# https://git-scm.com/docs/git-config#git-config-pushdefault
default = current
autoSetupRemote = true
[branch]
autosetuprebase = always
@@ -159,7 +162,6 @@
insteadOf = "github:"
[url "git@gist.github.com:"]
insteadOf = "gst:"
pushInsteadOf = "gist:"
pushInsteadOf = "git://gist.github.com/"
@@ -169,3 +171,14 @@
[diff-so-fancy]
markEmptyLines = false
[merge]
tool = nvim
[mergetool]
keepBackup = false
[mergetool "nvim"]
cmd = nvim -d $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J'
[pull]
default = current

View File

@@ -1,24 +1,53 @@
fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=46
sort_direction=1
hide_threads=0
# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
htop_version=3.3.0
config_reader_min_version=3
fields=0 48 17 18 38 39 2 46 47 49 1
hide_kernel_threads=1
hide_userland_threads=1
hide_running_in_container=0
shadow_other_users=0
show_thread_names=1
show_program_path=1
highlight_base_name=0
highlight_deleted_exe=1
shadow_distribution_path_prefix=0
highlight_megabytes=1
highlight_threads=1
tree_view=1
highlight_changes=0
highlight_changes_delay_secs=5
find_comm_in_cmdline=1
strip_exe_from_cmdline=1
show_merged_command=0
header_margin=1
screen_tabs=0
detailed_cpu_time=0
cpu_count_from_zero=1
cpu_count_from_one=0
show_cpu_usage=1
show_cpu_frequency=0
update_process_names=1
account_guest_in_cpu_meter=1
color_scheme=0
enable_mouse=1
delay=15
left_meters=AllCPUs2 CPU Blank Memory Swap
left_meter_modes=1 1 2 1 1
right_meters=Hostname Blank Tasks LoadAverage Blank Uptime
right_meter_modes=2 2 2 2 2 2
hide_function_bar=0
header_layout=two_50_50
column_meters_0=AllCPUs2 CPU Blank Memory Swap
column_meter_modes_0=1 1 2 1 1
column_meters_1=Hostname Blank Tasks LoadAverage Blank Uptime
column_meter_modes_1=2 2 2 2 2 2
tree_view=1
sort_key=46
tree_sort_key=46
sort_direction=1
tree_sort_direction=-1
tree_view_always_by_pid=0
all_branches_collapsed=0
screen:Main=PID USER PRIORITY NICE M_VIRT M_RESIDENT STATE PERCENT_CPU PERCENT_MEM TIME Command
.sort_key=PERCENT_CPU
.tree_sort_key=PERCENT_CPU
.tree_view_always_by_pid=0
.tree_view=1
.sort_direction=1
.tree_sort_direction=-1
.all_branches_collapsed=0

View File

@@ -0,0 +1,6 @@
require("config.builtins")
require("config.utils")
require("config.settings")
require("config.filetypes")
require("config.lazy")
require("config.mappings")

View File

@@ -0,0 +1,24 @@
{
"LuaSnip": { "branch": "master", "commit": "776a29c3e1ac61029ac3f57ac6b5937df2340162" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-git": { "branch": "main", "commit": "b24309c386c9666c549a1abaedd4956541676d06" },
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
"cmp-spell": { "branch": "master", "commit": "694a4e50809d6d645c1ea29015dad0c293f019d6" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "c2682b0d9732bf52cbc34862056f143e71dc4a6d" },
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
"nord": { "branch": "main", "commit": "57fb474a1d628bdf9d1e7964719464ed5675d7c7" },
"nvim-bqf": { "branch": "main", "commit": "e20417d5e589e03eaaaadc4687904528500608be" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-lspconfig": { "branch": "master", "commit": "8adb3b5938f6074a1bcc36d3c3916f497d2e8ec4" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"oil.nvim": { "branch": "master", "commit": "5b6068aad7d2057dd399fac73b7fb2cdf23ccd6e" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"vim-tmux-navigator": { "branch": "master", "commit": "97e58f2b3b4f8fd30ce149302f10202f363cc361" }
}

View File

@@ -15,3 +15,4 @@ vim.g.loaded_matchit = 1
vim.g.loaded_matchparen = 1
vim.g.loaded_logiPat = 1
vim.g.loaded_rrhelper = 1
vim.g.loaded_shada_plugin = 1

View File

@@ -0,0 +1,51 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
vim.g.mapleader = ' '
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{ import = "plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "nord" } },
-- automatically check for plugin updates
checker = { enabled = false },
change_detection = {
notify = false,
},
ui = {
icons = {
cmd = "",
config = "🛠",
event = "📅",
ft = "📂",
init = "",
keys = "🗝",
plugin = "🔌",
runtime = "💻",
require = "🌙",
source = "📄",
start = "🚀",
task = "📌",
lazy = "💤 ",
},
},
})

View File

@@ -0,0 +1,143 @@
local function map(mode, lhs, rhs, opts)
local options = { noremap = true }
if opts then options = vim.tbl_extend('force', options, opts) end
vim.keymap.set(mode, lhs, rhs, options)
end
local function nmap(lhs, rhs, opts)
map('n', lhs, rhs, opts)
end
--- Mappings
-- Essentials
vim.g.mapleader = ' '
-- TODO: move to keys (lazy telescope)
vim.keymap.set('n', '<leader>ff', function() require('telescope.builtin').find_files({ hidden = true }) end)
vim.keymap.set('n', '<leader>fb', function() require('telescope.builtin').buffers({ hidden = true }) end)
vim.keymap.set('n', '<leader>fo', function() require('telescope.builtin').find_files({ cwd = '~/Syncthing/Obsidian/Personal/', search_file = '*.md' }) end)
vim.keymap.set('n', '<leader>fO', function() require('telescope.builtin').live_grep({ cwd = '~/Syncthing/Obsidian/Personal/', search_file = '*.md' }) end)
vim.keymap.set('n', '<leader>fh', function() require('telescope.builtin').help_tags() end)
vim.keymap.set('n', '<leader>fq', function() require('telescope.builtin').quickfix() end)
nmap(';', ':')
map('v', ';', ':')
nmap(',,', '<C-^>')
-- TODO: stop this madness, :h autowrite
-- doesnt seem to work well in terminal
nmap('<leader>w', ':w<CR>')
nmap('Q', ':q!<CR>')
nmap('<leader><space>', ':nohlsearch<CR>', { silent = true })
-- Convenience
nmap('yy', 'Y')
nmap('Y', 'y$')
nmap('N', 'Nzz')
nmap('n', 'nzz')
nmap('j', 'gj')
nmap('k', 'gk')
nmap('H', '^')
nmap('L', '$')
nmap('J', 'mzJ`z')
-- nmap('K', '<Nop>')
nmap('gQ', '<Nop>')
nmap('vv', ':vs<CR>')
-- Tabs
nmap('<leader>t', ':tabnew<CR>')
nmap('<Tab>', ':tabnext<CR>')
nmap('<S-Tab>', ':tabprevious<CR>')
nmap('<leader>1', '1gt')
nmap('<leader>2', '2gt')
nmap('<leader>3', '3gt')
nmap('<leader>4', '4gt')
nmap('<leader>5', '5gt')
-- Visual mode
map('v', '.', ':normal .<CR>')
map('v', 'J', ':m \'>+1<CR>gv=gv')
map('v', 'K', ':m \'<-2<CR>gv=gv')
map('v', '<', '<gv')
map('v', '>', '>gv')
-- vim-easy-align
map("n", "ga", "<Plug>(EasyAlign)")
map("x", "ga", "<Plug>(EasyAlign)")
-- nvim-tree.lua
-- nmap('<leader>n', ':NvimTreeToggle<CR>')
-- nmap('<leader>N', ':NvimTreeFindFile<CR>')
vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" })
-- glow.vim
nmap('<leader>p', ':Glow<CR>')
-- fugitive.vim
nmap('<leader>ga', ':Gwrite<CR>')
nmap('<leader>gs', ':Git<CR>')
nmap('<leader>gb', ':Git blame<CR>')
-- rails-vim
-- nmap('<leader>a', ':A<CR>')
nmap('<leader>a', function()
local path = vim.fn.expand('%')
vim.print(path)
-- if path.ends('_spec.rb') then
-- vim.print('spec')
-- elseif path.contains('app') then
-- vim.print('app')
-- else
-- vim.print('nothing')
-- end
end)
-- test
nmap('<leader>r', function() os.execute("tmux send-keys -t '{down-of}' './bin/rspec '" .. vim.fn.expand("%") .. " Enter") end)
nmap('<leader>R', function() os.execute("tmux send-keys -t '{down-of}' './bin/rspec .' Enter") end)
-- grep
nmap('<C-f>', ':grep ')
-- trim whitespace
nmap('<leader>W', ':TrimWhitespace<CR>')
-- EXPERIMENTAL:
-- this is bad because of the accidental missclicks
-- nmap('<leader>x', ":call delete(expand('%')) | bdelete!<CR>")
nmap('<leader>q', ':copen<CR>')
-- pick one (comma makes more sense?)
-- neovim devs have chosen for me https://neovim.io/doc/user/news-0.11.html
nmap(']q', ':cnext<CR>')
nmap('[q', ':cprev<CR>')
nmap(',w', ':cnext<CR>')
nmap(',q', ':cprev<CR>')
-- command mode
vim.keymap.set('c', '<C-a>', '<Home>')
vim.keymap.set('c', '<C-e>', '<End>')
-- paste in visual mode and keep available
local expr = { expr = true, noremap = false, silent = false }
vim.keymap.set('x', 'p', [['pgv"'.v:register.'y`>']], expr)
vim.keymap.set('x', 'P', [['Pgv"'.v:register.'y`>']], expr)
-- vim.keymap.set('n', 'gQ', 'mzgggqG`z<cmd>delmarks z<cr>zz', { desc = 'Format buffer' })
vim.keymap.set('n', '<C-d>', '<C-d>zz', { desc = 'Scroll downwards' })
vim.keymap.set('n', '<C-u>', '<C-u>zz', { desc = 'Scroll upwards' })
-- TODO: luaify
-- create alternate buffer if not exist
-- vim.api.nvim_exec([[
-- command AC :execute "e " . eval('rails#buffer().alternate()')
-- ]], false)
-- vim.keymap.set('n', '<leader>to', '<cmd>tabonly<cr>', { desc = 'Close other tab pages' })
-- Make U opposite to u.
-- vim.keymap.set('n', 'U', '<C-r>', { desc = 'Redo' })

View File

@@ -1,49 +1,12 @@
local cmd, fn, opt, g = vim.cmd, vim.fn, vim.opt, vim.g
local command = vim.api.nvim_create_user_command
cmd('au TextYankPost * lua vim.highlight.on_yank { timeout = 250 }')
g.ruby_host_prog = 'asdf exec neovim-ruby-host'
local opt, g = vim.opt, vim.g
opt.smartindent = true -- Autoindenting when starting a new line
opt.completeopt = {'menu', 'menuone', 'noselect'}
opt.completeopt = { 'menu', 'menuone', 'noselect' }
opt.tabstop = 2 -- Tab counts as 2 columns
opt.shiftwidth = 2 -- Numbers of spaces to (auto)indent
opt.expandtab = true -- Tabs to spaces
opt.clipboard = 'unnamedplus' -- Share clipboard with the OS
opt.number = true -- Display line numbers
-- opt.fillchars = {
-- vert = '▕', -- alternatives │
-- eob = ' ', -- suppress ~ at EndOfBuffer
-- msgsep = '‾',
-- diff = '⣿',
-- fold = ' ',
-- foldopen = '▾',
-- foldsep = '│',
-- foldclose = '▸',
-- }
--
opt.listchars = {
nbsp = '', -- CIRCLED REVERSE SOLIDUS (U+29B8, UTF-8: E2 A6 B8)
extends = '»', -- RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB, UTF-8: C2 BB)
precedes = '«', -- LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00AB, UTF-8: C2 AB)
-- tab = ' ', -- '▷─' WHITE RIGHT-POINTING TRIANGLE (U+25B7, UTF-8: E2 96 B7) + BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL (U+2505, UTF-8: E2 94 85)
trail = '', -- BULLET (U+2022, UTF-8: E2 80 A2)
space = ' ',
}
opt.fillchars = {
diff = '',
eob = ' ', -- NO-BREAK SPACE (U+00A0, UTF-8: C2 A0) to suppress ~ at EndOfBuffer
vert = '', -- window border when window splits vertically ─ ┴ ┬ ┤ ├ ┼
msgsep = '',
fold = '·', -- MIDDLE DOT (U+00B7, UTF-8: C2 B7)
foldopen = '',
foldsep = '',
foldclose = ''
}
opt.synmaxcol = 500 -- Do not try to highlight lines longer than 500 characters
opt.lazyredraw = true -- Do not redraw while running macros
opt.showmatch = true -- Show matching braces
@@ -58,19 +21,39 @@ opt.visualbell = false -- No visual bell
opt.backup = false -- No backups
opt.writebackup = false -- No backups
opt.swapfile = false -- No backups
opt.mouse = 'a' -- Support mouse (for proper mouse highlight)
opt.mouse = '' -- Disable mouse
opt.list = true -- List mode
opt.listchars = { trail = '·', tab = '->' }
opt.timeoutlen = 1000 -- Delay for mappings
opt.ttimeoutlen = 0 -- Delay between modes
-- TODO: leads to "bash: no job control in this shell"
-- opt.shellcmdflag = '-ilc' -- Enables aliases from .bashrc in :! commands
opt.termguicolors = true -- 24-bit RGB color
opt.autoindent = true
if vim.fn.executable('rg') > 0 then
vim.o.grepprg = [[rg --glob "!.git" --no-heading --vimgrep --follow $*]]
end
opt.updatetime = 100
opt.timeout = true
opt.timeoutlen = 1000
opt.ttimeoutlen = 10
opt.listchars = {
nbsp = '', -- CIRCLED REVERSE SOLIDUS (U+29B8, UTF-8: E2 A6 B8)
extends = '»', -- RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB, UTF-8: C2 BB)
precedes = '«', -- LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00AB, UTF-8: C2 AB)
trail = '', -- BULLET (U+2022, UTF-8: E2 80 A2)
space = ' ',
tab = ''
}
opt.fillchars = {
diff = '',
eob = ' ', -- NO-BREAK SPACE (U+00A0, UTF-8: C2 A0) to suppress ~ at EndOfBuffer
-- vert = '│', -- window border when window splits vertically ─ ┴ ┬ ┤ ├ ┼
vert = '',
msgsep = '',
fold = '·', -- MIDDLE DOT (U+00B7, UTF-8: C2 B7)
foldopen = '',
foldsep = '',
foldclose = ''
}
-- Use in vertical diff mode, blank lines to keep sides aligned, Ignore whitespace changes
opt.diffopt = vim.opt.diffopt
@@ -99,6 +82,10 @@ opt.shortmess = {
W = true, -- Don't show [w] or written when writing
}
if vim.fn.executable('rg') > 0 then
vim.o.grepprg = [[rg --glob "!.git" --no-heading --vimgrep --follow $*]]
end
-- ignore when autocompleting
opt.wildignore = {
'*.aux', '*.out', '*.toc', '*.o', '*.obj',
@@ -108,18 +95,38 @@ opt.wildignore = {
'.lock', '.DS_Store', 'tags.lock'
}
-- vim-test
g['test#strategy'] = 'asyncrun_background'
-- find the correct ruby interpreter
g.ruby_host_prog = 'asdf exec neovim-ruby-host'
-- CtrlSF
g.ctrlsf_ackprg = 'rg'
g.ctrlsf_regex_pattern = 1
g.ctrlsf_case_sensitive = 'smart'
g.ctrlsf_default_root = 'project'
g.ctrlsf_context = '-B 1 -A 1'
g.ctrlsf_position = 'bottom'
g.ctrlsf_winsize = '40%'
g.ctrlsf_mapping = {
next = 'n',
prev = 'N',
}
-- highlight yanked text briefly
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.highlight.on_yank {
higroup = 'Search',
timeout = 250,
on_visual = true,
}
end,
})
-- resize splits when Vim is resized
vim.api.nvim_create_autocmd('VimResized', { command = 'horizontal wincmd =' })
vim.api.nvim_create_augroup('cursorline_focus', {})
vim.api.nvim_create_autocmd({ 'InsertLeave', 'WinEnter' }, {
group = 'cursorline_focus',
callback = function()
vim.wo.cursorline = true
end,
})
vim.api.nvim_create_autocmd({ 'InsertEnter', 'WinLeave' }, {
group = 'cursorline_focus',
callback = function()
vim.wo.cursorline = false
end,
})
-- Experimental
opt.iskeyword:prepend { '-' } -- treat dash separated words as a word textobject
vim.cmd('syntax on')

View File

@@ -0,0 +1 @@
return { 'kevinhwang91/nvim-bqf' }

View File

@@ -0,0 +1,165 @@
return {
{
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
opts = function()
local lsp = {
kinds = {
-- Text = '󰉿',
-- Method = '',
-- Function = '󰊕',
-- Constructor = '',
-- Field = '󰜢',
-- Variable = '󰀫',
-- Class = '󰠱',
-- Interface = '󰒪',
-- Module = '',
-- Property = '󰜣',
-- Unit = '',
-- Value = '󰎠',
-- Enum = '',
-- Keyword = '󰌋',
-- Snippet = '',
-- Color = '󰏘',
-- File = '󰈙',
-- Reference = '󰋺',
-- Folder = '󰉋',
-- EnumMember = '',
-- Constant = '󰏿',
-- Struct = '󰙅',
-- Event = '',
-- Operator = '󰆕',
TypeParameter = '',
},
}
local menu = {
luasnip = '[snip]',
nvim_lsp = '[LSP]',
git = '[git]',
spell = '[spell]',
path = '[path]',
buffer = '[buf]',
}
local cmp = require 'cmp'
-- supertab-like mapping
local mapping = {
['<C-n>'] = cmp.mapping.select_next_item {
behavior = cmp.SelectBehavior.Insert,
},
['<C-p>'] = cmp.mapping.select_prev_item {
behavior = cmp.SelectBehavior.Insert,
},
['<C-y>'] = cmp.mapping(
cmp.mapping.confirm {
behavior = cmp.SelectBehavior.Insert,
select = true,
},
{ 'i', 'c' }
),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-c>'] = cmp.mapping.complete {
config = {
sources = {
{ name = 'nvim_lsp' },
},
},
},
['<Up>'] = cmp.config.disable,
['<Down>'] = cmp.config.disable,
}
return {
completion = {
autocomplete = {
cmp.TriggerEvent.TextChanged,
cmp.TriggerEvent.InsertEnter,
},
},
snippet = {
expand = function(args)
vim.snippet.expand(args.body)
end,
},
mapping = mapping,
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
-- {
-- name = 'nvim_lsp',
-- entry_filter = function(entry, ctx)
-- return require('cmp.types').lsp.CompletionItemKind[entry:get_kind()]
-- ~= 'Snippet'
-- end,
-- },
{ name = 'luasnip' },
{ name = 'git' },
}, {
-- { name = 'spell' },
{ name = 'buffer', keyword_length = 4 },
{ name = 'path' },
}),
-- sorting = {
-- comparators = {
-- cmp.config.compare.offset,
-- cmp.config.compare.exact,
-- cmp.config.compare.score,
-- -- function(entry1, entry2)
-- -- local entry1_kind = require('cmp.types').lsp.CompletionItemKind[entry1:get_kind()]
-- -- == 'Snippet'
-- -- local entry2_kind = require('cmp.types').lsp.CompletionItemKind[entry2:get_kind()]
-- -- == 'Snippet'
-- -- print(entry1_kind)
-- -- print(entry2_kind)
-- -- -- if entry1_kind and not entry2_kind then
-- -- -- return false
-- -- -- else
-- -- -- return true
-- -- -- end
-- -- return true
-- -- end,
-- -- cmp.config.compare.kind,
-- cmp.config.compare.sort_text,
-- cmp.config.compare.length,
-- cmp.config.compare.order,
-- },
-- },
-- formatting = {
-- format = function(entry, vim_item)
-- -- source name
-- vim_item.menu = menu[entry.source.name]
-- -- lsp kinds
-- if vim_item.kind ~= nil then
-- vim_item.kind = string.format(
-- '%s [%s]',
-- lsp.kinds[vim_item.kind],
-- vim_item.kind:lower()
-- )
-- end
-- -- shorten long items
-- vim_item.abbr = vim_item.abbr:sub(1, 30)
-- return vim_item
-- end,
-- },
-- experimental = { ghost_text = true },
}
end,
dependencies = {
'saadparwaiz1/cmp_luasnip',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'f3fora/cmp-spell',
{
'petertriho/cmp-git',
opts = {
filetypes = {
'gitcommit',
'octo',
'markdown', -- for gh & glab CLI
},
},
},
},
},
}

View File

@@ -0,0 +1,4 @@
return {
'stevearc/dressing.nvim',
opts = {},
}

View File

@@ -0,0 +1 @@
return { 'tpope/vim-fugitive' }

View File

@@ -0,0 +1,314 @@
local au = vim.api.nvim_create_augroup('LspAttach', { clear = true })
return {
{
'williamboman/mason.nvim',
cmd = 'Mason',
opts = {
ensure_installed = {},
registries = {
'github:mason-org/mason-registry',
},
},
config = function(_, opts)
require('mason').setup(opts)
local registry = require 'mason-registry'
registry:on('package:install:success', function()
vim.defer_fn(function()
-- trigger FileType event to possibly load this newly installed LSP server
require('lazy.core.handler.event').trigger {
event = 'FileType',
buf = vim.api.nvim_get_current_buf(),
}
end, 100)
end)
local function ensure_installed()
for _, tool in ipairs(opts.ensure_installed) do
local package = registry.get_package(tool)
if not package:is_installed() then
package:install()
end
end
end
if registry.refresh then
registry.refresh(ensure_installed)
else
ensure_installed()
end
end,
},
{
'neovim/nvim-lspconfig',
event = { 'BufReadPost', 'BufNewFile' },
init = function()
vim.api.nvim_create_autocmd('LspAttach', {
group = au,
desc = 'LSP keymaps',
callback = function(args)
local bufnr = args.buf
local function map(mode, lhs, rhs)
vim.keymap.set(mode, lhs, rhs, { buffer = bufnr })
end
map('n', 'gD', vim.lsp.buf.declaration)
map('n', 'gd', vim.lsp.buf.definition)
map('n', 'K', vim.lsp.buf.hover)
map('n', 'gi', vim.lsp.buf.implementation)
-- map({ 'n', 'i' }, '<C-s>', vim.lsp.buf.signature_help)
-- map('n', '<leader>wa', vim.lsp.buf.add_workspace_folder)
-- map('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder)
-- map('n', '<leader>wl', function()
-- print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
-- end)
map('n', '<leader>D', vim.lsp.buf.type_definition)
-- map('n', '<leader>r', function()
-- require('conf.nui_lsp').lsp_rename()
-- end)
map('n', 'gr', function()
require('trouble').open { mode = 'lsp_references' }
end)
map('n', '<leader>li', vim.lsp.buf.incoming_calls)
map('n', '<leader>lo', vim.lsp.buf.outgoing_calls)
-- vim.opt.shortmess:append 'c'
end,
})
vim.api.nvim_create_autocmd('LspAttach', {
group = au,
desc = 'LSP inlay hints',
callback = function(args)
local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
if
client
and client.supports_method 'textDocument/inlayHint'
and pcall(require, 'vim.lsp.inlay_hint') -- NOTE: check that API exists
then
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
end
end,
})
vim.api.nvim_create_autocmd('LspAttach', {
group = au,
desc = 'LSP code actions',
callback = function(args)
local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
if
client
and client.supports_method 'textDocument/codeAction'
then
vim.keymap.set(
{ 'n', 'v' },
'<leader>ca',
vim.lsp.buf.code_action,
{ buffer = bufnr }
)
end
end,
})
end,
dependencies = {
-- {
-- 'folke/neoconf.nvim',
-- cmd = 'Neoconf',
-- config = false,
-- dependencies = { 'nvim-lspconfig' },
-- },
-- { 'folke/neodev.nvim', opts = {} },
'hrsh7th/cmp-nvim-lsp',
'mason.nvim',
{
'williamboman/mason-lspconfig.nvim',
opts = {
ensure_installed = {
'lua_ls',
-- 'dockerls',
-- 'docker_compose_language_service',
-- 'yamlls',
-- 'jsonls',
-- 'html',
-- 'cssls',
-- 'gopls',
'clangd',
'texlab',
-- 'ts_ls',
-- 'vtsls',
'terraformls',
'helm_ls',
-- 'bashls'
},
handlers = {
function(server_name)
require('lspconfig')[server_name].setup {}
end,
['yamlls'] = function()
require('lspconfig').yamlls.setup {
single_file_support = true,
filetypes = {
'yaml',
'yaml.gha',
},
root_dir = function(filename)
return require('lspconfig.util').find_git_ancestor(
filename
) or vim.uv.cwd()
end,
settings = {
yaml = {
editor = { formatOnType = true },
schemas = {
-- GitHub CI workflows
['https://json.schemastore.org/github-workflow.json'] = '/.github/workflows/*',
-- Helm charts
['https://json.schemastore.org/chart.json'] = '/templates/*',
},
customTags = {
-- mkdocs
'tag:yaml.org,2002:python/name:material.extensions.emoji.twemoji',
'tag:yaml.org,2002:python/name:material.extensions.emoji.to_svg',
'tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format',
},
},
},
}
require('lspconfig').yamlls.setup {
name = 'yamlls GitLab',
filetypes = { 'yaml.gitlab' },
settings = {
yaml = {
customTags = {
'!reference sequence',
'!reference scalar',
},
},
},
}
end,
['dockerls'] = function()
require('lspconfig').dockerls.setup {
settings = {
docker = {
languageserver = {
formatter = {
ignoreMultilineInstructions = true,
},
},
},
},
}
end,
['jsonls'] = function()
require('lspconfig').jsonls.setup {
filetypes = { 'json', 'jsonc' },
settings = {
json = {
schemas = {
{
fileMatch = { 'package.json' },
url = 'https://json.schemastore.org/package.json',
},
{
fileMatch = { 'tsconfig*.json' },
url = 'https://json.schemastore.org/tsconfig.json',
},
{
fileMatch = {
'.prettierrc',
'.prettierrc.json',
'prettier.config.json',
},
url = 'https://json.schemastore.org/prettierrc.json',
},
{
fileMatch = {
'.eslintrc',
'.eslintrc.json',
},
url = 'https://json.schemastore.org/eslintrc.json',
},
{
fileMatch = {
'.stylelintrc',
'.stylelintrc.json',
'stylelint.config.json',
},
url = 'http://json.schemastore.org/stylelintrc.json',
},
},
},
},
}
end,
['html'] = function()
require('lspconfig').html.setup {
settings = {
html = {
format = {
templating = true,
wrapLineLength = 120,
wrapAttributes = 'auto',
},
hover = {
documentation = true,
references = true,
},
},
},
}
end,
['tsserver'] = function()
require('lspconfig').tsserver.setup {
autostart = false,
root_dir = require('lspconfig.util').root_pattern 'package.json',
commands = {
OrganizeImports = {
function()
local params = {
command = '_typescript.organizeImports',
arguments = {
vim.api.nvim_buf_get_name(
0
),
},
title = '',
}
vim.lsp.buf.execute_command(params)
end,
},
},
}
end,
['lua_ls'] = function()
require('lspconfig').lua_ls.setup {
settings = {
Lua = {
completion = {
callSnippet = 'Replace',
},
workspace = { checkThirdParty = false },
telemetry = { enable = false },
diagnostics = {
unusedLocalExclude = { '_*' },
globals = { 'vim' }
},
format = { enable = false },
hint = {
enable = true,
arrayIndex = 'Disable',
},
},
},
}
end,
},
},
},
},
},
}

View File

@@ -0,0 +1,16 @@
return {
'gbprod/nord.nvim', name = 'nord',
lazy = false,
priority = 1000,
config = function()
vim.g.nord_contrast = true
vim.g.nord_borders = true
vim.g.nord_disable_background = false
vim.g.nord_cursorline_transparent = false
vim.g.nord_enable_sidebar_background = false
vim.g.nord_italic = true
vim.g.nord_uniform_diff_background = true
vim.g.nord_bold = false
vim.cmd [[colorscheme nord]]
end
}

View File

@@ -0,0 +1,33 @@
return {
"stevearc/oil.nvim",
config = function()
require("oil").setup({
-- prompt_save_on_select_new_entry = true,
skip_confirm_for_simple_edits = true,
default_file_explorer = false, -- so `gx` and `:GBrowse` works
use_default_keymap = false,
keymaps = {
["g?"] = "actions.show_help",
["<CR>"] = "actions.select",
["<C-s>"] = "actions.select_vsplit",
["<C-h>"] = false,
["<C-t>"] = "actions.select_tab",
["<C-p>"] = "actions.preview",
["<C-c>"] = "actions.close",
["<C-l>"] = false,
["-"] = "actions.parent",
["_"] = "actions.open_cwd",
["`"] = "actions.cd",
["~"] = "actions.tcd",
["gs"] = "actions.change_sort",
["gx"] = false,
["g."] = "actions.toggle_hidden",
["g\\"] = "actions.toggle_trash",
},
view_options = {
-- Show files and directories that start with "."
show_hidden = false,
}
})
end
}

View File

@@ -0,0 +1,95 @@
return {
{
'L3MON4D3/LuaSnip',
lazy = true,
build = 'make install_jsregexp',
keys = {
{
'<C-j>',
function()
local luasnip = require 'luasnip'
if luasnip.jumpable(1) then
luasnip.jump(1)
end
end,
mode = { 'i', 's' },
desc = 'jump to next snippet',
},
{
'<C-k>',
function()
local luasnip = require 'luasnip'
if luasnip.jumpable(-1) then
luasnip.jump(-1)
end
end,
mode = { 'i', 's' },
desc = 'jump to previous snippet',
},
{
'<C-e>',
function()
local luasnip = require 'luasnip'
if luasnip.choice_active() then
luasnip.change_choice(1)
end
end,
mode = { 'i', 's' },
desc = 'cycle through snippet choice node',
},
},
opts = {},
config = function()
local ls = require 'luasnip'
local types = require 'luasnip.util.types'
vim.api.nvim_set_hl(
0,
'LuasnipChoiceNodePassive',
{ italic = true }
)
vim.api.nvim_set_hl(0, 'LuasnipChoiceNodeActive', { bold = true })
ls.config.set_config {
keep_roots = true,
link_roots = true,
link_children = true,
region_check_events = 'CursorMoved,CursorHold,InsertEnter',
delete_check_events = 'InsertLeave',
ext_opts = {
[types.choiceNode] = {
active = {
virt_text = { { '', 'Operator' } }, -- 
hl_mode = 'combine',
},
},
[types.insertNode] = {
active = {
virt_text = { { '', 'Type' } }, -- 
hl_mode = 'combine',
},
},
},
enable_autosnippets = true,
}
vim.api.nvim_create_autocmd('User', {
pattern = 'LuasnipSnippetsAdded',
callback = function()
print 'snippets loaded'
end,
})
require('luasnip.loaders.from_lua').lazy_load {
paths = { './snippets' },
}
end,
dependencies = {
'rafamadriz/friendly-snippets',
config = function()
require('luasnip.loaders.from_vscode').lazy_load()
end,
enabled = false,
},
},
}

View File

@@ -0,0 +1,7 @@
return {
'nvim-telescope/telescope.nvim', tag = '0.1.8',
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
require('telescope').setup()
end
}

View File

@@ -0,0 +1 @@
return { 'christoomey/vim-tmux-navigator' }

View File

@@ -0,0 +1,3 @@
return {
'tpope/vim-surround'
}

View File

@@ -0,0 +1,60 @@
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function ()
require('nvim-treesitter.configs').setup({
-- one of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = { 'bash', 'c', 'cpp', 'c_sharp', 'clojure', 'cmake', 'comment', 'commonlisp',
'css', 'dockerfile', 'elixir', 'erlang', 'fish', 'go', 'html', 'http', 'java',
'javascript', 'json', 'kotlin', 'latex', 'lua', 'make', 'markdown', 'perl', 'php',
'python', 'ruby', 'rust', 'scss', 'swift', 'toml', 'tsx', 'vim', 'vue', 'yaml' },
-- ignore_install = { 'norg' },
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
context_commentstring = {
enable = true,
enable_autocmd = false,
},
rainbow = {
enable = true,
disable = { "html" },
extended_mode = false,
max_file_lines = nil,
},
indent = { enable = true },
autopairs = { enable = true },
autotag = { enable = true },
incremental_selection = { enable = true },
textobjects = { -- syntax-aware textobjects
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
disable = {},
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['af'] = '@function.outer',
['if'] = '@function.inner',
['aC'] = '@class.outer',
['iC'] = '@class.inner',
['ac'] = '@conditional.outer',
['ic'] = '@conditional.inner',
['ab'] = '@block.outer',
['ib'] = '@block.inner',
['al'] = '@loop.outer',
['il'] = '@loop.inner',
['is'] = '@statement.inner',
['as'] = '@statement.outer',
['am'] = '@call.outer',
['im'] = '@call.inner',
['ad'] = '@comment.outer',
['id'] = '@comment.inner',
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
},
},
}
})
end
}

View File

@@ -25,7 +25,7 @@ set -g renumber-windows on
set -g focus-events off
# https://gist.github.com/andersevenrud/015e61af2fd264371032763d4ed965b6
set -g default-terminal "tmux-256color"
set -g default-terminal "screen-256color"
set -ag terminal-overrides ",xterm-256color:RGB"
# => Theme
@@ -38,8 +38,9 @@ set -g message-style fg=colour166,bg=colour235
set -g window-status-format " ━━━━━━ "
set -g window-status-current-format " ━━━━━━ "
set -g status-left ''
set -g status-right ''
set -g status-left ""
# set -g status-left "#{?#{pane_ssh_connected},#{hostname_short},}"
set -g status-right "#(/bin/bash $HOME/.tmux/kube-tmux/kube.tmux 250 red cyan)"
set -g status-justify centre
# Planck
@@ -108,6 +109,8 @@ set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'soyuka/tmux-current-pane-hostname'
# If run as "tmux attach", create a session if one does not already exist
new-session -A -s default

View File

@@ -1,12 +0,0 @@
-- Author: Konstantin Bukley <madundead@gmail.com>
-- License: WTFPL
-- Description: Personal neovim configuration
vim.loader.enable()
require('filetypes')
require('builtins')
require('plugins')
require('util')
require('settings')
require('mappings')

View File

@@ -1,85 +0,0 @@
local function map(mode, lhs, rhs, opts)
local options = { noremap = true }
if opts then options = vim.tbl_extend('force', options, opts) end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
local function nmap(lhs, rhs, opts)
map('n', lhs, rhs, opts)
end
--- Mappings
-- Essentials
vim.g.mapleader = ' '
nmap(';', ':')
nmap(',,', '<C-^>')
nmap('<leader>w', ':w<CR>') -- TODO: stop this madness, :h autowrite
nmap('Q', ':q!<CR>')
nmap('<leader><space>', ':nohlsearch<CR>', { silent = true })
-- Convenience
nmap('yy', 'Y')
nmap('Y', 'y$')
nmap('N', 'Nzz')
nmap('n', 'nzz')
nmap('j', 'gj')
nmap('k', 'gk')
nmap('H', '^')
nmap('L', '$')
nmap('J', 'mzJ`z')
nmap('K', '<Nop>')
nmap('gQ', '<Nop>')
nmap('vv', ':vs<CR>')
-- Tabs
nmap('<leader>t', ':tabnew<CR>')
nmap('<Tab>', ':tabnext<CR>')
nmap('<S-Tab>', ':tabprevious<CR>')
nmap('<leader>1', '1gt')
nmap('<leader>2', '2gt')
nmap('<leader>3', '3gt')
nmap('<leader>4', '4gt')
nmap('<leader>5', '5gt')
-- Visual mode
map('v', '.', ':normal .<CR>')
map('v', 'J', ':m \'>+1<CR>gv=gv')
map('v', 'K', ':m \'<-2<CR>gv=gv')
map('v', '<', '<gv')
map('v', '>', '>gv')
-- vim-easy-align
vim.keymap.set("n", "ga", "<Plug>(EasyAlign)")
vim.keymap.set("x", "ga", "<Plug>(EasyAlign)")
-- nvim-tree.lua
nmap('<leader>n', ':NvimTreeToggle<CR>')
nmap('<leader>N', ':NvimTreeFindFile<CR>')
-- glow.vim
nmap('<leader>p', ':Glow<CR>')
-- fugitive.vim
nmap('<leader>ga',':Gwrite<CR>')
nmap('<leader>gs',':Git<CR>')
nmap('<leader>gb',':Git blame<CR>')
-- rails-vim
nmap('<leader>a', ':A<CR>')
-- test
nmap('<leader>r', ':TestFile<CR>')
nmap('<leader>R', ':TestSuite<CR>')
-- CtrlSF
nmap('<C-f>', '<Plug>CtrlSFPrompt')
-- trim whitespace
nmap('<leader>W', ':TrimWhitespace<CR>')
-- EXPERIMENTAL:
-- nmap('<leader>x', ':!rm %<CR>')
nmap('<leader>x', ":call delete(expand('%')) | bdelete!<CR>")
nmap('<leader>q', ':copen<CR>')

View File

@@ -1,19 +0,0 @@
local cmp = require('cmp')
local cmp_action = require('lsp-zero').cmp_action()
require('luasnip.loaders.from_vscode').lazy_load()
cmp.setup({
sources = {
{name = 'path'},
{name = 'nvim_lsp'},
{name = 'buffer', keyword_length = 3},
{name = 'luasnip', keyword_length = 2},
},
mapping = {
-- `Enter` key to confirm completion
['<CR>'] = cmp.mapping.confirm({select = false}),
['<Tab>'] = cmp_action.luasnip_supertab(),
['<S-Tab>'] = cmp_action.luasnip_shift_supertab(),
}
})

View File

@@ -1 +0,0 @@
require('Comment').setup()

View File

@@ -1 +0,0 @@
require('gitsigns').setup()

View File

@@ -1,138 +0,0 @@
local cmd, fn, opt, g = vim.cmd, vim.fn, vim.opt, vim.g
vim.loader.enable()
cmd [[packadd packer.nvim]]
local packer = require('packer')
local use = packer.use
-- NB: Difference between config and setup (https://github.com/wbthomason/packer.nvim#specifying-plugins)
--
-- `config` - Specifies code to run after this plugin is loaded.
--
-- The setup key implies opt = true
-- `setup` - Specifies code to run before this plugin is loaded. The code is ran even if
-- the plugin is waiting for other conditions (ft, cond...) to be met.
packer.startup(function()
use { 'wbthomason/packer.nvim', opt = true }
use {
'shaunsingh/nord.nvim',
config = function()
require('plugins.nord').config()
end,
setup = function()
require('plugins.nord').setup()
end
}
use {
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate',
event = { 'BufRead', 'BufNewFile' },
config = function()
require('plugins/treesitter').config()
end,
requires = {
{
'nvim-treesitter/nvim-treesitter-textobjects',
after = 'nvim-treesitter'
},
{
'nvim-treesitter/playground',
cmd = 'TSPlaygroundToggle',
}
}
}
use { 'nvim-tree/nvim-tree.lua',
config = function()
require('plugins/nvim-tree').config()
end,
opt = true,
cmd = { 'NvimTreeToggle', 'NvimTreeFindFile' }
}
use 'numtostr/comment.nvim'
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = fn.executable "make" == 1 }
use { 'nvim-telescope/telescope.nvim',
module = 'telescope',
requires = { 'nvim-lua/plenary.nvim' },
config = function()
require('plugins/telescope').config()
end,
setup = function()
require('plugins/telescope').setup()
end
}
-- Vimscript
use { 'junegunn/vim-easy-align',
-- opt = false,
-- event = { 'BufRead', 'BufNewFile' },
-- cmd = { 'EasyAlign' }
}
use 'christoomey/vim-tmux-navigator'
use 'lewis6991/gitsigns.nvim'
-- tpope
use 'tpope/vim-surround'
use 'tpope/vim-fugitive'
use 'tpope/vim-rails'
use 'tpope/vim-rhubarb'
use 'tpope/vim-repeat'
-- tests
use 'vim-test/vim-test'
use 'benmills/vimux'
-- TODO: find lua replacement / or learn :grep / cfdo
use 'dyng/ctrlsf.vim'
use 'andrewradev/splitjoin.vim'
use 'ggandor/leap.nvim'
use {
'VonHeikemen/lsp-zero.nvim',
branch = 'v3.x',
requires = {
-- LSP Support
{'neovim/nvim-lspconfig'}, -- Required
{ -- Optional
'williamboman/mason.nvim',
run = function()
pcall(vim.cmd, 'MasonUpdate')
end,
},
{'williamboman/mason-lspconfig.nvim'}, -- Optional
-- Autocompletion
{'hrsh7th/nvim-cmp'}, -- Required
{'hrsh7th/cmp-nvim-lsp'}, -- Required
{'hrsh7th/cmp-buffer'}, -- Optional
{'hrsh7th/cmp-path'}, -- Optional
{'saadparwaiz1/cmp_luasnip'}, -- Optional
{'hrsh7th/cmp-nvim-lua'}, -- Optional
-- Snippets
{'L3MON4D3/LuaSnip'}, -- Required
{'rafamadriz/friendly-snippets'}, -- Optional
}
}
use { "dstein64/vim-startuptime", cmd = "StartupTime" }
-- EXPERIMENTAL: trying out different plugins
use { 'skywind3000/asyncrun.vim' }
use {'kevinhwang91/nvim-bqf', ft = 'qf'} -- better qf
end)
require('plugins.lsp')
require('plugins.cmp')
require('plugins.comment')
require('plugins.gitsigns')

View File

@@ -1,35 +0,0 @@
local lsp_zero = require('lsp-zero')
local lspconfig = require('lspconfig')
lsp_zero.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
lsp_zero.default_keymaps({buffer = bufnr})
end)
require('mason').setup({})
require('mason-lspconfig').setup({
ensure_installed = {},
handlers = { lsp_zero.default_setup },
})
lspconfig.solargraph.setup({
-- there's a very weird problem with mason-provided solargraph
-- so instead I'm using the one from asdf
cmd = { os.getenv( "HOME" ) .. "/.asdf/shims/solargraph", 'stdio' },
settings = {
solargraph = {
autoformat = true,
completion = true,
diagnostic = true,
folding = true,
references = true,
rename = true,
symbols = true
}
}
})
lspconfig.lua_ls.setup(lsp_zero.nvim_lua_ls())
lsp_zero.setup()

View File

@@ -1,57 +0,0 @@
-- TODO: figure out how to simplify the snippets config
-- TODO: figure out how to create custom snippets
-- TODO: is it possible to use luasnip without nvim-cpm?
local function prequire(...)
local status, lib = pcall(require, ...)
if (status) then return lib end
return nil
end
local luasnip = prequire('luasnip')
local cmp = prequire("cmp")
local t = function(str)
return vim.api.nvim_replace_termcodes(str, true, true, true)
end
local check_back_space = function()
local col = vim.fn.col('.') - 1
if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
return true
else
return false
end
end
_G.tab_complete = function()
if cmp and cmp.visible() then
cmp.select_next_item()
elseif luasnip and luasnip.expand_or_jumpable() then
return t("<Plug>luasnip-expand-or-jump")
elseif check_back_space() then
return t "<Tab>"
else
cmp.complete()
end
return ""
end
_G.s_tab_complete = function()
if cmp and cmp.visible() then
cmp.select_prev_item()
elseif luasnip and luasnip.jumpable(-1) then
return t("<Plug>luasnip-jump-prev")
else
return t "<S-Tab>"
end
return ""
end
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
vim.api.nvim_set_keymap("i", "<C-E>", "<Plug>luasnip-next-choice", {})
vim.api.nvim_set_keymap("s", "<C-E>", "<Plug>luasnip-next-choice", {})
require("luasnip.loaders.from_vscode").lazy_load()

View File

@@ -1,37 +0,0 @@
local M = {}
function M.setup()
-- https://github.com/shaunsingh/nord.nvim#%EF%B8%8F-configuration
-- Make sidebars and popup menus like nvim-tree and telescope
-- have a different background
vim.g.nord_contrast = true
-- Enable the border between verticaly split windows visable
vim.g.nord_borders = true
-- Disable the setting of background color so that NeoVim
-- can use your terminal background
vim.g.nord_disable_background = false
-- Set the cursorline transparent/visible
vim.g.nord_cursorline_transparent = false
-- Re-enables the background of the sidebar if you disabled the background of everything
vim.g.nord_enable_sidebar_background = false
-- Enables/disables italics
vim.g.nord_italic = true
-- Enables/disables colorful backgrounds when used in diff mode
vim.g.nord_uniform_diff_background = true
-- Enables/disables bold
vim.g.nord_bold = false
end
function M.config()
require('nord').set()
end
return M

View File

@@ -1,20 +0,0 @@
local M = {}
function M.config()
require("nvim-tree").setup({
sort_by = "case_sensitive",
renderer = {
icons = {
show = {
file = false,
folder = false,
folder_arrow = false,
git = false,
}
},
group_empty = true,
}
})
end
return M

View File

@@ -1,55 +0,0 @@
local M = {}
function M.setup()
vim.keymap.set('n', '<leader>ff', function() require('telescope.builtin').find_files({ hidden = true }) end)
vim.keymap.set('n', '<leader>fo', function() require('telescope.builtin').find_files({ cwd = '~/Syncthing/Obsidian/Personal/', search_file = '*.md' }) end)
vim.keymap.set('n', '<leader>fh', function() require('telescope.builtin').help_tags() end)
-- require('telescope.builtin').find_files({ hidden = true })
end
function M.config()
local telescope = require 'telescope'
telescope.setup {
defaults = {
layout_strategy = 'vertical',
winblend = 7,
set_env = { COLORTERM = 'truecolor' },
color_devicons = true,
scroll_strategy = 'limit',
},
pickers = {
live_grep = {
only_sort_text = true,
path_display = { 'shorten' },
layout_strategy = 'horizontal',
layout_config = { preview_width = 0.4 },
},
git_files = {
path_display = {},
hidden = true,
show_untracked = true,
layout_strategy = 'horizontal',
layout_config = { preview_width = 0.65 },
},
},
extensions = {
fzf = {
override_generic_sorter = true,
override_file_sorter = true,
case_mode = 'smart_case',
},
},
}
-- pcall(require('telescope').load_extension, 'fzf')
-- Enable telescope fzf native, if installed
telescope.load_extension('fzf')
end
-- Telescope
-- TODO: change to Telescope
-- nmap('<leader>ft', ':Files ~/Tmp<CR>')
-- nmap('<leader>fo', ":call fzf#run(fzf#wrap(fzf#vim#with_preview({ 'source': 'fd . --type f --extension=md --follow --exclude .git ~/Syncthing/Obsidian/Personal' })))<CR>", { silent = true })
return M

View File

@@ -1,60 +0,0 @@
local M = {}
function M.config()
require('nvim-treesitter.configs').setup {
-- one of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = { 'bash', 'c', 'cpp', 'c_sharp', 'clojure', 'cmake', 'comment', 'commonlisp',
'css', 'dockerfile', 'elixir', 'erlang', 'fish', 'go', 'html', 'http', 'java',
'javascript', 'json', 'kotlin', 'latex', 'lua', 'make', 'markdown', 'perl', 'php',
'python', 'ruby', 'rust', 'scss', 'swift', 'toml', 'tsx', 'vim', 'vue', 'yaml' },
-- ignore_install = { 'norg' },
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
context_commentstring = {
enable = true,
enable_autocmd = false,
},
rainbow = {
enable = true,
disable = { "html" },
extended_mode = false,
max_file_lines = nil,
},
indent = { enable = false },
autopairs = { enable = true },
autotag = { enable = true },
incremental_selection = { enable = true },
textobjects = { -- syntax-aware textobjects
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
disable = {},
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['af'] = '@function.outer',
['if'] = '@function.inner',
['aC'] = '@class.outer',
['iC'] = '@class.inner',
['ac'] = '@conditional.outer',
['ic'] = '@conditional.inner',
['ab'] = '@block.outer',
['ib'] = '@block.inner',
['al'] = '@loop.outer',
['il'] = '@loop.inner',
['is'] = '@statement.inner',
['as'] = '@statement.outer',
['am'] = '@call.outer',
['im'] = '@call.inner',
['ad'] = '@comment.outer',
['id'] = '@comment.inner',
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
},
},
}
}
end
return M

View File

@@ -1,405 +0,0 @@
-- Automatically generated packer.nvim plugin loader code
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
return
end
vim.api.nvim_command('packadd packer.nvim')
local no_errors, error_msg = pcall(function()
_G._packer = _G._packer or {}
_G._packer.inside_compile = true
local time
local profile_info
local should_profile = false
if should_profile then
local hrtime = vim.loop.hrtime
profile_info = {}
time = function(chunk, start)
if start then
profile_info[chunk] = hrtime()
else
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
end
end
else
time = function(chunk, start) end
end
local function save_profiles(threshold)
local sorted_times = {}
for chunk_name, time_taken in pairs(profile_info) do
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
end
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
local results = {}
for i, elem in ipairs(sorted_times) do
if not threshold or threshold and elem[2] > threshold then
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
end
end
if threshold then
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
end
_G._packer.profile_output = results
end
time([[Luarocks path setup]], true)
local package_path_str = "/Users/madundead/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/madundead/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/madundead/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/madundead/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/Users/madundead/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
end
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
package.cpath = package.cpath .. ';' .. install_cpath_pattern
end
time([[Luarocks path setup]], false)
time([[try_loadstring definition]], true)
local function try_loadstring(s, component, name)
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
if not success then
vim.schedule(function()
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
end)
end
return result
end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
LuaSnip = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/LuaSnip",
url = "https://github.com/L3MON4D3/LuaSnip"
},
["asyncrun.vim"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/asyncrun.vim",
url = "https://github.com/skywind3000/asyncrun.vim"
},
["cmp-buffer"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/cmp-buffer",
url = "https://github.com/hrsh7th/cmp-buffer"
},
["cmp-nvim-lsp"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
},
["cmp-nvim-lua"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua",
url = "https://github.com/hrsh7th/cmp-nvim-lua"
},
["cmp-path"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/cmp-path",
url = "https://github.com/hrsh7th/cmp-path"
},
cmp_luasnip = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
url = "https://github.com/saadparwaiz1/cmp_luasnip"
},
["comment.nvim"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/comment.nvim",
url = "https://github.com/numtostr/comment.nvim"
},
["ctrlsf.vim"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/ctrlsf.vim",
url = "https://github.com/dyng/ctrlsf.vim"
},
["friendly-snippets"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/friendly-snippets",
url = "https://github.com/rafamadriz/friendly-snippets"
},
["gitsigns.nvim"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
url = "https://github.com/lewis6991/gitsigns.nvim"
},
["leap.nvim"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/leap.nvim",
url = "https://github.com/ggandor/leap.nvim"
},
["lsp-zero.nvim"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim",
url = "https://github.com/VonHeikemen/lsp-zero.nvim"
},
["mason-lspconfig.nvim"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
url = "https://github.com/williamboman/mason-lspconfig.nvim"
},
["mason.nvim"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/mason.nvim",
url = "https://github.com/williamboman/mason.nvim"
},
["nord.nvim"] = {
config = { "\27LJ\2\n;\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\vconfig\17plugins.nord\frequire\0" },
loaded = true,
needs_bufread = false,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/opt/nord.nvim",
url = "https://github.com/shaunsingh/nord.nvim"
},
["nvim-bqf"] = {
loaded = false,
needs_bufread = true,
only_cond = false,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/opt/nvim-bqf",
url = "https://github.com/kevinhwang91/nvim-bqf"
},
["nvim-cmp"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp"
},
["nvim-lspconfig"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig"
},
["nvim-tree.lua"] = {
commands = { "NvimTreeToggle", "NvimTreeFindFile" },
config = { "\27LJ\2\n@\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\vconfig\22plugins/nvim-tree\frequire\0" },
loaded = false,
needs_bufread = false,
only_cond = false,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/opt/nvim-tree.lua",
url = "https://github.com/nvim-tree/nvim-tree.lua"
},
["nvim-treesitter"] = {
after = { "nvim-treesitter-textobjects" },
config = { "\27LJ\2\nA\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\vconfig\23plugins/treesitter\frequire\0" },
loaded = false,
needs_bufread = false,
only_cond = false,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/opt/nvim-treesitter",
url = "https://github.com/nvim-treesitter/nvim-treesitter"
},
["nvim-treesitter-textobjects"] = {
load_after = {
["nvim-treesitter"] = true
},
loaded = false,
needs_bufread = false,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/opt/nvim-treesitter-textobjects",
url = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects"
},
["packer.nvim"] = {
loaded = false,
needs_bufread = false,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/opt/packer.nvim",
url = "https://github.com/wbthomason/packer.nvim"
},
playground = {
commands = { "TSPlaygroundToggle" },
loaded = false,
needs_bufread = true,
only_cond = false,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/opt/playground",
url = "https://github.com/nvim-treesitter/playground"
},
["plenary.nvim"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/plenary.nvim",
url = "https://github.com/nvim-lua/plenary.nvim"
},
["splitjoin.vim"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/splitjoin.vim",
url = "https://github.com/andrewradev/splitjoin.vim"
},
["telescope-fzf-native.nvim"] = {
cond = { true },
loaded = false,
needs_bufread = false,
only_cond = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/opt/telescope-fzf-native.nvim",
url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim"
},
["telescope.nvim"] = {
config = { "\27LJ\2\n@\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\vconfig\22plugins/telescope\frequire\0" },
loaded = false,
needs_bufread = true,
only_cond = false,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/opt/telescope.nvim",
url = "https://github.com/nvim-telescope/telescope.nvim"
},
["vim-easy-align"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-easy-align",
url = "https://github.com/junegunn/vim-easy-align"
},
["vim-fugitive"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-fugitive",
url = "https://github.com/tpope/vim-fugitive"
},
["vim-rails"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-rails",
url = "https://github.com/tpope/vim-rails"
},
["vim-repeat"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-repeat",
url = "https://github.com/tpope/vim-repeat"
},
["vim-rhubarb"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-rhubarb",
url = "https://github.com/tpope/vim-rhubarb"
},
["vim-startuptime"] = {
commands = { "StartupTime" },
loaded = false,
needs_bufread = false,
only_cond = false,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/opt/vim-startuptime",
url = "https://github.com/dstein64/vim-startuptime"
},
["vim-surround"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-surround",
url = "https://github.com/tpope/vim-surround"
},
["vim-test"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-test",
url = "https://github.com/vim-test/vim-test"
},
["vim-tmux-navigator"] = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-tmux-navigator",
url = "https://github.com/christoomey/vim-tmux-navigator"
},
vimux = {
loaded = true,
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vimux",
url = "https://github.com/benmills/vimux"
}
}
time([[Defining packer_plugins]], false)
local module_lazy_loads = {
["^telescope"] = "telescope.nvim"
}
local lazy_load_called = {['packer.load'] = true}
local function lazy_load_module(module_name)
local to_load = {}
if lazy_load_called[module_name] then return nil end
lazy_load_called[module_name] = true
for module_pat, plugin_name in pairs(module_lazy_loads) do
if not _G.packer_plugins[plugin_name].loaded and string.match(module_name, module_pat) then
to_load[#to_load + 1] = plugin_name
end
end
if #to_load > 0 then
require('packer.load')(to_load, {module = module_name}, _G.packer_plugins)
local loaded_mod = package.loaded[module_name]
if loaded_mod then
return function(modname) return loaded_mod end
end
end
end
if not vim.g.packer_custom_loader_enabled then
table.insert(package.loaders, 1, lazy_load_module)
vim.g.packer_custom_loader_enabled = true
end
-- Setup for: telescope.nvim
time([[Setup for telescope.nvim]], true)
try_loadstring("\27LJ\2\n?\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\22plugins/telescope\frequire\0", "setup", "telescope.nvim")
time([[Setup for telescope.nvim]], false)
-- Setup for: nord.nvim
time([[Setup for nord.nvim]], true)
try_loadstring("\27LJ\2\n:\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\17plugins.nord\frequire\0", "setup", "nord.nvim")
time([[Setup for nord.nvim]], false)
time([[packadd for nord.nvim]], true)
vim.cmd [[packadd nord.nvim]]
time([[packadd for nord.nvim]], false)
-- Config for: nord.nvim
time([[Config for nord.nvim]], true)
try_loadstring("\27LJ\2\n;\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\vconfig\17plugins.nord\frequire\0", "config", "nord.nvim")
time([[Config for nord.nvim]], false)
-- Conditional loads
time([[Conditional loading of telescope-fzf-native.nvim]], true)
require("packer.load")({"telescope-fzf-native.nvim"}, {}, _G.packer_plugins)
time([[Conditional loading of telescope-fzf-native.nvim]], false)
-- Command lazy-loads
time([[Defining lazy-load commands]], true)
pcall(vim.api.nvim_create_user_command, 'TSPlaygroundToggle', function(cmdargs)
require('packer.load')({'playground'}, { cmd = 'TSPlaygroundToggle', l1 = cmdargs.line1, l2 = cmdargs.line2, bang = cmdargs.bang, args = cmdargs.args, mods = cmdargs.mods }, _G.packer_plugins)
end,
{nargs = '*', range = true, bang = true, complete = function()
require('packer.load')({'playground'}, {}, _G.packer_plugins)
return vim.fn.getcompletion('TSPlaygroundToggle ', 'cmdline')
end})
pcall(vim.api.nvim_create_user_command, 'NvimTreeToggle', function(cmdargs)
require('packer.load')({'nvim-tree.lua'}, { cmd = 'NvimTreeToggle', l1 = cmdargs.line1, l2 = cmdargs.line2, bang = cmdargs.bang, args = cmdargs.args, mods = cmdargs.mods }, _G.packer_plugins)
end,
{nargs = '*', range = true, bang = true, complete = function()
require('packer.load')({'nvim-tree.lua'}, {}, _G.packer_plugins)
return vim.fn.getcompletion('NvimTreeToggle ', 'cmdline')
end})
pcall(vim.api.nvim_create_user_command, 'NvimTreeFindFile', function(cmdargs)
require('packer.load')({'nvim-tree.lua'}, { cmd = 'NvimTreeFindFile', l1 = cmdargs.line1, l2 = cmdargs.line2, bang = cmdargs.bang, args = cmdargs.args, mods = cmdargs.mods }, _G.packer_plugins)
end,
{nargs = '*', range = true, bang = true, complete = function()
require('packer.load')({'nvim-tree.lua'}, {}, _G.packer_plugins)
return vim.fn.getcompletion('NvimTreeFindFile ', 'cmdline')
end})
pcall(vim.api.nvim_create_user_command, 'StartupTime', function(cmdargs)
require('packer.load')({'vim-startuptime'}, { cmd = 'StartupTime', l1 = cmdargs.line1, l2 = cmdargs.line2, bang = cmdargs.bang, args = cmdargs.args, mods = cmdargs.mods }, _G.packer_plugins)
end,
{nargs = '*', range = true, bang = true, complete = function()
require('packer.load')({'vim-startuptime'}, {}, _G.packer_plugins)
return vim.fn.getcompletion('StartupTime ', 'cmdline')
end})
time([[Defining lazy-load commands]], false)
vim.cmd [[augroup packer_load_aucmds]]
vim.cmd [[au!]]
-- Filetype lazy-loads
time([[Defining lazy-load filetype autocommands]], true)
vim.cmd [[au FileType qf ++once lua require("packer.load")({'nvim-bqf'}, { ft = "qf" }, _G.packer_plugins)]]
time([[Defining lazy-load filetype autocommands]], false)
-- Event lazy-loads
time([[Defining lazy-load event autocommands]], true)
vim.cmd [[au BufRead * ++once lua require("packer.load")({'nvim-treesitter'}, { event = "BufRead *" }, _G.packer_plugins)]]
vim.cmd [[au BufNewFile * ++once lua require("packer.load")({'nvim-treesitter'}, { event = "BufNewFile *" }, _G.packer_plugins)]]
time([[Defining lazy-load event autocommands]], false)
vim.cmd("augroup END")
_G._packer.inside_compile = false
if _G._packer.needs_bufread == true then
vim.cmd("doautocmd BufRead")
end
_G._packer.needs_bufread = false
if should_profile then save_profiles() end
end)
if not no_errors then
error_msg = error_msg:gsub('"', '\\"')
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
end

View File

@@ -1,592 +0,0 @@
" Author: Konstantin Bukley <madundead@gmail.com>
" License: WTFPL
" Description: Personal vim configuration
" ========================================================
" -> General
" ========================================================
nnoremap <Space> <Nop>
let mapleader=' '
" ========================================================
" -> Plugins
" ========================================================
"
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
"
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] }
Plug 'junegunn/vim-easy-align', { 'on': ['<Plug>(EasyAlign)', 'EasyAlign'] }
Plug 'gregsexton/MatchTag', { 'for': 'html' }
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'AndrewRadev/splitjoin.vim'
Plug 'mattn/gist-vim' | Plug 'mattn/webapi-vim'
Plug 'Raimondi/delimitMate'
Plug 'nelstrom/vim-visual-star-search'
Plug 'benmills/vimux'
Plug 'vim-test/vim-test'
Plug 'dyng/ctrlsf.vim'
Plug 'terryma/vim-expand-region'
Plug 'mg979/vim-visual-multi'
Plug 'bogado/file-line'
Plug 'vim-utils/vim-interruptless'
Plug 'airblade/vim-gitgutter'
Plug 'machakann/vim-highlightedyank'
Plug 'arcticicestudio/nord-vim'
Plug 'christoomey/vim-tmux-navigator'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rails', { 'for': 'ruby' }
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-git'
Plug 'tpope/vim-vinegar'
Plug 'tpope/vim-rhubarb'
" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
Plug 'L3MON4D3/LuaSnip' | Plug 'honza/vim-snippets'
" ======== Experimental =================================
" Plug 'nvim-lua/popup.nvim'
" Plug 'nvim-lua/plenary.nvim'
" Plug 'nvim-telescope/telescope.nvim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'neovim/nvim-lspconfig'
call plug#end()
" ========================================================
" -> Functions
" ========================================================
function! StripTrailingWhitespace()
let _s=@/
let l = line(".")
let c = col(".")
%s/\s\+$//e
let @/=_s
silent! call cursor(l, c)
endfunction
function! Tabline()
let s = ''
for i in range(tabpagenr('$'))
let tab = i + 1
let winnr = tabpagewinnr(tab)
let buflist = tabpagebuflist(tab)
let bufnr = buflist[winnr - 1]
let bufname = bufname(bufnr)
let bufmodified = getbufvar(bufnr, "&mod")
let s .= (tab == tabpagenr() ? '%#TabLineSel#' : '%#TabLine#')
if bufname == ''
let s .= ' empty'
elseif bufname =~ 'NERD_tree'
let s .= ' tree'
elseif bufname =~ 'ControlP'
let s .= ' ctrlp'
elseif bufname =~ 'FZF'
let s .= ' fzf'
elseif bufname =~ '__CtrlSF__'
let s .= ' ctrlsf'
else
let s .= ' ' . fnamemodify(bufname, ':t')
endif
if bufmodified
let s .= '(+)'
endif
endfor
let s .= '%#TabLineFill#'
return s
endfunction
function! CloseNERDTree()
if exists("t:NERDTreeBufName")
if bufwinnr(t:NERDTreeBufName) != -1
if winnr("$") == 1
q
endif
endif
endif
endfunction
" ========================================================
" -> Plugin settings
" ========================================================
" Enable matchit.vim
runtime macros/matchit.vim
" --- Netrw
let g:netrw_banner = 0
let g:netrw_list_hide = '^\.$'
let g:netrw_liststyle = 4
" --- test
let test#strategy = "vimux"
" --- NERDTree
let NERDTreeWinPos = "right"
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
let NERDTreeAutoDeleteBuffer = 1
let NERDTreeHijackNetrw = 1
" --- highlightedyank
let g:highlightedyank_highlight_duration = 400
" --- gitgutter
let g:gitgutter_sign_added = '│'
let g:gitgutter_sign_modified = '│'
let g:gitgutter_sign_removed = '│'
let g:gitgutter_sign_modified_removed = '│'
let g:gitgutter_sign_removed_first_line = '│'
" --- fzf
if has('nvim') || has('gui_running')
let $FZF_DEFAULT_OPTS .= ' --no-info --color=gutter:#2E3440'
endif
" Obsidian
command! FO
\ call fzf#run(fzf#wrap(fzf#vim#with_preview({
\ 'source': 'fd . --type f --extension=md --follow --exclude .git ~/Syncthing/Obsidian/Personal'
\ })))
let g:fzf_preview_window = ''
let g:fzf_layout = { 'window': { 'width': 0.6, 'height': 0.6, 'border': 'sharp' } }
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'border': ['fg', 'Ignore'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
" --- CtrlSF
let g:ctrlsf_ackprg = 'rg'
let g:ctrlsf_regex_pattern = 1
let g:ctrlsf_case_sensitive = 'smart'
let g:ctrlsf_default_root = 'project'
let g:ctrlsf_context = '-B 1 -A 1'
let g:ctrlsf_position = 'bottom'
let g:ctrlsf_winsize = '40%'
let g:ctrlsf_mapping =
\ {
\ 'next': 'n',
\ 'prev': 'N',
\ }
" --- gist-vim
let g:gist_clip_command = 'pbcopy'
let g:gist_detect_filetype = 1
let g:gist_post_private = 1
let g:gist_show_privates = 1
" ========================================================
" -> Autocommands
" ========================================================
if has("autocmd")
au filetype help nnoremap <buffer><CR> <c-]>
au filetype help nnoremap <buffer><BS> <c-T>
au filetype help set nonumber
au BufNewFile,BufRead *.docker setl ft=Dockerfile
au FileType xml setlocal equalprg=xmllint\ --format\ --recover\ -\ 2>/dev/null
au FileType json setlocal equalprg=python\ -m\ json.tool
au FileType markdown setlocal wrap
" Hide statusline
au! FileType fzf
au FileType fzf set laststatus=0 noshowmode noruler
\| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
" Close tab if only NERDTree left
au WinEnter * call CloseNERDTree()
" Resize when the host window resized
au VimResized * wincmd =
endif
" ========================================================
" -> Colors & Fonts
" ========================================================
colorscheme nord
set background=dark
set guifont=Fira\ Code\ Medium:h18
if has('gui_running')
set guioptions-=T " Remove toolbar
set guioptions-=m " Remove menubar
set guioptions+=LlRrb " Remove
set guioptions-=LlRrb " Scrollbars
set t_Co=256
else
" Disable Background Color Erase (BCE) so that color schemes
" work properly when Vim is used inside tmux and GNU screen.
" See also http://snk.tuxfamily.org/log/vim-256color-bce.html
set t_ut=
set t_Co=16
endif
" ========================================================
" -> User Interface
" ========================================================
" Nicer separators
set fillchars=diff:⣿,vert:│
" Don't try to highlight lines longer than 800 characters.
set synmaxcol=200
" Do not redraw while running macros
set lazyredraw
" Tab label - requires vim-madundead
set tabline=%!Tabline()
" Number rows
set number
" Disable welcome message
set shortmess+=I
" Show matching braces
set showmatch
" Shows when you are in insert mode
set showmode
" Show title in console status bar
set title
" Dont wrap lines
set nowrap
" When I scroll up or down, there are 2 lines between the line I'm on and the bottom or top of the screen.
set scrolloff=5
" How many tenths of a second to blink on matching brackets
set mat=2
" Disable cursor blink
set gcr=a:blinkon0
" Hide the mouse pointer while typing
set mousehide
" Conceal mostly for markdown
set conceallevel=2
" Highlight VCS conflict markers
match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
" Statusline
set statusline=%<%f
" ========================================================
" -> Behavior & Different Tricks
" ========================================================
" Shamelessly taken from YADR dotfile repo https://github.com/skwp/dotfiles
" Stuff to ignore whent tab completing
set wildignore=*.o,*.obj,*~
set wildignore+=*vim/backups*
set wildignore+=*sass-cache*
set wildignore+=*DS_Store*
set wildignore+=vendor/rails/**
set wildignore+=vendor/cache/**
set wildignore+=*.gem
set wildignore+=log/**
set wildignore+=tmp/**
set wildignore+=*.png,*.jpg,*.gif
" Russian keymap support
set langmap=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯЖ;ABCDEFGHIJKLMNOPQRSTUVWXYZ:,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz
" W invokes sudo
command! W w !sudo tee % > /dev/null
" Use the OS clipboard by default (requires `+clipboard`)
set clipboard=unnamed
" Tenths of a second to show the matching paren
set matchtime=2
" Turn off visualbell
set novisualbell
" Fuck backups
set nobackup
set nowb
set noswapfile
" Doesn't select lines number in vim
set mouse=a
" Fancy whitespace characters
set list listchars=tab:→\ ,trail
" Abbrev. of messages (avoids 'hit enter')
set shortmess+=filmnrxoOtT
" Start scrolling when we're 8 lines away from margins
set scrolloff=8
" The minimal number of screen columns to keep to the left and to the
" right of the cursor if 'nowrap' is set.
set sidescrolloff=15
" Vertical splits in diff mode
set diffopt+=vertical
" Reduce delay between modes
set timeoutlen=1000 ttimeoutlen=0
" Use ripgrep if possible
if executable('rg')
set grepprg=rg\ -i\ --vimgrep
endif
" Enables aliases from .bashrc in :! commands
set shellcmdflag=-ic
" ========================================================
" -> Indentations
" ========================================================
" Automatically inserts one extra level of indentation in some cases
set smartindent
" Tab counts as 2 columns
set tabstop=2
" Numbers of spaces to (auto)indent
set shiftwidth=2
" Spaces
set expandtab
" ========================================================
" -> Hotkeys & Bindings
" ========================================================
nnoremap ; :
nnoremap <silent> Q :q!<CR>
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
nnoremap ,, <C-^>
nnoremap <silent><expr><leader>ff (expand('%') =~ 'NERD_tree' ? "\<C-w>\<C-w>" : '').":Files\<CR>"
nnoremap <silent><expr><leader>b (expand('%') =~ 'NERD_tree' ? "\<C-w>\<C-w>" : '').":Buffers\<CR>"
nnoremap <silent><expr><leader>gl (expand('%') =~ 'NERD_tree' ? "\<C-w>\<C-w>" : '').":Commits\<CR>"
nnoremap <silent><leader>a :A<CR>
nnoremap <silent><leader>x <nop>
nnoremap <silent><leader>n :NERDTreeToggle<CR>
nnoremap <silent><leader>N :NERDTreeFind<CR>
nnoremap <silent><leader>c <ESC>/\v^[<=>]{7}( .*\|$)<CR>
nnoremap <silent><leader>t :tabnew<CR>
nnoremap <silent><leader>d orequire 'pry'; binding.pry<ESC>
nnoremap <silent><leader>D oit { require 'pry'; binding.pry }<ESC>
nnoremap <silent><leader>r :TestFile<CR>
nnoremap <silent><leader>R :TestSuite<CR>
nnoremap <silent><leader>J :%!python -m json.tool<CR>
nnoremap <silent><leader>w :w<CR>
nnoremap <silent><leader>q :q!<CR>
nnoremap <silent><leader>e :e!<CR>
nnoremap <silent><leader>= <C-w>=
nnoremap <silent><leader><space> :nohlsearch<CR>
nnoremap <silent><leader>ga :Gwrite<CR>
nnoremap <silent><leader>gs :Git<CR>
nnoremap <silent><leader>gb :Git blame<CR>
nnoremap <silent><leader>t :tabnew<CR>
nnoremap <silent><Tab> :tabnext<CR>
nnoremap <silent><S-Tab> :tabprevious<CR>
" nnoremap <silent>vv <c-w>v
nnoremap <silent>vv :sp <CR>
nnoremap <silent><C-w> :call StripTrailingWhitespace()<CR>
nnoremap <leader>S :%s/\<<c-r><c-w>\>//g<left><left>
nnoremap yy Y
nnoremap Y y$
nnoremap N Nzz
nnoremap n nzz
nnoremap j gj
nnoremap k gk
nnoremap H ^
nnoremap L $
nnoremap J mzJ`z
nnoremap K <Nop>
nnoremap gQ <Nop>
vnoremap . :normal .<CR>
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
vnoremap < <gv
vnoremap > >gv
inoremap <C-e> <End>
vnoremap <C-e> <End>
cnoremap <C-e> <End>
inoremap <C-a> <Home>
vnoremap <C-a> <Home>
cnoremap <C-a> <Home>
nmap <C-f> <Plug>CtrlSFPrompt
vmap <C-f> <Plug>CtrlSFVwordPath
vmap <Enter> <Plug>(EasyAlign)
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
nnoremap <silent><expr><leader>ft (expand('%') =~ 'NERD_tree' ? "\<C-w>\<C-w>" : '').":Files ~/Tmp\<CR>"
nnoremap <leader>T :e ~/Tmp/
nnoremap <silent><expr><leader>fo (expand('%') =~ 'NERD_tree' ? "\<C-w>\<C-w>" : '').":FO<CR>"
nnoremap <leader>O :e ~/ownCloud/Obsidian/Personal
" undo break points
inoremap , ,<c-g>u
inoremap . .<c-g>u
inoremap ! !<c-g>u
inoremap ? ?<c-g>u
" Fix gx https://github.com/vim/vim/issues/4738#issuecomment-856925080
nnoremap <silent> gx :execute 'silent! !open ' . shellescape(expand('<cWORD>'), 1)<cr>
lua <<EOF
require'nvim-treesitter.configs'.setup {
ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
ignore_install = { "norg" },
highlight = { enable = true },
indent = { enable = true },
autopairs = { enable = true },
}
EOF
lua << EOF
require'lspconfig'.solargraph.setup{}
local nvim_lsp = require('lspconfig')
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
-- Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
local opts = { noremap=true, silent=true }
-- See `:help vim.lsp.*` for documentation on any of the below functions
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
-- buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
-- buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
-- buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
-- buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
-- buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
-- buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
-- buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
end
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local servers = { 'solargraph' }
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
on_attach = on_attach,
flags = {
debounce_text_changes = 150,
}
}
end
require("luasnip.loaders.from_snipmate").load()
local function prequire(...)
local status, lib = pcall(require, ...)
if (status) then return lib end
return nil
end
local luasnip = prequire('luasnip')
local cmp = prequire("cmp")
local t = function(str)
return vim.api.nvim_replace_termcodes(str, true, true, true)
end
local check_back_space = function()
local col = vim.fn.col('.') - 1
if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
return true
else
return false
end
end
_G.tab_complete = function()
if cmp and cmp.visible() then
cmp.select_next_item()
elseif luasnip and luasnip.expand_or_jumpable() then
return t("<Plug>luasnip-expand-or-jump")
elseif check_back_space() then
return t "<Tab>"
else
cmp.complete()
end
return ""
end
_G.s_tab_complete = function()
if cmp and cmp.visible() then
cmp.select_prev_item()
elseif luasnip and luasnip.jumpable(-1) then
return t("<Plug>luasnip-jump-prev")
else
return t "<S-Tab>"
end
return ""
end
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
vim.api.nvim_set_keymap("i", "<C-E>", "<Plug>luasnip-next-choice", {})
vim.api.nvim_set_keymap("s", "<C-E>", "<Plug>luasnip-next-choice", {})
EOF