Compare commits
5 Commits
4389d94876
...
3d0f3b11ae
Author | SHA1 | Date | |
---|---|---|---|
3d0f3b11ae | |||
7eda409f2b | |||
d2d3d932d8 | |||
87c1c50639 | |||
57cea17bca |
40
vim/.vim/lua/config/blaze.lua
Normal file
40
vim/.vim/lua/config/blaze.lua
Normal file
@ -0,0 +1,40 @@
|
||||
vim.cmd([[
|
||||
function s:blazeExec(cmd, targets)
|
||||
if len(a:targets) == 0
|
||||
exe VimuxRunCommand("build_target.py " . expand('%:p') . " " . a:cmd)
|
||||
else
|
||||
exe VimuxRunCommand(a:cmd . " " . join(a:targets, ' '))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function BlazeRun() abort
|
||||
call <SID>blazeExec("blaze run", blaze#GetTargets())
|
||||
endfunction
|
||||
|
||||
function BlazeBuild() abort
|
||||
call <SID>blazeExec("blaze build", blaze#GetTargets())
|
||||
endfunction
|
||||
|
||||
function BlazeTest() abort
|
||||
call <SID>blazeExec("blaze test", blaze#GetTargets())
|
||||
endfunction
|
||||
|
||||
function BlazeTestDebug() abort
|
||||
call <SID>blazeExec("blaze test --java_debug", blaze#GetTargets())
|
||||
endfunction
|
||||
|
||||
function BuildCleanerFile() abort
|
||||
exe VimuxRunCommand("build_cleaner " . expand('%'))
|
||||
endfunction
|
||||
|
||||
function UnusedDeps() abort
|
||||
exe VimuxRunCommand("unused_deps --nouse_build_api --blaze_options='--config=gmscore_tap' " . join(blaze#GetTargets(), ' '))
|
||||
endfunction
|
||||
|
||||
function BuildCleanerTarget() abort
|
||||
exe VimuxRunCommand("build_cleaner " . join(blaze#GetTargets(), ' '))
|
||||
endfunction
|
||||
|
||||
nnoremap <Leader>bc :call BuildCleanerFile()<cr>
|
||||
nnoremap <Leader>ud :call UnusedDeps()<cr>
|
||||
]])
|
@ -1,138 +0,0 @@
|
||||
local use_google = require("utils").use_google
|
||||
|
||||
if use_google() then
|
||||
vim.cmd([[
|
||||
let g:VCSCommandDisableMappings = 1
|
||||
|
||||
let g:signify_skip_filename_pattern = ['\.pipertmp.*']
|
||||
|
||||
function s:blazeExec(cmd, targets)
|
||||
if len(a:targets) == 0
|
||||
exe VimuxRunCommand("build_target.py " . expand('%:p') . " " . a:cmd)
|
||||
else
|
||||
exe VimuxRunCommand(a:cmd . " " . join(a:targets, ' '))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function BlazeRun() abort
|
||||
call <SID>blazeExec("blaze run", blaze#GetTargets())
|
||||
endfunction
|
||||
|
||||
function BlazeBuild() abort
|
||||
call <SID>blazeExec("blaze build", blaze#GetTargets())
|
||||
endfunction
|
||||
|
||||
function BlazeTest() abort
|
||||
call <SID>blazeExec("blaze test", blaze#GetTargets())
|
||||
endfunction
|
||||
|
||||
function BlazeTestDebug() abort
|
||||
call <SID>blazeExec("blaze test --java_debug", blaze#GetTargets())
|
||||
endfunction
|
||||
|
||||
function BuildCleanerFile() abort
|
||||
exe VimuxRunCommand("build_cleaner " . expand('%'))
|
||||
endfunction
|
||||
|
||||
function UnusedDeps() abort
|
||||
exe VimuxRunCommand("unused_deps --nouse_build_api --blaze_options='--config=gmscore_tap' " . join(blaze#GetTargets(), ' '))
|
||||
endfunction
|
||||
|
||||
function BuildCleanerTarget() abort
|
||||
exe VimuxRunCommand("build_cleaner " . join(blaze#GetTargets(), ' '))
|
||||
endfunction
|
||||
|
||||
nnoremap <Leader>br :call BlazeRun()<cr>
|
||||
nnoremap <Leader>bb :call BlazeBuild()<cr>
|
||||
nnoremap <Leader>bt :call BlazeTest()<cr>
|
||||
nnoremap <Leader>btd :call BlazeTestDebug()<cr>
|
||||
nnoremap <Leader>bc :call BuildCleanerFile()<cr>
|
||||
nnoremap <Leader>ud :call UnusedDeps()<cr>
|
||||
|
||||
let g:asyncrun_open = 1
|
||||
|
||||
function! s:AsyncBlaze(cmd, targets) abort
|
||||
"open cwindow manually and immediately when blaze starts.
|
||||
"simulate the same behavior from google-emacs blaze plugin.
|
||||
let l:aro = g:asyncrun_open
|
||||
let g:asyncrun_open = 0
|
||||
let l:target = ':'.expand('%:r')
|
||||
call setqflist([]) | copen 15
|
||||
" don't use !, so we scrolling the output.
|
||||
call asyncrun#run("", {"rows": 15}, a:cmd . ' ' . join(a:targets, ' '))
|
||||
let g:asyncrun_open = l:aro
|
||||
endfunction
|
||||
|
||||
function AsyncBlazeBuild() abort
|
||||
call <SID>AsyncBlaze("blaze build", blaze#GetTargets())
|
||||
endfunction
|
||||
|
||||
function AsyncBlazeTest() abort
|
||||
call <SID>AsyncBlaze("blaze test", blaze#GetTargets())
|
||||
endfunction
|
||||
|
||||
autocmd bufreadpre *.sh setlocal textwidth=80
|
||||
|
||||
augroup autoformat_settings
|
||||
autocmd FileType borg,gcl,patchpanel AutoFormatBuffer gclfmt
|
||||
autocmd FileType bzl AutoFormatBuffer buildifier
|
||||
autocmd FileType c,cpp,javascript,typescript AutoFormatBuffer clang-format
|
||||
autocmd FileType dart AutoFormatBuffer dartfmt
|
||||
autocmd FileType go AutoFormatBuffer gofmt
|
||||
autocmd FileType java AutoFormatBuffer google-java-format
|
||||
autocmd FileType jslayout AutoFormatBuffer jslfmt
|
||||
autocmd FileType markdown AutoFormatBuffer mdformat
|
||||
autocmd FileType ncl AutoFormatBuffer nclfmt
|
||||
autocmd FileType python AutoFormatBuffer pyformat
|
||||
autocmd FileType soy AutoFormatBuffer soyfmt
|
||||
autocmd FileType textpb AutoFormatBuffer text-proto-format
|
||||
autocmd FileType proto AutoFormatBuffer protofmt
|
||||
autocmd FileType sql AutoFormatBuffer format_sql
|
||||
autocmd FileType kotlin AutoFormatBuffer ktfmt
|
||||
autocmd FileType soy AutoFormatBuffer soyfmt
|
||||
" autocmd FileType html,css,json AutoFormatBuffer js-beautify
|
||||
augroup END
|
||||
|
||||
function! CitCWorkspace()
|
||||
let l:workspace = substitute(getcwd(), '/google/src/cloud/[^/]\+/\([^/]\+\)/.*', '\1', 'g')
|
||||
return l:workspace
|
||||
endfunction
|
||||
|
||||
function! G4Blame(...)
|
||||
" Grab the filename from the argument, use expand() to expand '%'.
|
||||
if a:0 > 0
|
||||
let file = expand(a:1)
|
||||
else
|
||||
let file = expand('%')
|
||||
endif
|
||||
" Lock scrolling in right pane
|
||||
setl scb
|
||||
" Create left pane
|
||||
vnew
|
||||
" It's 37 columns wide
|
||||
vert res 37
|
||||
" Get the output, split it on newline and keep empty lines, skip the first 2
|
||||
" lines because they're headers we don't need, and put it in starting on line
|
||||
" 1 of the left pane
|
||||
call setline(1, split(system('hg blame ' . file), '\n', 1)[2:])
|
||||
" Lock scrolling in left pane, turn off word wrap, set the buffer as
|
||||
" not-modified, remove any listchars highlighting (common in google code), set
|
||||
" it readonly (to make modifications slightly more annoying).
|
||||
setl scb nowrap nomod nolist ro
|
||||
" Move back to the right pane (not sure if there's a better way to do this?)
|
||||
exe "normal \<c-w>\<right>"
|
||||
" if a file was specified, open it
|
||||
if a:0 > 0
|
||||
execute "e ". file
|
||||
endif
|
||||
" Get the non-active pane scrolled to the same relative offset.
|
||||
syncbind
|
||||
endfunction
|
||||
|
||||
com! -nargs=? -complete=file Blame :call G4Blame(<f-args>)
|
||||
|
||||
nnoremap <leader>cc :CritiqueUnresolvedComments<space><cr>
|
||||
|
||||
nmap <leader>yb :let t = join(blaze#GetTargets(), ' ') \| echo t \| let @+ = t <CR>
|
||||
]])
|
||||
end
|
||||
|
@ -18,13 +18,59 @@ return {
|
||||
vim.opt.termguicolors = true
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
-- separator_style = "slope",
|
||||
separator_style = "slant",
|
||||
hover = {
|
||||
enabled = true,
|
||||
delay = 200,
|
||||
reveal = { "close" },
|
||||
},
|
||||
indicator = {
|
||||
-- icon = "▎", -- this should be omitted if indicator style is not 'icon'
|
||||
style = "icon", -- | 'underline' | 'none',
|
||||
},
|
||||
offsets = {
|
||||
{
|
||||
filetype = "NvimTree",
|
||||
text = "File Explorer",
|
||||
highlight = "Directory",
|
||||
separator = true, -- use a "true" to enable the default, or set your own character
|
||||
},
|
||||
},
|
||||
mode = "tabs",
|
||||
diagnostics = "nvim_lsp",
|
||||
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||
local symbols = { error = " ", warning = " ", info = " ", hint = " " }
|
||||
local symbols = { error = " ", warning = " ", info = " ", hint = " " }
|
||||
local icon = symbols[level] or level
|
||||
return "" .. icon .. count
|
||||
end,
|
||||
custom_areas = {
|
||||
left = function()
|
||||
local result = {}
|
||||
local seve = vim.diagnostic.severity
|
||||
local error = #vim.diagnostic.get(0, { severity = seve.ERROR })
|
||||
local warning = #vim.diagnostic.get(0, { severity = seve.WARN })
|
||||
local info = #vim.diagnostic.get(0, { severity = seve.INFO })
|
||||
local hint = #vim.diagnostic.get(0, { severity = seve.HINT })
|
||||
|
||||
if error ~= 0 then
|
||||
table.insert(result, { text = " " .. error, fg = "#EC5241" })
|
||||
end
|
||||
|
||||
if warning ~= 0 then
|
||||
table.insert(result, { text = " " .. warning, fg = "#EFB839" })
|
||||
end
|
||||
|
||||
if hint ~= 0 then
|
||||
table.insert(result, { text = " " .. hint, fg = "#A3BA5E" })
|
||||
end
|
||||
|
||||
if info ~= 0 then
|
||||
table.insert(result, { text = " " .. info, fg = "#7EA9A7" })
|
||||
end
|
||||
return result
|
||||
end,
|
||||
},
|
||||
max_name_length = 30,
|
||||
truncate_name = false,
|
||||
show_close_icon = false,
|
||||
|
@ -13,13 +13,13 @@ return {
|
||||
-- Load google paths like //google/* with `gf`
|
||||
{ import = "nvgoog.google.misc" },
|
||||
-- maktaba is required by all google plugins
|
||||
glug("maktaba", {
|
||||
lazy = true,
|
||||
dependencies = {},
|
||||
config = function()
|
||||
{
|
||||
name = "maktaba",
|
||||
dir = "/usr/share/vim/google/maktaba",
|
||||
init = function()
|
||||
vim.cmd("source /usr/share/vim/google/glug/bootstrap.vim")
|
||||
end,
|
||||
}),
|
||||
},
|
||||
glug("core"),
|
||||
glug("glaive"),
|
||||
glug("alert"),
|
||||
@ -192,9 +192,6 @@ return {
|
||||
|
||||
-- Run blaze commands
|
||||
glug("blaze", {
|
||||
opts = {
|
||||
execution_mode = "async",
|
||||
},
|
||||
dependencies = {
|
||||
glug("blazedeps"),
|
||||
},
|
||||
@ -210,6 +207,9 @@ return {
|
||||
"BlazeDebugFinish",
|
||||
"BlazeDepsUpdate",
|
||||
},
|
||||
config = function()
|
||||
require("config.blaze")
|
||||
end,
|
||||
keys = function()
|
||||
local function runCmd(cmd)
|
||||
return function()
|
||||
@ -224,12 +224,14 @@ return {
|
||||
end
|
||||
return {
|
||||
{ "<leader>b", desc = "Blaze" },
|
||||
{ "<leader>be", runCmd("call blaze#LoadErrors()"), desc = "Blaze load errors" },
|
||||
{ "<leader>bl", runCmd("call blaze#ViewCommandLog()"), desc = "Blaze view build log" },
|
||||
{ "<leader>bs", runCmd("BlazeGoToSponge"), desc = "Blaze go to sponge" },
|
||||
{ "<leader>bc", runCmd("Blaze"), desc = "Blaze build on targets" },
|
||||
{ "<leader>bb", runCmd("Blaze build"), desc = "Blaze build" },
|
||||
{ "<leader>bt", runCmd("Blaze test"), desc = "Blaze test" },
|
||||
{ "<leader>bt", ":call BlazeTest()<CR>", desc = "Blaze Test" },
|
||||
{ "<leader>bb", ":call BlazeBuild()<CR>", desc = "Blaze Build" },
|
||||
{ "<leader>br", ":call BlazeRun()<CR>", desc = "Blaze Run" },
|
||||
{
|
||||
"<leader>yb",
|
||||
":let t = join(blaze#GetTargets(), ' ') | echo t | let @+ = t <CR>",
|
||||
desc = "Yank Blaze Target",
|
||||
},
|
||||
{ "<leader>bf", runCmd("call blaze#TestCurrentFile()"), desc = "Blaze test current file" },
|
||||
{ "<leader>bm", runCmd("call blaze#TestCurrentMethod()"), desc = "Blaze test current method" },
|
||||
{ "<leader>bd", desc = "Blaze debug" },
|
||||
|
@ -64,7 +64,7 @@ return {
|
||||
getLightbulb,
|
||||
{
|
||||
"filename",
|
||||
path = 1, -- 0 = just filename, 1 = relative path, 2 = absolute path
|
||||
path = 4, -- 0 = just filename, 1 = relative path, 2 = absolute path
|
||||
},
|
||||
},
|
||||
lualine_x = {
|
||||
@ -79,42 +79,6 @@ return {
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
-- tabline = {
|
||||
-- lualine_a = {
|
||||
-- {
|
||||
-- "tabs",
|
||||
-- mode = 1,
|
||||
-- use_mode_colors = true,
|
||||
-- max_length = (vim.o.columns / 5) * 4,
|
||||
-- fmt = function(name, context)
|
||||
-- -- Show + if buffer is modified in tab
|
||||
-- local buflist = vim.fn.tabpagebuflist(context.tabnr)
|
||||
-- local winnr = vim.fn.tabpagewinnr(context.tabnr)
|
||||
-- local bufnr = buflist[winnr]
|
||||
-- local mod = vim.fn.getbufvar(bufnr, "&mod")
|
||||
--
|
||||
-- return name .. (mod == 1 and " +" or "")
|
||||
-- end,
|
||||
-- },
|
||||
-- },
|
||||
-- lualine_b = { "branch" },
|
||||
-- -- lualine_c = { "filename" },
|
||||
-- lualine_c = {
|
||||
-- {
|
||||
-- "diagnostics",
|
||||
-- sources = { "nvim_workspace_diagnostic" },
|
||||
-- symbols = { error = " ", warn = " ", info = " ", hint = " " },
|
||||
-- },
|
||||
-- },
|
||||
-- -- lualine_y = { getLGTMs }
|
||||
-- lualine_z = {
|
||||
-- {
|
||||
-- "filename",
|
||||
-- file_status = false, -- displays file status (readonly status, modified status)
|
||||
-- path = 2, -- 0 = just filename, 1 = relative path, 2 = absolute path
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
42
vim/.vimrc
42
vim/.vimrc
@ -27,7 +27,7 @@ set ttyfast
|
||||
set relativenumber
|
||||
set copyindent
|
||||
set preserveindent
|
||||
set lazyredraw " Enable if running slow...
|
||||
" set lazyredraw " Enable if running slow...
|
||||
set autoindent
|
||||
|
||||
set wrap
|
||||
@ -65,7 +65,6 @@ lua require('plugin_init')
|
||||
source ~/.vim/prefs/mappings.vim
|
||||
source ~/.vim/prefs/leader.vim
|
||||
|
||||
set noshowmode
|
||||
set encoding=utf-8
|
||||
|
||||
set t_Co=256
|
||||
@ -103,9 +102,6 @@ function! GenerateUnicode(first, last)
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
set colorcolumn=80
|
||||
set mouse=
|
||||
|
||||
" makes sure that when opening, files are normal, i.e. not folded.
|
||||
set nofoldenable
|
||||
|
||||
@ -125,41 +121,7 @@ let g:loaded_netrwPlugin = 1
|
||||
let g:loaded_tutor_mode_plugin = 1
|
||||
let g:loaded_remote_plugins = 1
|
||||
|
||||
|
||||
function! TabMultiDiff()
|
||||
let s:tab_multi_diff = 0
|
||||
argdo call s:AddBufferToTab()
|
||||
tabclose
|
||||
endfun
|
||||
|
||||
" Helper function used by TabMultiDiff(). Adds current buffer to new tab
|
||||
" or last tab as appropriate, and sets new window's "diff" option.
|
||||
function! s:AddBufferToTab()
|
||||
let buf = bufnr("%")
|
||||
if s:tab_multi_diff
|
||||
tablast
|
||||
vsplit
|
||||
wincmd w
|
||||
else
|
||||
tab split
|
||||
tabmove
|
||||
endif
|
||||
let s:tab_multi_diff = ! s:tab_multi_diff
|
||||
exe 'b ' . buf
|
||||
diffthis
|
||||
tabfirst
|
||||
endfun
|
||||
set mouse=
|
||||
|
||||
filetype plugin indent on
|
||||
syntax on
|
||||
|
||||
" noremap <Up> <Nop>
|
||||
" noremap <Down> <Nop>
|
||||
" noremap <Left> <Nop>
|
||||
" noremap <Right> <Nop>
|
||||
" inoremap <Up> <Nop>
|
||||
" inoremap <Down> <Nop>
|
||||
" inoremap <Left> <Nop>
|
||||
" inoremap <Right> <Nop>
|
||||
|
||||
lua require("config.google")
|
||||
|
@ -203,5 +203,6 @@ bdoctor_modules() {
|
||||
alias bisect=/google/data/ro/teams/tetralight/bin/bisect
|
||||
alias copybara='/google/bin/releases/copybara/public/copybara/copybara'
|
||||
source /etc/bash_completion.d/g4d
|
||||
gcertstatus --quiet || gcert && source /google/bin/releases/gmscore-tools/cli/prod/setup_prod_gms.sh
|
||||
|
||||
complete -D -C /google/data/ro/users/sk/skaushik/www/public-tools/flagpick -o bashdefault -o default
|
||||
|
Reference in New Issue
Block a user