chore: minor updates

This commit is contained in:
winston 2022-11-15 20:30:50 +01:00
parent 243576ec54
commit 4aeffd1db8
Signed by: winston
GPG key ID: 3786770EDBC2B481
4 changed files with 49 additions and 8 deletions

View file

@ -16,12 +16,16 @@ set NERDTree
set ReplaceWithRegister
set surround
set textobj-entire
" which-key, yay
set which-key
""" Common settings ----------------------------------------------------------
" '_' is a word separator
set iskeyword-=_
set relativenumber
set number
set showcmd
set showmode
" scroll offset
set scrolloff=5
set sidescrolloff=5
@ -32,14 +36,14 @@ map Q gq
set ideamarks
set ideajoin
set ideastatusicon=gray
set clipboard+=unnamed
""" Mappings -----------------------------------------------------------------
" IDEA binds
map <leader>a <Action>(Annotate)
map <leader>b <Action>(ToggleLineBreakpoint)
map <leader>h <Action>(Vcs.ShowTabbedFileHistory)
map <leader>r <Action>(RenameElement)
map <leader>z <Action>(ToggleDistractionFreeMode)
map <leader>rn <Action>(RenameElement)
" plugin binds
map <C-N> :NERDTreeToggle<CR>
@ -58,5 +62,23 @@ sethandler <C-D> a:vim
sethandler <C-U> a:vim
sethandler <C-R> n:ide
map <a-<> <Action>(PreviousTab)
map <a->> <Action>(NextTab)
map <A-<> <Action>(PreviousTab)
map <A->> <Action>(NextTab)
" Zen mode
map <leader>zz <Action>(ToggleZenMode)
" File navigation
map <leader>ff <Action>(GotoFile)
map <leader>fg <Action>(FindInPath)
map <leader>fl <Action>(RecentLocations)
map <leader>fs <Action>(NewScratchFile)
map [d <Action>(GotoPreviousError)
map ]d <Action>(GotoNextError)
map [c <Action>VcsShowPrevChangeMarker
map [c <Action>VcsShowNextChangeMarker
" show hoverdoc
map H <Action>(ShowErrorDescription)

View file

@ -52,8 +52,8 @@ Map("n", "<leader>gd", ":Gvdiff!<CR>")
Map("n", "gdh", ":diffget //2<CR>")
Map("n", "gdl", ":diffget //3<CR>")
-- clipboard
Map("n", "<leader>p", '"+p')
Map("n", "<leader>y", '"+y')
Map({ "n", "v" }, "<leader>p", '"+p')
Map({ "n", "v" }, "<leader>y", '"+y')
-- escape :terminal easier
vim.cmd([[tnoremap <Esc> <C-\><C-n>]])
@ -81,3 +81,18 @@ vim.api.nvim_create_autocmd("TextYankPost", {
end,
desc = "Highlight yanked text",
})
vim.cmd([[
augroup toggleRelativeLineNumbers
autocmd!
autocmd InsertEnter,BufLeave,WinLeave,FocusLost * nested
\ if &l:number && empty(&buftype) |
\ setlocal norelativenumber |
\ endif
autocmd InsertLeave,BufEnter,WinEnter,FocusGained * nested
\ if &l:number && empty(&buftype) |
\ setlocal relativenumber |
\ endif
augroup END
]])

View file

@ -20,6 +20,7 @@ if not present or not cmp then
end
local has_words_before = function()
---@diagnostic disable-next-line: deprecated
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0
and vim.api
@ -344,7 +345,7 @@ null.setup({
null.builtins.formatting.stylua,
null.builtins.formatting.stylua,
null.builtins.formatting.deno_fmt,
null.builtins.formatting.prettier,
null.builtins.formatting.prettierd,
},
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then

View file

@ -200,7 +200,7 @@ custom.tab_bar.new_tab.bg_color = "#080808"
local darkTheme = "OLEDppuccin"
local lightTheme = "Catppuccin Latte"
local function scheme_for_appearance(appearance)
local function update_nvim(appearance)
local f = io.popen("nvr --serverlist")
if f ~= nil and f:lines() ~= nil then
local theme = appearance:find("Dark") and "dark" or "light"
@ -208,10 +208,13 @@ local function scheme_for_appearance(appearance)
io.popen("nvr --servername " .. name .. ' -c "set background=' .. theme .. '"')
end
end
end
local function scheme_for_appearance(appearance)
if string.match(wezterm.target_triple, "linux") then
return darkTheme
end
update_nvim(appearance)
if appearance:find("Dark") then
return darkTheme
else