From 99215a333306563225e7b3aa932caffbe91622b7 Mon Sep 17 00:00:00 2001 From: Christian Nieves Date: Tue, 18 Oct 2022 23:32:44 +0000 Subject: [PATCH] stuff --- google/.hgrc | 3 ++- tmux/.tmux/osiris-theme.conf | 6 ++--- vim/.vim/lua/catppuccin-config.lua | 18 +++++++++++-- vim/.vim/lua/diagnostics.lua | 3 ++- vim/.vim/lua/google_comments.lua | 40 +++++++++++++++++++++++++++ vim/.vim/lua/lsp.lua | 29 ++++++++++++++++---- vim/.vim/prefs/google_comments.vim | 43 ------------------------------ vim/.vim/prefs/plugins.vim | 2 +- vim/.vimrc | 27 ++++++++++++++----- zsh/.aliases.sh | 1 + 10 files changed, 109 insertions(+), 63 deletions(-) create mode 100644 vim/.vim/lua/google_comments.lua diff --git a/google/.hgrc b/google/.hgrc index 78c617b..5415b30 100644 --- a/google/.hgrc +++ b/google/.hgrc @@ -1,7 +1,7 @@ %include /google/src/head/depot/google3/experimental/fig_contrib/hgshort/hgshort.hgrc [ui] -editor = vim +editor = nvim paginate = never merge = vimdiff username = Christian Nieves @@ -41,6 +41,7 @@ changeset = {desc}\n\n [alias] whatsout = status -n --change . --template=hgshort_status +what = status -n --change . --template=hgshort_status whatsoutall = status --rev p4base --no-status --template=hgshort_status # unbranch = cp --forget --at-rev . $1 unbranch = !$HG uncommit --keep $1 && $HG forget $1 && $HG add $1 && $HG amend $1 diff --git a/tmux/.tmux/osiris-theme.conf b/tmux/.tmux/osiris-theme.conf index 54beaf8..47e9427 100644 --- a/tmux/.tmux/osiris-theme.conf +++ b/tmux/.tmux/osiris-theme.conf @@ -66,14 +66,14 @@ set -g mode-style bg=brightcyan,fg=black set -g message-style bg=brightblack,fg=cyan set -g message-command-style bg=brightblack,fg=cyan -set -g status-style fg=white,bg=black +set -g status-style fg=white,bg=default set -g status-left '#{?pane_synchronized, ¤ ,}#{?window_zoomed_flag, ↕ ,}' set -g status-right "#{cpu_bg_color}#{cpu_fg_color} CPU:#{cpu_percentage} #{fg=black}$right_alt_sep#{ram_fg_color}#{ram_bg_color} RAM:#{ram_percentage} #{ram_bg_color} #[fg=black]$right_sep#[fg=default]#[bg=default] #H" set -g status-right-length 55 -set -g pane-border-style fg=brightblack,bg=black -set -g pane-active-border-style fg=colour104,bg=black +set -g pane-border-style fg=brightblack,bg=default +set -g pane-active-border-style fg=colour104,bg=default set-window-option -g window-status-style fg=colour104,bg=default set-window-option -g window-status-current-style fg=colour147,bg=default diff --git a/vim/.vim/lua/catppuccin-config.lua b/vim/.vim/lua/catppuccin-config.lua index ea6c596..19c4aae 100644 --- a/vim/.vim/lua/catppuccin-config.lua +++ b/vim/.vim/lua/catppuccin-config.lua @@ -1,9 +1,13 @@ +vim.g.catppuccin_flavour = "macchiato" -- latte, frappe, macchiato, mocha + +local colors = require("catppuccin.palettes").get_palette() + require("catppuccin").setup({ compile_path = vim.fn.stdpath("cache") .. "/catppuccin", transparent_background = false, term_colors = false, dim_inactive = { - enabled = false, + enabled = true, shade = "dark", percentage = 0.15, }, @@ -83,5 +87,15 @@ require("catppuccin").setup({ }, }, color_overrides = {}, - custom_highlights = {}, + custom_highlights = { + -- Type = { fg = colors.blue }, + -- Function = { fg = colors.sapphire }, + -- Identifier = { fg = colors.mauve }, + -- -- + Function = { fg = colors.mauve }, + }, }) + +require('catppuccin').compile() + +vim.api.nvim_command "colorscheme catppuccin" diff --git a/vim/.vim/lua/diagnostics.lua b/vim/.vim/lua/diagnostics.lua index 62228d9..1541d8c 100644 --- a/vim/.vim/lua/diagnostics.lua +++ b/vim/.vim/lua/diagnostics.lua @@ -4,7 +4,8 @@ require("trouble").setup({ height = 10, -- height of the trouble list when position is top or bottom width = 50, -- width of the list when position is left or right icons = true, -- use devicons for filenames - mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist" + -- mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist" + mode = "document_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist" fold_open = "", -- icon used for open folds fold_closed = "", -- icon used for closed folds group = true, -- group results by file diff --git a/vim/.vim/lua/google_comments.lua b/vim/.vim/lua/google_comments.lua new file mode 100644 index 0000000..eeec27a --- /dev/null +++ b/vim/.vim/lua/google_comments.lua @@ -0,0 +1,40 @@ +-- Here are all the options and their default values: +require('google.comments').setup { + -- The command for fetching comments, refer to `get_comments.par --help` to + -- see all the options. + -- command = {'/google/bin/releases/editor-devtools/get_comments.par', '--full', '--json', "-x=''"}, + command = {'/google/bin/releases/editor-devtools/get_comments.par', '--json', '--full', '--noresolved', '--cl_comments', '--file_comments', '--unreplied_only', ' -x ""'}, + -- Define your own icon by `vim.fn.sign_define('ICON_NAME', {text = ' '})`. + -- See :help sign_define + -- The sign property passed to setup should be the 'ICON_NAME' in the define + -- example above. + sign = 'COMMENT_ICON', + -- Fetch the comments after calling `setup`. + auto_fetch = true, + display = { + -- The width of the comment display window. + width = 50, + -- When showing file paths, use relative paths or not. + relative_path = true, + }, + --- Enable viewing comments through floating window + floating = true, + --- Options used when creating the floating window. + floating_window_options = require('google.comments.options') + .default_floating_window_options, +} +-- here are some mappings you might want: +vim.api.nvim_set_keymap('n', 'nc', + [[lua require('google.comments').goto_next_comment()]], + { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'pc', + [[lua require('google.comments').goto_prev_comment()]], + { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'lc', + [[lua require('google.comments').toggle_line_comments()]], + { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', 'ac', + [[lua require('google.comments').toggle_all_comments()]], + { noremap = true, silent = true }) + +vim.fn.sign_define('COMMENT_ICON', {text = ''}) diff --git a/vim/.vim/lua/lsp.lua b/vim/.vim/lua/lsp.lua index cc3e5f0..a47911a 100644 --- a/vim/.vim/lua/lsp.lua +++ b/vim/.vim/lua/lsp.lua @@ -1,11 +1,12 @@ -- 1. Configure CiderLSP local nvim_lsp = require("lspconfig") local configs = require("lspconfig.configs") +local notify = require 'notify' configs.ciderlsp = { default_config = { - cmd = { "/google/bin/releases/cider/ciderlsp/ciderlsp", "--tooltag=nvim-lsp", "--forward_sync_responses", "--enable_semantic_tokens", "--relay_mode=true", "--hub_addr=blade:languageservices-staging" ,"--enable_document_highlight"}, + cmd = { "/google/bin/releases/cider/ciderlsp/ciderlsp", "--tooltag=nvim-cmp", "--forward_sync_responses", "--enable_semantic_tokens", "--relay_mode=true", "--hub_addr=blade:languageservices-staging" ,"--enable_document_highlight"}, -- cmd = {'/google/bin/releases/cider/ciderlsp/ciderlsp', '--forward_sync_responses', '--enable_document_highlight'}; - filetypes = { "c", "cpp", "java", "kotlin", "proto", "textproto", "go", "python", "bzl" }, + filetypes = { "c", "cpp", "java", "kotlin", "objc", "proto", "textproto", "go", "python", "bzl" }, root_dir = nvim_lsp.util.root_pattern("BUILD"), settings = {}, }, @@ -121,8 +122,9 @@ cmp.setup({ with_text = true, maxwidth = 40, -- half max width menu = { - nvim_ciderlsp = "[🤖]", - buffer = "[buffer]", + -- nvim_ciderlsp = "[]", + nvim_ciderlsp = "", + buffer = "", nvim_lsp = "[CiderLSP]", nvim_lua = "[API]", path = "[path]", @@ -157,7 +159,7 @@ cider_lsp_handlers["$/syncResponse"] = function(_, result, ctx) local first_fire = vim.b['is_cider_lsp_attached'] == 'no' vim.b['is_cider_lsp_attached'] = 'yes' if first_fire then - require('notify')('CiderLSP attached', 'info', {timeout=150}) + notify('CiderLSP attached', 'info', {timeout=500}) require('lualine').refresh() end end @@ -169,6 +171,23 @@ cider_lsp_handlers["workspace/diagnostic/refresh"] = function(_, result, ctx) VPrint(ctx) end +cider_lsp_handlers['window/showMessage'] = function(_, result, ctx) + local client = vim.lsp.get_client_by_id(ctx.client_id) + local lvl = ({ + 'ERROR', + 'WARN', + 'INFO', + 'DEBUG', + })[result.type] + notify({ result.message }, lvl, { + title = 'LSP | ' .. client.name, + timeout = 1000, + keep = function() + return lvl == 'ERROR' or lvl == 'WARN' + end, + }) +end + -- 3. Set up CiderLSP local on_attach = function(client, bufnr) vim.b['is_cider_lsp_attached'] = 'no' diff --git a/vim/.vim/prefs/google_comments.vim b/vim/.vim/prefs/google_comments.vim index afa9920..527e928 100644 --- a/vim/.vim/prefs/google_comments.vim +++ b/vim/.vim/prefs/google_comments.vim @@ -1,45 +1,2 @@ -lua << EOF --- Here are all the options and their default values: -require('google.comments').setup { - -- The command for fetching comments, refer to `get_comments.par --help` to - -- see all the options. - -- command = {'/google/bin/releases/editor-devtools/get_comments.par', '--full', '--json', "-x=''"}, - command = {'/google/bin/releases/editor-devtools/get_comments.par', '--json', '--full', '--noresolved', '--cl_comments', '--file_comments', ' -x ""'}, - -- Define your own icon by `vim.fn.sign_define('ICON_NAME', {text = ' '})`. - -- See :help sign_define - -- The sign property passed to setup should be the 'ICON_NAME' in the define - -- example above. - sign = 'COMMENT_ICON', - -- Fetch the comments after calling `setup`. - auto_fetch = true, - display = { - -- The width of the comment display window. - width = 50, - -- When showing file paths, use relative paths or not. - relative_path = true, - }, - --- Enable viewing comments through floating window - floating = true, - --- Options used when creating the floating window. - floating_window_options = require('google.comments.options') - .default_floating_window_options, -} --- here are some mappings you might want: -vim.api.nvim_set_keymap('n', 'nc', - [[lua require('google.comments').goto_next_comment()]], - { noremap = true, silent = true }) -vim.api.nvim_set_keymap('n', 'pc', - [[lua require('google.comments').goto_prev_comment()]], - { noremap = true, silent = true }) -vim.api.nvim_set_keymap('n', 'lc', - [[lua require('google.comments').toggle_line_comments()]], - { noremap = true, silent = true }) -vim.api.nvim_set_keymap('n', 'ac', - [[lua require('google.comments').toggle_all_comments()]], - { noremap = true, silent = true }) - -vim.fn.sign_define('COMMENT_ICON', {text = ''}) -EOF - autocmd InsertLeave * :lua require('google.comments').update_signs() autocmd InsertLeave * :GoogleCommentsFetchComments diff --git a/vim/.vim/prefs/plugins.vim b/vim/.vim/prefs/plugins.vim index 818c13b..66df261 100644 --- a/vim/.vim/prefs/plugins.vim +++ b/vim/.vim/prefs/plugins.vim @@ -35,7 +35,6 @@ Plug 'rcarriga/nvim-notify' Plug 'nathanaelkane/vim-indent-guides' Plug 'Konfekt/vim-scratchpad' Plug 'guns/xterm-color-table.vim' -Plug 'kyazdani42/nvim-web-devicons' Plug 'mbbill/undotree' Plug 'tversteeg/registers.nvim', { 'branch': 'main' } " Plug 'ryanoasis/vim-devicons' @@ -131,6 +130,7 @@ Plug 'kristiandupont/shades-of-teal' Plug 'joshdick/onedark.vim' Plug 'google/vim-colorscheme-primary' Plug 'kyoz/purify', { 'rtp': 'vim' } +Plug 'kyazdani42/nvim-web-devicons' " ONE LINERS ONLY set statusline=%{pathshorten(expand('%:f'))} diff --git a/vim/.vimrc b/vim/.vimrc index 3638837..eaa1cc9 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -75,6 +75,8 @@ let g:clipboard = #{ \ cache_enabled: 1, \ } set shortmess=A +set modifiable +set omnifunc= completeopt=menuone,noinsert,noselect set updatetime=100 @@ -105,6 +107,7 @@ if filereadable(expand("~/use_google")) source ~/.vim/prefs/cmp.vim source ~/.vim/prefs/imp.vim source ~/.vim/prefs/google_comments.vim + lua require("google_comments") endif filetype plugin on " redundant? @@ -143,16 +146,26 @@ endif set background=dark let $NVIM_TUI_ENABLE_TRUE_COLOR=1 -" colorscheme quantum -let g:catppuccin_flavour = "macchiato" " latte, frappe, macchiato, mocha -colorscheme catppuccin -let g:airline_theme='quantum' - -set modifiable -set omnifunc= completeopt=menuone,noinsert,noselect let g:lsp_log_verbose = 1 let g:lsp_log_file = expand('~/vim-lsp.log') "Don't ask to save when changing buffers (i.e. when jumping to a type definition) set hidden + +function! GenerateUnicode(first, last) + let i = a:first + while i <= a:last + if (i%256 == 0) + $put ='----------------------------------------------------' + $put =' 0 1 2 3 4 5 6 7 8 9 A B C D E F ' + $put ='----------------------------------------------------' + endif + let c = printf('%04X ', i) + for j in range(16) + let c = c . nr2char(i) . ' ' + let i += 1 + endfor + $put =c + endwhile +endfunction diff --git a/zsh/.aliases.sh b/zsh/.aliases.sh index 02f3eee..1830f86 100644 --- a/zsh/.aliases.sh +++ b/zsh/.aliases.sh @@ -1,5 +1,6 @@ alias go=colorgo alias vim='nvim' +alias vimdiff='nvim -d' # alias cat='bat' alias ls='exa' alias mux='tmuxinator'