x startup scripts, arch provisioning and scripts, setup script, more shell work, neovim config
This commit is contained in:
parent
b1f910e0a0
commit
db059d115b
|
@ -3,6 +3,9 @@
|
||||||
# as far as I can tell, this file is only executed when you run startx from the
|
# as far as I can tell, this file is only executed when you run startx from the
|
||||||
# TTY
|
# TTY
|
||||||
|
|
||||||
|
echo '' > "$HOME/.xstartup_log"
|
||||||
|
echo "xinitrc" >> "$HOME/.xstartup_log"
|
||||||
|
|
||||||
# load our xprofile
|
# load our xprofile
|
||||||
if [ -f "$HOME/.xprofile" ]; then
|
if [ -f "$HOME/.xprofile" ]; then
|
||||||
source "$HOME/.xprofile"
|
source "$HOME/.xprofile"
|
||||||
|
@ -27,4 +30,4 @@ if command -v compton >/dev/null 2>&1; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# fire up wm
|
# fire up wm
|
||||||
exec "$DOTFILES_PATH/env/wm/wmstart"
|
exec "$DOTFILES_PATH/de/wmstart"
|
||||||
|
|
8
de/xloadresources
Normal file → Executable file
8
de/xloadresources
Normal file → Executable file
|
@ -1,13 +1,13 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "xloadresources" >> "$HOME/.xstartup_log"
|
||||||
|
|
||||||
|
sysresources="/etc/X11/xinit/.Xresources"
|
||||||
|
sysmodmap="/etc/X11/xinit/.Xmodmap"
|
||||||
userresources="$HOME/.Xresources"
|
userresources="$HOME/.Xresources"
|
||||||
usercolors="$HOME/.Xresources.colors"
|
usercolors="$HOME/.Xresources.colors"
|
||||||
userenv="$HOME/.Xresources.env"
|
userenv="$HOME/.Xresources.env"
|
||||||
usermodmap="$HOME/.Xmodmap"
|
usermodmap="$HOME/.Xmodmap"
|
||||||
sysresources="/etc/X11/xinit/.Xresources"
|
|
||||||
sysmodmap="/etc/X11/xinit/.Xmodmap"
|
|
||||||
|
|
||||||
echo "xstartup: resources $userresources $userenv" >> "$HOME/.xstartup_log"
|
|
||||||
|
|
||||||
if [ -f "$sysresources" ]; then
|
if [ -f "$sysresources" ]; then
|
||||||
xrdb -merge "$sysresources" >/dev/null 2>&1
|
xrdb -merge "$sysresources" >/dev/null 2>&1
|
||||||
|
|
|
@ -7,12 +7,10 @@ if [[ -z "$DOTFILES_PATH" ]]; then
|
||||||
export DOTFILES_PATH="$XDG_CONFIG_HOME/dotfiles"
|
export DOTFILES_PATH="$XDG_CONFIG_HOME/dotfiles"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$DOTFILES_PATH/env/x/xloadresources" ]; then
|
echo "xprofile ($DOTFILES_PATH)" >> "$HOME/.xstartup_log"
|
||||||
source "$DOTFILES_PATH/env/x/xloadresources"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$DOTFILES_PATH/variables.bash" ]; then
|
if [ -f "$DOTFILES_PATH/de/xloadresources" ]; then
|
||||||
source "$DOTFILES_PATH/variables.bash"
|
source "$DOTFILES_PATH/de/xloadresources"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# keyrepeat settings
|
# keyrepeat settings
|
||||||
|
|
10
os-specific/arch-linux/provisioning/0-adduser.bash
Executable file
10
os-specific/arch-linux/provisioning/0-adduser.bash
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
USERNAME=daniel
|
||||||
|
|
||||||
|
groupadd admin 2>/dev/null
|
||||||
|
mkdir -p "/home/$USERNAME/usr"
|
||||||
|
useradd -m -d "/home/$USERNAME/usr" -G admin,users,wheel -s "/usr/bin/bash" "$USERNAME"
|
||||||
|
chown -R "$USERNAME:$USERNAME" "/home/$USERNAME"
|
||||||
|
echo "Setting password for user '$USERNAME'"
|
||||||
|
passwd "$USERNAME"
|
29
os-specific/arch-linux/provisioning/1-pacaur.bash
Executable file
29
os-specific/arch-linux/provisioning/1-pacaur.bash
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# install the dependencies
|
||||||
|
sudo pacman -S git curl openssl perl expac yajl --noconfirm
|
||||||
|
|
||||||
|
# receive cower's gpg key
|
||||||
|
gpg --recv-keys 1EB2638FF56C0C53
|
||||||
|
|
||||||
|
# setup a temporary place to install the packages from
|
||||||
|
REPOSITORY_PATH="/tmp/provisioning"
|
||||||
|
mkdir -p "$REPOSITORY_PATH"
|
||||||
|
|
||||||
|
# clone the repositories
|
||||||
|
git clone https://aur.archlinux.org/cower.git "$REPOSITORY_PATH/cower"
|
||||||
|
git clone https://aur.archlinux.org/pacaur.git "$REPOSITORY_PATH/pacaur"
|
||||||
|
|
||||||
|
# build and install cower
|
||||||
|
cd "$REPOSITORY_PATH/cower"
|
||||||
|
makepkg -i --noconfirm --noedit
|
||||||
|
cd -
|
||||||
|
|
||||||
|
# build and install pacaur
|
||||||
|
cd "$REPOSITORY_PATH/pacaur"
|
||||||
|
makepkg -i --noconfirm --noedit
|
||||||
|
cd -
|
||||||
|
|
||||||
|
# once installed, let the package manager manage itself and its dependencies
|
||||||
|
pacaur -S cower pacaur --noconfirm --noedit
|
||||||
|
|
41
os-specific/arch-linux/provisioning/2-essentials.bash
Executable file
41
os-specific/arch-linux/provisioning/2-essentials.bash
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
sudo pacman -S \
|
||||||
|
tree \
|
||||||
|
rofi \
|
||||||
|
slock \
|
||||||
|
the_silver_searcher \
|
||||||
|
alsa-utils \
|
||||||
|
htop \
|
||||||
|
openssh \
|
||||||
|
openssl \
|
||||||
|
ruby \
|
||||||
|
python python-pip \
|
||||||
|
pass \
|
||||||
|
qutebrowser \
|
||||||
|
bash-completion \
|
||||||
|
fzf \
|
||||||
|
rsync \
|
||||||
|
pavucontrol \
|
||||||
|
neovim \
|
||||||
|
vim \
|
||||||
|
unzip \
|
||||||
|
xsel \
|
||||||
|
xclip \
|
||||||
|
tmux \
|
||||||
|
rxvt-unicode \
|
||||||
|
xorg-xinit xorg-server xorg-xrdb \
|
||||||
|
xcb-util xcb-util-keysyms xcb-util-wm xorg-xrandr xdotool feh \
|
||||||
|
--noconfirm
|
||||||
|
|
||||||
|
pacaur -S \
|
||||||
|
urxvt-perls-git \
|
||||||
|
samba \
|
||||||
|
pulseaudio-ctl \
|
||||||
|
alsa-plugins \
|
||||||
|
unclutter-xfixes-git gtk-theme-arc gtk-engine-murrine xorg-server-devel \
|
||||||
|
bspwm-git sxhkd-git xdo-git \
|
||||||
|
--noconfirm --noedit
|
||||||
|
|
||||||
|
# sudo ln -s /usr/bin/google-chrome-unstable /usr/bin/chrome
|
||||||
|
|
18
os-specific/arch-linux/provisioning/3-extras.bash
Executable file
18
os-specific/arch-linux/provisioning/3-extras.bash
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
pacaur -S \
|
||||||
|
gtk-theme-arc \
|
||||||
|
elementary-icon-theme \
|
||||||
|
lemonbar-xft-git \
|
||||||
|
thunar thunar-volman gvfs \
|
||||||
|
thunar-shares-plugin \
|
||||||
|
gvfs-smb \
|
||||||
|
terminus-font ttf-monaco gohufont artwiz-fonts phallus-fonts-git \
|
||||||
|
ttf-opensans ttf-dejavu \
|
||||||
|
avr-libc avr-gcc dfu-programmer dfu-util \
|
||||||
|
xorg-xbacklight \
|
||||||
|
gimp \
|
||||||
|
audacity
|
||||||
|
reptyr \
|
||||||
|
cmake python2 python2-pip \
|
||||||
|
--noconfirm --noedit
|
5
os-specific/arch-linux/provisioning/nvidia.bash
Executable file
5
os-specific/arch-linux/provisioning/nvidia.bash
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
pacaur -S \
|
||||||
|
nvidia-beta lib32-nvidia-beta \
|
||||||
|
--noconfirm --noedit
|
4
os-specific/arch-linux/provisioning/tmux-plugins.bash
Executable file
4
os-specific/arch-linux/provisioning/tmux-plugins.bash
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# tmux plugin manager
|
||||||
|
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
|
9
os-specific/arch-linux/scripts/get-colors.bash
Normal file
9
os-specific/arch-linux/scripts/get-colors.bash
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
get_color()
|
||||||
|
{
|
||||||
|
XR_COLOR_DEF=$(grep "#define base$1 #" ~/.Xresources.colors)
|
||||||
|
echo ${XR_COLOR_DEF:16}
|
||||||
|
}
|
||||||
|
export -f get_color
|
||||||
|
|
22
os-specific/arch-linux/scripts/get-fonts.bash
Normal file
22
os-specific/arch-linux/scripts/get-fonts.bash
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
XRES_FILE="$HOME/.Xresources"
|
||||||
|
if [ -a "$HOME/.Xresources.env" ]; then
|
||||||
|
XRES_FILE="$HOME/.Xresources.env"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PRIMARY_FONT_XRESOURCES=$(grep "^\*font: xft:" "$XRES_FILE" | grep -v "/\*" | head -n 1)
|
||||||
|
export PRIMARY_FONT_FAMILY_WITH_SIZE=${PRIMARY_FONT_XRESOURCES:11}
|
||||||
|
export PRIMARY_FONT_FAMILY=$(echo $PRIMARY_FONT_FAMILY_WITH_SIZE | sed 's/\-.*//')
|
||||||
|
export PRIMARY_FONT_SIZE=$(echo $PRIMARY_FONT_FAMILY_WITH_SIZE | sed 's/.*\-//')
|
||||||
|
|
||||||
|
SECONDARY_FONT_XRESOURCES=$(grep "^#define secondaryfont xft:" "$XRES_FILE" | grep -v "/\*" | head -n 1)
|
||||||
|
export SECONDARY_FONT_FAMILY_WITH_SIZE=${SECONDARY_FONT_XRESOURCES:26}
|
||||||
|
export SECONDARY_FONT_FAMILY=$(echo $SECONDARY_FONT_FAMILY_WITH_SIZE | sed 's/\-.*//')
|
||||||
|
export SECONDARY_FONT_SIZE=$(echo $SECONDARY_FONT_FAMILY_WITH_SIZE | sed 's/.*\-//')
|
||||||
|
|
||||||
|
ICON_FONT_XRESOURCES=$(grep "^#define iconfont xft:" "$XRES_FILE" | grep -v "/\*" | head -n 1)
|
||||||
|
export ICON_FONT_FAMILY_WITH_SIZE=${ICON_FONT_XRESOURCES:21}
|
||||||
|
export ICON_FONT_FAMILY=$(echo $ICON_FONT_FAMILY_WITH_SIZE | sed 's/\-.*//')
|
||||||
|
export ICON_FONT_SIZE=$(echo $ICON_FONT_FAMILY_WITH_SIZE | sed 's/.*\-//')
|
||||||
|
|
9
setup
9
setup
|
@ -28,16 +28,25 @@ else
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# TODO: make sure we have an even number, here
|
||||||
links=(
|
links=(
|
||||||
# desktop environment files
|
# desktop environment files
|
||||||
"$dfp/de/bspwmrc" "$XDG_CONFIG_HOME/bspwm/bspwmrc"
|
"$dfp/de/bspwmrc" "$XDG_CONFIG_HOME/bspwm/bspwmrc"
|
||||||
"$dfp/de/sxhkdrc" "$XDG_CONFIG_HOME/sxhkd/sxhkdrc"
|
"$dfp/de/sxhkdrc" "$XDG_CONFIG_HOME/sxhkd/sxhkdrc"
|
||||||
|
"$dfp/de/xresources" "$HOME/.Xresources"
|
||||||
|
"$dfp/de/xinitrc" "$HOME/.xinitrc"
|
||||||
|
"$dfp/de/xprofile" "$HOME/.xprofile"
|
||||||
|
"$dfp/common/colors/xresources" "$HOME/.Xresources.colors"
|
||||||
|
|
||||||
# shell files
|
# shell files
|
||||||
"$dfp/shell/bashrc" "$HOME/.bashrc"
|
"$dfp/shell/bashrc" "$HOME/.bashrc"
|
||||||
"$dfp/shell/bash_profile" "$HOME/.bash_profile"
|
"$dfp/shell/bash_profile" "$HOME/.bash_profile"
|
||||||
"$dfp/shell/tmux.conf" "$HOME/.tmux.conf"
|
"$dfp/shell/tmux.conf" "$HOME/.tmux.conf"
|
||||||
"$dfp/shell/tmux-layouts" "$HOME/.tmux/layouts"
|
"$dfp/shell/tmux-layouts" "$HOME/.tmux/layouts"
|
||||||
|
|
||||||
|
# text editor files
|
||||||
|
"$dfp/text-editor/neovim" "$XDG_CONFIG_HOME/nvim"
|
||||||
|
"$dfp/common/colors/vim" "$XDG_CONFIG_HOME/nvim/colors/current.vim"
|
||||||
)
|
)
|
||||||
|
|
||||||
source=""
|
source=""
|
||||||
|
|
|
@ -57,6 +57,9 @@ alias gac="git add -A && git commit -m"
|
||||||
# browser aliases
|
# browser aliases
|
||||||
alias qute="qutebrowser --backend webengine"
|
alias qute="qutebrowser --backend webengine"
|
||||||
|
|
||||||
|
# TODO: use chrome-beta, then chrome, then chromium
|
||||||
|
alias chrome="google-chrome-beta"
|
||||||
|
|
||||||
# networking aliases
|
# networking aliases
|
||||||
alias p="ping 8.8.8.8"
|
alias p="ping 8.8.8.8"
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,12 @@ BASE16_SHELL="$DOTFILES_PATH/common/colors/shell"
|
||||||
# disable ctrl-s terminal freeze
|
# disable ctrl-s terminal freeze
|
||||||
[[ $- == *i* ]] && stty -ixon
|
[[ $- == *i* ]] && stty -ixon
|
||||||
|
|
||||||
|
# import the fonts we're using so we can pass them to other applications
|
||||||
|
source "$DOTFILES_PATH/common/scripts/get-fonts.bash"
|
||||||
|
|
||||||
|
# import the functions that retrieve our theme colors
|
||||||
|
source "$DOTFILES_PATH/common/scripts/get-colors.bash"
|
||||||
|
|
||||||
# import our aliases
|
# import our aliases
|
||||||
source "$DOTFILES_PATH/shell/aliases"
|
source "$DOTFILES_PATH/shell/aliases"
|
||||||
|
|
||||||
|
|
444
text-editor/neovim/init.vim
Normal file
444
text-editor/neovim/init.vim
Normal file
|
@ -0,0 +1,444 @@
|
||||||
|
" initial plugin manager
|
||||||
|
if empty(glob('~/.config/nvim/autoload/plug.vim'))
|
||||||
|
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
|
autocmd VimEnter * PlugInstall
|
||||||
|
endif
|
||||||
|
|
||||||
|
" tell vim to reload the init.vim file when it saves it
|
||||||
|
autocmd! BufWritePost init.vim source %
|
||||||
|
|
||||||
|
" plugin build functions
|
||||||
|
function! BuildComposer(info)
|
||||||
|
if a:info.status != 'unchanged' || a:info.force
|
||||||
|
!cargo build --release
|
||||||
|
UpdateRemotePlugins
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! DoRemote(arg)
|
||||||
|
UpdateRemotePlugins
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Initialize plugin manager
|
||||||
|
call plug#begin('~/.config/nvim/bundle')
|
||||||
|
|
||||||
|
" let plugin manager manage itself
|
||||||
|
Plug 'junegunn/vim-plug'
|
||||||
|
|
||||||
|
|
||||||
|
" plugins
|
||||||
|
|
||||||
|
" if vim is being launched to view man pages, don't do our magical session
|
||||||
|
" stuff!
|
||||||
|
if exists('asmanviewer')
|
||||||
|
let g:prosession_dir = '/dev/null'
|
||||||
|
else
|
||||||
|
Plug 'tpope/vim-obsession' " session ease-of-use
|
||||||
|
Plug 'dhruvasagar/vim-prosession' " more session ease-of-use
|
||||||
|
let g:prosession_dir = '~/.config/nvim/session/'
|
||||||
|
endif
|
||||||
|
Plug 'vim-airline/vim-airline' " statusline
|
||||||
|
" let g:airline_powerline_fonts = 0
|
||||||
|
let g:airline#extensions#tabline#enabled = 1 " automatically displays all buffers when there's only one tab open
|
||||||
|
let g:airline#extensions#tabline#fnamemod = ':t'
|
||||||
|
" set laststatus=2 " always show statusline
|
||||||
|
" set noshowmode " hides default mode
|
||||||
|
let g:airline#extensions#tabline#left_sep = ''
|
||||||
|
let g:airline#extensions#tabline#left_alt_sep = ''
|
||||||
|
let g:airline_right_alt_sep = ''
|
||||||
|
let g:airline_right_sep = ''
|
||||||
|
let g:airline_left_alt_sep= ''
|
||||||
|
let g:airline_left_sep = ''
|
||||||
|
Plug 'vim-airline/vim-airline-themes'
|
||||||
|
|
||||||
|
Plug 'scrooloose/nerdtree', {'on': ['NERDTreeToggle', 'NERDTree']} " nice sidebar for files
|
||||||
|
let g:NERDTreeDirArrowExpandable = ' '
|
||||||
|
let g:NERDTreeDirArrowCollapsible = ' '
|
||||||
|
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif " close vim if last buffer is a NERD buffer
|
||||||
|
|
||||||
|
Plug 'nathanaelkane/vim-indent-guides' " indentation guides (NOTE: doesn't seem to work with my colorscheme)
|
||||||
|
let g:indent_guides_start_level = 0
|
||||||
|
let g:indent_guides_auto_color = 1
|
||||||
|
|
||||||
|
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } " autocomplete
|
||||||
|
let g:deoplete#enable_at_startup = 1
|
||||||
|
|
||||||
|
Plug 'scrooloose/syntastic' " syntax checker
|
||||||
|
Plug 'freitass/todo.txt-vim' " syntax checker
|
||||||
|
Plug 'bkad/CamelCaseMotion' " camel case and underscore word movements
|
||||||
|
Plug 'LargeFile' " gracefully handle very large files
|
||||||
|
Plug 'tpope/vim-commentary' " toggle comments in code easily
|
||||||
|
Plug 'tmux-plugins/vim-tmux-focus-events' " allow transitions within tmux
|
||||||
|
Plug 'christoomey/vim-tmux-navigator' " allow transitions within tmux
|
||||||
|
Plug 'tasklist.vim' " show tasks with leader,t
|
||||||
|
Plug 'godlygeek/tabular' " align text lines together
|
||||||
|
Plug 'dhruvasagar/vim-table-mode' " for creating and editing character tables
|
||||||
|
Plug 'lytedev/vim-superman' " view man pages with vim
|
||||||
|
Plug 'tpope/vim-surround' " quickly modify text surrounding objects
|
||||||
|
Plug 'tpope/vim-speeddating' " vim knows about date-like text objects
|
||||||
|
Plug 'michaeljsmith/vim-indent-object' " adds an indentation level text object
|
||||||
|
Plug 'wellle/targets.vim' " adds some more handy text objects
|
||||||
|
Plug 'ternjs/tern_for_vim', { 'do': 'npm install' }
|
||||||
|
Plug 'mikewest/vimroom'
|
||||||
|
Plug 'editorconfig/editorconfig-vim' " loads project-specific editor settings
|
||||||
|
let g:vimroom_sidebar_height = 0
|
||||||
|
|
||||||
|
Plug 'junegunn/fzf', {'dir': '~/.fzf', 'do': './install --all'} " fuzzy file finding
|
||||||
|
Plug 'junegunn/fzf.vim' " helpers for using fzf in vim
|
||||||
|
let g:fzf_layout = { 'window': 'enew' }
|
||||||
|
|
||||||
|
" plugins for specific file types
|
||||||
|
Plug 'kchmck/vim-coffee-script', {'for': ['coffee', 'coffeescript', 'vue']}
|
||||||
|
Plug 'posva/vim-vue', {'for': ['vue']}
|
||||||
|
Plug 'elixir-lang/vim-elixir', {'for': ['elixir']}
|
||||||
|
Plug 'wavded/vim-stylus', {'for': ['styl', 'stylus', 'vue']}
|
||||||
|
Plug 'rust-lang/rust.vim', {'for': ['rs', 'rust']}
|
||||||
|
" Plug 'plasticboy/vim-markdown', {'for': ['md', 'markdown']}
|
||||||
|
" Plug 'euclio/vim-markdown-composer', { 'do': function('BuildComposer'), 'for': ['md', 'markdown'] }
|
||||||
|
Plug 'digitaltoad/vim-jade', {'for': ['pug', 'jade', 'vue']}
|
||||||
|
Plug 'freitass/todo.txt-vim', {'for': ['todo']}
|
||||||
|
Plug 'leafo/moonscript-vim', {'for': ['moon', 'moonscript']}
|
||||||
|
Plug 'evidens/vim-twig'
|
||||||
|
Plug 'leafgarland/typescript-vim', {'for': ['ts', 'typescript']}
|
||||||
|
Plug 'jwalton512/vim-blade', {'for': ['blade', 'blade.php']}
|
||||||
|
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
filetype on
|
||||||
|
filetype indent on
|
||||||
|
filetype plugin on
|
||||||
|
|
||||||
|
" language specific configuration
|
||||||
|
|
||||||
|
" C
|
||||||
|
let c_space_errors = 1
|
||||||
|
let c_comment_strings = 0 " dont highlight strings inside C comments
|
||||||
|
|
||||||
|
" Python
|
||||||
|
let python_space_errors = 1
|
||||||
|
" autocmd FileType python setl tabstop=4 expandtab shiftwidth=4 softtabstop=4
|
||||||
|
" autocmd FileType js setl tabstop=2 expandtab shiftwidth=2 softtabstop=2
|
||||||
|
" autocmd FileType vue setl tabstop=2 expandtab shiftwidth=2 softtabstop=2
|
||||||
|
autocmd FileType php setl tabstop=4 expandtab shiftwidth=4 softtabstop=4
|
||||||
|
|
||||||
|
" Markdown
|
||||||
|
" autocmd BufNewFile,BufReadPost *.md setl filetype=markdown spell textwidth=0 wrapmargin=0
|
||||||
|
|
||||||
|
" Text
|
||||||
|
autocmd BufNewFile,BufReadPost *.txt setl spell textwidth=0 wrapmargin=0
|
||||||
|
|
||||||
|
" whitespace
|
||||||
|
set tabstop=2
|
||||||
|
set shiftwidth=2
|
||||||
|
set softtabstop=2
|
||||||
|
set expandtab
|
||||||
|
set autoindent smartindent
|
||||||
|
set list
|
||||||
|
set nostartofline
|
||||||
|
set listchars=trail:·,tab:\ \
|
||||||
|
|
||||||
|
" look and feel
|
||||||
|
|
||||||
|
set wrap
|
||||||
|
set linebreak
|
||||||
|
set breakindent
|
||||||
|
set textwidth=80
|
||||||
|
set formatoptions=crql1j
|
||||||
|
" t autowrap to textwidth
|
||||||
|
" c autowrap comments to textwidth
|
||||||
|
" r autoinsert comment leader with <enter>
|
||||||
|
" q allow formatting of comments with gq
|
||||||
|
" l lines longer than 'textwidth' on insert do not get formatted
|
||||||
|
" 1 don't break a line after a one-letter word - break it before
|
||||||
|
" j where it makes sense, remove a comment leader when joining lines
|
||||||
|
|
||||||
|
set title " handle window title
|
||||||
|
set synmaxcol=2048
|
||||||
|
if exists('asmanviewer')
|
||||||
|
set nonumber " no line numbers when viewing a man page
|
||||||
|
else
|
||||||
|
set number " line numbers
|
||||||
|
endif
|
||||||
|
" set relativenumber
|
||||||
|
set cursorline " highlight the current line
|
||||||
|
" set cursorcolumn " highlight the current column
|
||||||
|
" let &colorcolumn=join(range(81,400),",") " colors columns past 80
|
||||||
|
set showcmd
|
||||||
|
set nowildmenu
|
||||||
|
set wildmode=longest,list,full
|
||||||
|
set cpoptions-=$
|
||||||
|
set showmatch
|
||||||
|
set mouse=a
|
||||||
|
set mousehide
|
||||||
|
set backspace=indent,eol,start
|
||||||
|
set ruler
|
||||||
|
set lazyredraw
|
||||||
|
set scrolloff=8
|
||||||
|
set sidescrolloff=8
|
||||||
|
set splitright
|
||||||
|
set splitbelow
|
||||||
|
set noerrorbells
|
||||||
|
set visualbell
|
||||||
|
set nobackup
|
||||||
|
set nowritebackup
|
||||||
|
set noswapfile
|
||||||
|
set timeout
|
||||||
|
set ttimeoutlen=200
|
||||||
|
set isfname+=32
|
||||||
|
|
||||||
|
set vb t_vb=
|
||||||
|
if has('autocmd')
|
||||||
|
autocmd GUIEnter * set visualbell t_vb=
|
||||||
|
endif
|
||||||
|
|
||||||
|
let base16colorspace=256
|
||||||
|
set background=dark
|
||||||
|
colorscheme current
|
||||||
|
|
||||||
|
fun! ShowSpaceIndentation()
|
||||||
|
hi WhiteSpaces ctermfg=black ctermbg=8
|
||||||
|
match WhiteSpaces /^ \+/
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let s:distractionFreeMode = 0
|
||||||
|
fun! DistractionFreeModeFunc()
|
||||||
|
AirlineToggle
|
||||||
|
VimroomToggle
|
||||||
|
if s:distractionFreeMode == 0
|
||||||
|
let s:distractionFreeMode = 1
|
||||||
|
set nocursorline
|
||||||
|
set laststatus=0
|
||||||
|
set noshowmode
|
||||||
|
set noruler
|
||||||
|
set noshowcmd
|
||||||
|
set nonumber
|
||||||
|
hi NonText ctermfg=black guifg=black
|
||||||
|
else
|
||||||
|
let s:distractionFreeMode = 0
|
||||||
|
set cursorline
|
||||||
|
set showmode
|
||||||
|
set ruler
|
||||||
|
set laststatus=2
|
||||||
|
set showcmd
|
||||||
|
set number
|
||||||
|
hi NonText ctermfg=gray guifg=gray
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
nnoremap <silent> <Leader>mz :DistractionFreeMode<CR>
|
||||||
|
|
||||||
|
:command! SpaceIndents call ShowSpaceIndentation()
|
||||||
|
:command! ShowSpaceIndents call ShowSpaceIndentation()
|
||||||
|
:command! DistractionFreeMode call DistractionFreeModeFunc()
|
||||||
|
|
||||||
|
set hidden " allows buffer switching without saving
|
||||||
|
set shortmess=I
|
||||||
|
set history=1000
|
||||||
|
set undofile
|
||||||
|
set undodir=$HOME/.config/nvim/undo
|
||||||
|
set undolevels=1000
|
||||||
|
set undoreload=10000
|
||||||
|
|
||||||
|
set backupdir=$HOME/.config/nvim/backup
|
||||||
|
set directory=$HOME/.config/nvim/backup
|
||||||
|
set spellfile=$HOME/.config/nvim/spell/en.utf-8.add
|
||||||
|
|
||||||
|
set ignorecase
|
||||||
|
set smartcase
|
||||||
|
set incsearch
|
||||||
|
set hlsearch
|
||||||
|
set wrapscan
|
||||||
|
|
||||||
|
set foldmethod=syntax
|
||||||
|
set foldlevel=99
|
||||||
|
set foldnestmax=10
|
||||||
|
set nofoldenable
|
||||||
|
set foldlevelstart=1
|
||||||
|
|
||||||
|
if has('vim_starting')
|
||||||
|
set encoding=utf8
|
||||||
|
endif
|
||||||
|
set autowrite
|
||||||
|
set autochdir
|
||||||
|
set autoread
|
||||||
|
set nomodeline
|
||||||
|
|
||||||
|
" yank to OS clipboard
|
||||||
|
set clipboard+=unnamed
|
||||||
|
|
||||||
|
" allows for manual and syntax folding... supposedly
|
||||||
|
augroup vimrc
|
||||||
|
au BufReadPre * setlocal foldmethod=indent
|
||||||
|
au BufWinEnter * if &fdm == 'indent' | setlocal foldmethod=manual | endif
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
" jump to last opened position in file
|
||||||
|
if has("autocmd")
|
||||||
|
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" no empty buffer on startup
|
||||||
|
autocmd VimEnter * nested if bufname('')=='' && line('$') == 1 && col('$')==1 && !&modified | bd % | endif
|
||||||
|
|
||||||
|
function! TerminalSplit()
|
||||||
|
let current_file = @%
|
||||||
|
echo current_file
|
||||||
|
if match(current_file, "term://*") != -1
|
||||||
|
split
|
||||||
|
terminal
|
||||||
|
else
|
||||||
|
vsplit
|
||||||
|
vertical resize 80
|
||||||
|
terminal
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" bindings
|
||||||
|
|
||||||
|
" common typo fixes
|
||||||
|
command! WQ wq
|
||||||
|
command! Wq wq
|
||||||
|
command! Wqa wqa
|
||||||
|
command! W w
|
||||||
|
command! Q q
|
||||||
|
|
||||||
|
" best leader
|
||||||
|
let mapleader = "\<Space>"
|
||||||
|
|
||||||
|
" terminal mappings
|
||||||
|
" open a terminal split at 80 columns
|
||||||
|
nnoremap <C-t> :call TerminalSplit()<CR>
|
||||||
|
tnoremap <C-t> <C-\><C-n>:call TerminalSplit()<CR>
|
||||||
|
|
||||||
|
" close the terminal
|
||||||
|
tnoremap <C-w> <C-\><C-n>:q!<CR>
|
||||||
|
|
||||||
|
" moving between terminal splits
|
||||||
|
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
|
||||||
|
|
||||||
|
" enter insert mode when entering a terminal buffer
|
||||||
|
autocmd BufWinEnter,WinEnter term://* startinsert
|
||||||
|
|
||||||
|
" change buffers with leader,tab
|
||||||
|
nnoremap <leader><Tab> :bnext<CR>
|
||||||
|
nnoremap <leader><S-Tab> :bprevious<CR>
|
||||||
|
|
||||||
|
" don't kill vim
|
||||||
|
nnoremap <leader>K <Nop>
|
||||||
|
nnoremap <S-K> <NOP>
|
||||||
|
|
||||||
|
" nerdtree
|
||||||
|
nnoremap <C-n> :NERDTree<CR>
|
||||||
|
|
||||||
|
" run macro across visually selected lines
|
||||||
|
xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
|
||||||
|
function! ExecuteMacroOverVisualRange()
|
||||||
|
echo "@".getcmdline()
|
||||||
|
execute ":'<,'>normal @".nr2char(getchar())
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" quick paragraph formatting
|
||||||
|
vmap Q gq
|
||||||
|
nmap Q gqap
|
||||||
|
|
||||||
|
" launch fzf for the current git repo
|
||||||
|
nnoremap <C-p> :GitFiles<CR>
|
||||||
|
|
||||||
|
" launch fzf for files in the current directory
|
||||||
|
nnoremap <C-o> :Files<CR>
|
||||||
|
|
||||||
|
" launch fzf for files modified or not in git
|
||||||
|
nnoremap <C-u> :GFiles?<CR>
|
||||||
|
|
||||||
|
" launch fzf for open buffers (files)
|
||||||
|
nnoremap <leader>l :Buffers<CR>
|
||||||
|
|
||||||
|
" switch to previous buffer
|
||||||
|
nnoremap <leader>h :b#<CR>
|
||||||
|
|
||||||
|
" use leader j and k to switch buffers as well
|
||||||
|
nnoremap <leader>k :bnext<CR>
|
||||||
|
nnoremap <leader>j :bprevious<CR>
|
||||||
|
nnoremap <C-k> :bnext<CR>
|
||||||
|
nnoremap <C-j> :bprevious<CR>
|
||||||
|
|
||||||
|
" fast word change
|
||||||
|
nnoremap <leader>c ciw
|
||||||
|
nnoremap <leader>C ciW
|
||||||
|
|
||||||
|
" bash-like deletion
|
||||||
|
inoremap <C-BS> <C-w>
|
||||||
|
inoremap <A-BS> <C-w>
|
||||||
|
|
||||||
|
" clear search higlight
|
||||||
|
nnoremap <leader>/ :let @/ = ""<CR>
|
||||||
|
|
||||||
|
" remap jk and kj to escape in insert mode
|
||||||
|
inoremap jj <Esc>
|
||||||
|
inoremap Jj <Esc>
|
||||||
|
inoremap Jj <Esc>
|
||||||
|
inoremap JJ <Esc>
|
||||||
|
inoremap jk <Esc>
|
||||||
|
inoremap Jk <Esc>
|
||||||
|
inoremap jK <Esc>
|
||||||
|
inoremap JK <Esc>
|
||||||
|
|
||||||
|
" use hjkl-movement between rows when soft wrapping:
|
||||||
|
nnoremap j gj
|
||||||
|
nnoremap k gk
|
||||||
|
vnoremap j gj
|
||||||
|
vnoremap k gk
|
||||||
|
|
||||||
|
" camel case movements
|
||||||
|
map <silent> ,w <Plug>CamelCaseMotion_w
|
||||||
|
map <silent> ,b <Plug>CamelCaseMotion_b
|
||||||
|
map <silent> ,e <Plug>CamelCaseMotion_e
|
||||||
|
map <silent> ,ge <Plug>CamelCaseMotion_ge
|
||||||
|
|
||||||
|
" inner _ objects
|
||||||
|
omap <silent> ib <Plug>CamelCaseMotion_ib
|
||||||
|
xmap <silent> ib <Plug>CamelCaseMotion_ib
|
||||||
|
omap <silent> ie <Plug>CamelCaseMotion_ie
|
||||||
|
xmap <silent> ie <Plug>CamelCaseMotion_ie
|
||||||
|
|
||||||
|
" a _ objects
|
||||||
|
omap <silent> aw <Plug>CamelCaseMotion_aw
|
||||||
|
xmap <silent> aw <Plug>CamelCaseMotion_aw
|
||||||
|
omap <silent> ab <Plug>CamelCaseMotion_ab
|
||||||
|
xmap <silent> ab <Plug>CamelCaseMotion_ab
|
||||||
|
omap <silent> ae <Plug>CamelCaseMotion_ae
|
||||||
|
xmap <silent> ae <Plug>CamelCaseMotion_ae
|
||||||
|
|
||||||
|
" remove trailing whitespace:
|
||||||
|
map <F3> mw:%s/\s\+$//<CR>:let @/ = ""<CR>'w
|
||||||
|
|
||||||
|
" close buffer:
|
||||||
|
nnoremap <silent> <leader>w :bd<CR>
|
||||||
|
|
||||||
|
" toggle spell checking:
|
||||||
|
map <F5> :setlocal spell!<CR>
|
||||||
|
|
||||||
|
" open urls, files, etc. example: http://google.com:
|
||||||
|
noremap <leader>o :!xdg-open <cfile><CR><CR>
|
||||||
|
|
||||||
|
" keep that dumb window from popping up
|
||||||
|
map q: :q
|
||||||
|
noremap qqq: q:
|
||||||
|
|
||||||
|
" sane n/N behavior
|
||||||
|
nnoremap <expr> n 'Nn'[v:searchforward]
|
||||||
|
nnoremap <expr> N 'nN'[v:searchforward]
|
||||||
|
|
||||||
|
" better command history navigation
|
||||||
|
cnoremap <c-n> <down>
|
||||||
|
cnoremap <c-p> <up>
|
||||||
|
|
||||||
|
" keep selection after indenting visual selection
|
||||||
|
xnoremap < <gv
|
||||||
|
xnoremap > >gv
|
||||||
|
|
||||||
|
" modify higlight colors
|
||||||
|
hi Search cterm=NONE ctermbg=blue ctermfg=black
|
Reference in a new issue