diff options
Diffstat (limited to 'nvim')
-rw-r--r-- | nvim/colors/hybrid.vim.bkup | 455 | ||||
-rw-r--r-- | nvim/init.vim | 443 |
2 files changed, 371 insertions, 527 deletions
diff --git a/nvim/colors/hybrid.vim.bkup b/nvim/colors/hybrid.vim.bkup deleted file mode 100644 index a255e77..0000000 --- a/nvim/colors/hybrid.vim.bkup +++ /dev/null @@ -1,455 +0,0 @@ -" File: hybrid.vim -" Maintainer: Andrew Wong (w0ng) -" URL: https://github.com/w0ng/vim-hybrid -" Modified: 27 Jan 2013 07:33 AM AEST -" License: MIT - -" Description:"{{{ -" ---------------------------------------------------------------------------- -" The default RGB colour palette is taken from Tomorrow-Night.vim: -" https://github.com/chriskempson/vim-tomorrow-theme -" -" The reduced RGB colour palette is taken from Codecademy's online editor: -" https://www.codecademy.com/learn -" -" The syntax highlighting scheme is taken from jellybeans.vim: -" https://github.com/nanotech/jellybeans.vim -" -" The is code taken from solarized.vim: -" https://github.com/altercation/vim-colors-solarized - -"}}} -" Requirements And Recommendations:"{{{ -" ---------------------------------------------------------------------------- -" Requirements -" - gVim 7.3+ on Linux, Mac and Windows. -" - Vim 7.3+ on Linux and Mac, using a terminal that supports 256 colours. -" -" Due to the limited 256 palette, colours in Vim and gVim will still be slightly -" different. -" -" In order to have Vim use the same colours as gVim (the way this colour scheme -" is intended), it is recommended that you define the basic 16 colours in your -" terminal. -" -" For Linux users (rxvt-unicode, xterm): -" -" 1. Add the default palette to ~/.Xresources: -" -" https://gist.github.com/3278077 -" -" or alternatively, add the reduced contrast palette to ~/.Xresources: -" -" https://gist.github.com/w0ng/16e33902508b4a0350ae -" -" 2. Add to ~/.vimrc: -" -" let g:hybrid_custom_term_colors = 1 -" let g:hybrid_reduced_contrast = 1 " Remove this line if using the default palette. -" colorscheme hybrid -" -" For OSX users (iTerm): -" -" 1. Import the default colour preset into iTerm: -" -" https://raw.githubusercontent.com/w0ng/dotfiles/master/iterm2/hybrid.itermcolors -" -" or alternatively, import the reduced contrast color preset into iTerm: -" -" https://raw.githubusercontent.com/w0ng/dotfiles/master/iterm2/hybrid-reduced-contrast.itermcolors -" -" 2. Add to ~/.vimrc: -" -" let g:hybrid_custom_term_colors = 1 -" let g:hybrid_reduced_contrast = 1 " Remove this line if using the default palette. -" colorscheme hybrid - -"}}} -" Initialisation:"{{{ -" ---------------------------------------------------------------------------- - -hi clear - -if exists("syntax_on") - syntax reset -endif - -let s:style = &background - -let g:colors_name = "hybrid" - -"}}} -" GUI And Cterm Palettes:"{{{ -" ---------------------------------------------------------------------------- - -let s:palette = {'gui' : {} , 'cterm' : {}} - -if exists("g:hybrid_reduced_contrast") && g:hybrid_reduced_contrast == 1 - let s:gui_background = "#232c31" - let s:gui_selection = "#425059" - let s:gui_line = "#2d3c46" - let s:gui_comment = "#6c7a80" -else - let s:gui_background = "#1d1f21" - let s:gui_selection = "#373b41" - let s:gui_line = "#282a2e" - let s:gui_comment = "#707880" -endif - -let s:palette.gui.background = { 'dark' : s:gui_background , 'light' : "#e4e4e4" } -let s:palette.gui.foreground = { 'dark' : "#c5c8c6" , 'light' : "#000000" } -let s:palette.gui.selection = { 'dark' : s:gui_selection , 'light' : "#bcbcbc" } -let s:palette.gui.line = { 'dark' : s:gui_line , 'light' : "#d0d0d0" } -let s:palette.gui.comment = { 'dark' : s:gui_comment , 'light' : "#5f5f5f" } -let s:palette.gui.red = { 'dark' : "#cc6666" , 'light' : "#5f0000" } -let s:palette.gui.orange = { 'dark' : "#de935f" , 'light' : "#875f00" } -let s:palette.gui.yellow = { 'dark' : "#f0c674" , 'light' : "#5f5f00" } -let s:palette.gui.green = { 'dark' : "#b5bd68" , 'light' : "#005f00" } -let s:palette.gui.aqua = { 'dark' : "#8abeb7" , 'light' : "#005f5f" } -let s:palette.gui.blue = { 'dark' : "#81a2be" , 'light' : "#00005f" } -let s:palette.gui.purple = { 'dark' : "#b294bb" , 'light' : "#5f005f" } -let s:palette.gui.window = { 'dark' : "#303030" , 'light' : "#9e9e9e" } -let s:palette.gui.darkcolumn = { 'dark' : "#1c1c1c" , 'light' : "#808080" } -let s:palette.gui.addbg = { 'dark' : "#5F875F" , 'light' : "#d7ffd7" } -let s:palette.gui.addfg = { 'dark' : "#d7ffaf" , 'light' : "#005f00" } -let s:palette.gui.changebg = { 'dark' : "#5F5F87" , 'light' : "#d7d7ff" } -let s:palette.gui.changefg = { 'dark' : "#d7d7ff" , 'light' : "#5f005f" } -let s:palette.gui.delbg = { 'dark' : "#cc6666" , 'light' : "#ffd7d7" } -let s:palette.gui.darkblue = { 'dark' : "#00005f" , 'light' : "#d7ffd7" } -let s:palette.gui.darkcyan = { 'dark' : "#005f5f" , 'light' : "#005f00" } -let s:palette.gui.darkred = { 'dark' : "#5f0000" , 'light' : "#d7d7ff" } -let s:palette.gui.darkpurple = { 'dark' : "#5f005f" , 'light' : "#5f005f" } - -if exists("g:hybrid_custom_term_colors") && g:hybrid_custom_term_colors == 1 - " light dark - let s:cterm_foreground = "15" " attrib - cyan - let s:cterm_selection = "9" " selecton - purp - let s:cterm_line = "10" " nr color - blue - let s:cterm_comment = "7" " comments - orange - let s:cterm_red = "4" " integer - 4 12 light/dim red - let s:cterm_orange = "3" " static const - dark purp - let s:cterm_yellow = "11" " function - 11 3 light/dark purp - let s:cterm_green = "10" " strings - 10 11 blue/purp - let s:cterm_aqua = "11" " define - light purp - let s:cterm_blue = "4" " let for - red - let s:cterm_purple = "13" " variable - cyan - let s:cterm_delbg = "9" " dunno - dark purp -else - let s:cterm_foreground = "250" - let s:cterm_selection = "237" - let s:cterm_line = "235" - let s:cterm_comment = "243" - let s:cterm_red = "167" - let s:cterm_orange = "173" - let s:cterm_yellow = "221" - let s:cterm_green = "143" - let s:cterm_aqua = "109" - let s:cterm_blue = "110" - let s:cterm_purple = "139" - let s:cterm_delbg = "167" -endif - -let s:palette.cterm.background = { 'dark' : "234" , 'light' : "254" } -let s:palette.cterm.foreground = { 'dark' : s:cterm_foreground , 'light' : "16" } -let s:palette.cterm.window = { 'dark' : "236" , 'light' : "247" } -let s:palette.cterm.selection = { 'dark' : s:cterm_selection , 'light' : "250" } -let s:palette.cterm.line = { 'dark' : s:cterm_line , 'light' : "252" } -let s:palette.cterm.comment = { 'dark' : s:cterm_comment , 'light' : "59" } -let s:palette.cterm.red = { 'dark' : s:cterm_red , 'light' : "52" } -let s:palette.cterm.orange = { 'dark' : s:cterm_orange , 'light' : "94" } -let s:palette.cterm.yellow = { 'dark' : s:cterm_yellow , 'light' : "58" } -let s:palette.cterm.green = { 'dark' : s:cterm_green , 'light' : "22" } -let s:palette.cterm.aqua = { 'dark' : s:cterm_aqua , 'light' : "23" } -let s:palette.cterm.blue = { 'dark' : s:cterm_blue , 'light' : "17" } -let s:palette.cterm.purple = { 'dark' : s:cterm_purple , 'light' : "53" } -let s:palette.cterm.darkcolumn = { 'dark' : "234" , 'light' : "244" } -let s:palette.cterm.addbg = { 'dark' : "65" , 'light' : "194" } -let s:palette.cterm.addfg = { 'dark' : "193" , 'light' : "22" } -let s:palette.cterm.changebg = { 'dark' : "60" , 'light' : "189" } -let s:palette.cterm.changefg = { 'dark' : "189" , 'light' : "53" } -let s:palette.cterm.delbg = { 'dark' : s:cterm_delbg , 'light' : "224" } -let s:palette.cterm.darkblue = { 'dark' : "17" , 'light' : "194" } -let s:palette.cterm.darkcyan = { 'dark' : "24" , 'light' : "22" } -let s:palette.cterm.darkred = { 'dark' : "52" , 'light' : "189" } -let s:palette.cterm.darkpurple = { 'dark' : "53" , 'light' : "53" } - -"}}} -" Formatting Options:"{{{ -" ---------------------------------------------------------------------------- -let s:none = "NONE" -let s:t_none = "NONE" -let s:n = "NONE" -let s:c = ",undercurl" -let s:r = ",reverse" -let s:s = ",standout" -let s:b = ",bold" -let s:u = ",underline" -let s:i = ",italic" - -"}}} -" Highlighting Primitives:"{{{ -" ---------------------------------------------------------------------------- -function! s:build_prim(hi_elem, field) - " Given a:hi_elem = bg, a:field = comment - let l:vname = "s:" . a:hi_elem . "_" . a:field " s:bg_comment - let l:gui_assign = "gui".a:hi_elem."=".s:palette.gui[a:field][s:style] " guibg=... - let l:cterm_assign = "cterm".a:hi_elem."=".s:palette.cterm[a:field][s:style] " ctermbg=... - exe "let " . l:vname . " = ' " . l:gui_assign . " " . l:cterm_assign . "'" -endfunction - -let s:bg_none = ' guibg=NONE ctermbg=NONE' -call s:build_prim('bg', 'foreground') -call s:build_prim('bg', 'background') -call s:build_prim('bg', 'selection') -call s:build_prim('bg', 'line') -call s:build_prim('bg', 'comment') -call s:build_prim('bg', 'red') -call s:build_prim('bg', 'orange') -call s:build_prim('bg', 'yellow') -call s:build_prim('bg', 'green') -call s:build_prim('bg', 'aqua') -call s:build_prim('bg', 'blue') -call s:build_prim('bg', 'purple') -call s:build_prim('bg', 'window') -call s:build_prim('bg', 'darkcolumn') -call s:build_prim('bg', 'addbg') -call s:build_prim('bg', 'addfg') -call s:build_prim('bg', 'changebg') -call s:build_prim('bg', 'changefg') -call s:build_prim('bg', 'delbg') -call s:build_prim('bg', 'darkblue') -call s:build_prim('bg', 'darkcyan') -call s:build_prim('bg', 'darkred') -call s:build_prim('bg', 'darkpurple') - -let s:fg_none = ' guifg=NONE ctermfg=NONE' -call s:build_prim('fg', 'foreground') -call s:build_prim('fg', 'background') -call s:build_prim('fg', 'selection') -call s:build_prim('fg', 'line') -call s:build_prim('fg', 'comment') -call s:build_prim('fg', 'red') -call s:build_prim('fg', 'orange') -call s:build_prim('fg', 'yellow') -call s:build_prim('fg', 'green') -call s:build_prim('fg', 'aqua') -call s:build_prim('fg', 'blue') -call s:build_prim('fg', 'purple') -call s:build_prim('fg', 'window') -call s:build_prim('fg', 'darkcolumn') -call s:build_prim('fg', 'addbg') -call s:build_prim('fg', 'addfg') -call s:build_prim('fg', 'changebg') -call s:build_prim('fg', 'changefg') -call s:build_prim('fg', 'darkblue') -call s:build_prim('fg', 'darkcyan') -call s:build_prim('fg', 'darkred') -call s:build_prim('fg', 'darkpurple') - -exe "let s:fmt_none = ' gui=NONE". " cterm=NONE". " term=NONE" ."'" -exe "let s:fmt_bold = ' gui=NONE".s:b. " cterm=NONE".s:b. " term=NONE".s:b ."'" -exe "let s:fmt_bldi = ' gui=NONE".s:b. " cterm=NONE".s:b. " term=NONE".s:b ."'" -exe "let s:fmt_undr = ' gui=NONE".s:u. " cterm=NONE".s:u. " term=NONE".s:u ."'" -exe "let s:fmt_undb = ' gui=NONE".s:u.s:b. " cterm=NONE".s:u.s:b. " term=NONE".s:u.s:b."'" -exe "let s:fmt_undi = ' gui=NONE".s:u. " cterm=NONE".s:u. " term=NONE".s:u ."'" -exe "let s:fmt_curl = ' gui=NONE".s:c. " cterm=NONE".s:c. " term=NONE".s:c ."'" -exe "let s:fmt_ital = ' gui=NONE".s:i. " cterm=NONE".s:i. " term=NONE".s:i ."'" -exe "let s:fmt_stnd = ' gui=NONE".s:s. " cterm=NONE".s:s. " term=NONE".s:s ."'" -exe "let s:fmt_revr = ' gui=NONE".s:r. " cterm=NONE".s:r. " term=NONE".s:r ."'" -exe "let s:fmt_revb = ' gui=NONE".s:r.s:b. " cterm=NONE".s:r.s:b. " term=NONE".s:r.s:b."'" - -exe "let s:sp_none = ' guisp=". s:none ."'" -exe "let s:sp_foreground = ' guisp=". s:palette.gui.foreground[s:style] ."'" -exe "let s:sp_background = ' guisp=". s:palette.gui.background[s:style] ."'" -exe "let s:sp_selection = ' guisp=". s:palette.gui.selection[s:style] ."'" -exe "let s:sp_line = ' guisp=". s:palette.gui.line[s:style] ."'" -exe "let s:sp_comment = ' guisp=". s:palette.gui.comment[s:style] ."'" -exe "let s:sp_red = ' guisp=". s:palette.gui.red[s:style] ."'" -exe "let s:sp_orange = ' guisp=". s:palette.gui.orange[s:style] ."'" -exe "let s:sp_yellow = ' guisp=". s:palette.gui.yellow[s:style] ."'" -exe "let s:sp_green = ' guisp=". s:palette.gui.green[s:style] ."'" -exe "let s:sp_aqua = ' guisp=". s:palette.gui.aqua[s:style] ."'" -exe "let s:sp_blue = ' guisp=". s:palette.gui.blue[s:style] ."'" -exe "let s:sp_purple = ' guisp=". s:palette.gui.purple[s:style] ."'" -exe "let s:sp_window = ' guisp=". s:palette.gui.window[s:style] ."'" -exe "let s:sp_addbg = ' guisp=". s:palette.gui.addbg[s:style] ."'" -exe "let s:sp_addfg = ' guisp=". s:palette.gui.addfg[s:style] ."'" -exe "let s:sp_changebg = ' guisp=". s:palette.gui.changebg[s:style] ."'" -exe "let s:sp_changefg = ' guisp=". s:palette.gui.changefg[s:style] ."'" -exe "let s:sp_darkblue = ' guisp=". s:palette.gui.darkblue[s:style] ."'" -exe "let s:sp_darkcyan = ' guisp=". s:palette.gui.darkcyan[s:style] ."'" -exe "let s:sp_darkred = ' guisp=". s:palette.gui.darkred[s:style] ."'" -exe "let s:sp_darkpurple = ' guisp=". s:palette.gui.darkpurple[s:style] ."'" - -"}}} -" Vim Highlighting: (see :help highlight-groups)"{{{ -" ---------------------------------------------------------------------------- -exe "hi! ColorColumn" .s:fg_none .s:bg_line .s:fmt_none -" Conceal" -" Cursor" -" CursorIM" -exe "hi! CursorColumn" .s:fg_none .s:bg_line .s:fmt_none -exe "hi! CursorLine" .s:fg_none .s:bg_line .s:fmt_none -exe "hi! Directory" .s:fg_blue .s:bg_none .s:fmt_none -exe "hi! DiffAdd" .s:fg_addfg .s:bg_addbg .s:fmt_none -exe "hi! DiffChange" .s:fg_changefg .s:bg_changebg .s:fmt_none -exe "hi! DiffDelete" .s:fg_background .s:bg_delbg .s:fmt_none -exe "hi! DiffText" .s:fg_background .s:bg_blue .s:fmt_none -exe "hi! ErrorMsg" .s:fg_background .s:bg_red .s:fmt_stnd -exe "hi! VertSplit" .s:fg_window .s:bg_none .s:fmt_none -exe "hi! Folded" .s:fg_comment .s:bg_darkcolumn .s:fmt_none -exe "hi! FoldColumn" .s:fg_none .s:bg_darkcolumn .s:fmt_none -exe "hi! SignColumn" .s:fg_none .s:bg_darkcolumn .s:fmt_none -" Incsearch" -exe "hi! LineNr" .s:fg_line .s:bg_none .s:fmt_none -" fg_selection on first column -exe "hi! CursorLineNr" .s:fg_yellow .s:bg_none .s:fmt_none -exe "hi! MatchParen" .s:fg_background .s:bg_changebg .s:fmt_none -exe "hi! ModeMsg" .s:fg_green .s:bg_none .s:fmt_none -exe "hi! MoreMsg" .s:fg_green .s:bg_none .s:fmt_none -exe "hi! NonText" .s:fg_selection .s:bg_none .s:fmt_none -exe "hi! Pmenu" .s:fg_foreground .s:bg_selection .s:fmt_none -exe "hi! PmenuSel" .s:fg_foreground .s:bg_selection .s:fmt_revr -" PmenuSbar" -" PmenuThumb" -exe "hi! Question" .s:fg_green .s:bg_none .s:fmt_none -exe "hi! Search" .s:fg_background .s:bg_yellow .s:fmt_none -exe "hi! SpecialKey" .s:fg_selection .s:bg_none .s:fmt_none -exe "hi! SpellCap" .s:fg_blue .s:bg_darkblue .s:fmt_undr -exe "hi! SpellLocal" .s:fg_aqua .s:bg_darkcyan .s:fmt_undr -exe "hi! SpellBad" .s:fg_red .s:bg_darkred .s:fmt_undr -exe "hi! SpellRare" .s:fg_purple .s:bg_darkpurple .s:fmt_undr -exe "hi! StatusLine" .s:fg_comment .s:bg_background .s:fmt_revr -exe "hi! StatusLineNC" .s:fg_window .s:bg_comment .s:fmt_revr -exe "hi! TabLine" .s:fg_foreground .s:bg_darkcolumn .s:fmt_revr -" TabLineFill" -" TabLineSel" -exe "hi! Title" .s:fg_yellow .s:bg_none .s:fmt_none -exe "hi! Visual" .s:fg_none .s:bg_selection .s:fmt_none -" VisualNos" -exe "hi! WarningMsg" .s:fg_red .s:bg_none .s:fmt_none -" FIXME LongLineWarning to use variables instead of hardcoding -hi LongLineWarning guifg=NONE guibg=#371F1C gui=underline ctermfg=NONE ctermbg=NONE cterm=underline -" WildMenu" - -" Use defined custom background colour for terminal Vim. -if !has('gui_running') && exists("g:hybrid_custom_term_colors") && g:hybrid_custom_term_colors == 1 - let s:bg_normal = s:bg_none -else - let s:bg_normal = s:bg_background -endif -exe "hi! Normal" .s:fg_foreground .s:bg_normal .s:fmt_none - -"}}} -" Generic Syntax Highlighting: (see :help group-name)"{{{ -" ---------------------------------------------------------------------------- -exe "hi! Comment" .s:fg_comment .s:bg_none .s:fmt_none - -exe "hi! Constant" .s:fg_red .s:bg_none .s:fmt_none -exe "hi! String" .s:fg_green .s:bg_none .s:fmt_none -" Character" -" Number" -" Boolean" -" Float" - -exe "hi! Identifier" .s:fg_purple .s:bg_none .s:fmt_none -exe "hi! Function" .s:fg_yellow .s:bg_none .s:fmt_none - -exe "hi! Statement" .s:fg_blue .s:bg_none .s:fmt_none -" Conditional" -" Repeat" -" Label" -exe "hi! Operator" .s:fg_aqua .s:bg_none .s:fmt_none -" Keyword" -" Exception" - -exe "hi! PreProc" .s:fg_aqua .s:bg_none .s:fmt_none -" Include" -" Define" -" Macro" -" PreCondit" - -exe "hi! Type" .s:fg_orange .s:bg_none .s:fmt_none -" StorageClass" -exe "hi! Structure" .s:fg_aqua .s:bg_none .s:fmt_none -" Typedef" - -exe "hi! Special" .s:fg_green .s:bg_none .s:fmt_none -" SpecialChar" -" Tag" -" Delimiter" -" SpecialComment" -" Debug" -" -exe "hi! Underlined" .s:fg_blue .s:bg_none .s:fmt_none - -exe "hi! Ignore" .s:fg_none .s:bg_none .s:fmt_none - -exe "hi! Error" .s:fg_red .s:bg_darkred .s:fmt_undr - -exe "hi! Todo" .s:fg_addfg .s:bg_none .s:fmt_none - -" Quickfix window highlighting -exe "hi! qfLineNr" .s:fg_yellow .s:bg_none .s:fmt_none -" qfFileName" -" qfLineNr" -" qfError" - -"}}} -" Diff Syntax Highlighting:"{{{ -" ---------------------------------------------------------------------------- -" Diff -" diffOldFile -" diffNewFile -" diffFile -" diffOnly -" diffIdentical -" diffDiffer -" diffBDiffer -" diffIsA -" diffNoEOL -" diffCommon -hi! link diffRemoved Constant -" diffChanged -hi! link diffAdded Special -" diffLine -" diffSubname -" diffComment - -"}}} -" -" This is needed for some reason: {{{ - -let &background = s:style - -" }}} -" Legal:"{{{ -" ---------------------------------------------------------------------------- -" Copyright (c) 2011 Ethan Schoonover -" Copyright (c) 2009-2012 NanoTech -" Copyright (c) 2012 w0ng -" -" Permission is hereby granted, free of charge, to any per‐ -" son obtaining a copy of this software and associated doc‐ -" umentation files (the “Software”), to deal in the Soft‐ -" ware without restriction, including without limitation -" the rights to use, copy, modify, merge, publish, distrib‐ -" ute, sublicense, and/or sell copies of the Software, and -" to permit persons to whom the Software is furnished to do -" so, subject to the following conditions: -" -" The above copyright notice and this permission notice -" shall be included in all copies or substantial portions -" of the Software. -" -" THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY -" KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO -" THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICU‐ -" LAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CON‐ -" TRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON‐ -" NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -" THE SOFTWARE. - -" }}} diff --git a/nvim/init.vim b/nvim/init.vim index 13944c6..eb1144a 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,162 +1,461 @@ +" ============================================================================= +" General Settings +" ============================================================================= + +" Enable syntax highlighting syntax enable +" Use hybrid colorscheme let g:hybrid_custom_term_colors = 1 set background=dark - colorscheme hybrid +" Set file encoding set encoding=utf-8 + +" Disable swap files for performance and simplicity set noswapfile -" CLIPBOARD +" Clipboard sharing set clipboard+=unnamedplus -" indentation and looks +" Enable relative numbers +set number + +" Indentation and basic text manipulation +set smartindent " Smart indentation +set smartcase " Case-insensitive search unless uppercase is used +set incsearch " Show search matches as you type - " set relativenumber - set number - set smartindent - set smartcase - set incsearch +" Split window behavior +set splitbelow splitright -" vertical and horizontal splits - set splitbelow splitright - set wildmode=longest +" Wildcard completion behavior +set wildmode=longest:full,full -" tabs and stuff - set tabstop=4 softtabstop=4 - set shiftwidth=4 - set expandtab +" Tab behavior +set tabstop=4 softtabstop=4 +set shiftwidth=4 +set expandtab -" removing white spaces - autocmd BufWritePre * %s/\s\+$//e +" Remove trailing whitespace on save +autocmd BufWritePre * %s/\s\+$//e -" disable auto commenting - autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o +" Disable automatic commenting for easier commenting with plugins +autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o -" plugins - call plug#begin('~/.vim/plugged') +" ============================================================================= +" Plugin Management (vim-plug) +" ============================================================================= +call plug#begin('~/.vim/plugged') + + " Appearance and UI Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' Plug 'ryanoasis/vim-devicons' + " Text manipulation Plug 'tpope/vim-surround' Plug 'jiangmiao/auto-pairs' Plug 'norcalli/nvim-colorizer.lua' Plug 'preservim/nerdcommenter' + + " Language support Plug 'sheerun/vim-polyglot' + + " File explorer Plug 'preservim/nerdtree' + " Git integration Plug 'airblade/vim-gitgutter' Plug 'tpope/vim-fugitive' + " Discord presence Plug 'andweeb/presence.nvim' + " Telescope for fuzzy finding Plug 'nvim-lua/plenary.nvim' Plug 'nvim-telescope/telescope.nvim' - Plug 'ctrlpvim/ctrlp.vim' + " Code completion and AI Plug 'github/copilot.vim' - Plug 'neoclide/coc.nvim', {'branch': 'release'} - Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " AST - Plug 'neovim/nvim-lspconfig' " LSP + " Mason (LSP, DAP, linter, formatter manager) + Plug 'williamboman/mason.nvim' + Plug 'williamboman/mason-lspconfig.nvim' + + " Language server protocol (LSP) + Plug 'neovim/nvim-lspconfig' + " Autocompletion LSP Plug 'hrsh7th/nvim-cmp' Plug 'hrsh7th/cmp-nvim-lsp' Plug 'hrsh7th/cmp-buffer' Plug 'hrsh7th/cmp-path' Plug 'hrsh7th/cmp-cmdline' + Plug 'L3MON4D3/LuaSnip' - Plug 'ThePrimeagen/vim-be-good' + " null-ls (for linters and formatters) + Plug 'jose-elias-alvarez/null-ls.nvim' + " Diagnostics UI (optional UI for LSP diagnostics) + Plug 'j-hui/fidget.nvim' + + " Rust language tools Plug 'rust-lang/rust.vim' + + " Go language tools Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } - call plug#end() + " Latex tools + Plug 'lervag/vimtex' -" [Tabnine] Autocompletion -set rtp+=~/.vim/plugged/tabnine-vim +call plug#end() + +" ============================================================================= +" Language Specific Configurations +" ============================================================================= " [Rust.vim] Syntax checker provider let g:syntastic_rust_checkers = ['cargo'] -" LSP -lua require'lspconfig'.gopls.setup{} -lua require'lspconfig'.pyright.setup{} -lua require'lspconfig'.rust_analyzer.setup{} -lua require'lspconfig'.bashls.setup{} -lua require'lspconfig'.dartls.setup{} -lua require'lspconfig'.svelte.setup{} +" ZIG Formatter autosave - disable +let g:zig_fmt_autosave = 0 + +" ============================================================================= +" Telescope Configurations +" ============================================================================= + +" Find files +nnoremap <leader>f <cmd>Telescope find_files<cr> +" Live grep +nnoremap <leader>fg <cmd>Telescope live_grep<cr> +" Find open buffers +nnoremap <leader>fb <cmd>Telescope buffers<cr> +" Find help tags +nnoremap <leader>fh <cmd>Telescope help_tags<cr> + +" ============================================================================= +" Vimtex Configurations +" ============================================================================= + +let g:vimtex_view_method = 'zathura' +let g:vimtex_compiler_method = 'latexmk' +let g:vimtex_view_general_viewer = 'okular' +let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex' +let maplocalleader = "," + +" ============================================================================= +" Discord Presence +" ============================================================================= let g:presence_neovim_image_text="The One True Text Editor" let g:presence_main_image="file" -" air-line +" ============================================================================= +" Airline Configurations +" ============================================================================= + let g:airline_powerline_fonts = 1 +let g:airline#extensions#tabline#enabled = 1 let g:airline_theme='deus' -"let g:airline#extensions#tabline#enabled = 1 -filetype plugin on +" for vimtex +let g:airline#extensions#vimtex#enabled = 1 + +" Enable filetype plugins and indentation filetype plugin indent on -" Disable --INSERT-- (etc.) because it is already shown in the statusline +" ============================================================================= +" UI Settings +" ============================================================================= + +" Disable --INSERT-- mode display set noshowmode -"nvim-colorizer settings +" Enable true color support for nvim-colorizer set termguicolors -lua require'colorizer'.setup() - -""" CtrlP -let g:ctrlp_working_path_mode = 'ra' -set wildignore+=*/tmp/*,*.so,*.swp,*.zip -inoremap <silent><expr> <TAB> coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<TAB>" +" Setup nvim-colorizer +lua require'colorizer'.setup() +" ============================================================================= " Cursor highlight line +" ============================================================================= + hi CursorLine cterm=NONE ctermbg=256 hi CursorColumn cterm=NONE ctermbg=257 nnoremap <Leader>b :set cursorline! <CR> -"(Disable/enable) Local cursor line at startup -"augroup CursorLine - "au! - "au VimEnter,WinEnter,BufWinEnter * setlocal cursorline - "au WinLeave * setlocal nocursorline -"augroup END +" ============================================================================= +" Fidget Configuration +" ============================================================================= + +highlight FidgetTask guibg=NONE ctermbg=NONE -" remaps +" ============================================================================= +" Remaps +" ============================================================================= - " replace all - nnoremap <C-r> :%s//g<Left><Left> +nnoremap <C-r> :%s//g<Left><Left> - " vim tree - nnoremap <leader>\ :NERDTreeToggle<CR> +" Toggle NerdTree +nnoremap <leader>\ :NERDTreeToggle<CR> +nnoremap <C-e> :NERDTreeFocus<CR> - " Start NERDTree. If a file is specified, move the cursor to its window. - "autocmd StdinReadPre * let s:std_in=1 - "autocmd VimEnter * NERDTree | if argc() > 0 || exists("s:std_in") | wincmd p | endif +" NERDTree setup +let NERDTreeShowHidden=1 +let NERDTreeIgnore=['\.pyc$', '\~$', '\.swp$'] - " Exit Vim if NERDTree is the only window left. - autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif +" Exit Vim if NERDTree is the only window left. +autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif - " spell check - map S :setlocal spell! spelllang=en_us<CR> +" Spell check toggle +map S :setlocal spell! spelllang=en_us<CR> -" movement - map J k - map K j +" Movement +map J k +map K j " Quick save and exit - map zz :wq<CR> - map zx :q!<CR> - map zs :w<CR> +map zz :wq<CR> +map zx :q!<CR> +map zs :w<CR> + +" Ergonomic save and exit +map <leader>w :wq<CR> +map <leader>q :q!<CR> +map <leader>s :w<CR> + +" ============================================================================= +" Copilot Setup +" ============================================================================= + +" Disable copilot for text and markdown files +autocmd FileType text let g:copilot_enabled = 0 +autocmd FileType markdown let g:copilot_enabled = 0 + +" ============================================================================= +" NeoVide Setup +" ============================================================================= -"""NeoVide if exists("g:neovide") set guifont="Inconsolata" let g:neovide_transparency = 0.75 let g:airline_powerline_fonts = 0 let g:neovide_cursor_vfx_mode = "pixiedust" endif + +" ============================================================================= +" LSP Setup +" ============================================================================= + +lua << EOF +-- Keymap utility functions +local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(0, ...) end + +-- Global settings for LSP client. +vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { + border = "rounded", +}) + +-- Keymap settings (defined in the on_attach function) +local lsp_keymaps = function(bufnr) + buf_set_keymap("n", "gd", "<cmd>lua vim.lsp.buf.definition()<cr>", { desc = "Go to definition" }) + buf_set_keymap("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<cr>", { desc = "Go to declaration" }) + buf_set_keymap("n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", { desc = "Hover information" }) + buf_set_keymap("n", "<leader>lr", "<cmd>lua vim.lsp.buf.rename()<cr>", { desc = "Rename symbol" }) + buf_set_keymap("n", "<leader>lf", "<cmd>lua vim.lsp.buf.format()<cr>", { desc = "Format document" }) + buf_set_keymap("n", "<leader>la", "<cmd>lua vim.lsp.buf.code_action()<cr>", { desc = "Code action" }) + buf_set_keymap("n", "<leader>l ", "<cmd>lua vim.diagnostic.open_float()<cr>", { desc = "Diagnostics" }) + buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<cr>", { desc = "Show references" }) + buf_set_keymap("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<cr>", { desc = "Previous diagnostic" }) + buf_set_keymap("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<cr>", { desc = "Next diagnostic" }) +end + +-- On attach callback to apply keymaps and custom settings +local on_attach = function(client, bufnr) + -- Add LSP keymaps. + lsp_keymaps(bufnr) +end + +-- Mason configurations +require("mason").setup {} + +require("mason-lspconfig").setup { + -- List of servers to automatically install if they're not already installed + ensure_installed = { + "pyright", + "gopls", + "rust_analyzer", + "clangd", + "zls", + "jdtls", + "texlab", + "rnix", + + "bashls", + "jsonls", + "cssls", + "svelte", + "asm_lsp", + "csharp_ls", + "neocmake", + "ast_grep", + "dockerls", + "glslls", + "graphql", + "html", + "htmx", + "denols", + "harper_ls", + "glsl_analyzer", + "opencl_ls", + "prismals", + "sqlls", + "tinymist", + "vimls", + "vuels", + }, + -- Whether servers that are set up (via lspconfig) should be automatically installed + automatic_installation = true, +} + +-- LSP server configurations +local servers = { + pyright = { + settings = { + python = { + analysis = { + autoSearchPaths = true, + diagnosticMode = "openFilesOnly", + typeCheckingMode = "basic", + useLibraryCodeForTypes = true, + }, + }, + }, + }, + gopls = { + settings = { + gopls = { + gofumpt = true, + }, + }, + }, + rust_analyzer = { + settings = { + ["rust-analyzer"] = { + checkOnSave = { + command = "clippy", + }, + cargo = { + allFeatures = true, + } + }, + }, + }, + clangd = { + on_attach = function(client, bufnr) + lsp_keymaps(bufnr) + client.server_capabilities.semanticTokensProvider = nil + end + }, + zls = { + on_attach = function(client, bufnr) + lsp_keymaps(bufnr) + client.server_capabilities.semanticTokensProvider = nil + end + }, + dartls = { + on_attach = function(client, bufnr) + lsp_keymaps(bufnr) + client.server_capabilities.semanticTokensProvider = nil + end + }, + jdtls = { + on_attach = function(client, bufnr) + lsp_keymaps(bufnr) + client.server_capabilities.semanticTokensProvider = nil + end + }, + texlab = { + on_attach = function(client, bufnr) + lsp_keymaps(bufnr) + client.server_capabilities.semanticTokensProvider = nil + end + }, + rnix = { + on_attach = function(client, bufnr) + lsp_keymaps(bufnr) + client.server_capabilities.semanticTokensProvider = nil + end + }, +} + +local capabilities = require('cmp_nvim_lsp').default_capabilities() + +for server, config in pairs(servers) do + config = vim.tbl_deep_extend("force", { + on_attach = on_attach, + capabilities = capabilities, + }, config or {}) + + require("lspconfig")[server].setup(config) +end + +-- null-ls (for formatters/linters not provided by LSP) +local null_ls = require("null-ls") + +null_ls.setup({ + -- on_attach = on_attach, -- Remove on_attach from here + sources = { + -- Get formatters and linters from Mason + null_ls.builtins.formatting.stylua, + null_ls.builtins.formatting.black.with({ + extra_args = { "--fast" }, + -- Only use black if a .git or pyproject.toml is present + condition = function(utils) + return utils.root_has_file({".git", "pyproject.toml"}) + end, + }), + null_ls.builtins.formatting.isort, + null_ls.builtins.diagnostics.flake8, + null_ls.builtins.formatting.gofmt, + null_ls.builtins.formatting.goimports, + null_ls.builtins.formatting.rustfmt, + }, +}) + +-- cmp setup +local cmp = require 'cmp' +cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + ['<C-d>'] = cmp.mapping.scroll_docs(-4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<C-Space>'] = cmp.mapping.complete(), + ['<C-e>'] = cmp.mapping.abort(), + ['<CR>'] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'buffer' }, + { name = 'path' }, + }), +}) + +-- Diagnostics UI (fidget.nvim) +require("fidget").setup({ + notification = { + window = { + winblend = 0, + } + } +}) +EOF |