1
0
Fork 0

nvim: fuck window local options

This commit is contained in:
Vladimír Dudr 2023-02-15 01:15:42 +01:00
parent dea718004b
commit 5fda4d6ab4
7 changed files with 183 additions and 54 deletions

View file

@ -55,6 +55,7 @@ local aliases = {
warn = 'orange', warn = 'orange',
info = 'bright_blue', info = 'bright_blue',
hint = 'aqua', hint = 'aqua',
ok = 'green',
} }
for alias, target in pairs(aliases) do for alias, target in pairs(aliases) do
@ -107,6 +108,7 @@ end
---|'warn' ---|'warn'
---|'info' ---|'info'
---|'hint' ---|'hint'
---|'ok'
---|'NONE' ---|'NONE'
--}}} --}}}
-- style type {{{ -- style type {{{

View file

@ -9,12 +9,8 @@ function M.setup()
vim.o.autoindent = true vim.o.autoindent = true
vim.o.autoread = true vim.o.autoread = true
vim.o.completeopt = 'menuone,noinsert,noselect' vim.o.completeopt = 'menuone,noinsert,noselect'
vim.o.cursorline = true
vim.o.expandtab = true vim.o.expandtab = true
vim.o.fileencodings = 'ucs-bom,utf-8,default,windows-1250,cp852' vim.o.fileencodings = 'ucs-bom,utf-8,default,windows-1250,cp852'
vim.o.foldcolumn = 'auto:1'
vim.o.foldenable = true
vim.o.foldmethod = 'marker'
vim.o.foldopen = 'hor,mark,percent,quickfix,search,tag,undo' -- removed block so { and friends don't open fold vim.o.foldopen = 'hor,mark,percent,quickfix,search,tag,undo' -- removed block so { and friends don't open fold
vim.o.hidden = true vim.o.hidden = true
vim.o.ignorecase = true vim.o.ignorecase = true
@ -22,15 +18,12 @@ function M.setup()
vim.o.incsearch = true vim.o.incsearch = true
vim.o.list = false vim.o.list = false
vim.o.mouse = '' vim.o.mouse = ''
vim.o.number = true
vim.o.path = '**' vim.o.path = '**'
vim.o.relativenumber = false
vim.o.ruler = true vim.o.ruler = true
vim.o.scrolloff = 3 vim.o.scrolloff = 3
vim.o.shiftwidth = 4 vim.o.shiftwidth = 4
vim.o.showcmd = true vim.o.showcmd = true
vim.o.sidescrolloff = 5 vim.o.sidescrolloff = 5
vim.o.signcolumn = 'yes'
vim.o.smartcase = true vim.o.smartcase = true
vim.o.smartindent = true vim.o.smartindent = true
vim.o.softtabstop = 4 vim.o.softtabstop = 4
@ -42,12 +35,15 @@ function M.setup()
--vim.o.clipboard = "unnamedplus" --vim.o.clipboard = "unnamedplus"
vim.o.guifont = 'Hack:12h' vim.o.guifont = 'Hack:12h'
local function set_winopts()
vim.o.cursorline = true
vim.o.foldcolumn = 'auto:1'
vim.o.foldenable = true
vim.o.foldmethod = 'marker'
vim.o.number = true
vim.o.signcolumn = 'yes'
vim.o.relativenumber = false
vim.o.list = true vim.o.list = true
vim.o.listchars = 'tab:❮⋯❯,trail:⸬,nbsp:·'
vim.o.grepprg = 'rg --vimgrep --no-ignore --smart-case $*'
vim.o.grepformat = '%f:%l:%c:%m'
vim.o.statusline = '' vim.o.statusline = ''
.. ' %{fnamemodify(getcwd(),":t")}' -- basename of cwd .. ' %{fnamemodify(getcwd(),":t")}' -- basename of cwd
.. '%( │  %{get(b:,"gitsigns_head","")}%)' -- branch .. '%( │  %{get(b:,"gitsigns_head","")}%)' -- branch
@ -56,27 +52,59 @@ function M.setup()
.. '%y ' -- filetype .. '%y ' -- filetype
.. '%-7.(%3.l:%-3.(%c%V%)%) %P' -- ruler .. '%-7.(%3.l:%-3.(%c%V%)%) %P' -- ruler
if vim.fn.has('nvim-0.9') then
vim.o.statuscolumn = '%C%3l %s'
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'qf', 'man', 'help', 'tsplayground', 'checkhealth', 'OverseerList' },
callback = function(args)
local buf = args.buf
local bo = vim.bo[buf]
if bo.filetype == 'help' and bo.buftype ~= 'help' then
return
end end
end
set_winopts()
vim.o.listchars = 'tab:❮⋯❯,trail:⸬,nbsp:·'
vim.o.grepprg = 'rg --vimgrep --no-ignore --smart-case $*'
vim.o.grepformat = '%f:%l:%c:%m'
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter', 'FileType' }, {
pattern = '*',
callback = function(args)
set_winopts()
local buf = args.buf
local buftype = vim.bo[buf].buftype
if buftype == 'nofile' or buftype == 'help' then
vim.o.list = false
vim.bo[buf].buflisted = false vim.bo[buf].buflisted = false
vim.wo.number = false vim.wo.number = false
vim.wo.signcolumn = 'auto' vim.wo.signcolumn = 'auto'
-- vim.wo.foldcolumn = 0
vim.wo.statuscolumn = ''
vim.keymap.set('n', 'q', '<Cmd>:q<CR>', { buffer = buf }) vim.keymap.set('n', 'q', '<Cmd>:q<CR>', { buffer = buf })
if vim.bo[buf].filetype ~= 'qf' then if vim.bo[buf].filetype ~= 'qf' then
vim.wo.statusline = '%Y %f%=%l:%v %P' vim.wo.statusline = '%f'
end
end end
end, end,
}) })
-- vim.api.nvim_create_autocmd('FileType', {
-- pattern = { 'qf', 'man', 'help', 'tsplayground', 'checkhealth', 'OverseerList' },
-- callback = function(args)
-- local buf = args.buf
-- local bo = vim.bo[buf]
-- if bo.filetype == 'help' and bo.buftype ~= 'help' then
-- return
-- end
-- vim.bo[buf].buflisted = false
-- vim.wo.number = false
-- vim.wo.signcolumn = 'auto'
-- vim.keymap.set('n', 'q', '<Cmd>:q<CR>', { buffer = buf })
--
-- if vim.bo[buf].filetype ~= 'qf' then
-- vim.wo.statusline = '%Y %f%=%l:%v %P'
-- end
-- end,
-- })
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, { vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, {
pattern = { 'Trouble' }, pattern = { 'Trouble' },
callback = function(args) callback = function(args)
@ -92,9 +120,6 @@ function M.setup()
end, end,
}) })
if vim.fn.has('nvim-0.9') then
vim.o.statuscolumn = '%C%3l %s'
end
if vim.g.neoray then -- {{{ if vim.g.neoray then -- {{{
vim.cmd.NeoraySet('CursorAnimTime', 0) vim.cmd.NeoraySet('CursorAnimTime', 0)

View file

@ -155,10 +155,13 @@ function M.config()
gr:hl('IndentBlanklineContextChar', 'orange', nil, { 'nocombine' }) gr:hl('IndentBlanklineContextChar', 'orange', nil, { 'nocombine' })
link('DiagnosticSignOk', 'GruvboxGreenSign')
gr:hl('DiagnosticVirtualTextError', 'error', nil, { 'italic', }) gr:hl('DiagnosticVirtualTextError', 'error', nil, { 'italic', })
gr:hl('DiagnosticVirtualTextWarn', 'warn', nil, { 'italic', }) gr:hl('DiagnosticVirtualTextWarn', 'warn', nil, { 'italic', })
gr:hl('DiagnosticVirtualTextInfo', 'info', nil, { 'italic', }) gr:hl('DiagnosticVirtualTextInfo', 'info', nil, { 'italic', })
gr:hl('DiagnosticVirtualTextHint', 'hint', nil, { 'italic', }) gr:hl('DiagnosticVirtualTextHint', 'hint', nil, { 'italic', })
gr:hl('DiagnosticVirtualTextOk', 'ok', nil, { 'italic', })
gr:hl('@attribute', 'aqua') gr:hl('@attribute', 'aqua')

View file

@ -0,0 +1,87 @@
return {
{ 'mfussenegger/nvim-dap',
dependencies = {
'rcarriga/nvim-dap-ui',
},
keys = {
{ '<F2>', function() require('dap').step_over() end },
{ '<F3>', function() require('dap').step_into() end },
{ '<F3>', function() require('dap').step_out() end },
{ '<F5>', function() require('dap').continue({}) end },
{ '<F10>', function() require('dap').toggle_breakpoint() end },
{ '<leader>DD', function() require('dapui').toggle() end },
{ '<leader>DE', function()
vim.ui.input({ prompt = 'DAP Evalulate expression: ' },
function(input)
require('dapui').eval(input)
end)
end, },
},
opts = {
php = { -- {{{
adapter = {
type = 'executable',
command = 'node',
args = { vim.env.HOME .. '/.local/share/nvim/lazy/vscode-php-debug/out/phpDebug.js' },
},
confs = {
{
type = 'php',
request = 'launch',
name = 'Listen for Xdebug',
port = 9000,
},
},
}, -- }}}
},
config = function(_plug, opts)
-- signs - move to colorsheme? {{{
vim.fn.sign_define('DapBreakpoint', {
text = '⦿',
texthl = 'DiagnosticSignError',
linehl = '',
numhl = ''
})
vim.fn.sign_define('DapBreakpointCondition', {
text = '',
texthl = 'DiagnosticSignError',
linehl = '',
numhl = ''
})
vim.fn.sign_define('DapLogPoint', { text = '󱂅', texthl = '', linehl = '', numhl = '' })
vim.fn.sign_define('DapStopped', { text = '', texthl = 'DiagnosticSignOk', linehl = '', numhl = '' })
vim.fn.sign_define('DapBreakpointRejected', { text = '🛑', texthl = '', linehl = '', numhl = '' })
--- }}}
local dap = require('dap')
for lang, opt in pairs(opts) do
dap.configurations[lang] = opt.confs
dap.adapters[lang] = opt.adapter
end
local dapui = require('dapui')
dapui.setup()
dap.listeners.after.event_initialized['dapui_config'] = function()
dapui.open()
end
dap.listeners.before.event_terminated['dapui_config'] = function()
dapui.close()
end
dap.listeners.before.event_exited['dapui_config'] = function()
dapui.close()
end
end,
},
{ 'xdebug/vscode-php-debug',
build = { 'npm install && npm run build' },
config = false,
module = false,
lazy = true,
},
{ 'leoluz/nvim-dap-go',
ft = 'go',
config = true,
},
}

View file

@ -10,6 +10,18 @@ local function formatting_filter(c)
return true return true
end end
local function navic_attach(client, bufnr)
require('nvim-navic').attach(client, bufnr)
vim.wo.winbar = "%{%v:lua.require'nvim-navic'.get_location()%}"
vim.api.nvim_create_autocmd('LspDetach', {
pattern = vim.api.nvim_buf_get_name(bufnr),
once = true,
callback = function ()
vim.cmd.setlocal('winbar<')
end
})
end
local function on_attach(args) -- {{{ local function on_attach(args) -- {{{
-- require "lsp_signature".on_attach() -- require "lsp_signature".on_attach()
-- require'completion'.on_attach() -- require'completion'.on_attach()
@ -19,7 +31,7 @@ local function on_attach(args) -- {{{
local client = vim.lsp.get_client_by_id(args.data.client_id) local client = vim.lsp.get_client_by_id(args.data.client_id)
if (client.server_capabilities.documentSymbolProvider) then if (client.server_capabilities.documentSymbolProvider) then
require('nvim-navic').attach(client, bufnr) navic_attach(client, bufnr)
end end
-- Mappings. -- Mappings.
@ -175,7 +187,7 @@ local function config()
sdk_include_prereleases = true, sdk_include_prereleases = true,
analyze_open_documents_only = true, analyze_open_documents_only = true,
}, -- }}} }, -- }}}
sumneko_lua = { -- {{{ lua_ls = { -- {{{
settings = { settings = {
Lua = { Lua = {
workleader = { workleader = {
@ -247,8 +259,7 @@ local function config()
end end
return { return {
{ { 'neovim/nvim-lspconfig',
'neovim/nvim-lspconfig',
dependencies = { dependencies = {
{ 'j-hui/fidget.nvim', config = true }, { 'j-hui/fidget.nvim', config = true },
{ 'ray-x/lsp_signature.nvim', opts = { hint_prefix = '', floating_window = false, hint_scheme = 'Identifier' } }, { 'ray-x/lsp_signature.nvim', opts = { hint_prefix = '', floating_window = false, hint_scheme = 'Identifier' } },

View file

@ -52,7 +52,7 @@ return {
{ '<leader>xi', '<Cmd>OverseerInfo<CR>', desc = 'Overseer info' }, { '<leader>xi', '<Cmd>OverseerInfo<CR>', desc = 'Overseer info' },
{ '<leader>xa', '<Cmd>OverseerTaskAction<CR>', desc = 'Overseer action' }, { '<leader>xa', '<Cmd>OverseerTaskAction<CR>', desc = 'Overseer action' },
{ '<leader>xr', '<Cmd>OverseerRun<CR>', desc = 'Overseer run' }, { '<leader>xr', '<Cmd>OverseerRun<CR>', desc = 'Overseer run' },
} },
}, },
@ -66,6 +66,7 @@ return {
{ {
'vlada-dudr/vdebug', 'vlada-dudr/vdebug',
lazy = true, lazy = true,
enabled = false,
keys = { keys = {
{ '<F5>', desc = 'Start Vdebug' }, { '<F5>', desc = 'Start Vdebug' },
{ '<F10>', desc = 'Vdebug breakpoint' }, { '<F10>', desc = 'Vdebug breakpoint' },

View file

@ -51,21 +51,21 @@ function M.config()
}) })
-- --
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ '/', '?' }, { -- cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(), -- mapping = cmp.mapping.preset.cmdline(),
sources = { -- sources = {
{ name = 'buffer' }, -- { name = 'buffer' },
}, -- },
}) -- })
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). -- -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', { -- cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(), -- mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ -- sources = cmp.config.sources({
{ name = 'path' }, -- { name = 'path' },
}, { -- }, {
{ name = 'cmdline' }, -- { name = 'cmdline' },
}), -- }),
}) -- })
end end
return M return M