Add neovim config; Remove things

This commit is contained in:
Martin
2024-04-04 22:24:09 +02:00
parent a56014849a
commit d0fcefb19d
55 changed files with 328 additions and 8080 deletions

163
bin/o
View File

@ -1,163 +0,0 @@
#!/usr/bin/bash
# set -o nounset
# set -e
declare -A sessions=(
["misc"]="~/"
["cloud"]="~/projects/"
["edge"]="~/projects/fabmetrics"
# ["qiv"]="~/dev/projects/qiv/code/java/server"
# ["buchi"]="~/dev/projects/P17.02/Code/"
# ["bosch"]="~/dev/projects/bosch/Code/port/fredwick/source"
)
vimSessionsDir="~/.config/nvim/obsessions"
function setup() {
local session attach
session=$1
attach=$2
if tmux has-session -t $1>/dev/null 2>/dev/null; then
if [[ $attach == true ]]; then
attachSession $session
fi
else
makeSession $session
if [[ $attach == true ]]; then
attachSession $session
fi
fi
}
function makeSession() {
local session dir oldTMUX
session=$1
dir="${sessions[$session]}"
if [[ $insideSession == true ]]; then
oldTMUX="$TMUX"
TMUX=""
fi
case "$session" in
misc)
tmux new-session -s $session -n bash -d >/dev/null 2>/dev/null
tmux send-keys -t $session:0 "cd $dir" C-m
tmux send-keys -t $session:0 'clear' C-m
tmux selectp -t $session:0
tmux splitw -h -p 50
tmux selectp -l
tmux new-window -t $session:1 -n bash
tmux send-keys -t $session:1 "cd $dir" C-m
tmux send-keys -t $session:1 'clear' C-m
;;
edge)
tmux new-session -s $session -n proc -d >/dev/null 2>/dev/null
tmux send-keys -t $session:0 "cd $dir/code/processor" C-m
tmux send-keys -t $session:0 'clear' C-m
tmux send-keys -t $session:0 'git st' C-m
tmux new-window -t $session:1 -n ansible
tmux send-keys -t $session:1 "cd $dir/code/edge-device-setup/ansible" C-m
tmux send-keys -t $session:1 'clear' C-m
tmux new-window -t $session:2 -n edge
tmux send-keys -t $session:2 "cd $dir" C-m
tmux send-keys -t $session:2 'clear' C-m
tmux new-window -t $session:3 -n deploy
tmux send-keys -t $session:3 "cd $dir/files/deployment" C-m
tmux send-keys -t $session:3 'clear' C-m
tmux new-window -t $session:4 -n shell
tmux send-keys -t $session:4 "cd $dir" C-m
tmux send-keys -t $session:4 'clear' C-m
;;
cloud)
tmux new-session -s $session -n infra -d >/dev/null 2>/dev/null
tmux send-keys -t $session:0 "cd $dir/cloudExo/repos/infrastructure" C-m
tmux send-keys -t $session:0 'clear' C-m
tmux new-window -t $session:1 -n plat
tmux send-keys -t $session:1 "cd $dir/cloudExo/repos/platform" C-m
tmux send-keys -t $session:1 'clear' C-m
tmux new-window -t $session:2 -n helm
tmux send-keys -t $session:2 "cd $dir/cloudExo/repos/infrastructure/charts" C-m
tmux send-keys -t $session:2 'clear' C-m
tmux new-window -t $session:3 -n files
tmux send-keys -t $session:3 "cd $dir/cloudExo/files/" C-m
tmux send-keys -t $session:3 'clear' C-m
tmux new-window -t $session:4 -n shell
tmux send-keys -t $session:4 "cd $dir/cloudExo" C-m
tmux send-keys -t $session:4 'clear' C-m
tmux new-window -t $session:5 -n azCode
tmux send-keys -t $session:5 "cd $dir/cloudAz/code/" C-m
tmux send-keys -t $session:5 'clear' C-m
;;
esac
tmux select-window -t $session:0
if [[ $insideSession == true ]]; then
TMUX="$oldTMUX"
fi
}
function attachSession() {
if [[ $insideSession == true ]]; then
tmux switch-client -t $1
else
tmux attach -t $1
fi
}
if [ $# -gt 0 ]; then
arg=$1
if [[ ! -z ${TMUX:-} ]]; then
insideSession=true
fi
case "$arg" in
all)
for session in "${!sessions[@]}"; do
setup $session false
done
attachSession misc
;;
kill)
if [ $# -eq 2 ]; then
tmux kill-session -t $2
else
tmux kill-server && echo "killed all sessions"
fi
;;
params)
parameters="${!sessions[@]} all kill"
echo "$parameters"
;;
*)
if [ ! -z "${sessions[$arg]:-}" ]; then
setup $arg true
else
echo "no such session"
exit 1
fi
;;
esac
else
setup misc true
fi

View File

@ -1,4 +0,0 @@
#!/bin/bash
source ~/.bashrc
. "$HOME/.cargo/env"

View File

@ -1,192 +0,0 @@
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
export PATH="$HOME/bin:/usr/local/bin:$PATH"
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export EDITOR=nvim
# Prevent file overwrite on stdout redirection
# Use `>|` to force redirection to an existing file
set -o noclobber
# Automatically trim long paths in the prompt (requires Bash 4.x)
PROMPT_DIRTRIM=2
# Enable history expansion with space
# E.g. typing !!<space> will replace the !! with your last command
bind Space:magic-space
# Turn on recursive globbing (enables ** to recurse all directories)
shopt -s globstar 2> /dev/null
## SMARTER TAB-COMPLETION (Readline bindings) ##
# Perform file completion in a case insensitive fashion
bind "set completion-ignore-case on"
# Treat hyphens and underscores as equivalent
bind "set completion-map-case on"
# Display matches for ambiguous patterns at first tab press
bind "set show-all-if-ambiguous on"
## SANE HISTORY DEFAULTS ##
# Append to the history file, don't overwrite it
shopt -s histappend
# Save multi-line commands as one command
shopt -s cmdhist
# Record each line as it gets issued
# PROMPT_COMMAND='history -a'
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
# Huge history. Doesn't appear to slow things down, so why not?
HISTSIZE=500000
HISTFILESIZE=100000
# Avoid duplicate entries
HISTCONTROL="erasedups:ignoreboth"
# Don't record some commands
export HISTIGNORE="&:[ ]*:exit:ls:bg:fg:history:clear"
# Useful timestamp format
HISTTIMEFORMAT='%F %T '
# Enable incremental history search with up/down arrows (also Readline goodness)
# Learn more about this here: http://codeinthehole.com/writing/the-most-important-command-line-tip-incremental-history-searching-with-inputrc/
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
bind '"\e[C": forward-char'
bind '"\e[D": backward-char'
## BETTER DIRECTORY NAVIGATION ##
# Prepend cd to directory names automatically
shopt -s autocd 2> /dev/null
# Correct spelling errors during tab-completion
shopt -s dirspell 2> /dev/null
# Correct spelling errors in arguments supplied to cd
shopt -s cdspell 2> /dev/null
# This defines where cd looks for targets
# Add the directories you want to have fast access to, separated by colon
# Ex: CDPATH=".:~:~/projects" will look for targets in the current working directory, in home and in the ~/projects folder
CDPATH="."
# This allows you to bookmark your favorite places across the file system
# Define a variable containing a path and you will be able to cd into it regardless of the directory you're in
shopt -s cdable_vars
platform=$(uname)
if [[ $platform == "Linux" ]]; then
TERM=xterm-256color
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [[ "$color_prompt" == yes ]]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto -GFh'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
# xcape
#~/git/xcape/xcape -e 'Control_L=Escape'
# add Matlab path
# export PATH=$PATH:/usr/local/MATLAB/R2015b/bin
export PATH=/usr/local/MATLAB/R2015b/bin:/usr/local/MATLAB/R2015b/toolbox/local:$PATH
elif [[ $platform == "Darwin" ]]; then
PS1="\u@\h:\[\033[0;34m\]\w\[\033[0m\]$ "
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
alias ls="ls -CGFh"
fi
LESS="-im"
export LESS
alias la="ls -A"
alias ll="ls -lha"
alias vim="nvim"
source ~/bin/autocomplete.sh
# alias vims="vim -c \"call feedkeys(':source ~/.vim/obsessions/')\""
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
. "$HOME/.cargo/env"
export OPENAI_API_KEY=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

View File

@ -1,106 +0,0 @@
(require 'package)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))
(setq package-enable-at-startup nil)
(package-initialize)
(setq make-backup-files nil)
; ORG MODE
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-iswitchb)
(setq org-hide-leading-stars t)
(setq org-log-done 'time)
(setq org-todo-keyword-faces
'(("WORKING" . "orange")))
(setq org-todo-keywords
'((sequence "TODO" "WORKING" "|" "DONE")))
(setq org-tag-alist '(("research" . ?r)
("code" . ?c)
("write" . ?w)
("kom" . ?k)
("mail" . ?m)
("call" . ?t)))
; (setq org-tag-alist '((:startgrouptag)
; ("activity")
; (:grouptags)
; ("research" . ?r)
; ("code" . ?c)
; ("write" . ?w)
; (:endgrouptag)
; (:startgrouptag)
; ("kom" ?k)
; (:grouptags)
; ("mail" . ?m)
; ("call" . ?t)
; (:endgrouptag)))
(require 'evil)
(evil-mode t)
;; esc quits
(defun minibuffer-keyboard-quit ()
"Abort recursive edit.
In Delete Selection mode, if the mark is active, just deactivate it;
then it takes a second \\[keyboard-quit] to abort the minibuffer."
(interactive)
(if (and delete-selection-mode transient-mark-mode mark-active)
(setq deactivate-mark t)
(when (get-buffer "*Completions*") (delete-windows-on "*Completions*"))
(abort-recursive-edit)))
(define-key evil-normal-state-map [escape] 'keyboard-quit)
(define-key evil-visual-state-map [escape] 'keyboard-quit)
(define-key minibuffer-local-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-ns-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-completion-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-must-match-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-isearch-map [escape] 'minibuffer-keyboard-quit)
(global-set-key [escape] 'evil-exit-emacs-state)
(define-key evil-normal-state-map (kbd "<return>") 'org-open-at-point)
;; helm settings (TAB in helm window for actions over selected items,
;; C-SPC to select items)
; (require 'helm-config)
; (require 'helm-misc)
; (require 'helm-projectile)
; (require 'helm-locate)
; (setq helm-quick-update t)
; (setq helm-bookmark-show-location t)
; (setq helm-buffers-fuzzy-matching t)
; (after 'projectile
; (package 'helm-projectile))
; (global-set-key (kbd "M-x") 'helm-M-x)
; (defun helm-my-buffers ()
; (interactive)
; (let ((helm-ff-transformer-show-only-basename nil))
; (helm-other-buffer '(helm-c-source-buffers-list
; helm-c-source-elscreen
; helm-c-source-projectile-files-list
; helm-c-source-ctags
; helm-c-source-recentf
; helm-c-source-locate)
; "*helm-my-buffers*")))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(inhibit-startup-screen t)
'(org-agenda-files
(quote
("~/arbeit/org/entropie.org" "~/arbeit/org/particleFlow.org" "~/arbeit/org/seminar.org" "~/arbeit/org/ideen.org"))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)

View File

@ -1 +0,0 @@
#!/bin/sh

View File

@ -1 +0,0 @@
#!/bin/sh

View File

@ -1 +0,0 @@
#!/bin/sh

View File

@ -1,4 +0,0 @@
#!/bin/sh
case "$1" in
rebase) exec .git/hooks/post-merge ;;
esac

View File

@ -1,22 +0,0 @@
# mac
.DS_Store
# c++
*.o
*.d
*.pyc
# tex
*.pdf
*.log
*.aux
*.fls
*.fdb_latexmk
*.toc
*.loa
*.bbl
*.blg
*.rev
*.tdo
*.xmp
*.out

View File

@ -1,34 +0,0 @@
[color]
ui = auto
status = auto
branch = auto
[core]
editor = nvim
[merge]
tool = nvimdiff
[mergetool "nvimdiff"]
cmd = nvim -d $LOCAL $MERGED $BASE $REMOTE -c 'wincmd w' -c 'wincmd J'
[diff]
tool = nvimdiff
[difftool]
prompt = false
[difftool "nvimdiff"]
cmd = "nvim -d -u ~/.config/nvim/init.vim \"$LOCAL\" \"$REMOTE\""
[user]
name = Martin Pander
email = m@p.de
[alias]
st = status
ci = commit
co = checkout
br = branch
pl = pull
ps = push
mno = merge --no-ff
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit
[push]
default = matching
[init]
templatedir = ~/.git_template
[credential]
helper = store

View File

@ -1,7 +0,0 @@
set editing-mode vi
set keymap vi-command
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-char

View File

@ -1,15 +0,0 @@
#!/bin/bash
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
for dotfiles in $SCRIPTDIR/*; do
dotfile=${dotfiles##*/}
if [[ $dotfile != "setup" ]]; then
if [[ ! -a $HOME/.$dotfile ]]; then
ln -s $SCRIPTDIR/$dotfile $HOME/.$dotfile
echo $dotfile "symlinked to" $HOME/.$dotfile
else
echo "already exists:" $HOME/.$dotfile
fi
fi
done

View File

@ -1,73 +0,0 @@
set -g default-terminal "screen-256color"
# set -g utf8
# setw -g utf8 on
# set -g status-utf8 on
set -g mouse on
# set -g mode-mouse on
#setw -g mouse-select-window on
#setw -g mouse-select-pane on
set -s escape-time 0
set -g display-time 1500
#set-option -g default-shell /bin/zsh
set -g allow-rename off
#######################################
# key bindings
#######################################
set -g prefix C-a
bind C-a send-prefix
unbind C-b
setw -g mode-keys vi
unbind S
bind S command-prompt "switch -t %1"
bind C-r source-file ~/.tmux.conf
bind-key -n M-K switch-client -p
bind-key -n M-J switch-client -n
bind-key -n M-L next-window
bind-key -n M-H previous-window
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -a -c "#{pane_current_path}"
#######################################
# status line
#######################################
# /* source "/usr/lib/python3.5/site-packages/powerline/bindings/tmux/powerline.conf" */
set -g status-justify centre
set -g status-left "#[bg=#808080,fg=#ffffff,bold] #S #[default]#[bg=#BCBCBC] #{-30:pane_title} "
set -g status-left-length 40
set -g status-right "#[bg=#BCBCBC] %H:%M #[bg=#808080,fg=#ffffff] %d.%m.%y "
# setw -g window-status-format " #W#F "
# setw -g window-status-current-format " #W#F "
setw -g window-status-format " #W "
setw -g window-status-current-format " #W "
setw -g window-status-separator ""
#######################################
# colors, taken from vim-lucius
#######################################
set -g status-style "bg=#DADADA,fg=#000000"
setw -g window-status-style "bg=#BCBCBC,fg=#000000"
setw -g window-status-current-style "bg=#808080,fg=#ffffff"
setw -g window-status-activity-style "bg=#AFD7AF,fg=#000000"
setw -g window-status-bell-style "bg=#AFD7AF,fg=#000000"
#setw -g window-status-content-style "bg=#AFD7AF,fg=#000000"
set -g pane-active-border-style "bg=#eeeeee,fg=#006699"
set -g pane-border-style "bg=#eeeeee,fg=#999999"

View File

@ -1,168 +0,0 @@
#
# Sets Prezto options.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
#
# General
#
# Set case-sensitivity for completion, history lookup, etc.
# zstyle ':prezto:*:*' case-sensitive 'yes'
# Color output (auto set to 'no' on dumb terminals).
zstyle ':prezto:*:*' color 'yes'
# Set the Zsh modules to load (man zshmodules).
# zstyle ':prezto:load' zmodule 'attr' 'stat'
# Set the Zsh functions to load (man zshcontrib).
# zstyle ':prezto:load' zfunction 'zargs' 'zmv'
# Set the Prezto modules to load (browse modules).
# The order matters.
zstyle ':prezto:load' pmodule \
'environment' \
'terminal' \
'editor' \
'history' \
'directory' \
'spectrum' \
'utility' \
'completion' \
'syntax-highlighting' \
'history-substring-search' \
'prompt' \
'git'
#
# Editor
#
# Set the key mapping style to 'emacs' or 'vi'.
zstyle ':prezto:module:editor' key-bindings 'vi'
# Auto convert .... to ../..
# zstyle ':prezto:module:editor' dot-expansion 'yes'
#
# Git
#
# Ignore submodules when they are 'dirty', 'untracked', 'all', or 'none'.
# zstyle ':prezto:module:git:status:ignore' submodules 'all'
#
# GNU Utility
#
# Set the command prefix on non-GNU systems.
# zstyle ':prezto:module:gnu-utility' prefix 'g'
#
# History Substring Search
#
# Set the query found color.
# zstyle ':prezto:module:history-substring-search:color' found ''
# Set the query not found color.
# zstyle ':prezto:module:history-substring-search:color' not-found ''
# Set the search globbing flags.
# zstyle ':prezto:module:history-substring-search' globbing-flags ''
#
# Pacman
#
# Set the Pacman frontend.
# zstyle ':prezto:module:pacman' frontend 'yaourt'
#
# Prompt
#
# Set the prompt theme to load.
# Setting it to 'random' loads a random theme.
# Auto set to 'off' on dumb terminals.
# zstyle ':prezto:module:prompt' theme 'damoekri'
# zstyle ':prezto:module:prompt' theme 'walters'
zstyle ':prezto:module:prompt' theme 'minimal'
#
# Ruby
#
# Auto switch the Ruby version on directory change.
# zstyle ':prezto:module:ruby:chruby' auto-switch 'yes'
#
# Screen
#
# Auto start a session when Zsh is launched in a local terminal.
# zstyle ':prezto:module:screen:auto-start' local 'yes'
# Auto start a session when Zsh is launched in a SSH connection.
# zstyle ':prezto:module:screen:auto-start' remote 'yes'
#
# SSH
#
# Set the SSH identities to load into the agent.
# zstyle ':prezto:module:ssh:load' identities 'id_rsa' 'id_rsa2' 'id_github'
#
# Syntax Highlighting
#
# Set syntax highlighters.
zstyle ':prezto:module:syntax-highlighting' highlighters \
'main' \
'brackets' \
'pattern' \
'cursor' \
'root'
#
# Set syntax highlighting styles.
# zstyle ':prezto:module:syntax-highlighting' styles \
# 'builtin' 'bg=blue' \
# 'command' 'bg=blue' \
# 'function' 'bg=blue'
#
# Terminal
#
# Auto set the tab and window titles.
# zstyle ':prezto:module:terminal' auto-title 'yes'
# Set the window title format.
# zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s'
# Set the tab title format.
# zstyle ':prezto:module:terminal:tab-title' format '%m: %s'
#
# Tmux
#
# Auto start a session when Zsh is launched in a local terminal.
zstyle ':prezto:module:tmux:auto-start' local 'yes'
# Auto start a session when Zsh is launched in a SSH connection.
zstyle ':prezto:module:tmux:auto-start' remote 'yes'
# Integrate with iTerm2.
zstyle ':prezto:module:tmux:iterm' integrate 'yes'
#
# Completion
#
# Have editor tab completion ignore binary/media files.
zstyle ':prezto:module:completion' editor-ignores 'yes'

View File

@ -1,46 +0,0 @@
# Record each line as it gets issued
# PROMPT_COMMAND='history -a'
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
# Huge history. Doesn't appear to slow things down, so why not?
HISTSIZE=500000
SAVEHIST=500000
HISTFILESIZE=100000
# Avoid duplicate entries
HISTCONTROL="erasedups:ignoreboth"
# Don't record some commands
export HISTIGNORE="&:[ ]*:exit:ls:bg:fg:history:clear"
# Useful timestamp format
HISTTIMEFORMAT='%F %T '
HISTFILE=~/.histfile
setopt autocd extendedglob
unsetopt beep
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/pander/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
typeset -A ZSH_HIGHLIGHT_STYLES
ZSH_HIGHLIGHT_STYLES=(cursor bold)
export EDITOR=nvim
export PATH="$HOME/bin:/usr/local/bin:$PATH"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
unalias rm
#alias open='nautilus . &'
export OPENAI_API_KEY=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

View File

@ -6,34 +6,22 @@
./user/tmux.nix
./user/git.nix
./user/dev.nix
./user/nvim.nix
];
home.packages = with pkgs; [
neovim
# neovim
# # It is sometimes useful to fine-tune packages, for example, by applying
# # overrides. You can do that directly here, just don't forget the
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # fonts?
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
(pkgs.nerdfonts.override { fonts = [ "FiraCodeMono" ]; })
# # You can also create simple shell scripts directly inside your
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
];
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.
home.file = {
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
@ -55,13 +43,13 @@
#
# /etc/profiles/per-user/moustachioed/etc/profile.d/hm-session-vars.sh
#
home.sessionVariables = {
EDITOR = "nvim";
};
#home.sessionVariables = {
# EDITOR = "nvim";
#};
home.shellAliases = {
vim = "nvim";
};
#home.shellAliases = {
# "ll" = "ls -la";
#};
news.display = "silent";

View File

@ -7,11 +7,11 @@
]
},
"locked": {
"lastModified": 1711133180,
"narHash": "sha256-WJOahf+6115+GMl3wUfURu8fszuNeJLv9qAWFQl3Vmo=",
"lastModified": 1712212014,
"narHash": "sha256-s+lbaf3nLRn1++/X2eXwY9mYCA/m9l8AvyG8beeOaXE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "1c2c5e4cabba4c43504ef0f8cc3f3dfa284e2dbb",
"rev": "7e91f2a0ba4b62b88591279d54f741a13e36245b",
"type": "github"
},
"original": {
@ -22,11 +22,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1711163522,
"narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
"lastModified": 1712163089,
"narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
"rev": "fd281bd6b7d3e32ddfa399853946f782553163b5",
"type": "github"
},
"original": {

50
nix/user/nvim.nix Normal file
View File

@ -0,0 +1,50 @@
{ config, pkgs, lib, ... }:
{
programs.neovim = {
enable = true;
defaultEditor = true;
vimAlias = true;
plugins = with pkgs.vimPlugins; [
vim-commentary
vim-repeat
vim-surround
targets-vim
delimitMate
vim-startify
vim-windowswap
vim-nix
plenary-nvim
telescope-nvim
telescope-fzf-native-nvim
yanky-nvim
lualine-nvim
undotree
vim-vsnip
nvim-cmp
cmp-vsnip
cmp-buffer
cmp-path
cmp-cmdline
cmp-nvim-lsp
cmp_yanky
cmp-git
nvim-lspconfig
lspkind-nvim
(nvim-treesitter.withPlugins (p: [ p.awk p.bash p.c p.c_sharp p.cpp p.css p.diff p.dockerfile p.doxygen p.git_config p.gitcommit p.go p.gomod p.gosum p.gotmpl p.helm p.haskell p.html p.http p.java p.javascript p.json p.latex p.lua p.markdown p.markdown_inline p.matlab p.nix p.printf p.python p.regex p.rust p.sql p.strace p.supercollider p.svelte p.swift p.terraform p.tmux p.toml p.typescript p.vim p.xml p.yaml p.zig ]))
];
# extraConfig = ''
# set t_vb=
# '';
extraLuaConfig = builtins.concatStringsSep "\n" [
(lib.strings.fileContents ../../nvim/base.lua)
(lib.strings.fileContents ../../nvim/keymaps.lua)
(lib.strings.fileContents ../../nvim/plugins.lua)
];
};
}

View File

@ -67,6 +67,7 @@
programs.ripgrep.enable = true;
home.packages = with pkgs; [
fd
du-dust
#nerdfonts
];

View File

@ -8,6 +8,7 @@
keyMode = "vi";
escapeTime = 0;
extraConfig = ''
set -g default-terminal "screen-256color"
set -g display-time 1500
unbind S

1
nvim/.gitignore vendored
View File

@ -1 +0,0 @@
.cache/

View File

@ -1,123 +0,0 @@
# This file contains snippets that are always defined. I personally
# have snippets for signatures and often needed texts
# sligthly lower priority than everything else since specialized versions
# should overwrite. The user needs to adjust her priority in her snippets to
# ~-55 so that other filetypes will still overwrite.
priority -60
##############
# NICE BOXES #
##############
global !p
import string, vim
""" Maps a filetype to comment format used for boxes.
Automatically filled during usage"""
_commentDict = { }
def _parse_comments(s):
""" Parses vim's comments option to extract comment format """
i = iter(s.split(","))
rv = []
try:
while True:
# get the flags and text of a comment part
flags, text = next(i).split(':', 1)
if len(flags) == 0:
rv.append((text, text, text, ""))
# parse 3-part comment, but ignore those with O flag
elif flags[0] == 's' and 'O' not in flags:
ctriple = []
indent = ""
if flags[-1] in string.digits:
indent = " " * int(flags[-1])
ctriple.append(text)
flags,text = next(i).split(':', 1)
assert(flags[0] == 'm')
ctriple.append(text)
flags,text = next(i).split(':', 1)
assert(flags[0] == 'e')
ctriple.append(text)
ctriple.append(indent)
rv.append(ctriple)
elif flags[0] == 'b':
if len(text) == 1:
rv.insert(0, (text,text,text, ""))
except StopIteration:
return rv
def _get_comment_format():
""" Returns a 4-element tuple representing the comment format for
the current file. """
return _parse_comments(vim.eval("&comments"))[0]
def make_box(twidth, bwidth=None):
b, m, e, i = _get_comment_format()
bwidth_inner = bwidth - 3 - max(len(b), len(i + e)) if bwidth else twidth + 2
sline = b + m + bwidth_inner * m[0] + 2 * m[0]
nspaces = (bwidth_inner - twidth) // 2
mlines = i + m + " " + " " * nspaces
mlinee = " " + " "*(bwidth_inner - twidth - nspaces) + m
eline = i + m + bwidth_inner * m[0] + 2 * m[0] + e
return sline, mlines, mlinee, eline
def foldmarker():
"Return a tuple of (open fold marker, close fold marker)"
return vim.eval("&foldmarker").split(",")
endglobal
snippet box "A nice box with the current comment symbol" b
`!p
box = make_box(len(t[1]))
snip.rv = box[0] + '\n' + box[1]
`${1:content}`!p
box = make_box(len(t[1]))
snip.rv = box[2] + '\n' + box[3]`
$0
endsnippet
snippet bbox "A nice box over the full width" b
`!p
width = int(vim.eval("&textwidth")) or 71
box = make_box(len(t[1]), width)
snip.rv = box[0] + '\n' + box[1]
`${1:content}`!p
box = make_box(len(t[1]), width)
snip.rv = box[2] + '\n' + box[3]`
$0
endsnippet
snippet fold "Insert a vim fold marker" b
`!p snip.rv = _get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]`${2:1} `!p snip.rv = _get_comment_format()[2]`
endsnippet
snippet foldc "Insert a vim fold close marker" b
`!p snip.rv = _get_comment_format()[0]` ${2:1}`!p snip.rv = foldmarker()[1]` `!p snip.rv = _get_comment_format()[2]`
endsnippet
snippet foldp "Insert a vim fold marker pair" b
`!p snip.rv = _get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]` `!p snip.rv = _get_comment_format()[2]`
${2:${VISUAL:Content}}
`!p snip.rv = _get_comment_format()[0]` `!p snip.rv = foldmarker()[1]` $1 `!p snip.rv = _get_comment_format()[2]`
endsnippet
##########################
# LOREM IPSUM GENERATORS #
##########################
snippet lorem "Lorem Ipsum - 50 Words" b
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
endsnippet
# vim:ft=snippets:

View File

@ -1,154 +0,0 @@
###########################################################################
# TextMate Snippets #
###########################################################################
priority -50
snippet def "#define ..."
#define ${1}
endsnippet
snippet ifndef "#ifndef ... #define ... #endif"
#ifndef ${1/([A-Za-z0-9_]+).*/$1/}
#define ${1:SYMBOL} ${2:value}
#endif
endsnippet
snippet #if "#if #endif" b
#if ${1:0}
${VISUAL}${0:${VISUAL/(.*)/(?1::code)/}}
#endif
endsnippet
snippet inc "#include local header (inc)"
#include "${1:`!p snip.rv = snip.basename + '.h'`}"
endsnippet
snippet Inc "#include <> (Inc)"
#include <${1:.h}>
endsnippet
snippet mark "#pragma mark (mark)"
#if 0
${1:#pragma mark -
}#pragma mark $2
#endif
$0
endsnippet
snippet main "main() (main)"
int main(int argc, char *argv[])
{
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
return 0;
}
endsnippet
# snippet for "for loop (for)"
# for (${2:i} = 0; $2 < ${1:count}; ${3:++$2})
# {
# ${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
# }
# endsnippet
snippet for "for int loop (for)"
for ( ${4:int} ${2:i}=0; $2<${1:count}; ${3:$2++} ) {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
}
endsnippet
snippet enum "Enumeration"
enum ${1:name} { $0 };
endsnippet
snippet once "Include header once only guard"
#ifndef ${1:`!p
if not snip.c:
import random, string
name = re.sub(r'[^A-Za-z0-9]+','_', snip.fn).upper()
rand = ''.join(random.sample(string.ascii_letters+string.digits, 8))
snip.rv = ('%s_%s' % (name,rand)).upper()
else:
snip.rv = snip.c`}
#define $1
${0}
#endif /* end of include guard: $1 */
endsnippet
snippet td "Typedef"
typedef ${1:int} ${2:MyCustomType};
endsnippet
snippet wh "while loop"
while(${1:/* condition */}) {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
}
endsnippet
snippet do "do...while loop (do)"
do {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
} while(${1:/* condition */});
endsnippet
snippet fprintf "fprintf ..."
fprintf(${1:stderr}, "${2:%s}\n"${2/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$3${2/([^%]|%%)*(%.)?.*/(?2:\);)/}
endsnippet
snippet if "if .. (if)"
if (${1:/* condition */})
{
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
}
endsnippet
snippet el "else .. (else)"
else {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
}
endsnippet
snippet eli "else if .. (eli)"
else if (${1:/* condition */}) {
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
}
endsnippet
snippet ife "if .. else (ife)"
if (${1:/* condition */})
{
${2:/* code */}
}
else
{
${3:/* else */}
}
endsnippet
snippet printf "printf .. (printf)"
printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2:\);)/}
endsnippet
snippet st "struct"
struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`}
{
${0:/* data */}
};
endsnippet
snippet fun "function" b
${1:void} ${2:function_name}(${3})
{
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
}
endsnippet
snippet fund "function declaration" b
${1:void} ${2:function_name}(${3});
endsnippet
# vim:ft=snippets:

View File

@ -1,89 +0,0 @@
priority -50
extends c
# We want to overwrite everything in parent ft.
priority -49
###########################################################################
# TextMate Snippets #
###########################################################################
snippet beginend "$1.begin(), $1.end() (beginend)"
${1:v}${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}begin(), $1${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}end()
endsnippet
snippet cl "class .. (class)"
class ${1:`!p snip.rv = snip.basename or "name"`}
{
public:
${1/(\w+).*/$1/} (${2:arguments});
virtual ~${1/(\w+).*/$1/} ();
private:
${0:/* data */}
};
endsnippet
snippet ns "namespace .. (namespace)"
namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`}
{
${VISUAL}${0:${VISUAL/(.*)/(?1::\/* code *\/)/}}
}${1/.+/ \/* /m}$1${1/.+/ *\/ /m}
endsnippet
snippet readfile "read file (readF)"
std::vector<char> v;
if (FILE *fp = fopen(${1:"filename"}, "r"))
{
char buf[1024];
while(size_t len = fread(buf, 1, sizeof(buf), fp))
v.insert(v.end(), buf, buf + len);
fclose(fp);
}
endsnippet
snippet map "std::map (map)"
std::map<${1:key}, ${2:value}> map$0;
endsnippet
snippet vector "std::vector (v)"
std::vector<${1:char}> v$0;
endsnippet
snippet tp "template <typename ..> (template)"
template <typename ${1:_InputIter}>
endsnippet
## my own snippets
snippet dv "debug with var"
std::cout << "$1\n" << ${1:var} << "\n" << std::endl;
endsnippet
snippet dvif "debug with var (if)"
if ( output_ ) std::cout << "$1\n" << ${1:var} << "\n" << std::endl;
endsnippet
snippet pm "debug with message"
std::cout << "${1:message}" << std::endl;
endsnippet
snippet pmif "debug with message (if)"
if ( output_ ) std::cout << "${1:message}" << std::endl;
endsnippet
snippet cb "function comment block" s
// =============================================================================
// ${1:comment}
// =============================================================================
endsnippet
snippet cf "function comment block" s
// == Function =================================================================
// Name : ${1:Name}
// Description: ${2:Description}
// =============================================================================
endsnippet
# vim:ft=snippets:

View File

@ -1,6 +0,0 @@
priority -50
snippet disp "Display variable" i
disp('${1:${VISUAL:variableName}}')
disp(${2:${VISUAL:variable}})
endsnippet

View File

@ -1,92 +0,0 @@
priority -50
global !p
import vim
# Tests for the existence of a variable declared by Vim's filetype detection
# suggesting the type of shell script of the current file
def testShell(scope, shell):
return vim.eval("exists('" + scope + ":is_" + shell + "')")
# Loops over the possible variables, checking for global variables
# first since they indicate an override by the user.
def getShell():
for scope in ["g", "b"]:
for shell in ["bash", "posix", "sh", "kornshell"]:
if testShell(scope, shell) == "1":
if shell == "kornshell":
return "ksh"
if shell == "posix":
return "sh"
return shell
return "sh"
endglobal
###########################################################################
# TextMate Snippets #
###########################################################################
snippet #!
`!p snip.rv = '#!/bin/' + getShell() + "\n\n" `
endsnippet
snippet !env "#!/usr/bin/env (!env)"
`!p snip.rv = '#!/usr/bin/env ' + getShell() + "\n\n" `
endsnippet
snippet temp "Tempfile"
${1:TMPFILE}="$(mktemp -t ${2:`!p
snip.rv = re.sub(r'[^a-zA-Z]', '_', snip.fn) or "untitled"
`})"
${3:${4/(.+)/trap "/}${4:rm -f '$${1/.*\s//}'}${4/(.+)/" 0 # EXIT\n/}${5/(.+)/trap "/}${5:rm -f '$${1/.*\s//}'; exit 1}${5/(.+)/" 2 # INT\n/}${6/(.+)/trap "/}${6:rm -f '$${1/.*\s//}'; exit 1}${6/(.+)/" 1 15 # HUP TERM\n/}}
endsnippet
snippet case "case .. esac (case)"
case ${1:word} in
${2:pattern} )
$0;;
esac
endsnippet
snippet elif "elif .. (elif)"
elif ${2:[[ ${1:condition} ]]}; then
${0:#statements}
endsnippet
snippet for "for ... done (for)"
for (( i = 0; i < ${1:10}; i++ )); do
${0:#statements}
done
endsnippet
snippet forin "for ... in ... done (forin)"
for ${1:i}${2/.+/ in /}${2:words}; do
${0:#statements}
done
endsnippet
snippet here "here document (here)"
<<-${2:'${1:TOKEN}'}
$0
${1/['"`](.+)['"`]/$1/}
endsnippet
snippet if "if ... then (if)"
if ${2:[[ ${1:condition} ]]}; then
${0:#statements}
fi
endsnippet
snippet until "until ... (done)"
until ${2:[[ ${1:condition} ]]}; do
${0:#statements}
done
endsnippet
snippet while "while ... (done)"
while ${2:[[ ${1:condition} ]]}; do
${0:#statements}
done
endsnippet
# vim:ft=snippets:

View File

@ -1,158 +0,0 @@
priority -50
extends texmath
snippet document "document setup"
\documentclass[a4paper]{article}
\usepackage{defaultTex}
% \usepackage[style=alphabetic]{biblatex}
% \addbibresource{lib.bib}
\begin{document}
${1:text}
\end{document}
endsnippet
snippet "b(egin)?" "begin{} / end{}" br
\begin{${1:something}}
${0:${VISUAL}}
\label{${2}}
\end{$1}
endsnippet
snippet bo "bold"
\textbf{${1:${VISUAL}}}$0
endsnippet
snippet tab
\begin{${1:t}${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}{${2:c}}
$0${2/((?<=.)c|l|r)|./(?1: & )/g}
\end{$1${1/(t)$|(a)$|(.*)/(?1:abular)(?2:rray)/}}
endsnippet
snippet fig "Figure environment" b
\begin{figure}${2:[htpb]}
\centering
\includegraphics[width=${3:0.8}\linewidth]{${4:name.ext}}
\caption{${4/(\w+)\.\w+/\u$1/}$0}
\label{fig:${4/(\w+)\.\w+/$1/}}
\end{figure}
endsnippet
snippet enum "Enumerate" b
\begin{enumerate}
\item $1
\end{enumerate}
endsnippet
snippet item "Itemize" b
\begin{itemize}
\item $1
\end{itemize}
endsnippet
snippet desc "Description" b
\begin{description}
\item[$1] $0
\end{description}
endsnippet
snippet eq "equation"
\begin{equation}
${2:${VISUAL}}
\end{equation}
endsnippet
snippet eql "equation with label"
\begin{equation}
${2:${VISUAL}}
\label{$1}
\end{equation}
endsnippet
snippet eqs "aligned equations"
\begin{equation}
\begin{aligned}
${2:${VISUAL}}
\end{aligned}
\end{equation}
endsnippet
snippet eqsl "aligned equations with label"
\begin{equation}
\begin{aligned}
${2:${VISUAL}}
\end{aligned}
\label{$1}
\end{equation}
endsnippet
snippet align "align"
\begin{align}
${2:${VISUAL}}
\label{$1}
\end{align}
endsnippet
snippet it "Individual item" b
\item $1
endsnippet
snippet part "Part" b
\part{${1:part name}}
\label{prt:${2:${1/(\w+)|\W+/(?1:\L$0\E:_)/ga}}}
${0}
endsnippet
snippet cha "Chapter" b
\chapter{${1:chapter name}}
\label{cha:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0}
endsnippet
snippet sec "Section" b
\section{${1:section name}}
\label{sec:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0}
endsnippet
snippet sub "Subsection" b
\subsection{${1:subsection name}}
\label{sub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0}
endsnippet
snippet ssub "Subsubsection" b
\subsubsection{${1:subsubsection name}}
\label{ssub:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0}
endsnippet
snippet par "Paragraph" b
\paragraph{${1:paragraph name}}
\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0}
endsnippet
snippet subp "Subparagraph" b
\subparagraph{${1:subparagraph name}}
\label{par:${2:${1/\\\w+\{(.*?)\}|\\(.)|(\w+)|([^\w\\]+)/(?4:_:\L$1$2$3\E)/ga}}}
${0}
endsnippet
snippet ni "Non-indented paragraph" b
\noindent
${0}
endsnippet
snippet pac "Package" b
\usepackage[${1:options}]{${2:package}}$0
endsnippet
# vim:ft=snippets:

View File

@ -1,85 +0,0 @@
priority -50
##############
# MATH STUFF #
##############
# snippet eq "Equation" b
# \begin{equation}
# $0
# \end{equation}
# endsnippet
# snippet eqnn "Equation without number" b
# \begin{equation*}
# $0
# \end{equation*}
# endsnippet
# snippet eqa "Equation array" b
# \begin{eqnarray}
# $1 & $2 & $0
# \end{eqnarray}
# endsnippet
# snippet eqann "Equation array without numbers" b
# \begin{eqnarray*}
# $1 & $2 & $0
# \end{eqnarray*}
# endsnippet
snippet frac "Fraction" w
\frac{${1:${VISUAL:nom}}}{${2:denom}}
endsnippet
snippet mat "Smart Matrix"
\begin{${1:p/b/v/V/B/small}matrix}
$0
\end{$1matrix}
endsnippet
snippet lrb "left( right)" w
\left( ${1:${VISUAL}} \right)
endsnippet
snippet lrv "left| right|" w
\left| ${1:${VISUAL}} \right|
endsnippet
snippet lrB "left\{ right\}" w
\left\\{ ${1:${VISUAL}} \right\\}
endsnippet
snippet lre "left[ right]" w
\left[ ${1:${VISUAL}} \right]
endsnippet
# my snippets
snippet func "Function" w
\func{${1:${VISUAL}}}{${2}}
endsnippet
snippet funcb "Function with brackets" w
\funcb{${1:${VISUAL}}}{${2}}
endsnippet
snippet int "integral"
\int_{${1}}^{${2}}
endsnippet
snippet sum "sum"
\sum_{${1}}^{${2}}
endsnippet
snippet eqr "eqref"
\eqref{${1}}
endsnippet
snippet v "Vector" w
\vec
endsnippet
snippet bis "bis" w
\bis{${1}}{${2}}
endsnippet
# vim:ft=snippets:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,6 @@
-------------------------
-------- OPTIONS --------
-------------------------
vim.opt.mouse = 'a'
vim.opt.history = 1000
vim.opt.ruler = true
@ -39,9 +42,46 @@ vim.opt.showbreak = '..'
-- vim.opt.clipboard = vim.opt.clipboard + 'unnamedplus'
-- vim.opt.clipboard = 'unnamedplus'
vim.opt.errorbells = false
vim.opt.visualbell = true
vim.opt.visualbell = false
vim.opt.title = true
vim.opt.autoread = true
vim.opt.syntax = 'on'
vim.opt.encoding = 'utf-8'
vim.opt.completeopt = 'menu,menuone,noselect'
----------------------------
-------- COMMANDS --------
----------------------------
--
vim.cmd('filetype plugin indent on')
-- vim.cmd('colorscheme lucius')
-- vim.cmd('LuciusWhite')
----------------------------
-------- AUTOGROUPs --------
----------------------------
vim.api.nvim_create_augroup('VimIntern', { clear = true })
vim.api.nvim_create_autocmd({'FocusGained', 'BufEnter', 'CursorMoved', 'CursorMovedI', 'CursorHold', 'CursorHoldI'}, {
group = 'VimIntern',
pattern = '*',
command = 'silent! checktime'
})
vim.api.nvim_create_autocmd('BufEnter', {
group = 'VimIntern',
pattern = '*',
command = 'silent! lcd %:p:h'
})
---------------------------
-------- FUNCTIONS --------
---------------------------
vim.api.nvim_create_user_command('TrimWhiteSpace', function()
vim.cmd('%s/\\s\\+$//e')
end, {})

View File

@ -1,438 +0,0 @@
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
lua require('basic_vim')
lua require('plugins_vim')
lua require('mappings_vim')
" set nocompatible
" set mouse=a
" set history=1000
" set ruler
" set number
" set showcmd
" set ttimeoutlen=100
" set backspace=indent,eol,start
" set tabstop=4
" set expandtab
" set shiftwidth=4
" set softtabstop=4
" set autoindent
" set showmatch
" set incsearch
" set hlsearch
" set wrapscan
" set ignorecase
" set smartcase
" set hidden
" set splitright
" set splitbelow
" set backupdir=~/.config/nvim/backup,/tmp
" set backup
" set noswapfile
" set wildmode=longest,list
" set nospell
" set foldmethod=syntax
" set foldopen-=block
" set foldlevel=99
" set lazyredraw
" set listchars=eol:¬,tab:\ \ ,trail:·
" set fillchars=vert:\|,fold:\
" set list
" set laststatus=2
" set scrolloff=8
" set background=light
" " set colorcolumn=100
" set wrap
" set showbreak=..
" set clipboard+=unnamedplus
" " set formatoptions+=l
" set noerrorbells
" set visualbell
set t_vb=
" set title
" set autoread
" syntax on
" let g:tex_flavor="latex"
" set listchars=eol:¬,tab:▸\ ,trail:·
" set listchars=eol:¬,tab:>\ ,trail:·
" if !has('nvim') | set encoding=utf-8 | endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" plugins
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" call plug#begin('~/.local/share/nvim/site/plugins')
" Plug 'kien/ctrlp.vim' | Plug 'sgur/ctrlp-extensions.vim'
" Plug 'scrooloose/nerdtree'
" Plug 'scrooloose/syntastic'
" Plug 'vim-scripts/bufexplorer.zip'
" Plug 'majutsushi/tagbar'
" Plug 'Shougo/deoplete.nvim'
" Plug 'SirVer/ultisnips'
" Plug 'Raimondi/delimitMate'
" Plug 'tpope/vim-surround'
" Plug 'tpope/vim-commentary'
" Plug 'junegunn/vim-easy-align'
" Plug 'maxbrunsfeld/vim-yankstack'
" Plug 'tpope/vim-repeat'
" Plug 'wellle/targets.vim'
" Plug 'benekastah/neomake'
" Plug 'tpope/vim-fugitive'
" Plug 'tpope/vim-dispatch'
" Plug 'lervag/vimtex'
" Plug 'vim-scripts/LanguageTool'
" Plug 'mhinz/neovim-remote'
" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | Plug 'junegunn/fzf.vim'
" Plug 'rking/ag.vim'
"
" Plug 'tpope/vim-obsession'
" Plug 'mhinz/vim-startify'
" Plug 'wesQ3/vim-windowswap'
"
" Plug 'bling/vim-airline' | Plug 'vim-airline/vim-airline-themes' |Plug 'jonathanfilip/vim-lucius'
" Plug 'altercation/vim-colors-solarized'
" call plug#end()
filetype plugin indent on
set omnifunc=syntaxcomplete#Complete
" set completeopt=menu
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" plugin specific
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" NerdTree
"let NERDTreeQuitOnOpen=1
"let NERDTreeHijackNetrw=1
" syntastic
" set statusline+=%#warningmsg#
" set statusline+=%{SyntasticStatuslineFlag()}
" set statusline+=%*
" let g:syntastic_always_populate_loc_list = 1
" let g:syntastic_auto_loc_list = 1
" let g:syntastic_check_on_open = 1
" let g:syntastic_check_on_wq = 0
" CtrlP
" set wildignore+=main,*.o,*.d,*.aux,*.bbl,*.lof,*.loa,*.blg,*.fdb_latexmk,*.fls,*.tdo,*.pdf,*.pyc
" let g:ctrlp_switch_buffer = 'e'
" let g:ctrlp_working_path_mode = 'ra'
" let g:ctrlp_extensions = [ 'tag', 'buffertag', 'mixed' ]
" let g:ctrlp_map = ''
" let g:ctrlp_prompt_mappings = {
" \ 'PrtSelectMove("j")': ['<c-n>', '<down>'],
" \ 'PrtSelectMove("k")': ['<c-p>', '<up>'],
" \}
" tagbar
let g:tagbar_left=1
let g:tagbar_autoclose=1
let g:tagbar_autofocus=1
" DelimitMate
let delimitMate_expand_space=1
let delimitMate_expand_cr=1
" UltiSnips
" let g:UltiSnipsSnippetsDir='~/.config/nvim/UltiSnips'
" let g:UltiSnipsSnippetsDirectories=["UltiSnips"]
" let g:UltiSnipsExpandTrigger="<C-j>"
" let g:UltiSnipsJumpForwardTrigger="<C-j>"
" let g:UltiSnipsJumpBackwardTrigger="<C-k>"
" YankStack
"let g:yankstack_map_keys=0
"call yankstack#setup()
" vimtex
" let g:vimtex_fold_enabled = 1
" let g:vimtex_view_method = 'zathura'
" let g:vimtex_quickfix_mode = 2
" let g:deoplete#omni#input_patterns.tex =
" \ '\v\\%('
" \ . '\a*cite\a*%(\s*\[[^]]*\]){0,2}\s*\{[^}]*'
" \ . '|\a*ref%(\s*\{[^}]*|range\s*\{[^,}]*%(}\{)?)'
" \ . '|hyperref\s*\[[^]]*'
" \ . '|includegraphics\*?%(\s*\[[^]]*\]){0,2}\s*\{[^}]*'
" \ . '|%(include%(only)?|input)\s*\{[^}]*'
" \ . '|\a*(gls|Gls|GLS)(pl)?\a*%(\s*\[[^]]*\]){0,2}\s*\{[^}]*'
" \ . '|includepdf%(\s*\[[^]]*\])?\s*\{[^}]*'
" \ . '|includestandalone%(\s*\[[^]]*\])?\s*\{[^}]*'
" \ . ')'
" Startify
let g:startify_session_dir = '~/.config/nvim/obsessions'
let g:startify_list_order = [[' Sessions'],'sessions',
\ [' Bookmarks'],'bookmarks',
\ [' Recent dirs'],'dir',]
let g:startify_bookmarks = [ {'v': '~/.config/nvim/init.vim'} ]
" \ [' Recent files'],'files',
let g:startify_custom_header = []
" windowswap
let g:windowswap_map_keys=0
" airline
let g:airline_theme='lucius'
if !exists('g:airline_symbols')
let g:airline_symbols={}
endif
let g:airline_left_sep=''
let g:airline_right_sep=''
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = '␤'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
let g:airline_section_y=''
let g:airline#extensions#tabline#enabled=1
let g:airline#extensions#tabline#tab_nr_type = 1
let g:airline#extensions#tabline#show_buffers=0
let g:airline#extensions#tabline#show_tab_nr=1
let g:airline#extensions#tabline#show_tab_type=0
let g:airline#extensions#tabline#fnamemod = ':~:.'
" Lucius
colorscheme lucius
LuciusWhite
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" misc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader = "\<Space>"
nnoremap <leader>w :w<CR>
nnoremap <silent> <leader>q :call ToggleList("Quickfix List", 'c')<CR>
nnoremap <silent> <leader>ev :tabnew ~/.config/nvim/init.vim<CR>
nnoremap Y y$
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
" file navigation
nnoremap <silent> <leader>ff <cmd>Telescope find_files<CR>
nnoremap <silent> <leader>fg <cmd>Telescope live_grep<CR>
nnoremap <silent> <leader>o <cmd>Telescope buffers<CR>
nnoremap <silent> <leader>fh <cmd>Telescope help_tags<CR>
nnoremap <silent> <leader>F :e.<CR>
nnoremap <silent> <leader>O :BufExplorer<CR>
nnoremap <silent> <leader>t :CtrlPBufTagAll<CR>
nnoremap <silent> <leader>T :TagbarToggle<CR>
nnoremap <leader>p :CtrlPYankring<CR>
nnoremap <C-p> <Plug>yankstack_substitute_newer_paste
nnoremap <C-n> <Plug>yankstack_substitute_older_paste
" command line mappings
cnoremap <C-p> <Up>
cnoremap <C-n> <Down>
cnoremap w!! w !sudo tee > /dev/null %
" quickfix mappings
" nnoremap <silent> <leader>q :call ToggleList("Quickfix List", 'c')<CR>
" nnoremap <silent> [q :cprevious<CR>
" nnoremap <silent> ]q :cnext<CR>
" split movement
nnoremap <C-h> <C-w>h
nnoremap <BS> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
nnoremap <leader>s :call WindowSwap#EasyWindowSwap()<CR>
" terminal mappings
tnoremap <Esc> <C-\><C-n>
tnoremap <C-h> <C-\><C-n><C-w>h
tnoremap <C-j> <C-\><C-n><C-w>j
tnoremap <C-k> <C-\><C-n><C-w>k
tnoremap <C-l> <C-\><C-n><C-w>l
" alignment mappings
nnoremap <silent> <leader>= :normal vip<CR> :'<,'>EasyAlign =<CR>
vnoremap <silent> <leader>= :'<,'>EasyAlign =<CR>
vmap <Enter> <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
augroup Terminal
autocmd!
au BufWinEnter,WinEnter term://* startinsert
" au TermOpen * call SetMatlabMaps()
augroup END
" no folding on open bracket
augroup Folding
autocmd!
au InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif
au InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif
augroup END
augroup VimIntern
autocmd!
" Source init.vim on write
au BufWritePost $MYVIMRC source %
" check for file change
au FocusGained,BufEnter,CursorMoved,CursorMovedI,CursorHold,CursorHoldI * :silent! checktime
" change working directory to current files directory
au BufEnter * silent! lcd %:p:h
augroup END
" tmux window title
" augroup TmuxTitle
" autocmd!
" au VimEnter * call SaveTmuxWindowName()
" au SessionLoadPost * call ChangeTmuxToSessionName()
" au VimLeave * call system("tmux rename-window '" . g:tmuxWindowName . "'")
" augroup END
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" filetype specific
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" matlab
augroup Matlab
autocmd!
au FileType matlab let b:commentary_format='% %s'
au FileType matlab setlocal listchars=eol,tab:\|\ ,trail
au FileType matlab nnoremap <leader>ml :call OpenMatlabInTerminal()<CR>
" au FileType matlab inoremap <silent> = =<Esc>:call <SID>ealign()<CR>a
augroup END
" c/c++
augroup Cpp
autocmd!
au FileType c,cpp setlocal listchars=eol,tab:\|\ ,trail
au FileType c,cpp nnoremap <leader>ml :call OpenMatlabInTerminal()<CR>
" au FileType c,cpp inoremap <silent> = =<Esc>:call <SID>ealign()<CR>a
augroup END
" " tex
" augroup Tex
" autocmd!
" au Filetype tex,latex setlocal foldmethod=expr
" au Filetype tex,latex setlocal foldlevel=0
" au Filetype tex,latex setlocal spell
" " au Filetype tex,latex setlocal textwidth=80
" au Filetype tex,latex inoremap $ $$<Left>
" au BufWritePost *.tex Neomake
" augroup END
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" custom functions
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" open terminal with matlab in bottom right split
function! OpenMatlabInTerminal()
execute "normal \<C-w>l"
split
terminal mlnd
call SetMatlabMaps()
endfunction
" function! SetMatlabMaps()
" if bufname('') =~? "mlnd"
" tnoremap <buffer> <leader><leader>mc close all<CR>
" tnoremap <buffer> <leader><leader>mw clear<CR>
" tnoremap <buffer> <leader><leader>mf clear functions<CR>
" nnoremap <buffer> <C-c> i<C-c>
" endif
" endfunction
" change tmux window name to session
" function! ChangeTmuxToSessionName()
" let sessionName = v:this_session
" if strlen(sessionName)
" let session = substitute(sessionName, ".*/", "", "g")
" call system("tmux rename-window '" . session . "'")
" else
" call system("tmux rename-window 'nvim'")
" endif
" endfunction
" function! SaveTmuxWindowName()
" let g:tmuxWindowName = system("tmux display-message -p '#W'")
" let g:tmuxWindowName = substitute(g:tmuxWindowName, '\n\+$', '', '')
" call system("tmux rename-window 'nvim'")
" endfunction
" remove whitespaces
function! TrimWhiteSpace()
%s/\s\+$//e
endfunction
" function! s:ealign()
" let p = '^.*=\s.*$'
" if exists(':Tabularize') && getline('.') =~# '^.*=' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
" let column = strlen(substitute(getline('.')[0:col('.')],'[^=]','','g'))
" let position = strlen(matchstr(getline('.')[0:col('.')],'.*=\s*\zs.*'))
" Tabularize/=/l1
" normal! 0
" call search(repeat('[^=]*=',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
" endif
" endfunction
" toggle the quickfix or location list window.
function! GetBufferList()
redir =>buflist
silent! ls
redir END
return buflist
endfunction
function! ToggleList(bufname, pfx)
let buflist = GetBufferList()
for bufnum in map(filter(split(buflist, '\n'), 'v:val =~ "'.a:bufname.'"'), 'str2nr(matchstr(v:val, "\\d\\+"))')
if bufwinnr(bufnum) != -1
exec(a:pfx.'close')
return
endif
endfor
if a:pfx == 'l' && len(getloclist(0)) == 0
echohl ErrorMsg
echo "Location List is Empty."
return
endif
let winnr = winnr()
exec(a:pfx.'open')
if winnr() != winnr
wincmd p
endif
endfunction
" let neomake_matlab_mlint_maker = {
" \ 'exe': 'mlint',
" \ 'errorformat':
" \ '%+PFile:\ %f,' .
" \ 'L\ %l\ (C\ %c):\ %m,' .
" \ 'L\ %l\ (C\ %c-%.):\ %m,',
" \ }
" neomake matlab maker
let neomake_matlab_mlint_maker = {
\ 'exe': 'mlint',
\ 'errorformat':
\ '%+PFile:\ %f,' .
\ 'L\ %l\ (C\ %c):\ %*[a-zA-Z0-9]:\ %m,'.
\ 'L\ %l\ (C\ %c-%*[0-9]):\ %*[a-zA-Z0-9]:\ %m'
\ }

42
nvim/keymaps.lua Normal file
View File

@ -0,0 +1,42 @@
vim.g.mapleader = " "
-- Navigation
vim.keymap.set('n', 'j', 'gj', {})
vim.keymap.set('n', 'k', 'gk', {})
vim.keymap.set('v', 'j', 'gj', {})
vim.keymap.set('v', 'k', 'gk', {})
vim.keymap.set('n', '<C-h>', '<C-w>h', {})
vim.keymap.set('n', '<C-j>', '<C-w>j', {})
vim.keymap.set('n', '<C-k>', '<C-w>k', {})
vim.keymap.set('n', '<C-l>', '<C-w>l', {})
vim.keymap.set('n', '<leader>s', ':call WindowSwap#EasyWindowSwap()<CR>', {})
-- Convenience
vim.keymap.set('n', '<leader>w', ':w<CR>', { silent = true })
vim.keymap.set('n', '<leader>F', ':e.<CR>', {})
vim.keymap.set('n', 'Y', 'y$', {})
-- Telescope
local telebuiltin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', telebuiltin.find_files, { silent = true })
vim.keymap.set('n', '<leader>fg', telebuiltin.live_grep, { silent = true })
vim.keymap.set('n', '<leader>fs', telebuiltin.grep_string, { silent = true })
vim.keymap.set('n', '<leader>o', telebuiltin.buffers, { silent = true })
vim.keymap.set('n', '<leader>fh', telebuiltin.help_tags, { silent = true })
-- Yanky
vim.keymap.set({"n","x"}, "p", "<Plug>(YankyPutAfter)")
vim.keymap.set({"n","x"}, "P", "<Plug>(YankyPutBefore)")
vim.keymap.set({"n","x"}, "gp", "<Plug>(YankyGPutAfter)")
vim.keymap.set({"n","x"}, "gP", "<Plug>(YankyGPutBefore)")
vim.keymap.set("n", "<c-n>", "<Plug>(YankyCycleForward)")
vim.keymap.set("n", "<c-p>", "<Plug>(YankyCycleBackward)")
vim.keymap.set({"n","x"}, "y", "<Plug>(YankyYank)")
-- Undotree
vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle)
-- nnoremap <silent> <leader>t :CtrlPBufTagAll<CR>
-- nnoremap <silent> <leader>T :TagbarToggle<CR>

View File

@ -1,7 +0,0 @@
vim.opt.mouse = 'a'
vim.opt.history = 1000
vim.opt.ruler = true
vim.opt.ruler = true
vim.opt.number = true
vim.opt.showcmd = true
vim.opt.ttimeoutlen = 100

View File

@ -1,17 +0,0 @@
-- Yanky mappings
vim.keymap.set({"n","x"}, "p", "<Plug>(YankyPutAfter)")
vim.keymap.set({"n","x"}, "P", "<Plug>(YankyPutBefore)")
vim.keymap.set({"n","x"}, "gp", "<Plug>(YankyGPutAfter)")
vim.keymap.set({"n","x"}, "gP", "<Plug>(YankyGPutBefore)")
-- vim.keymap.set("n", "<c-n>", "<Plug>(YankyCycleForward)")
-- vim.keymap.set("n", "<c-p>", "<Plug>(YankyCycleBackward)")
vim.keymap.set({"n","x"}, "y", "<Plug>(YankyYank)")
vim.keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<CR>")
-- nnoremap <silent> <leader>f <cmd>Telescope find_files<CR>
-- nnoremap <silent> <leader>fg <cmd>Telescope live_grep<CR>
-- nnoremap <silent> <leader>o <cmd>Telescope buffers<CR>
-- nnoremap <silent> <leader>fh <cmd>Telescope help_tags<CR>
-- nnoremap <silent> <leader>F :e.<CR>
-- nnoremap <silent> <leader>O :BufExplorer<CR>
-- nnoremap <silent> <leader>t :CtrlPBufTagAll<CR>
-- nnoremap <silent> <leader>T :TagbarToggle<CR>

View File

@ -1,191 +0,0 @@
local Plug = vim.fn['plug#']
vim.call('plug#begin', '~/.local/share/nvim/site/plugins')
-- enhanced commenting
Plug 'tpope/vim-commentary'
-- enhanced single-repeat '.'
Plug 'tpope/vim-repeat'
-- enhanced surrounding
Plug 'tpope/vim-surround'
-- session management
Plug 'tpope/vim-obsession'
-- enhanced text objects
Plug 'wellle/targets.vim'
-- enhanced yank
Plug 'gbprod/yanky.nvim'
-- auto close brackets
Plug 'Raimondi/delimitMate'
-- start page
Plug 'mhinz/vim-startify'
-- alignment
Plug 'junegunn/vim-easy-align'
-- swap windows
Plug 'wesQ3/vim-windowswap'
-- LSP
Plug 'neovim/nvim-lspconfig'
Plug('nvim-treesitter/nvim-treesitter', {['do'] = ':TSUpdate'})
-- command completion
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
-- prettify command completion
Plug 'onsails/lspkind.nvim'
-- snippets
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
-- fuzzy finder
Plug 'nvim-lua/plenary.nvim'
Plug('nvim-telescope/telescope.nvim', {branch = '0.1.x'})
-- status line and theme
Plug 'bling/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'jonathanfilip/vim-lucius'
Plug 'altercation/vim-colors-solarized'
-- filetype
Plug 'towolf/vim-helm'
vim.call('plug#end')
-- " Plug 'mhinz/neovim-remote'
-- Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | Plug 'junegunn/fzf.vim'
-- Plug 'rking/ag.vim'
local cmp = require('cmp')
local lspkind = require('lspkind')
cmp.setup {
-- As currently, i am not using any snippet manager, thus disabled it.
-- snippet = {
-- expand = function(args)
-- require("luasnip").lsp_expand(args.body)
-- end,
-- },
-- mapping = {
-- ["<C-d>"] = cmp.mapping.scroll_docs(-4),
-- ["<C-f>"] = cmp.mapping.scroll_docs(4),
-- ["<C-e>"] = cmp.mapping.close(),
-- ["<c-y>"] = cmp.mapping.confirm {
-- behavior = cmp.ConfirmBehavior.Insert,
-- select = true,
-- },
-- }
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
formatting = {
format = lspkind.cmp_format {
mode = 'symbol_text',
menu = {
buffer = "[buf]",
nvim_lsp = "[LSP]",
path = "[path]",
},
},
},
sources = {
{ name = "nvim_lsp"},
{ name = "path" },
{ name = "buffer" , keyword_length = 2},
},
experimental = {
ghost_text = true
}
}
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the four listed parsers should always be installed)
ensure_installed = { "lua", "vim", "help" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = false,
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = {
-- `false` will disable the whole extension
enable = true,
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
-- disable = { "c", "rust" },
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}
require("yanky").setup({
ring = {
history_length = 100,
storage = "shada",
sync_with_numbered_registers = true,
cancel_event = "update",
},
system_clipboard = {
sync_with_ring = true,
},
preserve_cursor_position = {
enabled = true,
},
})
--
require("telescope").load_extension("yank_history")

View File

@ -1,2 +0,0 @@
*
!.gitignore

178
nvim/plugins.lua Normal file
View File

@ -0,0 +1,178 @@
vim.g.delimitMate_expand_space=1
vim.g.delimitMate_expand_cr = 1
vim.g.tagbar_left=1
vim.g.tagbar_autoclose=1
vim.g.tagbar_autofocus=1
vim.g.windowswap_map_keys=0
local cmp = require('cmp')
local lspkind = require('lspkind')
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
{ name = 'path' },
{ name = 'cmp_yanky' },
{ name = 'git' },
-- }, {
{ name = 'buffer', keyword_length = 2 },
}),
formatting = {
format = lspkind.cmp_format({
mode = "symbol_text",
menu = ({
buffer = "[buf]",
nvim_lsp = "[lsp]",
vsnip = "[snip]",
nvim_lua = "[lua]",
latex_symbols = "[tex]",
path = "[path]",
cmp_yanky = "[yank]",
})
}),
},
})
-- -- Set configuration for specific filetype.
-- cmp.setup.filetype('gitcommit', {
-- sources = cmp.config.sources({
-- { name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
-- }, {
-- { name = 'buffer' },
-- })
-- })
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
}),
matching = { disallow_symbol_nonprefix_matching = false }
})
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local lspconfig = require("lspconfig")
lspconfig.gopls.setup({ capabilities = capabilities })
lspconfig.svelte.setup({ capabilities = capabilities })
lspconfig.pyright.setup({ capabilities = capabilities })
lspconfig.omnisharp.setup({ capabilities = capabilities })
lspconfig.clangd.setup({ capabilities = capabilities })
lspconfig.dockerls.setup({ capabilities = capabilities })
lspconfig.docker_compose_language_service.setup({ capabilities = capabilities })
lspconfig.flow.setup({ capabilities = capabilities })
lspconfig.marksman.setup({ capabilities = capabilities })
lspconfig.als.setup({ capabilities = capabilities })
lspconfig.sqls.setup({ capabilities = capabilities })
lspconfig.yamlls.setup({ capabilities = capabilities })
lspconfig.nil_ls.setup({ capabilities = capabilities })
require("yanky").setup({
ring = {
history_length = 100,
storage = "shada",
sync_with_numbered_registers = true,
cancel_event = "update",
},
system_clipboard = {
sync_with_ring = true,
},
preserve_cursor_position = {
enabled = true,
},
})
require("telescope").load_extension("yank_history")
require'nvim-treesitter.configs'.setup {
-- ensure_installed = { "lua", "vim", "help" },
sync_install = false,
auto_install = false,
highlight = {
enable = true,
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
additional_vim_regex_highlighting = false,
},
}
require('lualine').setup({
options = {
icons_enabled = true,
theme = 'Tomorrow',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
})

View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -1 +0,0 @@
*.pyc

View File

@ -1,117 +0,0 @@
import os
import ycm_core
from clang_helpers import PrepareClangFlags
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-pendantic',
'-std=c++11',
'-x',
'c++',
'-I',
'.',
'-isystem',
'/usr/include/',
'-isystem',
'/usr/local/include/',
'-isystem',
'/Library/Developer/CommandLineTools/usr/include',
'-isystem',
'/Library/Developer/CommandLineTools/usr/lib/c++/v1'
]
compilation_database_folder = ''
if os.path.exists( compilation_database_folder ):
database = ycm_core.CompilationDatabase( compilation_database_folder )
else:
database = None
SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
def DirectoryOfThisScript():
return os.path.dirname( os.path.abspath( __file__ ) )
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
if not working_directory:
return list( flags )
new_flags = []
make_next_absolute = False
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
for flag in flags:
new_flag = flag
if make_next_absolute:
make_next_absolute = False
if not flag.startswith( '/' ):
new_flag = os.path.join( working_directory, flag )
for path_flag in path_flags:
if flag == path_flag:
make_next_absolute = True
break
if flag.startswith( path_flag ):
path = flag[ len( path_flag ): ]
new_flag = path_flag + os.path.join( working_directory, path )
break
if new_flag:
new_flags.append( new_flag )
return new_flags
def IsHeaderFile( filename ):
extension = os.path.splitext( filename )[ 1 ]
return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
def GetCompilationInfoForFile( filename ):
# The compilation_commands.json file generated by CMake does not have entries
# for header files. So we do our best by asking the db for flags for a
# corresponding source file, if any. If one exists, the flags for that file
# should be good enough.
if IsHeaderFile( filename ):
basename = os.path.splitext( filename )[ 0 ]
for extension in SOURCE_EXTENSIONS:
replacement_file = basename + extension
if os.path.exists( replacement_file ):
compilation_info = database.GetCompilationInfoForFile(
replacement_file )
if compilation_info.compiler_flags_:
return compilation_info
return None
return database.GetCompilationInfoForFile( filename )
def FlagsForFile( filename, **kwargs ):
if database:
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
# python list, but a "list-like" StringVec object
compilation_info = GetCompilationInfoForFile( filename )
if not compilation_info:
return None
final_flags = MakeRelativePathsInFlagsAbsolute(
compilation_info.compiler_flags_,
compilation_info.compiler_working_dir_ )
# NOTE: This is just for YouCompleteMe; it's highly likely that your project
# does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR
# ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT.
try:
final_flags.remove( '-stdlib=libc++' )
except ValueError:
pass
else:
relative_to = DirectoryOfThisScript()
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
return {
'flags': final_flags,
'do_cache': True
}

Binary file not shown.

View File

@ -1,4 +0,0 @@
resampling
reweighted
reweighting
Kalman

Binary file not shown.

Binary file not shown.

Binary file not shown.

55
setup
View File

@ -1,55 +0,0 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
###########################################################
## call setups
###########################################################
for setupdir in *; do
if [[ $setupdir != "setup" ]]; then
if [[ -a $DIR/$setupdir/setup ]]; then
echo -e "\n###########################################################"
echo "## " $setupdir "will be setup"
echo "###########################################################"
( exec "$setupdir/setup" )
fi
fi
done
###########################################################
## nvim setup
###########################################################
NVIMDIR="$HOME/.config/nvim"
PLUGINDIR="$HOME/.local/share/nvim/site"
if [[ ! -d $PLUGINDIR ]]; then
mkdir -p $PLUGINDIR
fi
echo -e "\n###########################################################"
echo "## nvim will be setup"
echo "###########################################################"
if [[ ! -a $NVIMDIR ]]; then
ln -s $DIR/nvim $NVIMDIR
echo "nvim symlinked to" $NVIMDIR
else
echo "already exists:" $NVIMDIR
fi
if [[ ! -a $PLUGINDIR/plugins ]]; then
ln -s $DIR/nvim/plugins $PLUGINDIR/plugins
echo "plugins symlinked to" $PLUGINDIR/plugins
else
echo "already exists:" $PLUGINDIR/plugins
fi
if [[ ! -a $PLUGINDIR/autoload ]]; then
ln -s $DIR/nvim/autoload $PLUGINDIR/autoload
echo "autoload symlinked to" $PLUGINDIR/autoload
else
echo "already exists:" $PLUGINDIR/autoload
fi