Merge branch 'main' into neovim-0.5.0
commit
d029ee6e76
6
Makefile
6
Makefile
|
@ -296,8 +296,10 @@ install_asdf: check_os
|
|||
|
||||
.PHONY: install_vim
|
||||
install_vim: check_os link_vim
|
||||
@echo "Installing vim packages..."
|
||||
@echo "y\n\n\n" | nvim +PackerCompile +PackerInstall +qall
|
||||
@echo "Vim package installation is no longer done automatically!"
|
||||
@echo "Start Vim or NeoVim and run:"
|
||||
@echo "For NeoVim: :PackerInstall"
|
||||
@echo "For Vim: :PlugInstall"
|
||||
|
||||
.PHONY: oh_my_zsh
|
||||
oh_my_zsh: check_os
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if require('personal.first_load')() then
|
||||
if require('init.first_load')() then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -13,17 +13,17 @@ vim.g.mapleader = ' '
|
|||
-- Globals taken from TJ config
|
||||
-- Helpful for configuration
|
||||
-- Might be removed in future version of NeoVim
|
||||
require('personal.globals')
|
||||
require('init.globals')
|
||||
|
||||
require('personal.plugins')
|
||||
require('init.plugins')
|
||||
|
||||
require('personal.options')
|
||||
require('init.options')
|
||||
|
||||
require('lsp')
|
||||
|
||||
-- Colorscheme
|
||||
vim.cmd('syntax on')
|
||||
require('personal.colors')
|
||||
require('init.colors')
|
||||
|
||||
vim.api.nvim_set_keymap('n', 'Q', 'gq', {})
|
||||
vim.api.nvim_set_keymap('i', '<C-U>', '<C-G>u<C-U>', {noremap = true})
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
-- vim.o.termguicolors = true -- Does not look good with gruvbox
|
||||
vim.o.background = "dark"
|
||||
vim.cmd([[colorscheme gruvbox]])
|
|
@ -16,4 +16,4 @@ if pcall(require, 'plenary') then
|
|||
end
|
||||
|
||||
-- `vim.opt`
|
||||
require('personal.globals.opt')
|
||||
require('init.globals.opt')
|
|
@ -20,7 +20,7 @@ return require('packer').startup {
|
|||
use 'mhinz/vim-grepper'
|
||||
use 'direnv/direnv.vim'
|
||||
use 'tpope/vim-speeddating'
|
||||
use 'sainnhe/gruvbox-material'
|
||||
use 'flazz/vim-colorschemes'
|
||||
|
||||
-- Tools
|
||||
use 'tpope/vim-dispatch'
|
||||
|
@ -55,6 +55,7 @@ return require('packer').startup {
|
|||
|
||||
-- Treesitter
|
||||
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
|
||||
-- use { 'npxbr/gruvbox.nvim', requires = { 'rktjmp/lush.nvim' } }
|
||||
|
||||
-- LSP
|
||||
-- use 'tjdevries/nlua.nvim'
|
|
@ -7,6 +7,7 @@
|
|||
vim.o.completeopt = "menuone,noinsert,noselect"
|
||||
-- Avoid showing message extra message when using completion
|
||||
vim.cmd('set shortmess+=c')
|
||||
vim.cmd('let g:completion_enable_snippet = "UltiSnips"')
|
||||
vim.cmd('let g:completion_confirm_key = "\\<C-y>"')
|
||||
vim.cmd("autocmd BufEnter * lua require'completion'.on_attach()")
|
||||
vim.g.completion_matching_strategy_list = {'exact', 'substring', 'fuzzy'}
|
||||
vim.g.completion_confirm_key = '<C-y>'
|
||||
vim.g.completion_enable_snippet = 'UltiSnips'
|
||||
|
|
|
@ -5,4 +5,3 @@
|
|||
require("lsp.diagnostic")
|
||||
require("lsp.servers")
|
||||
require("lsp.completion")
|
||||
require("lsp.maps")
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
-------------------------------------------------------------------------------
|
||||
-- - LSP related keymaps -
|
||||
-------------------------------------------------------------------------------
|
||||
default_opts = {noremap = true, silent = true}
|
||||
|
||||
-- Lsp keymaps
|
||||
vim.api.nvim_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', default_opts)
|
||||
vim.api.nvim_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', default_opts)
|
||||
vim.api.nvim_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', default_opts)
|
||||
vim.api.nvim_set_keymap('n', '<Leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', default_opts)
|
||||
vim.api.nvim_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', default_opts)
|
||||
vim.api.nvim_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', default_opts)
|
||||
vim.api.nvim_set_keymap('n', '<A-CR>', '<cmd>lua vim.lsp.buf.code_action()<CR>', default_opts)
|
||||
vim.api.nvim_set_keymap('n', '<Leader>ac', '<cmd>lua vim.lsp.buf.code_action()<CR>', default_opts)
|
||||
vim.api.nvim_set_keymap('n', '<Leader>a', '<cmd>lua vim.lsp.buf.code_action_range()<CR>', default_opts)
|
||||
|
||||
completion_opts = {silent = true}
|
||||
|
||||
-- Completion keymaps
|
||||
vim.api.nvim_set_keymap('i', '<C-n>', '<Plug>(completion_trigger)', completion_opts)
|
|
@ -6,15 +6,36 @@ local lspconfig = require("lspconfig")
|
|||
|
||||
local on_attach = function(client, bufnr)
|
||||
require'completion'.on_attach()
|
||||
|
||||
local function buf_set_keymap(...) 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')
|
||||
|
||||
default_opts = {noremap = true, silent = true}
|
||||
|
||||
-- Lsp keymaps
|
||||
buf_set_keymap('n', '<C-]>', '<cmd>lua vim.lsp.buf.definition()<CR>', default_opts)
|
||||
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', default_opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', default_opts)
|
||||
buf_set_keymap('n', '<Leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', default_opts)
|
||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', default_opts)
|
||||
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', default_opts)
|
||||
buf_set_keymap('n', '<A-CR>', '<cmd>lua vim.lsp.buf.code_action()<CR>', default_opts)
|
||||
buf_set_keymap('n', '<Leader>ac', '<cmd>lua vim.lsp.buf.code_action()<CR>', default_opts)
|
||||
buf_set_keymap('n', '<Leader>a', '<cmd>lua vim.lsp.buf.code_action_range()<CR>', default_opts)
|
||||
|
||||
completion_opts = {silent = true}
|
||||
|
||||
-- Completion keymaps
|
||||
buf_set_keymap('i', '<C-n>', '<Plug>(completion_trigger)', completion_opts)
|
||||
end
|
||||
|
||||
-- Lsp default language servers
|
||||
local servers = { "bashls", "clangd", "dartls", "jsonls", "pyright", "rust_analyzer", "kotlin_language_server", "vimls" }
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup { on_attach = on_attach }
|
||||
end
|
||||
-- Lsp language servers
|
||||
lspconfig.bashls.setup {on_attach = on_attach}
|
||||
lspconfig.clangd.setup {on_attach = on_attach}
|
||||
lspconfig.dartls.setup {on_attach = on_attach}
|
||||
lspconfig.jsonls.setup {on_attach = on_attach}
|
||||
lspconfig.pyright.setup {on_attach = on_attach}
|
||||
lspconfig.rust_analyzer.setup {on_attach = on_attach}
|
||||
lspconfig.vimls.setup {on_attach = on_attach}
|
||||
|
||||
-- Lua bultin lsp
|
||||
-- require('nlua.lsp.nvim').setup(lspconfig, {
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
vim.api.nvim_exec('colorscheme gruvbox-material', false)
|
|
@ -1,79 +0,0 @@
|
|||
" Must have extensions!
|
||||
|
||||
lua <<EOF
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
end
|
||||
|
||||
vim.g.diagnostic_enable_virtual_text = 1
|
||||
|
||||
default_opts = {noremap = true, silent = true}
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<c-]>", "<cmd>lua vim.lsp.buf.definition()<CR>", default_opts)
|
||||
vim.api.nvim_set_keymap("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", default_opts)
|
||||
vim.api.nvim_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", default_opts)
|
||||
vim.api.nvim_set_keymap("n", "<Leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", default_opts)
|
||||
vim.api.nvim_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", default_opts)
|
||||
vim.api.nvim_set_keymap("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", default_opts)
|
||||
vim.api.nvim_set_keymap("n", "<A-CR>", "<cmd>lua vim.lsp.buf.code_action()<CR>", default_opts)
|
||||
vim.api.nvim_set_keymap("n", "<Leader>ac", "<cmd>lua vim.lsp.buf.code_action()<CR>", default_opts)
|
||||
vim.api.nvim_set_keymap("n", "<Leader>a", "<cmd>lua vim.lsp.buf.code_action_range()<CR>", default_opts)
|
||||
|
||||
lspconfig.bashls.setup {on_attach = on_attach}
|
||||
lspconfig.clangd.setup {on_attach = on_attach}
|
||||
lspconfig.dartls.setup {on_attach = on_attach}
|
||||
lspconfig.jsonls.setup {on_attach = on_attach}
|
||||
lspconfig.pyright.setup {on_attach = on_attach}
|
||||
lspconfig.rust_analyzer.setup {on_attach = on_attach}
|
||||
lspconfig.vimls.setup {on_attach = on_attach}
|
||||
|
||||
require'compe'.setup {
|
||||
enabled = true;
|
||||
autocomplete = true;
|
||||
debug = false;
|
||||
min_length = 1;
|
||||
preselect = 'enable';
|
||||
throttle_time = 80;
|
||||
source_timeout = 200;
|
||||
incomplete_delay = 400;
|
||||
max_abbr_width = 100;
|
||||
max_kind_width = 100;
|
||||
max_menu_width = 100;
|
||||
documentation = true;
|
||||
|
||||
source = {
|
||||
path = true;
|
||||
buffer = true;
|
||||
calc = true;
|
||||
vsnip = true;
|
||||
nvim_lsp = true;
|
||||
nvim_lua = true;
|
||||
spell = true;
|
||||
tags = true;
|
||||
snippets_nvim = true;
|
||||
treesitter = true;
|
||||
};
|
||||
}
|
||||
|
||||
require("nvim-ale-diagnostic")
|
||||
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
underline = false,
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
update_in_insert = false,
|
||||
}
|
||||
)
|
||||
|
||||
EOF
|
||||
|
||||
inoremap <silent><expr> <C-n> compe#complete()
|
||||
inoremap <silent><expr> <C-y> compe#confirm('<C-y>')
|
||||
inoremap <silent><expr> <C-e> compe#close('<C-e>')
|
||||
inoremap <silent><expr> <C-f> compe#scroll({ 'delta': +4 })
|
||||
inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })
|
||||
|
||||
" Set completeopt to have a better completion experience
|
||||
set completeopt=menuone,noselect
|
|
@ -3,8 +3,8 @@
|
|||
" -----------------------------------------------------------------------------
|
||||
|
||||
function s:UpdateColors()
|
||||
let ctermbg = synIDattr(synIDtrans(hlID('StatusLine')), 'bg', 'cterm')
|
||||
let guibg = synIDattr(synIDtrans(hlID('StatusLine')), 'bg', 'gui')
|
||||
let ctermbg = synIDattr(synIDtrans(hlID('StatusLine')), 'fg', 'cterm')
|
||||
let guibg = synIDattr(synIDtrans(hlID('StatusLine')), 'fg', 'gui')
|
||||
let idguifg1 = synIDattr(synIDtrans(hlID('Function')), 'fg', 'gui')
|
||||
let idctermfg1 = synIDattr(synIDtrans(hlID('Function')), 'fg', 'cterm')
|
||||
" Green in gruvbox
|
||||
|
@ -14,8 +14,8 @@ function s:UpdateColors()
|
|||
if l:idctermfg1
|
||||
exec 'hi User1 ctermfg=' . l:idctermfg1
|
||||
endif
|
||||
let idguifg2 = synIDattr(synIDtrans(hlID('ErrorMsg')), 'fg', 'gui')
|
||||
let idctermfg2 = synIDattr(synIDtrans(hlID('ErrorMsg')), 'fg', 'cterm')
|
||||
let idguifg2 = synIDattr(synIDtrans(hlID('WarningMsg')), 'fg', 'gui')
|
||||
let idctermfg2 = synIDattr(synIDtrans(hlID('WarningMsg')), 'fg', 'cterm')
|
||||
" Red in gruvbox
|
||||
exec 'hi User2 guifg=' . l:idguifg2 .
|
||||
\' guibg=' . l:guibg .
|
||||
|
@ -23,8 +23,8 @@ function s:UpdateColors()
|
|||
if l:idctermfg2
|
||||
exec 'hi User2 ctermfg=' . l:idctermfg2
|
||||
endif
|
||||
let idguifg3 = synIDattr(synIDtrans(hlID('WarningMsg')), 'fg', 'gui')
|
||||
let idctermfg3 = synIDattr(synIDtrans(hlID('WarningMsg')), 'fg', 'cterm')
|
||||
let idguifg3 = synIDattr(synIDtrans(hlID('MoreMsg')), 'fg', 'gui')
|
||||
let idctermfg3 = synIDattr(synIDtrans(hlID('MoreMsg')), 'fg', 'cterm')
|
||||
" Yellow in gruvbox
|
||||
exec 'hi User3 guifg=' . l:idguifg3 .
|
||||
\' guibg=' . l:guibg .
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Polymorphism
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue