Add a bunch more plugins and configurations
- lualine - bufferline - nvim-jdtls
This commit is contained in:
parent
dceb69cf01
commit
8adb8243a0
10 changed files with 239 additions and 158 deletions
|
@ -33,6 +33,9 @@ dotfiles:
|
||||||
- nvim-packer-install
|
- nvim-packer-install
|
||||||
dst: ~/.config/nvim/lua
|
dst: ~/.config/nvim/lua
|
||||||
src: .config/nvim/lua
|
src: .config/nvim/lua
|
||||||
|
d_nvim_scripts:
|
||||||
|
dst: ~/.config/nvim/scripts
|
||||||
|
src: .config/nvim/scripts
|
||||||
f_user-dirs.dirs:
|
f_user-dirs.dirs:
|
||||||
dst: ~/.config/user-dirs.dirs
|
dst: ~/.config/user-dirs.dirs
|
||||||
src: .config/user-dirs.dirs
|
src: .config/user-dirs.dirs
|
||||||
|
@ -162,7 +165,7 @@ dotfiles:
|
||||||
f_gpg-agent.conf:
|
f_gpg-agent.conf:
|
||||||
src: .gnupg/gpg-agent.conf
|
src: .gnupg/gpg-agent.conf
|
||||||
dst: ~/.gnupg/gpg-agent.conf
|
dst: ~/.gnupg/gpg-agent.conf
|
||||||
chmod: '600'
|
chmod: "600"
|
||||||
f_gpg.conf:
|
f_gpg.conf:
|
||||||
src: .gnupg/gpg.conf
|
src: .gnupg/gpg.conf
|
||||||
dst: ~/.gnupg/gpg.conf
|
dst: ~/.gnupg/gpg.conf
|
||||||
|
@ -185,6 +188,7 @@ profiles:
|
||||||
- f_ssh.conf
|
- f_ssh.conf
|
||||||
- f_authorized_keys
|
- f_authorized_keys
|
||||||
- d_nvim_lua
|
- d_nvim_lua
|
||||||
|
- d_nvim_scripts
|
||||||
- f_nvim_init
|
- f_nvim_init
|
||||||
- f_gitconfig
|
- f_gitconfig
|
||||||
- f_alacritty.yml
|
- f_alacritty.yml
|
||||||
|
|
|
@ -4,8 +4,10 @@ require 'keybinds'
|
||||||
require 'settings'
|
require 'settings'
|
||||||
|
|
||||||
-- Plugin configurations
|
-- Plugin configurations
|
||||||
require 'pluginconf.airline'
|
require 'pluginconf.lualine'
|
||||||
|
require 'pluginconf.bufferline'
|
||||||
require 'pluginconf.completion'
|
require 'pluginconf.completion'
|
||||||
require 'pluginconf.lsp'
|
require 'pluginconf.lsp'
|
||||||
require 'pluginconf.treesitter'
|
require 'pluginconf.treesitter'
|
||||||
require 'pluginconf.telescope'
|
require 'pluginconf.telescope'
|
||||||
|
-- require 'pluginconf.indent-blankline'
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
local g = vim.g
|
|
||||||
local o = vim.o
|
|
||||||
|
|
||||||
o.showmode = false
|
|
||||||
o.laststatus = 2
|
|
||||||
g["airline#extensions#tabline#enabled"] = 1
|
|
||||||
g.airline_powerline_fonts = 1
|
|
||||||
g.airline_section_warning = ''
|
|
||||||
g.airline_section_error = ''
|
|
||||||
g.airline_theme = 'onedark'
|
|
1
home/.config/nvim/lua/pluginconf/bufferline.lua
Normal file
1
home/.config/nvim/lua/pluginconf/bufferline.lua
Normal file
|
@ -0,0 +1 @@
|
||||||
|
require("bufferline").setup{}
|
1
home/.config/nvim/lua/pluginconf/indent-blankline.lua
Normal file
1
home/.config/nvim/lua/pluginconf/indent-blankline.lua
Normal file
|
@ -0,0 +1 @@
|
||||||
|
require('indent_blankline').setup {filetype_exclude = {'help'}}
|
|
@ -1,33 +1,56 @@
|
||||||
|
-- List of servers to install
|
||||||
|
local required_servers = {
|
||||||
|
"css", "html", "java", "json", "lua", "rust", "yaml", "dockerfile", "latex",
|
||||||
|
"bash", "typescript", "php"
|
||||||
|
}
|
||||||
|
|
||||||
-- keymaps
|
-- keymaps
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
local function buf_set_keymap(...)
|
||||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||||
|
end
|
||||||
|
local function buf_set_option(...)
|
||||||
|
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||||
|
end
|
||||||
|
|
||||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
|
||||||
-- Mappings.
|
-- Mappings.
|
||||||
local opts = { noremap=true, silent=true }
|
local opts = {noremap = true, silent = true}
|
||||||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||||
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||||
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>',
|
||||||
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
opts)
|
||||||
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
buf_set_keymap('n', '<space>wa',
|
||||||
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
'<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||||
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
buf_set_keymap('n', '<space>wr',
|
||||||
|
'<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||||
|
buf_set_keymap('n', '<space>wl',
|
||||||
|
'<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>',
|
||||||
|
opts)
|
||||||
|
buf_set_keymap('n', '<space>D',
|
||||||
|
'<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||||
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||||
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
buf_set_keymap('n', '<space>e',
|
||||||
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
'<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>',
|
||||||
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
opts)
|
||||||
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>',
|
||||||
|
opts)
|
||||||
|
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>',
|
||||||
|
opts)
|
||||||
|
buf_set_keymap('n', '<space>q',
|
||||||
|
'<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||||
|
|
||||||
-- Set some keybinds conditional on server capabilities
|
-- Set some keybinds conditional on server capabilities
|
||||||
if client.resolved_capabilities.document_formatting then
|
if client.resolved_capabilities.document_formatting then
|
||||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>",
|
||||||
|
opts)
|
||||||
elseif client.resolved_capabilities.document_range_formatting then
|
elseif client.resolved_capabilities.document_range_formatting then
|
||||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
buf_set_keymap("n", "<space>f",
|
||||||
|
"<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set autocommands conditional on server_capabilities
|
-- Set autocommands conditional on server_capabilities
|
||||||
|
@ -41,39 +64,39 @@ local on_attach = function(client, bufnr)
|
||||||
]], false)
|
]], false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--
|
|
||||||
-- Configure lua language server for neovim development
|
-- Configure lua language server for neovim development
|
||||||
local lua_settings = {
|
local lua_settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = {
|
runtime = {
|
||||||
-- LuaJIT in the case of Neovim
|
-- LuaJIT in the case of Neovim
|
||||||
version = 'LuaJIT',
|
version = 'LuaJIT',
|
||||||
path = vim.split(package.path, ';'),
|
path = vim.split(package.path, ';')
|
||||||
},
|
},
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
-- Get the language server to recognize the `vim` global
|
-- Get the language server to recognize the `vim` global
|
||||||
globals = {'vim'},
|
globals = {'vim'}
|
||||||
},
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
-- Make the server aware of Neovim runtime files
|
-- Make the server aware of Neovim runtime files
|
||||||
library = {
|
library = {
|
||||||
[vim.fn.expand('$VIMRUNTIME/lua')] = true,
|
[vim.fn.expand('$VIMRUNTIME/lua')] = true,
|
||||||
[vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true,
|
[vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- config that activates keymaps and enables snippet support
|
-- config that activates keymaps and enables snippet support
|
||||||
local function make_config()
|
local function make_config()
|
||||||
local capabilities = vim .lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
return {
|
return {
|
||||||
-- enable snippet support
|
-- enable snippet support
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
-- map buffer local keybindings when the language server attaches
|
-- map buffer local keybindings when the language server attaches
|
||||||
on_attach = on_attach,
|
on_attach = on_attach
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- lsp-install
|
-- lsp-install
|
||||||
|
@ -83,23 +106,38 @@ local function setup_servers()
|
||||||
-- get all installed servers
|
-- get all installed servers
|
||||||
local servers = require'lspinstall'.installed_servers()
|
local servers = require'lspinstall'.installed_servers()
|
||||||
|
|
||||||
|
-- install server if not already installed but required
|
||||||
|
-- for _, server in pairs(required_servers) do
|
||||||
|
-- if not vim.tbl_contains(servers) then
|
||||||
|
-- require'lspinstall'.install_server(server)
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- Refresh servers list in case of newly installed servers
|
||||||
|
servers = require'lspinstall'.installed_servers()
|
||||||
|
|
||||||
for _, server in pairs(servers) do
|
for _, server in pairs(servers) do
|
||||||
local config = make_config()
|
local config = make_config()
|
||||||
|
|
||||||
-- language specific config
|
-- language specific config
|
||||||
if server == "lua" then
|
if server == "lua" then config.settings = lua_settings end
|
||||||
config.settings = lua_settings
|
|
||||||
end
|
|
||||||
|
|
||||||
-- setup lspconfig for all servers
|
|
||||||
require'lspconfig'[server].setup(config)
|
require'lspconfig'[server].setup(config)
|
||||||
|
|
||||||
|
-- Java LSP client is started by the plugin nvim-jdtls
|
||||||
|
if server == "java" then return end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
setup_servers()
|
setup_servers()
|
||||||
|
|
||||||
|
require('jdtls').start_or_attach({
|
||||||
|
cmd = {'java-lsp.sh'},
|
||||||
|
root_dir = require('jdtls.setup').find_root({'gradle.build', 'pom.xml'})
|
||||||
|
})
|
||||||
|
|
||||||
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
|
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
|
||||||
require'lspinstall'.post_install_hook = function ()
|
require'lspinstall'.post_install_hook = function()
|
||||||
setup_servers() -- reload installed servers
|
setup_servers() -- reload installed servers
|
||||||
vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server
|
vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server
|
||||||
end
|
end
|
||||||
|
|
3
home/.config/nvim/lua/pluginconf/lualine.lua
Normal file
3
home/.config/nvim/lua/pluginconf/lualine.lua
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
require'lualine'.setup {
|
||||||
|
options = {theme = 'onedark'},
|
||||||
|
}
|
|
@ -20,10 +20,22 @@ require('packer').startup(function()
|
||||||
use {'wbthomason/packer.nvim', opt = true}
|
use {'wbthomason/packer.nvim', opt = true}
|
||||||
|
|
||||||
-- Colorscheme
|
-- Colorscheme
|
||||||
use 'joshdick/onedark.vim'
|
use 'monsonjeremy/onedark.nvim'
|
||||||
|
|
||||||
-- Custom status and tabline
|
-- Statusline
|
||||||
use 'vim-airline/vim-airline'
|
use {
|
||||||
|
'hoob3rt/lualine.nvim',
|
||||||
|
requires = {'kyazdani42/nvim-web-devicons', opt = true}
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Tabline/bufferline
|
||||||
|
use {
|
||||||
|
'akinsho/nvim-bufferline.lua',
|
||||||
|
requires = 'kyazdani42/nvim-web-devicons'
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Indent characters
|
||||||
|
--use "lukas-reineke/indent-blankline.nvim"
|
||||||
|
|
||||||
-- Tree explorer
|
-- Tree explorer
|
||||||
use {'kyazdani42/nvim-tree.lua', requires = 'kyazdani42/nvim-web-devicons'}
|
use {'kyazdani42/nvim-tree.lua', requires = 'kyazdani42/nvim-web-devicons'}
|
||||||
|
@ -46,6 +58,9 @@ require('packer').startup(function()
|
||||||
-- Install LSP executables
|
-- Install LSP executables
|
||||||
use 'kabouzeid/nvim-lspinstall'
|
use 'kabouzeid/nvim-lspinstall'
|
||||||
|
|
||||||
|
-- Extensions for eclipse.jdt.ls
|
||||||
|
use 'mfussenegger/nvim-jdtls'
|
||||||
|
|
||||||
-- Completion framework
|
-- Completion framework
|
||||||
use 'nvim-lua/completion-nvim'
|
use 'nvim-lua/completion-nvim'
|
||||||
|
|
||||||
|
@ -63,6 +78,12 @@ require('packer').startup(function()
|
||||||
-- Formatter plugin
|
-- Formatter plugin
|
||||||
use 'sbdchd/neoformat'
|
use 'sbdchd/neoformat'
|
||||||
|
|
||||||
|
-- Make editing passwords safer
|
||||||
|
use {
|
||||||
|
'https://git.zx2c4.com/password-store',
|
||||||
|
rtp = 'contrib/vim/redact_pass.vim'
|
||||||
|
}
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Install plugins if packer was not installed
|
-- Install plugins if packer was not installed
|
||||||
|
|
|
@ -5,7 +5,7 @@ local cmd = vim.cmd
|
||||||
------ Appearance ------
|
------ Appearance ------
|
||||||
|
|
||||||
-- Set colorscheme
|
-- Set colorscheme
|
||||||
cmd 'colorscheme onedark'
|
require('onedark').setup()
|
||||||
|
|
||||||
-- True colors
|
-- True colors
|
||||||
o.termguicolors = true
|
o.termguicolors = true
|
||||||
|
@ -19,6 +19,10 @@ o.cmdheight = 1
|
||||||
-- Always show signcolumn
|
-- Always show signcolumn
|
||||||
o.signcolumn = 'yes'
|
o.signcolumn = 'yes'
|
||||||
|
|
||||||
|
-- Blinking cursor
|
||||||
|
cmd 'set guicursor=i:ver1'
|
||||||
|
cmd 'set guicursor+=a:blinkon1'
|
||||||
|
|
||||||
-- Gutter and cursoline bg transparent
|
-- Gutter and cursoline bg transparent
|
||||||
cmd 'highlight CursorLineNr guibg=transparent'
|
cmd 'highlight CursorLineNr guibg=transparent'
|
||||||
cmd 'highlight SignColumn guibg=transparent'
|
cmd 'highlight SignColumn guibg=transparent'
|
||||||
|
|
17
home/.config/nvim/scripts/java-lsp.sh
Executable file
17
home/.config/nvim/scripts/java-lsp.sh
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
JAR="$HOME/.local/share/nvim/lspinstall/java/plugins/org.eclipse.equinox.launcher_*.jar"
|
||||||
|
GRADLE_HOME=$HOME/gradle /usr/lib/jvm/default/bin/java \
|
||||||
|
-Declipse.application=org.eclipse.jdt.ls.core.id1 \
|
||||||
|
-Dosgi.bundles.defaultStartLevel=4 \
|
||||||
|
-Declipse.product=org.eclipse.jdt.ls.core.product \
|
||||||
|
-Dlog.protocol=true \
|
||||||
|
-Dlog.level=ALL \
|
||||||
|
-Xms1g \
|
||||||
|
-Xmx2G \
|
||||||
|
-jar $(echo "$JAR") \
|
||||||
|
-configuration "$HOME/.local/share/nvim/lspinstall/java/config_linux" \
|
||||||
|
-data "${1:-$HOME/workspace}" \
|
||||||
|
--add-modules=ALL-SYSTEM \
|
||||||
|
--add-opens java.base/java.util=ALL-UNNAMED \
|
||||||
|
--add-opens java.base/java.lang=ALL-UNNAMED
|
Loading…
Add table
Add a link
Reference in a new issue