1
0

General changes + vim changes

This commit is contained in:
2024-10-10 21:17:54 +02:00
parent adc26f9860
commit 6790f75c8a
20 changed files with 273 additions and 138 deletions

View File

@@ -25,3 +25,39 @@ vim.keymap.set('n', '<leader>l', ':e#<CR>')
vim.keymap.set('n', '<leader>i', 'cc')
-- peek
vim.keymap.set('n', '<leader>p', vim.lsp.buf.hover)
-- Scratch pad
vim.keymap.set(
'n',
'<leader>s',
':bo vs<CR>:enew<CR>:setlocal noswapfile<CR>:setlocal bufhidden=hide<CR>:setlocal buftype=nofile<CR>:set filetype=markdown<CR>:set syntax=markdown<CR>'
)
-- Help
vim.cmd.cnoreabbrev('h vert h')
-- Windows
vim.keymap.set('n', '<leader>k', function()
if vim.bo.modified then
if Confirm('Buffer has unsaved changes; write?') then
vim.cmd.write()
vim.cmd.bdelete()
else
vim.cmd('bd!')
end
else
vim.cmd.bdelete()
end
end)
-- Comp mode
vim.keymap.set('n', '<leader>s', function() -- s: start
local command = Input('Enter compilation command > ', vim.g.last_compile_command)
if command then
vim.g.last_compile_command = command
vim.cmd.Compile(command)
end
end)
vim.keymap.set('n', '<leader>E', ':NextError<CR>')
vim.keymap.set('n', '<leader>S', ':Recompile<CR>')

View File

@@ -0,0 +1,24 @@
if not vim.g.neovide then
return
end
vim.o.guifont = 'Jetbrains Mono:h17'
vim.g.neovide_underline_stroke_scale = 2.0
vim.g.neovide_theme = 'dark'
vim.g.neovide_refresh_rate_idle = 10
vim.g.neovide_transparency = 0.6
-- Scroll
vim.g.neovide_scroll_animation_length = 0.1
vim.g.neovide_scroll_animation_far_lines = 50
-- Cursor
vim.g.neovide_cursor_animation_length = 0.03
vim.g.neovide_cursor_trail_size = 0.5
vim.g.neovide_cursor_smooth_blink = true
vim.cmd.set('guicursor=i-v-c:blinkwait400-blinkoff350-blinkon250,i-ci-ve:ver25,r-cr:hor20,o:hor20')
-- Pasting
vim.keymap.set('i', '<SC-v>', '<C-r>+')
vim.keymap.set('n', '<SC-v>', '"+p')

View File

@@ -7,6 +7,8 @@ vim.opt.shiftwidth = 4
-- Line numbers
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.cursorline = true
vim.opt.cursorlineopt = 'number'
-- Folding
vim.opt.foldlevelstart = 99
@@ -19,3 +21,20 @@ vim.g.terminal_emulator = 'kitty'
-- LSP
vim.lsp.inlay_hint.enable()
-- Splitting
-- vim.cmd.set('splitbelow')
-- vim.cmd.set('splitright')
vim.opt.splitright = true
vim.opt.splitbelow = true
-- Make text readable
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
pattern = { '*.md', '*.typ' },
command = 'setlocal linebreak',
})
vim.api.nvim_create_autocmd('FileType', {
pattern = 'help',
command = 'setlocal linebreak',
})

View File

@@ -0,0 +1,53 @@
function Ask(msg)
vim.cmd.echohl('Question')
vim.cmd.echo('"' .. msg .. '"')
vim.cmd.echohl()
end
function Confirm(msg)
Ask(msg .. ' [Y/n] ')
local answer = vim.fn.getchar()
return answer ~= 110 and answer ~= 27 and answer ~= 37 -- 'n', <ESC>, <SPACE>
end
function Input(prompt, last)
local buffer = ''
while true do
vim.cmd('redraw | echo')
vim.api.nvim_echo({
{ prompt, 'Question' },
last and { last, 'Visual' } or { buffer, 'Normal' },
}, false, {})
local character = vim.fn.getchar()
if pcall(function(char)
if vim.fn.keytrans(char) ~= '<BS>' then
error()
end
end, character) then
last = nil
buffer = vim.fn.slice(buffer, 0, -1)
elseif character == 27 then
vim.cmd('redraw | echo')
return nil
elseif character == 13 then
return last or buffer
elseif
(character == 32 or pcall(function(char)
if vim.fn.keytrans(char) ~= '<Right>' then
error()
end
end, character)) and last
then
buffer = last
if character == 32 then
buffer = buffer .. ' '
end
last = nil
else
last = nil
buffer = buffer .. vim.fn.nr2char(character)
end
end
end

View File

@@ -114,31 +114,13 @@ cmp.setup({
return kind
end,
-- format = function(entry, vim_item)
-- -- Kind icons
-- vim_item.kind = string.format('%s %s ', cmp_kind_icons[vim_item.kind], vim_item.kind)
--
-- return vim_item
-- end,
-- format = function(entry, item)
-- local menu_icon = {
-- nvim_lsp = 'λ',
-- luasnip = '⋗',
-- buffer = 'Ω',
-- path = '🖫',
-- }
-- item.menu = menu_icon[entry.source.name]
-- return item
-- end
},
})
-- #region Highlight groups
-- Customization for Pmenu
vim.api.nvim_set_hl(0, 'PmenuSel', { bg = '#282C34', fg = 'NONE' })
vim.api.nvim_set_hl(0, 'Pmenu', { fg = '#C5CDD9', bg = '#22252A' })
@@ -151,9 +133,9 @@ vim.api.nvim_set_hl(0, 'CmpItemKindField', { fg = '#EED8DA', bg = '#B5585F' })
vim.api.nvim_set_hl(0, 'CmpItemKindProperty', { fg = '#EED8DA', bg = '#B5585F' })
vim.api.nvim_set_hl(0, 'CmpItemKindEvent', { fg = '#EED8DA', bg = '#B5585F' })
vim.api.nvim_set_hl(0, 'CmpItemKindText', { fg = '#e2f3c9', bg = '#94c549' })
vim.api.nvim_set_hl(0, 'CmpItemKindEnum', { fg = '#e2f3c9', bg = '#94c549' })
vim.api.nvim_set_hl(0, 'CmpItemKindKeyword', { fg = '#e2f3c9', bg = '#94c549' })
vim.api.nvim_set_hl(0, 'CmpItemKindText', { fg = '#C3E88D', bg = '#9FBD73' })
vim.api.nvim_set_hl(0, 'CmpItemKindEnum', { fg = '#C3E88D', bg = '#9FBD73' })
vim.api.nvim_set_hl(0, 'CmpItemKindKeyword', { fg = '#C3E88D', bg = '#9FBD73' })
vim.api.nvim_set_hl(0, 'CmpItemKindConstant', { fg = '#FFE082', bg = '#D4BB6C' })
vim.api.nvim_set_hl(0, 'CmpItemKindConstructor', { fg = '#FFE082', bg = '#D4BB6C' })
@@ -168,9 +150,9 @@ vim.api.nvim_set_hl(0, 'CmpItemKindOperator', { fg = '#EADFF0', bg = '#A377BF' }
vim.api.nvim_set_hl(0, 'CmpItemKindVariable', { fg = '#C5CDD9', bg = '#7E8294' })
vim.api.nvim_set_hl(0, 'CmpItemKindFile', { fg = '#C5CDD9', bg = '#7E8294' })
vim.api.nvim_set_hl(0, 'CmpItemKindUnit', { fg = '#F5EBD9', bg = '#D29a32' })
vim.api.nvim_set_hl(0, 'CmpItemKindSnippet', { fg = '#F5EBD9', bg = '#D29a32' })
vim.api.nvim_set_hl(0, 'CmpItemKindFolder', { fg = '#F5EBD9', bg = '#D29a32' })
vim.api.nvim_set_hl(0, 'CmpItemKindUnit', { fg = '#F5EBD9', bg = '#D4A959' })
vim.api.nvim_set_hl(0, 'CmpItemKindSnippet', { fg = '#F5EBD9', bg = '#D4A959' })
vim.api.nvim_set_hl(0, 'CmpItemKindFolder', { fg = '#F5EBD9', bg = '#D4A959' })
vim.api.nvim_set_hl(0, 'CmpItemKindMethod', { fg = '#DDE5F5', bg = '#6C8ED4' })
vim.api.nvim_set_hl(0, 'CmpItemKindValue', { fg = '#DDE5F5', bg = '#6C8ED4' })

View File

@@ -0,0 +1,23 @@
return {
{
'ej-shafran/compile-mode.nvim',
dependencies = {
'nvim-lua/plenary.nvim',
'm00qek/baleia.nvim',
},
config = function()
vim.api.nvim_set_hl(0, 'CompileModeInfo', { link = 'DiagnosticInfo' })
vim.api.nvim_set_hl(0, 'CompileModeWarning', { link = 'DiagnosticWarning' })
vim.api.nvim_set_hl(0, 'CompileModeError', { link = 'DiagnosticError' })
vim.api.nvim_set_hl(0, 'CompileModeCommandOutput', { link = 'Statement' })
vim.api.nvim_set_hl(0, 'CompileModeMessage', { link = 'SpellCap' })
vim.api.nvim_set_hl(0, 'CompileModeMessageRow', { link = 'CursorLineNr' })
vim.api.nvim_set_hl(0, 'CompileModeMessageCol', { link = 'CursorLineNr' })
vim.g.compile_mode = {
baleria_setup = true,
}
end,
},
}

View File

@@ -1,13 +1,10 @@
return {
{
'loctvl842/monokai-pro.nvim',
-- lazy = true,
'blazkowolf/gruber-darker.nvim',
priority = 999,
config = function()
require('monokai-pro').setup({
filter = 'spectrum',
})
vim.cmd.colorscheme('monokai-pro')
-- require('gruber-darker').setup()
vim.cmd.colorscheme('gruber-darker')
end,
},
}