Set up some new Vim stuff
This commit is contained in:
parent
7caa0e5515
commit
26744ef1e8
5 changed files with 346 additions and 11 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -8,6 +8,8 @@ hub
|
|||
vim/vim.symlink/.netrwhist
|
||||
vim/vim.symlink/bundle
|
||||
|
||||
nvim/nvim.symlink/plugged
|
||||
|
||||
zsh/zsh.symlink/liquidprompt
|
||||
zsh/zsh.symlink/zsh-completions
|
||||
zsh/zsh.symlink/zsh-syntax-highlighting
|
||||
|
|
|
@ -64,7 +64,7 @@ LP_PERCENTS_ALWAYS=0
|
|||
# Use the permissions feature and display a red ':' before the prompt to show
|
||||
# when you don't have write permission to the current directory.
|
||||
# Recommended value is 1
|
||||
LP_ENABLE_PERM=0
|
||||
LP_ENABLE_PERM=1
|
||||
|
||||
# Enable the proxy detection feature.
|
||||
# Recommended value is 1
|
||||
|
@ -76,11 +76,11 @@ LP_ENABLE_JOBS=1
|
|||
|
||||
# Enable the load feature.
|
||||
# Recommended value is 1
|
||||
LP_ENABLE_LOAD=1
|
||||
LP_ENABLE_LOAD=0
|
||||
|
||||
# Enable the battery feature.
|
||||
# Recommended value is 1
|
||||
LP_ENABLE_BATT=1
|
||||
LP_ENABLE_BATT=0
|
||||
|
||||
# Enable the 'sudo credentials' feature.
|
||||
# Be warned that this may pollute the syslog if you don't have sudo
|
||||
|
@ -118,7 +118,7 @@ LP_ENABLE_TIME=1
|
|||
|
||||
# Show runtime of the previous command if over LP_RUNTIME_THRESHOLD
|
||||
# Recommended value is 0
|
||||
LP_ENABLE_RUNTIME=0
|
||||
LP_ENABLE_RUNTIME=1
|
||||
|
||||
# Minimal runtime (in seconds) before the runtime will be displayed
|
||||
# Recommended value is 2
|
||||
|
@ -162,24 +162,23 @@ LP_DISABLED_VCS_PATH=""
|
|||
|
||||
# Colors
|
||||
|
||||
LP_COLOR_MARK=""
|
||||
LP_COLOR_USER_LOGGED=""
|
||||
LP_COLOR_TIME=""
|
||||
LP_COLOR_MARK="$PURPLE"
|
||||
LP_COLOR_USER_LOGGED="$CYAN"
|
||||
LP_COLOR_TIME="$BLUE"
|
||||
|
||||
LP_COLOR_WRITE="$GREEN"
|
||||
LP_COLOR_NOWRITE="$RED"
|
||||
|
||||
LP_MARK_DEFAULT="$"
|
||||
LP_MARK_LOAD=""
|
||||
LP_MARK_GIT="${LP_MARK_DEFAULT}"
|
||||
LP_MARK_BRACKET_OPEN="${BLACK}[${WHITE}"
|
||||
LP_MARK_BRACKET_CLOSE="${BLACK}]${WHITE}"
|
||||
LP_MARK_PERM="${BLACK}:${WHITE}"
|
||||
|
||||
LP_COLOR_UP=""
|
||||
LP_COLOR_UP="$YELLOW"
|
||||
LP_COLOR_COMMITS="$GREEN"
|
||||
LP_COLOR_CHANGES="$BLUE"
|
||||
|
||||
LP_COLOR_PATH="${WHITE}"
|
||||
|
||||
LP_COLOR_PATH="${YELLOW}"
|
||||
|
||||
# vim: set et sts=4 sw=4 tw=120 ft=sh:
|
||||
|
|
306
nvim/nvim.symlink/init.vim
Normal file
306
nvim/nvim.symlink/init.vim
Normal file
|
@ -0,0 +1,306 @@
|
|||
" Basic editing config
|
||||
|
||||
" colorscheme maxbucknell
|
||||
set termguicolors
|
||||
set updatetime=100
|
||||
|
||||
call plug#begin()
|
||||
|
||||
" Colours
|
||||
Plug 'morhetz/gruvbox'
|
||||
|
||||
" Fuzzy finding
|
||||
Plug '/usr/local/opt/fzf'
|
||||
|
||||
" Snippets
|
||||
Plug 'SirVer/ultisnips'
|
||||
Plug 'honza/vim-snippets'
|
||||
|
||||
" Git integration
|
||||
Plug 'tpope/vim-fugitive'
|
||||
Plug 'airblade/vim-gitgutter'
|
||||
|
||||
" Linting
|
||||
Plug 'neomake/neomake'
|
||||
Plug 'w0rp/ale'
|
||||
|
||||
" Comments
|
||||
Plug 'tpope/vim-commentary'
|
||||
|
||||
" Statusline
|
||||
Plug 'vim-airline/vim-airline'
|
||||
|
||||
" For async completion
|
||||
Plug 'Shougo/deoplete.nvim'
|
||||
|
||||
" TypeScript
|
||||
Plug 'HerringtonDarkholme/yats.vim'
|
||||
Plug 'mhartington/nvim-typescript', {'do': './install.sh'}
|
||||
|
||||
" Go
|
||||
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
|
||||
Plug 'deoplete-plugins/deoplete-go', { 'do': 'make'}
|
||||
|
||||
" Rust
|
||||
Plug 'rust-lang/rust.vim'
|
||||
Plug 'sebastianmarkow/deoplete-rust'
|
||||
|
||||
call plug#end()
|
||||
|
||||
" Theme configuration
|
||||
let g:gruvbox_italic = 1
|
||||
colorscheme gruvbox
|
||||
|
||||
" Setting up autocomplete
|
||||
let g:deoplete#enable_at_startup = 1
|
||||
|
||||
" Quick exit insert mode
|
||||
"
|
||||
" Escape is at the far corner of my keyboard, and having it so far away
|
||||
" was discouraging me from exiting insert mode. Qwerty users can remap
|
||||
" jk to <esc>, which is a far better solution. The keys are next to each
|
||||
" other, and it makes exiting insert mode a pleasant rolling motion.
|
||||
" Moreover, when in normal mode, jk is a no-op.
|
||||
"
|
||||
" As a dvorak user, jk was too cumbersome, but there were no other
|
||||
" suitable candidates. hh is inferior in that it is not a no-op in
|
||||
" normal mode, but it is just as easy to type. The only caveat is when
|
||||
" an edit ends with h, which is why hhh will expand to place an h in
|
||||
" the buffer before exiting.
|
||||
"
|
||||
" To encourage me to adopt the new style, I disable escape. That one is
|
||||
" sure to mess up someone not familiar with my setup.
|
||||
inoremap hh <esc>
|
||||
inoremap hhh h<esc>
|
||||
" Terminal mode setting
|
||||
tnoremap hh <C-\><C-n>
|
||||
tnoremap hhh h<C-\><C-n>
|
||||
|
||||
" Lead with the biggest button on the motherfucking keyboard
|
||||
let mapleader = "\<space>"
|
||||
|
||||
" FUzzy finding
|
||||
nnoremap <leader>t :FZF<cr>
|
||||
|
||||
" Don't wrap lines
|
||||
"
|
||||
" I look at a lot of CSV files and logs, which are generally the only
|
||||
" times I see long lines. If code is too long, I shorten it. As such,
|
||||
" having lines artificially wrapping only gets in my way.
|
||||
set nowrap
|
||||
|
||||
" Line numbering
|
||||
"
|
||||
" This shows the real line number of the current line, and relative
|
||||
" line numbers on the other lines. Relative line numbers are good to
|
||||
" know how many lines to yank, delete, or move.
|
||||
set number
|
||||
set relativenumber
|
||||
|
||||
" Write before commands
|
||||
"
|
||||
" This means that if I have unsaved changes, they get saved before
|
||||
" executing a git commit, or something like that.
|
||||
set autowrite
|
||||
|
||||
" Split management
|
||||
set splitbelow
|
||||
set splitright
|
||||
|
||||
" Just remove an extra keystroke
|
||||
nnoremap <C-j> <C-w>j
|
||||
nnoremap <C-k> <C-w>k
|
||||
nnoremap <C-h> <C-w>h
|
||||
nnoremap <C-l> <C-w>l
|
||||
|
||||
" Make searches case sensitive only if an upper case character has been typed
|
||||
set ignorecase smartcase
|
||||
|
||||
" Allow backspacing over everything in insert mode
|
||||
"
|
||||
" By default, Vim will stop when it gets to the beginning of a line,
|
||||
" throw its arms in the air and give up.
|
||||
set backspace=indent,eol,start
|
||||
|
||||
" Display incomplete commands and the lines they apply to.
|
||||
set showcmd
|
||||
|
||||
" Allow hidden buffers
|
||||
"
|
||||
" If this is off, buffers are destroyed when they fade out of view. We
|
||||
" have the memory to spare to keep them around.
|
||||
set hidden
|
||||
|
||||
" Enable highlighting for syntax
|
||||
syntax on
|
||||
|
||||
" Enable file type detection.
|
||||
"
|
||||
" Use the default filetype settings, so that mail gets 'tw' set to 72,
|
||||
" 'cindent' is on in C files, etc.
|
||||
" Also load indent files, to automatically do language-dependent
|
||||
" indenting.
|
||||
filetype plugin indent on
|
||||
|
||||
" Insert only one space when joining lines that contain
|
||||
" sentence-terminating punctuation like `.`.
|
||||
set nojoinspaces
|
||||
|
||||
" If a file is changed outside of vim, automatically reload it
|
||||
set autoread
|
||||
|
||||
" Show trailing whitespace, since it's a crime
|
||||
set list
|
||||
set listchars=tab:‣\ ,trail:·
|
||||
|
||||
" Turn off code folding
|
||||
"
|
||||
" I hate code folding. It makes me mad. I just want a buffer with all
|
||||
" of my text in it, no funny business.
|
||||
set foldmethod=manual
|
||||
set nofoldenable
|
||||
let g:vim_markdown_folding_disabled=1
|
||||
let g:vimtex_fold_enabled=0
|
||||
|
||||
""""""""""""""""""
|
||||
" Ultisnips, y'all
|
||||
""""""""""""""""""
|
||||
|
||||
let g:UltiSnipsExpandTrigger="<tab>"
|
||||
let g:UltiSnipsJumpForwardTrigger="<tab>"
|
||||
let g:UltiSnipsJumpBackwardTrigger="<S-tab>"
|
||||
|
||||
" Tab config options
|
||||
"
|
||||
" In general, I prefer spaces to tabs, and 2-space indentation. These
|
||||
" settings just make that consistent, so I rarely have to think about
|
||||
" it.
|
||||
set expandtab
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set softtabstop=4
|
||||
set autoindent
|
||||
|
||||
augroup vimrcEx
|
||||
" Clear all autocmds in the group
|
||||
autocmd!
|
||||
|
||||
" Language whitespace settings
|
||||
autocmd FileType make setl noet sw=8 sts=8 ts=8
|
||||
|
||||
" Hard wrap prose
|
||||
"
|
||||
" This will automatically insert a new line in insert mode when a
|
||||
" line gets too long (above 80 characters). I can also run gqap
|
||||
" in normal mode to reflow a paragraph.
|
||||
autocmd FileType
|
||||
\ markdown,text
|
||||
\ setl tw=80 fo=t1
|
||||
|
||||
" Automatically enter terminal mode when summoning a terminal
|
||||
autocmd TermOpen term://* startinsert
|
||||
|
||||
augroup END
|
||||
|
||||
" Make directories in a filename if they don't exist.
|
||||
|
||||
function! AskQuit (msg, options, quit_option)
|
||||
if confirm(a:msg, a:options) == a:quit_option
|
||||
exit
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! EnsureDirExists ()
|
||||
let required_dir = expand("%:h")
|
||||
if !isdirectory(required_dir)
|
||||
try
|
||||
call mkdir( required_dir, 'p' )
|
||||
catch
|
||||
echom "Could not create directory"
|
||||
exit
|
||||
endtry
|
||||
endif
|
||||
endfunction
|
||||
|
||||
augroup AutoMkdir
|
||||
autocmd!
|
||||
autocmd BufNewFile * :call EnsureDirExists()
|
||||
augroup END
|
||||
|
||||
" Ale
|
||||
"
|
||||
" An asynchronous linting engine.
|
||||
let g:ale_lint_on_text_changed = 1
|
||||
|
||||
" Hallelujah!
|
||||
let g:ale_set_signs = 1
|
||||
let g:ale_sign_column_always = 1
|
||||
let g:ale_sign_error = '--'
|
||||
let g:ale_sign_warning = '--'
|
||||
|
||||
" Gitgutter
|
||||
let g:gitgutter_realtime = 1
|
||||
let g:gitgutter_eager = 1
|
||||
|
||||
" JSX in mah JavaScript
|
||||
let g:jsx_ext_required = 0
|
||||
|
||||
" Status line stuff
|
||||
let g:airline#extensions#ale#enabled = 1
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
" Input supports patched fonts already \o/
|
||||
let g:airline_powerline_fonts = 1
|
||||
|
||||
|
||||
" Go to most recently edited file
|
||||
nnoremap <leader><leader> <c-^>
|
||||
|
||||
" Disable syntax hiding in JSON
|
||||
"
|
||||
" Vim JSON provides a fancy way of viewing, where it hides quotes and
|
||||
" just shows you data. I don't want that.
|
||||
let g:vim_json_syntax_conceal = 0
|
||||
|
||||
" Show syntax highlighting groups for word under cursor
|
||||
"
|
||||
" This is useful for finding rogue elements I forgot in my colour
|
||||
" scheme.
|
||||
nnoremap <leader>\ :call <SID>SynStack()<CR>
|
||||
function! <SID>SynStack()
|
||||
if !exists("*synstack")
|
||||
return
|
||||
endif
|
||||
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val,"name")')
|
||||
endfunc
|
||||
|
||||
" Remap semi-colon to colon.
|
||||
"
|
||||
" Colon is the starting point of a lot of actions in Vim. And I
|
||||
" shouldn't have to hold a modifier key to access so much
|
||||
" essential functionality.
|
||||
noremap ; :
|
||||
noremap ;; ;
|
||||
|
||||
" Commenting aliases, because I hate change.
|
||||
nnoremap <leader>/ :.Commentary<cr>
|
||||
|
||||
" Git blame
|
||||
"
|
||||
" I used to do this by just filling in my buffer, but this is nicer.
|
||||
nnoremap <leader>a :Gblame<cr>
|
||||
|
||||
" Disable creation of swap files.
|
||||
"
|
||||
" Swap files serve a purpose, but not to me. I write often, and so
|
||||
" these just get in the way.
|
||||
set nobackup
|
||||
set nowritebackup
|
||||
set noswapfile
|
||||
|
||||
" What the hell is ex mode
|
||||
"
|
||||
" Whatever it is, I don't like it.
|
||||
nnoremap Q <nop>
|
||||
|
||||
" Summon a terminal
|
||||
nnoremap <leader>k :bot sp term://zsh<cr>
|
14
zsh/zsh.symlink/fzf.zsh
Normal file
14
zsh/zsh.symlink/fzf.zsh
Normal file
|
@ -0,0 +1,14 @@
|
|||
# Setup fzf
|
||||
# ---------
|
||||
if [[ ! "$PATH" == */usr/local/opt/fzf/bin* ]]; then
|
||||
export PATH="$PATH:/usr/local/opt/fzf/bin"
|
||||
fi
|
||||
|
||||
# Auto-completion
|
||||
# ---------------
|
||||
[[ $- == *i* ]] && source "/usr/local/opt/fzf/shell/completion.zsh" 2> /dev/null
|
||||
|
||||
# Key bindings
|
||||
# ------------
|
||||
source "/usr/local/opt/fzf/shell/key-bindings.zsh"
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
source /etc/zshrc
|
||||
|
||||
# Secret stuff
|
||||
source $HOME/.zsh/secret
|
||||
|
||||
# Fuzzy finder!
|
||||
source $HOME/.zsh/fzf.zsh
|
||||
|
||||
## Path
|
||||
# Default path
|
||||
export PATH="/sbin"
|
||||
|
@ -18,12 +22,18 @@ PATH="$HOME/dotfiles/bin:$PATH"
|
|||
PATH="$HOME/.composer/vendor/bin:$PATH"
|
||||
export COMPOSER_HOME="$HOME/.composer"
|
||||
|
||||
# Ruby
|
||||
PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.6.0/bin:$PATH"
|
||||
|
||||
# Python
|
||||
export PYTHONPATH="$PYTHONPATH:$HOME/dotfiles/lib/python"
|
||||
|
||||
# Rust
|
||||
source $HOME/.cargo/env
|
||||
|
||||
# Go
|
||||
PATH="$HOME/go/bin:$PATH"
|
||||
|
||||
## Completion
|
||||
|
||||
# Load up the extra Z Shell completions
|
||||
|
@ -147,6 +157,9 @@ setopt hist_lex_words
|
|||
# Liquid Prompt!
|
||||
source "$HOME/.zsh/liquidprompt/liquidprompt"
|
||||
|
||||
# Vim!
|
||||
alias vim=nvim
|
||||
|
||||
# Create MySQL Docker container
|
||||
function provision_mysql {
|
||||
mkdir -p "$HOME/Data/5.6/data" && docker run -d\
|
||||
|
@ -220,3 +233,4 @@ To install Magento. Happy hacking!
|
|||
EOF
|
||||
popd
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue