Neovim, color scheme not working on macOS Ventura terminal - neovim

When I run Neovim (NVIM v0.8.0), I was getting the following error.
Error detected while processing /Users/oguzyildirim/.config/nvim/init.lua:
E5113: Error while calling lua chunk: vim/_meta.lua:0: E474: Invalid argument
stack traceback:
[C]: in function 'nvim_set_option_value'
vim/_meta.lua: in function '_set'
vim/_meta.lua: in function '__newindex'
/Users/oguzyildirim/.config/nvim/lua/oguz/core/options.lua:26: in main chunk
[C]: in function 'require'
/Users/oguzyildirim/.config/nvim/init.lua:2: in main chunk
E5422: Conflicting configs: "/Users/oguzyildirim/.config/nvim/init.lua" "/Users/oguzyildirim/.config/nvim/init.vim"
After a while the error message stopped coming. But nightfly color scheme wasn't working.
This is colorscheme.lua file's code,
local status, _ = pcall(vim.cmd, 'colorscheme nightfly')
if not status then
print('Colorscheme not found!')
return
end
This is options.lua file's code
local opt = vim.opt -- for conciseness
-- line numbers
opt.relativenumber = true
opt.number = true
-- tabs & indentation
opt.tabstop = 2
opt.shiftwidth = 2
opt.expandtab = true
opt.autoindent = true
-- line wrapping
opt.wrap = false
-- search settings
opt.ignorecase = true
opt.smartcase = true
-- cursor line
opt.cursorline = true
-- apperance
opt. termguicolors = true
opt.background ="dark"
opt.signcolumn = "yes"
-- backspace
opt.backspace = 'indent,eol,start'
-- clipboard
opt.clipboard:append('unnamedplus')
-- split windows
opt.splitright = true
opt.splitbelow = true
opt.iskeyword:append('-')
This is plugins-setup.lua file's code
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]]
return true
end
return false
end
local packer_bootstrap = ensure_packer()
-- Autocommand that reloads neovim whenever you save this file
vim.cmd([[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerCompile
augroup end
]])
local status, packer = pcall(require, 'packer')
if not status then
return
end
return packer.startup(function(use)
use("wbthomason/packer.nvim")
use("bluz71/vim-nightfly-guicolors") -- oreferred colorscheme
if packer_bootstrap then
require('packer').sync()
end
end)
This is init.lua file's code
require('oguz.plugins-setup')
require('oguz.core.options')
require('oguz.core.keymaps')
require('oguz.core.colorscheme')
I installed neovim for the first time. Then I was making simple config edits to change themes. My expectation was to be able to run the "nightfly" color scheme properly.

I solved my problem. The problem is that native mac terminal doesn't support color scheme. Download another terminal app for that. Like iTerm. I also recommend installing zshrc.

Related

Neovim starting multiple LSP clients for each buffer

I recently realized that my neovim automatically spawns the same language server (in this case, tsserver and tailwindcss) everytime I open a file.
Everything works fine when opening the first file
However, once I opened another file, it starts spawning another lsp client
Here's my nvim config for the lsp.
-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap = true, silent = true }
vim.api.nvim_set_keymap("n", "<space>e", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
vim.api.nvim_set_keymap("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<CR>", opts)
vim.api.nvim_set_keymap("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<CR>", opts)
vim.api.nvim_set_keymap("n", "<space>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
end
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
local rawCapabilitiesWithoutFormatting = vim.lsp.protocol.make_client_capabilities()
rawCapabilitiesWithoutFormatting.textDocument.formatting = false
rawCapabilitiesWithoutFormatting.textDocument.rangeFormatting = false
local capabilitiesWithoutFormatting = require("cmp_nvim_lsp").default_capabilities(rawCapabilitiesWithoutFormatting)
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches, for
-- servers that don't need any special treatment
local servers = {
"bashls",
"clangd",
"cssls",
"eslint",
"gopls",
"html",
"jsonls",
"rust_analyzer",
"svelte",
"tailwindcss",
"vimls",
"volar",
"prismals",
"marksman",
}
for _, lsp in pairs(servers) do
require("lspconfig")[lsp].setup({
on_attach = on_attach,
flags = {
debounce_text_changes = 300,
},
capabilities = capabilities,
})
end
-- setup tsserver manually like a pro
require("lspconfig").tsserver.setup({
on_attach = function(client, bufnr)
client.server_capabilities.document_formatting = false
client.server_capabilities.document_range_formatting = false
on_attach(client, bufnr)
end,
flags = {
debounce_text_changes = 300,
},
capabilities = capabilitiesWithoutFormatting,
settings = {
documentFormatting = false,
},
root_dir = require("lspconfig.util").find_git_ancestor,
})
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
underline = true,
-- This sets the spacing and the prefix, obviously.
virtual_text = {
spacing = 4,
},
signs = true,
update_in_insert = true,
})
It was an issue on nvim-lspconfig's end, however it was fixed on a recent patch. Just pull in the latest version and it should work as expected.

neovim's lsp does not show error messages

i have a neovim config which contains lsp configuration
on my laptop i have neovim 0.7.2 which works perfectly
but on my desktop i have neovim 0.8.0 and lsp still works but does not show error massages.
this is my config
vim.opt.tabstop = 2
vim.cmd([[colorscheme dedsec]])
vim.cmd([[set number]])
vim.cmd([[set noswapfile]])
vim.cmd([[set mouse=a]])
vim.opt.shiftwidth = 2
vim.opt.softtabstop = 2
vim.opt.expandtab = true
require("packer").startup(function(use)
-- use "wbthompson/packer.nvim"
use "vim-airline/vim-airline"
use 'vim-airline/vim-airline-themes'
use 'ryanoasis/vim-devicons'
use 'jpalardy/vim-slime'
use 'shime/vim-livedown'
use 'ap/vim-css-color'
use 'terryma/vim-multiple-cursors'
use 'mattn/emmet-vim'
use 'scrooloose/nerdtree'
use 'mxw/vim-jsx'
-- LSP
use {
'VonHeikemen/lsp-zero.nvim',
requires = {
-- LSP Support
{'neovim/nvim-lspconfig'},
{'williamboman/mason.nvim'},
{'williamboman/mason-lspconfig.nvim'},
-- Autocompletion
{'hrsh7th/nvim-cmp'},
{'hrsh7th/cmp-buffer'},
{'hrsh7th/cmp-path'},
{'saadparwaiz1/cmp_luasnip'},
{'hrsh7th/cmp-nvim-lsp'},
{'hrsh7th/cmp-nvim-lua'},
-- Snippets
{'L3MON4D3/LuaSnip'},
{'rafamadriz/friendly-snippets'},
}
}
end)
vim.cmd([[
let g:airline_powerline_fonts = 1 "Включить поддержку Powerline шрифтов
let g:airline#extensions#keymap#enabled = 0 "Не показывать текущий маппинг
let g:airline_section_z = "\ue0a1:%l/%L Col:%c" "Кастомная графа положения курсора
let g:Powerline_symbols='unicode' "Поддержка unicode
let g:airline#extensions#xkblayout#enabled = 0 "Про это позже расскажу
set guioptions= "Отключаем панели прокрутки в GUI
set showtabline=1 "Отключаем панель табов (окошки FTW)
let g:slime_target = "tmux"
let g:slime_target = "neovim"
nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-b> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
let g:user_emmet_mode='a'
set colorcolumn=109
]])
local lsp = require('lsp-zero')
lsp.preset('recommended')
lsp.nvim_workspace()
lsp.setup()
local servers = { 'pyright', 'tsserver', 'jdtls', 'rust-analyzer', 'clangd', 'sumneko_lua'}
for _, lsp in pairs(servers) do
require('lspconfig')[lsp].setup {
on_attach = on_attach,
flags = {
debounce_text_changes = 150,
}
}
end
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl= hl, numhl = hl })
end
this is how it works on laptop
this is how it works on my desktop
i have tried to install neovim 0.7.2 but it does not help me
i also have tired to update and reinstall plugins but it also does not help
https://github.com/VonHeikemen/lsp-zero.nvim/blob/v1.x/doc/md/lsp.md#diagnostics
simply follow this documentation.
change
virtual_text = false,
to
virtual_text = true,
if you have the same situation try to install williamboman/nvim-lsp-installer. it have halped in my situation

Error occurs when debugging rust program with vscode (windows only)

I am trying to debug the code below with vscode, but an error occurs.
Development environment
Microsoft Windows 10 Home 10.0.19042 Build 19042
rustc 1.49.0 (e1884a8e3 2020-12-29)
Vscode 1.54.3
CodeLLDB v1.6.1
// Cargo.toml
//[dependencies]
//datafusion = "3.0.0"
//arrow = "3.0.0"
//tokio = { version = "0.2", features = ["macros", "blocking", "rt-core", "rt-threaded", "sync"] }
use std::time::{Duration, Instant};
use arrow::util::pretty;
use datafusion::error::Result;
use datafusion::prelude::*;
/// This example demonstrates executing a simple query against an Arrow data source (CSV) and
/// fetching results
#[tokio::main]
async fn main() -> Result<()> {
println!("======== Start Program ========");
let start = Instant::now();
// let res_path = r"/root/workspace/project/hello_arrow/res/sample_01.csv";
// http://insideairbnb.com/get-the-data.html
// listing_id,id,date,reviewer_id,reviewer_name,comments
// Boston, Massachusetts, United States
let res_path = r"D:\workspace\vscode\arrow_rust\res\review.01.csv";
// create local execution context
let mut ctx = ExecutionContext::new();
// register csv file with the execution context
ctx.register_csv("datatable_01", res_path, CsvReadOptions::new())?;
// execute the query
let sql = "SELECT count(id) from datatable_01";
let df = ctx.sql(sql)?;
let results = df.collect().await?;
// print the results
pretty::print_batches(&results)?;
let duration = start.elapsed();
println!("Time elapsed in expensive_function() is: {:?}", duration);
println!("======== End Program ========");
Ok(())
}
Error Code
configuration: {
type: 'lldb',
request: 'launch',
name: 'Debug Window',
program: '${workspaceRoot}/target/debug/arrow_rust.exe',
args: [],
cwd: '${workspaceRoot}',
sourceLanguages: [ 'rust' ],
__configurationTarget: 5,
relativePathBase: 'd:\\workspace\\vscode\\arrow_rust'
}
Listening on port 8541
error: arrow_rust.exe :: Class 'arrow::datatypes::DataType' has a member '__0' of type 'alloc::vec::Vec<arrow::datatypes::Field>' which does not have a complete definition.
Debug adapter exit code=3221225620, signal=null.
The program runs normally. Debugging fine on Linux for the same code.
Is there any other way to debug on Windows?
I have the same problem.
Inspired by the link below, I have solved it.
https://github.com/vadimcn/vscode-lldb/issues/410#issuecomment-786791796
The reason is that I have installed NVIDIA Nsight.
As shown below, the msdia140.dll for Nsight has been loaded by codelldb.
Run PowerShell as administrator. Execute the command below to register the component. Then codelldb works.
regsvr32.exe C:\Users\【user name】\.vscode\extensions\vadimcn.vscode-lldb-1.6.8\lldb\bin\msdia140.dll
Update
For newer versions, the DLL has moved to another folder:
regsvr32.exe C:\Users\[user name]\.vscode\extensions\vadimcn.vscode-lldb-1.8.1\adapter\msdia140.dll

Within a gimp python-fu plug-in can one create/invoke a modal dialog (and/or register a procedure that is ONLY to be added as a temp procedure?)

I am trying to add a procedure to pop-up a modal dialog inside a plug-in.
Its purpose is to query a response at designated steps within the control-flow of the plug-in (not just acquire parameters at its start).
I have tried using gtk - I get a dialog but it is asynchronous - the plugin continues execution. It needs to operate as a synchronous function.
I have tried registering a plugin in order to take advantage of the gimpfu start-up dialogue for same. By itself, it works; it shows up in the procedural db when queried. But I never seem to be able to actually invoke it from within another plug-in - its either an execution error or wrong number of arguments no matter how many permutations I try.
[Reason behind all of this nonsense: I have written a lot of extension Python scripts for PaintShopPro. I have written a App package (with App.Do, App.Constants, Environment and the like that lets me begin to port those scripts to GIMP -- yes it is perverse, and yes sometimes the code just has to be rewritten, but for a lot of what I actual use in the PSP.API it is sufficient.
However, debugging and writing the module rhymes with witch. So. I am trying to add emulation of psp's "SetExecutionMode" (ie interactive). If
set, the intended behavior is that the App.Do() method will "pause" after/before it runs the applicable psp emulation code by popping up a simple message dialog.]
A simple modal dialogue within a gimp python-fu plug-in can be implemented via gtk's Dialog interface, specifically gtk.MessageDialog.
A generic dialog can be created via
queryDialogue = gtk.MessageDialog(None, gtk.DIALOG_DESTROY_WITH_PARENT \
gtk.MESSAGE_QUESTION, \
gtk.BUTTONS_OK_CANCEL, "")
Once the dialog has been shown,
a synchronous response may be obtained from it
queryDialogue.show()
response = queryDialogue.run()
queryDialogue.hide()
The above assumes that the dialog is not created and thence destroyed after each use.
In the use case (mentioned in the question) of a modal dialog to manage single stepping through a pspScript in gimp via an App emulator package, the dialogue message contents need to be customized for each use. [Hence, the "" for the message argument in the Constructor. [more below]]
In addition, the emulator must be able to accept a [cancel] response to 'get out of Dodge' - ie quit the entire plug-in (gracefully). I could not find a gimpfu interface for the latter, (and do not want to kill the app entirely via gimp.exit()). Hence, this is accomplished by raising a custom Exception class [appTerminate] within the App pkg and catching the exception in the outer-most scope of the plugin. When caught, then, the plug-in returns (exits).[App.Do() can not return a value to indicate continue/exit/etc, because the pspScripts are to be included verbatim.]
The following is an abbreviated skeleton of the solution -
a plug-in incorporating (in part) a pspScript
the App.py pkg supplying the environment and App.Do() to support the pspScript
a Map.py pkg supporting how pspScripts use dot-notation for parameters
App.py demonstrates creation, customization and use of a modal dialog - App.doContinue() displays the dialogue illustrating how it can be customized on each use.
App._parse() parses the pspScript (excerpt showing how it determines to start/stop single-step via the dialogue)
App._exec() implements the pspScript commands (excerpt showing how it creates the dialogue, identifies the message widget for later customization, and starts/stops its use)
# App.py (abbreviated)
#
import gimp
import gtk
import Map # see https://stackoverflow.com/questions/2352181/how-to- use-a-dot-to-access-members-of-dictionary
from Map import *
pdb = gimp.pdb
isDialogueAvailable = False
queryDialogue = None
queryMessage = None
Environment = Map({'executionMode' : 1 })
_AutoActionMode = Map({'Match' : 0})
_ExecutionMode = Map({'Default' : 0}, Silent=1, Interactive=2)
Constants = Map({'AutoActionMode' : _AutoActionMode}, ExecutionMode=_ExecutionMode ) # etc...
class appTerminate(Exception): pass
def Do(eNvironment, procedureName, options = {}):
global appTerminate
img = gimp.image_list()[0]
lyr = pdb.gimp_image_get_active_layer(img)
parsed = _parse(img, lyr, procedureName, options)
if eNvironment.executionMode == Constants.ExecutionMode.Interactive:
resp = doContinue(procedureName, parsed.detail)
if resp == -5: # OK
print procedureName # log to stdout
if parsed.valid:
if parsed.isvalid:
_exec(img, lyr, procedureName, options, parsed, eNvironment)
else:
print "invalid args"
else:
print "invalid procedure"
elif resp == -6: # CANCEL
raise appTerminate, "script cancelled"
pass # terminate plugin
else:
print procedureName + " skipped"
pass # skip execution, continue
else:
_exec(img, lyr, procedureName, options, parsed, eNvironment)
return
def doContinue(procedureName, details):
global queryMessage, querySkip, queryDialogue
# - customize the dialog -
if details == "":
msg = "About to execute procedure \n "+procedureName+ "\n\nContinue?"
else:
msg = "About to execute procedure \n "+procedureName+ "\n\nDetails - \n" + details +"\n\nContinue?"
queryMessage.set_text(msg)
queryDialogue.show()
resp = queryDialogue.run() # get modal response
queryDialogue.hide()
return resp
def _parse(img, lyr, procedureName, options):
# validate and interpret App.Do options' semantics vz gimp
if procedureName == "Selection":
isValid=True
# ...
# parsed = Map({'valid' : True}, isvalid=True, start=Start, width=Width, height=Height, channelOP=ChannelOP ...
# /Selection
# ...
elif procedureName == "SetExecutionMode":
generalOptions = options['GeneralSettings']
newMode = generalOptions['ExecutionMode']
if newMode == Constants.ExecutionMode.Interactive:
msg = "set mode interactive/single-step"
else:
msg = "set mode silent/run"
parsed = Map({'valid' : True}, isvalid=True, detail=msg, mode=newMode)
# /SetExecutionMode
else:
parsed = Map({'valid' : False})
return parsed
def _exec(img, lyr, procedureName, options, o, eNvironment):
global isDialogueAvailable, queryMessage, queryDialogue
#
try:
# -------------------------------------------------------------------------------------------------------------------
if procedureName == "Selection":
# pdb.gimp_rect_select(img, o.start[0], o.start[1], o.width, o.height, o.channelOP, ...
# /Selection
# ...
elif procedureName == "SetExecutionMode":
generalOptions = options['GeneralSettings']
eNvironment.executionMode = generalOptions['ExecutionMode']
if eNvironment.executionMode == Constants.ExecutionMode.Interactive:
if isDialogueAvailable:
queryDialogue.destroy() # then clean-up and refresh
isDialogueAvailable = True
queryDialogue = gtk.MessageDialog(None, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_QUESTION, gtk.BUTTONS_OK_CANCEL, "")
queryDialogue.set_title("psp/APP.Do Emulator")
queryDialogue.set_size_request(450, 180)
aqdContent = queryDialogue.children()[0]
aqdHeader = aqdContent.children()[0]
aqdMsgBox = aqdHeader.children()[1]
aqdMessage = aqdMsgBox.children()[0]
queryMessage = aqdMessage
else:
if isDialogueAvailable:
queryDialogue.destroy()
isDialogueAvailable = False
# /SetExecutionMode
else: # should not get here (should have been screened by parse)
raise AssertionError, "unimplemented PSP procedure: " + procedureName
except:
raise AssertionError, "App.Do("+procedureName+") generated an exception:\n" + sys.exc_info()
return
A skeleton of the plug-in itself. This illustrates incorporating a pspScript which includes a request for single-step/interactive execution mode, and thus the dialogues. It catches the terminate exception raised via the dialogue, and then terminates.
def generateWebImageSet(dasImage, dasLayer, title, mode):
try:
img = dasImage.duplicate()
# ...
bkg = img.layers[-1]
frameWidth = 52
start = bkg.offsets
end = (start[0]+bkg.width, start[1]+frameWidth)
# pspScript: (snippet included verbatim)
# SetExecutionMode / begin interactive single-step through pspScript
App.Do( Environment, 'SetExecutionMode', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Interactive
}
})
# Selection
App.Do( Environment, 'Selection', {
'General' : {
'Mode' : 'Replace',
'Antialias' : False,
'Feather' : 0
},
'Start': start,
'End': end
})
# Promote
App.Do( Environment, 'SelectPromote' )
# und_so_weiter ...
except App.appTerminate:
raise AssertionError, "script cancelled"
# /generateWebImageSet
# _generateFloatingCanvasSetWeb.register -----------------------------------------
#
def generateFloatingCanvasSetWeb(dasImage, dasLayer, title):
mode="FCSW"
generateWebImageSet(dasImage, dasLayer, title, mode)
register(
"generateFloatingCanvasSetWeb",
"Generate Floating- Frame GW Canvas Image Set for Web Page",
"Generate Floating- Frame GW Canvas Image Set for Web Page",
"C G",
"C G",
"2019",
"<Image>/Image/Generate Web Imagesets/Floating-Frame Gallery-Wrapped Canvas Imageset...",
"*",
[
( PF_STRING, "title", "title", "")
],
[],
generateFloatingCanvasSetWeb)
main()
I realize that this may seem like a lot of work just to be able to include some pspScripts in a gimp plug-in, and to be able to single-step through the emulation. But we are talking about maybe 10K lines of scripts (and multiple scripts).
However, if any of this helps anyone else with dialogues inside plug-ins, etc., so much the better.

TYPO3 Exception thrown but not shown in FE/BE

How can I show Exception in Debug Mode (Install -> Presets) in FE?
I'm using LTS 7.6.29
My TYPO3 configuration is
1 BE/debug
1 FE/debug
* SYS/devIPmask
1 SYS/displayErrors
file SYS/enableDeprecationLog
1 SYS/sqlDebug
0 SYS/systemLogLevel
1 SYS/clearCacheSystem
config.contentObjectExceptionHandler = 0
PHP.ini
error_reporting = E_ALL
display_errors = On
display_startup_errors = On
log_errors = On
You've to use this setting in TypoScript to show Error-Messages in Frontend:
config {
contentObjectExceptionHandler = 0
}
In the file LocalConfiguration.php you've to set following values, it's explained how to set them by using the installtool:
SYS
Try, to disable the TYPO3 exception handlers in general:
System > Install > "All Configuration"
Filter by (search-field): exceptionhandler
Set empty values:
[SYS][productionExceptionHandler] =
[SYS][debugExceptionHandler] =
[SYS][errorHandler] =
After debugging set exception handling to the default values:
[SYS][productionExceptionHandler] =
TYPO3\CMS\Core\Error\ProductionExceptionHandler
[SYS][debugExceptionHandler] = TYPO3\CMS\Core\Error\DebugExceptionHandler
[SYS][errorHandler] = TYPO3\CMS\Core\Error\ErrorHandler
After changing the settings you've to delete the file typo3temp/autoload/autoload_classmap.php that the changed settings are applied to the system. The file will be new created but with a bit different content.
You can delete the file too in installtool by deleting the autoload-information.
Most is explained here: https://docs.typo3.org/typo3cms/extensions/launch/Administrators/03_Errorhandling/09_OopsAnErrorOccured/Index.html