diff options
author | Vikas Kushwaha <dev@vikas.rocks> | 2025-05-21 14:30:00 +0530 |
---|---|---|
committer | Vikas Kushwaha <dev@vikas.rocks> | 2025-05-21 14:30:00 +0530 |
commit | 0d397e4d3d204a1e016c0863815f0b5dc516c46b (patch) | |
tree | 5e5db5a8b53555783ca3b5679bc21876e9de0b6c | |
parent | e55ad8ca4f99fa024106d5695a55f9ac132d7b68 (diff) |
added some new scripts and cleaned up nvim directory
43 files changed, 372 insertions, 2092 deletions
diff --git a/.config/Thunar/accels.scm b/.config/Thunar/accels.scm index b140458..520380d 100644 --- a/.config/Thunar/accels.scm +++ b/.config/Thunar/accels.scm @@ -1,4 +1,4 @@ -; Thunar GtkAccelMap rc-file -*- scheme -*- +; thunar GtkAccelMap rc-file -*- scheme -*- ; this file is an automated accelerator map dump ; ; (gtk_accel_path "<Actions>/ThunarStandardView/sort-by-type" "") diff --git a/.config/X11/xprofile b/.config/X11/xprofile index 46c2b18..240aa8d 100644 --- a/.config/X11/xprofile +++ b/.config/X11/xprofile @@ -6,7 +6,7 @@ xrdb "${XDG_CONFIG_HOME:-$HOME/.config}/X11/Xresources" & xrdbpid=$! numlockx on & logdir="${XDG_STATE_HOME:-$HOME/.local/state}/startup" -autostart="copyq dunst pipewire syncthing remapd gammastep setdp prime-offload" +autostart="copyq dunst pipewire syncthing remapd gammastep setdp prime-offload mailsyncd" mkdir -pv "$logdir" for program in $autostart; do diff --git a/.config/nvim/autoload/airline/themes/onedark.vim b/.config/nvim/autoload/airline/themes/onedark.vim deleted file mode 100644 index 65181dd..0000000 --- a/.config/nvim/autoload/airline/themes/onedark.vim +++ /dev/null @@ -1,130 +0,0 @@ -" [onedark.vim](https://github.com/joshdick/onedark.vim/) - -" This is a [vim-airline](https://github.com/vim-airline/vim-airline) theme for use with -" the [onedark.vim](https://github.com/joshdick/onedark.vim) colorscheme. - -" It is based on vim-airline's ["tomorrow" theme](https://github.com/vim-airline/vim-airline-themes/blob/master/autoload/airline/themes/tomorrow.vim). -function! airline#themes#onedark#refresh() - let s:colors = onedark#GetColors() - - if get(g:, 'onedark_termcolors', 256) == 16 - let s:term_red = s:colors.red.cterm16 - let s:term_green = s:colors.green.cterm16 - let s:term_yellow = s:colors.yellow.cterm16 - let s:term_blue = s:colors.blue.cterm16 - let s:term_purple = s:colors.purple.cterm16 - let s:term_white = s:colors.white.cterm16 - let s:term_cursor_grey = s:colors.cursor_grey.cterm16 - let s:term_visual_grey = s:colors.visual_grey.cterm16 - else - let s:term_red = s:colors.red.cterm - let s:term_green = s:colors.green.cterm - let s:term_yellow = s:colors.yellow.cterm - let s:term_blue = s:colors.blue.cterm - let s:term_purple = s:colors.purple.cterm - let s:term_white = s:colors.white.cterm - let s:term_cursor_grey = s:colors.cursor_grey.cterm - let s:term_visual_grey = s:colors.visual_grey.cterm - endif - - let g:airline#themes#onedark#palette = {} - - let g:airline#themes#onedark#palette.accents = { - \ 'red': [ s:colors.red.gui, '', s:term_red, 0 ] - \ } - - let s:N1 = [ s:colors.cursor_grey.gui, s:colors.green.gui, s:term_cursor_grey, s:term_green ] - let s:N2 = [ s:colors.white.gui, s:colors.visual_grey.gui, s:term_white, s:term_visual_grey ] - let s:N3 = [ s:colors.green.gui, s:colors.cursor_grey.gui, s:term_green, s:term_cursor_grey ] - let g:airline#themes#onedark#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3) - - let group = airline#themes#get_highlight('vimCommand') - let g:airline#themes#onedark#palette.normal_modified = { - \ 'airline_c': [ group[0], '', group[2], '', '' ] - \ } - - let s:I1 = [ s:colors.cursor_grey.gui, s:colors.blue.gui, s:term_cursor_grey, s:term_blue ] - let s:I2 = s:N2 - let s:I3 = [ s:colors.blue.gui, s:colors.cursor_grey.gui, s:term_blue, '' ] - let g:airline#themes#onedark#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3) - let g:airline#themes#onedark#palette.insert_modified = g:airline#themes#onedark#palette.normal_modified - - let s:R1 = [ s:colors.cursor_grey.gui, s:colors.red.gui, s:term_cursor_grey, s:term_red ] - let s:R2 = s:N2 - let s:R3 = [ s:colors.red.gui, s:colors.cursor_grey.gui, s:term_red, '' ] - let g:airline#themes#onedark#palette.replace = airline#themes#generate_color_map(s:R1, s:R2, s:R3) - let g:airline#themes#onedark#palette.replace_modified = g:airline#themes#onedark#palette.normal_modified - - let s:V1 = [ s:colors.cursor_grey.gui, s:colors.purple.gui, s:term_cursor_grey, s:term_purple ] - let s:V2 = s:N2 - let s:V3 = [ s:colors.purple.gui, s:colors.cursor_grey.gui, s:term_purple, '' ] - let g:airline#themes#onedark#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3) - let g:airline#themes#onedark#palette.visual_modified = g:airline#themes#onedark#palette.normal_modified - - let s:IA1 = [ s:colors.cursor_grey.gui, s:colors.white.gui, s:term_cursor_grey, s:term_white ] - let s:IA2 = [ s:colors.white.gui, s:colors.visual_grey.gui, s:term_white, s:term_visual_grey ] - let s:IA3 = s:N2 - let g:airline#themes#onedark#palette.inactive = airline#themes#generate_color_map(s:IA1, s:IA2, s:IA3) - let g:airline#themes#onedark#palette.inactive_modified = { - \ 'airline_c': [ group[0], '', group[2], '', '' ] - \ } - - " Warning/Error styling code from vim-airline's ["base16" theme](https://github.com/vim-airline/vim-airline-themes/blob/master/autoload/airline/themes/base16.vim) - - " Warnings - let s:WI = [ s:colors.cursor_grey.gui, s:colors.yellow.gui, s:term_cursor_grey, s:term_yellow ] - let g:airline#themes#onedark#palette.normal.airline_warning = [ - \ s:WI[0], s:WI[1], s:WI[2], s:WI[3] - \ ] - - let g:airline#themes#onedark#palette.normal_modified.airline_warning = - \ g:airline#themes#onedark#palette.normal.airline_warning - - let g:airline#themes#onedark#palette.insert.airline_warning = - \ g:airline#themes#onedark#palette.normal.airline_warning - - let g:airline#themes#onedark#palette.insert_modified.airline_warning = - \ g:airline#themes#onedark#palette.normal.airline_warning - - let g:airline#themes#onedark#palette.visual.airline_warning = - \ g:airline#themes#onedark#palette.normal.airline_warning - - let g:airline#themes#onedark#palette.visual_modified.airline_warning = - \ g:airline#themes#onedark#palette.normal.airline_warning - - let g:airline#themes#onedark#palette.replace.airline_warning = - \ g:airline#themes#onedark#palette.normal.airline_warning - - let g:airline#themes#onedark#palette.replace_modified.airline_warning = - \ g:airline#themes#onedark#palette.normal.airline_warning - - " Errors - let s:ER = [ s:colors.cursor_grey.gui, s:colors.red.gui, s:term_cursor_grey, s:term_red ] - let g:airline#themes#onedark#palette.normal.airline_error = [ - \ s:ER[0], s:ER[1], s:ER[2], s:ER[3] - \ ] - - let g:airline#themes#onedark#palette.normal_modified.airline_error = - \ g:airline#themes#onedark#palette.normal.airline_error - - let g:airline#themes#onedark#palette.insert.airline_error = - \ g:airline#themes#onedark#palette.normal.airline_error - - let g:airline#themes#onedark#palette.insert_modified.airline_error = - \ g:airline#themes#onedark#palette.normal.airline_error - - let g:airline#themes#onedark#palette.visual.airline_error = - \ g:airline#themes#onedark#palette.normal.airline_error - - let g:airline#themes#onedark#palette.visual_modified.airline_error = - \ g:airline#themes#onedark#palette.normal.airline_error - - let g:airline#themes#onedark#palette.replace.airline_error = - \ g:airline#themes#onedark#palette.normal.airline_error - - let g:airline#themes#onedark#palette.replace_modified.airline_error = - \ g:airline#themes#onedark#palette.normal.airline_error - -endfunction - -call airline#themes#onedark#refresh() diff --git a/.config/nvim/autoload/lightline/colorscheme/onedark.vim b/.config/nvim/autoload/lightline/colorscheme/onedark.vim deleted file mode 100644 index d04a501..0000000 --- a/.config/nvim/autoload/lightline/colorscheme/onedark.vim +++ /dev/null @@ -1,58 +0,0 @@ -" [onedark.vim](https://github.com/joshdick/onedark.vim/) - -" This is a [lightline.vim](https://github.com/itchyny/lightline.vim) colorscheme for use with -" the [onedark.vim](https://github.com/joshdick/onedark.vim) colorscheme. - -let s:colors = onedark#GetColors() - -if get(g:, 'onedark_termcolors', 256) == 16 - let s:term_red = s:colors.red.cterm16 - let s:term_green = s:colors.green.cterm16 - let s:term_yellow = s:colors.yellow.cterm16 - let s:term_blue = s:colors.blue.cterm16 - let s:term_purple = s:colors.purple.cterm16 - let s:term_white = s:colors.white.cterm16 - let s:term_cursor_grey = s:colors.cursor_grey.cterm16 - let s:term_visual_grey = s:colors.visual_grey.cterm16 -else - let s:term_red = s:colors.red.cterm - let s:term_green = s:colors.green.cterm - let s:term_yellow = s:colors.yellow.cterm - let s:term_blue = s:colors.blue.cterm - let s:term_purple = s:colors.purple.cterm - let s:term_white = s:colors.white.cterm - let s:term_cursor_grey = s:colors.cursor_grey.cterm - let s:term_visual_grey = s:colors.visual_grey.cterm -endif - -let s:red = [ s:colors.red.gui, s:term_red ] -let s:green = [ s:colors.green.gui, s:term_green ] -let s:yellow = [ s:colors.yellow.gui, s:term_yellow ] -let s:blue = [ s:colors.blue.gui, s:term_blue ] -let s:purple = [ s:colors.purple.gui, s:term_purple ] -let s:white = [ s:colors.white.gui, s:term_white ] -let s:cursor_grey = [ s:colors.cursor_grey.gui, s:term_cursor_grey ] -let s:visual_grey = [ s:colors.visual_grey.gui, s:term_visual_grey ] - -let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}} -let s:p.normal.left = [ [ s:cursor_grey, s:green ], [ s:white, s:visual_grey ] ] -let s:p.normal.right = [ [ s:cursor_grey, s:green ], [ s:white, s:visual_grey ] ] -let s:p.inactive.left = [ [ s:white, s:visual_grey ], [ s:white, s:visual_grey ] ] -let s:p.inactive.right = [ [ s:cursor_grey, s:white ], [ s:cursor_grey, s:white ] ] -let s:p.insert.left = [ [ s:cursor_grey, s:blue ], [ s:white, s:visual_grey ] ] -let s:p.insert.right = [ [ s:cursor_grey, s:blue ], [ s:white, s:visual_grey ] ] -let s:p.replace.left = [ [ s:cursor_grey, s:red ], [ s:white, s:visual_grey ] ] -let s:p.replace.right = [ [ s:cursor_grey, s:red ], [ s:white, s:visual_grey ] ] -let s:p.visual.left = [ [ s:cursor_grey, s:purple ], [ s:white, s:visual_grey ] ] -let s:p.visual.right = [ [ s:cursor_grey, s:purple ], [ s:white, s:visual_grey ] ] -let s:p.normal.middle = [ [ s:white, s:cursor_grey ] ] -let s:p.inactive.middle = [ [ s:white, s:visual_grey ] ] -let s:p.tabline.left = [ [ s:white, s:visual_grey ] ] -let s:p.tabline.tabsel = [ [ s:cursor_grey, s:white ] ] -let s:p.tabline.middle = [ [ s:white, s:cursor_grey ] ] -let s:p.tabline.right = [ [ s:white, s:visual_grey ] ] -let s:p.normal.error = [ [ s:cursor_grey, s:red ] ] -let s:p.normal.warning = [ [ s:cursor_grey, s:yellow ] ] - -let g:lightline#colorscheme#onedark#palette = lightline#colorscheme#flatten(s:p) - diff --git a/.config/nvim/autoload/onedark.vim b/.config/nvim/autoload/onedark.vim deleted file mode 100644 index 4630ff4..0000000 --- a/.config/nvim/autoload/onedark.vim +++ /dev/null @@ -1,29 +0,0 @@ -" [onedark.vim](https://github.com/joshdick/onedark.vim/) - -let s:overrides = get(g:, "onedark_color_overrides", {}) - -let s:colors = { - \ "red": get(s:overrides, "red", { "gui": "#E06C75", "cterm": "204", "cterm16": "1" }), - \ "dark_red": get(s:overrides, "dark_red", { "gui": "#BE5046", "cterm": "196", "cterm16": "9" }), - \ "green": get(s:overrides, "green", { "gui": "#98C379", "cterm": "114", "cterm16": "2" }), - \ "yellow": get(s:overrides, "yellow", { "gui": "#E5C07B", "cterm": "180", "cterm16": "3" }), - \ "dark_yellow": get(s:overrides, "dark_yellow", { "gui": "#D19A66", "cterm": "173", "cterm16": "11" }), - \ "blue": get(s:overrides, "blue", { "gui": "#61AFEF", "cterm": "39", "cterm16": "4" }), - \ "purple": get(s:overrides, "purple", { "gui": "#C678DD", "cterm": "170", "cterm16": "5" }), - \ "cyan": get(s:overrides, "cyan", { "gui": "#56B6C2", "cterm": "38", "cterm16": "6" }), - \ "white": get(s:overrides, "white", { "gui": "#ABB2BF", "cterm": "145", "cterm16": "15" }), - \ "black": get(s:overrides, "black", { "gui": "#282C34", "cterm": "235", "cterm16": "0" }), - \ "foreground": get(s:overrides, "foreground", { "gui": "#ABB2BF", "cterm": "145", "cterm16": "NONE" }), - \ "background": get(s:overrides, "background", { "gui": "#282C34", "cterm": "235", "cterm16": "NONE" }), - \ "comment_grey": get(s:overrides, "comment_grey", { "gui": "#5C6370", "cterm": "59", "cterm16": "7" }), - \ "gutter_fg_grey": get(s:overrides, "gutter_fg_grey", { "gui": "#4B5263", "cterm": "238", "cterm16": "8" }), - \ "cursor_grey": get(s:overrides, "cursor_grey", { "gui": "#2C323C", "cterm": "236", "cterm16": "0" }), - \ "visual_grey": get(s:overrides, "visual_grey", { "gui": "#3E4452", "cterm": "237", "cterm16": "8" }), - \ "menu_grey": get(s:overrides, "menu_grey", { "gui": "#3E4452", "cterm": "237", "cterm16": "7" }), - \ "special_grey": get(s:overrides, "special_grey", { "gui": "#3B4048", "cterm": "238", "cterm16": "7" }), - \ "vertsplit": get(s:overrides, "vertsplit", { "gui": "#3E4452", "cterm": "59", "cterm16": "7" }), - \} - -function! onedark#GetColors() - return s:colors -endfunction diff --git a/.config/nvim/coc.vim b/.config/nvim/coc.vim new file mode 100644 index 0000000..1175735 --- /dev/null +++ b/.config/nvim/coc.vim @@ -0,0 +1,52 @@ +source ~/.config/nvim/init.vim + +packadd! onedark.vim +" packadd! fzf +" packadd! fzf.vim +packadd! vim-jsx-pretty +" packadd! copilot.vim + +" --> Fzf +" source ~/.config/nvim/user/fzf.vim +" set rtp+=/usr/share/vim/vimfiles + +" --> Zeal +source ~/.config/nvim/user/zeal.vim + +" --> Onedark theme +source ~/.config/nvim/user/onedark.vim + +" --> Vimspector +source ~/.config/nvim/user/vimspector.vim + +" --> COC +autocmd! User coc.nvim source $HOME/.config/nvim/user/coc-onload.vim +let g:coc_config_home = '$HOME/.config/nvim/user' +let g:coc_data_home = '$HOME/.local/share/nvim/site/coc' +let g:coc_global_extensions = [ + \ 'coc-json', + \ 'coc-marketplace', + \ 'coc-css', + \ 'coc-tsserver', + \ 'coc-pyright', + \ 'coc-sh', + \ ] +nnoremap <silent><nowait> <leader>ca :<C-u>CocList diagnostics<cr> +nnoremap <silent><nowait> <leader>ce :<C-u>CocList extensions<cr> +nnoremap <silent><nowait> <leader>cc :<C-u>CocList commands<cr> +nnoremap <silent><nowait> <leader>co :<C-u>CocList outline<cr> +nnoremap <silent><nowait> <leader>cs :<C-u>CocList -I symbols<cr> +nnoremap <silent><nowait> <leader>cj :<C-u>CocNext<CR> +nnoremap <silent><nowait> <leader>ck :<C-u>CocPrev<CR> +nnoremap <silent><nowait> <leader>cp :<C-u>CocListResume<CR> +nnoremap <leader>cm :CocList marketplace<CR> +nnoremap <leader>cff :Format<CR> +inoremap <silent><expr><c-l> coc#refresh() + +nnoremap <leader><C-r> :source ~/.config/nvim/coc.vim<CR> + +" autocmd VimLeave * call SaveSess() +" autocmd VimEnter * nested call RestoreSess() + +AirlineTheme +CocList extensions diff --git a/.config/nvim/colors/onedark.vim b/.config/nvim/colors/onedark.vim deleted file mode 100644 index 6769d6c..0000000 --- a/.config/nvim/colors/onedark.vim +++ /dev/null @@ -1,713 +0,0 @@ -" vim:fdm=marker -" Vim Color File -" Name: onedark.vim -" Maintainer: https://github.com/joshdick/onedark.vim/ -" License: The MIT License (MIT) -" Based On: https://github.com/MaxSt/FlatColor/ - -" Companion statusline plugin and terminal themes are included with onedark.vim: -" * https://github.com/joshdick/onedark.vim#lightlinevim-colorscheme -" * https://github.com/joshdick/onedark.vim#vim-airline-theme -" * https://github.com/joshdick/onedark.vim/tree/main/term - -" Color Reference {{{ - -" The following colors were measured inside Atom using its built-in inspector. - -" +---------------------------------------------+ -" | Color Name | RGB | Hex | -" |--------------+--------------------+---------| -" | Black | rgb(40, 44, 52) | #282c34 | -" |--------------+--------------------+---------| -" | White | rgb(171, 178, 191) | #abb2bf | -" |--------------+--------------------+---------| -" | Light Red | rgb(224, 108, 117) | #e06c75 | -" |--------------+--------------------+---------| -" | Dark Red | rgb(190, 80, 70) | #be5046 | -" |--------------+--------------------+---------| -" | Green | rgb(152, 195, 121) | #98c379 | -" |--------------+--------------------+---------| -" | Light Yellow | rgb(229, 192, 123) | #e5c07b | -" |--------------+--------------------+---------| -" | Dark Yellow | rgb(209, 154, 102) | #d19a66 | -" |--------------+--------------------+---------| -" | Blue | rgb(97, 175, 239) | #61afef | -" |--------------+--------------------+---------| -" | Magenta | rgb(198, 120, 221) | #c678dd | -" |--------------+--------------------+---------| -" | Cyan | rgb(86, 182, 194) | #56b6c2 | -" |--------------+--------------------+---------| -" | Gutter Grey | rgb(76, 82, 99) | #4b5263 | -" |--------------+--------------------+---------| -" | Comment Grey | rgb(92, 99, 112) | #5c6370 | -" +---------------------------------------------+ - -" }}} - -" Initialization {{{ - -highlight clear - -if exists("syntax_on") - syntax reset -endif - -set t_Co=256 - -let g:colors_name="onedark" - -" Set to "256" for 256-color terminals, or -" set to "16" to use your terminal emulator's native colors -" (a 16-color palette for this color scheme is available; see -" < https://github.com/joshdick/onedark.vim/blob/main/README.md > -" for more information.) -if !exists("g:onedark_termcolors") - let g:onedark_termcolors = 256 -endif - -" Not all terminals support italics properly. If yours does, opt-in. -if !exists("g:onedark_terminal_italics") - let g:onedark_terminal_italics = 0 -endif - -" This function is based on one from FlatColor: https://github.com/MaxSt/FlatColor/ -" Which in turn was based on one found in hemisu: https://github.com/noahfrederick/vim-hemisu/ -let s:group_colors = {} " Cache of default highlight group settings, for later reference via `onedark#extend_highlight` -function! s:h(group, style, ...) - if (a:0 > 0) " Will be true if we got here from onedark#extend_highlight - let s:highlight = s:group_colors[a:group] - for style_type in ["fg", "bg", "sp"] - if (has_key(a:style, style_type)) - let l:default_style = (has_key(s:highlight, style_type) ? copy(s:highlight[style_type]) : { "cterm16": "NONE", "cterm": "NONE", "gui": "NONE" }) - let s:highlight[style_type] = extend(l:default_style, a:style[style_type]) - endif - endfor - if (has_key(a:style, "gui")) - let s:highlight.gui = a:style.gui - endif - if (has_key(a:style, "cterm")) - let s:highlight.cterm = a:style.cterm - endif - else - let s:highlight = a:style - let s:group_colors[a:group] = s:highlight " Cache default highlight group settings - endif - - if g:onedark_terminal_italics == 0 - if has_key(s:highlight, "cterm") && s:highlight["cterm"] == "italic" - unlet s:highlight.cterm - endif - if has_key(s:highlight, "gui") && s:highlight["gui"] == "italic" - unlet s:highlight.gui - endif - endif - - if g:onedark_termcolors == 16 - let l:ctermfg = (has_key(s:highlight, "fg") ? s:highlight.fg.cterm16 : "NONE") - let l:ctermbg = (has_key(s:highlight, "bg") ? s:highlight.bg.cterm16 : "NONE") - else - let l:ctermfg = (has_key(s:highlight, "fg") ? s:highlight.fg.cterm : "NONE") - let l:ctermbg = (has_key(s:highlight, "bg") ? s:highlight.bg.cterm : "NONE") - endif - - execute "highlight" a:group - \ "guifg=" (has_key(s:highlight, "fg") ? s:highlight.fg.gui : "NONE") - \ "guibg=" (has_key(s:highlight, "bg") ? s:highlight.bg.gui : "NONE") - \ "guisp=" (has_key(s:highlight, "sp") ? s:highlight.sp.gui : "NONE") - \ "gui=" (has_key(s:highlight, "gui") ? s:highlight.gui : "NONE") - \ "ctermfg=" . l:ctermfg - \ "ctermbg=" . l:ctermbg - \ "cterm=" (has_key(s:highlight, "cterm") ? s:highlight.cterm : "NONE") -endfunction - -" public {{{ - -function! onedark#set_highlight(group, style) - call s:h(a:group, a:style) -endfunction - -function! onedark#extend_highlight(group, style) - call s:h(a:group, a:style, 1) -endfunction - -" }}} - -" }}} - -" Color Variables {{{ - -let s:colors = onedark#GetColors() - -let s:red = s:colors.red -let s:dark_red = s:colors.dark_red -let s:green = s:colors.green -let s:yellow = s:colors.yellow -let s:dark_yellow = s:colors.dark_yellow -let s:blue = s:colors.blue -let s:purple = s:colors.purple -let s:cyan = s:colors.cyan -let s:white = s:colors.white -let s:black = s:colors.black -let s:foreground = s:colors.foreground -let s:background = s:colors.background -let s:comment_grey = s:colors.comment_grey -let s:gutter_fg_grey = s:colors.gutter_fg_grey -let s:cursor_grey = s:colors.cursor_grey -let s:visual_grey = s:colors.visual_grey -let s:menu_grey = s:colors.menu_grey -let s:special_grey = s:colors.special_grey -let s:vertsplit = s:colors.vertsplit - -" }}} - -" Terminal Colors {{{ - -if has('nvim') - let g:terminal_color_0 = s:black.gui - let g:terminal_color_1 = s:red.gui - let g:terminal_color_2 = s:green.gui - let g:terminal_color_3 = s:yellow.gui - let g:terminal_color_4 = s:blue.gui - let g:terminal_color_5 = s:purple.gui - let g:terminal_color_6 = s:cyan.gui - let g:terminal_color_7 = s:comment_grey.gui - let g:terminal_color_8 = s:visual_grey.gui - let g:terminal_color_9 = s:red.gui - let g:terminal_color_10 = s:green.gui - let g:terminal_color_11 = s:yellow.gui - let g:terminal_color_12 = s:blue.gui - let g:terminal_color_13 = s:purple.gui - let g:terminal_color_14 = s:cyan.gui - let g:terminal_color_15 = s:white.gui -else - let g:terminal_ansi_colors = [ - \ s:black.gui, s:red.gui, s:green.gui, s:yellow.gui, - \ s:blue.gui, s:purple.gui, s:cyan.gui, s:comment_grey.gui, - \ s:visual_grey.gui, s:red.gui, s:green.gui, s:yellow.gui, - \ s:blue.gui, s:purple.gui, s:cyan.gui, s:white.gui - \] -endif - -" }}} - -" Syntax Groups (descriptions and ordering from `:h w18`) {{{ - -call s:h("Comment", { "fg": s:comment_grey, "gui": "italic", "cterm": "italic" }) " any comment -call s:h("Constant", { "fg": s:cyan }) " any constant -call s:h("String", { "fg": s:green }) " a string constant: "this is a string" -call s:h("Character", { "fg": s:green }) " a character constant: 'c', '\n' -call s:h("Number", { "fg": s:dark_yellow }) " a number constant: 234, 0xff -call s:h("Boolean", { "fg": s:dark_yellow }) " a boolean constant: TRUE, false -call s:h("Float", { "fg": s:dark_yellow }) " a floating point constant: 2.3e10 -call s:h("Identifier", { "fg": s:red }) " any variable name -call s:h("Function", { "fg": s:blue }) " function name (also: methods for classes) -call s:h("Statement", { "fg": s:purple }) " any statement -call s:h("Conditional", { "fg": s:purple }) " if, then, else, endif, switch, etc. -call s:h("Repeat", { "fg": s:purple }) " for, do, while, etc. -call s:h("Label", { "fg": s:purple }) " case, default, etc. -call s:h("Operator", { "fg": s:purple }) " sizeof", "+", "*", etc. -call s:h("Keyword", { "fg": s:purple }) " any other keyword -call s:h("Exception", { "fg": s:purple }) " try, catch, throw -call s:h("PreProc", { "fg": s:yellow }) " generic Preprocessor -call s:h("Include", { "fg": s:blue }) " preprocessor #include -call s:h("Define", { "fg": s:purple }) " preprocessor #define -call s:h("Macro", { "fg": s:purple }) " same as Define -call s:h("PreCondit", { "fg": s:yellow }) " preprocessor #if, #else, #endif, etc. -call s:h("Type", { "fg": s:yellow }) " int, long, char, etc. -call s:h("StorageClass", { "fg": s:yellow }) " static, register, volatile, etc. -call s:h("Structure", { "fg": s:yellow }) " struct, union, enum, etc. -call s:h("Typedef", { "fg": s:yellow }) " A typedef -call s:h("Special", { "fg": s:blue }) " any special symbol -call s:h("SpecialChar", { "fg": s:dark_yellow }) " special character in a constant -call s:h("Tag", {}) " you can use CTRL-] on this -call s:h("Delimiter", {}) " character that needs attention -call s:h("SpecialComment", { "fg": s:comment_grey }) " special things inside a comment -call s:h("Debug", {}) " debugging statements -call s:h("Underlined", { "gui": "underline", "cterm": "underline" }) " text that stands out, HTML links -call s:h("Ignore", {}) " left blank, hidden -call s:h("Error", { "fg": s:red }) " any erroneous construct -call s:h("Todo", { "fg": s:purple }) " anything that needs extra attention; mostly the keywords TODO FIXME and XXX - -" }}} - -" Highlighting Groups (descriptions and ordering from `:h highlight-groups`) {{{ -call s:h("ColorColumn", { "bg": s:cursor_grey }) " used for the columns set with 'colorcolumn' -call s:h("Conceal", {}) " placeholder characters substituted for concealed text (see 'conceallevel') -call s:h("Cursor", { "fg": s:black, "bg": s:blue }) " the character under the cursor -call s:h("CursorIM", {}) " like Cursor, but used when in IME mode -call s:h("CursorColumn", { "bg": s:cursor_grey }) " the screen column that the cursor is in when 'cursorcolumn' is set -if &diff - " Don't change the background color in diff mode - call s:h("CursorLine", { "gui": "underline" }) " the screen line that the cursor is in when 'cursorline' is set -else - call s:h("CursorLine", { "bg": s:cursor_grey }) " the screen line that the cursor is in when 'cursorline' is set -endif -call s:h("Directory", { "fg": s:blue }) " directory names (and other special names in listings) -call s:h("DiffAdd", { "bg": s:green, "fg": s:black }) " diff mode: Added line -call s:h("DiffChange", { "fg": s:yellow, "gui": "underline", "cterm": "underline" }) " diff mode: Changed line -call s:h("DiffDelete", { "bg": s:red, "fg": s:black }) " diff mode: Deleted line -call s:h("DiffText", { "bg": s:yellow, "fg": s:black }) " diff mode: Changed text within a changed line -if get(g:, 'onedark_hide_endofbuffer', 0) - " If enabled, will style end-of-buffer filler lines (~) to appear to be hidden. - call s:h("EndOfBuffer", { "fg": s:black }) " filler lines (~) after the last line in the buffer -endif -call s:h("ErrorMsg", { "fg": s:red }) " error messages on the command line -call s:h("VertSplit", { "fg": s:vertsplit }) " the column separating vertically split windows -call s:h("Folded", { "fg": s:comment_grey }) " line used for closed folds -call s:h("FoldColumn", {}) " 'foldcolumn' -call s:h("SignColumn", {}) " column where signs are displayed -call s:h("IncSearch", { "fg": s:yellow, "bg": s:comment_grey }) " 'incsearch' highlighting; also used for the text replaced with ":s///c" -call s:h("LineNr", { "fg": s:gutter_fg_grey }) " Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. -call s:h("CursorLineNr", {}) " Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. -call s:h("MatchParen", { "fg": s:blue, "gui": "underline", "cterm": "underline" }) " The character under the cursor or just before it, if it is a paired bracket, and its match. -call s:h("ModeMsg", {}) " 'showmode' message (e.g., "-- INSERT --") -call s:h("MoreMsg", {}) " more-prompt -call s:h("NonText", { "fg": s:special_grey }) " '~' and '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). -call s:h("Normal", { "fg": s:foreground, "bg": s:background }) " normal text -call s:h("Pmenu", { "fg": s:white, "bg": s:menu_grey }) " Popup menu: normal item. -call s:h("PmenuSel", { "fg": s:cursor_grey, "bg": s:blue }) " Popup menu: selected item. -call s:h("PmenuSbar", { "bg": s:cursor_grey }) " Popup menu: scrollbar. -call s:h("PmenuThumb", { "bg": s:white }) " Popup menu: Thumb of the scrollbar. -call s:h("Question", { "fg": s:purple }) " hit-enter prompt and yes/no questions -call s:h("QuickFixLine", { "fg": s:black, "bg": s:yellow }) " Current quickfix item in the quickfix window. -call s:h("Search", { "fg": s:black, "bg": s:yellow }) " Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. -call s:h("SpecialKey", { "fg": s:special_grey }) " Meta and special keys listed with ":map", also for text used to show unprintable characters in the text, 'listchars'. Generally: text that is displayed differently from what it really is. -call s:h("SpellBad", { "fg": s:red, "gui": "underline", "cterm": "underline" }) " Word that is not recognized by the spellchecker. This will be combined with the highlighting used otherwise. -call s:h("SpellCap", { "fg": s:dark_yellow }) " Word that should start with a capital. This will be combined with the highlighting used otherwise. -call s:h("SpellLocal", { "fg": s:dark_yellow }) " Word that is recognized by the spellchecker as one that is used in another region. This will be combined with the highlighting used otherwise. -call s:h("SpellRare", { "fg": s:dark_yellow }) " Word that is recognized by the spellchecker as one that is hardly ever used. spell This will be combined with the highlighting used otherwise. -call s:h("StatusLine", { "fg": s:white, "bg": s:cursor_grey }) " status line of current window -call s:h("StatusLineNC", { "fg": s:comment_grey }) " status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. -call s:h("StatusLineTerm", { "fg": s:white, "bg": s:cursor_grey }) " status line of current :terminal window -call s:h("StatusLineTermNC", { "fg": s:comment_grey }) " status line of non-current :terminal window -call s:h("TabLine", { "fg": s:comment_grey }) " tab pages line, not active tab page label -call s:h("TabLineFill", {}) " tab pages line, where there are no labels -call s:h("TabLineSel", { "fg": s:white }) " tab pages line, active tab page label -call s:h("Terminal", { "fg": s:white, "bg": s:black }) " terminal window (see terminal-size-color) -call s:h("Title", { "fg": s:green }) " titles for output from ":set all", ":autocmd" etc. -call s:h("Visual", { "bg": s:visual_grey }) " Visual mode selection -call s:h("VisualNOS", { "bg": s:visual_grey }) " Visual mode selection when vim is "Not Owning the Selection". Only X11 Gui's gui-x11 and xterm-clipboard supports this. -call s:h("WarningMsg", { "fg": s:yellow }) " warning messages -call s:h("WildMenu", { "fg": s:black, "bg": s:blue }) " current match in 'wildmenu' completion - -" }}} - -" Termdebug highlighting for Vim 8.1+ {{{ - -" See `:h hl-debugPC` and `:h hl-debugBreakpoint`. -call s:h("debugPC", { "bg": s:special_grey }) " the current position -call s:h("debugBreakpoint", { "fg": s:black, "bg": s:red }) " a breakpoint - -" }}} - -" Language-Specific Highlighting {{{ - -" CSS -call s:h("cssAttrComma", { "fg": s:purple }) -call s:h("cssAttributeSelector", { "fg": s:green }) -call s:h("cssBraces", { "fg": s:white }) -call s:h("cssClassName", { "fg": s:dark_yellow }) -call s:h("cssClassNameDot", { "fg": s:dark_yellow }) -call s:h("cssDefinition", { "fg": s:purple }) -call s:h("cssFontAttr", { "fg": s:dark_yellow }) -call s:h("cssFontDescriptor", { "fg": s:purple }) -call s:h("cssFunctionName", { "fg": s:blue }) -call s:h("cssIdentifier", { "fg": s:blue }) -call s:h("cssImportant", { "fg": s:purple }) -call s:h("cssInclude", { "fg": s:white }) -call s:h("cssIncludeKeyword", { "fg": s:purple }) -call s:h("cssMediaType", { "fg": s:dark_yellow }) -call s:h("cssProp", { "fg": s:white }) -call s:h("cssPseudoClassId", { "fg": s:dark_yellow }) -call s:h("cssSelectorOp", { "fg": s:purple }) -call s:h("cssSelectorOp2", { "fg": s:purple }) -call s:h("cssTagName", { "fg": s:red }) - -" Fish Shell -call s:h("fishKeyword", { "fg": s:purple }) -call s:h("fishConditional", { "fg": s:purple }) - -" Go -call s:h("goDeclaration", { "fg": s:purple }) -call s:h("goBuiltins", { "fg": s:cyan }) -call s:h("goFunctionCall", { "fg": s:blue }) -call s:h("goVarDefs", { "fg": s:red }) -call s:h("goVarAssign", { "fg": s:red }) -call s:h("goVar", { "fg": s:purple }) -call s:h("goConst", { "fg": s:purple }) -call s:h("goType", { "fg": s:yellow }) -call s:h("goTypeName", { "fg": s:yellow }) -call s:h("goDeclType", { "fg": s:cyan }) -call s:h("goTypeDecl", { "fg": s:purple }) - -" HTML (keep consistent with Markdown, below) -call s:h("htmlArg", { "fg": s:dark_yellow }) -call s:h("htmlBold", { "fg": s:dark_yellow, "gui": "bold", "cterm": "bold" }) -call s:h("htmlBoldItalic", { "fg": s:green, "gui": "bold,italic", "cterm": "bold,italic" }) -call s:h("htmlEndTag", { "fg": s:white }) -call s:h("htmlH1", { "fg": s:red }) -call s:h("htmlH2", { "fg": s:red }) -call s:h("htmlH3", { "fg": s:red }) -call s:h("htmlH4", { "fg": s:red }) -call s:h("htmlH5", { "fg": s:red }) -call s:h("htmlH6", { "fg": s:red }) -call s:h("htmlItalic", { "fg": s:purple, "gui": "italic", "cterm": "italic" }) -call s:h("htmlLink", { "fg": s:cyan, "gui": "underline", "cterm": "underline" }) -call s:h("htmlSpecialChar", { "fg": s:dark_yellow }) -call s:h("htmlSpecialTagName", { "fg": s:red }) -call s:h("htmlTag", { "fg": s:white }) -call s:h("htmlTagN", { "fg": s:red }) -call s:h("htmlTagName", { "fg": s:red }) -call s:h("htmlTitle", { "fg": s:white }) - -" JavaScript -call s:h("javaScriptBraces", { "fg": s:white }) -call s:h("javaScriptFunction", { "fg": s:purple }) -call s:h("javaScriptIdentifier", { "fg": s:purple }) -call s:h("javaScriptNull", { "fg": s:dark_yellow }) -call s:h("javaScriptNumber", { "fg": s:dark_yellow }) -call s:h("javaScriptRequire", { "fg": s:cyan }) -call s:h("javaScriptReserved", { "fg": s:purple }) -" https://github.com/pangloss/vim-javascript -call s:h("jsArrowFunction", { "fg": s:purple }) -call s:h("jsClassKeyword", { "fg": s:purple }) -call s:h("jsClassMethodType", { "fg": s:purple }) -call s:h("jsDocParam", { "fg": s:blue }) -call s:h("jsDocTags", { "fg": s:purple }) -call s:h("jsExport", { "fg": s:purple }) -call s:h("jsExportDefault", { "fg": s:purple }) -call s:h("jsExtendsKeyword", { "fg": s:purple }) -call s:h("jsFrom", { "fg": s:purple }) -call s:h("jsFuncCall", { "fg": s:blue }) -call s:h("jsFunction", { "fg": s:purple }) -call s:h("jsGenerator", { "fg": s:yellow }) -call s:h("jsGlobalObjects", { "fg": s:yellow }) -call s:h("jsImport", { "fg": s:purple }) -call s:h("jsModuleAs", { "fg": s:purple }) -call s:h("jsModuleWords", { "fg": s:purple }) -call s:h("jsModules", { "fg": s:purple }) -call s:h("jsNull", { "fg": s:dark_yellow }) -call s:h("jsOperator", { "fg": s:purple }) -call s:h("jsStorageClass", { "fg": s:purple }) -call s:h("jsSuper", { "fg": s:red }) -call s:h("jsTemplateBraces", { "fg": s:dark_red }) -call s:h("jsTemplateVar", { "fg": s:green }) -call s:h("jsThis", { "fg": s:red }) -call s:h("jsUndefined", { "fg": s:dark_yellow }) -" https://github.com/othree/yajs.vim -call s:h("javascriptArrowFunc", { "fg": s:purple }) -call s:h("javascriptClassExtends", { "fg": s:purple }) -call s:h("javascriptClassKeyword", { "fg": s:purple }) -call s:h("javascriptDocNotation", { "fg": s:purple }) -call s:h("javascriptDocParamName", { "fg": s:blue }) -call s:h("javascriptDocTags", { "fg": s:purple }) -call s:h("javascriptEndColons", { "fg": s:white }) -call s:h("javascriptExport", { "fg": s:purple }) -call s:h("javascriptFuncArg", { "fg": s:white }) -call s:h("javascriptFuncKeyword", { "fg": s:purple }) -call s:h("javascriptIdentifier", { "fg": s:red }) -call s:h("javascriptImport", { "fg": s:purple }) -call s:h("javascriptMethodName", { "fg": s:white }) -call s:h("javascriptObjectLabel", { "fg": s:white }) -call s:h("javascriptOpSymbol", { "fg": s:cyan }) -call s:h("javascriptOpSymbols", { "fg": s:cyan }) -call s:h("javascriptPropertyName", { "fg": s:green }) -call s:h("javascriptTemplateSB", { "fg": s:dark_red }) -call s:h("javascriptVariable", { "fg": s:purple }) - -" JSON -call s:h("jsonCommentError", { "fg": s:white }) -call s:h("jsonKeyword", { "fg": s:red }) -call s:h("jsonBoolean", { "fg": s:dark_yellow }) -call s:h("jsonNumber", { "fg": s:dark_yellow }) -call s:h("jsonQuote", { "fg": s:white }) -call s:h("jsonMissingCommaError", { "fg": s:red, "gui": "reverse" }) -call s:h("jsonNoQuotesError", { "fg": s:red, "gui": "reverse" }) -call s:h("jsonNumError", { "fg": s:red, "gui": "reverse" }) -call s:h("jsonString", { "fg": s:green }) -call s:h("jsonStringSQError", { "fg": s:red, "gui": "reverse" }) -call s:h("jsonSemicolonError", { "fg": s:red, "gui": "reverse" }) - -" LESS -call s:h("lessVariable", { "fg": s:purple }) -call s:h("lessAmpersandChar", { "fg": s:white }) -call s:h("lessClass", { "fg": s:dark_yellow }) - -" Markdown (keep consistent with HTML, above) -call s:h("markdownBlockquote", { "fg": s:comment_grey }) -call s:h("markdownBold", { "fg": s:dark_yellow, "gui": "bold", "cterm": "bold" }) -call s:h("markdownBoldItalic", { "fg": s:green, "gui": "bold,italic", "cterm": "bold,italic" }) -call s:h("markdownCode", { "fg": s:green }) -call s:h("markdownCodeBlock", { "fg": s:green }) -call s:h("markdownCodeDelimiter", { "fg": s:green }) -call s:h("markdownH1", { "fg": s:red }) -call s:h("markdownH2", { "fg": s:red }) -call s:h("markdownH3", { "fg": s:red }) -call s:h("markdownH4", { "fg": s:red }) -call s:h("markdownH5", { "fg": s:red }) -call s:h("markdownH6", { "fg": s:red }) -call s:h("markdownHeadingDelimiter", { "fg": s:red }) -call s:h("markdownHeadingRule", { "fg": s:comment_grey }) -call s:h("markdownId", { "fg": s:purple }) -call s:h("markdownIdDeclaration", { "fg": s:blue }) -call s:h("markdownIdDelimiter", { "fg": s:purple }) -call s:h("markdownItalic", { "fg": s:purple, "gui": "italic", "cterm": "italic" }) -call s:h("markdownLinkDelimiter", { "fg": s:purple }) -call s:h("markdownLinkText", { "fg": s:blue }) -call s:h("markdownListMarker", { "fg": s:red }) -call s:h("markdownOrderedListMarker", { "fg": s:red }) -call s:h("markdownRule", { "fg": s:comment_grey }) -call s:h("markdownUrl", { "fg": s:cyan, "gui": "underline", "cterm": "underline" }) - -" Perl -call s:h("perlFiledescRead", { "fg": s:green }) -call s:h("perlFunction", { "fg": s:purple }) -call s:h("perlMatchStartEnd",{ "fg": s:blue }) -call s:h("perlMethod", { "fg": s:purple }) -call s:h("perlPOD", { "fg": s:comment_grey }) -call s:h("perlSharpBang", { "fg": s:comment_grey }) -call s:h("perlSpecialString",{ "fg": s:dark_yellow }) -call s:h("perlStatementFiledesc", { "fg": s:red }) -call s:h("perlStatementFlow",{ "fg": s:red }) -call s:h("perlStatementInclude", { "fg": s:purple }) -call s:h("perlStatementScalar",{ "fg": s:purple }) -call s:h("perlStatementStorage", { "fg": s:purple }) -call s:h("perlSubName",{ "fg": s:yellow }) -call s:h("perlVarPlain",{ "fg": s:blue }) - -" PHP -call s:h("phpVarSelector", { "fg": s:red }) -call s:h("phpOperator", { "fg": s:white }) -call s:h("phpParent", { "fg": s:white }) -call s:h("phpMemberSelector", { "fg": s:white }) -call s:h("phpType", { "fg": s:purple }) -call s:h("phpKeyword", { "fg": s:purple }) -call s:h("phpClass", { "fg": s:yellow }) -call s:h("phpUseClass", { "fg": s:white }) -call s:h("phpUseAlias", { "fg": s:white }) -call s:h("phpInclude", { "fg": s:purple }) -call s:h("phpClassExtends", { "fg": s:green }) -call s:h("phpDocTags", { "fg": s:white }) -call s:h("phpFunction", { "fg": s:blue }) -call s:h("phpFunctions", { "fg": s:cyan }) -call s:h("phpMethodsVar", { "fg": s:dark_yellow }) -call s:h("phpMagicConstants", { "fg": s:dark_yellow }) -call s:h("phpSuperglobals", { "fg": s:red }) -call s:h("phpConstants", { "fg": s:dark_yellow }) - -" Ruby -call s:h("rubyBlockParameter", { "fg": s:red}) -call s:h("rubyBlockParameterList", { "fg": s:red }) -call s:h("rubyClass", { "fg": s:purple}) -call s:h("rubyConstant", { "fg": s:yellow}) -call s:h("rubyControl", { "fg": s:purple }) -call s:h("rubyEscape", { "fg": s:red}) -call s:h("rubyFunction", { "fg": s:blue}) -call s:h("rubyGlobalVariable", { "fg": s:red}) -call s:h("rubyInclude", { "fg": s:blue}) -call s:h("rubyIncluderubyGlobalVariable", { "fg": s:red}) -call s:h("rubyInstanceVariable", { "fg": s:red}) -call s:h("rubyInterpolation", { "fg": s:cyan }) -call s:h("rubyInterpolationDelimiter", { "fg": s:red }) -call s:h("rubyInterpolationDelimiter", { "fg": s:red}) -call s:h("rubyRegexp", { "fg": s:cyan}) -call s:h("rubyRegexpDelimiter", { "fg": s:cyan}) -call s:h("rubyStringDelimiter", { "fg": s:green}) -call s:h("rubySymbol", { "fg": s:cyan}) - -" Sass -" https://github.com/tpope/vim-haml -call s:h("sassAmpersand", { "fg": s:red }) -call s:h("sassClass", { "fg": s:dark_yellow }) -call s:h("sassControl", { "fg": s:purple }) -call s:h("sassExtend", { "fg": s:purple }) -call s:h("sassFor", { "fg": s:white }) -call s:h("sassFunction", { "fg": s:cyan }) -call s:h("sassId", { "fg": s:blue }) -call s:h("sassInclude", { "fg": s:purple }) -call s:h("sassMedia", { "fg": s:purple }) -call s:h("sassMediaOperators", { "fg": s:white }) -call s:h("sassMixin", { "fg": s:purple }) -call s:h("sassMixinName", { "fg": s:blue }) -call s:h("sassMixing", { "fg": s:purple }) -call s:h("sassVariable", { "fg": s:purple }) -" https://github.com/cakebaker/scss-syntax.vim -call s:h("scssExtend", { "fg": s:purple }) -call s:h("scssImport", { "fg": s:purple }) -call s:h("scssInclude", { "fg": s:purple }) -call s:h("scssMixin", { "fg": s:purple }) -call s:h("scssSelectorName", { "fg": s:dark_yellow }) -call s:h("scssVariable", { "fg": s:purple }) - -" TeX -call s:h("texStatement", { "fg": s:purple }) -call s:h("texSubscripts", { "fg": s:dark_yellow }) -call s:h("texSuperscripts", { "fg": s:dark_yellow }) -call s:h("texTodo", { "fg": s:dark_red }) -call s:h("texBeginEnd", { "fg": s:purple }) -call s:h("texBeginEndName", { "fg": s:blue }) -call s:h("texMathMatcher", { "fg": s:blue }) -call s:h("texMathDelim", { "fg": s:blue }) -call s:h("texDelimiter", { "fg": s:dark_yellow }) -call s:h("texSpecialChar", { "fg": s:dark_yellow }) -call s:h("texCite", { "fg": s:blue }) -call s:h("texRefZone", { "fg": s:blue }) - -" TypeScript -call s:h("typescriptReserved", { "fg": s:purple }) -call s:h("typescriptEndColons", { "fg": s:white }) -call s:h("typescriptBraces", { "fg": s:white }) - -" XML -call s:h("xmlAttrib", { "fg": s:dark_yellow }) -call s:h("xmlEndTag", { "fg": s:red }) -call s:h("xmlTag", { "fg": s:red }) -call s:h("xmlTagName", { "fg": s:red }) - -" }}} - -" Plugin Highlighting {{{ - -" airblade/vim-gitgutter -call s:h("GitGutterAdd", { "fg": s:green }) -call s:h("GitGutterChange", { "fg": s:yellow }) -call s:h("GitGutterDelete", { "fg": s:red }) - -" dense-analysis/ale -call s:h("ALEError", { "fg": s:red, "gui": "underline", "cterm": "underline" }) -call s:h("ALEWarning", { "fg": s:yellow, "gui": "underline", "cterm": "underline" }) -call s:h("ALEInfo", { "gui": "underline", "cterm": "underline" }) -call s:h("ALEErrorSign", { "fg": s:red }) -call s:h("ALEWarningSign", { "fg": s:yellow }) -call s:h("ALEInfoSign", { }) - -" easymotion/vim-easymotion -call s:h("EasyMotionTarget", { "fg": s:red, "gui": "bold", "cterm": "bold" }) -call s:h("EasyMotionTarget2First", { "fg": s:yellow, "gui": "bold", "cterm": "bold" }) -call s:h("EasyMotionTarget2Second", { "fg": s:dark_yellow, "gui": "bold", "cterm": "bold" }) -call s:h("EasyMotionShade", { "fg": s:comment_grey }) - -" lewis6991/gitsigns.nvim -hi link GitSignsAdd GitGutterAdd -hi link GitSignsChange GitGutterChange -hi link GitSignsDelete GitGutterDelete - -" mhinz/vim-signify -hi link SignifySignAdd GitGutterAdd -hi link SignifySignChange GitGutterChange -hi link SignifySignDelete GitGutterDelete - -" neoclide/coc.nvim -call s:h("CocErrorSign", { "fg": s:red }) -call s:h("CocWarningSign", { "fg": s:yellow }) -call s:h("CocInfoSign", { "fg": s:blue }) -call s:h("CocHintSign", { "fg": s:cyan }) -call s:h("CocFadeOut", { "fg": s:comment_grey }) -" https://github.com/joshdick/onedark.vim/issues/313 -highlight! link CocMenuSel PmenuSel - -" neomake/neomake -call s:h("NeomakeErrorSign", { "fg": s:red }) -call s:h("NeomakeWarningSign", { "fg": s:yellow }) -call s:h("NeomakeInfoSign", { "fg": s:blue }) - -" plasticboy/vim-markdown (keep consistent with Markdown, above) -call s:h("mkdDelimiter", { "fg": s:purple }) -call s:h("mkdHeading", { "fg": s:red }) -call s:h("mkdLink", { "fg": s:blue }) -call s:h("mkdURL", { "fg": s:cyan, "gui": "underline", "cterm": "underline" }) - -" prabirshrestha/vim-lsp -call s:h("LspErrorText", { "fg": s:red }) -call s:h("LspWarningText", { "fg": s:yellow }) -call s:h("LspInformationText", { "fg":s:blue }) -call s:h("LspHintText", { "fg":s:cyan }) -call s:h("LspErrorHighlight", { "fg": s:red, "gui": "underline", "cterm": "underline" }) -call s:h("LspWarningHighlight", { "fg": s:yellow, "gui": "underline", "cterm": "underline" }) -call s:h("LspInformationHighlight", { "fg":s:blue, "gui": "underline", "cterm": "underline" }) -call s:h("LspHintHighlight", { "fg":s:cyan, "gui": "underline", "cterm": "underline" }) - -" tpope/vim-fugitive -call s:h("diffAdded", { "fg": s:green }) -call s:h("diffRemoved", { "fg": s:red }) - -" }}} - -" Git Highlighting {{{ - -call s:h("gitcommitComment", { "fg": s:comment_grey }) -call s:h("gitcommitUnmerged", { "fg": s:green }) -call s:h("gitcommitOnBranch", {}) -call s:h("gitcommitBranch", { "fg": s:purple }) -call s:h("gitcommitDiscardedType", { "fg": s:red }) -call s:h("gitcommitSelectedType", { "fg": s:green }) -call s:h("gitcommitHeader", {}) -call s:h("gitcommitUntrackedFile", { "fg": s:cyan }) -call s:h("gitcommitDiscardedFile", { "fg": s:red }) -call s:h("gitcommitSelectedFile", { "fg": s:green }) -call s:h("gitcommitUnmergedFile", { "fg": s:yellow }) -call s:h("gitcommitFile", {}) -call s:h("gitcommitSummary", { "fg": s:white }) -call s:h("gitcommitOverflow", { "fg": s:red }) -hi link gitcommitNoBranch gitcommitBranch -hi link gitcommitUntracked gitcommitComment -hi link gitcommitDiscarded gitcommitComment -hi link gitcommitSelected gitcommitComment -hi link gitcommitDiscardedArrow gitcommitDiscardedFile -hi link gitcommitSelectedArrow gitcommitSelectedFile -hi link gitcommitUnmergedArrow gitcommitUnmergedFile - -" }}} - -" Neovim-Specific Highlighting {{{ - -if has("nvim") - " Neovim terminal colors {{{ - let g:terminal_color_0 = s:black.gui - let g:terminal_color_1 = s:red.gui - let g:terminal_color_2 = s:green.gui - let g:terminal_color_3 = s:yellow.gui - let g:terminal_color_4 = s:blue.gui - let g:terminal_color_5 = s:purple.gui - let g:terminal_color_6 = s:cyan.gui - let g:terminal_color_7 = s:white.gui - let g:terminal_color_8 = s:visual_grey.gui - let g:terminal_color_9 = s:dark_red.gui - let g:terminal_color_10 = s:green.gui " No dark version - let g:terminal_color_11 = s:dark_yellow.gui - let g:terminal_color_12 = s:blue.gui " No dark version - let g:terminal_color_13 = s:purple.gui " No dark version - let g:terminal_color_14 = s:cyan.gui " No dark version - let g:terminal_color_15 = s:comment_grey.gui - let g:terminal_color_background = s:background.gui - let g:terminal_color_foreground = s:foreground.gui - " }}} - - " Neovim Diagnostics {{{ - call s:h("DiagnosticError", { "fg": s:red }) - call s:h("DiagnosticWarn", { "fg": s:yellow }) - call s:h("DiagnosticInfo", { "fg": s:blue }) - call s:h("DiagnosticHint", { "fg": s:cyan }) - call s:h("DiagnosticUnderlineError", { "fg": s:red, "gui": "underline", "cterm": "underline" }) - call s:h("DiagnosticUnderlineWarn", { "fg": s:yellow, "gui": "underline", "cterm": "underline" }) - call s:h("DiagnosticUnderlineInfo", { "fg": s:blue, "gui": "underline", "cterm": "underline" }) - call s:h("DiagnosticUnderlineHint", { "fg": s:cyan, "gui": "underline", "cterm": "underline" }) - " }}} - - " Neovim LSP (for versions < 0.5.1) {{{ - hi link LspDiagnosticsDefaultError DiagnosticError - hi link LspDiagnosticsDefaultWarning DiagnosticWarn - hi link LspDiagnosticsDefaultInformation DiagnosticInfo - hi link LspDiagnosticsDefaultHint DiagnosticHint - hi link LspDiagnosticsUnderlineError DiagnosticUnderlineError - hi link LspDiagnosticsUnderlineWarning DiagnosticUnderlineWarn - hi link LspDiagnosticsUnderlineInformation DiagnosticUnderlineInfo - hi link LspDiagnosticsUnderlineHint DiagnosticUnderlineHint - " }}} -endif - -" }}} - -" Must appear at the end of the file to work around this oddity: -" https://groups.google.com/forum/#!msg/vim_dev/afPqwAFNdrU/nqh6tOM87QUJ -set background=dark diff --git a/.config/nvim/dev.vim b/.config/nvim/dev.vim deleted file mode 100644 index 23afa9f..0000000 --- a/.config/nvim/dev.vim +++ /dev/null @@ -1,106 +0,0 @@ -source ~/.config/nvim/init.vim - -packadd! onedark.vim -" packadd! fzf -packadd! fzf.vim -packadd! vim-jsx-pretty -packadd! copilot.vim - -" --> Fzf -source ~/.config/nvim/other/fzf.vim -set rtp+=/usr/share/vim/vimfiles - -" --> Zeal docs -let g:zv_disable_mapping = 1 -nmap <leader>z <Plug>Zeavim -vmap <leader>z <Plug>ZVVisSelection -nmap gz <Plug>ZVOperator -nmap <leader><leader>z <Plug>ZVKeyDocset - -" --> COC -autocmd! User coc.nvim source $HOME/.config/nvim/coc/coc-onload.vim -let g:coc_config_home = '$HOME/.config/nvim/coc' -let g:coc_data_home = '$HOME/.local/share/nvim/site/coc' -let g:coc_global_extensions = [ - \ 'coc-json', - \ 'coc-marketplace', - \ 'coc-css', - \ 'coc-tsserver', - \ 'coc-pyright', - \ 'coc-sh', - \ ] -nnoremap <silent><nowait> <leader>ca :<C-u>CocList diagnostics<cr> -nnoremap <silent><nowait> <leader>ce :<C-u>CocList extensions<cr> -nnoremap <silent><nowait> <leader>cc :<C-u>CocList commands<cr> -nnoremap <silent><nowait> <leader>co :<C-u>CocList outline<cr> -nnoremap <silent><nowait> <leader>cs :<C-u>CocList -I symbols<cr> -nnoremap <silent><nowait> <leader>cj :<C-u>CocNext<CR> -nnoremap <silent><nowait> <leader>ck :<C-u>CocPrev<CR> -nnoremap <silent><nowait> <leader>cp :<C-u>CocListResume<CR> -nnoremap <leader>cm :CocList marketplace<CR> -nnoremap <leader>cff :Format<CR> -inoremap <silent><expr><c-l> coc#refresh() - -" --> Vimspector -let g:vimspector_base_dir = expand('$HOME/.local/share/nvim/vimspector') -let g:vimspector_enable_mappings = 'HUMAN' -nnoremap <leader>dc <Plug>VimspectorContinue -nnoremap <leader>ds <Plug>VimspectorStop -nnoremap <leader>dr <Plug>VimspectorRestart -nnoremap <leader>dp <Plug>VimspectorPause -nnoremap <leader>dl <Plug>VimspectorBreakpoints -nnoremap <leader>dd <Plug>VimspectorToggleBreakpoint -nnoremap <leader>db <Plug>VimspectorToggleConditionalBreakpoint -nnoremap <leader>df <Plug>VimspectorAddFunctionBreakpoint -nnoremap <leader>dg <Plug>VimspectorGoToCurrentLine -nnoremap <leader>dx :call vimspector#ClearBreakpoints()<CR> -nnoremap <leader>dq :VimspectorReset<CR> -nnoremap <A-C> <Plug>VimspectorContinue -nnoremap <A-n> <Plug>VimspectorStepOver -nnoremap <A-i> <Plug>VimspectorStepInto -nnoremap <A-o> <Plug>VimspectorStepOut -nnoremap <A-b> <Plug>VimspectorToggleBreakpoint -nnoremap <A-c> <Plug>VimspectorRunToCursor - -" --> onedark theme -if exists('+termguicolors') - let g:airline_theme = 'onedark' - let g:onedark_terminal_italics = 1 - let g:onedark_color_overrides = { - \ "foreground": { "gui": "#BBC2CF", "cterm": "145", "cterm16": "NONE" }, - \ "background": { "gui": "#181C24", "cterm": "235", "cterm16": "NONE" }, - \ "comment_grey": { "gui": "#6C7380", "cterm": "59", "cterm16": "7" }, - \ "gutter_fg_grey": { "gui": "#6272A4", "cterm": "238", "cterm16": "8" }, - \ "special_grey": { "gui": "#5Ba078", "cterm": "238", "cterm16": "7" }, - \ } - " \ "background": { "gui": "#202426", "cterm": "235", "cterm16": "NONE" }, - " - " \ "red": { "gui": "#E06C75", "cterm": "204", "cterm16": "1" }, - " \ "dark_red": { "gui": "#BE5046", "cterm": "196", "cterm16": "9" }, - " \ "green": { "gui": "#98C379", "cterm": "114", "cterm16": "2" }, - " \ "yellow": { "gui": "#E5C07B", "cterm": "180", "cterm16": "3" }, - " \ "dark_yellow": { "gui": "#D19A66", "cterm": "173", "cterm16": "11" }, - " \ "blue": { "gui": "#61AFEF", "cterm": "39", "cterm16": "4" }, - " \ "purple": { "gui": "#C678DD", "cterm": "170", "cterm16": "5" }, - " \ "cyan": { "gui": "#56B6C2", "cterm": "38", "cterm16": "6" }, - " \ "black": { "gui": "#282C34", "cterm": "235", "cterm16": "0" }, - " \ "white": { "gui": "#ABB2BF", "cterm": "145", "cterm16": "15" }, - " \ "cursor_grey": { "gui": "#2C323C", "cterm": "236", "cterm16": "0" }, - " \ "visual_grey": { "gui": "#3E4452", "cterm": "237", "cterm16": "8" }, - " \ "menu_grey": { "gui": "#3E4452", "cterm": "237", "cterm16": "7" }, - " \ "vertsplit": { "gui": "#3E4452", "cterm": "59", "cterm16": "7" }, - - " autocmd ColorScheme * call onedark#extend_highlight("LineNr", { - " \ "fg": { "gui": "#6272A4", "cterm": "238", "cterm16": "8" }, - " \ }) - let &t_8f="\<Esc>[38;2;%lu;%lu;%lum" - let &t_8b="\<Esc>[48;2;%lu;%lu;%lum" - " set termguicolors noshowmode - colorscheme onedark - " autocmd VimEnter * AirlineTheme -endif - -nnoremap <leader><C-r> :source ~/.config/nvim/dev.vim<CR> - -AirlineTheme -CocList extensions diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index e9772ee..eeedeae 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -32,9 +32,14 @@ if filereadable(config_dir . "autoload/plug.vim") call plug#end() endif +packadd fzf.vim +source ~/.config/nvim/user/fzf.vim +set rtp+=/usr/share/vim/vimfiles + let g:Verdin#autocomplete = 1 let g:livepreview_previewer = 'zathura' let g:tex_flavor = 'latex' +let g:session_filename = '.session.vim' set title showmatch nowrap mouse=a scrolloff=5 set tabstop=2 shiftwidth=0 @@ -51,33 +56,19 @@ colorscheme vim highlight NonText ctermfg=242 highlight ColorColumn ctermbg=238 highlight! link CursorColumn ColorColumn +highlight FloatermBorder guibg=orange guifg=cyan autocmd FileType text,fstab setlocal tabstop=8 shiftwidth=8 autocmd FileType html setlocal tabstop=2 shiftwidth=2 list nolinebreak autocmd FileType sql setlocal commentstring=--\ %s +autocmd BufWritePre * %s/\s\+$//e autocmd BufEnter bm-files,bm-dirs setlocal tabstop=8 shiftwidth=8 autocmd BufWritePost bm-files,bm-dirs silent !shortcuts -autocmd VimLeave *.tex !dev clean "%" autocmd BufWritePost config.def.h !cd "%:h"; rm -f config.h; sudo make install autocmd BufWritePost config.h !cd "%:h"; sudo make install -autocmd BufWritePre * %s/\s\+$//e -au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif - -autocmd BufWritePost */Documents/Notes/*.md silent !pandoc % -o "$HOME/Documents/Notes/.out/$(basename % .md).html" -" autocmd BufWritePost */Documents/latex/resume/resume.tex !cd "%:h"; pdflatex resume.tex; cp -v resume.pdf ~/Dev/vikas.rocks/static/dox/ autocmd BufWritePost *Xresources silent !xrdb "%" autocmd BufRead,BufNewFile *.yt* set filetype=conf - -function SourceTemplate() - let b:template = glob("${XDG_CONFIG_HOME:-$HOME/.config}/nvim/templates/_default." . expand('%:e')) - if !empty(b:template) - execute('0r' . b:template) - endif -endfunction - -autocmd BufNewFile * call SourceTemplate() - -autocmd TermOpen * startinsert -command! -nargs=* T split | terminal <args> +autocmd VimLeave *.tex !dev clean "%" +au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif " --> Scratch buffer if exists('g:loaded_scratch') @@ -98,6 +89,44 @@ nnoremap <Esc>o :LfWorkingDirectory<CR> nnoremap <leader>l :LfCurrentFileNewTab<CR> nnoremap <leader>o :LfWorkingDirectoryExistingOrNewTab<CR> +" --> Sessions + +fu! SaveSess() + execute 'mksession! ' . getcwd() . '/' . g:session_filename +endfunction + +fu! RestoreSess() +if filereadable(getcwd() . '/' . g:session_filename) + execute 'so ' . getcwd() . '/' . g:session_filename + if bufexists(1) + for l in range(1, bufnr('$')) + if bufwinnr(l) == -1 + exec 'sbuffer ' . l + endif + endfor + endif +endif +endfunction + +command! -nargs=0 Mksess :call SaveSess() +command! -nargs=0 Resess :call RestoreSess() + +" --> Template Management + +function SourceTemplate() + let b:template = glob("${XDG_CONFIG_HOME:-$HOME/.config}/nvim/templates/_default." . expand('%:e')) + if !empty(b:template) + execute('0r' . b:template) + endif +endfunction + +autocmd BufNewFile * call SourceTemplate() + +autocmd TermOpen * startinsert +command! -nargs=* T split | terminal <args> + +" --> Bindings and configs + if !exists('g:lasttab') let g:lasttab = 1 endif @@ -124,25 +153,37 @@ inoremap jk <Esc> inoremap ;n <Esc>/<++><Enter>c4l nnoremap <leader>n /<++><Enter>c4l -inoremap ;s ><Esc>bi<<Esc>ea -inoremap ;c ><Esc>bi</<Esc>ea -inoremap ;i <Esc>b"tywi<<Esc>ea></><Esc>PF<i -inoremap ;I <Esc>b"tywi<<Esc>ea><++></><Esc>P2F>i<Space> -inoremap ;b <Esc>b"tywi<<Esc>ea><CR></<Esc>"tpa><CR><++><Esc>kO -inoremap ;B <Esc>b"tywi<<Esc>ea><CR><++><CR></<Esc>"tpa><CR><++><Esc>3k$i<Space> -inoremap ;ap <p><CR><++><CR></p><CR><++><Esc>3k$i -inoremap ;aa <a href=""><CR><++><CR></a><CR><++><Esc>3k$hi +augroup Web + autocmd! + autocmd FileType html,javascript call SetWebBindings() + function SetWebBindings() + inoremap ;s ><Esc>bi<<Esc>ea + inoremap ;c ><Esc>bi</<Esc>ea + inoremap ;i <Esc>b"tywi<<Esc>ea></><Esc>PF<i + inoremap ;I <Esc>b"tywi<<Esc>ea><++></><Esc>P2F>i<Space> + inoremap ;b <Esc>b"tywi<<Esc>ea><CR></<Esc>"tpa><CR><++><Esc>kO + inoremap ;B <Esc>b"tywi<<Esc>ea><CR><++><CR></<Esc>"tpa><CR><++><Esc>3k$i<Space> + inoremap ;ap <p><CR></p><CR><++><Esc>kO + inoremap ;aP <p></p><Esc>F<i + inoremap ;aa <a href=""><CR><++><CR></a><CR><++><Esc>3k$hi + inoremap ;aA <a href=""><++></a><Esc>F"i + inoremap ;cl console.log("");<Esc>F"i + endfunction +augroup END augroup Tex autocmd! - autocmd FileType tex inoremap ;b <Esc>b"tywi\begin{<Esc>ea}<CR>\end{<Esc>"tpa}<Esc>kA - autocmd FileType tex inoremap ;s \section{}<Esc>i - autocmd FileType tex inoremap ;at \begin{tikzpicture}<CR>\end{tikzpicture}<Esc>O - autocmd FileType tex inoremap ;ap \usepackage{}<Esc>i - autocmd FileType tex inoremap ;aP \usepackage[]{}<Esc>F[a - autocmd FileType tex inoremap ;ab \textbf{}<Esc>i - autocmd FileType tex inoremap ;ai \textit{}<Esc>i - autocmd FileType tex inoremap ;au \underline{}<Esc>i + autocmd FileType tex call SetTexBindings() + function SetTexBindings() + inoremap ;b <Esc>b"tywi\begin{<Esc>ea}<CR>\end{<Esc>"tpa}<Esc>kA + inoremap ;s \section{}<Esc>i + inoremap ;at \begin{tikzpicture}<CR>\end{tikzpicture}<Esc>O + inoremap ;ap \usepackage{}<Esc>i + inoremap ;aP \usepackage[]{}<Esc>F[a + inoremap ;ab \textbf{}<Esc>i + inoremap ;ai \textit{}<Esc>i + inoremap ;au \underline{}<Esc>i + endfunction augroup END autocmd FileType go inoremap ;ae err<Space>:=<Space><++><CR>if<Space>err<Space>!=<Space>nil<Space>{<CR>return<Space>err<CR>}<Esc>3kI @@ -163,23 +204,18 @@ nnoremap <leader>Fe :w<CR>:T dev run "%"<CR> nnoremap <leader>Ft :w<CR>:T dev test "%"<CR> nnoremap <leader>Fr :w<CR>:T dev clean "%"<CR> -autocmd BufEnter * nmap <leader>b :w<CR>:se nornu<CR>:!dev build "%"<CR>:se rnu<CR> -autocmd BufEnter * nmap <leader>B :w<CR>:se nornu<CR>:T dev build "%"<CR> -autocmd BufEnter * nmap <leader>t :w<CR>:se nornu<CR>:!dev test "%"<CR>:se rnu<CR> -autocmd BufEnter * nmap <leader>T :w<CR>:se nornu<CR>:T dev test "%"<CR> - -autocmd BufEnter vartak-results-data.pl nmap <leader>t :w<CR>:se nornu<CR>:!vartak-results-data.pl ~/GDrive/vartak/results/university/1S002557.pdf<CR>:se rnu<CR> +nnoremap <leader>b :w<CR>:se nornu<CR>:!dev build "%"<CR>:se rnu<CR> +nnoremap <leader>B :w<CR>:se nornu<CR>:T dev build "%"<CR> +nnoremap <leader>t :w<CR>:se nornu<CR>:!dev test "%"<CR>:se rnu<CR> +nnoremap <leader>T :w<CR>:se nornu<CR>:T dev test "%"<CR> nnoremap <leader>w :set wrap!<CR> nnoremap <leader>fo :!opout "%:p"<CR> -nnoremap <leader>ei :tabnew ~/.config/nvim/init.vim<CR> -nnoremap <leader>eo :tabnew ~/.config/nvim/coc/coc-onload.vim<CR> -nnoremap <leader>ec :tabnew ~/.config/nvim/coc/coc-settings.json<CR> -nnoremap <leader>ed :tabnew ~/.config/nvim/dev.vim<CR> nnoremap <leader><C-r> :source ~/.config/nvim/init.vim<CR> nnoremap <leader>s :%s//gc<Left><Left><Left> nnoremap <leader>gc :T git add --all && git commit<CR> +nnoremap <leader>gp :T gitpush<CR> let shortcuts = config_dir . "shortcuts.vim" if filereadable(shortcuts) diff --git a/.config/nvim/other/learn.vim b/.config/nvim/other/learn.vim deleted file mode 100644 index c3272d9..0000000 --- a/.config/nvim/other/learn.vim +++ /dev/null @@ -1,649 +0,0 @@ -" ############## -" Introduction -" ############## -" -" Vim script (also called VimL) is the subset of Vim's ex-commands which -" supplies a number of features one would expect from a scripting language, -" such as values, variables, functions or loops. Always keep in the back of -" your mind that a Vim script file is just a sequence of ex-commands. It is -" very common for a script to mix programming-language features and raw -" ex-commands. -" -" You can run Vim script directly by entering the commands in command-line mode -" (press `:` to enter command-line mode), or you can write them to a file -" (without the leading `:`) and source it in a running Vim instance (`:source -" path/to/file`). Some files are sourced automatically as part of your -" configuration (see |startup|). This guide assumes that you are familiar -" with ex-commands and will only cover the scripting. Help topics to the -" relevant manual sections are included. -" -" See |usr_41.txt| for the official introduction to Vim script. A comment is -" anything following an unmatched `"` until the end of the line, and `|` -" separates instructions (what `;` does in most other languages). References to -" the manual as surrounded with `|`, such as |help.txt|. - -" This is a comment - -" The vertical line '|' (pipe) separates commands -echo 'Hello' | echo 'world!' - -" Putting a comment after a command usually works -pwd " Displays the current working directory - -" Except for some commands it does not; use the command delimiter before the -" comment (echo assumes that the quotation mark begins a string) -echo 'Hello world!' | " Displays a message - -" Line breaks can be escaped by placing a backslash as the first non-whitespace -" character on the *following* line. Only works in script files, not on the -" command line -echo " Hello - \ world " - -echo [1, - \ 2] - -echo { - \ 'a': 1, - \ 'b': 2 -\} - - -" ####### -" Types -" ####### -" -" For an overview of types see |E712|. For an overview of operators see -" |expression-syntax| - -" Numbers (|expr-number|) -" ####### - -echo 123 | " Decimal -echo 0b1111011 | " Binary -echo 0173 | " Octal -echo 0x7B | " Hexadecimal -echo 123.0 | " Floating-point -echo 1.23e2 | " Floating-point (scientific notation) - -" Note that an *integer* number with a leading `0` is in octal notation. The -" usual arithmetic operations are supported. - -echo 1 + 2 | " Addition -echo 1 - 2 | " Subtraction -echo - 1 | " Negation (unary minus) -echo + 1 | " Unary plus (does nothing really, but still legal) -echo 1 * 2 | " Multiplication -echo 1 / 2 | " Division -echo 1 % 2 | " Modulo (remainder) - -" Booleans (|Boolean|) -" ######## -" -" The number 0 is false, every other number is true. Strings are implicitly -" converted to numbers (see below). There are two pre-defined semantic -" constants. - -echo v:true | " Evaluates to 1 or the string 'v:true' -echo v:false | " Evaluates to 0 or the string 'v:false' - -" Boolean values can result from comparison of two objects. - -echo x == y | " Equality by value -echo x != y | " Inequality -echo x > y | " Greater than -echo x >= y | " Greater than or equal -echo x < y | " Smaller than -echo x <= y | " Smaller than or equal -echo x is y | " Instance identity (lists and dictionaries) -echo x isnot y | " Instance non-identity (lists and dictionaries) - -" Strings are compared based on their alphanumerical ordering -" echo 'a' < 'b'. Case sensitivity depends on the setting of 'ignorecase' -" -" Explicit case-sensitivity is specified by appending '#' (match case) or '?' -" (ignore case) to the operator. Prefer explicitly case sensitivity when writing -" portable scripts. - -echo 'a' < 'B' | " True or false depending on 'ignorecase' -echo 'a' <? 'B' | " True -echo 'a' <# 'B' | " False - -" Regular expression matching -echo "hi" =~ "hello" | " Regular expression match, uses 'ignorecase' -echo "hi" =~# "hello" | " Regular expression match, case sensitive -echo "hi" =~? "hello" | " Regular expression match, case insensitive -echo "hi" !~ "hello" | " Regular expression unmatch, use 'ignorecase' -echo "hi" !~# "hello" | " Regular expression unmatch, case sensitive -echo "hi" !~? "hello" | " Regular expression unmatch, case insensitive - -" Boolean operations are possible. - -echo v:true && v:false | " Logical AND -echo v:true || v:false | " Logical OR -echo ! v:true | " Logical NOT -echo v:true ? 'yes' : 'no' | " Ternary operator - - -" Strings (|String|) -" ####### -" -" An ordered zero-indexed sequence of bytes. The encoding of text into bytes -" depends on the option |'encoding'|. - -" Literal constructors -echo "Hello world\n" | " The last two characters stand for newline -echo 'Hello world\n' | " The last two characters are literal -echo 'Let''s go!' | " Two single quotes become one quote character - -" Single-quote strings take all characters are literal, except two single -" quotes, which are taken to be a single quote in the string itself. See -" |expr-quote| for all possible escape sequences. - -" String concatenation -" The .. operator is preferred, but only supported in since Vim 8.1.1114 -echo 'Hello ' . 'world' | " String concatenation -echo 'Hello ' .. 'world' | " String concatenation (new variant) - -" String indexing -echo 'Hello'[0] | " First byte -echo 'Hello'[1] | " Second byte -echo 'Hellö'[4] | " Returns a byte, not the character 'ö' - -" Substrings (second index is inclusive) -echo 'Hello'[:] | " Copy of entire string -echo 'Hello'[1:3] | " Substring, second to fourth byte -echo 'Hello'[1:-2] | " Substring until second to last byte -echo 'Hello'[1:] | " Substring with starting index -echo 'Hello'[:2] | " Substring with ending index -echo 'Hello'[-2:] | " Substring relative to end of string - -" A negative index is relative to the end of the string. See -" |string-functions| for all string-related functions. - -" Lists (|List|) -" ##### -" -" An ordered zero-indexed heterogeneous sequence of arbitrary Vim script -" objects. - -" Literal constructor -echo [] | " Empty list -echo [1, 2, 'Hello'] | " List with elements -echo [1, 2, 'Hello', ] | " Trailing comma permitted -echo [[1, 2], 'Hello'] | " Lists can be nested arbitrarily - -" List concatenation -echo [1, 2] + [3, 4] | " Creates a new list - -" List indexing, negative is relative to end of list (|list-index|) -echo [1, 2, 3, 4][2] | " Third element -echo [1, 2, 3, 4][-1] | " Last element - -" List slicing (|sublist|) -echo [1, 2, 3, 4][:] | " Shallow copy of entire list -echo [1, 2, 3, 4][:2] | " Sublist until third item (inclusive) -echo [1, 2, 3, 4][2:] | " Sublist from third item (inclusive) -echo [1, 2, 3, 4][:-2] | " Sublist until second-to-last item (inclusive) - -" All slicing operations create new lists. To modify a list in-place use list -" functions (|list-functions|) or assign directly to an item (see below about -" variables). - - -" Dictionaries (|Dictionary|) -" ############ -" -" An unordered sequence of key-value pairs, keys are always strings (numbers -" are implicitly converted to strings). - -" Dictionary literal -echo {} | " Empty dictionary -echo {'a': 1, 'b': 2} | " Dictionary literal -echo {'a': 1, 'b': 2, } | " Trailing comma permitted -echo {'x': {'a': 1, 'b': 2}} | " Nested dictionary - -" Indexing a dictionary -echo {'a': 1, 'b': 2}['a'] | " Literal index -echo {'a': 1, 'b': 2}.a | " Syntactic sugar for simple keys - -" See |dict-functions| for dictionary manipulation functions. - - -" Funcref (|Funcref|) -" ####### -" -" Reference to a function, uses the function name as a string for construction. -" When stored in a variable the name of the variable has the same restrictions -" as a function name (see below). - -echo function('type') | " Reference to function type() -" Note that `funcref('type')` will throw an error because the argument must be -" a user-defined function; see further below for defining your own functions. -echo funcref('type') | " Reference by identity, not name -" A lambda (|lambda|) is an anonymous function; it can only contain one -" expression in its body, which is also its implicit return value. -echo {x -> x * x} | " Anonymous function -echo function('substitute', ['hello']) | " Partial function - - -" Regular expression (|regular-expression|) -" ################## -" -" A regular expression pattern is generally a string, but in some cases you can -" also use a regular expression between a pair of delimiters (usually `/`, but -" you can choose anything). - -" Substitute 'hello' for 'Hello' -substitute/hello/Hello/ - - -" ########################### -" Implicit type conversions -" ########################### -" -" Strings are converted to numbers, and numbers to strings when necessary. A -" number becomes its decimal notation as a string. A string becomes its -" numerical value if it can be parsed to a number, otherwise it becomes zero. - -echo "1" + 1 | " Number -echo "1" .. 1 | " String -echo "0xA" + 1 | " Number - -" Strings are treated like numbers when used as booleans -echo "true" ? 1 : 0 | " This string is parsed to 0, which is false - -" ########### -" Variables -" ########### -" -" Variables are bound within a scope; if no scope is provided a default is -" chosen by Vim. Use `:let` and `:const` to bind a value and `:unlet` to unbind -" it. - -let b:my_var = 1 | " Local to current buffer -let w:my_var = 1 | " Local to current window -let t:my_var = 1 | " Local to current tab page -let g:my_var = 1 | " Global variable -let l:my_var = 1 | " Local to current function (see functions below) -let s:my_var = 1 | " Local to current script file -let a:my_arg = 1 | " Function argument (see functions below) - -" The Vim scope is read-only -echo v:true | " Special built-in Vim variables (|v:var|) - -" Access special Vim memory like variables -let @a = 'Hello' | " Register -let $PATH='' | " Environment variable -let &textwidth = 79 | " Option -let &l:textwidth = 79 | " Local option -let &g:textwidth = 79 | " Global option - -" Access scopes as dictionaries (can be modified like all dictionaries) -" See the |dict-functions|, especially |get()|, for access and manipulation -echo b: | " All buffer variables -echo w: | " All window variables -echo t: | " All tab page variables -echo g: | " All global variables -echo l: | " All local variables -echo s: | " All script variables -echo a: | " All function arguments -echo v: | " All Vim variables - -" Constant variables -const x = 10 | " See |:const|, |:lockvar| - -" Function reference variables have the same restrictions as function names -let IsString = {x -> type(x) == type('')} | " Global: capital letter -let s:isNumber = {x -> type(x) == type(0)} | " Local: any name allowed - -" When omitted the scope `g:` is implied, except in functions, there `l:` is -" implied. - - -" Multiple value binding (list unpacking) -" ####################################### -" -" Assign values of list to multiple variables (number of items must match) -let [x, y] = [1, 2] - -" Assign the remainder to a rest variable (note the semicolon) -let [mother, father; children] = ['Alice', 'Bob', 'Carol', 'Dennis', 'Emily'] - - -" ############## -" Flow control -" ############## - -" Conditional (|:if|, |:elseif|, |:else|, |:endif|) -" ########### -" -" Conditions are set between `if` and `endif`. They can be nested. - -let condition = v:true - -if condition - echo 'First condition' -elseif another_condition - echo 'Second condition' -else - echo 'Fail' -endif - -" Loops (|:for|, |:endfor|, |:while|, |:endwhile|, |:break|, |:continue|) -" ##### -" -" Two types of loops: `:for` and `:while`. Use `:continue` to skip to the next -" iteration, `:break` to break out of the loop. - -" For-loop (|:for|, |:endfor|) -" ======== -" -" For-loops iterate over lists and nothing else. If you want to iterate over -" another sequence you need to use a function which will create a list. - -" Iterate over a list -for person in ['Alice', 'Bob', 'Carol', 'Dennis', 'Emily'] - echo 'Hello ' .. person -endfor - -" Iterate over a nested list by unpacking it -for [x, y] in [[1, 0], [0, 1], [-1, 0], [0, -1]] - echo 'Position: x =' .. x .. ', y = ' .. y -endfor - -" Iterate over a range of numbers -for i in range(10, 0, -1) " Count down from 10 - echo 'T minus' .. i -endfor - -" Iterate over the keys of a dictionary -for symbol in keys({'π': 3.14, 'e': 2.71}) - echo 'The constant ' .. symbol .. ' is a transcendent number' -endfor - -" Iterate over the values of a dictionary -for value in values({'π': 3.14, 'e': 2.71}) - echo 'The value ' .. value .. ' approximates a transcendent number' -endfor - -" Iterate over the keys and values of a dictionary -for [symbol, value] in items({'π': 3.14, 'e': 2.71}) - echo 'The number ' .. symbol .. ' is approximately ' .. value -endfor - -" While-loops (|:while|, |:endwhile|) - -let there_yet = v:true -while !there_yet - echo 'Are we there yet?' -endwhile - - -" Exception handling (|exception-handling|) -" ################## -" -" Throw new exceptions as strings, catch them by pattern-matching a regular -" expression against the string - -" Throw new exception -throw "Wrong arguments" - -" Guard against an exception (the second catch matches any exception) -try - source path/to/file -catch /Cannot open/ - echo 'Looks like that file does not exist' -catch /.*/ - echo 'Something went wrong, but I do not know what' -finally - echo 'I am done trying' -endtry - - -" ########## -" Functions -" ########## - -" Defining functions (|:function|, |:endfunction|) -" ################## - -" Unscoped function names have to start with a capital letter -function! AddNumbersLoudly(x, y) - " Use a: scope to access arguments - echo 'Adding' .. a:x .. 'and' .. a:y | " A side effect - return a:x + a:y | " A return value -endfunction - -" Scoped function names may start with a lower-case letter -function! s:addNumbersLoudly(x, y) - echo 'Adding' .. a:x .. 'and' .. a:y - return a:x + a:y -endfunction - -" Without the exclamation mark it would be an error to re-define a function, -" with the exclamation mark the new definition can replace the old one. Since -" Vim script files can be reloaded several times over the course of a session -" it is best to use the exclamation mark unless you really know what you are -" doing. - -" Function definitions can have special qualifiers following the argument list. - -" Range functions define two implicit arguments, which will be set to the range -" of the ex-command -function! FirstAndLastLine() range - echo [a:firstline, a:lastline] -endfunction - -" Prints the first and last line that match a pattern (|cmdline-ranges|) -/^#!/,/!#$/call FirstAndLastLine() - -" Aborting functions, abort once error occurs (|:func-abort|) -function! SourceMyFile() abort - source my-file.vim | " Try sourcing non-existing file - echo 'This will never be printed' -endfunction - -" Closures, functions carrying values from outer scope (|:func-closure|) -function! MakeAdder(x) - function! Adder(n) closure - return a:n + a:x - endfunction - return funcref('Adder') -endfunction -let AddFive = MakeAdder(5) -echo AddFive(3) | " Prints 8 - -" Dictionary functions, poor man's OOP methods (|Dictionary-function|) -function! Mylen() dict - return len(self.data) | " Implicit variable self -endfunction -let mydict = {'data': [0, 1, 2, 3], 'len': function("Mylen")} -echo mydict.len() - -" Alternatively, more concise -let mydict = {'data': [0, 1, 2, 3]} -function! mydict.len() - return len(self.data) -endfunction - -" Calling functions (|:call|) -" ################# - -" Call a function for its return value, and possibly for its side effects -let animals = keys({'cow': 'moo', 'dog': 'woof', 'cat': 'meow'}) - -" Call a function for its side effects only, ignore potential return value -call sign_undefine() - -" The call() function calls a function reference and passes parameters as a -" list, and returns the function's result. -echo call(function('get'), [{'a': 1, 'b': 2}, 'c', 3]) | " Prints 3 - -" Recall that Vim script is embedded within the ex-commands, that is why we -" cannot just call a function directly, we have to use the `:call` ex-command. - -" Function namespaces (|write-library-script|, |autoload|) -" ################### - -" Must be defined in autoload/foo/bar.vim -" Namspaced function names do not have to start with a capital letter -function! foo#bar#log(value) - echomsg value -endfunction - -call foo#bar#log('Hello') - - -" ############################# -" Frequently used ex-commands -" ############################# - - -" Sourcing runtime files (|'runtimepath'|) -" ###################### - -" Source first match among runtime paths -runtime plugin/my-plugin.vim - - -" Defining new ex-commands (|40.2|, |:command|) -" ######################## - -" First argument here is the name of the command, rest is the command body -command! SwapAdjacentLines normal! ddp - -" The exclamation mark works the same as with `:function`. User-defined -" commands must start with a capital letter. The `:command` command can take a -" number of attributes (some of which have their own parameters with `=`), such -" as `-nargs`, all of them start with a dash to set them apart from the command -" name. - -command! -nargs=1 Error echoerr <args> - - -" Defining auto-commands (|40.3|, |autocmd|, |autocommand-events|) -" ###################### - -" The arguments are "events", "patterns", rest is "commands" -autocmd BufWritePost $MYVIMRC source $MYVIMRC - -" Events and patterns are separated by commas with no space between. See -" |autocmd-events| for standard events, |User| for custom events. Everything -" else are the ex-commands which will be executed. - -" Auto groups -" =========== -" -" When a file is sourced multiple times the auto-commands are defined anew, -" without deleting the old ones, causing auto-commands to pile up over time. -" Use auto-groups and the following ritual to guard against this. - -augroup auto-source | " The name of the group is arbitrary - autocmd! | " Deletes all auto-commands in the current group - autocmd BufWritePost $MYVIMRC source $MYVIMRC -augroup END | " Switch back to default auto-group - -" It is also possible to assign a group directly. This is useful if the -" definition of the group is in one script and the definition of the -" auto-command is in another script. - -" In one file -augroup auto-source - autocmd! -augroup END - -" In another file -autocmd auto-source BufWritePost $MYVIMRC source $MYVIMRC - -" Executing (run-time macros of sorts) -" #################################### - -" Sometimes we need to construct an ex-command where part of the command is not -" known until runtime. - -let line = 3 | " Line number determined at runtime -execute line .. 'delete' | " Delete a line - -" Executing normal-mode commands -" ############################## -" -" Use `:normal` to play back a sequence of normal mode commands from the -" command-line. Add an exclamation mark to ignore user mappings. - -normal! ggddGp | " Transplant first line to end of buffer - -" Window commands can be used with :normal, or with :wincmd if :normal would -" not work -wincmd L | " Move current window all the way to the right - - -" ########################### -" Frequently used functions -" ########################### - -" Feature check -echo has('nvim') | " Running Neovim -echo has('python3') | " Support for Python 3 plugins -echo has('unix') | " Running on a Unix system -echo has('win32') | " Running on a Windows system - - -" Test if something exists -echo exists('&mouse') | " Option (exists only) -echo exists('+mouse') | " Option (exists and works) -echo exists('$HOSTNAME') | " Environment variable -echo exists('*strftime') | " Built-in function -echo exists('**s:MyFunc') | " User-defined function -echo exists('bufcount') | " Variable (scope optional) -echo exists('my_dict["foo"]') | " Variable (dictionary entry) -echo exists('my_dict["foo"]') | " Variable (dictionary entry) -echo exists(':Make') | " Command -echo exists("#CursorHold") | " Auto-command defined for event -echo exists("#BufReadPre#*.gz") | " Event and pattern -echo exists("#filetypeindent") | " Auto-command group -echo exists("##ColorScheme") | " Auto-command supported for event - -" Various dynamic values (see |expand()|) -echo expand('%') | " Current file name -echo expand('<cword>') | " Current word under cursor -echo expand('%:p') | " Modifier are possible - -" Type tests -" There are unique constants defined for the following types. Older versions -" of Vim lack the type variables, see the reference " documentation for a -" workaround -echo type(my_var) == v:t_number | " Number -echo type(my_var) == v:t_string | " String -echo type(my_var) == v:t_func | " Funcref -echo type(my_var) == v:t_list | " List -echo type(my_var) == v:t_dict | " Dictionary -echo type(my_var) == v:t_float | " Float -echo type(my_var) == v:t_bool | " Explicit Boolean -" For the null object should compare it against itself -echo my_var is v:null - -" Format strings -echo printf('%d in hexadecimal is %X', 123, 123) - - -" ##################### -" Tricks of the trade -" ##################### - -" Source guard -" ############ - -" Prevent a file from being sourced multiple times; users can set the variable -" in their configuration to prevent the plugin from loading at all. -if exists('g:loaded_my_plugin') - finish -endif -let g:loaded_my_plugin = v:true - -" Default values -" ############## - -" Get a default value: if the user defines a variable use it, otherwise use a -" hard-coded default. Uses the fact that a scope is also a dictionary. -let s:greeting = get(g:, 'my_plugin_greeting', 'Hello') diff --git a/.config/nvim/pack/plugins/opt/auto-session b/.config/nvim/pack/plugins/opt/auto-session new file mode 160000 +Subproject 00334ee24b9a05001ad50221c8daffbeedaa084 diff --git a/.config/nvim/pack/plugins/opt/vim-verdin b/.config/nvim/pack/plugins/opt/vim-verdin new file mode 160000 +Subproject b96fc398ffe09c9910bd469f22ee5170b5a46a1 diff --git a/.config/nvim/coc/coc-onload.vim b/.config/nvim/user/coc-onload.vim index c2835cc..b3db607 100644 --- a/.config/nvim/coc/coc-onload.vim +++ b/.config/nvim/user/coc-onload.vim @@ -53,6 +53,9 @@ nmap <silent> gy <Plug>(coc-type-definition) nmap <silent> gi <Plug>(coc-implementation) nmap <silent> gr <Plug>(coc-references) +" Override neovim's builtin referencing +nmap <silent> grr <Plug>(coc-references) + " Use K to show documentation in preview window nnoremap <silent> <C-k> :call ShowDocumentation()<CR> diff --git a/.config/nvim/coc/coc-settings.json b/.config/nvim/user/coc-settings.json index 2f3abdc..437572d 100644 --- a/.config/nvim/coc/coc-settings.json +++ b/.config/nvim/user/coc-settings.json @@ -4,6 +4,7 @@ "python.linting.pycodestyleEnabled": true, "html.autoCreateQuotes": false, "coc.preferences.formatOnType": true, + "copilot.showRemainingText": true, "copilot.enable": false, - "copilot.showRemainingText": true + "typescript.autoClosingTags": false } diff --git a/.config/nvim/other/fzf.vim b/.config/nvim/user/fzf.vim index 371b680..371b680 100644 --- a/.config/nvim/other/fzf.vim +++ b/.config/nvim/user/fzf.vim diff --git a/.config/nvim/user/onedark.vim b/.config/nvim/user/onedark.vim new file mode 100644 index 0000000..6f526bd --- /dev/null +++ b/.config/nvim/user/onedark.vim @@ -0,0 +1,38 @@ +" --> Onedark Theme +if exists('+termguicolors') + let g:airline_theme = 'onedark' + let g:onedark_terminal_italics = 1 + let g:onedark_color_overrides = { + \ "foreground": { "gui": "#BBC2CF", "cterm": "145", "cterm16": "NONE" }, + \ "background": { "gui": "#181C24", "cterm": "235", "cterm16": "NONE" }, + \ "comment_grey": { "gui": "#6C7380", "cterm": "59", "cterm16": "7" }, + \ "gutter_fg_grey": { "gui": "#6272A4", "cterm": "238", "cterm16": "8" }, + \ "special_grey": { "gui": "#5Ba078", "cterm": "238", "cterm16": "7" }, + \ } + " \ "background": { "gui": "#202426", "cterm": "235", "cterm16": "NONE" }, + " + " \ "red": { "gui": "#E06C75", "cterm": "204", "cterm16": "1" }, + " \ "dark_red": { "gui": "#BE5046", "cterm": "196", "cterm16": "9" }, + " \ "green": { "gui": "#98C379", "cterm": "114", "cterm16": "2" }, + " \ "yellow": { "gui": "#E5C07B", "cterm": "180", "cterm16": "3" }, + " \ "dark_yellow": { "gui": "#D19A66", "cterm": "173", "cterm16": "11" }, + " \ "blue": { "gui": "#61AFEF", "cterm": "39", "cterm16": "4" }, + " \ "purple": { "gui": "#C678DD", "cterm": "170", "cterm16": "5" }, + " \ "cyan": { "gui": "#56B6C2", "cterm": "38", "cterm16": "6" }, + " \ "black": { "gui": "#282C34", "cterm": "235", "cterm16": "0" }, + " \ "white": { "gui": "#ABB2BF", "cterm": "145", "cterm16": "15" }, + " \ "cursor_grey": { "gui": "#2C323C", "cterm": "236", "cterm16": "0" }, + " \ "visual_grey": { "gui": "#3E4452", "cterm": "237", "cterm16": "8" }, + " \ "menu_grey": { "gui": "#3E4452", "cterm": "237", "cterm16": "7" }, + " \ "vertsplit": { "gui": "#3E4452", "cterm": "59", "cterm16": "7" }, + + " autocmd ColorScheme * call onedark#extend_highlight("LineNr", { + " \ "fg": { "gui": "#6272A4", "cterm": "238", "cterm16": "8" }, + " \ }) + let &t_8f="\<Esc>[38;2;%lu;%lu;%lum" + let &t_8b="\<Esc>[48;2;%lu;%lu;%lum" + " set termguicolors noshowmode + colorscheme onedark + " autocmd VimEnter * AirlineTheme +endif + diff --git a/.config/nvim/other/out.vim b/.config/nvim/user/out.vim index 6e4e1f1..6e4e1f1 100644 --- a/.config/nvim/other/out.vim +++ b/.config/nvim/user/out.vim diff --git a/.config/nvim/user/vimspector.vim b/.config/nvim/user/vimspector.vim new file mode 100644 index 0000000..521e252 --- /dev/null +++ b/.config/nvim/user/vimspector.vim @@ -0,0 +1,21 @@ +" --> Vimspector +let g:vimspector_base_dir = expand('$HOME/.local/share/nvim/vimspector') +let g:vimspector_enable_mappings = 'HUMAN' +nnoremap <leader>dc <Plug>VimspectorContinue +nnoremap <leader>ds <Plug>VimspectorStop +nnoremap <leader>dr <Plug>VimspectorRestart +nnoremap <leader>dp <Plug>VimspectorPause +nnoremap <leader>dl <Plug>VimspectorBreakpoints +nnoremap <leader>dd <Plug>VimspectorToggleBreakpoint +nnoremap <leader>db <Plug>VimspectorToggleConditionalBreakpoint +nnoremap <leader>df <Plug>VimspectorAddFunctionBreakpoint +nnoremap <leader>dg <Plug>VimspectorGoToCurrentLine +nnoremap <leader>dx :call vimspector#ClearBreakpoints()<CR> +nnoremap <leader>dq :VimspectorReset<CR> +nnoremap <A-C> <Plug>VimspectorContinue +nnoremap <A-n> <Plug>VimspectorStepOver +nnoremap <A-i> <Plug>VimspectorStepInto +nnoremap <A-o> <Plug>VimspectorStepOut +nnoremap <A-b> <Plug>VimspectorToggleBreakpoint +nnoremap <A-c> <Plug>VimspectorRunToCursor + diff --git a/.config/nvim/user/zeal.vim b/.config/nvim/user/zeal.vim new file mode 100644 index 0000000..1b2734f --- /dev/null +++ b/.config/nvim/user/zeal.vim @@ -0,0 +1,7 @@ +" --> Zeal docs +let g:zv_disable_mapping = 1 +nmap <leader>z <Plug>Zeavim +vmap <leader>z <Plug>ZVVisSelection +nmap gz <Plug>ZVOperator +nmap <leader><leader>z <Plug>ZVKeyDocset + diff --git a/.config/nvim/vim.log b/.config/nvim/vim.log deleted file mode 100644 index 67ecb5b..0000000 --- a/.config/nvim/vim.log +++ /dev/null @@ -1,170 +0,0 @@ - - -times in msec - clock self+sourced self: sourced script - clock elapsed: other lines - -000.009 000.009: --- NVIM STARTING --- -000.119 000.110: event init -000.186 000.067: early init -000.230 000.043: locale set -000.260 000.030: init first window -000.469 000.209: inits 1 -000.483 000.014: window checked -000.484 000.001: parsing arguments -000.872 000.051 000.051: require('vim.shared') -000.971 000.034 000.034: require('vim._meta') -000.973 000.095 000.061: require('vim._editor') -000.974 000.190 000.044: require('vim._init_packages') -000.975 000.301: init lua interpreter -001.027 000.053: expanding arguments -001.058 000.031: inits 2 -001.316 000.258: init highlight -001.317 000.001: waiting for UI -001.475 000.157: done waiting for UI -001.481 000.007: clear screen -001.588 000.107: init default mappings & autocommands -001.883 000.041 000.041: sourcing /usr/share/nvim/runtime/ftplugin.vim -001.936 000.022 000.022: sourcing /usr/share/nvim/runtime/indent.vim -001.982 000.009 000.009: sourcing /usr/share/nvim/archlinux.vim -001.985 000.030 000.021: sourcing /etc/xdg/nvim/sysinit.vim -006.183 000.919 000.919: sourcing /home/master/.config/nvim/autoload/plug.vim -012.319 000.007 000.007: sourcing /home/master/.local/share/nvim/plugged/vim-polyglot/filetype.vim -012.437 000.007 000.007: sourcing /home/master/.local/share/nvim/plugged/vim-polyglot/ftdetect/polyglot.vim -012.556 000.010 000.010: sourcing /usr/share/vim/vimfiles/ftdetect/PKGBUILD.vim -012.580 000.008 000.008: sourcing /usr/share/vim/vimfiles/ftdetect/SRCINFO.vim -012.604 000.007 000.007: sourcing /usr/share/vim/vimfiles/ftdetect/augeas.vim -012.634 000.014 000.014: sourcing /usr/share/vim/vimfiles/ftdetect/conkyrc.vim -012.672 000.022 000.022: sourcing /usr/share/vim/vimfiles/ftdetect/espeakfiletype.vim -012.703 000.015 000.015: sourcing /usr/share/vim/vimfiles/ftdetect/lf.vim -012.755 000.024 000.024: sourcing /usr/share/vim/vimfiles/ftdetect/nginx.vim -023.697 011.642 011.528: sourcing /home/master/.local/share/nvim/plugged/vim-polyglot/autoload/polyglot/init.vim -023.708 011.710 000.068: sourcing /home/master/.local/share/nvim/plugged/vim-polyglot/filetype.vim -023.840 000.085 000.085: sourcing /usr/share/nvim/runtime/filetype.lua -024.243 000.011 000.011: sourcing /usr/share/nvim/runtime/ftplugin.vim -024.319 000.007 000.007: sourcing /usr/share/nvim/runtime/indent.vim -024.499 000.063 000.063: sourcing /usr/share/nvim/runtime/syntax/synload.vim -024.563 000.201 000.137: sourcing /usr/share/nvim/runtime/syntax/syntax.vim -024.947 000.306 000.306: sourcing /usr/share/nvim/runtime/syntax/nosyntax.vim -025.066 000.054 000.054: sourcing /usr/share/nvim/runtime/syntax/synload.vim -025.118 000.505 000.145: sourcing /usr/share/nvim/runtime/syntax/syntax.vim -025.229 000.008 000.008: sourcing /home/master/.local/share/nvim/plugged/vim-polyglot/filetype.vim -025.302 000.053 000.053: sourcing /usr/share/nvim/runtime/filetype.lua -025.391 000.008 000.008: sourcing /usr/share/nvim/runtime/ftplugin.vim -025.499 000.007 000.007: sourcing /home/master/.local/share/nvim/plugged/vim-polyglot/filetype.vim -025.566 000.048 000.048: sourcing /usr/share/nvim/runtime/filetype.lua -025.652 000.008 000.008: sourcing /usr/share/nvim/runtime/ftplugin.vim -025.723 000.006 000.006: sourcing /usr/share/nvim/runtime/indent.vim -025.809 023.804 010.228: sourcing /home/master/.config/nvim/init.vim -025.815 000.331: sourcing vimrc file(s) -026.068 000.043 000.043: sourcing /home/master/.config/nvim/plugin/coc.vim -026.166 000.080 000.080: sourcing /home/master/.config/nvim/plugin/debug.vim -026.202 000.018 000.018: sourcing /home/master/.config/nvim/plugin/docs.vim -026.303 000.082 000.082: sourcing /home/master/.config/nvim/plugin/fzf.vim -026.366 000.041 000.041: sourcing /home/master/.config/nvim/plugin/scratch.vim -026.863 000.071 000.071: sourcing /home/master/.config/nvim/autoload/onedark.vim -039.423 012.982 012.912: sourcing /home/master/.config/nvim/colors/onedark.vim -039.454 013.068 000.086: sourcing /home/master/.config/nvim/plugin/ui.vim -039.812 000.227 000.227: sourcing /home/master/.local/share/nvim/plugged/vim-surround/plugin/surround.vim -039.967 000.084 000.084: sourcing /home/master/.local/share/nvim/plugged/vim-commentary/plugin/commentary.vim -040.116 000.063 000.063: sourcing /home/master/.local/share/nvim/plugged/lf.vim/plugin/lf.vim -040.371 000.185 000.185: sourcing /home/master/.local/share/nvim/plugged/vim-floaterm/plugin/floaterm.vim -040.855 000.418 000.418: sourcing /home/master/.local/share/nvim/plugged/fzf/plugin/fzf.vim -041.550 000.617 000.617: sourcing /home/master/.local/share/nvim/plugged/fzf.vim/plugin/fzf.vim -041.693 000.073 000.073: sourcing /home/master/.local/share/nvim/plugged/zeavim.vim/plugin/zeavim.vim -042.133 000.339 000.339: sourcing /home/master/.local/share/nvim/plugged/vim-polyglot/plugin/polyglot.vim -042.506 000.152 000.152: sourcing /usr/share/nvim/runtime/plugin/gzip.vim -042.533 000.007 000.007: sourcing /usr/share/nvim/runtime/plugin/health.vim -042.939 000.118 000.118: sourcing /usr/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim -043.016 000.466 000.348: sourcing /usr/share/nvim/runtime/plugin/matchit.vim -043.131 000.099 000.099: sourcing /usr/share/nvim/runtime/plugin/matchparen.vim -043.494 000.345 000.345: sourcing /usr/share/nvim/runtime/plugin/netrwPlugin.vim -044.073 000.113 000.113: sourcing /usr/share/nvim/runtime/autoload/remote/host.vim -044.305 000.089 000.089: sourcing /usr/share/nvim/runtime/autoload/remote/define.vim -044.761 001.141 000.938: sourcing /home/master/.local/share/nvim/rplugin.vim -044.768 001.244 000.103: sourcing /usr/share/nvim/runtime/plugin/rplugin.vim -044.886 000.091 000.091: sourcing /usr/share/nvim/runtime/plugin/shada.vim -044.928 000.017 000.017: sourcing /usr/share/nvim/runtime/plugin/spellfile.vim -045.070 000.121 000.121: sourcing /usr/share/nvim/runtime/plugin/tarPlugin.vim -045.154 000.058 000.058: sourcing /usr/share/nvim/runtime/plugin/tohtml.vim -045.193 000.013 000.013: sourcing /usr/share/nvim/runtime/plugin/tutor.vim -045.365 000.151 000.151: sourcing /usr/share/nvim/runtime/plugin/zipPlugin.vim -045.471 000.012 000.012: sourcing /usr/share/vim/vimfiles/plugin/fzf.vim -045.579 000.089 000.089: sourcing /usr/share/vim/vimfiles/plugin/redact_pass.vim -046.186 000.100 000.100: sourcing /usr/share/nvim/runtime/plugin/editorconfig.lua -046.313 000.104 000.104: sourcing /usr/share/nvim/runtime/plugin/man.lua -046.371 000.037 000.037: sourcing /usr/share/nvim/runtime/plugin/nvim.lua -046.425 002.166: loading rtp plugins -046.501 000.075: loading packages -046.527 000.027: loading after plugins -046.535 000.007: inits 3 -049.346 002.812: reading ShaDa -049.563 000.216: opening buffers -049.592 000.029: BufEnter autocommands -049.594 000.002: editing files in windows -051.092 000.064 000.064: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/init.vim -051.660 000.278 000.278: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/parts.vim -051.828 000.011 000.011: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/formatter/short_path.vim -052.601 000.102 000.102: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/util.vim -052.898 000.159 000.159: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/extensions.vim -053.025 000.030 000.030: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/extensions/quickfix.vim -053.204 000.108 000.108: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline.vim -053.349 000.020 000.020: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/extensions/netrw.vim -053.463 000.021 000.021: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/extensions/fzf.vim -053.692 000.064 000.064: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/extensions/term.vim -055.576 000.118 000.118: require('vim.lsp.log') -056.062 000.483 000.483: require('vim.lsp.protocol') -057.439 000.324 000.324: require('vim.lsp._snippet') -057.532 000.090 000.090: require('vim.highlight') -057.538 000.004 000.004: require('vim.F') -057.556 001.459 001.041: require('vim.lsp.util') -057.570 002.492 000.432: require('vim.lsp.handlers') -057.977 000.405 000.405: require('vim.lsp.rpc') -058.150 000.171 000.171: require('vim.lsp.sync') -058.648 000.496 000.496: require('vim.lsp.semantic_tokens') -059.000 000.349 000.349: require('vim.lsp.buf') -059.135 000.133 000.133: require('vim.lsp.diagnostic') -059.350 000.213 000.213: require('vim.lsp.codelens') -059.382 005.520 001.261: require('vim.lsp') -059.504 000.044 000.044: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/extensions/nvimlsp.vim -059.696 000.071 000.071: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/extensions/whitespace.vim -059.933 000.037 000.037: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/extensions/po.vim -060.085 000.056 000.056: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/extensions/wordcount.vim -060.283 000.019 000.019: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/extensions/keymap.vim -060.481 000.028 000.028: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/extensions/searchcount.vim -064.384 000.073 000.073: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/section.vim -064.878 000.238 000.238: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/highlighter.vim -068.911 000.072 000.072: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/themes.vim -069.476 000.931 000.859: sourcing /home/master/.config/nvim/autoload/airline/themes/onedark.vim -072.884 000.370 000.370: sourcing /home/master/.config/nvim/autoload/airline/themes/onedark.vim -085.154 000.083 000.083: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/builder.vim -085.516 000.050 000.050: sourcing /home/master/.local/share/nvim/plugged/vim-airline/autoload/airline/extensions/default.vim -102.172 051.614 043.237: sourcing /home/master/.local/share/nvim/plugged/vim-airline/plugin/airline.vim -102.485 000.031 000.031: sourcing /home/master/.local/share/nvim/plugged/vim-airline-themes/plugin/airline-themes.vim -103.232 001.993: VimEnter autocommands -103.235 000.003: UIEnter autocommands -103.236 000.001: before starting main loop -103.996 000.760: first screen update -103.998 000.002: --- NVIM STARTED --- - - -times in msec - clock self+sourced self: sourced script - clock elapsed: other lines - -000.009 000.009: --- NVIM STARTING --- -000.188 000.179: event init -000.251 000.063: early init -000.292 000.041: locale set -000.329 000.036: init first window -000.545 000.217: inits 1 -000.551 000.006: window checked -000.553 000.002: parsing arguments -000.937 000.026 000.026: require('vim.shared') -001.012 000.032 000.032: require('vim._meta') -001.014 000.073 000.041: require('vim._editor') -001.015 000.160 000.061: require('vim._init_packages') -001.016 000.302: init lua interpreter -001.515 000.500: expanding arguments -001.559 000.044: inits 2 -001.793 000.233: init highlight diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 37a847c..5c9826a 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -21,7 +21,7 @@ alias gpu='gitpush' lt() { tree -aC --dirsfirst -I "$IGNORE_GLOB" "$@" | less -F; } dul() { du -ahd 1 "$@" | sort -h | less -FX; } -v() { LESSOPEN="|preview %s" less -r -F "${1:-.}"; } +v() { LESSOPEN="|preview %s" less -r -F -X "${@:-.}"; } ff() { find -H "$@" ! -wholename '*.git*' ! \( -type d -printf '%p/\n' , ! -type d -print \) | fzf -m; } senv() { source "${XDG_DATA_HOME:-$HOME/.local/share}/virtualenvs/${1:-main}/bin/activate"; } diff --git a/.config/shell/bm-dirs b/.config/shell/bm-dirs index 603136b..b729ac5 100644 --- a/.config/shell/bm-dirs +++ b/.config/shell/bm-dirs @@ -1,43 +1,38 @@ # You can add comments to these files with # cac ${XDG_CACHE_HOME:-$HOME/.cache} cg ${XDG_CONFIG_HOME:-$HOME/.config} +lbn ${XDG_SCRIPTS_DIR:-$HOME/.local/bin} lsh ${XDG_DATA_DIR:-$HOME/.local/share} +lst ${XDG_STATE_DIR:-$HOME/.local/state} +lsr ${XDG_SOURCE_DIR:-$HOME/.local/src} +dn ${XDG_DOWNLOAD_DIR:-$HOME/Downloads} +dx ${XDG_DOCUMENTS_DIR:-$HOME/Documents} +ms ${XDG_MUSIC_DIR:-$HOME/Music} +px ${XDG_PICTURES_DIR:-$HOME/Pictures} +vd ${XDG_VIDEOS_DIR:-$HOME/Videos} + +nv ${XDG_CONFIG_HOME:-$HOME/.config}/nvim lsha ${XDG_DATA_DIR:-$HOME/.local/share}/applications vnv ${XDG_DATA_DIR:-$HOME/.local/share}/virtualenvs ltr ${XDG_DATA_DIR:-$HOME/.local/share}/Trash -lsr ${XDG_DATA_DIR:-$HOME/.local/src} -lst ${XDG_DATA_DIR:-$HOME/.local/state} -dn ${XDG_DOWNLOAD_DIR:-$HOME/Downloads} -dx ${XDG_DOCUMENTS_DIR:-$HOME/Documents} dl ${XDG_DOCUMENTS_DIR:-$HOME/Documents}/latex dr ${XDG_DOCUMENTS_DIR:-$HOME/Documents}/latex/resume nt ${XDG_DOCUMENTS_DIR:-$HOME/Documents}/Notes -ms ${XDG_MUSIC_DIR:-$HOME/Music} -px ${XDG_PICTURES_DIR:-$HOME/Pictures} -vd ${XDG_VIDEOS_DIR:-$HOME/Videos} -lbn ~/.local/bin bn ~/bin sd ~/sdcard rp ~/repos an ~/Android ap ~/Applications dv ~/Dev -cm ~/Dev/cloud-maker -cs ~/Dev/sites/csstudent41.github.io -vrd ~/Dev/sites/vikas.rocks -vrc ~/Dev/sites/vikas.rocks/content -vrl ~/Dev/sites/vikas.rocks/layouts -vrp ~/Dev/sites/vikas.rocks/public +vr ~/Dev/sites/vikas.rocks +vc ~/Dev/sites/vikas.rocks/content +vl ~/Dev/sites/vikas.rocks/layouts +vp ~/Dev/sites/vikas.rocks/public td ~/Dev/test -gd ~/GDrive/vartak/CS/sem6 -gp ~/GDrive/vartak/CS/sem6/practicals -gj ~/GDrive/vartak/CS/sem6/journals -gz ~/GDrive/vartak/CS/practical-zip/sem5 -gn ~/GDrive/vartak/CS/sem6/notes -rs ~/GDrive/vartak/results +gd ~/GDrive/vartak/CS ph ~/Phone -stv ~/Phone/.stversions +sv ~/Phone/.stversions pw ~/Phone/Android/media/com.whatsapp.w4b/WhatsApp\ Business/Media/WhatsApp\ Business\ Documents mn /mnt diff --git a/.config/shell/bm-files b/.config/shell/bm-files index 898e080..8685e00 100644 --- a/.config/shell/bm-files +++ b/.config/shell/bm-files @@ -4,26 +4,25 @@ bf ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-files bd ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs -pf ~/.profile -zp ~/.zprofile -xp ~/.xprofile -gi ~/.gitignore -zc ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/.zshrc +cpf ~/.profile +czp ~/.zprofile +cxp ~/.xprofile +cgi ~/.gitignore +czr ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/.zshrc +car ${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc +clc ${XDG_CONFIG_HOME:-$HOME/.config}/lf/lfrc +csx ${XDG_CONFIG_HOME:-$HOME/.config}/sxiv/exec/key-handler +cin ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/init.vim +cac ${XDG_CONFIG_HOME:-$HOME/.config}/alacritty/alacritty.toml +cxr ${XDG_CONFIG_HOME:-$HOME/.config}/X11/Xresources +cxi ${XDG_CONFIG_HOME:-$HOME/.config}/X11/xinitrc +cml ${XDG_CONFIG_HOME:-$HOME/.config}/mimeapps.list +cfi ${XDG_CONFIG_HOME:-$HOME/.config}/fd/ignore +csc ~/.ssh/config + zh ${XDG_STATE_HOME:-$HOME/.local/state}/zsh/history -za ${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc -arc ${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc -spf ${XDG_CONFIG_HOME:-$HOME/.config}/shell/server.profile -lc ${XDG_CONFIG_HOME:-$HOME/.config}/lf/lfrc -sx ${XDG_CONFIG_HOME:-$HOME/.config}/sxiv/exec/key-handler -in ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/init.vim -ac ${XDG_CONFIG_HOME:-$HOME/.config}/alacritty/alacritty.toml -xr ${XDG_CONFIG_HOME:-$HOME/.config}/X11/Xresources -xi ${XDG_CONFIG_HOME:-$HOME/.config}/X11/xinitrc -mm ${XDG_CONFIG_HOME:-$HOME/.config}/mimeapps.list -fdi ${XDG_CONFIG_HOME:-$HOME/.config}/fd/ignore -ssc ~/.ssh/config qn ${XDG_DOCUMENTS_HOME:-$HOME/Documents}/Notes/QuickNote.md bm ${XDG_DOCUMENTS_HOME:-$HOME/Documents}/Notes/bookmarks.txt akn ${XDG_DOCUMENTS_HOME:-$HOME/Documents}/Notes/ak47.txt li ${XDG_DOCUMENTS_HOME:-$HOME/Documents}/latex/lorem-ipsum.txt -vrh ~/Dev/sites/vikas.rocks/layouts/_default/home.html +vh ~/Dev/sites/vikas.rocks/layouts/_default/home.html diff --git a/.config/ytignore b/.config/ytignore index 6bc17cd..9ba10af 100644 --- a/.config/ytignore +++ b/.config/ytignore @@ -1,5 +1,6 @@ *.srt *.vtt +*.meta *.description *.info.json *.live_chat.json diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 9fb8143..93c6e01 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -248,6 +248,7 @@ bindkey '^[H' get-help [ -f "$SDOTDIR/aliasrc" ] && source "$SDOTDIR/aliasrc" [ -f "$SDOTDIR/shortcutrc" ] && source "$SDOTDIR/shortcutrc" +[ -f "$SDOTDIR/shortcutenvrc" ] && source "$SDOTDIR/shortcutenvrc" [ -f "$ZDOTDIR/zshnameddirrc" ] && source "$ZDOTDIR/zshnameddirrc" @@ -263,9 +264,9 @@ case "$TERM" in *256*) } command -v fd >/dev/null && { - FZF_DEFAULT_COMMAND="fd --color=always | sort" + FZF_DEFAULT_COMMAND="fd --hidden --color=always" FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --ansi" - ff() { FZF_DEFAULT_COMMAND+="$@" fzf -m; } + ff() { fzf -m "$@"; } alias f='fd --hidden --no-ignore-vcs' alias sr='fd --no-ignore-vcs --color=always . ~/.config ~/.local/bin ~/bin | fzf --ansi' } @@ -286,7 +287,7 @@ alias sv='sudo sv' alias mmv='noglob zmv -W' alias s='sudo ' alias fh='fzf --tac < "$OPEN_HISTFILE"' -alias ide='nvim -u "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/dev.vim"' +alias ide='nvim -u "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/coc.vim"' alias mirror='sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist-arch' alias mirrord='sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist-arch' alias cleanup='sudo pacman -Rns $(pacman -Qtdq)' diff --git a/.config/zsh/command-tools.zsh b/.config/zsh/command-tools.zsh index 20126cb..b63b0ac 100644 --- a/.config/zsh/command-tools.zsh +++ b/.config/zsh/command-tools.zsh @@ -1,5 +1,5 @@ whereis_alias() { - location="$(zsh -xic exit 2>&1 | sed -E "/alias[ '$]*$1=/!d" | + location="$(zsh -xic exit 2>&1 | sed -E "/alias[ '$]*$1=/!d; /\/plugins\//d" | fzf --exit-0 --select-1 --ansi --header-first --header='Select alias location' | sed -n "s|^\+\(/.*:[0-9]*\)>.*$|\1|p")" diff --git a/.config/zsh/zprofile b/.config/zsh/zprofile index 16b64c6..3a9242f 100644 --- a/.config/zsh/zprofile +++ b/.config/zsh/zprofile @@ -1,17 +1,20 @@ #!/bin/zsh + . ~/.profile -[ -n "$TMUX" ] || [ -n "$TERMUX_VERSION" ] || [ "$SSH_CONNECTION" ] && +[ -n "$TMUX" ] || [ -n "$TERMUX_VERSION" ] || [ -n "$SSH_CONNECTION" ] && return on_ac_power="$(cat /sys/class/power_supply/ACAD/online)" -[ "$on_ac_power" = 0 ] && brightnessctl set 5% || brightnessctl set 20% +[ "$on_ac_power" = 0 ] && + brightnessctl set 5% || + brightnessctl set "$(<"${XDG_STATE_HOME:-$HOME/.local/state}/brightness")" case "$TTY" in /dev/tty1) command -V optimus-manager >/dev/null && [ "$on_ac_power" = 1 ] && { echo "Waiting for nvidia card to load up..." - until [ -e /dev/dri/card1 ]; do; sleep 0.1; done + until [ -e /dev/dri/card1 ]; do sleep 0.1; done } command -V startx >/dev/null && { pgrep startx || startx } ;; diff --git a/.local/bin/desktop/brightness b/.local/bin/desktop/brightness index 11733f4..74d3e36 100755 --- a/.local/bin/desktop/brightness +++ b/.local/bin/desktop/brightness @@ -15,6 +15,7 @@ case "$1" in esac brightness="$(brightnessctl --machine-readable | cut -d, -f4)" +echo "$brightness" > "${XDG_STATE_HOME:-$HOME/.local/state}/brightness" if [ -n "$TMUX" ]; then tmux display "Brightness: $brightness" diff --git a/.local/bin/desktop/setdp b/.local/bin/desktop/setdp index 48c6a7a..afe4498 100755 --- a/.local/bin/desktop/setdp +++ b/.local/bin/desktop/setdp @@ -13,8 +13,8 @@ if [ "$display_count" = 2 ]; then for display in $displays; do case "$display" in - eDP*) export PRIMARY="$display"; set -- "$@" --output "$display" --mode 1920x1080 --primary --pos 0x270 ;; - HDMI*) set -- "$@" --output "$display" --mode 1920x1080 --pos 1920x0 --scale "1.25x1.25" ;; + eDP*) export PRIMARY="$display"; set -- "$@" --output "$display" --mode 1920x1080 --primary --pos 0x162 ;; + HDMI*) set -- "$@" --output "$display" --mode 1920x1080 --pos 2112x0 --scale "1.25x1.25" ;; esac done diff --git a/.local/bin/desktop/windowshot b/.local/bin/desktop/windowshot new file mode 100755 index 0000000..e4de6b0 --- /dev/null +++ b/.local/bin/desktop/windowshot @@ -0,0 +1,3 @@ +#!/bin/sh + +import -silent -window "$(xdotool selectwindow)" png:- | xclip -sel clipboard -t image/png -i diff --git a/.local/bin/desktop/zbarscreen b/.local/bin/desktop/zbarscreen new file mode 100755 index 0000000..e325ce5 --- /dev/null +++ b/.local/bin/desktop/zbarscreen @@ -0,0 +1,3 @@ +#!/bin/sh + + import -silent -window root bmp:- | zbarimg - | sed -e 's/QR-Code://' | xclip -selection clipboard diff --git a/.local/bin/desktop/zbarwindow b/.local/bin/desktop/zbarwindow new file mode 100755 index 0000000..7085f69 --- /dev/null +++ b/.local/bin/desktop/zbarwindow @@ -0,0 +1,3 @@ +#!/bin/sh + +import -silent -window "$(xdotool selectwindow)" bmp:- | zbarimg - | sed -e 's/QR-Code://' | xclip -selection clipboard diff --git a/.local/bin/shorts/font2svg b/.local/bin/development/font2svg index 539972d..539972d 100755 --- a/.local/bin/shorts/font2svg +++ b/.local/bin/development/font2svg diff --git a/.local/bin/development/gitpush b/.local/bin/development/gitpush index 7774a7b..2c503ca 100755 --- a/.local/bin/development/gitpush +++ b/.local/bin/development/gitpush @@ -1,12 +1,6 @@ #!/bin/sh push_to_remote() { - case "$(git config --get remote.origin.url)" in - *csstudent41*) sshadd ~/.ssh/github.com_id_ed25519 ;; - *labstudent41*) sshadd ~/.ssh/labstudent41_id_ed25519 ;; - *vtc-tech*) sshadd ~/.ssh/vartaktechclub_id_ed25519 ;; - esac - git add --all git commit && git push -u origin } diff --git a/.local/bin/development/nx b/.local/bin/development/nx index 862be99..8305487 100755 --- a/.local/bin/development/nx +++ b/.local/bin/development/nx @@ -21,7 +21,7 @@ shift $((OPTIND - 1)) [ "$#" -gt 1 ] && err "too many arguments. Only one expected" -new_script() { +new_file() { cat << EOF > "$1" #!/bin/sh @@ -47,77 +47,8 @@ EOF chmod u+x -- "$1" || exit } - -new_c_file() { - cat << EOF > "$1" -#include <stdio.h> - -int main() -{ - printf("Hello\n"); - - return 0; -} -EOF -} - - -new_cpp_file() { - cat << EOF > "$1" -#include <iostream> - -using namespace std; - -int main() -{ - cout << "Hello" << endl; - - cin.get(); - return 0; -} -EOF -} - - -new_py_file() { - cat << EOF > "$1" -import timeit - -print("Finished in %fs" % timeit.timeit()) -EOF -} - - -new_java_file() { - PATTERN="Scanner" - VIMCMDS="normal!2n\n noh" - cat << EOF > "$1" -import java.util.Scanner; - -class ${1%.java} { - public static void main(String args[]) { - Scanner sc = new Scanner(System.in); - - System.out.println("Finished!"); - sc.close - } -} -EOF -} - - file="$1" -new_file() { - case "$file" in - *.c) new_c_file "$file" ;; - *.cpp) new_cpp_file "$file" ;; - *.py) new_py_file "$file" ;; - *.java) new_java_file "$file" ;; - *) new_script "$file" ;; - esac -} - if [ -f "$file" ]; then [ ! -w "$file" ] && chmod u+rw "$file" if [ -s "$file" ]; then @@ -134,15 +65,5 @@ fi ls -lF --color -- "$file" -case "$EDITOR" in - '') echo "$0: \$EDITOR variable not set" >&2 && exit 1 ;; - vi|*vim*) - VIMCONF="$(mktemp)"; export VIMCONF - [ -n "$VIOPTS" ] && echo "set $VIOPTS" >> "$VIMCONF" - [ -n "$PATTERN" ] && echo "/$PATTERN" >> "$VIMCONF" - [ -n "$VIMCMDS" ] && echo "$VIMCMDS" >> "$VIMCONF" - $EDITOR -S "$VIMCONF" "$file" - rm -f "$VIMCONF" - ;; - *) $EDITOR "$file" ;; -esac; exit +${EDITOR} "$file" + diff --git a/.local/bin/fgrp b/.local/bin/fgrp deleted file mode 100755 index 18bcabd..0000000 --- a/.local/bin/fgrp +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# fzf-grep: browse through grepped lines using fzf - -if [ "$OPENFLAG" = 0 ]; then - location="$(echo "$*" | sed 's/^\(.*\):\([0-9]\+\):.*$/\1|\2/')" - file="${location%|*}"; line="${location##*|}" - case "${OPENWITH:=$EDITOR}" in - ''|vi|*vim*) $OPENWITH +"$line" "$file" ;; - *) $OPENWITH "$file" ;; - esac; exit -fi - -[ -z "$FZF_HISTDIR" ] && - export FZF_HISTDIR="${XDG_STATE_HOME:-$HOME/.local/state}/fzf" -mkdir -pv "$FZF_HISTDIR" -export FZF_HIST="$FZF_HISTDIR/grep_history" - -cmd="grep -Rnsi --exclude-dir=.git --exclude-dir=node_modules --color=always" -$cmd "$@" | - fzf --ansi \ - --history="$FZF_HIST" \ - --prompt="grep > " \ - --preview='preview "$(echo {1} | cut -d: -f1)"' \ - --preview-window="hidden" \ - --bind 'ctrl-v:toggle-preview,ctrl-space:toggle-preview' \ - --bind "ctrl-r:reload($cmd $*)" \ - --bind 'enter:execute(append-to-history {} "$FZF_HIST"; OPENFLAG=0 fgrp {})' \ - --bind 'alt-e:execute(append-to-history {} "$FZF_HIST"; OPENFLAG=0 OPENWITH=${EDITOR:-vi} fgrp {})' \ - --bind 'alt-o:execute(append-to-history {} "$FZF_HIST"; OPENFLAG=0 OPENWITH=${OPENER:-xdg-open} fgrp {})' \ - --bind 'alt-O:execute(append-to-history {} "$FZF_HIST"; OPENFLAG=0 OPENWITH=${FILES:-lf} fgrp {})' diff --git a/.local/bin/frg b/.local/bin/frg new file mode 100755 index 0000000..97f703a --- /dev/null +++ b/.local/bin/frg @@ -0,0 +1,70 @@ +#!/bin/sh + +# https://junegunn.github.io/fzf/tips/ripgrep-integration/#6-bind-enter-to-become-action + +help() { echo "frg - grep with fzf + +USAGE: + fgrp [OPTION]... PATTERN + +OPTIONS: + -r real time grepping in fzf prompt + -h show this help message"; } + +err() { printf '%s: %s\n' "$0" "$@" >&2; exit 1; } + +while getopts 'rh' o; do case "$o" in + r) rflag=1 ;; + h) help >&2; exit ;; + ?) err "invalid option passed" ;; +esac done +shift $((OPTIND - 1)) + +[ -z "$FZF_HISTDIR" ] && + export FZF_HISTDIR="${XDG_STATE_HOME:-$HOME/.local/state}/fzf" +mkdir -pv "$FZF_HISTDIR" +export FZF_HIST="$FZF_HISTDIR/grep_history" + +if command -v rg >/dev/null; then + GREP_CMD="rg --smart-case --column --color=always" +elif command -v git >/dev/null; then + GREP_CMD="git grep -I --ignore-case --column --color=always" +else + GREP_CMD="grep -Rnsi --exclude-dir=.git --color=always" +fi + +RELOAD="reload($GREP_CMD {q} || :)" + +OPENER=' + # update history + sed -i \\\|^{q}$\|d "$FZF_HIST" + echo {q} >> "$FZF_HIST" + + if [[ $FZF_SELECT_COUNT -eq 0 ]]; then + $EDITOR {1} +{2} # No selection. Open the current line in Vim. + else + $EDITOR +cw -q {+f} # Build quickfix list for the selected items. + fi + ' + +query="$*" + +fzf() { $GREP_CMD "$query" | command fzf "$@" \ + --ansi --multi --header-first \ + --history="$FZF_HIST" \ + --bind "enter:execute($OPENER)" \ + --bind "ctrl-o:become($OPENER)" \ + --bind 'ctrl-v:toggle-preview,ctrl-space:toggle-preview' \ + --bind "ctrl-r:reload($GREP_CMD '$query')" \ + --bind 'alt-a:select-all,alt-d:deselect-all,ctrl-/:toggle-preview' \ + --delimiter : \ + --preview 'bat --style=full --color=always --highlight-line {2} {1}' \ + --preview-window '~4,+{2}+4/3,<80(up)'; } + +if [ "$rflag" = 1 ]; then + fzf --disabled --query "$query" \ + --header "COMMAND: $GREP_CMD <prompt-query>" \ + --bind "change:$RELOAD" +else + fzf --header "COMMAND: $GREP_CMD '$query'" +fi diff --git a/.local/bin/preview b/.local/bin/preview index 235f0e0..68eec32 100755 --- a/.local/bin/preview +++ b/.local/bin/preview @@ -19,7 +19,7 @@ case "$1" in *.html) w3m -dump "$1" ;; *.md) glow "$1" ;; # *.vim) highlight --syntax=vim --replace-tabs=2 -- "$1" ;; - *.js|*.vim|*.lua) highlight -- "$1" ;; + *.js*|*.ts*|*.vim|*.lua) highlight --replace-tabs=2 -- "$1" ;; *.txt|*.description|*.srt) cat -- "$1" ;; *.png|*.jpg|*.jpeg|*.webp|*.mp3|*.ogg|*.mp4|*.mkv|*.webm) mediainfo -- "$1" ;; *.info.json) jq -C . "$1" ;; @@ -47,7 +47,7 @@ case "$1" in *html) w3m -dump "$1" ;; text/markdown) glow "$1" ;; application/json) highlight --syntax=json --replace-tabs=2 -- "$1" ;; - text/*|*javascript) highlight --force -- "$1" ;; + text/*|*javascript) highlight --force --replace-tabs=2 -- "$1" ;; audio/*|video/*|image/*) mediainfo -- "$1" ;; *xz) xz --list "$1" ;; *zip|*tar*|*7z*|*bzip2) atool --list -- "$1" ;; diff --git a/.local/bin/shortcuts b/.local/bin/shortcuts index 545799f..af3fe5b 100755 --- a/.local/bin/shortcuts +++ b/.local/bin/shortcuts @@ -1,25 +1,28 @@ #!/bin/sh -config="${XDG_CONFIG_HOME:-$HOME/.config}" -bmdirs="$config/shell/bm-dirs" -bmfiles="$config/shell/bm-files" +bmdirs="${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs" +bmfiles="${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-files" -shell_shortcuts="$config/shell/shortcutrc" -zsh_named_dirs="$config/zsh/zshnameddirrc" -lf_shortcuts="$config/lf/shortcutrc" -vim_shortcuts="$config/nvim/shortcuts.vim" +shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" +shell_env_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutenvrc" +zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/zsh/zshnameddirrc" +lf_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/lf/shortcutrc" +vim_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/nvim/shortcuts.vim" rm -f "$zsh_named_dirs" "$lf_shortcuts" "$vim_shortcuts" -printf "# vim: filetype=sh\n" > "$shell_shortcuts" +printf "# vim: filetype=sh\\nalias \\\\\n" > "$shell_shortcuts" +printf "# vim: filetype=sh\\nexport \\\\\n" > "$shell_env_shortcuts" eval "echo \"$(cat "$bmdirs")\"" | awk -F'\t' " !/^\s*#/ && !/^\s*$/ { gsub(\"\\\s*#.*$\", \"\"); - printf(\"alias %s='cd %s && ls -A'\n\", \$1, \$2) >> \"$shell_shortcuts\" - printf(\"hash -d %s=%s\n\", \$1, \$2) >> \"$zsh_named_dirs\" + printf(\"c%s='cd %s && ls -A' \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" + printf(\"d%s=\42%s\42 \\\\\n\", \$1, \$2) >> \"$shell_env_shortcuts\" + printf(\"hash -d d%s=%s\n\", \$1, \$2) >> \"$zsh_named_dirs\" printf(\"map c%s :cd %s\n\", \$1, \$2) >> \"$lf_shortcuts\" - printf(\"cmap ;%s %s\n\", \$1, \$2) >> \"$vim_shortcuts\" + printf(\"cmap ;d%s %s\n\", \$1, \$2) >> \"$vim_shortcuts\" + printf(\"imap ;d%s %s\n\", \$1, \$2) >> \"$vim_shortcuts\" } " @@ -27,9 +30,11 @@ eval "echo \"$(cat "$bmfiles")\"" | awk -F'\t' " !/^\s*#/ && !/^\s*$/ { gsub(\"\\\s*#.*$\", \"\"); - printf(\"alias %s='\$EDITOR %s'\n\", \$1, \$2) >> \"$shell_shortcuts\" - printf(\"hash -d %s=%s\n\", \$1, \$2) >> \"$zsh_named_dirs\" + printf(\"e%s='\$EDITOR %s' \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" + printf(\"export f%s=\42%s\42 \\\\\n\", \$1, \$2) >> \"$shell_env_shortcuts\" + printf(\"hash -d f%s=%s\n\", \$1, \$2) >> \"$zsh_named_dirs\" printf(\"map E%s $\$EDITOR %s\n\", \$1, \$2) >> \"$lf_shortcuts\" - printf(\"cmap ;%s %s\n\", \$1, \$2) >> \"$vim_shortcuts\" + printf(\"cmap ;f%s %s\n\", \$1, \$2) >> \"$vim_shortcuts\" + printf(\"imap ;f%s %s\n\", \$1, \$2) >> \"$vim_shortcuts\" } " diff --git a/.local/bin/shorts/gi b/.local/bin/shorts/gi new file mode 100755 index 0000000..d78ff99 --- /dev/null +++ b/.local/bin/shorts/gi @@ -0,0 +1,6 @@ +#!/bin/sh + +# gi - edit the Git Ignore file of current repo + +TOPLEVEL="$(git rev-parse --show-toplevel)" || exit +find "$TOPLEVEL" -name ".gitignore" | xargs -r nvim -p diff --git a/.local/bin/shorts/mailsyncd b/.local/bin/shorts/mailsyncd new file mode 100755 index 0000000..4b51c45 --- /dev/null +++ b/.local/bin/shorts/mailsyncd @@ -0,0 +1,6 @@ +#!/bin/sh + +while true; do + mailsync + sleep 5m +done diff --git a/.local/bin/shorts/rep b/.local/bin/shorts/rep new file mode 100755 index 0000000..78623b6 --- /dev/null +++ b/.local/bin/shorts/rep @@ -0,0 +1,3 @@ +#!/bin/sh + +fd | sad "$@" diff --git a/.local/bin/shorts/windowshot b/.local/bin/shorts/windowshot deleted file mode 100755 index c654cc7..0000000 --- a/.local/bin/shorts/windowshot +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -image="${XDG_PICTURES_DIR:-$HOME/Pictures}/xwindow.jpg" -import -window "$(xdotool selectwindow)" "$image" -# dragon-drop --and-exit "$image" -xclip -sel clipboard -t image/png -i "$image" |