This commit is contained in:
2022-01-18 01:25:46 -05:00
parent 2e1e1f38b2
commit def5ca8b9a
86 changed files with 9017 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
-- mostly taken from https://gitlab.com/ethanwu10/dotfiles
require('plugins')
require('options')
+23
View File
@@ -0,0 +1,23 @@
local fn = vim.fn
local is_bootstrawp = false
local bootstrap_output = ''
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
bootstrap_output = fn.system({
'git',
'clone',
'--depth', '1',
'https://github.com/wbthomason/packer.nvim',
install_path
})
is_bootstrap = true
vim.cmd 'packloadall'
end
return {
is_bootstrap = is_bootstrap,
bootstrap_output = bootstrap_output,
}
+130
View File
@@ -0,0 +1,130 @@
vim.g.coq_settings = {
auto_start = 'shut-up',
}
local coq = require('coq')
local lspstatus = require('lsp-status')
lspstatus.register_progress()
local lsp_confs = {
sumneko_lua = {
settings = {
Lua = {
-- Settings for working with nvim (copied from https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#sumneko_lua)
runtime = {
version = 'LuaJIT',
path = runtime_path,
},
diagnostics = {
globals = {'vim'},
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
},
},
},
},
rust_analyzer = {
settings = {
["rust-analyzer"] = {
checkOnSave = {
command = "clippy",
},
},
},
},
ccls = {},
pyright = {},
gopls = {},
}
local lsp_special_setup = {
}
local lspconfig = require('lspconfig')
for server, conf in pairs(lsp_confs) do
local source_on_attach = conf.on_attach
if source_on_attach == nil then
conf.on_attach = on_attach
else
conf.on_attach = function(client, bufnr)
on_attach(client, bufnr)
source_on_attach(client, bufnr)
end
end
conf.capabilities = vim.tbl_deep_extend(
"keep",
conf.capabilities or {},
lspstatus.capabilities
)
local final_config = coq.lsp_ensure_capabilities(conf)
local special_setup = lsp_special_setup[server]
if special_setup then
special_setup(final_config)
else
lspconfig[server].setup(final_config)
end
end
local null_ls = require('null-ls')
null_ls.setup({
sources = {
null_ls.builtins.diagnostics.chktex,
null_ls.builtins.diagnostics.cppcheck,
null_ls.builtins.diagnostics.shellcheck,
null_ls.builtins.code_actions.gitsigns,
},
})
vim.diagnostic.config({
severity_sort = true,
update_in_insert = true,
float = {
source = true,
},
})
do -- signs
local signs = {
{'DiagnosticSignError', text='×', texthl='DiagnosticSignError'},
{'DiagnosticSignWarn', text='>', texthl='DiagnosticSignWarn'},
{'DiagnosticSignInfo', text='I', texthl='DiagnosticSignInfo'},
{'DiagnosticSignHint', text='H', texthl='DiagnosticSignHint'},
}
for _, sign in pairs(signs) do
local name = sign[1]
local opts = sign
opts[1] = nil
vim.fn.sign_define(name, opts)
end
end
local map = vim.api.nvim_set_keymap
map(
'n',
'K',
[[luaeval('next(vim.lsp.buf_get_clients()) == nil') ? 'K' : '<Cmd>lua vim.lsp.buf.hover()<CR>']],
{noremap = true, expr = true}
)
map(
'n',
'<C-]>',
[[luaeval('next(vim.lsp.buf_get_clients()) == nil') ? '<C-]>' : '<Cmd>lua vim.lsp.buf.definition()<CR>']],
{noremap = true, expr = true}
)
vim.cmd [[
augroup lspconfig
au!
" diagnostic on hover
au CursorHold * lua vim.diagnostic.open_float({focus = false})
augroup END
]]
+51
View File
@@ -0,0 +1,51 @@
local o = vim.opt
local map = vim.api.nvim_set_keymap
vim.g.mapleader = ","
vim.g.maplocalleader = ","
o.modeline = true
o.number = true
o.relativenumber = true
o.clipboard = "unnamedplus"
o.viminfo = ""
-- why viminfo not work
o.tabstop = 4
o.viminfo = ''
o.termguicolors = false
vim.cmd('colorscheme wal')
vim.g.airline_theme='wal'
map('n', '<Leader>s', ':%s//g<Left><Left>', {})
map('n', '<Leader>e', ':make!<CR>', {noremap = true})
map('n', '<C-o>', ':cclose<CR>', {noremap = true})
map('n', '<C-L>', ':nohlsearch<CR><C-L>', {noremap = true, silent = true})
map('n', ';', ':', {noremap = true})
map('v', ';', ':', {noremap = true})
for i = 1,9,1 do
map('', '<Leader>' .. tostring(i), tostring(i) .. 'gt', {noremap = true})
end
map('n', '<C-Left>', ':tabprevious<CR>', {noremap = true})
map('n', '<C-Right>', ':tabnext<CR>', {noremap = true})
map('', '<Leader>0', ':tablast<CR>', {noremap = true})
map('n', 'ZX', '<Cmd>q<CR>', {noremap = true, silent = true})
map('t', '<Esc>', '<C-\\><C-n>', {noremap = true})
o.list=true
o.listchars = {
tab = '',
eol = '¬',
trail = '·',
extends = ''
}
vim.cmd [[
augroup options_guicursor
au!
" Reset to underscore cursor for terminal nvim (https://github.com/neovim/neovim/issues/4867#issuecomment-291249173)
au VimLeave * set guicursor=a:ver90
augroup END
]]
+144
View File
@@ -0,0 +1,144 @@
local bootstrap = require('bootstrap')
local function import(name)
return ([[require '%s']]):format(name)
end
return require('packer').startup({function(use)
use 'wbthomason/packer.nvim'
use {
'vim-airline/vim-airline',
requires = {
'ryanoasis/vim-devicons',
}
}
use {
'tpope/vim-fugitive',
config = function()
local map = vim.api.nvim_set_keymap
map('n', '<Leader>g', '<Cmd>Git<CR>', {noremap = true})
end,
}
use {
'lewis6991/gitsigns.nvim',
requires = {
'nvim-lua/plenary.nvim'
},
config = function()
require('gitsigns').setup {
signs = {
add = {hl = 'GitSignsAdd' , text = '', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'},
change = {hl = 'GitSignsChange', text = '', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
topdelete = {hl = 'GitSignsDelete', text = '', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
},
}
end
}
use {
'numToStr/Comment.nvim',
config = function()
local map = vim.api.nvim_set_keymap
require('Comment').setup({})
map('n', '<C-_>',
'<Cmd>lua require("Comment.api").toggle_linewise_op(vim.fn.visualmode())<CR>',
{noremap = true, silent = true})
end
}
use {
'nvim-telescope/telescope.nvim',
requires = {
'nvim-lua/plenary.nvim',
{
'nvim-telescope/telescope-fzf-native.nvim',
run = 'make',
},
'nvim-telescope/telescope-symbols.nvim',
},
config = import('tel'),
}
use {
'stevearc/dressing.nvim',
config = function()
require('dressing').setup({
input = {
default_prompt = '',
winhighlight = 'NormalFloat:Normal',
},
})
vim.cmd [[highlight link FloatTitle NonText]]
vim.cmd [[highlight link DressingInputText Normal]]
end,
}
use {
'antoinemadec/FixCursorHold.nvim',
config = function()
vim.g.cursorhold_updatetime = 500
end,
}
use {
'neovim/nvim-lspconfig',
requires = {
'nvim-lua/lsp-status.nvim',
{
'ms-jpq/coq_nvim',
run = ':COQdeps',
requires = {
'ms-jpq/coq.artifacts',
},
},
{
'jose-elias-alvarez/null-ls.nvim',
requires = {
'nvim-lua/plenary.nvim',
},
},
},
config = import('lsp'),
}
use {
'lervag/vimtex',
config = function()
vim.g.vimtex_view_general_viewer = 'zathura'
vim.g.vimtex_view_general_options = '--unique file:@pdf\\#src:@line@tex'
vim.g.vimtex_quickfix_enabled = 0
vim.g.Tex_GotoError = 0
vim.g.Tex_ShowErrorContext = 0
end,
}
use {
'iamcco/markdown-preview.nvim',
run = "cd app && npm install",
setup = function() vim.g.mkdp_filetypes = { "markdown" } end, ft = { "markdown" },
config = function()
local map = vim.api.nvim_set_keymap
map('n', '<C-m>', '<Plug>MarkdownPreviewToggle', {})
map('n', '<Leader>m', '<Plug>MarkdownPreviewToggle', {})
end
}
use {
'https://github.com/dylanaraps/wal.vim',
as = 'wal'
}
if bootstrap.is_bootstrap then
require('packer').sync()
end
end,
config = {
compile_path = require('packer.util').join_paths(vim.fn.stdpath('data'), 'site', 'plugin', 'packer_compiled.lua'),
}})
+73
View File
@@ -0,0 +1,73 @@
local telescope = require('telescope')
telescope.setup({
defaults = {
file_ignore_patterns = {'.git'},
mappings = {
i = {
['<C-o>'] = { '<Esc>', type = 'command' },
['<Esc>'] = 'close',
['<C-s>'] = 'select_horizontal',
},
n = {
q = 'close',
['<C-o>'] = { '<Nop>', type = 'command' },
['<C-s>'] = 'select_horizontal',
},
},
sorting_strategy = 'ascending',
layout_config = {
prompt_position = 'top',
},
prompt_prefix = ' ',
selection_caret = ' ',
multi_icon = '',
},
pickers = {
buffers = {
mappings = {
n = {
dd = 'delete_buffer',
},
},
},
find_files = {
hidden = true,
},
lsp_code_actions = {
initial_mode = 'normal',
},
lsp_range_code_actions = {
initial_mode = 'normal',
},
},
})
telescope.load_extension('fzf')
local map = vim.api.nvim_set_keymap
map('n', '<Leader>pf', '<Cmd>Telescope find_files<CR>', {noremap = true})
map('n', '<Leader>pb', '<Cmd>Telescope buffers<CR>', {noremap = true})
map('n', '<Leader>po', '<Cmd>Telescope lsp_document_symbols<CR>', {noremap = true})
map('n', '<Leader>p', ':Telescope ', {noremap = true})
map('n', '<Leader>p ', ':Telescope ', {noremap = true})
map('n', '<Leader>.', '<Cmd>Telescope lsp_code_actions<CR>', {noremap = true})
-- vim.cmd [[
-- function! s:telescope_hlsetup() abort
-- highlight link TelescopeBorder NonText
-- highlight link TelescopeTitle NonText
-- endfunction
-- call s:telescope_hlsetup()
-- augroup telescope_hlsetup
-- au!
-- au ColorScheme * call s:telescope_hlsetup()
-- augroup END
-- ]]