mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 22:22:40 +00:00
Working on vim settings
This commit is contained in:
@@ -21,6 +21,7 @@ brew "ripgrep"
|
|||||||
brew "stow" # for dotfile linking / placement.
|
brew "stow" # for dotfile linking / placement.
|
||||||
brew "swift-format" # for formatting swift files
|
brew "swift-format" # for formatting swift files
|
||||||
brew "tmux" # terminal multi-plexer
|
brew "tmux" # terminal multi-plexer
|
||||||
|
brew "vim"
|
||||||
brew "zsh"
|
brew "zsh"
|
||||||
brew "zsh-completions"
|
brew "zsh-completions"
|
||||||
|
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
|
|
||||||
" Settings:
|
|
||||||
set tabstop=4 softtabstop=4
|
|
||||||
set shiftwidth=4
|
|
||||||
set expandtab
|
|
||||||
set smartindent
|
|
||||||
set exrc
|
|
||||||
set relativenumber
|
|
||||||
set nohlsearch
|
|
||||||
set hidden
|
|
||||||
set nu
|
|
||||||
set nowrap
|
|
||||||
set noswapfile
|
|
||||||
set nobackup
|
|
||||||
set undodir=~/.vim/undodir
|
|
||||||
set undofile
|
|
||||||
set incsearch
|
|
||||||
set termguicolors
|
|
||||||
set scrolloff=8
|
|
||||||
set noshowmode
|
|
||||||
set signcolumn=yes
|
|
||||||
set colorcolumn=80
|
|
||||||
set noerrorbells
|
|
||||||
set number
|
|
||||||
syntax enable
|
|
||||||
set background=dark
|
|
||||||
|
|
||||||
let mapleader = " "
|
|
||||||
|
|
||||||
|
|
||||||
fun! TrimWhiteSpace()
|
|
||||||
let l:save = winsaveview()
|
|
||||||
keeppatterns %s/\s\+$//e
|
|
||||||
call winrestview(l:save)
|
|
||||||
endfun
|
|
||||||
|
|
||||||
augroup MICHAEL
|
|
||||||
autocmd!
|
|
||||||
autocmd BufWritePre * :call TrimWhiteSpace()
|
|
||||||
autocmd Filetype yaml setlocal ts=2 sts=2 sw=2 expandtab
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
|
|
||||||
87
vim/.vim/vimrc
Normal file
87
vim/.vim/vimrc
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
|
||||||
|
" ----------------------- settings ----------------------------------
|
||||||
|
set autoindent
|
||||||
|
set autowrite " automatically write files when changing
|
||||||
|
set background=dark
|
||||||
|
set ruler " turns on col and row in lower right
|
||||||
|
" used with `set ruler`
|
||||||
|
set ruf=%30(%=%#LineNr#%.50F\ [%{strlen(&ft)?&ft:'none'}]\ %l:%c\ %p%%%)
|
||||||
|
set showmode " show command and insert mode
|
||||||
|
set tabstop=2
|
||||||
|
set softtabstop=2
|
||||||
|
set shiftwidth=2
|
||||||
|
set expandtab " replace tabs with spaces automatically
|
||||||
|
set textwidth=72
|
||||||
|
set smartindent
|
||||||
|
set smarttab
|
||||||
|
set nofixendofline
|
||||||
|
set foldmethod=manual
|
||||||
|
set exrc
|
||||||
|
set relativenumber
|
||||||
|
set nohlsearch
|
||||||
|
set hidden
|
||||||
|
set nocompatible
|
||||||
|
set nu
|
||||||
|
set nowrap
|
||||||
|
set noswapfile
|
||||||
|
set nobackup
|
||||||
|
set undodir=~/.vim/undodir
|
||||||
|
set undofile
|
||||||
|
set icon
|
||||||
|
set incsearch
|
||||||
|
set termguicolors
|
||||||
|
set scrolloff=8
|
||||||
|
set signcolumn=yes
|
||||||
|
set colorcolumn=80
|
||||||
|
set noerrorbells
|
||||||
|
set number
|
||||||
|
set wildmenu
|
||||||
|
set ttyfast " faster scrolling
|
||||||
|
set viminfo='20,<1000,s1000 " prevents truncated yanks, deletes, etc.
|
||||||
|
set hidden
|
||||||
|
set history=100 " command history
|
||||||
|
syntax enable
|
||||||
|
filetype plugin on " sense the filesystem
|
||||||
|
let mapleader = " "
|
||||||
|
|
||||||
|
" ----------------------- plugins ----------------------------------
|
||||||
|
|
||||||
|
" Install vim-plug if not found
|
||||||
|
if empty(glob('~/.vim/autoload/plug.vim'))
|
||||||
|
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
||||||
|
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Run PlugInstall if there are missing plugins
|
||||||
|
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
||||||
|
\| PlugInstall --sync | source $MYVIMRC
|
||||||
|
\| endif
|
||||||
|
|
||||||
|
call plug#begin('~/.vim/plugged')
|
||||||
|
Plug 'junegunn/fzf'
|
||||||
|
Plug 'vim-pandoc/vim-pandoc'
|
||||||
|
Plug 'rwxrob/vim-pandoc-syntax-simple'
|
||||||
|
Plug 'morhetz/gruvbox'
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
colorscheme gruvbox
|
||||||
|
" highlight Normal guibg=none
|
||||||
|
|
||||||
|
" ----------------------- utilities ----------------------------------
|
||||||
|
" Edit/Reload vimr configuration file
|
||||||
|
nnoremap confe :e $HOME/.vimrc<CR>
|
||||||
|
nnoremap confr :source $HOME/.vimrc<CR>
|
||||||
|
|
||||||
|
fun! TrimWhiteSpace()
|
||||||
|
let l:save = winsaveview()
|
||||||
|
keeppatterns %s/\s\+$//e
|
||||||
|
call winrestview(l:save)
|
||||||
|
endfun
|
||||||
|
|
||||||
|
augroup MICHAEL
|
||||||
|
autocmd!
|
||||||
|
autocmd BufWritePre * :call TrimWhiteSpace()
|
||||||
|
autocmd Filetype yaml setlocal ts=2 sts=2 sw=2 expandtab
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
|
||||||
61
vim/.vimrc
61
vim/.vimrc
@@ -1,61 +0,0 @@
|
|||||||
|
|
||||||
" Settings:
|
|
||||||
set tabstop=2
|
|
||||||
set softtabstop=2
|
|
||||||
set shiftwidth=2
|
|
||||||
set expandtab
|
|
||||||
set smartindent
|
|
||||||
set exrc
|
|
||||||
set relativenumber
|
|
||||||
set nohlsearch
|
|
||||||
set hidden
|
|
||||||
set nu
|
|
||||||
set nowrap
|
|
||||||
set noswapfile
|
|
||||||
set nobackup
|
|
||||||
set undodir=~/.vim/undodir
|
|
||||||
set undofile
|
|
||||||
set incsearch
|
|
||||||
set termguicolors
|
|
||||||
set scrolloff=8
|
|
||||||
set noshowmode
|
|
||||||
set signcolumn=yes
|
|
||||||
set colorcolumn=80
|
|
||||||
set noerrorbells
|
|
||||||
set number
|
|
||||||
syntax enable
|
|
||||||
set background=dark
|
|
||||||
|
|
||||||
let mapleader = " "
|
|
||||||
|
|
||||||
" Install vim-plug if not found
|
|
||||||
if empty(glob('~/.vim/autoload/plug.vim'))
|
|
||||||
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
|
||||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Run PlugInstall if there are missing plugins
|
|
||||||
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
|
||||||
\| PlugInstall --sync | source $MYVIMRC
|
|
||||||
\| endif
|
|
||||||
|
|
||||||
call plug#begin('~/.vim/plugged')
|
|
||||||
" Plug 'morhetz/gruvbox'
|
|
||||||
call plug#end()
|
|
||||||
|
|
||||||
|
|
||||||
highlight Normal guibg=none
|
|
||||||
|
|
||||||
fun! TrimWhiteSpace()
|
|
||||||
let l:save = winsaveview()
|
|
||||||
keeppatterns %s/\s\+$//e
|
|
||||||
call winrestview(l:save)
|
|
||||||
endfun
|
|
||||||
|
|
||||||
augroup MICHAEL
|
|
||||||
autocmd!
|
|
||||||
autocmd BufWritePre * :call TrimWhiteSpace()
|
|
||||||
autocmd Filetype yaml setlocal ts=2 sts=2 sw=2 expandtab
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
|
|
||||||
15
vim/setup
Executable file
15
vim/setup
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if test -z "$(type vim)"; then
|
||||||
|
echo "Does not look like you have vim installed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir "${HOME}/.vim" |true
|
||||||
|
ln -sfv "${PWD}/.vim/vimrc" "${HOME}/.vim/vimrc"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -36,6 +36,8 @@ export EDITOR=vi
|
|||||||
export VISUAL=vi
|
export VISUAL=vi
|
||||||
export EDITOR_PREFIX=vi
|
export EDITOR_PREFIX=vi
|
||||||
export GIT_DISCOVERY_ACROSS_FILESYSTEM=1
|
export GIT_DISCOVERY_ACROSS_FILESYSTEM=1
|
||||||
|
export VIMINIT='source $MYVIMRC'
|
||||||
|
export MYVIMRC="$HOME/.vim/vimrc"
|
||||||
|
|
||||||
autoload -U up-line-or-beginning-search
|
autoload -U up-line-or-beginning-search
|
||||||
autoload -U down-line-or-beginning-search
|
autoload -U down-line-or-beginning-search
|
||||||
@@ -127,9 +129,6 @@ setopt aliases
|
|||||||
# Enable vi mode
|
# Enable vi mode
|
||||||
bindkey -v
|
bindkey -v
|
||||||
|
|
||||||
#zsh_add_file "zsh-exports"
|
|
||||||
#zsh_add_file "zsh-aliases"
|
|
||||||
|
|
||||||
# Plugins
|
# Plugins
|
||||||
zsh_add_plugin "zsh-users/zsh-autosuggestions"
|
zsh_add_plugin "zsh-users/zsh-autosuggestions"
|
||||||
zsh_add_plugin "zsh-users/zsh-syntax-highlighting"
|
zsh_add_plugin "zsh-users/zsh-syntax-highlighting"
|
||||||
@@ -146,12 +145,28 @@ autoload -Uz compinit; compinit # zstyle(s) should be added before this.
|
|||||||
zmodload zsh/complist
|
zmodload zsh/complist
|
||||||
_comp_options+=(globdots) # Include hidden files.
|
_comp_options+=(globdots) # Include hidden files.
|
||||||
|
|
||||||
|
#------------------------------ prompt ------------------------------
|
||||||
|
|
||||||
# Prompt / managed by brew. (`brew install pure`)
|
# Prompt / managed by brew. (`brew install pure`)
|
||||||
autoload -Uz promptinit; promptinit
|
autoload -Uz promptinit; promptinit
|
||||||
prompt pure
|
prompt pure
|
||||||
|
|
||||||
|
#------------------------------ aliases ------------------------------
|
||||||
|
|
||||||
|
alias bk='cd "${OLDPWD}"'
|
||||||
|
alias cdots='cd "${DOTFILES}"'
|
||||||
|
alias cl='printf "\e[H\e[2J"'
|
||||||
|
alias clear='printf "\e[H\e[2J"'
|
||||||
|
alias g='git'
|
||||||
|
alias ga='git add'
|
||||||
|
alias gcb='git checkout -b'
|
||||||
|
alias gco='git checkout'
|
||||||
|
#alias gma() { git add . && git commit -m "$1" }
|
||||||
|
#alias gp() { git push }
|
||||||
|
alias gs='git status'
|
||||||
|
|
||||||
#------------------------------ local configs ------------------------------
|
#------------------------------ local configs ------------------------------
|
||||||
_source_if "$ZDOTDIR/.zshrc-local"
|
_source_if "$ZDOTDIR/.zshrc-local"
|
||||||
|
|
||||||
|
|
||||||
|
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
||||||
|
|||||||
Reference in New Issue
Block a user