Bootstrap using stow
This commit is contained in:
10
files/bash/.bash_profile
Normal file
10
files/bash/.bash_profile
Normal file
@@ -0,0 +1,10 @@
|
||||
# Load .profile, containing login, non-bash related initializations.
|
||||
source "$HOME/.profile"
|
||||
|
||||
# Load .bashrc, containing non-login related bash initializations.
|
||||
source "$HOME/.bashrc"
|
||||
|
||||
|
||||
# References:
|
||||
# https://unix.stackexchange.com/questions/192521/loading-profile-from-bash-profile-or-not-using-bash-profile-at-all
|
||||
# https://www.stefaanlippens.net/my_bashrc_aliases_profile_and_other_stuff/
|
||||
85
files/bash/.bashrc
Normal file
85
files/bash/.bashrc
Normal file
@@ -0,0 +1,85 @@
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color|*-256color) 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'
|
||||
#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
|
||||
|
||||
# colored GCC warnings and errors
|
||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# some more ls aliases
|
||||
alias ll='ls -alF'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
|
||||
# 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$//'\'')"'
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# 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 ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
export NVM_DIR="$HOME/.config/nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
54
files/bash/.profile
Normal file
54
files/bash/.profile
Normal file
@@ -0,0 +1,54 @@
|
||||
if [ -z "$PROFILE_LOCK" ]; then
|
||||
export PROFILE_LOCK=1
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/bin" ]; then
|
||||
export PATH="$HOME/bin:$PATH"
|
||||
fi
|
||||
if [ -d "$HOME/.local/bin" ]; then
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
|
||||
# config
|
||||
if [ -z "$XDG_DATA_HOME" ]; then
|
||||
export XDG_DATA_HOME="$HOME/.local/share"
|
||||
mkdir -p "$XDG_DATA_HOME"
|
||||
fi
|
||||
if [ -z "$XDG_CONFIG_HOME" ]; then
|
||||
export XDG_CONFIG_HOME="$HOME/.config"
|
||||
mkdir -p "$XDG_CONFIG_HOME"
|
||||
fi
|
||||
|
||||
# workspace
|
||||
if [ -z "$WORKSPACE" ]; then
|
||||
export WORKSPACE="$HOME/workspace"
|
||||
mkdir -p "$WORKSPACE"
|
||||
fi
|
||||
|
||||
# pyenv
|
||||
export PYENV_ROOT="$HOME/.pyenv"
|
||||
if [ -d "$PYENV_ROOT" ]; then
|
||||
export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
export PATH="$PYENV_ROOT/shims:$PATH"
|
||||
[ -x "$(command -v pyenv)" ] && eval "$(pyenv init -)"
|
||||
fi
|
||||
|
||||
# poetry
|
||||
export POETRY_ROOT="$HOME/.poetry"
|
||||
if [ -d "$POETRY_ROOT" ]; then
|
||||
export PATH="$POETRY_ROOT/bin:$PATH"
|
||||
fi
|
||||
|
||||
# nvm
|
||||
export NVM_DIR="$XDG_CONFIG_HOME/nvm"
|
||||
if [ -d "$NVM_DIR" ]; then
|
||||
export PATH="$NVM_DIR/bin:$PATH"
|
||||
fi
|
||||
|
||||
# yarn
|
||||
export YARN_DIR="$HOME/.yarn"
|
||||
if [ -d "$YARN_DIR" ]; then
|
||||
export PATH="$YARN_DIR/bin:$PATH"
|
||||
fi
|
||||
|
||||
fi
|
||||
11
files/fish/config.fish
Normal file
11
files/fish/config.fish
Normal file
@@ -0,0 +1,11 @@
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Cross-shell (only import if environment has been setup)
|
||||
# ---------------------------------------------------------------------------- #
|
||||
if test -e ~/.profile
|
||||
bass source ~/.profile
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------------------------- #
|
||||
# Fish specific
|
||||
# ---------------------------------------------------------------------------- #
|
||||
set fish_greeting
|
||||
2
files/fish/fishfile
Normal file
2
files/fish/fishfile
Normal file
@@ -0,0 +1,2 @@
|
||||
rafaelrinaldi/pure
|
||||
edc/bass
|
||||
4
files/fish/functions/nvm.fish
Normal file
4
files/fish/functions/nvm.fish
Normal file
@@ -0,0 +1,4 @@
|
||||
function nvm
|
||||
bass source $NVM_DIR/nvm.sh --no-use ';' nvm $argv
|
||||
end
|
||||
|
||||
3
files/fish/functions/update.fish
Normal file
3
files/fish/functions/update.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
function update -d 'run dotfiles install'
|
||||
make --directory="$WORKSPACE/dotfiles"
|
||||
end
|
||||
6
files/git/.gitconfig
Normal file
6
files/git/.gitconfig
Normal file
@@ -0,0 +1,6 @@
|
||||
[user]
|
||||
name = Andrejus
|
||||
email = hi@andrejus.uk
|
||||
|
||||
[github]
|
||||
user = andrejusk
|
||||
1
files/git/.gitignore_global
Normal file
1
files/git/.gitignore_global
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
5
files/ssh/config
Normal file
5
files/ssh/config
Normal file
@@ -0,0 +1,5 @@
|
||||
Host *
|
||||
IgnoreUnknown UseKeychain
|
||||
UseKeychain yes
|
||||
AddKeysToAgent yes
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
466
files/vim/init.vim
Normal file
466
files/vim/init.vim
Normal file
@@ -0,0 +1,466 @@
|
||||
scriptencoding utf-8
|
||||
source $XDG_CONFIG_HOME/nvim/plugins.vim
|
||||
|
||||
|
||||
" ============================================================================ "
|
||||
" === EDITING OPTIONS === "
|
||||
" ============================================================================ "
|
||||
|
||||
" Remap leader key to ,
|
||||
let g:mapleader=','
|
||||
|
||||
" Yank and paste with the system clipboard
|
||||
set clipboard=unnamed
|
||||
|
||||
" Hides buffers instead of closing them
|
||||
set hidden
|
||||
|
||||
" === TAB/Space settings === "
|
||||
" Insert spaces when TAB is pressed.
|
||||
set expandtab
|
||||
|
||||
" do not wrap long lines by default
|
||||
set nowrap
|
||||
|
||||
" Only one line for command line
|
||||
set cmdheight=1
|
||||
|
||||
|
||||
" ============================================================================ "
|
||||
" === PLUGIN SETUP === "
|
||||
" ============================================================================ "
|
||||
|
||||
" Wrap in try/catch to avoid errors on initial install before plugin is available
|
||||
try
|
||||
" === Denite setup ==="
|
||||
" Use ripgrep for searching current directory for files
|
||||
" By default, ripgrep will respect rules in .gitignore
|
||||
" --files: Print each file that would be searched (but don't search)
|
||||
" --glob: Include or exclues files for searching that match the given glob
|
||||
" (aka ignore .git files)
|
||||
"
|
||||
call denite#custom#var('file/rec', 'command', ['rg', '--files', '--glob', '!.git'])
|
||||
|
||||
" Use ripgrep in place of "grep"
|
||||
call denite#custom#var('grep', 'command', ['rg'])
|
||||
|
||||
" Custom options for ripgrep
|
||||
" --vimgrep: Show results with every match on it's own line
|
||||
" --hidden: Search hidden directories and files
|
||||
" --heading: Show the file name above clusters of matches from each file
|
||||
" --S: Search case insensitively if the pattern is all lowercase
|
||||
call denite#custom#var('grep', 'default_opts', ['--hidden', '--vimgrep', '--heading', '-S'])
|
||||
|
||||
" Recommended defaults for ripgrep via Denite docs
|
||||
call denite#custom#var('grep', 'recursive_opts', [])
|
||||
call denite#custom#var('grep', 'pattern_opt', ['--regexp'])
|
||||
call denite#custom#var('grep', 'separator', ['--'])
|
||||
call denite#custom#var('grep', 'final_opts', [])
|
||||
|
||||
" Remove date from buffer list
|
||||
call denite#custom#var('buffer', 'date_format', '')
|
||||
|
||||
" Custom options for Denite
|
||||
" auto_resize - Auto resize the Denite window height automatically.
|
||||
" prompt - Customize denite prompt
|
||||
" direction - Specify Denite window direction as directly below current pane
|
||||
" winminheight - Specify min height for Denite window
|
||||
" highlight_mode_insert - Specify h1-CursorLine in insert mode
|
||||
" prompt_highlight - Specify color of prompt
|
||||
" highlight_matched_char - Matched characters highlight
|
||||
" highlight_matched_range - matched range highlight
|
||||
let s:denite_options = {'default' : {
|
||||
\ 'split': 'floating',
|
||||
\ 'start_filter': 1,
|
||||
\ 'auto_resize': 1,
|
||||
\ 'source_names': 'short',
|
||||
\ 'prompt': 'λ ',
|
||||
\ 'highlight_matched_char': 'QuickFixLine',
|
||||
\ 'highlight_matched_range': 'Visual',
|
||||
\ 'highlight_window_background': 'Visual',
|
||||
\ 'highlight_filter_background': 'DiffAdd',
|
||||
\ 'winrow': 1,
|
||||
\ 'vertical_preview': 1
|
||||
\ }}
|
||||
|
||||
" Loop through denite options and enable them
|
||||
function! s:profile(opts) abort
|
||||
for l:fname in keys(a:opts)
|
||||
for l:dopt in keys(a:opts[l:fname])
|
||||
call denite#custom#option(l:fname, l:dopt, a:opts[l:fname][l:dopt])
|
||||
endfor
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
call s:profile(s:denite_options)
|
||||
catch
|
||||
echo 'Denite not installed. It should work after running :PlugInstall'
|
||||
endtry
|
||||
|
||||
" === Coc.nvim === "
|
||||
" use <tab> for trigger completion and navigate to next complete item
|
||||
function! s:check_back_space() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~ '\s'
|
||||
endfunction
|
||||
|
||||
inoremap <silent><expr> <TAB>
|
||||
\ pumvisible() ? "\<C-n>" :
|
||||
\ <SID>check_back_space() ? "\<TAB>" :
|
||||
\ coc#refresh()
|
||||
|
||||
"Close preview window when completion is done.
|
||||
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
|
||||
|
||||
" Allow use of :Prettier
|
||||
command! -nargs=0 Prettier :CocCommand prettier.formatFile
|
||||
|
||||
" === NeoSnippet === "
|
||||
" Map <C-k> as shortcut to activate snippet if available
|
||||
imap <C-k> <Plug>(neosnippet_expand_or_jump)
|
||||
smap <C-k> <Plug>(neosnippet_expand_or_jump)
|
||||
xmap <C-k> <Plug>(neosnippet_expand_target)
|
||||
|
||||
" Load custom snippets from snippets folder
|
||||
let g:neosnippet#snippets_directory='~/.config/nvim/snippets'
|
||||
|
||||
" Hide conceal markers
|
||||
let g:neosnippet#enable_conceal_markers = 0
|
||||
|
||||
" === NERDTree === "
|
||||
" Show hidden files/directories
|
||||
let g:NERDTreeShowHidden = 1
|
||||
|
||||
" Remove bookmarks and help text from NERDTree
|
||||
let g:NERDTreeMinimalUI = 1
|
||||
|
||||
" Custom icons for expandable/expanded directories
|
||||
let g:NERDTreeDirArrowExpandable = ''
|
||||
let g:NERDTreeDirArrowCollapsible = ''
|
||||
|
||||
" Hide certain files and directories from NERDTree
|
||||
let g:NERDTreeIgnore = ['^\.DS_Store$', '^tags$', '\.git$[[dir]]', '\.idea$[[dir]]', '\.sass-cache$']
|
||||
|
||||
" Wrap in try/catch to avoid errors on initial install before plugin is available
|
||||
try
|
||||
|
||||
" === Vim airline ==== "
|
||||
" Enable extensions
|
||||
let g:airline_extensions = ['branch', 'hunks', 'coc']
|
||||
|
||||
" Update section z to just have line number
|
||||
let g:airline_section_z = airline#section#create(['linenr'])
|
||||
|
||||
" Do not draw separators for empty sections (only for the active window) >
|
||||
let g:airline_skip_empty_sections = 1
|
||||
|
||||
" Smartly uniquify buffers names with similar filename, suppressing common parts of paths.
|
||||
let g:airline#extensions#tabline#formatter = 'unique_tail'
|
||||
|
||||
" Custom setup that removes filetype/whitespace from default vim airline bar
|
||||
let g:airline#extensions#default#layout = [['a', 'b', 'c'], ['x', 'z', 'warning', 'error']]
|
||||
|
||||
" Customize vim airline per filetype
|
||||
" 'nerdtree' - Hide nerdtree status line
|
||||
" 'list' - Only show file type plus current line number out of total
|
||||
let g:airline_filetype_overrides = {
|
||||
\ 'nerdtree': [ get(g:, 'NERDTreeStatusline', ''), '' ],
|
||||
\ 'list': [ '%y', '%l/%L'],
|
||||
\ }
|
||||
|
||||
" Enable powerline fonts
|
||||
let g:airline_powerline_fonts = 1
|
||||
|
||||
" Enable caching of syntax highlighting groups
|
||||
let g:airline_highlighting_cache = 1
|
||||
|
||||
" Define custom airline symbols
|
||||
if !exists('g:airline_symbols')
|
||||
let g:airline_symbols = {}
|
||||
endif
|
||||
|
||||
" Don't show git changes to current file in airline
|
||||
let g:airline#extensions#hunks#enabled=0
|
||||
|
||||
catch
|
||||
echo 'Airline not installed. It should work after running :PlugInstall'
|
||||
endtry
|
||||
|
||||
" === echodoc === "
|
||||
" Enable echodoc on startup
|
||||
let g:echodoc#enable_at_startup = 1
|
||||
|
||||
" === vim-javascript === "
|
||||
" Enable syntax highlighting for JSDoc
|
||||
let g:javascript_plugin_jsdoc = 1
|
||||
|
||||
" === vim-jsx === "
|
||||
" Highlight jsx syntax even in non .jsx files
|
||||
let g:jsx_ext_required = 0
|
||||
|
||||
" === javascript-libraries-syntax === "
|
||||
let g:used_javascript_libs = 'underscore,requirejs,chai,jquery'
|
||||
|
||||
" === Signify === "
|
||||
let g:signify_sign_delete = '-'
|
||||
|
||||
|
||||
" ============================================================================ "
|
||||
" === UI === "
|
||||
" ============================================================================ "
|
||||
|
||||
" Enable true color support
|
||||
set termguicolors
|
||||
|
||||
" Vim airline theme
|
||||
let g:airline_theme='codedark'
|
||||
|
||||
" Change vertical split character to be a space (essentially hide it)
|
||||
set fillchars+=vert:.
|
||||
|
||||
" Set preview window to appear at bottom
|
||||
set splitbelow
|
||||
|
||||
" Don't dispay mode in command line (airilne already shows it)
|
||||
set noshowmode
|
||||
|
||||
" Set floating window to be slightly transparent
|
||||
set winbl=10
|
||||
|
||||
" ============================================================================ "
|
||||
" === CUSTOM COLORSCHEME CHANGES === "
|
||||
" ============================================================================ "
|
||||
"
|
||||
" Add custom highlights in method that is executed every time a colorscheme is sourced
|
||||
" See https://gist.github.com/romainl/379904f91fa40533175dfaec4c833f2f for details
|
||||
function! TrailingSpaceHighlights() abort
|
||||
" Hightlight trailing whitespace
|
||||
highlight Trail ctermbg=red guibg=red
|
||||
call matchadd('Trail', '\s\+$', 100)
|
||||
endfunction
|
||||
|
||||
function! s:custom_jarvis_colors()
|
||||
" coc.nvim color changes
|
||||
hi link CocErrorSign WarningMsg
|
||||
hi link CocWarningSign Number
|
||||
hi link CocInfoSign Type
|
||||
|
||||
" Make background transparent for many things
|
||||
hi Normal ctermbg=NONE guibg=NONE
|
||||
hi NonText ctermbg=NONE guibg=NONE
|
||||
hi LineNr ctermfg=NONE guibg=NONE
|
||||
hi SignColumn ctermfg=NONE guibg=NONE
|
||||
hi StatusLine guifg=#16252b guibg=#6699CC
|
||||
hi StatusLineNC guifg=#16252b guibg=#16252b
|
||||
|
||||
" Try to hide vertical spit and end of buffer symbol
|
||||
hi VertSplit gui=NONE guifg=#17252c guibg=#17252c
|
||||
hi EndOfBuffer ctermbg=NONE ctermfg=NONE guibg=#17252c guifg=#17252c
|
||||
|
||||
" Customize NERDTree directory
|
||||
hi NERDTreeCWD guifg=#99c794
|
||||
|
||||
" Make background color transparent for git changes
|
||||
hi SignifySignAdd guibg=NONE
|
||||
hi SignifySignDelete guibg=NONE
|
||||
hi SignifySignChange guibg=NONE
|
||||
|
||||
" Highlight git change signs
|
||||
hi SignifySignAdd guifg=#99c794
|
||||
hi SignifySignDelete guifg=#ec5f67
|
||||
hi SignifySignChange guifg=#c594c5
|
||||
endfunction
|
||||
|
||||
autocmd! ColorScheme * call TrailingSpaceHighlights()
|
||||
autocmd! ColorScheme codedark call s:custom_jarvis_colors()
|
||||
|
||||
" Call method on window enter
|
||||
augroup WindowManagement
|
||||
autocmd!
|
||||
autocmd WinEnter * call Handle_Win_Enter()
|
||||
augroup END
|
||||
|
||||
" Change highlight group of preview window when open
|
||||
function! Handle_Win_Enter()
|
||||
if &previewwindow
|
||||
setlocal winhighlight=Normal:MarkdownError
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Editor theme
|
||||
set background=dark
|
||||
try
|
||||
colorscheme codedark
|
||||
catch
|
||||
colorscheme slate
|
||||
endtry
|
||||
|
||||
|
||||
" ============================================================================ "
|
||||
" === KEY MAPPINGS === "
|
||||
" ============================================================================ "
|
||||
|
||||
" === Denite shorcuts === "
|
||||
" ; - Browser currently open buffers
|
||||
" <leader>t - Browse list of files in current directory
|
||||
" <leader>g - Search current directory for occurences of given term and close window if no results
|
||||
" <leader>j - Search current directory for occurences of word under cursor
|
||||
nmap ; :Denite buffer<CR>
|
||||
nmap <leader>t :DeniteProjectDir file/rec<CR>
|
||||
nnoremap <leader>g :<C-u>Denite grep:. -no-empty<CR>
|
||||
nnoremap <leader>j :<C-u>DeniteCursorWord grep:.<CR>
|
||||
|
||||
" Define mappings while in 'filter' mode
|
||||
" <C-o> - Switch to normal mode inside of search results
|
||||
" <Esc> - Exit denite window in any mode
|
||||
" <CR> - Open currently selected file in any mode
|
||||
" <C-t> - Open currently selected file in a new tab
|
||||
" <C-v> - Open currently selected file a vertical split
|
||||
" <C-h> - Open currently selected file in a horizontal split
|
||||
autocmd FileType denite-filter call s:denite_filter_my_settings()
|
||||
function! s:denite_filter_my_settings() abort
|
||||
imap <silent><buffer> <C-o>
|
||||
\ <Plug>(denite_filter_quit)
|
||||
inoremap <silent><buffer><expr> <Esc>
|
||||
\ denite#do_map('quit')
|
||||
nnoremap <silent><buffer><expr> <Esc>
|
||||
\ denite#do_map('quit')
|
||||
inoremap <silent><buffer><expr> <CR>
|
||||
\ denite#do_map('do_action')
|
||||
inoremap <silent><buffer><expr> <C-t>
|
||||
\ denite#do_map('do_action', 'tabopen')
|
||||
inoremap <silent><buffer><expr> <C-v>
|
||||
\ denite#do_map('do_action', 'vsplit')
|
||||
inoremap <silent><buffer><expr> <C-h>
|
||||
\ denite#do_map('do_action', 'split')
|
||||
endfunction
|
||||
|
||||
" Define mappings while in denite window
|
||||
" <CR> - Opens currently selected file
|
||||
" q or <Esc> - Quit Denite window
|
||||
" d - Delete currenly selected file
|
||||
" p - Preview currently selected file
|
||||
" <C-o> or i - Switch to insert mode inside of filter prompt
|
||||
" <C-t> - Open currently selected file in a new tab
|
||||
" <C-v> - Open currently selected file a vertical split
|
||||
" <C-h> - Open currently selected file in a horizontal split
|
||||
autocmd FileType denite call s:denite_my_settings()
|
||||
function! s:denite_my_settings() abort
|
||||
nnoremap <silent><buffer><expr> <CR>
|
||||
\ denite#do_map('do_action')
|
||||
nnoremap <silent><buffer><expr> q
|
||||
\ denite#do_map('quit')
|
||||
nnoremap <silent><buffer><expr> <Esc>
|
||||
\ denite#do_map('quit')
|
||||
nnoremap <silent><buffer><expr> d
|
||||
\ denite#do_map('do_action', 'delete')
|
||||
nnoremap <silent><buffer><expr> p
|
||||
\ denite#do_map('do_action', 'preview')
|
||||
nnoremap <silent><buffer><expr> i
|
||||
\ denite#do_map('open_filter_buffer')
|
||||
nnoremap <silent><buffer><expr> <C-o>
|
||||
\ denite#do_map('open_filter_buffer')
|
||||
nnoremap <silent><buffer><expr> <C-t>
|
||||
\ denite#do_map('do_action', 'tabopen')
|
||||
nnoremap <silent><buffer><expr> <C-v>
|
||||
\ denite#do_map('do_action', 'vsplit')
|
||||
nnoremap <silent><buffer><expr> <C-h>
|
||||
\ denite#do_map('do_action', 'split')
|
||||
endfunction
|
||||
|
||||
" === Nerdtree shorcuts === "
|
||||
" <leader>n - Toggle NERDTree on/off
|
||||
" <leader>f - Opens current file location in NERDTree
|
||||
nmap <leader>n :NERDTreeToggle<CR>
|
||||
nmap <leader>f :NERDTreeFind<CR>
|
||||
|
||||
" <Space> - PageDown
|
||||
" - - PageUp
|
||||
noremap <Space> <PageDown>
|
||||
noremap - <PageUp>
|
||||
|
||||
" Quick window switching
|
||||
nmap <C-h> <C-w>h
|
||||
nmap <C-j> <C-w>j
|
||||
nmap <C-k> <C-w>k
|
||||
nmap <C-l> <C-w>l
|
||||
|
||||
" === coc.nvim === "
|
||||
" <leader>dd - Jump to definition of current symbol
|
||||
" <leader>dr - Jump to references of current symbol
|
||||
" <leader>dj - Jump to implementation of current symbol
|
||||
" <leader>ds - Fuzzy search current project symbols
|
||||
" <leader>p - Run Prettier formatter on file
|
||||
nmap <silent> <leader>dd <Plug>(coc-definition)
|
||||
nmap <silent> <leader>dr <Plug>(coc-references)
|
||||
nmap <silent> <leader>dj <Plug>(coc-implementation)
|
||||
nnoremap <silent> <leader>ds :<C-u>CocList -I -N --top symbols<CR>
|
||||
nmap <silent> <leader>p :Prettier<CR>
|
||||
|
||||
" === vim-better-whitespace === "
|
||||
" <leader>y - Automatically remove trailing whitespace
|
||||
nmap <leader>y :StripWhitespace<CR>
|
||||
|
||||
" === Search shorcuts === "
|
||||
" <leader>h - Find and replace
|
||||
" <leader>/ - Claer highlighted search terms while preserving history
|
||||
map <leader>h :%s///<left><left>
|
||||
nmap <silent> <leader>/ :nohlsearch<CR>
|
||||
|
||||
" === Easy-motion shortcuts ==="
|
||||
" <leader>w - Easy-motion highlights first word letters bi-directionally
|
||||
map <leader>w <Plug>(easymotion-bd-w)
|
||||
|
||||
" Allows you to save files you opened without write permissions via sudo
|
||||
cmap w!! w !sudo tee %
|
||||
|
||||
" === vim-jsdoc shortcuts ==="
|
||||
" Generate jsdoc for function under cursor
|
||||
nmap <leader>z :JsDoc<CR>
|
||||
|
||||
" Delete current visual selection and dump in black hole buffer before pasting
|
||||
" Used when you want to paste over something without it getting copied to
|
||||
" Vim's default buffer
|
||||
vnoremap <leader>p "_dP
|
||||
|
||||
" ============================================================================ "
|
||||
" === MISC. === "
|
||||
" ============================================================================ "
|
||||
|
||||
" Automaticaly close nvim if NERDTree is only thing left open
|
||||
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
|
||||
|
||||
" === Search === "
|
||||
" ignore case when searching
|
||||
set ignorecase
|
||||
|
||||
" if the search string has an upper case letter in it, the search will be case sensitive
|
||||
set smartcase
|
||||
|
||||
" Automatically re-read file if a change was detected outside of vim
|
||||
set autoread
|
||||
|
||||
" Enable line numbers
|
||||
set number
|
||||
|
||||
" Enable spellcheck for markdown files
|
||||
autocmd BufRead,BufNewFile *.md setlocal spell
|
||||
|
||||
" Set backups
|
||||
if has('persistent_undo')
|
||||
set undofile
|
||||
set undolevels=3000
|
||||
set undoreload=10000
|
||||
endif
|
||||
set backupdir=$XDG_DATA_HOME/nvim/backup " Don't put backups in current dir
|
||||
set backup
|
||||
set noswapfile
|
||||
|
||||
" Reload icons after init source
|
||||
if exists('g:loaded_webdevicons')
|
||||
call webdevicons#refresh()
|
||||
endif
|
||||
|
||||
" Disable deprecated python2 provider
|
||||
let g:loaded_python_provider = 0
|
||||
|
||||
90
files/vim/plugins.vim
Normal file
90
files/vim/plugins.vim
Normal file
@@ -0,0 +1,90 @@
|
||||
|
||||
" ============================================================================ "
|
||||
" === PLUGINS === "
|
||||
" ============================================================================ "
|
||||
|
||||
" check whether vim-plug is installed and install it if necessary
|
||||
let plugpath = expand('<sfile>:p:h'). '/autoload/plug.vim'
|
||||
if !filereadable(plugpath)
|
||||
if executable('curl')
|
||||
let plugurl = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||
call system('curl -fLo ' . shellescape(plugpath) . ' --create-dirs ' . plugurl)
|
||||
if v:shell_error
|
||||
echom "Error downloading vim-plug. Please install it manually.\n"
|
||||
exit
|
||||
endif
|
||||
else
|
||||
echom "vim-plug not installed. Please install it manually or install curl.\n"
|
||||
exit
|
||||
endif
|
||||
endif
|
||||
|
||||
call plug#begin('~/.config/nvim/plugged')
|
||||
|
||||
" === Editing Plugins === "
|
||||
" Trailing whitespace highlighting & automatic fixing
|
||||
Plug 'ntpeters/vim-better-whitespace'
|
||||
|
||||
" auto-close plugin
|
||||
Plug 'rstacruz/vim-closer'
|
||||
|
||||
" Improved motion in Vim
|
||||
Plug 'easymotion/vim-easymotion'
|
||||
|
||||
" Intellisense Engine
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||
|
||||
" Denite - Fuzzy finding, buffer management
|
||||
Plug 'Shougo/denite.nvim'
|
||||
|
||||
" Snippet support
|
||||
Plug 'Shougo/neosnippet'
|
||||
Plug 'Shougo/neosnippet-snippets'
|
||||
|
||||
" Print function signatures in echo area
|
||||
Plug 'Shougo/echodoc.vim'
|
||||
|
||||
" === Git Plugins === "
|
||||
" Enable git changes to be shown in sign column
|
||||
Plug 'mhinz/vim-signify'
|
||||
Plug 'tpope/vim-fugitive'
|
||||
|
||||
" === Javascript Plugins === "
|
||||
" Typescript syntax highlighting
|
||||
Plug 'HerringtonDarkholme/yats.vim'
|
||||
|
||||
" ReactJS JSX syntax highlighting
|
||||
Plug 'mxw/vim-jsx'
|
||||
|
||||
" Generate JSDoc commands based on function signature
|
||||
Plug 'heavenshell/vim-jsdoc'
|
||||
|
||||
" === Syntax Highlighting === "
|
||||
|
||||
" Syntax highlighting for nginx
|
||||
Plug 'chr4/nginx.vim'
|
||||
|
||||
" Syntax highlighting for javascript libraries
|
||||
Plug 'othree/javascript-libraries-syntax.vim'
|
||||
|
||||
" Improved syntax highlighting and indentation
|
||||
Plug 'othree/yajs.vim'
|
||||
|
||||
" === UI === "
|
||||
" File explorer
|
||||
Plug 'scrooloose/nerdtree'
|
||||
|
||||
" Colorscheme
|
||||
Plug 'tomasiser/vim-code-dark'
|
||||
|
||||
" Customized vim status line
|
||||
Plug 'vim-airline/vim-airline'
|
||||
Plug 'vim-airline/vim-airline-themes'
|
||||
|
||||
" Icons
|
||||
Plug 'ryanoasis/vim-devicons'
|
||||
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
|
||||
|
||||
" Initialize plugin system
|
||||
call plug#end()
|
||||
|
||||
Reference in New Issue
Block a user