Cannot use auto-completion function in coc.nvim - configuration

Whenever I enter a certain auto-completion suggestions from coc.nvim, it just flashes the suggestion and removes it entirely and it throws an error 'coc.nvim: command not found'. The suggestion tab shows normally and acts normally.
This bug always happens in a gdscript file, all other files work as intended.
I can't find a fix for this, maybe its the language server or the coc configuration file.

Try adding this to your init.vim file.
inoremap complete_info().selected != -1 ?
\ &filetype == "gdscript3" ? (coc#expandable() ? "<C-y>" : "<C-y>a") : "<C-y>"
\ : "<C-g>u<CR>"

Related

How to use command to switch to Terminal-Normal mode?

I would like to make a key mapping which could move to terminal window and switch to Terminal-Normal mode, and perform the opposite action again to look over the long message.
map <F4> call Toggle_Terminal_Mode()<cr>
function Toggle_Terminal_Mode()
if &buftype ==""
move to terminal-window
switch terminal-normal mode " ?????
do blah blah blah....
elseif &buftype=="terminal" && mode()=="n"
swich terminal-mode
move back to edited buffer window
endif
endfunc
I know I can use <C-w>N or <C-\><C-n> to switch to Terminal-Normal mode, but I want to use command instead in function so as to do other thing.
And I try
:execute "normal \<C-w>N" doesn't work,
and <C-\><C-N> either.
:call term_sendkey(..) , does't work.
How to use command to switch to terminal-Normal mode ?
Finally, I try the <expr> to solve the conditional requirement.
nnoremap <expr><F3> &bt=="" ? "<C-w>j<C-\><C-n>z100<CR>H" : "z10<cr>i" . "<C-_>k"
If current buffer type is "" (null), it will jump down to terminal window(default),
go to Normal mode, and resize line height to max size(supposed 100).To look the long message in terminal.
If current buffer type is "terminal", it will restore to 10 line height, go to terminal mode , and go back to the up window. To continue editing the code window.
But I am still finding the method how to change terminal mode in command (not key mapping method).

Snort configuration dead end

I'm in a dead end at the configuration of snort.
In theory a simple problem.
I created a test rule to check if snort runs properly.
Location:\etc\snort\rules\local.rules
Content:
alert icmp any any -> $HOME_NET any (msg:"ICMP on fire"; sid:10000001; rev:001;)
Then I ran on terminal :
sudo snort -T -i enp0s3 -c /etc/snort/snort.conf
Message I receive at the end of the initialization:
"Snort successfully validated the configuration!"
"Snort exiting"
But scrolling up I'm seeing:
Initializing rule chains...
0 Snort rules read
0 detection rules
0 decoder rules
0 preprocessor rules
0 Option Chains linked into 0 Chain Headers
No rules at all!
location is correct in conf file under
/etc/snort/snort.conf
var RULE_PATH /etc/snort/rules
Snort 2.9.17 Build 199
Ubuntu 20.04
Any ideas?Thnnks in advance!
I would recommend supplying the rule path when you execute Snort using the "--rule-path" flag.
The --rule-path flag is not available and not recognized.
As far I understand this variable is just that, a variable that's not used anywhere in the configuration file.
The only way/workaround that I found was include the rule files for ex.
In the snort.conf appending this.
.
.
.
.
include c:\local.rules
Besides that, someone found a way to match content in answer/response?
I mean, let suppose that I want to check if the server has answer with a known content, for ex: success. I've tried with bidirectional operator <> and flow:to_client but nothing has worked.

No auto-complete on HTML and CSS files in VIM (YouCompleteMe)

For some reason, I get no autocomplete on html and css files. All works well with other languages, for example JS, Ruby or Python.
I've spent close to 2h today trying to fix it but to no avail. I use Vundle and YouCompleteMe to do all of this. You can have a look at my .vimrc file here https://gist.github.com/comatory/73aacac1b0249b8c1c55.
I'm on OS X 10.10.5 and my Vim version is 7.4 (installed via Homebrew). I also use Macvim but it doesn't matter, it doesn't work in either of them.
Check the value of the paste setting
:verbose set paste?
will show you the current value for this buffer as well as which plugin set it last.
In my experience, completion doesn't happen if paste is set. Disable with
:set nopaste
Maybe it is in your filepath blacklist as in default.
Quote from: https://github.com/ycm-core/YouCompleteMe/
The g:ycm_filepath_blacklist option
This option controls for which Vim filetypes (see :h filetype) should filepath completion be disabled. The option value should be a Vim dictionary with keys being filetype strings (like python, cpp, etc.) and values being unimportant (the dictionary is used like a hash set, meaning that only the keys matter).
let g:ycm_filepath_blacklist = {'*': 1}
The * key is special and matches all filetypes. Use this key if you want to completely disable filepath completion:
You can get the filetype of the current file in Vim with :set ft?.
Default: [see next line]
let g:ycm_filepath_blacklist = {
\ 'html': 1,
\ 'jsx': 1,
\ 'xml': 1,
\}
I would suggest you use NeoComplete. I tried YouCompleteMe on Vim8, but doesn't work for some reason. NeoComplete does the job for me.
After installing NeoComplete just add, let g:neocomplete#enable_at_startup = 1 to your .vimrrc

Why consecutive event jsons fall on the same line in some packages in githubarchive?

In http://www.githubarchive.org/ that Ilya Grigorik has provided ,I found that in many gz files , some consecutive events are logged to same file .
for example in 2011-03-15-21.json.gz
To get the above do :
wget http://data.githubarchive.org/2011-03-15-21.json.gz
In this gz for example if you search for id 1484832 , you can find that the 2 consecutive events(jsons) are in same line
see
http://codebeautify.org/jsonviewer/2cb891
the two jsons in same line is a combination of
http://codebeautify.org/jsonviewer/c7e18e
and
http://codebeautify.org/jsonviewer/945d56
.
What is the impact ?
when I was loading each line and loading it with python's(why python ? because I felt python is comfortable in dealing with jsons) json.loads it said it was invalid as it was a combination of two jsons .
Question :
1) How did you solve these kind of bugs when you processed that github archive data ?
2) I already have the data in my local . so how can I overcome this problem . Shall I write code specific to this case to overcome ?
the code i wrote was like
jsonlist = line.split('}{')
json.loads(jsonlist[0] + '}', "ISO-8859-1") # load and navigate through this json
json.loads('{' + jsonlist[1], "ISO-8859-1") # load and navigate through this json
I got the solution here
1) How did you solve these kind of bugs when you processed that github archive data ?
https://github.com/vadasg/githubarchive-parser/blob/master/src/FixGitHubArchiveDelimiters.rb
. This script removes the problems of two or more events appearing on the same line .
so now after running this script the jsons appear in different lines .
2) I already have the data in my local . so how can I overcome this problem . Shall I write code specific to this case to overcome ? the code i wrote was like
This script removes the necessity to write the code I mentioned above .
Note :
Related issues found on the github archive project in github
https://github.com/igrigorik/githubarchive.org/issues/53
https://github.com/igrigorik/githubarchive.org/issues/17
WARNING :
When I was running this script I got an error related to the encoding used . Because by default the Yajl::Parser.parse(jsonInputFile)
line checks if characters it parses adheres to UTF-8 encoding ,if not it will throw errors .
As github data also contains non UTF-8 characters , this error will be thrown in our case too. So to bypass that problem(or may be a fix) I put it as
Yajl::Parser.parse(jsonInputFile, :check_utf8 => false)
for doubts refer docs: http://rdoc.info/github/brianmario/yajl-ruby/Yajl/Parser.parse

sorting html in shell script

I have a file with an html code inside it
Is there a way to sort the content by names? such that the file is now sorted like:
Thanks :)
Yes, simply run this command :
sort -t '>' -k 3 filename
I think you have an error in your wanted output : Chan should be before deLtorro.
By the way, can you tell us what are you trying to achieve finally ? Maybe that's not the better way.