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YYBYRXGLLNYHIN4N25ZVQC
* TODO: add spacemacs private layer into stowed
* TODO: add tmux.conf to home-manager
### TODO: for macos
* move skhd, yabai, karabiner to stowed
* move start_scripts to home-manager
" enable python plugins for neovim using neovim's own pyenv
call plug#begin()
Plug 'roxma/nvim-completion-manager'
Plug 'autozimu/LanguageClient-neovim', { 'do': ':UpdateRemotePlugins' }
Plug 'roxma/nvim-cm-tern', {'do': 'npm install'}
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'Shougo/neosnippet'
Plug 'Shougo/neosnippet-snippets'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'fatih/vim-go', { 'tag': '*' }
Plug 'bling/vim-airline'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'mitermayer/vim-prettier', {'do': 'yarn install', 'for': ['javascript', 'typescript', 'css', 'less', 'scss']}
" syntax color plugins and indent plugins
Plug 'trevordmiller/nova-vim'
Plug 'pangloss/vim-javascript'
Plug 'othree/html5.vim'
Plug 'hail2u/vim-css3-syntax'
Plug 'mxw/vim-jsx'
call plug#end()
" / search config
set ignorecase
nnoremap <silent> <Esc> :nohlsearch<Bar>:echo<CR>
" rg fzf config
let g:rg_command = '
\ rg --column --line-number --no-heading --fized-strings --ignore-case --no-ignore --hidden --follow --color "always"
\ -g "!{.git,node_modules,vendor}/*" '
command! -bang -nargs=* F call fzf#vim#grep(g:rg_command .shellescape(<q-args>), 1, <bang>0)
nmap <C-p> :Files<cr>
let g:fzf_action = {'ctrl-s': 'vsplit' }
let g:fzf_layout = { 'down': '~20%' }
" lint engine configuration options
let g:ale_sign_column_always = 1
let g:ale_fixers = {
\ }
" status line vim airline config
let g:airline#extensions#tabline#enabled = 1
" vim-javascript config
let g:javascript_plugin_flow = 1 " enable javascript flow shit to be highlighted correctly
" -- Terminal Mode Remaps
:tnoremap <Esc> <C-\><C-n> " press escape to get into normal mode
" -- Visual Mode Remaps
"###FUNCTIONS###
"###############
function! NumberToggle()
if(&relativenumber == 1)
set nornu
set number
else
set rnu
endif
endfunc
function! AleFixersToggle()
let g:ale_fix_on_save = exists('g:ale_fix_on_save') ? !g:ale_fix_on_save : 1
endfunc
command! ToggleFixers call AleFixersToggle()
command! NumToggle call NumberToggle()
" -- misc settings
set number
set relativenumber
set nojoinspaces
set splitright
set scrolloff=3
set sidescrolloff=5
set hidden
colorscheme nova
vmap <leader>cp :'<,'>:w !pbcopy<cr><cr>
" vim-test config
let test#strategy = "neovim" " runs test in :term instead of :!
let g:rustfmt_autosave = 1
" let g:deoplete#sources#rust#documentation_max_height=20
augroup rust
autocmd!
autocmd FileType rust nnoremap <leader>rr :term cargo run<cr>
autocmd FileType rust nnoremap <leader>bb :term cargo build<cr>
"use vim-test autocmd FileType rust nnoremap <leader>tt :term cargo test<cr>
augroup END
autocmd FileType rust nnoremap <leader>qb :term cargo check<cr>
let g:racer_cmd='~/.cargo/bin/racer'
" let g:deoplete#sources#rust#racer_binary=$HOME . '/.cargo/bin/racer'
" let g:deoplete#sources#rust#rust_source_path=$HOME . '/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src'
" -- Normal Mode Remaps
nnoremap <leader>j :bn<cr>
nnoremap <leader>k :bp<cr>
nnoremap <leader>T :vsplit term://bash<cr>a. ~/.bash_profile<cr>
nnoremap <leader>Th :sp term://bash<cr>a. ~/.bash_profile<cr>
nnoremap <leader>tt :TestFile<cr>
" rust language specific config
let g:prettier#exec_cmd_async = 1 " enable async js / css code formatting through prettier
let g:prettier#autoformat = 0
autocmd BufWritePre *.js,*.css,*.scss,*.less PrettierAsync " runs prettier before saving
" nerd comment config
let g:NERDSpaceDelims = 1
let g:NERDTrimTrailingWhitespace = 1
" neosnippet config
imap <C-i> <Plug>(neosnippet_expand_or_jump)
smap <C-i> <Plug>(neosnippet_expand_or_jump)
xmap <C-i> <Plug>(neosnippet_expand_target)
let g:neosnippet#snippets_directory='~/dotfiles/nvim/snippets'
nmap <silent> <C-j> :cn<CR>
nmap <silent> <C-k> :cp<CR>
\ 'javascript': ['eslint'],
\ 'python': ['yapf'],
let g:ale_fix_on_save = 1
let g:ale_linters = {'rust': ['rls']}
set smartcase
set magic
let g:deoplete#enable_at_startup = 1
let g:jedi#completions_enabled = 1 " use deoplete for completions
Plug 'rust-lang/rust.vim'
Plug 'dag/vim-fish'
Plug 'junegunn/fzf.vim'
Plug 'scrooloose/nerdcommenter'
Plug 'tpope/vim-rhubarb'
" Plug 'sebastianmarkow/deoplete-rust'
Plug 'wellle/tmux-complete.vim'
Plug 'zchee/deoplete-jedi'
Plug 'davidhalter/jedi-vim'
Plug 'w0rp/ale'
Plug 'janko-m/vim-test'
let g:python_host_prog = $PYENV_ROOT . '/versions/neovim2/bin/python'
let g:python3_host_prog = $PYENV_ROOT . '/versions/neovim3/bin/python'
" defaults to load before plugins
" plugins can override these for stuff where it makes sense
set ts=4
# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
fields=0 48 17 18 38 39 2 46 47 49 1
sort_direction=1
hide_kernel_threads=1
hide_userland_threads=0
shadow_other_users=0
show_thread_names=0
show_program_path=1
highlight_base_name=0
highlight_megabytes=1
highlight_threads=1
tree_view=0
header_margin=1
detailed_cpu_time=0
update_process_names=0
account_guest_in_cpu_meter=0
color_scheme=0
delay=15
left_meters=LeftCPUs2 Memory Swap
left_meter_modes=1 1 1
right_meters=RightCPUs2 Tasks LoadAverage Uptime
right_meter_modes=1 2 2 2
enable_mouse=1
cpu_count_from_one=1
show_cpu_usage=1
show_cpu_frequency=0
highlight_changes=0
highlight_changes_delay_secs=5
find_comm_in_cmdline=1
strip_exe_from_cmdline=1
show_merged_command=0
sort_key=47
function __complete_terraform
set -lx COMP_LINE (string join ' ' (commandline -o))
test (commandline -ct) = ""
and set COMP_LINE "$COMP_LINE "
/usr/local/bin/terraform
end
complete -c terraform -a "(__complete_terraform)"
# Key bindings
# ------------
function fzf_key_bindings
# Store current token in $dir as root for the 'find' command
function fzf-file-widget -d "List files and folders"
set -l commandline (__fzf_parse_commandline)
set -l dir $commandline[1]
set -l fzf_query $commandline[2]
# "-path \$dir'*/\\.*'" matches hidden files/folders inside $dir but not
# $dir itself, even if hidden.
set -q FZF_CTRL_T_COMMAND; or set -l FZF_CTRL_T_COMMAND "
command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \
-o -type f -print \
-o -type d -print \
-o -type l -print 2> /dev/null | sed 's@^\./@@'"
set -q FZF_TMUX_HEIGHT; or set FZF_TMUX_HEIGHT 40%
begin
set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse $FZF_DEFAULT_OPTS $FZF_CTRL_T_OPTS"
eval "$FZF_CTRL_T_COMMAND | "(__fzfcmd)' -m --query "'$fzf_query'"' | while read -l r; set result $result $r; end
end
if [ -z "$result" ]
commandline -f repaint
return
else
# Remove last token from commandline.
commandline -t ""
end
for i in $result
commandline -it -- (string escape $i)
commandline -it -- ' '
end
commandline -f repaint
end
function fzf-history-widget -d "Show command history"
set -q FZF_TMUX_HEIGHT; or set FZF_TMUX_HEIGHT 40%
begin
set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT $FZF_DEFAULT_OPTS --tiebreak=index --bind=ctrl-r:toggle-sort $FZF_CTRL_R_OPTS +m"
set -l FISH_MAJOR (echo $version | cut -f1 -d.)
set -l FISH_MINOR (echo $version | cut -f2 -d.)
# history's -z flag is needed for multi-line support.
# history's -z flag was added in fish 2.4.0, so don't use it for versions
# before 2.4.0.
if [ "$FISH_MAJOR" -gt 2 -o \( "$FISH_MAJOR" -eq 2 -a "$FISH_MINOR" -ge 4 \) ];
history -z | eval (__fzfcmd) --read0 -q '(commandline)' | perl -pe 'chomp if eof' | read -lz result
and commandline -- $result
else
history | eval (__fzfcmd) -q '(commandline)' | read -l result
and commandline -- $result
end
end
commandline -f repaint
end
function fzf-cd-widget -d "Change directory"
set -l commandline (__fzf_parse_commandline)
set -l dir $commandline[1]
set -l fzf_query $commandline[2]
set -q FZF_ALT_C_COMMAND; or set -l FZF_ALT_C_COMMAND "
command find -L \$dir -mindepth 1 \\( -path \$dir'*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' \\) -prune \
-o -type d -print 2> /dev/null | sed 's@^\./@@'"
set -q FZF_TMUX_HEIGHT; or set FZF_TMUX_HEIGHT 40%
begin
set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT --reverse $FZF_DEFAULT_OPTS $FZF_ALT_C_OPTS"
eval "$FZF_ALT_C_COMMAND | "(__fzfcmd)' +m --query "'$fzf_query'"' | read -l result
if [ -n "$result" ]
cd $result
# Remove last token from commandline.
commandline -t ""
end
end
commandline -f repaint
end
function __fzfcmd
set -q FZF_TMUX; or set FZF_TMUX 0
set -q FZF_TMUX_HEIGHT; or set FZF_TMUX_HEIGHT 40%
if [ $FZF_TMUX -eq 1 ]
echo "fzf-tmux -d$FZF_TMUX_HEIGHT"
else
echo "fzf"
end
end
bind \ct fzf-file-widget
bind \cr fzf-history-widget
bind \ec fzf-cd-widget
if bind -M insert > /dev/null 2>&1
bind -M insert \ct fzf-file-widget
bind -M insert \cr fzf-history-widget
bind -M insert \ec fzf-cd-widget
end
function __fzf_parse_commandline -d 'Parse the current command line token and return split of existing filepath and rest of token'
# eval is used to do shell expansion on paths
set -l commandline (eval "printf '%s' "(commandline -t))
if [ -z $commandline ]
# Default to current directory with no --query
set dir '.'
set fzf_query ''
else
set dir (__fzf_get_dir $commandline)
if [ "$dir" = "." -a (string sub -l 1 $commandline) != '.' ]
# if $dir is "." but commandline is not a relative path, this means no file path found
set fzf_query $commandline
else
# Also remove trailing slash after dir, to "split" input properly
set fzf_query (string replace -r "^$dir/?" '' "$commandline")
end
end
echo $dir
echo $fzf_query
end
function __fzf_get_dir -d 'Find the longest existing filepath from input string'
set dir $argv
# Strip all trailing slashes. Ignore if $dir is root dir (/)
if [ (string length $dir) -gt 1 ]
set dir (string replace -r '/*$' '' $dir)
end
# Iteratively check if dir exists and strip tail end of path
while [ ! -d "$dir" ]
# If path is absolute, this can keep going until ends up at /
# If path is relative, this can keep going until entire input is consumed, dirname returns "."
set dir (dirname "$dir")
end
echo $dir
end
end