First of all, I'm a temporary worker. Therefore, the sales staff will be present at the time of the interview with the dispatched company. Since the sales person ignores my opinion and proceeds without permission, the dispatch destination may be decided regardless of the situation. Since I became a temporary worker, I have abandoned humans, but I would like you to forgive me for a moment.
With that said, the next may be a Java language project. That means I had to re-learn the Java language. However, I thought I wouldn't use books related to the Java language, so I left them at my parents' house. I couldn't help it, so I decided to buy more from the first school book. How many books and how many kinds of elementary books should I buy ... I'm planning to buy a Kindle book if possible, but it's hard to see, so it's definitely a paper book. There will be no good measures.
If you're programming for beginners, you definitely don't need a big IDE. If I have time to build such an environment, I would like to devote even a little time to study. How is it? Because I couldn't master Vim, I still couldn't build it like an IDE. Taking this opportunity, I would like to introduce Language Server Protocol (abbreviation: LSP).
I think it's a function that completes the input process with auto-completion. With that in mind, I decided to introduce it.
It's a hassle to prepare an IDE environment, so I'd like to build an environment just by slightly modifying the already installed Vim. Therefore, I don't want to be difficult or time consuming. So, I decided to use mattn's Plug-in to reduce installation cost.
Since it is easy to do, I decided to proceed as explained by Mr. mattn.
Plugin management uses minpac.
I thought it would be easy to introduce, for the time being, whether one line would be enough or two lines would be needed.
vimrc
call minpac#add('prabirshrestha/vim-lsp')
call minpac#add('mattn/vim-lsp-settings')
Then, on the ex command line,
command
call minpac#update()
Type in. By doing so, the plugin will be introduced. This alone makes it very convenient.
You also need to write to vimrc.
vimrc
"Ability to display errors in real time as files change
let g:lsp_diagnostics_enabled = 1
let g:lsp_diagnostics_echo_cursor = 1
"Setting to automatically display the input completion pop-up
let g:asyncomplete_auto_popup = 1
let g:asyncomplete_auto_completeopt = 1
"Delay until pop-up is displayed
let g:asyncomplete_popup_delay = 200
"Setting to enable textEdit, which is a specification of LSP
let g:lsp_text_edit_enabled = 1
let g:lsp_signs_enabled = 1
let g:lsp_diagnostics_echo_cursor = 1
mattn seems to have [split] the config file (https://mattn.kaoriya.net/software/vim/20191231001537.htm), but I haven't. Therefore, I am writing to vimrc, but I think that there is no problem.
vim-lsp seems to be the mother ship, and if you don't include it, you will get an error.
error
Error detected while processing User Autocommands for "lsp_setup":
E117: Unknown function: lsp#register_server
I got an error because I proceeded with the work without installing the plug-in of the mother ship.
error
BufRead Autocommands for "*.java"..FileType Autocommands for "java"..function <SNR>8_vim_lsp_load_or_suggest[105]..
User Autocommands for "lsp_setup"An error was detected during the processing of:
E117:Unknown function: lsp#register_server
Make sure to read the explanation properly.
I'm getting an error in my plugin management plugin, which seems to have already been fixed (https://github.com/k-takata/minpac/issues/1).
Open a file with a * .java extension. And
Ex command
LspInstallServer
Since the file is installed according to the programming file, you can press Yes
and wait until the installation is completed.
Completed.
Personally, the character code is strange ... but I'll review it at another time. It should have been UTF-8, but ...
I'm not sure, but it seems that some programming files cannot be installed.
Open a C ++ language file
I obediently followed it because it could be introduced.
Of course yes.
However, the installation failed. This seems to be because the required command was not found. Therefore, there may be a problem with my environment, but now I only need to prepare the Java environment, so I postpone it.
Strange. Auto-completion doesn't work at all.
Popup is not displayed at all.
Strange.
For mattn's settings,
vimrc
if empty(globpath(&rtp, 'autoload/lsp.vim'))
・
・
・
function! s:on_lsp_buffer_enabled() abort
・
・
・
augroup lsp_install
・
・
・
Was written, but is this there? By describing this, the configuration file was destroyed ...
I needed a separate plug-in.
asyncomplete.vim The description is in English, so I didn't think it was the required plugin.
vimrc
"Autocomplete pop-up menu display
call minpac#add('prabirshrestha/asyncomplete.vim')
"Autocomplete source
call minpac#add('prabirshrestha/asyncomplete-lsp.vim')
It seems that these two types are needed.
It's a little uncomfortable with an unintended pop-up display. In this example, I would like to enter "System", but when ** S ** is entered, "Saf ~ Nanchara" is automatically entered. Unreasonable inconvenience. What I want to do is, when I enter "S", nothing is entered and the candidates are displayed in a pop-up. I'm in trouble.
asyncomplete.vim As for the display method, nvim seems to be better. I will not change the main body now.
Although I have the above complaints, I will say that I have set it for the time being. It's still a long way from studying the Java language with just vim itself, but this article ends. Eventually, I want to be able to execute and debug.
that's all.
Recommended Posts