From 8c600508ebde6340defb45a0f6a3280b7ea8f530 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Sun, 31 Oct 2021 21:31:45 +1300 Subject: [PATCH 01/67] [ nvim ] initial migration of settings to lua --- vim/vim.symlink/settings.lua | 212 +++++++++++++++++++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100644 vim/vim.symlink/settings.lua diff --git a/vim/vim.symlink/settings.lua b/vim/vim.symlink/settings.lua new file mode 100644 index 0000000..d9fb810 --- /dev/null +++ b/vim/vim.symlink/settings.lua @@ -0,0 +1,212 @@ +-- TO BE MIGRATED TO SEPARATE FILE +require'nvim-treesitter.configs'.setup { + ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages + highlight = { + enable = true, -- false will disable the whole extension + disable = { "c", "rust", "go", "c_sharp" }, -- list of language that will be disabled + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +} +vim.g.loaded_gzip = 1 +vim.g.loaded_tar = 1 +vim.g.loaded_tarPlugin = 1 +vim.g.loaded_zip = 1 +vim.g.loaded_zipPlugin = 1 +vim.g.loaded_getscript = 1 +vim.g.loaded_getscriptPlugin = 1 +vim.g.loaded_vimball = 1 +vim.g.loaded_vimballPlugin = 1 +vim.g.loaded_matchit = 1 +vim.g.loaded_matchparen = 1 +vim.g.loaded_2html_plugin = 1 +vim.g.loaded_logiPat = 1 +vim.g.loaded_rrhelper = 1 +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 +vim.g.loaded_netrwSettings = 1 +vim.g.loaded_netrwFileHandlers = 1 +-- TO BE MIGRATED TO SEPARATE FILE + +-- Some settings copied from: +-- https://github.com/ahmedelgabri/dotfiles/blob/main/config/nvim/init.lua + +-- Persistent undo +vim.opt.background = 'dark' +vim.opt.undodir = '~/.vim/undo/' +vim.opt.undofile = true +vim.opt.undolevels = 1000 +vim.opt.undoreload = 10000 +vim.opt.updatetime = 300 + +-- Ignored files/directories from autocomplete (and CtrlP) +vim.opt.wildmode = 'longest:full,list,full' +vim.opt.wildignore:append '*.o,*.out,*.obj,.git,*.rbc,*.rbo,*.class,.svn,*.gem,*.pyc' +vim.opt.wildignore:append '*.swp,*~,*/.DS_Store' +vim.opt.wildignore:append '*/vendor/bundle/*' +vim.opt.wildignore:append '*/node_modules/' + +-- Use vim, not vi api +vim.opt.compatible = false + +vim.opt.backupcopy = 'yes' -- overwrite files to update, instead of renaming + rewriting +vim.opt.backup = false +vim.opt.writebackup = false +vim.opt.backupdir = string.format('%s%s', vim.fn.stdpath 'data', '/backup//') -- keep backup files out of the way +vim.opt.backupdir:append '.' + +-- No swap file +vim.opt.swapfile = false + +-- Always show cursor +vim.opt.ruler = true + +-- Show incomplete commands +vim.opt.showcmd = true + +-- Command history +vim.opt.history=500 + +-- Always show cursor +vim.opt.ruler = true + +-- Highlight search matches +vim.opt.hlsearch = true + +-- Ignore case in search +vim.opt.smartcase = true + +-- Make sure any searches /searchPhrase doesn't need the \c escape character +vim.opt.ignorecase = true + +-- Turn word wrap off +vim.opt.wrap = false + +-- Allow backspace to delete end of line, indent and start of line characters +vim.opt.backspace={ + indent, + eol, + start +} + +-- Convert tabs to spaces +vim.opt.expandtab = true + +-- Set tab size in spaces (this is for manual indenting) +vim.opt.tabstop=4 + +-- The number of spaces inserted for a tab (used for auto indenting) +vim.opt.shiftwidth=4 + +-- Turn on line numbers +vim.opt.number = true + +-- Set number width +vim.opt.numberwidth=5 + +-- Leave 5 lines of buffer when scrolling +vim.opt.scrolloff=5 + +-- Leave 10 characters of horizontal buffer when scrolling +vim.opt.sidescrolloff=10 + +-- Turn on relative line numbers +vim.opt.relativenumber = true + +-- show trailing whitespace +vim.opt.list = true +vim.opt.listchars = { + tab = '⋅ ', + -- tab = '| ', + nbsp = '░', + extends = '»', + precedes = '«', + trail = '␣', +} +vim.opt.joinspaces = false +vim.opt.concealcursor = 'n' + +-- http://stackoverflow.com/questions/2158516/vim-delay-before-o-opens-a-new-line +vim.opt.timeoutlen = 1000 +vim.opt.ttimeoutlen = 0 + +-- Always show status bar +vim.opt.laststatus=2 + +-- Set the status line to something useful +-- set statusline=%f\ %=L:%l/%L\ %c\ (%p%%) +vim.opt.statusline:prepend "%{coc#status()}%{get(b:,'coc_current_function','')}" + +-- UTF encoding +vim.opt.encoding="utf-8" + +-- Autoload files that have changed outside of vim +vim.opt.autoread = true + +-- http://stackoverflow.com/questions/8134647/copy-and-paste-in-vim-via-keyboard-between-different-mac-terminals +vim.opt.clipboard:append 'unnamed' + +-- Don't show intro +vim.opt.shortmess:append 'I' + +-- Better splits (new windows appear below and to the right) +vim.opt.splitbelow = true +vim.opt.splitright = true + +-- Highlight the current line +vim.opt.cursorline = true + +-- Ensure Vim doesn't beep at you every time you make a mistype +vim.opt.visualbell = true + +-- Visual autocomplete for command menu (e.g. :e ~/path/to/file) +vim.opt.wildmenu = true + +-- redraw only when we need to (i.e. don't redraw when executing a macro) +vim.opt.lazyredraw = true + +-- highlight a matching [{()}] when cursor is placed on start/end character +vim.opt.showmatch = true + +-- incremental command live feedback" +vim.opt.inccommand = 'nosplit' + +-- cursor behavior: +-- - no blinking in normal/visual mode +-- - blinking in insert-mode +vim.opt.guicursor:append 'n-v-c:blinkon0,i-ci:ver25-Cursor/lCursor-blinkwait30-blinkoff100-blinkon100' + +-- Make sure diffs are always opened in vertical splits, also match my git settings +vim.opt.diffopt:append 'vertical,algorithm:histogram,indent-heuristic,hiddenoff' + +vim.opt.title = true + +-- highlight matching [{()}] +vim.opt.showmatch = true + +vim.opt.textwidth = 80 +vim.opt.wrap = false +vim.opt.signcolumn = 'yes' +vim.opt.ttyfast = true +vim.opt.errorbells = false +vim.opt.visualbell = false + +-- Use new regular expression engine +-- https://jameschambers.co.uk/vim-typescript-slow +vim.opt.re = 0 + +vim.opt.maxmempattern = 2000000 + +-- start highlighting from 256 lines backwards +vim.cmd 'syntax sync minlines=256' +-- do not highlight very long lines +vim.opt.synmaxcol = 300 + +-- Don't Display the mode you're in. since it's already shown on the statusline +vim.opt.showmode = false + +-- use guifg/guibg instead of ctermfg/ctermbg in terminal +vim.opt.termguicolors = true From 5c251a306006ffb757cfa814f270d7ff40ccf38c Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Sun, 31 Oct 2021 21:32:45 +1300 Subject: [PATCH 02/67] [ nvim ] remove legacy settings.vim --- vim/settings.vim | 10 +++++++--- vim/vim.symlink/settings.vim | 1 - 2 files changed, 7 insertions(+), 4 deletions(-) delete mode 120000 vim/vim.symlink/settings.vim diff --git a/vim/settings.vim b/vim/settings.vim index 4a8dcf1..da55e39 100644 --- a/vim/settings.vim +++ b/vim/settings.vim @@ -76,10 +76,14 @@ set shiftwidth=4 " Turn on line numbers set number +" Set number width +set numberwidth=5 -set numberwidth=5 " Set number width -set scrolloff=5 " Leave 5 lines of buffer when scrolling -set sidescrolloff=10 " Leave 10 characters of horizontal buffer when scrolling +" Leave 5 lines of buffer when scrolling +set scrolloff=5 + +" Leave 10 characters of horizontal buffer when scrolling +set sidescrolloff=10 " Turn on relative line numbers set relativenumber diff --git a/vim/vim.symlink/settings.vim b/vim/vim.symlink/settings.vim deleted file mode 120000 index 550fe26..0000000 --- a/vim/vim.symlink/settings.vim +++ /dev/null @@ -1 +0,0 @@ -../settings.vim \ No newline at end of file From 8f359a1660c54585015ad9fe82b1b809afd21b2d Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Sun, 31 Oct 2021 21:33:41 +1300 Subject: [PATCH 03/67] [ nvim ] slightly tune plugin and vimrc settings --- vim/vim.symlink/coc-settings.json | 36 +++++++++++ vim/vim.symlink/plugin/coc.vim | 2 +- vim/vim.symlink/plugin/plugins.vim | 12 +++- vim/vim.symlink/plugin/telescope.vim | 4 ++ vim/vimrc.symlink | 91 ++++++++++------------------ 5 files changed, 83 insertions(+), 62 deletions(-) create mode 100644 vim/vim.symlink/plugin/telescope.vim diff --git a/vim/vim.symlink/coc-settings.json b/vim/vim.symlink/coc-settings.json index 43b76c1..70440d7 100644 --- a/vim/vim.symlink/coc-settings.json +++ b/vim/vim.symlink/coc-settings.json @@ -227,6 +227,42 @@ "lintTool": "golint" } }, + "lua":{ + "command": "/home/kevin/lua-language-server/bin/Linux/lua-language-server", + "args": ["-E", "/home/kevin/lua-language-server/bin/Linux/main.lua"], + "filetypes": ["lua"], + "rootPatterns": [".git/"], + "settings": { + "Lua": { + "workspace": { + "library": { + "/usr/share/nvim/runtime/lua": true, + "/usr/share/nvim/runtime/lua/vim/lsp": true + }, + "maxPreload": 2000, + "preloadFileSize": 1000 + }, + "runtime": { + "version": "Lua 5.4.3" + }, + "diagnostics": { + "enable": true, + "globals": [ + "hs", + "vim", + "it", + "describe", + "before_each", + "after_each" + ], + "disable": ["lowercase-global"] + }, + "completion": { + "keywordSnippet": "Disable" + } + } + } + }, "bash": { "command": "bash-language-server", "args": ["start"], diff --git a/vim/vim.symlink/plugin/coc.vim b/vim/vim.symlink/plugin/coc.vim index 8d24e87..8799c1c 100644 --- a/vim/vim.symlink/plugin/coc.vim +++ b/vim/vim.symlink/plugin/coc.vim @@ -1,4 +1,4 @@ -let g:coc_node_path = '~/.nvm/versions/node/v14.16.1/bin/node' +"let g:coc_node_path = '~/.nvm/versions/node/v14.16.1/bin/node' let g:coc_global_extensions = [ 'coc-snippets', 'coc-tsserver', 'coc-tslint-plugin', 'coc-css', 'coc-json', 'coc-stylelint', 'coc-styled-components', 'coc-java', 'coc-docthis'] " Symbol renaming. nmap rn (coc-rename) diff --git a/vim/vim.symlink/plugin/plugins.vim b/vim/vim.symlink/plugin/plugins.vim index 59ad106..15f273b 100644 --- a/vim/vim.symlink/plugin/plugins.vim +++ b/vim/vim.symlink/plugin/plugins.vim @@ -1,7 +1,7 @@ call plug#begin('~/.vim/plugged') " Added 15/03/2021 Plug 'jlanzarotta/bufexplorer' -Plug 'roman/golden-ratio' +"Plug 'roman/golden-ratio' " Added 2021年04月01日 Plug 'jeffkreeftmeijer/vim-numbertoggle' Plug 'tpope/vim-eunuch' @@ -22,6 +22,12 @@ Plug 'eliba2/vim-node-inspect' " Added 2021年09月30日 Plug 'honza/vim-snippets' +" Added 2021-10-31 +Plug 'nvim-lua/plenary.nvim' +Plug 'nvim-telescope/telescope.nvim' +Plug 'nvim-treesitter/nvim-treesitter', {'branch': '0.5-compat', 'do': ':TSUpdate'} " We recommend updating the parsers on update +"Plug 'rafcamlet/coc-nvim-lua' + " Plugs to install " General @@ -44,8 +50,8 @@ Plug 'christoomey/vim-tmux-navigator' "Plug 'tpope/vim-rhubarb' Plug 'terryma/vim-multiple-cursors' Plug 'neoclide/coc.nvim', {'branch': 'release'} -Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } -Plug 'junegunn/fzf.vim' +"Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } +"Plug 'junegunn/fzf.vim' Plug 'voldikss/vim-floaterm' Plug 'joshdick/onedark.vim' diff --git a/vim/vim.symlink/plugin/telescope.vim b/vim/vim.symlink/plugin/telescope.vim new file mode 100644 index 0000000..9b1efc2 --- /dev/null +++ b/vim/vim.symlink/plugin/telescope.vim @@ -0,0 +1,4 @@ +nnoremap :Telescope git_files +map t :Telescope file_browser +map tab :Telescope keymaps +map b :Telescope buffers diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index 1af25d1..96ebdb0 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -1,6 +1,5 @@ source ~/.config/nvim/plugin/plugins.vim -"let g:coc_global_extensions = ['coc-emoji', 'coc-eslint', 'coc-prettier', 'coc-tsserver', 'coc-tslint-plugin', 'coc-css', 'coc-json', 'coc-pyls', 'coc-yaml', 'coc-stylelint', 'coc-styled-components', 'coc-rls', 'coc-java'] let g:jsx_ext_required = 0 let g:echodoc#enable_at_startup = 1 let g:echodoc#type = "floating" @@ -18,18 +17,29 @@ let g:go_highlight_structs = 1 let g:go_highlight_types = 1 let g:go_auto_type_info = 1 " let g:coc_filetype_map +" Ack (uses Ag behind the scenes) +let g:ackprg = 'ag --nogroup --nocolor --column' + +" Airline (status line) +let g:airline_powerline_fonts = 1 + +" Gist authorisation settings +let g:github_user = $GITHUB_USER +let g:github_token = $GITHUB_TOKEN +let g:gist_detect_filetype = 1 +let g:gist_open_browser_after_post = 1 let g:go_fmt_command = "goimports" + +" Set built-in file system explorer to use layout similar to the NERDTree plugin +let g:netrw_liststyle=3 + +:luafile ~/.config/nvim/settings.lua " Solarized theme -set background=dark colorscheme onedark syntax off -source ~/.config/nvim/settings.vim - -" Set built-in file system explorer to use layout similar to the NERDTree plugin -let g:netrw_liststyle=3 " Always highlight column 80 so it's easier to see where " cutoff appears on longer screens @@ -43,9 +53,6 @@ map map w :update map q :qall map gs :Gstatus -"vim fzf config -nnoremap :GFiles --exclude-standard --cached --others -map t :Files map 1 :1tabn map 2 :2tabn map 3 :3tabn @@ -62,7 +69,7 @@ nmap gi (coc-implementation) nmap gr (coc-references) nnoremap k :call show_documentation() " Find/replace -vnoremap "hy:%s/h//g +vnoremap "hy:%s/h//g function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') @@ -95,10 +102,6 @@ augroup vimrcex autocmd bufread,bufnewfile vimrc.local set filetype=vim augroup end -" Mapping selecting mappings -nmap (fzf-maps-n) -xmap (fzf-maps-x) -omap (fzf-maps-o) " Easy tab navigation nnoremap :tabprevious @@ -107,23 +110,7 @@ nnoremap :tabnext command! -nargs=0 Format :call CocAction('format') command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') -" Insert mode completion -imap (fzf-complete-word) -imap (fzf-complete-path) -imap (fzf-complete-file-ag) -imap (fzf-complete-line) -" Ack (uses Ag behind the scenes) -let g:ackprg = 'ag --nogroup --nocolor --column' - -" Airline (status line) -let g:airline_powerline_fonts = 1 - -" Gist authorisation settings -let g:github_user = $GITHUB_USER -let g:github_token = $GITHUB_TOKEN -let g:gist_detect_filetype = 1 -let g:gist_open_browser_after_post = 1 " Related plugins: " https://github.com/mattn/webapi-vim " https://github.com/vim-scripts/Gist.vim @@ -141,44 +128,26 @@ map c :Tabularize /: map es :Tabularize /=\zs map cs :Tabularize /:\zs -" }}} - -" Mappings {{{ -" Notes... -" -" :map j gg (j will be mapped to gg) -" :map Q j (Q will also be mapped to gg, because j will be expanded -> recursive mapping) -" :noremap W j (W will be mapped to j not to gg, because j will not be expanded -> non recursive) -" -" These mappings work in all modes. To have mappings work in only specific -" modes then denote the mapping with the mode character. -" -" e.g. -" to map something in just NORMAL mode use :nmap or :nnoremap -" to map something in just VISUAL mode use :vmap or :vnoremap " Clear search buffer :nnoremap § :nohlsearch " Mapping selecting mappings -nmap (fzf-maps-n) -xmap (fzf-maps-x) -omap (fzf-maps-o) +"nmap (fzf-maps-n) +"xmap (fzf-maps-x) +"omap (fzf-maps-o) " Insert mode completion -imap (fzf-complete-word) -imap (fzf-complete-path) -imap (fzf-complete-file-ag) -imap (fzf-complete-line) +"imap (fzf-complete-word) +"imap (fzf-complete-path) +"imap (fzf-complete-file-ag) +"imap (fzf-complete-line) map bn :r !git rev-parse --abbrev-ref HEADA: " Command to use sudo when needed cmap w!! %!sudo tee > /dev/null % - " File System Explorer (in horizontal split) -map . :Sexplore - " Buffers map yt :ls @@ -202,8 +171,6 @@ map ` v " Make saving easier " map w :update map sv :source ~/.vimrc -" Recently edited files -map h :History " Commands {{{ " jump to last cursor @@ -246,10 +213,18 @@ autocmd InsertEnter * match TechWordsToAvoid /\cobviously\|basically\|simply\|of autocmd InsertLeave * match TechWordsToAvoid /\cobviously\|basically\|simply\|of\scourse\|clearly\|just\|everyone\sknows\|however,\|so,\|easy/ autocmd BufWinLeave * call clearmatches() +command! -nargs=0 Ns call Newscratch() +fun! Newscratch() + execute 'tabnew ' + setlocal buftype=nofile + setlocal bufhidden=hide + setlocal noswapfile +endfun + " Create a 'scratch buffer' which is a temporary buffer Vim wont ask to save " http://vim.wikia.com/wiki/Display_output_of_shell_commands_in_new_window command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand() -function! s:RunShellCommand(cmdline) +fun! s:RunShellCommand(cmdline) echo a:cmdline let expanded_cmdline = a:cmdline for part in split(a:cmdline, ' ') From cc06bca21c461bba1cb1176da4dc16f502dc5de3 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Sun, 31 Oct 2021 21:34:42 +1300 Subject: [PATCH 04/67] [ zshrc ] luamake and fzf --- zshrc.symlink | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zshrc.symlink b/zshrc.symlink index 8d31a37..b00a5ba 100644 --- a/zshrc.symlink +++ b/zshrc.symlink @@ -108,3 +108,7 @@ fi # Example aliases alias zshconfig="vim ~/.zshrc" alias ohmyzsh="vim ~/.oh-my-zsh" + +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh + +alias luamake=/home/kevin/lua-language-server/3rd/luamake/luamake From 9e09af734f2005d31aa8ad2f64a916e7592928b5 Mon Sep 17 00:00:00 2001 From: Kevin Jiang <> Date: Sun, 23 Jan 2022 23:58:31 +1300 Subject: [PATCH 05/67] [ nvim ] convert mappings to lua --- vim/vim.symlink/lua/mappings.lua | 57 ++++++++++ vim/vim.symlink/lua/options.lua | 177 +++++++++++++++++++++++++++++++ vim/vimrc.symlink | 173 +++++------------------------- 3 files changed, 262 insertions(+), 145 deletions(-) create mode 100644 vim/vim.symlink/lua/mappings.lua create mode 100644 vim/vim.symlink/lua/options.lua diff --git a/vim/vim.symlink/lua/mappings.lua b/vim/vim.symlink/lua/mappings.lua new file mode 100644 index 0000000..224e809 --- /dev/null +++ b/vim/vim.symlink/lua/mappings.lua @@ -0,0 +1,57 @@ +local vim = vim +local api = vim.api +local M = {} + +function M.map(mode, lhs, rhs, opts) + local options = {noremap = true, silent = true} + if opts then + options = vim.tbl_extend('force', options, opts) + end + api.nvim_set_keymap(mode, lhs, rhs, options) +end + +function M.mapBuf(buf, mode, lhs, rhs, opts) + local options = {noremap = true, silent = true} + if opts then + options = vim.tbl_extend('force', options, opts) + end + api.nvim_buf_set_keymap(buf, mode, lhs, rhs, options) +end + +-- Change leader key from \ to space. +M.map('','','') +M.map('', 'w', ':update') +M.map('', 'q', ':qall') +M.map('', 'gs', ':Gstatus') +M.map('','yd ',' :bufdo bd') +M.map('',';','s') -- Horizontal split +M.map('','`','v') -- Vertical split +-- List buffers +M.map('','yt',':ls') + +M.map('n', 'gd', '(coc-definition)') +M.map('n', 'gy', '(coc-type-definition)') +M.map('n', 'gi', '(coc-implementation)') +M.map('n', 'gr', '(coc-references)') + +M.map('v', '', '"hy:%s/h//g') + +M.map('','e',':Tabularize /=') +M.map('','c',':Tabularize /:') +M.map('','es',':Tabularize /=\zs') +M.map('','cs',':Tabularize /:\zs') + +M.map('n','§',':nohlsearch' ) + +M.map('c','w!!','%!sudo tee > /dev/null %' ) + + + +for i = 1, 9 do + local leader = '' .. i + local tab = ':' .. i .. 'tabn' + M.map('n', leader, tab) +end + + +return M diff --git a/vim/vim.symlink/lua/options.lua b/vim/vim.symlink/lua/options.lua new file mode 100644 index 0000000..bf57675 --- /dev/null +++ b/vim/vim.symlink/lua/options.lua @@ -0,0 +1,177 @@ +local home = os.getenv("HOME") +vim.g.mapleader = " " + +-- Some settings copied from: +-- https://github.com/ahmedelgabri/dotfiles/blob/main/config/nvim/init.lua +-- Persistent undo +vim.opt.background = 'dark' +vim.opt.undodir = home .. '/.vim/undo' +vim.opt.undofile = true +vim.opt.undolevels = 1000 +vim.opt.undoreload = 10000 +vim.opt.updatetime = 300 + +-- Ignored files/directories from autocomplete (and CtrlP) +vim.opt.wildmode = 'longest:full,list,full' +vim.opt.wildignore:append '*.o,*.out,*.obj,.git,*.rbc,*.rbo,*.class,.svn,*.gem,*.pyc' +vim.opt.wildignore:append '*.swp,*~,*/.DS_Store' +vim.opt.wildignore:append '*/vendor/bundle/*' +vim.opt.wildignore:append '*/node_modules/' + +-- Use vim, not vi api +vim.opt.compatible = false + +vim.opt.backupcopy = 'yes' -- overwrite files to update, instead of renaming + rewriting +vim.opt.backup = false +vim.opt.writebackup = false +vim.opt.backupdir = string.format('%s%s', vim.fn.stdpath 'data', '/backup//') -- keep backup files out of the way +vim.opt.backupdir:append '.' + +-- No swap file +vim.opt.swapfile = false + +-- Always show cursor +vim.opt.ruler = true + +-- Show incomplete commands +vim.opt.showcmd = true + +-- Command history +vim.opt.history=500 + +-- Always show cursor +vim.opt.ruler = true + +-- Highlight search matches +vim.opt.hlsearch = true + +-- Ignore case in search +vim.opt.smartcase = true + +-- Make sure any searches /searchPhrase doesn't need the \c escape character +vim.opt.ignorecase = true + +-- Turn word wrap off +vim.opt.wrap = false + +-- Allow backspace to delete end of line, indent and start of line characters +vim.o.backspace = "indent,eol,start" + +-- Convert tabs to spaces +vim.opt.expandtab = true + +-- Set tab size in spaces (this is for manual indenting) +vim.opt.tabstop=4 + +-- The number of spaces inserted for a tab (used for auto indenting) +vim.opt.shiftwidth=4 + +-- Turn on line numbers +vim.opt.number = true + +-- Set number width +vim.opt.numberwidth=5 + +-- Leave 5 lines of buffer when scrolling +vim.opt.scrolloff=5 + +-- Leave 10 characters of horizontal buffer when scrolling +vim.opt.sidescrolloff=10 + +-- Turn on relative line numbers +vim.opt.relativenumber = true + +-- show trailing whitespace +vim.opt.list = true +vim.opt.listchars = { + tab = '⋅ ', + -- tab = '| ', + nbsp = '░', + extends = '»', + precedes = '«', + trail = '␣', +} +vim.opt.joinspaces = false +vim.opt.concealcursor = 'n' + +-- http://stackoverflow.com/questions/2158516/vim-delay-before-o-opens-a-new-line +vim.opt.timeoutlen = 1000 +vim.opt.ttimeoutlen = 0 + +-- Always show status bar +vim.opt.laststatus=2 + +-- Set the status line to something useful +-- set statusline=%f\ %=L:%l/%L\ %c\ (%p%%) +vim.opt.statusline:prepend "%{coc#status()}%{get(b:,'coc_current_function','')}" + +-- UTF encoding +vim.opt.encoding="utf-8" + +-- Autoload files that have changed outside of vim +vim.opt.autoread = true + +-- http://stackoverflow.com/questions/8134647/copy-and-paste-in-vim-via-keyboard-between-different-mac-terminals +vim.opt.clipboard:append 'unnamed' + +-- Don't show intro +vim.opt.shortmess:append 'I' + +-- Better splits (new windows appear below and to the right) +vim.opt.splitbelow = true +vim.opt.splitright = true + +-- Highlight the current line +vim.opt.cursorline = true + +-- Ensure Vim doesn't beep at you every time you make a mistype +vim.opt.visualbell = true + +-- Visual autocomplete for command menu (e.g. :e ~/path/to/file) +vim.opt.wildmenu = true + +-- redraw only when we need to (i.e. don't redraw when executing a macro) +vim.opt.lazyredraw = true + +-- highlight a matching [{()}] when cursor is placed on start/end character +vim.opt.showmatch = true + +-- incremental command live feedback" +vim.opt.inccommand = 'nosplit' + +-- cursor behavior: +-- - no blinking in normal/visual mode +-- - blinking in insert-mode +vim.opt.guicursor:append 'n-v-c:blinkon0,i-ci:ver25-Cursor/lCursor-blinkwait30-blinkoff100-blinkon100' + +-- Make sure diffs are always opened in vertical splits, also match my git settings +vim.opt.diffopt:append 'vertical,algorithm:histogram,indent-heuristic,hiddenoff' + +vim.opt.title = true + +-- highlight matching [{()}] +vim.opt.showmatch = true + +vim.opt.textwidth = 80 +vim.opt.wrap = false +vim.opt.signcolumn = 'yes' +vim.opt.ttyfast = true +vim.opt.errorbells = false +vim.opt.visualbell = false + +-- Use new regular expression engine +-- https://jameschambers.co.uk/vim-typescript-slow +vim.opt.re = 0 + +vim.opt.maxmempattern = 2000000 + +-- start highlighting from 256 lines backwards +vim.cmd 'syntax sync minlines=256' +-- do not highlight very long lines +vim.opt.synmaxcol = 300 + +-- Don't Display the mode you're in. since it's already shown on the statusline +vim.opt.showmode = false + +-- use guifg/guibg instead of ctermfg/ctermbg in terminal +vim.opt.termguicolors = true diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index 96ebdb0..bda4211 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -1,138 +1,33 @@ source ~/.config/nvim/plugin/plugins.vim +:luafile ~/.config/nvim/lua/options.lua +:luafile ~/.config/nvim/lua/mappings.lua +:luafile ~/.config/nvim/settings.lua -let g:jsx_ext_required = 0 -let g:echodoc#enable_at_startup = 1 -let g:echodoc#type = "floating" -" vim-airline -let g:airline_powerline_fonts = 1 -let g:airline#extensions#tabline#enabled = 1 -" Golang specific settings -let g:go_highlight_build_constraints = 1 -let g:go_highlight_extra_types = 1 -let g:go_highlight_fields = 1 -let g:go_highlight_functions = 1 -let g:go_highlight_methods = 1 -let g:go_highlight_operators = 1 -let g:go_highlight_structs = 1 -let g:go_highlight_types = 1 -let g:go_auto_type_info = 1 -" let g:coc_filetype_map " Ack (uses Ag behind the scenes) let g:ackprg = 'ag --nogroup --nocolor --column' -" Airline (status line) -let g:airline_powerline_fonts = 1 - -" Gist authorisation settings -let g:github_user = $GITHUB_USER -let g:github_token = $GITHUB_TOKEN -let g:gist_detect_filetype = 1 -let g:gist_open_browser_after_post = 1 - -let g:go_fmt_command = "goimports" - - -" Set built-in file system explorer to use layout similar to the NERDTree plugin -let g:netrw_liststyle=3 - -:luafile ~/.config/nvim/settings.lua -" Solarized theme -colorscheme onedark -syntax off - - " Always highlight column 80 so it's easier to see where " cutoff appears on longer screens autocmd BufWinEnter * highlight ColorColumn ctermbg=darkred -" }}} -"autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') -" Change leader key from \ to space. -map -map w :update -map q :qall -map gs :Gstatus -map 1 :1tabn -map 2 :2tabn -map 3 :3tabn -map 4 :4tabn -map 5 :5tabn -map 6 :6tabn -map 7 :7tabn -map 8 :8tabn -map 9 :9tabn " GoTo code navigation. -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) +"nmap gd (coc-definition) +"nmap gy (coc-type-definition) +"nmap gi (coc-implementation) +"nmap gr (coc-references) nnoremap k :call show_documentation() " Find/replace -vnoremap "hy:%s/h//g -function! s:show_documentation() - if (index(['vim','help'], &filetype) >= 0) - execute 'h '.expand('') - elseif (coc#rpc#ready()) - call CocActionAsync('doHover') - else - execute '!' . &keywordprg . " " . expand('') - endif -endfunction +"vnoremap "hy:%s/h//g autocmd CursorHold * silent call CocActionAsync('highlight') -augroup vimrcex - autocmd! - - " when editing a file, always jump to the last known cursor position. - " don't do it for commit messages, when the position is invalid, or when - " inside an event handler (happens when dropping a file on gvim). - autocmd bufreadpost * - \ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") | - \ exe "normal g`\"" | - \ endif - - " set syntax highlighting for specific file types - autocmd bufread,bufnewfile *.md set filetype=markdown - autocmd bufread,bufnewfile .{jscs,jshint,eslint}rc set filetype=json - autocmd bufread,bufnewfile aliases.local,zshrc.local,*/zsh/configs/* set filetype=sh - autocmd bufread,bufnewfile gitconfig.local set filetype=gitconfig - autocmd bufread,bufnewfile tmux.conf.local set filetype=tmux - autocmd bufread,bufnewfile vimrc.local set filetype=vim -augroup end - - -" Easy tab navigation -nnoremap :tabprevious -nnoremap :tabnext - command! -nargs=0 Format :call CocAction('format') command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') - -" Related plugins: -" https://github.com/mattn/webapi-vim -" https://github.com/vim-scripts/Gist.vim -" https://github.com/tpope/vim-fugitive - -" HTML generation using 'emmet-vim' -" NORMAL mode Ctrl+y then , - highlight clear SignColumn -" Tabularize -map e :Tabularize /= -map c :Tabularize /: -map es :Tabularize /=\zs -map cs :Tabularize /:\zs - - -" Clear search buffer -:nnoremap § :nohlsearch - - " Mapping selecting mappings "nmap (fzf-maps-n) "xmap (fzf-maps-x) @@ -145,15 +40,6 @@ map cs :Tabularize /:\zs "imap (fzf-complete-line) map bn :r !git rev-parse --abbrev-ref HEADA: -" Command to use sudo when needed -cmap w!! %!sudo tee > /dev/null % - -" Buffers -map yt :ls - -" Buffers (runs the delete buffer command on all open buffers) -map yd :bufdo bd - " Make handling vertical/linear Vim windows easier map w- - " decrement height map w+ + " increment height @@ -161,32 +47,10 @@ map w] _ " maximize height map w \| " maximize width map w[ = " equalize all windows -" Handling horizontal Vim windows doesn't appear to be possible. -" Attempting to map < and > didn't work -" Same with mapping | - -" Make splitting Vim windows easier -map ; s -map ` v " Make saving easier " map w :update map sv :source ~/.vimrc -" Commands {{{ -" jump to last cursor -autocmd BufReadPost * - \ if line("'\"") > 0 && line("'\"") <= line("$") | - \ exe "normal g`\"" | - \ endif - -fun! StripTrailingWhitespace() - " don't strip on these filetypes - if &ft =~ 'markdown' - return - endif - %s/\s\+$//e -endfun -autocmd BufWritePre * call StripTrailingWhitespace() " " specify syntax highlighting for specific files autocmd Bufread,BufNewFile *.md set filetype=markdown @@ -212,6 +76,7 @@ autocmd BufWinEnter * match TechWordsToAvoid /\cobviously\|basically\|simply\|of autocmd InsertEnter * match TechWordsToAvoid /\cobviously\|basically\|simply\|of\scourse\|clearly\|just\|everyone\sknows\|however,\|so,\|easy/ autocmd InsertLeave * match TechWordsToAvoid /\cobviously\|basically\|simply\|of\scourse\|clearly\|just\|everyone\sknows\|however,\|so,\|easy/ autocmd BufWinLeave * call clearmatches() +autocmd FilterWritePre * call SetDiffColors() command! -nargs=0 Ns call Newscratch() fun! Newscratch() @@ -261,4 +126,22 @@ fun! SetDiffColors() highlight DiffChange cterm=bold ctermfg=white ctermbg=DarkBlue highlight DiffText cterm=bold ctermfg=white ctermbg=DarkRed endfun -autocmd FilterWritePre * call SetDiffColors() + +function! s:show_documentation() + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('') + elseif (coc#rpc#ready()) + call CocActionAsync('doHover') + else + execute '!' . &keywordprg . " " . expand('') + endif +endfunction + +fun! StripTrailingWhitespace() + " don't strip on these filetypes + if &ft =~ 'markdown' + return + endif + %s/\s\+$//e +endfun +autocmd BufWritePre * call StripTrailingWhitespace() From 015bf0f8fc31feae04c309022aaf0b32b07737e1 Mon Sep 17 00:00:00 2001 From: Kevin Jiang <> Date: Sun, 23 Jan 2022 23:59:52 +1300 Subject: [PATCH 06/67] [ nvim ] remove unused coc plugin config --- vim/vim.symlink/coc-settings.json | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/vim/vim.symlink/coc-settings.json b/vim/vim.symlink/coc-settings.json index 70440d7..536ff47 100644 --- a/vim/vim.symlink/coc-settings.json +++ b/vim/vim.symlink/coc-settings.json @@ -200,22 +200,6 @@ "snippets.autoTrigger": false, "snippets.userSnippetsDirectory": "~/.config/nvim/Ultisnips", "json.format.enable": true, - "zi.enable": true, - "zi.patterns": { - "": [], - "javascript": ["^\\s*\\/\\/", "^\\s*\\/\\*", "^\\s*\\*", "const \\s*"], - "typescript": ["^\\s*\\/\\/", "^\\s*\\/\\*", "^\\s*\\*"], - "markdown": [], - "vim": ["^\\s*\\\""], - "gitcommit": [] - }, - "zi.syntaxKinds.javascript": [ - "StringLiteral", - "NoSubstitutionTemplateLiteral", - "TemplateHead", - "TemplateTail", - "TemplateMiddle" - ], "languageserver": { "golang": { "command": "gopls", From 5b83f760af89f3d44aab81595b0e4021b1177d39 Mon Sep 17 00:00:00 2001 From: Kevin Jiang <> Date: Mon, 24 Jan 2022 00:00:28 +1300 Subject: [PATCH 07/67] [ nvim ] Move some settings to lua --- vim/vim.symlink/settings.lua | 202 ++++------------------------------- 1 file changed, 20 insertions(+), 182 deletions(-) diff --git a/vim/vim.symlink/settings.lua b/vim/vim.symlink/settings.lua index d9fb810..b196fd7 100644 --- a/vim/vim.symlink/settings.lua +++ b/vim/vim.symlink/settings.lua @@ -3,7 +3,7 @@ require'nvim-treesitter.configs'.setup { ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages highlight = { enable = true, -- false will disable the whole extension - disable = { "c", "rust", "go", "c_sharp" }, -- list of language that will be disabled + disable = { "c", "rust", "c_sharp" }, -- list of language that will be disabled -- Setting this to true will run `:h syntax` and tree-sitter at the same time. -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). -- Using this option may slow down your editor, and you may see some duplicate highlights. @@ -11,6 +11,10 @@ require'nvim-treesitter.configs'.setup { additional_vim_regex_highlighting = false, }, } + +vim.cmd('colorscheme onedark') +vim.cmd('syntax off') + vim.g.loaded_gzip = 1 vim.g.loaded_tar = 1 vim.g.loaded_tarPlugin = 1 @@ -29,184 +33,18 @@ vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 vim.g.loaded_netrwSettings = 1 vim.g.loaded_netrwFileHandlers = 1 --- TO BE MIGRATED TO SEPARATE FILE - --- Some settings copied from: --- https://github.com/ahmedelgabri/dotfiles/blob/main/config/nvim/init.lua - --- Persistent undo -vim.opt.background = 'dark' -vim.opt.undodir = '~/.vim/undo/' -vim.opt.undofile = true -vim.opt.undolevels = 1000 -vim.opt.undoreload = 10000 -vim.opt.updatetime = 300 - --- Ignored files/directories from autocomplete (and CtrlP) -vim.opt.wildmode = 'longest:full,list,full' -vim.opt.wildignore:append '*.o,*.out,*.obj,.git,*.rbc,*.rbo,*.class,.svn,*.gem,*.pyc' -vim.opt.wildignore:append '*.swp,*~,*/.DS_Store' -vim.opt.wildignore:append '*/vendor/bundle/*' -vim.opt.wildignore:append '*/node_modules/' - --- Use vim, not vi api -vim.opt.compatible = false - -vim.opt.backupcopy = 'yes' -- overwrite files to update, instead of renaming + rewriting -vim.opt.backup = false -vim.opt.writebackup = false -vim.opt.backupdir = string.format('%s%s', vim.fn.stdpath 'data', '/backup//') -- keep backup files out of the way -vim.opt.backupdir:append '.' - --- No swap file -vim.opt.swapfile = false - --- Always show cursor -vim.opt.ruler = true - --- Show incomplete commands -vim.opt.showcmd = true - --- Command history -vim.opt.history=500 - --- Always show cursor -vim.opt.ruler = true - --- Highlight search matches -vim.opt.hlsearch = true - --- Ignore case in search -vim.opt.smartcase = true - --- Make sure any searches /searchPhrase doesn't need the \c escape character -vim.opt.ignorecase = true - --- Turn word wrap off -vim.opt.wrap = false - --- Allow backspace to delete end of line, indent and start of line characters -vim.opt.backspace={ - indent, - eol, - start -} - --- Convert tabs to spaces -vim.opt.expandtab = true - --- Set tab size in spaces (this is for manual indenting) -vim.opt.tabstop=4 - --- The number of spaces inserted for a tab (used for auto indenting) -vim.opt.shiftwidth=4 - --- Turn on line numbers -vim.opt.number = true - --- Set number width -vim.opt.numberwidth=5 - --- Leave 5 lines of buffer when scrolling -vim.opt.scrolloff=5 - --- Leave 10 characters of horizontal buffer when scrolling -vim.opt.sidescrolloff=10 - --- Turn on relative line numbers -vim.opt.relativenumber = true - --- show trailing whitespace -vim.opt.list = true -vim.opt.listchars = { - tab = '⋅ ', - -- tab = '| ', - nbsp = '░', - extends = '»', - precedes = '«', - trail = '␣', -} -vim.opt.joinspaces = false -vim.opt.concealcursor = 'n' - --- http://stackoverflow.com/questions/2158516/vim-delay-before-o-opens-a-new-line -vim.opt.timeoutlen = 1000 -vim.opt.ttimeoutlen = 0 - --- Always show status bar -vim.opt.laststatus=2 - --- Set the status line to something useful --- set statusline=%f\ %=L:%l/%L\ %c\ (%p%%) -vim.opt.statusline:prepend "%{coc#status()}%{get(b:,'coc_current_function','')}" - --- UTF encoding -vim.opt.encoding="utf-8" - --- Autoload files that have changed outside of vim -vim.opt.autoread = true - --- http://stackoverflow.com/questions/8134647/copy-and-paste-in-vim-via-keyboard-between-different-mac-terminals -vim.opt.clipboard:append 'unnamed' - --- Don't show intro -vim.opt.shortmess:append 'I' - --- Better splits (new windows appear below and to the right) -vim.opt.splitbelow = true -vim.opt.splitright = true - --- Highlight the current line -vim.opt.cursorline = true - --- Ensure Vim doesn't beep at you every time you make a mistype -vim.opt.visualbell = true - --- Visual autocomplete for command menu (e.g. :e ~/path/to/file) -vim.opt.wildmenu = true - --- redraw only when we need to (i.e. don't redraw when executing a macro) -vim.opt.lazyredraw = true - --- highlight a matching [{()}] when cursor is placed on start/end character -vim.opt.showmatch = true - --- incremental command live feedback" -vim.opt.inccommand = 'nosplit' - --- cursor behavior: --- - no blinking in normal/visual mode --- - blinking in insert-mode -vim.opt.guicursor:append 'n-v-c:blinkon0,i-ci:ver25-Cursor/lCursor-blinkwait30-blinkoff100-blinkon100' - --- Make sure diffs are always opened in vertical splits, also match my git settings -vim.opt.diffopt:append 'vertical,algorithm:histogram,indent-heuristic,hiddenoff' - -vim.opt.title = true - --- highlight matching [{()}] -vim.opt.showmatch = true - -vim.opt.textwidth = 80 -vim.opt.wrap = false -vim.opt.signcolumn = 'yes' -vim.opt.ttyfast = true -vim.opt.errorbells = false -vim.opt.visualbell = false - --- Use new regular expression engine --- https://jameschambers.co.uk/vim-typescript-slow -vim.opt.re = 0 - -vim.opt.maxmempattern = 2000000 - --- start highlighting from 256 lines backwards -vim.cmd 'syntax sync minlines=256' --- do not highlight very long lines -vim.opt.synmaxcol = 300 - --- Don't Display the mode you're in. since it's already shown on the statusline -vim.opt.showmode = false - --- use guifg/guibg instead of ctermfg/ctermbg in terminal -vim.opt.termguicolors = true +-- BEGIN custom config +--vim.g.jsx_ext_required = 0 +--vim.g.airline_powerline_fonts = 1 +--vim.g.go_highlight_extra_types = 1 +--vim.g.go_highlight_fields = 1 +--vim.g.go_highlight_functions = 1 +--vim.g.go_highlight_methods = 1 +--vim.g.go_highlight_operators = 1 +--vim.g.go_highlight_structs = 1 +--vim.g.go_highlight_types = 1 +--vim.g.go_auto_type_info = 1 +--vim.g.ackprg = 'ag --nogroup --nocolor --column' +--vim.g.go_fmt_command = "goimports" + +-- TO BE MIGRATED TO go_highlight_build_constraints = 1SEPARATE FILE From e6d6eb38bed3159feb0702f08dd4600aaf9e0be1 Mon Sep 17 00:00:00 2001 From: Kevin Jiang <> Date: Sun, 13 Feb 2022 22:07:19 +1300 Subject: [PATCH 08/67] fix(rasi): fix issue with rasi --- .config/rofi.symlink/config.rasi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.config/rofi.symlink/config.rasi b/.config/rofi.symlink/config.rasi index 484736f..413c5c2 100644 --- a/.config/rofi.symlink/config.rasi +++ b/.config/rofi.symlink/config.rasi @@ -1,7 +1,6 @@ configuration { - theme: "/usr/share/rofi/themes/Paper.rasi"; modi: "window,drun,ssh,combi"; font: "hack 10"; show-icons: true; - } +@theme "/usr/share/rofi/themes/Paper.rasi" From bd61d43c8132873dae2481437f738a6bd46a47a5 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Sun, 3 Jul 2022 21:54:26 +1200 Subject: [PATCH 09/67] [ nvim ] migrated settings to lua --- vim/vim.symlink/lua/settings.lua | 24 +++++++++++++++ vim/vim.symlink/settings.lua | 50 -------------------------------- vim/vimrc.symlink | 2 +- 3 files changed, 25 insertions(+), 51 deletions(-) create mode 100644 vim/vim.symlink/lua/settings.lua delete mode 100644 vim/vim.symlink/settings.lua diff --git a/vim/vim.symlink/lua/settings.lua b/vim/vim.symlink/lua/settings.lua new file mode 100644 index 0000000..eae8068 --- /dev/null +++ b/vim/vim.symlink/lua/settings.lua @@ -0,0 +1,24 @@ +vim.cmd[[ + colorscheme onedark + syntax off + highlight clear SignColumn +]] + +vim.g.loaded_gzip = 1 +vim.g.loaded_tar = 1 +vim.g.loaded_tarPlugin = 1 +vim.g.loaded_zip = 1 +vim.g.loaded_zipPlugin = 1 +vim.g.loaded_getscript = 1 +vim.g.loaded_getscriptPlugin = 1 +vim.g.loaded_vimball = 1 +vim.g.loaded_vimballPlugin = 1 +vim.g.loaded_matchit = 1 +vim.g.loaded_matchparen = 1 +vim.g.loaded_2html_plugin = 1 +vim.g.loaded_logiPat = 1 +vim.g.loaded_rrhelper = 1 +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 +vim.g.loaded_netrwSettings = 1 +vim.g.loaded_netrwFileHandlers = 1 diff --git a/vim/vim.symlink/settings.lua b/vim/vim.symlink/settings.lua deleted file mode 100644 index b196fd7..0000000 --- a/vim/vim.symlink/settings.lua +++ /dev/null @@ -1,50 +0,0 @@ --- TO BE MIGRATED TO SEPARATE FILE -require'nvim-treesitter.configs'.setup { - ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages - highlight = { - enable = true, -- false will disable the whole extension - disable = { "c", "rust", "c_sharp" }, -- list of language that will be disabled - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, -} - -vim.cmd('colorscheme onedark') -vim.cmd('syntax off') - -vim.g.loaded_gzip = 1 -vim.g.loaded_tar = 1 -vim.g.loaded_tarPlugin = 1 -vim.g.loaded_zip = 1 -vim.g.loaded_zipPlugin = 1 -vim.g.loaded_getscript = 1 -vim.g.loaded_getscriptPlugin = 1 -vim.g.loaded_vimball = 1 -vim.g.loaded_vimballPlugin = 1 -vim.g.loaded_matchit = 1 -vim.g.loaded_matchparen = 1 -vim.g.loaded_2html_plugin = 1 -vim.g.loaded_logiPat = 1 -vim.g.loaded_rrhelper = 1 -vim.g.loaded_netrw = 1 -vim.g.loaded_netrwPlugin = 1 -vim.g.loaded_netrwSettings = 1 -vim.g.loaded_netrwFileHandlers = 1 --- BEGIN custom config ---vim.g.jsx_ext_required = 0 ---vim.g.airline_powerline_fonts = 1 ---vim.g.go_highlight_extra_types = 1 ---vim.g.go_highlight_fields = 1 ---vim.g.go_highlight_functions = 1 ---vim.g.go_highlight_methods = 1 ---vim.g.go_highlight_operators = 1 ---vim.g.go_highlight_structs = 1 ---vim.g.go_highlight_types = 1 ---vim.g.go_auto_type_info = 1 ---vim.g.ackprg = 'ag --nogroup --nocolor --column' ---vim.g.go_fmt_command = "goimports" - --- TO BE MIGRATED TO go_highlight_build_constraints = 1SEPARATE FILE diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index bda4211..dc1bf32 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -1,7 +1,7 @@ source ~/.config/nvim/plugin/plugins.vim :luafile ~/.config/nvim/lua/options.lua :luafile ~/.config/nvim/lua/mappings.lua -:luafile ~/.config/nvim/settings.lua +:luafile ~/.config/nvim/lua/settings.lua " Ack (uses Ag behind the scenes) let g:ackprg = 'ag --nogroup --nocolor --column' From 730fee3ed5a9c0e778f547e857850dbe6aee9576 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Sun, 3 Jul 2022 23:06:09 +1200 Subject: [PATCH 10/67] [ nvim ] migrate commands and mappings --- vim/vim.symlink/lua/commands.lua | 84 +++++++++++++++++++ vim/vim.symlink/lua/init.lua | 6 ++ vim/vim.symlink/lua/mappings.lua | 30 ++++--- vim/vim.symlink/lua/options.lua | 2 + .../lua/pluginconfig/coc-config.lua | 10 +++ vim/vim.symlink/lua/pluginconfig/init.lua | 3 + 6 files changed, 122 insertions(+), 13 deletions(-) create mode 100644 vim/vim.symlink/lua/commands.lua create mode 100644 vim/vim.symlink/lua/init.lua create mode 100644 vim/vim.symlink/lua/pluginconfig/coc-config.lua create mode 100644 vim/vim.symlink/lua/pluginconfig/init.lua diff --git a/vim/vim.symlink/lua/commands.lua b/vim/vim.symlink/lua/commands.lua new file mode 100644 index 0000000..2e27e12 --- /dev/null +++ b/vim/vim.symlink/lua/commands.lua @@ -0,0 +1,84 @@ +vim.cmd('command! -nargs=0 Format :call CocAction(\'format\') ') +vim.cmd('command! -nargs=0 OR :call CocAction(\'runCommand\', \'editor.action.organizeImport\')') + +--[[ + [Reset spelling colours when reading a new buffer + [This works around an issue where the colorscheme is changed by .local.vimrc + ]] +vim.cmd[[ + fun! SetSpellingColors() + highlight SpellBad cterm=bold ctermfg=white ctermbg=red + highlight SpellCap cterm=bold ctermfg=red ctermbg=white + endfun + + autocmd BufWinEnter * call SetSpellingColors() + autocmd BufNewFile * call SetSpellingColors() + autocmd InsertEnter * call SetSpellingColors() + autocmd InsertLeave * call SetSpellingColors() +]] + + +--[[ + [Change colourscheme when diffing + ]] +vim.cmd[[ + fun! SetDiffColors() + highlight DiffAdd cterm=bold ctermfg=white ctermbg=DarkGreen + highlight DiffDelete cterm=bold ctermfg=white ctermbg=DarkGrey + highlight DiffChange cterm=bold ctermfg=white ctermbg=DarkBlue + highlight DiffText cterm=bold ctermfg=white ctermbg=DarkRed + endfun +]] + +vim.cmd[[ + fun! StripTrailingWhitespace() + " don't strip on these filetypes + if &ft =~ 'markdown' + return + endif + %s/\s\+$//e + endfun + autocmd BufWritePre * call StripTrailingWhitespace() +]] + +--[[ + [Create a 'scratch buffer' which is a temporary buffer Vim wont ask to save + [http://vim.wikia.com/wiki/Display_output_of_shell_commands_in_new_window + ]] +vim.cmd[[ + command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand() + fun! s:RunShellCommand(cmdline) + echo a:cmdline + let expanded_cmdline = a:cmdline + for part in split(a:cmdline, ' ') + if part[0] =~ '\v[%#<]' + let expanded_part = fnameescape(expand(part)) + let expanded_cmdline = substitute(expanded_cmdline, part, expanded_part, '') + endif + endfor + botright new + setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap + call setline(1, 'You entered: ' . a:cmdline) + call setline(2, 'Expanded Form: ' .expanded_cmdline) + call setline(3,substitute(getline(2),'.','=','g')) + execute '$read !'. expanded_cmdline + setlocal nomodifiable + 1 + endfunction +]] + + +vim.cmd[[ + command! -nargs=0 Ns call Newscratch() + fun! Newscratch() + execute 'tabnew ' + setlocal buftype=nofile + setlocal bufhidden=hide + setlocal noswapfile + endfun +]] + +function new_scratch() + vim.api.nvim_create_buf() + +end diff --git a/vim/vim.symlink/lua/init.lua b/vim/vim.symlink/lua/init.lua new file mode 100644 index 0000000..7d13176 --- /dev/null +++ b/vim/vim.symlink/lua/init.lua @@ -0,0 +1,6 @@ +require('plugins') +require('pluginconfig') +require('options') +require('commands') +require('settings') +require('mappings') diff --git a/vim/vim.symlink/lua/mappings.lua b/vim/vim.symlink/lua/mappings.lua index 224e809..b4be58a 100644 --- a/vim/vim.symlink/lua/mappings.lua +++ b/vim/vim.symlink/lua/mappings.lua @@ -1,3 +1,5 @@ +require('pluginconfig/coc-config') + local vim = vim local api = vim.api local M = {} @@ -20,29 +22,31 @@ end -- Change leader key from \ to space. M.map('','','') -M.map('', 'w', ':update') -M.map('', 'q', ':qall') -M.map('', 'gs', ':Gstatus') -M.map('','yd ',' :bufdo bd') +M.map('','w',':update') +M.map('','q',':qall') +M.map('','gs',':Git') +M.map('','yd',':bufdo bd') M.map('',';','s') -- Horizontal split M.map('','`','v') -- Vertical split --- List buffers +M.map('',']','s') -- Horizontal split +M.map('','[','v') -- Vertical split +M.map('','=','=') -- Horizontal split +M.map('','',':wincmd _ :wincmd | ') -- maximize width and height M.map('','yt',':ls') - -M.map('n', 'gd', '(coc-definition)') -M.map('n', 'gy', '(coc-type-definition)') -M.map('n', 'gi', '(coc-implementation)') -M.map('n', 'gr', '(coc-references)') - -M.map('v', '', '"hy:%s/h//g') - M.map('','e',':Tabularize /=') M.map('','c',':Tabularize /:') M.map('','es',':Tabularize /=\zs') M.map('','cs',':Tabularize /:\zs') +M.map('n','k',':lua show_documentation()') +M.map('n','gd','(coc-definition)',{noremap = false, silent = true}) +M.map('n','gy','(coc-type-definition)',{noremap = false, silent = true}) +M.map('n','gi','(coc-implementation)',{noremap = false, silent = true}) +M.map('n','gr','(coc-references)',{noremap = false, silent = true}) M.map('n','§',':nohlsearch' ) +M.map('v','','"hy:%s/h//g') + M.map('c','w!!','%!sudo tee > /dev/null %' ) diff --git a/vim/vim.symlink/lua/options.lua b/vim/vim.symlink/lua/options.lua index bf57675..c74b02f 100644 --- a/vim/vim.symlink/lua/options.lua +++ b/vim/vim.symlink/lua/options.lua @@ -63,6 +63,8 @@ vim.opt.expandtab = true -- Set tab size in spaces (this is for manual indenting) vim.opt.tabstop=4 +vim.opt.softtabstop=4 + -- The number of spaces inserted for a tab (used for auto indenting) vim.opt.shiftwidth=4 diff --git a/vim/vim.symlink/lua/pluginconfig/coc-config.lua b/vim/vim.symlink/lua/pluginconfig/coc-config.lua new file mode 100644 index 0000000..502b4f1 --- /dev/null +++ b/vim/vim.symlink/lua/pluginconfig/coc-config.lua @@ -0,0 +1,10 @@ +function show_documentation() + local filetype = vim.bo.filetype + + if filetype == 'vim' or filetype == 'help' then + vim.api.nvim_command('h ' .. filetype) + + elseif vim.call('coc#rpc#ready') then + vim.fn.CocActionAsync('doHover') + end +end diff --git a/vim/vim.symlink/lua/pluginconfig/init.lua b/vim/vim.symlink/lua/pluginconfig/init.lua new file mode 100644 index 0000000..9d07fc9 --- /dev/null +++ b/vim/vim.symlink/lua/pluginconfig/init.lua @@ -0,0 +1,3 @@ +require('pluginconfig.coc-config') +--require('pluginconfig.nvim-treesitter') +--require('pluginconfig.telescope-config') From 462cd9660693cdf916b2da3f31deb36e1127a208 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Sun, 3 Jul 2022 23:06:38 +1200 Subject: [PATCH 11/67] [ polybar ] rename polybar config --- .config/polybar.symlink/{config => config.ini} | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) rename .config/polybar.symlink/{config => config.ini} (97%) diff --git a/.config/polybar.symlink/config b/.config/polybar.symlink/config.ini similarity index 97% rename from .config/polybar.symlink/config rename to .config/polybar.symlink/config.ini index 022932b..eb29d79 100755 --- a/.config/polybar.symlink/config +++ b/.config/polybar.symlink/config.ini @@ -346,10 +346,10 @@ override-redirect = true [module/eth] type = internal/network interface = ${env:ETH_INTERFACE} -label-connected = %{} %ifname% %local_ip% %{} +label-connected = %ifname% %local_ip% label-connected-background = #212E3A -label-disconnected = wireless not connected %{} +label-disconnected = wireless not connected label-disconnected-foreground = #656D7E label-disconnected-background = #212E3A @@ -378,22 +378,22 @@ format-packetloss = %{A1:networkmanager_dmenu:} Date: Sun, 3 Jul 2022 23:07:39 +1200 Subject: [PATCH 12/67] Remove migrated code --- vim/vimrc.symlink | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index dc1bf32..e158600 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -11,13 +11,6 @@ let g:ackprg = 'ag --nogroup --nocolor --column' autocmd BufWinEnter * highlight ColorColumn ctermbg=darkred -" GoTo code navigation. -"nmap gd (coc-definition) -"nmap gy (coc-type-definition) -"nmap gi (coc-implementation) -"nmap gr (coc-references) -nnoremap k :call show_documentation() -" Find/replace "vnoremap "hy:%s/h//g autocmd CursorHold * silent call CocActionAsync('highlight') @@ -127,16 +120,6 @@ fun! SetDiffColors() highlight DiffText cterm=bold ctermfg=white ctermbg=DarkRed endfun -function! s:show_documentation() - if (index(['vim','help'], &filetype) >= 0) - execute 'h '.expand('') - elseif (coc#rpc#ready()) - call CocActionAsync('doHover') - else - execute '!' . &keywordprg . " " . expand('') - endif -endfunction - fun! StripTrailingWhitespace() " don't strip on these filetypes if &ft =~ 'markdown' From 035011fa53dcf64a1d2f32c7268017be87175e0b Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Mon, 18 Jul 2022 22:03:17 +1200 Subject: [PATCH 13/67] [ nvim ] usable Lua based nvim config --- vim/vim.symlink/autoload/plug.vim | 25 +++-- vim/vim.symlink/lua/commands.lua | 55 ++++++++--- vim/vim.symlink/lua/mappings.lua | 27 +----- .../lua/pluginconfig/nvim-treesitter.lua | 92 ++++++++++++++++++ .../lua/pluginconfig/telescope-config.lua | 96 ++++++++++++++++++ vim/vim.symlink/lua/utils.lua | 39 ++++++++ vim/vim.symlink/plugin/airline.vim | 3 + vim/vim.symlink/plugin/coc.vim | 3 + vim/vimrc.symlink | 97 +------------------ 9 files changed, 300 insertions(+), 137 deletions(-) create mode 100644 vim/vim.symlink/lua/pluginconfig/nvim-treesitter.lua create mode 100644 vim/vim.symlink/lua/pluginconfig/telescope-config.lua create mode 100644 vim/vim.symlink/lua/utils.lua create mode 100644 vim/vim.symlink/plugin/airline.vim diff --git a/vim/vim.symlink/autoload/plug.vim b/vim/vim.symlink/autoload/plug.vim index 2b89b5a..46416b8 100644 --- a/vim/vim.symlink/autoload/plug.vim +++ b/vim/vim.symlink/autoload/plug.vim @@ -116,6 +116,10 @@ let s:TYPE = { let s:loaded = get(s:, 'loaded', {}) let s:triggers = get(s:, 'triggers', {}) +function! s:is_powershell(shell) + return a:shell =~# 'powershell\(\.exe\)\?$' || a:shell =~# 'pwsh\(\.exe\)\?$' +endfunction + function! s:isabsolute(dir) abort return a:dir =~# '^/' || (has('win32') && a:dir =~? '^\%(\\\|[A-Z]:\)') endfunction @@ -238,6 +242,8 @@ function! plug#begin(...) let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p')) elseif exists('g:plug_home') let home = s:path(g:plug_home) + elseif has('nvim') + let home = stdpath('data') . '/plugged' elseif !empty(&rtp) let home = s:path(split(&rtp, ',')[0]) . '/plugged' else @@ -263,7 +269,7 @@ function! s:define_commands() endif if has('win32') \ && &shellslash - \ && (&shell =~# 'cmd\(\.exe\)\?$' || &shell =~# 'powershell\(\.exe\)\?$') + \ && (&shell =~# 'cmd\(\.exe\)\?$' || s:is_powershell(&shell)) return s:err('vim-plug does not support shell, ' . &shell . ', when shellslash is set.') endif if !has('nvim') @@ -401,7 +407,7 @@ function! plug#end() for [map, names] in items(lod.map) for [mode, map_prefix, key_prefix] in - \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] + \ [['i', '', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']] execute printf( \ '%snoremap %s %s:call lod_map(%s, %s, %s, "%s")', \ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix) @@ -503,7 +509,7 @@ if s:is_win let batchfile = s:plug_tempname().'.bat' call writefile(s:wrap_cmds(a:cmd), batchfile) let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 0}) - if &shell =~# 'powershell\(\.exe\)\?$' + if s:is_powershell(&shell) let cmd = '& ' . cmd endif return [batchfile, cmd] @@ -984,7 +990,7 @@ function! s:chsh(swap) set shell=sh endif if a:swap - if &shell =~# 'powershell\(\.exe\)\?$' || &shell =~# 'pwsh$' + if s:is_powershell(&shell) let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s' elseif &shell =~# 'sh' || &shell =~# 'cmd\(\.exe\)\?$' set shellredir=>%s\ 2>&1 @@ -1204,7 +1210,8 @@ function! s:update_impl(pull, force, args) abort normal! 2G silent! redraw - let s:clone_opt = [] + " Set remote name, overriding a possible user git config's clone.defaultRemoteName + let s:clone_opt = ['--origin', 'origin'] if get(g:, 'plug_shallow', 1) call extend(s:clone_opt, ['--depth', '1']) if s:git_version_requirement(1, 7, 10) @@ -2225,7 +2232,7 @@ function! plug#shellescape(arg, ...) let script = get(opts, 'script', 1) if shell =~# 'cmd\(\.exe\)\?$' return s:shellesc_cmd(a:arg, script) - elseif shell =~# 'powershell\(\.exe\)\?$' || shell =~# 'pwsh$' + elseif s:is_powershell(shell) return s:shellesc_ps1(a:arg) endif return s:shellesc_sh(a:arg) @@ -2277,7 +2284,7 @@ function! s:system(cmd, ...) return system(a:cmd) endif let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"shell": &shell, "script": 0})')) - if &shell =~# 'powershell\(\.exe\)\?$' + if s:is_powershell(&shell) let cmd = '& ' . cmd endif else @@ -2759,9 +2766,9 @@ function! s:snapshot(force, ...) abort 1 let anchor = line('$') - 3 let names = sort(keys(filter(copy(g:plugs), - \'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)'))) + \'has_key(v:val, "uri") && isdirectory(v:val.dir)'))) for name in reverse(names) - let sha = s:git_revision(g:plugs[name].dir) + let sha = has_key(g:plugs[name], 'commit') ? g:plugs[name].commit : s:git_revision(g:plugs[name].dir) if !empty(sha) call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha)) redraw diff --git a/vim/vim.symlink/lua/commands.lua b/vim/vim.symlink/lua/commands.lua index 2e27e12..ea6fa70 100644 --- a/vim/vim.symlink/lua/commands.lua +++ b/vim/vim.symlink/lua/commands.lua @@ -1,6 +1,15 @@ +local M = require('utils') + + vim.cmd('command! -nargs=0 Format :call CocAction(\'format\') ') vim.cmd('command! -nargs=0 OR :call CocAction(\'runCommand\', \'editor.action.organizeImport\')') +vim.cmd[[ + highlight clear SignColumn + highlight Comment cterm=italic gui=italic + highlight TechWordsToAvoid ctermbg=red ctermfg=white +]] + --[[ [Reset spelling colours when reading a new buffer [This works around an issue where the colorscheme is changed by .local.vimrc @@ -30,6 +39,8 @@ vim.cmd[[ endfun ]] +M.autocmd('FilterWritePre', 'call SetDiffColors()') + vim.cmd[[ fun! StripTrailingWhitespace() " don't strip on these filetypes @@ -68,17 +79,39 @@ vim.cmd[[ ]] -vim.cmd[[ - command! -nargs=0 Ns call Newscratch() - fun! Newscratch() - execute 'tabnew ' - setlocal buftype=nofile - setlocal bufhidden=hide - setlocal noswapfile - endfun -]] +--vim.cmd[[ + --command! -nargs=0 Ns call Newscratch() + --fun! Newscratch() + --execute 'tabnew ' + --setlocal buftype=nofile + --setlocal bufhidden=hide + --setlocal noswapfile + --endfun +--]] function new_scratch() - vim.api.nvim_create_buf() - + vim.api.nvim_command('tabnew') + vim.api.nvim_create_buf(false, true) + vim.opt_local.buftype = 'nofile' + vim.opt_local.bufhidden = 'hide' + vim.opt_local.swapfile = false + M.mapBuf(vim.api.nvim_get_current_buf(), 'n', 's', ':file note_' .. os.time() ..'| set buftype= swapfile | w ') end + + + +-- Always highlight column 80 so it's easier to see where +-- cutoff appears on longer screens +--autocmd BufWinEnter * highlight ColorColumn ctermbg=darkred +M.autocmd('BufWinEnter', 'highlight ColorColumn ctermbg=darkred', nil) + +-- Map double Esc to wipebuffer in terminals +M.autocmd('TermOpen', 'nmap :bd!', nil) + + +--Open NERDTree if start with no args +--autocmd VimEnter * if !argc() | NERDTree | endif +M.autocmd('VimEnter', 'if !argc() | NERDTree | endif', nil) + +M.autocmd('CursorHold', 'silent call CocActionAsync(\'highlight\')') + diff --git a/vim/vim.symlink/lua/mappings.lua b/vim/vim.symlink/lua/mappings.lua index b4be58a..92a177e 100644 --- a/vim/vim.symlink/lua/mappings.lua +++ b/vim/vim.symlink/lua/mappings.lua @@ -1,24 +1,7 @@ require('pluginconfig/coc-config') +require('commands') +local M = require('utils') -local vim = vim -local api = vim.api -local M = {} - -function M.map(mode, lhs, rhs, opts) - local options = {noremap = true, silent = true} - if opts then - options = vim.tbl_extend('force', options, opts) - end - api.nvim_set_keymap(mode, lhs, rhs, options) -end - -function M.mapBuf(buf, mode, lhs, rhs, opts) - local options = {noremap = true, silent = true} - if opts then - options = vim.tbl_extend('force', options, opts) - end - api.nvim_buf_set_keymap(buf, mode, lhs, rhs, options) -end -- Change leader key from \ to space. M.map('','','') @@ -37,8 +20,10 @@ M.map('','e',':Tabularize /=') M.map('','c',':Tabularize /:') M.map('','es',':Tabularize /=\zs') M.map('','cs',':Tabularize /:\zs') +M.map('','',':q', {noremap = false, silent = true} ) M.map('n','k',':lua show_documentation()') +M.map('n','n',':lua new_scratch()') M.map('n','gd','(coc-definition)',{noremap = false, silent = true}) M.map('n','gy','(coc-type-definition)',{noremap = false, silent = true}) M.map('n','gi','(coc-implementation)',{noremap = false, silent = true}) @@ -49,7 +34,7 @@ M.map('v','','"hy:%s/h//g') M.map('c','w!!','%!sudo tee > /dev/null %' ) - +M.map('t','','' ) for i = 1, 9 do local leader = '' .. i @@ -57,5 +42,3 @@ for i = 1, 9 do M.map('n', leader, tab) end - -return M diff --git a/vim/vim.symlink/lua/pluginconfig/nvim-treesitter.lua b/vim/vim.symlink/lua/pluginconfig/nvim-treesitter.lua new file mode 100644 index 0000000..fb8d2ef --- /dev/null +++ b/vim/vim.symlink/lua/pluginconfig/nvim-treesitter.lua @@ -0,0 +1,92 @@ +require("nvim-treesitter.configs").setup({ + ensure_installed = "all", -- one of 'all', 'language', or a list of languages + highlight = { + enable = true, -- false will disable the whole extension + disable = {}, -- list of language that will be disabled + additional_vim_regex_highlighting = false, + }, + incremental_selection = { + enable = true, + keymaps = { -- mappings for incremental selection (visual mappings) + -- node_incremental = "grn", -- increment to the upper named parent + -- scope_incremental = "grc", -- increment to the upper scope (as defined in locals.scm) + -- init_selection = 'gnn', -- maps in normal mode to init the node/scope selection + -- node_decremental = "grm" -- decrement to the previous node + init_selection = "", + scope_incremental = "", + node_incremental = "", + node_decremental = "", + }, + }, + refactor = { + highlight_definitions = { enable = false }, + highlight_current_scope = { enable = false }, + smart_rename = { + enable = true, + keymaps = { + smart_rename = "Gr", -- mapping to rename reference under cursor + }, + }, + navigation = { + enable = true, + keymaps = { + goto_definition = "Gd", -- mapping to go to definition of symbol under cursor + list_definitions = "GD", -- mapping to list all definitions in current file + }, + }, + }, + textobjects = { -- syntax-aware textobjects + select = { + enable = true, + disable = {}, + keymaps = { + ["aF"] = "@function.outer", + ["iF"] = "@function.inner", + ["aC"] = "@class.outer", + ["iC"] = "@class.inner", + ["iB"] = "@block.inner", + ["aB"] = "@block.outer", + -- use sandwich + -- ["i"] = "@call.inner", + -- ["a"] = "@call.outer", + -- ["a"] = "@comment.outer", + ["iI"] = "@conditional.inner", + ["aI"] = "@conditional.outer", + ["iL"] = "@loop.inner", + ["aL"] = "@loop.outer", + ["iP"] = "@parameter.inner", + ["aP"] = "@parameter.outer", + ["aS"] = "@statement.outer", + }, + }, + swap = { + enable = true, + swap_next = { ["G>>"] = "@parameter.inner" }, + swap_previous = { ["G<<"] = "@parameter.inner" }, + }, + move = { + enable = true, + goto_next_start = { ["]m"] = "@function.outer", ["]]"] = "@class.outer" }, + goto_next_end = { ["]M"] = "@function.outer", ["]["] = "@class.outer" }, + goto_previous_start = { ["[m"] = "@function.outer", ["[["] = "@class.outer" }, + goto_previous_end = { ["[M"] = "@function.outer", ["[]"] = "@class.outer" }, + }, + }, + textsubjects = { enable = true, keymaps = { ["."] = "textsubjects-smart" } }, + rainbow = { + enable = true, + disable = { "cpp" }, -- please disable lua and bash for now + }, + pairs = { + enable = false, + disable = {}, + highlight_pair_events = { "CursorMoved" }, -- when to highlight the pairs, use {} to deactivate highlighting + highlight_self = true, + goto_right_end = false, -- whether to go to the end of the right partner or the beginning + fallback_cmd_normal = "call matchit#Match_wrapper('',1,'n')", -- What command to issue when we can't find a pair (e.g. "normal! %") + keymaps = { goto_partner = "%" }, + }, + context_commentstring = { enable = true }, +}) + +vim.api.nvim_set_keymap("n", "e", "e!", { noremap = false, silent = true }) diff --git a/vim/vim.symlink/lua/pluginconfig/telescope-config.lua b/vim/vim.symlink/lua/pluginconfig/telescope-config.lua new file mode 100644 index 0000000..e5d809b --- /dev/null +++ b/vim/vim.symlink/lua/pluginconfig/telescope-config.lua @@ -0,0 +1,96 @@ +-- Telescope Global remapping +local action_state = require("telescope.actions.state") +local actions = require("telescope.actions") +local fb_actions = require("telescope._extensions.file_browser.actions") + +require("telescope").setup({ + defaults = { + winblend = 20, + sorting_strategy = "descending", + layout_strategy = "flex", + layout_config = { + flex = { + flip_columns = 140, + }, + vertical = { + preview_cutoff = 40, + prompt_position = "bottom", + }, + horizontal = { + width = 0.9, + height = 0.8, + }, + }, + mappings = { + i = { + [""] = actions.close, + [""] = actions.smart_send_to_qflist + actions.open_qflist, + }, + }, + }, + extensions = { + file_browser = { + theme = "ivy", + mappings = { + ["i"] = { + [""] = fb_actions.move, + }, + ["n"] = { + -- your custom normal mode mappings + }, + }, + }, + }, + pickers = { + buffers = { + sort_lastused = true, + mappings = { + i = { + [""] = "delete_buffer", + }, + n = { + [""] = "delete_buffer", + }, + }, + }, + -- https://gitter.im/nvim-telescope/community?at=6113b874025d436054c468e6 Fabian David Schmidt + find_files = { + on_input_filter_cb = function(prompt) + local find_colon = string.find(prompt, ":") + if find_colon then + local ret = string.sub(prompt, 1, find_colon - 1) + vim.schedule(function() + local prompt_bufnr = vim.api.nvim_get_current_buf() + local picker = action_state.get_current_picker(prompt_bufnr) + local lnum = tonumber(prompt:sub(find_colon + 1)) + if type(lnum) == "number" then + local win = picker.previewer.state.winid + local bufnr = picker.previewer.state.bufnr + local line_count = vim.api.nvim_buf_line_count(bufnr) + vim.api.nvim_win_set_cursor(win, { math.max(1, math.min(lnum, line_count)), 0 }) + end + end) + return { prompt = ret } + end + end, + attach_mappings = function() + actions.select_default:enhance({ + post = function() + -- if we found something, go to line + local prompt = action_state.get_current_line() + local find_colon = string.find(prompt, ":") + if find_colon then + local lnum = tonumber(prompt:sub(find_colon + 1)) + vim.api.nvim_win_set_cursor(0, { lnum, 0 }) + end + end, + }) + return true + end, + }, + }, +}) + +--require("telescope").load_extension("terms") +require("telescope").load_extension("fzf") +require("telescope").load_extension("file_browser") diff --git a/vim/vim.symlink/lua/utils.lua b/vim/vim.symlink/lua/utils.lua new file mode 100644 index 0000000..b0d06ec --- /dev/null +++ b/vim/vim.symlink/lua/utils.lua @@ -0,0 +1,39 @@ +-- Shamelessly copied from https://github.com/ahmedelgabri/dotfiles/blob/main/config/nvim/lua/_/utils/map.lua + +local M = {} +local api = vim.api + +function M.map(mode, lhs, rhs, opts) + local options = {noremap = true, silent = true} + if opts then + options = vim.tbl_extend('force', options, opts) + end + api.nvim_set_keymap(mode, lhs, rhs, options) +end + +function M.mapBuf(buf, mode, lhs, rhs, opts) + local options = {noremap = true, silent = true} + if opts then + options = vim.tbl_extend('force', options, opts) + end + api.nvim_buf_set_keymap(buf, mode, lhs, rhs, options) +end + +function M.autocmd(event, command, pattern) + pattern = pattern or "*" + opts = { command = command, pattern = pattern} + + api.nvim_create_autocmd(event, opts) +end + +--[[ + [function M.map(event, command, augroup, pattern) + [ api.nvim_create_autocmd(event, { + [ command = command, + [ pattern = pattern, + [ group = augroup, + [ }) + [end + ]] + +return M diff --git a/vim/vim.symlink/plugin/airline.vim b/vim/vim.symlink/plugin/airline.vim new file mode 100644 index 0000000..0e67321 --- /dev/null +++ b/vim/vim.symlink/plugin/airline.vim @@ -0,0 +1,3 @@ +" vim-airline +let g:airline_powerline_fonts = 1 +let g:airline#extensions#tabline#enabled = 1 diff --git a/vim/vim.symlink/plugin/coc.vim b/vim/vim.symlink/plugin/coc.vim index 8799c1c..7b8075d 100644 --- a/vim/vim.symlink/plugin/coc.vim +++ b/vim/vim.symlink/plugin/coc.vim @@ -1,5 +1,8 @@ "let g:coc_node_path = '~/.nvm/versions/node/v14.16.1/bin/node' let g:coc_global_extensions = [ 'coc-snippets', 'coc-tsserver', 'coc-tslint-plugin', 'coc-css', 'coc-json', 'coc-stylelint', 'coc-styled-components', 'coc-java', 'coc-docthis'] +let g:jsx_ext_required = 0 +let g:echodoc#enable_at_startup = 1 +let g:echodoc#type = "floating" " Symbol renaming. nmap rn (coc-rename) diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index e158600..2e49260 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -1,53 +1,15 @@ source ~/.config/nvim/plugin/plugins.vim -:luafile ~/.config/nvim/lua/options.lua -:luafile ~/.config/nvim/lua/mappings.lua -:luafile ~/.config/nvim/lua/settings.lua +:luafile ~/.config/nvim/lua/init.lua " Ack (uses Ag behind the scenes) let g:ackprg = 'ag --nogroup --nocolor --column' " Always highlight column 80 so it's easier to see where " cutoff appears on longer screens -autocmd BufWinEnter * highlight ColorColumn ctermbg=darkred - -"vnoremap "hy:%s/h//g - -autocmd CursorHold * silent call CocActionAsync('highlight') - -command! -nargs=0 Format :call CocAction('format') -command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') - -highlight clear SignColumn - - -" Mapping selecting mappings -"nmap (fzf-maps-n) -"xmap (fzf-maps-x) -"omap (fzf-maps-o) - -" Insert mode completion -"imap (fzf-complete-word) -"imap (fzf-complete-path) -"imap (fzf-complete-file-ag) -"imap (fzf-complete-line) -map bn :r !git rev-parse --abbrev-ref HEADA: - -" Make handling vertical/linear Vim windows easier -map w- - " decrement height -map w+ + " increment height -map w] _ " maximize height -map w \| " maximize width -map w[ = " equalize all windows - -" Make saving easier -" map w :update -map sv :source ~/.vimrc - -" " specify syntax highlighting for specific files autocmd Bufread,BufNewFile *.md set filetype=markdown -" au BufRead,BufNewFile *.txt,*.tex,*.md set wrap linebreak nolist textwidth=0 wrapmargin=0 +"au BufRead,BufNewFile *.txt,*.tex,*.md set wrap linebreak nolist textwidth=0 wrapmargin=0 " file formats autocmd Filetype gitcommit setlocal spell textwidth=72 @@ -58,18 +20,13 @@ autocmd FileType sh,cucumber,ruby,zsh,vim setlocal shiftwidth=2 tabstop=2 expand " specify syntax highlighting for specific files autocmd Bufread,BufNewFile *.spv set filetype=php -autocmd VimEnter * if !argc() | NERDTree | endif " Highlight words to avoid in tech writing " http://css-tricks.com/words-avoid-educational-writing/ -highlight Comment cterm=italic gui=italic -highlight TechWordsToAvoid ctermbg=red ctermfg=white match TechWordsToAvoid /\cobviously\|basically\|simply\|of\scourse\|clearly\|just\|everyone\sknows\|however\|so,\|easy/ autocmd BufWinEnter * match TechWordsToAvoid /\cobviously\|basically\|simply\|of\scourse\|clearly\|just\|everyone\sknows\|however,\|so,\|easy/ autocmd InsertEnter * match TechWordsToAvoid /\cobviously\|basically\|simply\|of\scourse\|clearly\|just\|everyone\sknows\|however,\|so,\|easy/ autocmd InsertLeave * match TechWordsToAvoid /\cobviously\|basically\|simply\|of\scourse\|clearly\|just\|everyone\sknows\|however,\|so,\|easy/ -autocmd BufWinLeave * call clearmatches() -autocmd FilterWritePre * call SetDiffColors() command! -nargs=0 Ns call Newscratch() fun! Newscratch() @@ -78,53 +35,3 @@ fun! Newscratch() setlocal bufhidden=hide setlocal noswapfile endfun - -" Create a 'scratch buffer' which is a temporary buffer Vim wont ask to save -" http://vim.wikia.com/wiki/Display_output_of_shell_commands_in_new_window -command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand() -fun! s:RunShellCommand(cmdline) - echo a:cmdline - let expanded_cmdline = a:cmdline - for part in split(a:cmdline, ' ') - if part[0] =~ '\v[%#<]' - let expanded_part = fnameescape(expand(part)) - let expanded_cmdline = substitute(expanded_cmdline, part, expanded_part, '') - endif - endfor - botright new - setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap - call setline(1, 'You entered: ' . a:cmdline) - call setline(2, 'Expanded Form: ' .expanded_cmdline) - call setline(3,substitute(getline(2),'.','=','g')) - execute '$read !'. expanded_cmdline - setlocal nomodifiable - 1 -endfunction - -" Reset spelling colours when reading a new buffer -" This works around an issue where the colorscheme is changed by .local.vimrc -fun! SetSpellingColors() - highlight SpellBad cterm=bold ctermfg=white ctermbg=red - highlight SpellCap cterm=bold ctermfg=red ctermbg=white -endfun -autocmd BufWinEnter * call SetSpellingColors() -autocmd BufNewFile * call SetSpellingColors() -autocmd InsertEnter * call SetSpellingColors() -autocmd InsertLeave * call SetSpellingColors() - -" Change colourscheme when diffing -fun! SetDiffColors() - highlight DiffAdd cterm=bold ctermfg=white ctermbg=DarkGreen - highlight DiffDelete cterm=bold ctermfg=white ctermbg=DarkGrey - highlight DiffChange cterm=bold ctermfg=white ctermbg=DarkBlue - highlight DiffText cterm=bold ctermfg=white ctermbg=DarkRed -endfun - -fun! StripTrailingWhitespace() - " don't strip on these filetypes - if &ft =~ 'markdown' - return - endif - %s/\s\+$//e -endfun -autocmd BufWritePre * call StripTrailingWhitespace() From 34d7aef11b29affd4cea190acd8a650af4c13db4 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Mon, 18 Jul 2022 22:04:20 +1200 Subject: [PATCH 14/67] [ bspwm ] bspwm update and monitor hot-plug script --- .config/bspwm.symlink/bspwmrc | 68 ++++++++++++++----------------- shell/aliases.symlink | 2 + shell/monitor-hot-plug.sh.symlink | 13 ++++++ zshrc.symlink | 6 ++- 4 files changed, 50 insertions(+), 39 deletions(-) create mode 100755 shell/monitor-hot-plug.sh.symlink diff --git a/.config/bspwm.symlink/bspwmrc b/.config/bspwm.symlink/bspwmrc index c821c9f..bf01122 100755 --- a/.config/bspwm.symlink/bspwmrc +++ b/.config/bspwm.symlink/bspwmrc @@ -1,4 +1,4 @@ -#! /bin/sh +#! /bin/bash xgetmons() { xrandr | grep \ connected | awk {'print $1'} } @@ -12,53 +12,21 @@ EXTERNAL=$(xgetmons | grep -v eDP) if [ $DISP_NUM -eq 2 ]; then + dunstify "Using dual monitor setup" bspc monitor $INTERNAL -d web code chat for mons in $EXTERNAL ; do bspc monitor $EXTERNAL -d video game torrent done - #polybar top_ext > /dev/null 2>&1 & - mons -e top else if [ $RESOLUTION = '1080x1920' ]; then bspc monitor -d web code server else - bspc monitor -d web code chat video game torrent server + dunstify "Using single monitor setup" + bspc monitor $INTERNAL -d web code chat video game torrent server fi - #bspc monitor DP-0 -d web code chat video game torrent server fi -pkill polybar - -$HOME/.config/polybar/launch.sh - -pkill picom -picom & -#fcitx-autostart & -remmina -i & -pkill keepassxc -/usr/bin/keepassxc & - -pkill xscreensaver -xscreensaver -no-splash & -#caffeine & -#polybar example & -blueman-applet & -#solaar & - -pkill plank -plank & - -pkill guake -guake & - -/usr/bin/lxqt-policykit-agent & -/usr/bin/octopi-notifier & - -pkill dunst -dunst & - - bspc config border_width 0.5 bspc config window_gap 1 @@ -71,8 +39,6 @@ bspc config gapless_monocle true #Focusing behavior bspc config focus_follows_pointer true -bspc config history_aware_focus true -bspc config focus_by_distance true #Multihead behavior bspc config remove_disabled_monitors true @@ -88,17 +54,43 @@ bspc rule -a Kupfer.py focus=on bspc rule -a Screenkey manage=off bspc rule -a firefox desktop='^1' follow=on +#remmina -i & +#pkill keepassxc +#/usr/bin/keepassxc & + +pkill xscreensaver +xscreensaver -no-splash & + +#blueman-applet & + +/usr/bin/lxqt-policykit-agent & + +AUTO_START=(caffeine picom plank dunst guake keepassxc blueman-applet) +for p in ${AUTO_START[@]}; do + pgrep -x $p > /dev/null || $p & disown +done + +#pgrep -x picom > /dev/null || picom& +#pgrep -x plank > /dev/null || plank& +#pgrep -x dunst > /dev/null || dunst& +#pgrep -x guake > /dev/null || guake& +#pgrep -x caffeine > /dev/null || caffeine& +pgrep -x fcitx > /dev/null || fcitx -u fcitx-light-ui& wal -i Pictures/bg.png +$HOME/.config/polybar/launch.sh + # Remap Caps key to control setxkbmap -option ctrl:nocaps systemd-detect-virt 1> /dev/null + if [ $? == 0 ]; then # Run virtualbox-tools VboxClient-all fi +notify-send "Desktop loaded successfully" "$(date +'%c')" diff --git a/shell/aliases.symlink b/shell/aliases.symlink index ca2fd22..8c247cd 100644 --- a/shell/aliases.symlink +++ b/shell/aliases.symlink @@ -55,3 +55,5 @@ alias rc="NO_RENDERER=true bin/rails c" alias vimrc="vim ~/.vimrc" alias vimplugins="vim ~/.dotfiles/vim/vim.symlink/plugin/plugins.vim" alias zshrc="vim ~/.zshrc" + +# vim:ft=sh diff --git a/shell/monitor-hot-plug.sh.symlink b/shell/monitor-hot-plug.sh.symlink new file mode 100755 index 0000000..22cbd2a --- /dev/null +++ b/shell/monitor-hot-plug.sh.symlink @@ -0,0 +1,13 @@ +#! /usr/bin/bash + +function connect(){ + xrandr --output eDP1 --mode 1920x1080 --pos 0x1080 --rotate normal --output HDMI1 --primary --mode 1920x1080 --pos 0x0 --rotate normal +} + +function disconnect(){ + xrandr --output HDMI1 --off +} + +xrandr | grep "HDMI1 connected" &> /dev/null && connect || disconnect + +/bin/bspc wm -r & disown diff --git a/zshrc.symlink b/zshrc.symlink index b00a5ba..9357e6a 100644 --- a/zshrc.symlink +++ b/zshrc.symlink @@ -99,7 +99,7 @@ fi # ssh # export SSH_KEY_PATH="~/.ssh/rsa_id" - +source <(/usr/bin/starship init zsh --print-full-init) # Set personal aliases, overriding those provided by oh-my-zsh libs, # plugins, and themes. Aliases can be placed here, though oh-my-zsh # users are encouraged to define aliases within the ZSH_CUSTOM folder. @@ -112,3 +112,7 @@ alias ohmyzsh="vim ~/.oh-my-zsh" [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh alias luamake=/home/kevin/lua-language-server/3rd/luamake/luamake + +export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion From 5537e3749bf85475c36cfbf9c28b0c3059f9ed2e Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Mon, 18 Jul 2022 22:04:59 +1200 Subject: [PATCH 15/67] [ picom ] picom config --- .config/picom.conf.symlink | 1 - 1 file changed, 1 deletion(-) diff --git a/.config/picom.conf.symlink b/.config/picom.conf.symlink index 554fb75..ef78b30 100644 --- a/.config/picom.conf.symlink +++ b/.config/picom.conf.symlink @@ -26,7 +26,6 @@ mark-wmwin-focused = true; mark-ovredir-focused = true; detect-rounded-corners = true; detect-client-opacity = true; -refresh-rate = 60; vsync = true; dbe = false; #paint-on-overlay = true; From bbc62ebf6b2b20967054c130e086ba4210468640 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Mon, 18 Jul 2022 22:10:11 +1200 Subject: [PATCH 16/67] [ alacritty ] font size --- .config/alacritty.symlink/alacritty.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/alacritty.symlink/alacritty.yml b/.config/alacritty.symlink/alacritty.yml index a4c3cae..f8429cb 100644 --- a/.config/alacritty.symlink/alacritty.yml +++ b/.config/alacritty.symlink/alacritty.yml @@ -147,7 +147,7 @@ font: #style: Bold Italic # Point size - size: 18.0 + size: 16.0 # Offset is the extra space around each character. `offset.y` can be thought # of as modifying the line spacing, and `offset.x` as modifying the letter From e1d75d96e187784a99aacb5bce42039006793777 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Mon, 18 Jul 2022 22:10:33 +1200 Subject: [PATCH 17/67] [ polybar ] polybar update --- .config/polybar.symlink/config.ini | 5 +---- .config/polybar.symlink/launch.sh | 8 ++++++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.config/polybar.symlink/config.ini b/.config/polybar.symlink/config.ini index eb29d79..41c576a 100755 --- a/.config/polybar.symlink/config.ini +++ b/.config/polybar.symlink/config.ini @@ -438,9 +438,6 @@ ramp-foreground = ${colors.foreground-alt} [settings] -throttle-output = 5 -throttle-output-for = 10 - screenchange-reload = false compositing-background = source @@ -449,6 +446,6 @@ compositing-overline = clear compositing-underline = clear compositing-border = over -pseudo-transparency = false +pseudo-transparency = true ; vim:ft=dosini diff --git a/.config/polybar.symlink/launch.sh b/.config/polybar.symlink/launch.sh index 92c50f8..1d1e68c 100755 --- a/.config/polybar.symlink/launch.sh +++ b/.config/polybar.symlink/launch.sh @@ -1,6 +1,9 @@ #!/usr/bin/env bash -killall -q polybar +#killall -q polybar +# Terminate already running bar instances +# If all your bars have ipc enabled, you can use +polybar-msg cmd quit export BAT=$(ls -A1 /sys/class/power_supply|grep -E 'BAT') export AC=$(ls -A1 /sys/class/power_supply|grep -v 'BAT') @@ -18,4 +21,5 @@ else fi -echo "Bar launched..." +notify-send "Polybar" "Polybar reloaded successfully" + From 8a680b6686bba5fa89d01d9e79e7d20e236bcaa6 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Mon, 18 Jul 2022 22:11:04 +1200 Subject: [PATCH 18/67] [ nvim ] plugin and config --- vim/vim.symlink/coc-settings.json | 13 +- vim/vim.symlink/lua/plugins/init.lua | 56 ++++++++ vim/vim.symlink/lua/plugins/packerinit.lua | 45 ++++++ vim/vim.symlink/plugin/packer_compiled.lua | 152 +++++++++++++++++++++ vim/vim.symlink/plugin/plugins.vim | 7 +- vim/vim.symlink/plugin/telescope.vim | 7 +- vim/vim.symlink/plugin/vim-ripgrep.vim | 4 +- vim/vim.symlink/spell/en.utf-8.add | 1 + vim/vim.symlink/spell/en.utf-8.add.spl | Bin 0 -> 43 bytes 9 files changed, 266 insertions(+), 19 deletions(-) create mode 100644 vim/vim.symlink/lua/plugins/init.lua create mode 100644 vim/vim.symlink/lua/plugins/packerinit.lua create mode 100644 vim/vim.symlink/plugin/packer_compiled.lua create mode 100644 vim/vim.symlink/spell/en.utf-8.add create mode 100644 vim/vim.symlink/spell/en.utf-8.add.spl diff --git a/vim/vim.symlink/coc-settings.json b/vim/vim.symlink/coc-settings.json index 536ff47..74b7b0d 100644 --- a/vim/vim.symlink/coc-settings.json +++ b/vim/vim.symlink/coc-settings.json @@ -201,16 +201,6 @@ "snippets.userSnippetsDirectory": "~/.config/nvim/Ultisnips", "json.format.enable": true, "languageserver": { - "golang": { - "command": "gopls", - "rootPatterns": ["go.mod"], - "filetypes": ["go"], - "initializationOptions": { - "gocodeCompletionEnabled": true, - "diagnosticsEnabled": true, - "lintTool": "golint" - } - }, "lua":{ "command": "/home/kevin/lua-language-server/bin/Linux/lua-language-server", "args": ["-E", "/home/kevin/lua-language-server/bin/Linux/main.lua"], @@ -289,5 +279,6 @@ "sourcekit.commandPath": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp", "cSpell.userWords": ["Innei", "Typegoose", "consola"], "smartf.timeout": 5000, - "java.format.settings.url": "/home/ksjiang/.config/coc/extensions/node_modules/redhat.java/eclipse-formatter.xml" + "java.format.settings.url": "/home/ksjiang/.config/coc/extensions/node_modules/redhat.java/eclipse-formatter.xml", + "clangd.path": "~/.config/coc/extensions/coc-clangd-data/install/14.0.3/clangd_14.0.3/bin/clangd" } diff --git a/vim/vim.symlink/lua/plugins/init.lua b/vim/vim.symlink/lua/plugins/init.lua new file mode 100644 index 0000000..9dbde67 --- /dev/null +++ b/vim/vim.symlink/lua/plugins/init.lua @@ -0,0 +1,56 @@ +--https://github.com/NvChad/NvChad/blob/main/lua/plugins/init.lua +local fn = vim.fn +local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' +if fn.empty(fn.glob(install_path)) > 0 then + packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) +end + +return require('packer').startup(function(use) + -- this is arranged on the basis of when a plugin starts + + use "nvim-lua/plenary.nvim" + + use { + "wbthomason/packer.nvim", + event = "VimEnter", + } + + use { + "kyazdani42/nvim-web-devicons", + } + + use { + "nvim-treesitter/nvim-treesitter", + event = "BufRead", + config = function() + require('pluginconfig.nvim-treesitter') + end + } + + -- file managing , picker etc + use { + "kyazdani42/nvim-tree.lua", + -- only set "after" if lazy load is disabled and vice versa for "cmd" + after = "nvim-web-devicons", + } + + use { + "nvim-telescope/telescope-file-browser.nvim" + } + use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } + use { + "nvim-telescope/telescope.nvim", + requires = { + { "nvim-lua/popup.nvim" }, + { "nvim-lua/plenary.nvim" }, + { "nvim-telescope/telescope-fzf-native.nvim", run = "make" }, + }, + config = function() + require('pluginconfig.telescope-config') + end + } + + if packer_bootstrap then + require('packer').sync() + end +end) diff --git a/vim/vim.symlink/lua/plugins/packerinit.lua b/vim/vim.symlink/lua/plugins/packerinit.lua new file mode 100644 index 0000000..cd5dca2 --- /dev/null +++ b/vim/vim.symlink/lua/plugins/packerinit.lua @@ -0,0 +1,45 @@ +-- https://github.com/NvChad/NvChad/blob/main/lua/plugins/packerInit.lua +vim.cmd "packadd packer.nvim" + +local present, packer = pcall(require, "packer") + +if not present then + local packer_path = vim.fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim" + + print "Cloning packer.." + -- remove the dir before cloning + vim.fn.delete(packer_path, "rf") + vim.fn.system { + "git", + "clone", + "https://github.com/wbthomason/packer.nvim", + "--depth", + "20", + packer_path, + } + + vim.cmd "packadd packer.nvim" + present, packer = pcall(require, "packer") + + if present then + print "Packer cloned successfully." + else + error("Couldn't clone packer !\nPacker path: " .. packer_path .. "\n" .. packer) + end +end + +packer.init { + display = { + open_fn = function() + return require("packer.util").float { border = "single" } + end, + prompt_border = "single", + }, + git = { + clone_timeout = 6000, -- seconds + }, + auto_clean = true, + compile_on_sync = true, +} + +return packer diff --git a/vim/vim.symlink/plugin/packer_compiled.lua b/vim/vim.symlink/plugin/packer_compiled.lua new file mode 100644 index 0000000..04caff9 --- /dev/null +++ b/vim/vim.symlink/plugin/packer_compiled.lua @@ -0,0 +1,152 @@ +-- Automatically generated packer.nvim plugin loader code + +if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then + vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') + return +end + +vim.api.nvim_command('packadd packer.nvim') + +local no_errors, error_msg = pcall(function() + + local time + local profile_info + local should_profile = false + if should_profile then + local hrtime = vim.loop.hrtime + profile_info = {} + time = function(chunk, start) + if start then + profile_info[chunk] = hrtime() + else + profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 + end + end + else + time = function(chunk, start) end + end + +local function save_profiles(threshold) + local sorted_times = {} + for chunk_name, time_taken in pairs(profile_info) do + sorted_times[#sorted_times + 1] = {chunk_name, time_taken} + end + table.sort(sorted_times, function(a, b) return a[2] > b[2] end) + local results = {} + for i, elem in ipairs(sorted_times) do + if not threshold or threshold and elem[2] > threshold then + results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' + end + end + + _G._packer = _G._packer or {} + _G._packer.profile_output = results +end + +time([[Luarocks path setup]], true) +local package_path_str = "/home/kevin/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/kevin/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/kevin/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/kevin/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/kevin/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" +if not string.find(package.path, package_path_str, 1, true) then + package.path = package.path .. ';' .. package_path_str +end + +if not string.find(package.cpath, install_cpath_pattern, 1, true) then + package.cpath = package.cpath .. ';' .. install_cpath_pattern +end + +time([[Luarocks path setup]], false) +time([[try_loadstring definition]], true) +local function try_loadstring(s, component, name) + local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) + if not success then + vim.schedule(function() + vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) + end) + end + return result +end + +time([[try_loadstring definition]], false) +time([[Defining packer_plugins]], true) +_G.packer_plugins = { + ["nvim-tree.lua"] = { + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/kevin/.local/share/nvim/site/pack/packer/opt/nvim-tree.lua", + url = "https://github.com/kyazdani42/nvim-tree.lua" + }, + ["nvim-treesitter"] = { + config = { "\27LJ\2\n<\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0!pluginconfig.nvim-treesitter\frequire\0" }, + loaded = false, + needs_bufread = true, + only_cond = false, + path = "/home/kevin/.local/share/nvim/site/pack/packer/opt/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["nvim-web-devicons"] = { + loaded = true, + path = "/home/kevin/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", + url = "https://github.com/kyazdani42/nvim-web-devicons" + }, + ["packer.nvim"] = { + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/kevin/.local/share/nvim/site/pack/packer/opt/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + ["plenary.nvim"] = { + loaded = true, + path = "/home/kevin/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, + ["popup.nvim"] = { + loaded = true, + path = "/home/kevin/.local/share/nvim/site/pack/packer/start/popup.nvim", + url = "https://github.com/nvim-lua/popup.nvim" + }, + ["telescope-file-browser.nvim"] = { + loaded = true, + path = "/home/kevin/.local/share/nvim/site/pack/packer/start/telescope-file-browser.nvim", + url = "https://github.com/nvim-telescope/telescope-file-browser.nvim" + }, + ["telescope-fzf-native.nvim"] = { + loaded = true, + path = "/home/kevin/.local/share/nvim/site/pack/packer/start/telescope-fzf-native.nvim", + url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim" + }, + ["telescope.nvim"] = { + config = { "\27LJ\2\n=\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\"pluginconfig.telescope-config\frequire\0" }, + loaded = true, + path = "/home/kevin/.local/share/nvim/site/pack/packer/start/telescope.nvim", + url = "https://github.com/nvim-telescope/telescope.nvim" + } +} + +time([[Defining packer_plugins]], false) +-- Config for: telescope.nvim +time([[Config for telescope.nvim]], true) +try_loadstring("\27LJ\2\n=\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\"pluginconfig.telescope-config\frequire\0", "config", "telescope.nvim") +time([[Config for telescope.nvim]], false) +-- Load plugins in order defined by `after` +time([[Sequenced loading]], true) +vim.cmd [[ packadd nvim-web-devicons ]] +vim.cmd [[ packadd nvim-tree.lua ]] +time([[Sequenced loading]], false) +vim.cmd [[augroup packer_load_aucmds]] +vim.cmd [[au!]] + -- Event lazy-loads +time([[Defining lazy-load event autocommands]], true) +vim.cmd [[au VimEnter * ++once lua require("packer.load")({'packer.nvim'}, { event = "VimEnter *" }, _G.packer_plugins)]] +vim.cmd [[au BufRead * ++once lua require("packer.load")({'nvim-treesitter'}, { event = "BufRead *" }, _G.packer_plugins)]] +time([[Defining lazy-load event autocommands]], false) +vim.cmd("augroup END") +if should_profile then save_profiles() end + +end) + +if not no_errors then + error_msg = error_msg:gsub('"', '\\"') + vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') +end diff --git a/vim/vim.symlink/plugin/plugins.vim b/vim/vim.symlink/plugin/plugins.vim index 15f273b..d9055db 100644 --- a/vim/vim.symlink/plugin/plugins.vim +++ b/vim/vim.symlink/plugin/plugins.vim @@ -23,12 +23,11 @@ Plug 'eliba2/vim-node-inspect' Plug 'honza/vim-snippets' " Added 2021-10-31 -Plug 'nvim-lua/plenary.nvim' -Plug 'nvim-telescope/telescope.nvim' -Plug 'nvim-treesitter/nvim-treesitter', {'branch': '0.5-compat', 'do': ':TSUpdate'} " We recommend updating the parsers on update +"Plug 'nvim-lua/plenary.nvim' +"Plug 'nvim-telescope/telescope.nvim' +"Plug 'nvim-treesitter/nvim-treesitter', {'branch': '0.5-compat', 'do': ':TSUpdate'} " We recommend updating the parsers on update "Plug 'rafcamlet/coc-nvim-lua' - " Plugs to install " General diff --git a/vim/vim.symlink/plugin/telescope.vim b/vim/vim.symlink/plugin/telescope.vim index 9b1efc2..d30a90c 100644 --- a/vim/vim.symlink/plugin/telescope.vim +++ b/vim/vim.symlink/plugin/telescope.vim @@ -1,4 +1,5 @@ nnoremap :Telescope git_files -map t :Telescope file_browser -map tab :Telescope keymaps -map b :Telescope buffers +nnoremap t :Telescope file_browser +nnoremap :Telescope keymaps +nnoremap b :Telescope buffers +nnoremap h :Telescope oldfiles diff --git a/vim/vim.symlink/plugin/vim-ripgrep.vim b/vim/vim.symlink/plugin/vim-ripgrep.vim index 64611f7..e4aa468 100644 --- a/vim/vim.symlink/plugin/vim-ripgrep.vim +++ b/vim/vim.symlink/plugin/vim-ripgrep.vim @@ -1,3 +1,5 @@ " bind K to search word under cursor -nnoremap K :Rg +"nnoremap K :Telescope grep_string +nnoremap K :lua require('telescope.builtin').grep_string() + cnoreabbrev Ag ((getcmdtype() is# ':' && getcmdline() is# 'Ag')?('Rg'):('Ag')) diff --git a/vim/vim.symlink/spell/en.utf-8.add b/vim/vim.symlink/spell/en.utf-8.add new file mode 100644 index 0000000..5685f8f --- /dev/null +++ b/vim/vim.symlink/spell/en.utf-8.add @@ -0,0 +1 @@ +uninstall diff --git a/vim/vim.symlink/spell/en.utf-8.add.spl b/vim/vim.symlink/spell/en.utf-8.add.spl new file mode 100644 index 0000000000000000000000000000000000000000..9f675b336f16996d67c6e7e2aa2b89784741ad33 GIT binary patch literal 43 ocmWIZ^erw(&B-zP&%nSS!dS|f$CwGk#f&A4iHtcw2o#0_0Pz9{HUIzs literal 0 HcmV?d00001 From 1e76f2f33658e49498eb6647dbbccd1924613d58 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Mon, 18 Jul 2022 22:11:25 +1200 Subject: [PATCH 19/67] Updated git ignore --- .gitignore | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 6f7179c..73a6b71 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ + !bin vim/bundle/ .DS_Store @@ -14,9 +15,9 @@ vim/vim.symlink/undo .config/fcitx.symlink/profile .config/fcitx.symlink/rime/.place_holder .config/fcitx.symlink/rime/build -.config/fcitx.symlink/rime/luna_pinyin.userdb -.config/fcitx.symlink/rime/clover.userdb -.config/fcitx.symlink/rime/emoji.userdb +.config/fcitx.symlink/rime/*.userdb .config/fcitx.symlink/rime/trash .config/fcitx.symlink/log .config/fcitx.symlink/rime/user.yaml + +LOG* From 420bdd52c90dedfbb301261118d806b297277d5a Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Sun, 21 Aug 2022 15:41:45 +1200 Subject: [PATCH 20/67] gitconfig update --- git/gitconfig.symlink.example | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/git/gitconfig.symlink.example b/git/gitconfig.symlink.example index 2add5a7..34be091 100644 --- a/git/gitconfig.symlink.example +++ b/git/gitconfig.symlink.example @@ -62,10 +62,14 @@ # squash commits down when merging # https://thoughtbot.com/blog/autosquashing-git-commits autosquash = true + autostash = true [pull] - ff = only + ff = only # Always prefer rebase - rebase = true + rebase = true + autostash = true +[push] + autosetupremote = true [commit] gpgsign = false [hub] From ac4351f976617503c6cc328e18c323396620ef61 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Mon, 5 Sep 2022 18:21:05 +1200 Subject: [PATCH 21/67] [ Polybar ] update polybar config --- .config/polybar.symlink/config.ini | 10 +++++----- .config/polybar.symlink/launch.sh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.config/polybar.symlink/config.ini b/.config/polybar.symlink/config.ini index 41c576a..1301a7c 100755 --- a/.config/polybar.symlink/config.ini +++ b/.config/polybar.symlink/config.ini @@ -85,7 +85,7 @@ font-3 = Sarasa Mono H:style=bold:size=10;3 font-4 = FontAwesome:size=12;4 font-5 = Siji:pixelsize=10;1 -modules-left = powermenu bspwm +modules-left = powermenu bspwm mpd modules-right = network cpu pulseaudio xbacklight memory eth temperature battery date tray-position = right tray-padding = 2 @@ -252,9 +252,9 @@ battery = ${env:BAT:} adapter = ${env:AC:} full-at = 98 -format-charging = %{F#BB5F80} %{F-} -format-discharging = %{F#BB5F80} %{F-} -format-full = %{F#BB5F80} %{F-} %{F#5CA551} %{F-} +format-charging = %{F#BB5F80} %{F-} %{A1:gnome-power-statistics:} %{A} +format-discharging = %{F#BB5F80} %{F-} %{A1:gnome-power-statistics:} %{A} +format-full = %{F#BB5F80} %{F-} %{A1:gnome-power-statistics:}%{F#5CA551} %{F-}%{A} ramp-capacity-0 =  ramp-capacity-0-foreground = #FF6A6A @@ -349,7 +349,7 @@ interface = ${env:ETH_INTERFACE} label-connected = %ifname% %local_ip% label-connected-background = #212E3A -label-disconnected = wireless not connected +label-disconnected = wired network not connected label-disconnected-foreground = #656D7E label-disconnected-background = #212E3A diff --git a/.config/polybar.symlink/launch.sh b/.config/polybar.symlink/launch.sh index 1d1e68c..4a9032b 100755 --- a/.config/polybar.symlink/launch.sh +++ b/.config/polybar.symlink/launch.sh @@ -14,7 +14,7 @@ while pgrep -u $UID -x polybar > /dev/null; do sleep 1; done if type "xrandr"; then for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do - MONITOR=$m polybar --reload top & + MONITOR=$m polybar top & done else polybar --reload top & From 69e8ffaf46b275d2baa9c8a3fd802d87fec567db Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Mon, 5 Sep 2022 18:21:31 +1200 Subject: [PATCH 22/67] [ bspwmrc ] fix bspwmrc --- .config/bspwm.symlink/bspwmrc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.config/bspwm.symlink/bspwmrc b/.config/bspwm.symlink/bspwmrc index bf01122..2ee6f32 100755 --- a/.config/bspwm.symlink/bspwmrc +++ b/.config/bspwm.symlink/bspwmrc @@ -70,17 +70,12 @@ for p in ${AUTO_START[@]}; do pgrep -x $p > /dev/null || $p & disown done -#pgrep -x picom > /dev/null || picom& -#pgrep -x plank > /dev/null || plank& -#pgrep -x dunst > /dev/null || dunst& -#pgrep -x guake > /dev/null || guake& -#pgrep -x caffeine > /dev/null || caffeine& pgrep -x fcitx > /dev/null || fcitx -u fcitx-light-ui& wal -i Pictures/bg.png -$HOME/.config/polybar/launch.sh +$HOME/.config/polybar/launch.sh & disown # Remap Caps key to control setxkbmap -option ctrl:nocaps From d0d8d091ff7307052d18f01c538f34c46b67301d Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Mon, 5 Sep 2022 18:21:55 +1200 Subject: [PATCH 23/67] Monitor hotplug script --- shell/monitor-hot-plug.sh.symlink | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/monitor-hot-plug.sh.symlink b/shell/monitor-hot-plug.sh.symlink index 22cbd2a..67be355 100755 --- a/shell/monitor-hot-plug.sh.symlink +++ b/shell/monitor-hot-plug.sh.symlink @@ -10,4 +10,4 @@ function disconnect(){ xrandr | grep "HDMI1 connected" &> /dev/null && connect || disconnect -/bin/bspc wm -r & disown +/bin/bspc wm -r & disown && killall polybar From fe4fb6207982278a7a4c47964a2b10fc092f772b Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Fri, 9 Sep 2022 21:18:37 +1200 Subject: [PATCH 24/67] Vim config update --- vim/vim.symlink/coc-settings.json | 3 +- vim/vim.symlink/lua/commands.lua | 47 ++++++++++++++++++- vim/vim.symlink/lua/init.lua | 2 +- .../lua/pluginconfig/nvim-treesitter.lua | 10 ++-- vim/vim.symlink/lua/plugins/init.lua | 32 +++++++++++-- vim/vim.symlink/lua/settings.lua | 2 + vim/vim.symlink/plugin/coc.vim | 12 +++-- vim/vim.symlink/plugin/packer_compiled.lua | 2 +- vim/vim.symlink/plugin/plugins.vim | 2 +- vim/vimrc.symlink | 5 +- 10 files changed, 96 insertions(+), 21 deletions(-) diff --git a/vim/vim.symlink/coc-settings.json b/vim/vim.symlink/coc-settings.json index 74b7b0d..93a0aef 100644 --- a/vim/vim.symlink/coc-settings.json +++ b/vim/vim.symlink/coc-settings.json @@ -25,7 +25,6 @@ "suggest.detailField": "menu", "suggest.snippetIndicator": "*", "suggest.triggerCompletionWait": 100, - "suggest.echodocSupport": true, "suggest.completionItemKindLabels": { "class": "\uf0e8", "color": "\ue22b", @@ -245,7 +244,7 @@ } }, "snippets.textmateSnippetsRoots": [], - "snippets.extends": [{ "vue": "javascript" }], + "snippets.extends": { "vue": "javascript" }, "html.filetypes": ["html", "handlebars", "htmldjango", "vue"], "vetur.useWorkspaceDependencies": true, "vetur.format.enable": true, diff --git a/vim/vim.symlink/lua/commands.lua b/vim/vim.symlink/lua/commands.lua index ea6fa70..4d8a454 100644 --- a/vim/vim.symlink/lua/commands.lua +++ b/vim/vim.symlink/lua/commands.lua @@ -96,8 +96,45 @@ function new_scratch() vim.opt_local.bufhidden = 'hide' vim.opt_local.swapfile = false M.mapBuf(vim.api.nvim_get_current_buf(), 'n', 's', ':file note_' .. os.time() ..'| set buftype= swapfile | w ') + M.mapBuf(vim.api.nvim_get_current_buf(), 'n', ',ff', ':%!jq . :setf json') end +function node_execute(command) + local bnr = vim.fn.bufnr('%') + local ns_id = vim.api.nvim_create_namespace('demo') + + local selected = (vim.fn.getline('.')) + local handle + + if command == 'js' then + handle = io.popen("node -e '" .. selected .. "'") + end + + if command == 'py' then + handle = io.popen("python -c '" .. selected .. "'") + end + + if command == 'rb' then + handle = io.popen("ruby -c '" .. selected .. "'") + end + + --local handle = io.popen("node -e '" .. selected .. "'") + local result = handle:read("*a") + result = result:gsub("%s+", "") + + local col_num,line_num = unpack(vim.fn.getpos('v')) + + local opts = { + id = 1, + virt_text = {{result, "IncSearch"}}, + virt_text_pos = 'right_align', + } + vim.api.nvim_buf_set_extmark(bnr, ns_id, line_num -1, col_num, opts) + --vim.api.nvim_command('o') + + --vim.cmd("normal o") + --vim.api.nvim_buf_set_lines(cur_buf, line_end + 1, line_end + 1, false, { result }) +end -- Always highlight column 80 so it's easier to see where @@ -114,4 +151,12 @@ M.autocmd('TermOpen', 'nmap :bd!', nil) M.autocmd('VimEnter', 'if !argc() | NERDTree | endif', nil) M.autocmd('CursorHold', 'silent call CocActionAsync(\'highlight\')') - +M.autocmd({'BufEnter'}, ':set filetype=markdown', {"*.md"}) + +-- TODO: <27-07-22, yourname> convert this to lua func -- +-- This help execute the js without leaving the buffer +M.autocmd({'Filetype'}, 'nmap ,js :lua node_execute(\'js\')', {"markdown"}) +M.autocmd({'Filetype'}, 'nmap ,py :lua node_execute(\'py\')', {"markdown"}) +M.autocmd({'Filetype'}, 'nmap ,rb :lua node_execute(\'rb\')', {"markdown"}) +--M.autocmd({'Filetype'}, 'vmap ,py :put=system(\'python\', getline(\'.\')) ', {"markdown"}) +M.autocmd({'BufEnter'}, ':!pandoc %:S --to plain -o %:S', {"*.docx", "*.doc"}) diff --git a/vim/vim.symlink/lua/init.lua b/vim/vim.symlink/lua/init.lua index 7d13176..ca96137 100644 --- a/vim/vim.symlink/lua/init.lua +++ b/vim/vim.symlink/lua/init.lua @@ -1,5 +1,5 @@ -require('plugins') require('pluginconfig') +require('plugins') require('options') require('commands') require('settings') diff --git a/vim/vim.symlink/lua/pluginconfig/nvim-treesitter.lua b/vim/vim.symlink/lua/pluginconfig/nvim-treesitter.lua index fb8d2ef..c10deea 100644 --- a/vim/vim.symlink/lua/pluginconfig/nvim-treesitter.lua +++ b/vim/vim.symlink/lua/pluginconfig/nvim-treesitter.lua @@ -2,7 +2,7 @@ require("nvim-treesitter.configs").setup({ ensure_installed = "all", -- one of 'all', 'language', or a list of languages highlight = { enable = true, -- false will disable the whole extension - disable = {}, -- list of language that will be disabled + disable = {'markdown'}, -- list of language that will be disabled additional_vim_regex_highlighting = false, }, incremental_selection = { @@ -19,18 +19,18 @@ require("nvim-treesitter.configs").setup({ }, }, refactor = { - highlight_definitions = { enable = false }, - highlight_current_scope = { enable = false }, + highlight_definitions = { enable = true }, + highlight_current_scope = { enable = true }, smart_rename = { enable = true, keymaps = { - smart_rename = "Gr", -- mapping to rename reference under cursor + smart_rename = "r", -- mapping to rename reference under cursor }, }, navigation = { enable = true, keymaps = { - goto_definition = "Gd", -- mapping to go to definition of symbol under cursor + goto_definition = "gnd", -- mapping to go to definition of symbol under cursor list_definitions = "GD", -- mapping to list all definitions in current file }, }, diff --git a/vim/vim.symlink/lua/plugins/init.lua b/vim/vim.symlink/lua/plugins/init.lua index 9dbde67..ff76ad6 100644 --- a/vim/vim.symlink/lua/plugins/init.lua +++ b/vim/vim.symlink/lua/plugins/init.lua @@ -3,30 +3,54 @@ local fn = vim.fn local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' if fn.empty(fn.glob(install_path)) > 0 then packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) + --vim.api.nvim_command('packadd packer.nvim') end return require('packer').startup(function(use) -- this is arranged on the basis of when a plugin starts - - use "nvim-lua/plenary.nvim" - use { "wbthomason/packer.nvim", event = "VimEnter", } + use "nvim-lua/plenary.nvim" + + use { "kyazdani42/nvim-web-devicons", } use { "nvim-treesitter/nvim-treesitter", - event = "BufRead", + event = "VimEnter", + run = ":TSUpdate", config = function() require('pluginconfig.nvim-treesitter') end } + use{ + "nvim-treesitter/nvim-treesitter-refactor", + requires = { + { "nvim-treesitter/nvim-treesitter" }, + }, + config = function() + require('pluginconfig.nvim-treesitter') + end, + after= "nvim-treesitter/nvim-treesitter", + } + + use{ + "nvim-treesitter/nvim-treesitter-textobjects", + requires = { + { "nvim-treesitter/nvim-treesitter" }, + }, + config = function() + require('pluginconfig.nvim-treesitter') + end, + after= "nvim-treesitter/nvim-treesitter", + } + -- file managing , picker etc use { "kyazdani42/nvim-tree.lua", diff --git a/vim/vim.symlink/lua/settings.lua b/vim/vim.symlink/lua/settings.lua index eae8068..74f69a1 100644 --- a/vim/vim.symlink/lua/settings.lua +++ b/vim/vim.symlink/lua/settings.lua @@ -22,3 +22,5 @@ vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 vim.g.loaded_netrwSettings = 1 vim.g.loaded_netrwFileHandlers = 1 +vim.g.lexima_enable_newline_rules = 1 +vim.g.lexima_enable_endwise_rules = 1 diff --git a/vim/vim.symlink/plugin/coc.vim b/vim/vim.symlink/plugin/coc.vim index 7b8075d..42c4061 100644 --- a/vim/vim.symlink/plugin/coc.vim +++ b/vim/vim.symlink/plugin/coc.vim @@ -14,14 +14,16 @@ nmap f (coc-format-selected) " Use for trigger snippet expand. imap (coc-snippets-expand) " Use for select text for visual placeholder of snippet. - vmap (coc-snippets-select) +vmap (coc-snippets-select) inoremap - \ pumvisible() ? coc#_select_confirm() : - \ coc#expandableOrJumpable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : - \ check_back_space() ? "\" : + \ coc#pum#visible() ? coc#pum#next(1): + \ CheckBackSpace() ? "\" : \ coc#refresh() +inoremap coc#pum#visible() ? coc#_select_confirm() + \: "\u\\=coc#on_enter()\" -function! s:check_back_space() abort + +function! CheckBackSpace() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction diff --git a/vim/vim.symlink/plugin/packer_compiled.lua b/vim/vim.symlink/plugin/packer_compiled.lua index 04caff9..4f4f69f 100644 --- a/vim/vim.symlink/plugin/packer_compiled.lua +++ b/vim/vim.symlink/plugin/packer_compiled.lua @@ -79,7 +79,7 @@ _G.packer_plugins = { ["nvim-treesitter"] = { config = { "\27LJ\2\n<\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0!pluginconfig.nvim-treesitter\frequire\0" }, loaded = false, - needs_bufread = true, + needs_bufread = false, only_cond = false, path = "/home/kevin/.local/share/nvim/site/pack/packer/opt/nvim-treesitter", url = "https://github.com/nvim-treesitter/nvim-treesitter" diff --git a/vim/vim.symlink/plugin/plugins.vim b/vim/vim.symlink/plugin/plugins.vim index d9055db..d1ffb63 100644 --- a/vim/vim.symlink/plugin/plugins.vim +++ b/vim/vim.symlink/plugin/plugins.vim @@ -1,7 +1,7 @@ call plug#begin('~/.vim/plugged') " Added 15/03/2021 Plug 'jlanzarotta/bufexplorer' -"Plug 'roman/golden-ratio' +Plug 'roman/golden-ratio' " Added 2021年04月01日 Plug 'jeffkreeftmeijer/vim-numbertoggle' Plug 'tpope/vim-eunuch' diff --git a/vim/vimrc.symlink b/vim/vimrc.symlink index 2e49260..6322863 100644 --- a/vim/vimrc.symlink +++ b/vim/vimrc.symlink @@ -1,6 +1,7 @@ source ~/.config/nvim/plugin/plugins.vim :luafile ~/.config/nvim/lua/init.lua - +let g:lexima_enable_newline_rules = 0 +let g:lexima_enable_endwise_rules = 0 " Ack (uses Ag behind the scenes) let g:ackprg = 'ag --nogroup --nocolor --column' @@ -31,6 +32,8 @@ autocmd InsertLeave * match TechWordsToAvoid /\cobviously\|basically\|simply\|of command! -nargs=0 Ns call Newscratch() fun! Newscratch() execute 'tabnew ' + nnoremap ,ff :%!jq . :setf json:redraw! + nnoremap s :file note_ . strftime('%c') | set buftype= swapfile | w setlocal buftype=nofile setlocal bufhidden=hide setlocal noswapfile From 2d490aa8a672df9752b3acf2c64ba1e4d2f3bd0e Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Fri, 16 Dec 2022 23:26:13 +1300 Subject: [PATCH 25/67] Updated monitor hot plug script --- shell/monitor-hot-plug.sh.symlink | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/monitor-hot-plug.sh.symlink b/shell/monitor-hot-plug.sh.symlink index 67be355..228405e 100755 --- a/shell/monitor-hot-plug.sh.symlink +++ b/shell/monitor-hot-plug.sh.symlink @@ -10,4 +10,4 @@ function disconnect(){ xrandr | grep "HDMI1 connected" &> /dev/null && connect || disconnect -/bin/bspc wm -r & disown && killall polybar +((/bin/bspc wm -r &) && (killall polybar &)) From d3997cca65903822cded9c8262fe130c0b2b68d0 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Fri, 16 Dec 2022 23:27:02 +1300 Subject: [PATCH 26/67] Add zoom launcher --- .config/rofi.symlink/zoom/launcher.sh | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 .config/rofi.symlink/zoom/launcher.sh diff --git a/.config/rofi.symlink/zoom/launcher.sh b/.config/rofi.symlink/zoom/launcher.sh new file mode 100755 index 0000000..a2bdd1f --- /dev/null +++ b/.config/rofi.symlink/zoom/launcher.sh @@ -0,0 +1,2 @@ +#xdg-open $( cat ~/.zoom_meetings.conf | rofi -dmenu -p 'Select Zoom meeting' | awk '{print $2}' - ) & disown +xdg-open $( cat ~/.zoom_meetings.conf | rofi -dmenu -p 'Select Zoom meeting' | cut --fields=2 --delimiter=" ") & disown From fb4e2275a4d8e54e1d860adb8e67657f43f5209f Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Fri, 16 Dec 2022 23:27:21 +1300 Subject: [PATCH 27/67] Remove commented code --- .config/rofi.symlink/zoom/launcher.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.config/rofi.symlink/zoom/launcher.sh b/.config/rofi.symlink/zoom/launcher.sh index a2bdd1f..1c19d83 100755 --- a/.config/rofi.symlink/zoom/launcher.sh +++ b/.config/rofi.symlink/zoom/launcher.sh @@ -1,2 +1 @@ -#xdg-open $( cat ~/.zoom_meetings.conf | rofi -dmenu -p 'Select Zoom meeting' | awk '{print $2}' - ) & disown xdg-open $( cat ~/.zoom_meetings.conf | rofi -dmenu -p 'Select Zoom meeting' | cut --fields=2 --delimiter=" ") & disown From f1456e58450e0064a3bd70b5ee6988c05423c148 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Fri, 16 Dec 2022 23:29:12 +1300 Subject: [PATCH 28/67] bspwm config update --- .config/bspwm.symlink/bspwmrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.config/bspwm.symlink/bspwmrc b/.config/bspwm.symlink/bspwmrc index 2ee6f32..323f789 100755 --- a/.config/bspwm.symlink/bspwmrc +++ b/.config/bspwm.symlink/bspwmrc @@ -60,6 +60,7 @@ bspc rule -a firefox desktop='^1' follow=on pkill xscreensaver xscreensaver -no-splash & +nm-applet & #blueman-applet & @@ -73,7 +74,7 @@ done pgrep -x fcitx > /dev/null || fcitx -u fcitx-light-ui& -wal -i Pictures/bg.png +wal -i wallpapers/pixels-d.webp $HOME/.config/polybar/launch.sh & disown From 29357b0d09ca22046fe2605fd698b6c5dad989ad Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Fri, 16 Dec 2022 23:29:41 +1300 Subject: [PATCH 29/67] Update polybar config --- .config/polybar.symlink/config.ini | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.config/polybar.symlink/config.ini b/.config/polybar.symlink/config.ini index 1301a7c..5349c93 100755 --- a/.config/polybar.symlink/config.ini +++ b/.config/polybar.symlink/config.ini @@ -43,7 +43,7 @@ font-3 = Sarasa Mono H:style=bold:size=10;3 font-4 = FontAwesome:size=12;4 font-5 = Siji:pixelsize=11;1 -modules-left = powermenu bspwm mpd +modules-left = powermenu launcher bspwm mpd modules-right = network cpu pulseaudio xbacklight memory eth temperature date tray-position = right tray-padding = 2 @@ -85,7 +85,7 @@ font-3 = Sarasa Mono H:style=bold:size=10;3 font-4 = FontAwesome:size=12;4 font-5 = Siji:pixelsize=10;1 -modules-left = powermenu bspwm mpd +modules-left = powermenu bspwm launcher launcher2 mpd modules-right = network cpu pulseaudio xbacklight memory eth temperature battery date tray-position = right tray-padding = 2 @@ -246,6 +246,28 @@ ramp-volume-2 = %{F#FF6A6A}  %{F-} ramp-volume-3 = %{F#FF6A6A}  %{F-} +[module/launcher2] +type = custom/menu + +format-padding = 0 + +label-open = 異 +label-close = ☓ + +menu-0-0 = Zoom +menu-0-0-foreground = #fba922 +menu-0-0-exec = ~/.config/rofi/zoom/launcher.sh + +[module/launcher] +type = custom/text + +content = 異 +content-background = black +content-foreground = green + +click-left = ~/.config/rofi/zoom/launcher.sh +click-right = launcher_t1 + [module/battery] type = internal/battery battery = ${env:BAT:} From baf4b8972018559c9f01151ddc39830d7f8befd0 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Fri, 16 Dec 2022 23:30:05 +1300 Subject: [PATCH 30/67] enable fcitx light ui --- .config/fcitx.symlink/addon/fcitx-light-ui.conf | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .config/fcitx.symlink/addon/fcitx-light-ui.conf diff --git a/.config/fcitx.symlink/addon/fcitx-light-ui.conf b/.config/fcitx.symlink/addon/fcitx-light-ui.conf new file mode 100644 index 0000000..f3765a9 --- /dev/null +++ b/.config/fcitx.symlink/addon/fcitx-light-ui.conf @@ -0,0 +1,2 @@ +[Addon] +Enabled=True From b0619036f7529a994eb3dfb402c0fad2c1470d3f Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Fri, 16 Dec 2022 23:30:35 +1300 Subject: [PATCH 31/67] Rime config update --- .config/fcitx.symlink/rime/default.custom.yaml | 10 ++++------ .config/fcitx.symlink/rime/placeless_flypy.schema.yaml | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.config/fcitx.symlink/rime/default.custom.yaml b/.config/fcitx.symlink/rime/default.custom.yaml index 610879f..c9da7bd 100644 --- a/.config/fcitx.symlink/rime/default.custom.yaml +++ b/.config/fcitx.symlink/rime/default.custom.yaml @@ -2,12 +2,10 @@ customization: distribution_code_name: "" distribution_version: "" generator: "Rime::SwitcherSettings" - modified_time: "Sat Jul 28 16:18:25 2018" - rime_version: 1.2.9 + modified_time: "Sat Aug 20 14:05:10 2022" + rime_version: 1.7.3 patch: menu: - page_size: 15 + page_size: 10 schema_list: - - {schema: double_pinyin_flypy} - - {schema: placeless_flypy} - - {schema: emoji} + - {schema: placeless_flypy} \ No newline at end of file diff --git a/.config/fcitx.symlink/rime/placeless_flypy.schema.yaml b/.config/fcitx.symlink/rime/placeless_flypy.schema.yaml index 9e22282..3289cbf 100644 --- a/.config/fcitx.symlink/rime/placeless_flypy.schema.yaml +++ b/.config/fcitx.symlink/rime/placeless_flypy.schema.yaml @@ -119,7 +119,7 @@ grammar: punctuator: import_preset: default symbols: - "bq": [😂️, 😅️, 🎉, 🐂, 😱️, 👌, 😇️, 🙃️, 🤔️, 💊️, 💯️, 👍️, 🙈️, 💩️, 😈️ ] + "bq": [😂️, 😅️, 🤦‍♂, 🥺, 🥵, 🎉, 🐂, 😱️, 👌, 😇️, 🙃️, 🤔️, 💊️, 💯️, 👍️, 🙈️, 💩️, 😈️, 🥲, 🫥, 🫠] "kb": [⌘, ⌥, ⇧, ⌃, ⎋, ⇪, , ⌫, ⌦, ↩︎, ⏎, ↑, ↓, ←, →, ↖, ↘, ⇟, ⇞] half_shape: "\\" : "、" From a7952ca45cb28fa151f2c8aa1c5999bfc14592d5 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Tue, 25 Apr 2023 19:10:01 +0800 Subject: [PATCH 32/67] [ bspwm ] update bspwm config --- .config/bspwm.symlink/bspwmrc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.config/bspwm.symlink/bspwmrc b/.config/bspwm.symlink/bspwmrc index 323f789..59c4191 100755 --- a/.config/bspwm.symlink/bspwmrc +++ b/.config/bspwm.symlink/bspwmrc @@ -48,11 +48,18 @@ bspc rule -a Gimp desktop='^4' state=floating follow=on bspc rule -a org.remmina.Remmina desktop='^7' state=floating follow=on bspc rule -a telegram-desktop desktop='^3' state=floating follow=on bspc rule -a Chromium desktop='^1' follow=on -bspc rule -a atom desktop='^4' follow=on bspc rule -a mplayer2 state=floating bspc rule -a Kupfer.py focus=on bspc rule -a Screenkey manage=off bspc rule -a firefox desktop='^1' follow=on +# To fix weried and annoying bug with jetbrain products +bspc rule -a android-studio state=floating border=off follow=on +# To fix weried and annoying bug with jetbrain products * 2 +bspc rule -a intellij state=floating border=off follow=on + + +pkill wmname +wmname LG3D & #remmina -i & #pkill keepassxc From 414e873b83788ce0b14cbcad61a8abf05f549cb1 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Tue, 25 Apr 2023 19:10:29 +0800 Subject: [PATCH 33/67] [ polybar ] polybar config --- .config/polybar.symlink/config.ini | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/.config/polybar.symlink/config.ini b/.config/polybar.symlink/config.ini index 5349c93..e1284a6 100755 --- a/.config/polybar.symlink/config.ini +++ b/.config/polybar.symlink/config.ini @@ -246,26 +246,36 @@ ramp-volume-2 = %{F#FF6A6A}  %{F-} ramp-volume-3 = %{F#FF6A6A}  %{F-} -[module/launcher2] -type = custom/menu +#[module/launcher2] +#type = custom/menu +# +#format-padding = 0 +# +#label-open = 異 +#label-close = ☓ +# +#menu-0-0 = Zoom +#menu-0-0-foreground = #fba922 +#menu-0-0-exec = ~/.config/rofi/zoom/launcher.sh -format-padding = 0 +[module/launcher] +type = custom/text -label-open = 異 -label-close = ☓ +content = 異 +content-background = black +content-foreground = green -menu-0-0 = Zoom -menu-0-0-foreground = #fba922 -menu-0-0-exec = ~/.config/rofi/zoom/launcher.sh +click-left = ~/.config/rofi/zoom/launcher.sh +click-right = launcher_t1 -[module/launcher] +[module/launcher2] type = custom/text content = 異 content-background = black content-foreground = green -click-left = ~/.config/rofi/zoom/launcher.sh +click-left = ~/.config/rofi/virtualbox/launcher.sh click-right = launcher_t1 [module/battery] From 7ab43a3e603355e89b249e64faefc7e86747a4a3 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Tue, 25 Apr 2023 19:10:43 +0800 Subject: [PATCH 34/67] [ rofi ] rofi config --- .config/rofi.symlink/config.rasi | 3 ++- .config/rofi.symlink/virtualbox/launcher.sh | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100755 .config/rofi.symlink/virtualbox/launcher.sh diff --git a/.config/rofi.symlink/config.rasi b/.config/rofi.symlink/config.rasi index 413c5c2..f45f4c4 100644 --- a/.config/rofi.symlink/config.rasi +++ b/.config/rofi.symlink/config.rasi @@ -1,6 +1,7 @@ configuration { modi: "window,drun,ssh,combi"; - font: "hack 10"; + show: "combi"; + font: "hack 12"; show-icons: true; } @theme "/usr/share/rofi/themes/Paper.rasi" diff --git a/.config/rofi.symlink/virtualbox/launcher.sh b/.config/rofi.symlink/virtualbox/launcher.sh new file mode 100755 index 0000000..8fc03cd --- /dev/null +++ b/.config/rofi.symlink/virtualbox/launcher.sh @@ -0,0 +1 @@ +vboxmanage startvm $( vboxmanage list --sorted vms | rofi -dmenu -p 'Select vm to launch' | awk -F ' ' '{print $NF}' ) From 7e01799b7c4f9e35c6513c176deade8898b175b6 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Tue, 25 Apr 2023 19:10:56 +0800 Subject: [PATCH 35/67] [ rofi ] rofi config --- .config/sxhkd.symlink/sxhkdrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.config/sxhkd.symlink/sxhkdrc b/.config/sxhkd.symlink/sxhkdrc index 6201ab1..a35c37f 100755 --- a/.config/sxhkd.symlink/sxhkdrc +++ b/.config/sxhkd.symlink/sxhkdrc @@ -11,7 +11,8 @@ super + e pcmanfm-qt # program launcher alt + space - rofi -show drun -display-drun "Run" -show-icons + rofi -show combi -combi-modes "window,drun,ssh,zoom:$HOME/.config/rofi/zoom/launcher.sh" -modes combi -display-drun "" -show-icons + #rofi -show drun -display-drun "Run" -show-icons # make sxhkd reload its configuration files: super + Escape From eaf3ae40802d4aeaf7990e31533b0f59484e1006 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Tue, 25 Apr 2023 19:11:27 +0800 Subject: [PATCH 36/67] [zsh]config update --- zshrc.symlink | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/zshrc.symlink b/zshrc.symlink index 9357e6a..ef6693d 100644 --- a/zshrc.symlink +++ b/zshrc.symlink @@ -1,6 +1,6 @@ # If you come from bash you might have to change your $PATH. -# export PATH=$HOME/bin:/usr/local/bin:$PATH +export PATH=$HOME/.local/bin:$HOME/bin:/usr/local/bin:$PATH # Path to your oh-my-zsh installation. export ZSH=~/.oh-my-zsh @@ -116,3 +116,23 @@ alias luamake=/home/kevin/lua-language-server/3rd/luamake/luamake export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion + + +(cat ~/.cache/wal/sequences &) + +# pnpm +export PNPM_HOME="/home/kevin/.local/share/pnpm" +export PATH="$PNPM_HOME:$PATH" +# pnpm end +# bun completions +[ -s "/home/kevin/.bun/_bun" ] && source "/home/kevin/.bun/_bun" + +# bun +export BUN_INSTALL="$HOME/.bun" +export PATH="$BUN_INSTALL/bin:$PATH" + +# The next line updates PATH for the Google Cloud SDK. +if [ -f '/home/kevin/local/bin/google-cloud-sdk/path.zsh.inc' ]; then . '/home/kevin/local/bin/google-cloud-sdk/path.zsh.inc'; fi + +# The next line enables shell command completion for gcloud. +if [ -f '/home/kevin/local/bin/google-cloud-sdk/completion.zsh.inc' ]; then . '/home/kevin/local/bin/google-cloud-sdk/completion.zsh.inc'; fi From 1f9e136eb83eef7eef3e8e64b37acbfb8d552b5c Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Sun, 7 May 2023 21:05:11 +1200 Subject: [PATCH 37/67] [ picom ] fix shadow for dock --- .config/picom.conf.symlink | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/picom.conf.symlink b/.config/picom.conf.symlink index ef78b30..585a5c9 100644 --- a/.config/picom.conf.symlink +++ b/.config/picom.conf.symlink @@ -6,7 +6,7 @@ shadow-opacity = 0.7; shadow-red = 0.0; shadow-green = 0.0; shadow-blue = 0.0; -shadow-exclude = [ "name = 'Notification'", "class_g = 'Conky'", "class_g ?= 'Notify-osd'", "class_g = 'Cairo-clock'" ]; +shadow-exclude = [ "name = 'Notification'", "class_g = 'Conky'", "class_g ?= 'Notify-osd'", "window_type = 'dock'" ]; shadow-ignore-shaped = false; xinerama-shadow-crop = false; inactive-opacity = 0.8; From faa3bc4bd1887b69400b5c20fa79e5ffe7c3fc88 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Thu, 14 Sep 2023 20:53:32 +1200 Subject: [PATCH 38/67] add redshift to auto_start --- .config/bspwm.symlink/bspwmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/bspwm.symlink/bspwmrc b/.config/bspwm.symlink/bspwmrc index 59c4191..60328cf 100755 --- a/.config/bspwm.symlink/bspwmrc +++ b/.config/bspwm.symlink/bspwmrc @@ -73,7 +73,7 @@ nm-applet & /usr/bin/lxqt-policykit-agent & -AUTO_START=(caffeine picom plank dunst guake keepassxc blueman-applet) +AUTO_START=(caffeine picom plank dunst guake keepassxc blueman-applet redshift) for p in ${AUTO_START[@]}; do pgrep -x $p > /dev/null || $p & disown done From 8d14e77dbc3322576939d65caea0095676e47464 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Sun, 28 Jan 2024 12:01:31 +1300 Subject: [PATCH 39/67] bspwm fix --- .config/bspwm.symlink/bspwmrc | 39 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/.config/bspwm.symlink/bspwmrc b/.config/bspwm.symlink/bspwmrc index 60328cf..8256205 100755 --- a/.config/bspwm.symlink/bspwmrc +++ b/.config/bspwm.symlink/bspwmrc @@ -1,29 +1,30 @@ -#! /bin/bash +#!/bin/bash + xgetmons() { xrandr | grep \ connected | awk {'print $1'} } pgrep -x sxhkd > /dev/null || sxhkd & -DISP_NUM=`xrandr -d :0 -q | grep ' connected' | wc -l` -RESOLUTION=`xrandr | grep \* | cut -d' ' -f4` +DISP_NUM=$(xrandr -d :0 -q | grep -c ' connected') +RESOLUTION=$(xrandr | grep ".*" | cut -d' ' -f4) INTERNAL=$(xgetmons | grep eDP) EXTERNAL=$(xgetmons | grep -v eDP) -if [ $DISP_NUM -eq 2 ]; +if [ "$DISP_NUM" -eq 2 ]; then dunstify "Using dual monitor setup" - bspc monitor $INTERNAL -d web code chat + bspc monitor "$INTERNAL" -d web code chat for mons in $EXTERNAL ; do - bspc monitor $EXTERNAL -d video game torrent + bspc monitor "$mons" -d video game torrent done else - if [ $RESOLUTION = '1080x1920' ]; + if [ "$RESOLUTION" = '1080x1920' ]; then bspc monitor -d web code server else dunstify "Using single monitor setup" - bspc monitor $INTERNAL -d web code chat video game torrent server + bspc monitor "$INTERNAL" -d web code chat video game torrent server fi fi @@ -38,14 +39,16 @@ bspc config borderless_monocle true bspc config gapless_monocle true #Focusing behavior +# bspc config focus_follows_pointer true +#bspc config click_to_focus true #Multihead behavior bspc config remove_disabled_monitors true bspc config remove_unplugged_monitors true bspc rule -a Gimp desktop='^4' state=floating follow=on -bspc rule -a org.remmina.Remmina desktop='^7' state=floating follow=on +#bspc rule -a org.remmina.Remmina desktop='^7' state=floating follow=on bspc rule -a telegram-desktop desktop='^3' state=floating follow=on bspc rule -a Chromium desktop='^1' follow=on bspc rule -a mplayer2 state=floating @@ -67,26 +70,22 @@ wmname LG3D & pkill xscreensaver xscreensaver -no-splash & -nm-applet & #blueman-applet & -/usr/bin/lxqt-policykit-agent & - -AUTO_START=(caffeine picom plank dunst guake keepassxc blueman-applet redshift) -for p in ${AUTO_START[@]}; do - pgrep -x $p > /dev/null || $p & disown +AUTO_START=(caffeine picom plank dunst guake keepassxc blueman-applet redshift lxqt-policykit-agent nm-applet) +for p in "${AUTO_START[@]}"; do + pgrep -x "$p" > /dev/null || $p & disown done +pgrep -x fcitx > /dev/null || fcitx -u fcitx-light-ui & -pgrep -x fcitx > /dev/null || fcitx -u fcitx-light-ui& - -wal -i wallpapers/pixels-d.webp +wal -i wallpapers/awesome.png -$HOME/.config/polybar/launch.sh & disown +"$HOME"/.config/polybar/launch.sh & disown # Remap Caps key to control -setxkbmap -option ctrl:nocaps +#setxkbmap -option ctrl:nocaps systemd-detect-virt 1> /dev/null From 8fd50101869e984599bb2986a4d64604021051fc Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Sun, 28 Jan 2024 12:01:45 +1300 Subject: [PATCH 40/67] add alacritty config --- .config/alacritty.symlink/alacritty.toml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .config/alacritty.symlink/alacritty.toml diff --git a/.config/alacritty.symlink/alacritty.toml b/.config/alacritty.symlink/alacritty.toml new file mode 100644 index 0000000..3ef5b68 --- /dev/null +++ b/.config/alacritty.symlink/alacritty.toml @@ -0,0 +1,7 @@ +[font] +size = 16.0 + +[[keyboard.bindings]] +action = "SpawnNewInstance" +key = "Return" +mods = "Control|Shift" From c5222cbea86231c7431e76728915260923c170d2 Mon Sep 17 00:00:00 2001 From: Kevin Jiang Date: Mon, 29 Jan 2024 12:08:51 +1300 Subject: [PATCH 41/67] Update polybar config --- .config/polybar.symlink/config.ini | 52 ++++++++++++++++++------------ .config/sxhkd.symlink/sxhkdrc | 17 +++++++--- 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/.config/polybar.symlink/config.ini b/.config/polybar.symlink/config.ini index e1284a6..3552bcd 100755 --- a/.config/polybar.symlink/config.ini +++ b/.config/polybar.symlink/config.ini @@ -13,6 +13,7 @@ margin-bottom = 0 [bar/top_ext] enable-ipc = true +;dpi = ${xrdb:Xft.dpi:-1} monitor = ${env:MONITOR:} width = 100% height = 32 @@ -36,7 +37,7 @@ padding-right = 2 module-margin-left = 1 module-margin-right = 2 -font-0 = Roboto:style=regular:size=12;3 +font-0 = Roboto:style=regular:size=14;3 font-1 = Unifont:size=12;3 font-2 = Material Icons:style=Regular:size=14;3 font-3 = Sarasa Mono H:style=bold:size=10;3 @@ -44,10 +45,16 @@ font-4 = FontAwesome:size=12;4 font-5 = Siji:pixelsize=11;1 modules-left = powermenu launcher bspwm mpd -modules-right = network cpu pulseaudio xbacklight memory eth temperature date +modules-right = network cpu pulseaudio brightness memory eth temperature date tray + +[modules/tray] +type = internal/tray + tray-position = right tray-padding = 2 + + wm-restack = bspwm scroll-up = #bspwm.next @@ -55,6 +62,7 @@ scroll-down = #bspwm.prev [bar/top] enable-ipc = true +dpi = ${xrdb:Xft.dpi:-1} monitor = ${env:MONITOR:} width = 100% height = 32 @@ -85,18 +93,18 @@ font-3 = Sarasa Mono H:style=bold:size=10;3 font-4 = FontAwesome:size=12;4 font-5 = Siji:pixelsize=10;1 -modules-left = powermenu bspwm launcher launcher2 mpd -modules-right = network cpu pulseaudio xbacklight memory eth temperature battery date -tray-position = right -tray-padding = 2 +modules-left = powermenu bspwm launcher2 mpd +modules-right = network cpu pulseaudio brightness memory eth temperature battery date tray wm-restack = bspwm scroll-up = bspwm-desknext scroll-down = bspwm-deskprev -[module/xbacklight] -type = internal/xbacklight +[module/brightness] +type = internal/backlight +card = amdgpu_bl1 +use-actual-brightness = true format =