Created
April 18, 2020 10:40
-
-
Save RowanFeely/a01eb3f0507a3ed5172a54656f29cea6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ██ | |
" ░░ | |
" ███████ ██ ██████████████ | |
" ░░██░░░█░██ ░█░█░░██░░██░░██ | |
" ░██ ░█░░██ ░██░██░██ ░██ ░██ | |
" ░██ ░██░░████ ░██░██ ░██ ░██ | |
" ███ ░██ ░░██ ░█████ ░██ ░██ | |
" ░░░ ░░ ░░ ░░░░░ ░░ ░░ | |
" ▓▓▓▓▓▓▓▓▓▓ | |
" ░▓ author ▓ ROGUE(X3)<rowanfeely.github.io> | |
" ░▓ code ▓ https://github.com/RowanFeely/dotfiles | |
" ░▓ ▓ http://rowanfeely.github.io | |
" ░▓▓▓▓▓▓▓▓▓▓ | |
" ░░░░░░░░░░ | |
set encoding=utf-8 | |
" set t_Co=256color | |
source ~/.config/nvim/plugins.vim | |
set mouse=a | |
" ============================================================================ " | |
" === EDITING OPTIONS === " | |
" ============================================================================ " | |
" let base16colorspace=256 " Access colors present in 256 colorspace | |
set shortmess+=I | |
" Remap leader key to , | |
let g:mapleader=',' | |
set nowrap | |
" no folding | |
set nofoldenable | |
set foldlevel=99 | |
set foldminlines=99 | |
set foldlevelstart=99 | |
"+--- Search ---+ | |
set ignorecase | |
set smartcase | |
set hlsearch | |
set incsearch | |
" Disable line numbers | |
set nonumber | |
" Don't show last command | |
set noshowcmd | |
" Yank and paste with the system clipboard | |
set clipboard=unnamed | |
" Hides buffers instead of closing them | |
set hidden | |
" Set files as hidden from directories | |
set wildignore+=*/.git/*,*/.hg/*,*/.svn/* | |
" === TAB/Space settings === " | |
" Insert spaces when TAB is pressed. | |
set expandtab | |
" Change number of spaces that a <Tab> counts for during editing ops | |
set softtabstop=2 | |
" Indentation amount for < and > commands. | |
set shiftwidth=2 | |
" Automatically wrap left and right. | |
" " This allows to move the cursor to the previous/next line after reaching | |
" first/last character in the line using the arrow keys in normal-, insert- | |
" (<,>) and visual mode ([,]) or the h and l keys. | |
set wrap | |
set whichwrap+=<,>,h,l,[,] | |
" wrap lines that do not fit in window | |
" doesnt modify file only visual | |
set linebreak | |
" Not sure what this does exactly lol | |
set guicursor=a:ver25-Cursor/lCursor | |
" Don't highlight current cursor line | |
set cursorline | |
" Disable line/column number in status line | |
" Shows up in preview window when airline is disabled if not | |
set noruler | |
" Only one line for command line | |
set cmdheight=1 | |
" === Completion Settings === " | |
" Don't give completion messages like 'match 1 of 2' | |
" or 'The only match' | |
set shortmess+=c | |
" ============================================================================ " | |
" === 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': 'λ ', | |
\ 'statusline': 0, | |
\ 'highlight_matched_char': 'QuickFixLine', | |
\ 'highlight_matched_range': 'Visual', | |
\ 'highlight_window_background': 'Visual', | |
\ '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 | |
" === 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 | |
" Open NERDtree on right hand side | |
let g:NERDTreeWinPos = "right" | |
" 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 | |
" ==== Limelight for Vim ==== | |
" Color name (:help cterm-colors) or ANSI code | |
let g:limelight_conceal_ctermfg = '8' | |
let g:limelight_conceal_ctermfg = 240 | |
" Color name (:help gui-colors) or RGB color | |
let g:limelight_conceal_guifg = 'LightGray' | |
let g:limelight_conceal_guifg = '#3b4253' | |
" Default: 0.5 | |
let g:limelight_default_coefficient = 0.25 | |
" Number of preceding/following paragraphs to include (default: 0) | |
let g:limelight_paragraph_span = 4 | |
" Beginning/end of paragraph | |
" When there's no empty line between the paragraphs | |
" and each paragraph starts with indentation | |
let g:limelight_bop = '^\s' | |
let g:limelight_eop = '\ze\n^\s' | |
" Highlighting priority (default: 10) | |
" Set it to -1 not to overrule hlsearch | |
let g:limelight_priority = -1 | |
" Goyo vim integration | |
autocmd! User GoyoEnter Limelight | |
autocmd! User GoyoLeave Limelight! | |
"==== 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']] | |
let airline#extensions#coc#stl_format_err = '%E{[%e(#%fe)]}' | |
let airline#extensions#coc#stl_format_warn = '%W{[%w(#%fw)]}' | |
" Configure error/warning section to use coc.nvim | |
let g:airline_section_error = '%{airline#util#wrap(airline#extensions#coc#get_error(),0)}' | |
let g:airline_section_warning = '%{airline#util#wrap(airline#extensions#coc#get_warning(),0)}' | |
" Hide the Nerdtree status line to avoid clutter | |
let g:NERDTreeStatusline = '' | |
" Disable vim-airline in preview mode | |
let g:airline_exclude_preview = 1 | |
" 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 | |
syntax enable | |
set synmaxcol=512 | |
filetype plugin on | |
" Editor theme | |
colorscheme sourcerer | |
" Enable nord theme with italics | |
"let g:nord_italic = 1 | |
"let g:nord_italic_comments = 1 | |
"let g:nord_underline = 1 | |
"let g:nord_cursor_line_number_background = 0 | |
"let g:nord_uniform_status_lines = 1 | |
"let g:NVIM_TUI_ENABLE_TRUE_COLOR=1 | |
" Vim airline theme | |
"let g:airline_theme='nord' | |
" Add custom highlights in method that is executed every time a colorscheme is sourced | |
" See https://gist.github.com/romainl/379904f91fa40533175dfaec4c833f2f for details | |
" function! MyHighlights() abort | |
" Hightlight trailing whitespace | |
" highlight Trail guibg=#bf616a | |
" call matchadd('Trail', '\s\+$', 100) | |
"endfunction | |
"augroup MyColors | |
" autocmd! | |
" autocmd ColorScheme * call MyHighlights() | |
"augroup END | |
" 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=3 | |
" 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=#2E3440 guibg=#3B4253 | |
hi! StatusLineNC guifg=#2E3440 guibg=#2E3440 | |
" Try to hide vertical spit and end of buffer symbol | |
hi! VertSplit gui=NONE guifg=#2E3440 guibg=#2E3440 | |
hi! EndOfBuffer ctermbg=NONE ctermfg=NONE guibg=#2E3440 guifg=#2E3440 | |
" Customize NERDTree directory | |
hi! NERDTreeCWD guifg=#A3BE8C | |
" 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=#A3BE8C | |
hi! SignifySignDelete guifg=#BF616A | |
hi! SignifySignChange guifg=#B48EAD | |
" Call method on window enter | |
augroup WindowManagement | |
autocmd! | |
autocmd WinEnter * call Handle_Win_Enter() | |
augroup END | |
let g:gruvbox_termcolors=16 | |
" Change highlight group of preview window when open | |
function! Handle_Win_Enter() | |
if &previewwindow | |
setlocal winhighlight=Normal:MarkdownError | |
endif | |
endfunction | |
" ============================================================================ " | |
" === KEY MAPPINGS === " | |
" ============================================================================ " | |
"map CTRL-M to MRU | |
nmap <C-m> :MRU<CR> | |
" === 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 === " | |
nmap <silent> <leader>dd <Plug>(coc-definition) | |
nmap <silent> <leader>dr <Plug>(coc-references) | |
nmap <silent> <leader>dj <Plug>(coc-implementation) | |
" === 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 | |
" ============================================================================ " | |
" === STARTIFY === " | |
" ============================================================================ " | |
function! s:center(lines) abort | |
let longest_line = max(map(copy(a:lines), 'strwidth(v:val)')) | |
let centered_lines = map(copy(a:lines), | |
\ 'repeat(" ", (&columns / 2) - (longest_line / 2)) . v:val') | |
return centered_lines | |
endfunction | |
let s:header= [ | |
\"", | |
\"", | |
\" ;::::;", | |
\" ;::::; :;", | |
\" ;:::::' :;", | |
\" ;:::::; ;.", | |
\" ,:::::' 0xR0 ; OOO\ ", | |
\" ::::::; ; OOOOO\ ", | |
\" ;:::::; ; OOOOOOOO", | |
\" ,;::::::; ;' / OOOOOOO", | |
\" ;:::::::::`. ,,,;. / / DOOOOOO", | |
\" .';:::::::::::::::::;, / / DOOOO", | |
\" , ::::::;::::::;;;;::::;, / / DOOO", | |
\" ;`::::::`'::::::;;;::::: ,#/ / DOOO", | |
\" :`:::::::`;::::::;;::: ;::# / DOOO", | |
\" ::`:::::::`;:::::::: ;::::# / DOO", | |
\" :`:::::::`;:::::: ;::::::#/ DOO", | |
\" :::`:::::::`;; ;:::::::::## OO", | |
\" ::::`:::::::`;::::::::;:::# OO", | |
\" :::::`::::::::::::;'`:;::# O", | |
\" :::::`::::::::;' / / `:#", | |
\" ::::::`:::::;' / / `#", | |
\" ___________________________________", | |
\" author{ROGUEX3/rowanfeely.github.io}", | |
\" code{github.com/RowanFeely/dotfiles}", | |
\"", | |
\"" | |
\] | |
let g:startify_change_to_dir = 1 | |
let g:startify_custom_header = s:center(s:header) | |
" Optionally create and use footer | |
"let s:header= [] | |
"let g:startify_custom_footer = s:center(s:footer) | |
" ============================================================================ " | |
" === 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 | |
" Set backups | |
if has('persistent_undo') | |
set undofile | |
set undolevels=3000 | |
set undoreload=10000 | |
endif | |
set backupdir=~/.local/share/nvim/backup " Don't put backups in current dir | |
set backup | |
set noswapfile | |
"================================================================ | |
" taskwarrior " | |
"===============================================================" | |
" default task report type | |
let g:task_report_name = 'next' | |
" custom reports have to be listed explicitly to make them available | |
let g:task_report_command = [] | |
" whether the field under the cursor is highlighted | |
let g:task_highlight_field = 1 | |
" can not make change to task data when set to 1 | |
let g:task_readonly = 0 | |
" vim built-in term for task undo in gvim | |
let g:task_gui_term = 1 | |
" allows user to override task configurations. Seperated by space. Defaults to '' | |
let g:task_rc_override = 'rc.defaultwidth=999' | |
" default fields to ask when adding a new task | |
let g:task_default_prompt = ['due', 'description'] | |
" whether the info window is splited vertically | |
let g:task_info_vsplit = 0 | |
" info window size | |
let g:task_info_size = 15 | |
" info window position | |
let g:task_info_position = 'belowright' | |
" directory to store log files defaults to taskwarrior data.location | |
let g:task_log_directory = '~/.task' | |
" max number of historical entries | |
let g:task_log_max = '20' | |
" forward arrow shown on statusline | |
let g:task_left_arrow = ' <<' | |
" backward arrow ... | |
let g:task_left_arrow = '>> ' | |
" Reload icons after init source | |
if exists('g:loaded_webdevicons') | |
call webdevicons#refresh() | |
endif | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment