diff --git a/.vim/config.vim b/.vim/config.vim index cd8128f2..af879f55 100644 --- a/.vim/config.vim +++ b/.vim/config.vim @@ -19,7 +19,8 @@ set hidden " Switch between buffers without saving them set incsearch " Automatically move to text as you search for it set wildmenu " Show a menu of the different options when you tab in command mode set display+=lastline " Show as much of a long line as possible -set laststatus=0 " Disable the status line (removes filename and increases working space) +set laststatus=2 " Enable the status line (set to 0 to remove) +set noshowmode " Disable the --MODE-- text (enable if not using the status line) set history=100 " Only keep the last 100 commands set tabpagemax=50 " Set the maximum number of tabs to be opened in any window to 50 diff --git a/.vim/keybindings.vim b/.vim/keybindings.vim index 8f8cd4b8..f1f479ac 100644 --- a/.vim/keybindings.vim +++ b/.vim/keybindings.vim @@ -6,46 +6,22 @@ let mapleader = ' ' " ================== Top row nnoremap e :set nu! -nnoremap r :call matchadd('OverLength', '\%101v', 100) nnoremap t :OverCommandLine%s/ -nnoremap y :bn -nnoremap u w -nnoremap i -nnoremap o -nnoremap p " ================== Middle row -"nnoremap a :NERDTreeToggle -nnoremap a :Files -"nnoremap d :TagbarToggle nnoremap f :Files nnoremap g :set hlsearch! -" Easily jump between lines in all open files nnoremap j :Buffers -nnoremap k :Lines -" This is the same as f, but I haven't figured out which -" letter I like using better yet -nnoremap l :Files -" Easily open new files in horizontal and vertical splits -nnoremap ; :split w :Files -nnoremap ' :vsplit w :Files +nnoremap l :Rg " ================== Bottom row -nnoremap v :Ack! "\b\b" -nnoremap n o -nnoremap m O - -" Bind the right beautify function based on what file is open autocmd FileType javascript nnoremap b :call JsBeautify() autocmd FileType json nnoremap b :call JsonBeautify() autocmd FileType jsx nnoremap b :call JsxBeautify() autocmd FileType html nnoremap b :call HtmlBeautify() autocmd FileType css nnoremap b :call CSSBeautify() -" Easily enter 'zen mode' with Goyo and Pencil -" We have to explicitly set vertsplit again since Goyo resets it for some reason -nnoremap 2 :PencilSoft:Goyo:hi vertsplit ctermfg=8 ctermbg=none +" Easily enter 'zen mode' with Goyo and Pencil (Note: Goyo resets the color scheme) +nnoremap 2 :PencilSoft:Goyo:hi vertsplit ctermfg=0 ctermbg=none + +" Save and load vim sessions nnoremap 3 :mksession! ~/.vim_session nnoremap 4 :source ~/.vim_session - -" Close the current buffer without closing the window -" Useful for when you want to close a buffer with VimFiler open -nnoremap 5 :bpspbnbd diff --git a/.vim/plugins.vim b/.vim/plugins.vim index 550c065e..35ce5dd5 100644 --- a/.vim/plugins.vim +++ b/.vim/plugins.vim @@ -1,54 +1,37 @@ " New Start: A modern Arch workflow built with an emphasis on functionality. " Copyright (C) 2017-2018 Donovan Glover -call plug#begin('~/.vim/plugged') " Use vim-plug as our package manager of choice - Plug 'airblade/vim-gitgutter' " Add git diff support - Plug 'dylanaraps/wal.vim' " Add wal support - Plug 'osyo-manga/vim-over' " Automatically highlight find and replace - Plug 'jiangmiao/auto-pairs' " Close brackets and other pairs automatically - Plug 'w0rp/ale' " Automatically check language syntax for errors - Plug 'maksimr/vim-jsbeautify' " Make it easier to work with foreign code - Plug 'lervag/vimtex' " Make editing LaTeX a breeze - Plug 'dbeniamine/todo.txt-vim' " Easily manage any part of your todo.txt - Plug 'elixir-editors/vim-elixir' " Add syntax highlighting and autoindent for Elixir - - Plug 'tpope/vim-fugitive' " Add fugitive.vim, enabling us to use git in vim - Plug 'junegunn/fzf' " Add fuzzy finding to easily move between files - Plug 'junegunn/fzf.vim' " Add the vim functionality of fuzzy finding - - Plug 'rhysd/vim-crystal' " Add support for the crystal language - Plug 'scrooloose/nerdtree' " Add a file browser to vim - - Plug 'rust-lang/rust.vim' " Add rust support to vim - - Plug 'jamessan/vim-gnupg' " Easily use GPG encryption inside of vim - Plug 'reedes/vim-pencil' " Use vim as a tool for writing - Plug 'mileszs/ack.vim' " Testing ack.vim with ag - Plug 'tpope/vim-endwise' " Automatically add end +call plug#begin('~/.vim/plugged') + Plug 'dylanaraps/wal.vim' " Color scheme + Plug 'airblade/vim-gitgutter' " Git diff + Plug 'itchyny/lightline.vim' " Status line + Plug 'w0rp/ale' " Syntax checker + Plug 'sgur/vim-editorconfig' " EditorConfig + Plug 'tpope/vim-fugitive' " Git wrapper + Plug 'junegunn/fzf.vim' " fzf wrapper + Plug 'jiangmiao/auto-pairs' " {Pair} completion + Plug 'tpope/vim-endwise' " 'End' completion + Plug 'reedes/vim-pencil' " Word wrap Plug 'junegunn/goyo.vim' " Distraction-free writing - Plug 'Yggdroot/indentLine' " Show indentation levels - Plug 'Shougo/unite.vim' " Required by vimfiler - Plug 'Shougo/vimfiler.vim' " Yet another file explorer + Plug 'osyo-manga/vim-over', {'on': 'OverCommandLine'} + Plug 'maksimr/vim-jsbeautify', {'on': ['JsBeautify', 'JsonBeautify', + \ 'JsxBeautify', 'HtmlBeautify', 'CSSBeautify']} - Plug 'mattn/emmet-vim' " Add emmet support - Plug 'sgur/vim-editorconfig' " Add editorconfig support - Plug 'baskerville/vim-sxhkdrc' " Add sxhkdrc support - Plug 'cespare/vim-toml' " Add toml support - Plug 'dag/vim-fish' " Add fish support - Plug 'slim-template/vim-slim' " Add slim support - Plug 'pangloss/vim-javascript' " Improve JavaScript support - Plug 'othree/html5.vim' " Improve HTML support - Plug 'alvan/vim-closetag' " Automatically close tags when writing HTML - Plug 'tpope/vim-surround' " Easily add or remove surrounding characters - Plug 'chrisbra/csv.vim' " Add CSV support - Plug 'Glench/Vim-Jinja2-Syntax' " Add Jinja2 support - Plug 'mustache/vim-mustache-handlebars' " Add mustache and handlebars support - Plug 'plasticboy/vim-markdown' " Add more markdown support (LaTeX, frontmatter, etc.) - Plug 'quabug/vim-gdscript' " Add Godot support - Plug 'posva/vim-vue' " Add Vue support - Plug 'mxw/vim-jsx' " Add React support - Plug 'digitaltoad/vim-pug' " Add Pug support - Plug 'kchmck/vim-coffee-script' " Add CoffeeScript support - Plug 'leafgarland/typescript-vim' " Add TypeScript support -call plug#end() " Start the plugins + Plug 'pangloss/vim-javascript', {'for': 'javascript'} + Plug 'alvan/vim-closetag', {'for': 'html'} + Plug 'rhysd/vim-crystal', {'for': 'crystal'} + Plug 'rust-lang/rust.vim', {'for': 'rust'} + Plug 'baskerville/vim-sxhkdrc', {'for': 'sxhkdrc'} + Plug 'cespare/vim-toml', {'for': 'toml'} + Plug 'dag/vim-fish', {'for': 'fish'} + Plug 'slim-template/vim-slim', {'for': 'slim'} + Plug 'Glench/Vim-Jinja2-Syntax', {'for': 'jinja2'} + Plug 'plasticboy/vim-markdown', {'for': 'markdown'} + Plug 'posva/vim-vue', {'for': 'vue'} + Plug 'mxw/vim-jsx', {'for': 'javascript'} + Plug 'digitaltoad/vim-pug', {'for': 'pug'} + Plug 'leafgarland/typescript-vim', {'for': 'typescript'} + Plug 'dbeniamine/todo.txt-vim', {'for': 'todo'} + Plug 'lervag/vimtex', {'for': 'tex'} +call plug#end() diff --git a/.vimrc b/.vimrc index ca149d2d..6b8b79cb 100644 --- a/.vimrc +++ b/.vimrc @@ -11,145 +11,70 @@ source ~/.vim/keybindings.vim colorscheme wal +" Wal Themes: Tomorrow, Tomorrow_Night, one, materia, material, nord +" Other Themes: wombat, solarized, powerline, jellybeans, Tomorrow_Night_Blue, +" Tomorrow_Night_Eighties, PaperColor, seoul256, landscape, +" darcula, molokai, OldHope, deus +let g:lightline = { +\ 'colorscheme': 'Tomorrow_Night', +\ 'active': { +\ 'left': [ +\ [ 'mode', 'paste' ], [ 'gitbranch' ], +\ ['readonly', 'filename', 'modified'] +\ ] +\ }, +\ 'component_function': { +\ 'gitbranch': 'fugitive#head' +\ }, +\ } + " =================================== Plugin-Specific =================================== let g:ale_lint_on_text_changed = 'never' " Do not lint while typing let g:ale_lint_on_insert_leave = 1 " Only lint after leaving insert mode -let g:ackprg = 'rg --vimgrep' " Use rg instead of ag / ack / grep -let g:plug_window = 'rightbelow topleft new' " Show vim-plug above instead of to the left -let g:vimfiler_as_default_explorer = 1 " Replace netrw with vimfiler as the default FileEx -let g:indentLine_enabled = 0 " Disable indent lines by default -let g:indentLine_color_term = 8 " Set the color for the indent line -"let g:vimfiler_no_default_key_mappings = 1 +let g:ale_linters = {'javascript': ['standard']} -" Note that indent lines breaks with pencil mode, although you really -" shouldn't be using both at the same time anyway. +" Don't show the separator for vertical splits +hi vertsplit ctermfg=0 ctermbg=none -" NOTE: To view all the items you can change the color of, use: -" :so $VIMRUNTIME/syntax/hitest.vim - -" Set the color for the vertical split line (6 is as good as 8 here) -hi vertsplit ctermfg=8 ctermbg=none -" Remove the background color from the status line -hi StatusLine ctermbg=none -hi StatusLineNC ctermbg=none -" Remove the background color from tabs -hi TabLine ctermbg=none -hi TabLineFill ctermbg=none -hi TabLineSel ctermbg=none " Finally, an easier way to read search results hi Search ctermbg=240 ctermfg=255 -" We have to set the color for while we search as well -" To keep things simple, we'll just invert the colors here -" As an added bonus, this looks rather nice as well hi IncSearch ctermbg=255 ctermfg=240 " Disable all vimtex keybindings so we can define our own let g:vimtex_mappings_enabled = 0 let g:vimtex_imaps_enabled = 0 let g:vimtex_view_method = 'zathura' -let g:vimtex_index_show_help = 0 -let g:vimtex_index_split_width = 50 -let g:vimtex_index_split_pos = 'vert rightbelow' let g:vimtex_compiler_latexmk = {'build_dir': '.tex'} -map a (vimtex-toc-toggle) -map f (vimtex-view) -map g (vimtex-compile) -map c (vimtex-errors) -map w :VimtexCountWords - -" Delete the surrounding environment -map d (vimtex-env-delete) -map c (vimtex-env-change) - -" Toggle stars -nnoremap s (vimtex-env-toggle-star) -nnoremap e (vimtex-cmd-toggle-star) - +nnoremap f (vimtex-view) +nnoremap g (vimtex-compile) +nnoremap d (vimtex-env-delete) +nnoremap c (vimtex-env-change) inoremap ]] (vimtex-delim-close) -" Use incsearch and tab / shift+tab to go through the results -cno getcmdtype() =~ '[?/]' ? '' : feedkeys('', 'int')[1] -cno getcmdtype() =~ '[?/]' ? '' : feedkeys('', 'int')[1] - -" Easily repeat a command on multiple lines through visual mode -vnoremap . :normal . - " Easily show lines that go past the character count -highlight OverLength ctermbg=red ctermfg=white guibg=#592929 +highlight OverLength ctermbg=240 ctermfg=230 +call matchadd('OverLength', '\%80v') -" Automatically close the file viewer when it's the only thing left -autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif - -" Use w!! to force write a file as sudo -" cmap w!! w !sudo tee > /dev/null % - -" Make the tabline not have an X in it -function MyTabLine() - let s = '' - for i in range(tabpagenr('$')) - " select the highlighting - if i + 1 == tabpagenr() - let s .= '%#TabLineSel#' - else - let s .= '%#TabLine#' - endif - - " set the tab page number (for mouse clicks) - let s .= '%' . (i + 1) . 'T' - - " the label is made by MyTabLabel() - let s .= ' %{MyTabLabel(' . (i + 1) . ')} ' - endfor - - " after the last tab fill with TabLineFill and reset tab page nr - let s .= '%#TabLineFill#%T' - - return s -endfunction - -function MyTabLabel(n) - let buflist = tabpagebuflist(a:n) - let winnr = tabpagewinnr(a:n) - return bufname(buflist[winnr - 1]) -endfunction - -set tabline=%!MyTabLine() - -" Custom highlighting -" Highlight key words that we like to use -match Function /@requires/ - -" Use syntax highlighting for .ecr files -autocmd BufNewFile,BufRead *.ecr set syntax=html - -" Use syntax highlighting for .slang files -autocmd BufNewFile,BufRead *.slim setlocal filetype=slim -autocmd BufNewFile,BufRead *.slang setlocal filetype=slim -" autocmd BufReadPost *.slang set syntax=slim - -" Use htmldjango for html files -" autocmd BufNewFile,BufRead *.html setlocal filetype=htmldjango -" autocmd BufNewFile,BufRead *.html setlocal filetype=html -autocmd BufNewFile,BufRead *.html setlocal filetype=jinja +autocmd BufNewFile,BufRead *.ecr setlocal syntax=html +autocmd BufNewFile,BufRead *.slang setlocal filetype=slim " Disable vim-markdown folding let g:vim_markdown_folding_disabled = 1 -let g:vim_markdown_math = 1 -let g:vim_markdown_frontmatter = 1 +let g:vim_markdown_math = 1 +let g:vim_markdown_frontmatter = 1 autocmd BufNewFile,BufRead *.md set conceallevel=2 -" au BufNewFile,BufRead,BufWrite *.md syntax match Comment /\%^---\_.\{-}---$/ " Change cursor back to blink after exiting neovim au VimLeave * set guicursor=a:block-blinkon1 -" Only hide the dots we don't need -let g:vimfiler_ignore_pattern = ['^\.git$', '^\.shards$', '^\.sass-cache$'] - -" Only use standard for JavaScript -let g:ale_linters = {'javascript': ['standard']} - " Ignore syntax concealing for markdown files let g:vim_markdown_conceal = 0 let g:tex_conceal = "" let g:vim_markdown_math = 1 + +" Hide the status line showing "fzf" when using fzf.vim +" NOTE: You must add "showmode" if your setup depends on it +autocmd! FileType fzf +autocmd FileType fzf set laststatus=0 noshowmode noruler + \| autocmd BufLeave set laststatus=2 ruler