Merge branch 'master' of github.com:ChristianChiarulli/LunarVim into stable

This commit is contained in:
christianchiarulli 2021-07-03 16:34:43 -04:00
commit 8f37e7f278
14 changed files with 224 additions and 94 deletions

View file

@ -0,0 +1,60 @@
name: General Issue
description: File a bug report
title: "[Bug]: "
labels: [bug]
# assignees:
# - ChristianChiarulli
body:
- type: markdown
attributes:
value: |
Thank you for helping us improve !
- type: textarea
id: problem-description
attributes:
label: Problem description
description: Also tell us, what did you expect to happen?
placeholder: |
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
validations:
required: true
- type: input
id: lunar-vim-version
attributes:
label: LunarVim version
validations:
required: true
- type: input
id: nvim-version
attributes:
label: Neovim version (>= 0.5)
placeholder: nvim --version
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant log output
placeholder: |
nvim -v
:checkhealth
:messages
render: shell
- type: textarea
id: screenshots
attributes:
label: Screenshots
description: If applicable, add screenshots to help explain your problem
- type: checkboxes
id: checks
attributes:
label: I have read
options:
- label: The readme
required: true
- label: The wiki
required: true

4
ftdetect/zig.lua Normal file
View file

@ -0,0 +1,4 @@
vim.cmd([[
au BufRead,BufNewFile *.zig set filetype=zig
au BufRead,BufNewFile *.zir set filetype=zir
]])

1
ftplugin/cpp.lua Symbolic link
View file

@ -0,0 +1 @@
c.lua

View file

@ -3,8 +3,8 @@ require'lspconfig'.elixirls.setup{
} }
-- needed for the LSP to recognize elixir files (alternativly just use elixir-editors/vim-elixir) -- needed for the LSP to recognize elixir files (alternativly just use elixir-editors/vim-elixir)
vim.cmd([[ -- vim.cmd([[
au BufRead,BufNewFile *.ex,*.exs set filetype=elixir -- au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
au BufRead,BufNewFile *.eex,*.leex,*.sface set filetype=eelixir -- au BufRead,BufNewFile *.eex,*.leex,*.sface set filetype=eelixir
au BufRead,BufNewFile mix.lock set filetype=elixir -- au BufRead,BufNewFile mix.lock set filetype=elixir
]]) -- ]])

11
ftplugin/euphoria3.lua Normal file
View file

@ -0,0 +1,11 @@
-- TODO Remove this at some point
require'lspconfig'.elixirls.setup{
cmd = { DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh"};
}
-- needed for the LSP to recognize elixir files (alternativly just use elixir-editors/vim-elixir)
-- vim.cmd([[
-- au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
-- au BufRead,BufNewFile *.eex,*.leex,*.sface set filetype=eelixir
-- au BufRead,BufNewFile mix.lock set filetype=elixir
-- ]])

View file

@ -26,7 +26,7 @@ require"lspconfig".efm.setup {
-- init_options = {initializationOptions}, -- init_options = {initializationOptions},
cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"}, cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"},
init_options = {documentFormatting = true, codeAction = false}, init_options = {documentFormatting = true, codeAction = false},
filetypes = {"lua", "python", "javascriptreact", "javascript", "typescript","typescriptreact","sh", "html", "css", "yaml", "markdown", "vue"}, filetypes = {"python"},
settings = { settings = {
rootMarkers = {".git/", "requirements.txt"}, rootMarkers = {".git/", "requirements.txt"},
languages = { languages = {

15
ftplugin/zig.lua Normal file
View file

@ -0,0 +1,15 @@
-- Because lspinstall don't support zig yet,
-- So we need zls preset in global lib
-- Further custom install zls in
-- https://github.com/zigtools/zls/wiki/Downloading-and-Building-ZLS
require'lspconfig'.zls.setup{
root_dir = require'lspconfig'.util.root_pattern(".git", "build.zig", "zls.json"),
on_attach = require'lsp'.common_on_attach,
}
require('lv-utils').define_augroups({
_zig_autoformat = {
{'BufWritePre', '*.zig', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'},
{'BufEnter', '*.zig', ':lua vim.api.nvim_buf_set_option(0, "commentstring", "// %s")'}
}
})
vim.cmd("setl expandtab tabstop=8 softtabstop=4 shiftwidth=4")

View file

@ -1,6 +1,7 @@
CONFIG_PATH = vim.fn.stdpath('config') CONFIG_PATH = vim.fn.stdpath('config')
DATA_PATH = vim.fn.stdpath('data') DATA_PATH = vim.fn.stdpath('data')
CACHE_PATH = vim.fn.stdpath('cache') CACHE_PATH = vim.fn.stdpath('cache')
TERMINAL = vim.fn.expand('$TERMINAL')
O = { O = {
auto_close_tree = 0, auto_close_tree = 0,
@ -18,6 +19,8 @@ O = {
ignore_case = true, ignore_case = true,
smart_case = true, smart_case = true,
lushmode = false, lushmode = false,
hl_search = false,
transparent_window = false;
leader_key = "space"; leader_key = "space";
-- @usage pass a table with your desired languages -- @usage pass a table with your desired languages
@ -145,9 +148,9 @@ O = {
virtual_text = {spacing = 0, prefix = ""}, virtual_text = {spacing = 0, prefix = ""},
signs = true, signs = true,
underline = true, underline = true,
cross_file_rename = true, },
header_insertion = 'never' cross_file_rename = true,
} header_insertion = 'never'
}, },
ruby = { ruby = {
diagnostics = { diagnostics = {

View file

@ -20,7 +20,6 @@ vim.cmd("nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>")
vim.cmd("nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>") vim.cmd("nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>")
vim.cmd("nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>") vim.cmd("nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>")
vim.cmd("nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>") vim.cmd("nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>")
vim.cmd("nnoremap <silent> ca :Lspsaga code_action<CR>")
vim.cmd("nnoremap <silent> K :Lspsaga hover_doc<CR>") vim.cmd("nnoremap <silent> K :Lspsaga hover_doc<CR>")
-- vim.cmd('nnoremap <silent> <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>') -- vim.cmd('nnoremap <silent> <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>')
vim.cmd("nnoremap <silent> <C-p> :Lspsaga diagnostic_jump_prev<CR>") vim.cmd("nnoremap <silent> <C-p> :Lspsaga diagnostic_jump_prev<CR>")

View file

@ -103,7 +103,7 @@ table.insert(gls.left, {
highlight = {colors.red, colors.bg} highlight = {colors.red, colors.bg}
} }
}) })
print(vim.fn.getbufvar(0, 'ts')) -- print(vim.fn.getbufvar(0, 'ts'))
vim.fn.getbufvar(0, 'ts') vim.fn.getbufvar(0, 'ts')
table.insert(gls.left, { table.insert(gls.left, {
@ -178,9 +178,38 @@ table.insert(gls.right, {
} }
}) })
local get_lsp_client = function (msg)
msg = msg or "No Active LSP Client"
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
local clients = vim.lsp.get_active_clients()
if next(clients) == nil then
return msg
end
local lsps = ""
for _,client in ipairs(clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~=1 then
-- print(client.name)
if lsps == "" then
-- print("first", lsps)
lsps = client.name
else
lsps = lsps .. ", " .. client.name
-- print("more", lsps)
end
end
end
if lsps == "" then
return msg
else
return lsps
end
end
table.insert(gls.right, { table.insert(gls.right, {
ShowLspClient = { ShowLspClient = {
provider = 'GetLspClient', provider = get_lsp_client,
condition = function() condition = function()
local tbl = {['dashboard'] = true, [' '] = true} local tbl = {['dashboard'] = true, [' '] = true}
if tbl[vim.bo.filetype] then return false end if tbl[vim.bo.filetype] then return false end

View file

@ -1,6 +1,7 @@
local M = {} local M = {}
M.config = function() M.config = function()
require('hop').setup()
vim.api.nvim_set_keymap('n', 's', ":HopChar2<cr>", {silent = true}) vim.api.nvim_set_keymap('n', 's', ":HopChar2<cr>", {silent = true})
vim.api.nvim_set_keymap('n', 'S', ":HopWord<cr>", {silent = true}) vim.api.nvim_set_keymap('n', 'S', ":HopWord<cr>", {silent = true})
end end

View file

@ -10,21 +10,19 @@ if fn.empty(fn.glob(install_path)) > 0 then
end end
local packer_ok, packer = pcall(require, "packer") local packer_ok, packer = pcall(require, "packer")
if not packer_ok then if not packer_ok then return end
return
end
packer.init { packer.init {
-- compile_path = vim.fn.stdpath('data')..'/site/pack/loader/start/packer.nvim/plugin/packer_compiled.vim', -- compile_path = vim.fn.stdpath('data')..'/site/pack/loader/start/packer.nvim/plugin/packer_compiled.vim',
compile_path = require("packer.util").join_paths(vim.fn.stdpath('config'), 'plugin', 'packer_compiled.vim'), compile_path = require("packer.util").join_paths(vim.fn.stdpath('config'),
git = { 'plugin',
clone_timeout = 300 'packer_compiled.vim'),
}, git = {clone_timeout = 300},
display = { display = {
open_fn = function() open_fn = function()
return require("packer.util").float { border = "single" } return require("packer.util").float {border = "single"}
end, end
}, }
} }
vim.cmd "autocmd BufWritePost plugins.lua PackerCompile" -- Auto compile when there are changes in plugins.lua vim.cmd "autocmd BufWritePost plugins.lua PackerCompile" -- Auto compile when there are changes in plugins.lua
@ -46,15 +44,15 @@ return require("packer").startup(function(use)
config = [[require('lv-telescope')]], config = [[require('lv-telescope')]],
cmd = "Telescope" cmd = "Telescope"
} }
-- Snap -- Snap TODO disable for now, need to only install fzy when user specifies they want to use snap
use { -- use {
"camspiers/snap", -- "camspiers/snap",
rocks = "fzy", -- rocks = "fzy",
config = function() -- config = function()
require("lv-snap").config() -- require("lv-snap").config()
end, -- end,
disable = not O.plugin.snap.active, -- disable = not O.plugin.snap.active
} -- }
-- Autocomplete -- Autocomplete
use { use {
"hrsh7th/nvim-compe", "hrsh7th/nvim-compe",
@ -90,8 +88,11 @@ return require("packer").startup(function(use)
use {"folke/which-key.nvim"} use {"folke/which-key.nvim"}
-- Autopairs -- Autopairs
use {"windwp/nvim-autopairs", use {
config = function() require'lv-autopairs' end "windwp/nvim-autopairs",
config = function()
require 'lv-autopairs'
end
} }
-- Comments -- Comments
@ -221,7 +222,6 @@ return require("packer").startup(function(use)
use { use {
"lukas-reineke/indent-blankline.nvim", "lukas-reineke/indent-blankline.nvim",
branch = "lua",
event = "BufRead", event = "BufRead",
setup = function() setup = function()
@ -400,9 +400,8 @@ return require("packer").startup(function(use)
-- Lush Create Color Schemes -- Lush Create Color Schemes
use { use {
"rktjmp/lush.nvim", "rktjmp/lush.nvim",
event = "VimEnter",
-- cmd = {"LushRunQuickstart", "LushRunTutorial", "Lushify"}, -- cmd = {"LushRunQuickstart", "LushRunTutorial", "Lushify"},
-- disable = not O.plugin.lush.active, disable = not O.plugin.lush.active,
} }
-- HTML preview -- HTML preview
use { use {
@ -421,15 +420,12 @@ return require("packer").startup(function(use)
-- LANGUAGE SPECIFIC GOES HERE -- LANGUAGE SPECIFIC GOES HERE
-- Latex TODO what filetypes should this be active for? -- Latex TODO what filetypes should this be active for?
use {"lervag/vimtex", ft = "latex", disable = not O.lang.latex.active} use {"lervag/vimtex", ft = "latex"}
-- Rust tools -- Rust tools
-- TODO: use lazy loading maybe? -- TODO: use lazy loading maybe?
use {"simrat39/rust-tools.nvim", disable = not O.lang.rust.active} use {"simrat39/rust-tools.nvim", ft = "rust"}
-- Elixir -- Elixir
use {"elixir-editors/vim-elixir", use {"elixir-editors/vim-elixir", ft = {"elixir", "eelixir", "euphoria3"}}
ft = {"elixir", "eelixir"},
disable = not O.lang.elixir.active
}
end) end)

View file

@ -1,50 +1,60 @@
vim.cmd('set iskeyword+=-') -- treat dash separated words as a word text object" --- HELPERS ---
vim.opt.shortmess:append("c") -- Don't pass messages to |ins-completion-menu|.
vim.cmd('set inccommand=split') -- Make substitution work in realtime
vim.o.hidden = O.hidden_files -- Required to keep multiple buffers open multiple buffers local cmd = vim.cmd
vim.o.title = true local opt = vim.opt
TERMINAL = vim.fn.expand('$TERMINAL')
vim.cmd('let &titleold="'..TERMINAL..'"')
vim.o.titlestring="%<%F%=%l/%L - nvim" --- VIM ONLY COMMANDS ---
vim.wo.wrap = O.wrap_lines -- Display long lines as just one line
vim.cmd('set whichwrap+=<,>,[,],h,l') -- move to next line with theses keys
vim.o.pumheight = 10 -- Makes popup menu smaller cmd('filetype plugin on') -- filetype detection
vim.o.fileencoding = "utf-8" -- The encoding written to file cmd('let &titleold="'..TERMINAL..'"')
vim.o.cmdheight = 2 -- More space for displaying messages cmd('set inccommand=split') -- show what you are substituting in real time
vim.cmd('set colorcolumn=99999') -- fix indentline for now cmd('set iskeyword+=-') -- treat dash as a separate word
vim.o.mouse = "a" -- Enable your mouse cmd('set whichwrap+=<,>,[,],h,l') -- move to next line with theses keys
vim.o.splitbelow = true -- Horizontal splits will automatically be below if O.transparent_window then
vim.o.termguicolors = true -- set term gui colors most terminals support this cmd('au ColorScheme * hi Normal ctermbg=none guibg=none')
vim.o.splitright = true -- Vertical splits will automatically be to the right end
-- vim.o.t_Co = "256" -- Support 256 colors
vim.o.conceallevel = 0 -- So that I can see `` in markdown files --- SETTINGS ---
vim.opt.tabstop = 4 -- Insert 2 spaces for a tab
vim.opt.shiftwidth = 4 -- Change the number of space characters inserted for indentation
--vim.opt.softtabstop = 4 opt.backup = false -- creates a backup file
vim.opt.expandtab = true -- Converts tabs to spaces opt.clipboard = "unnamedplus" -- allows neovim to access the system clipboard
vim.o.completeopt = "menuone,noselect" opt.cmdheight = 2 -- more space in the neovim command line for displaying messages
vim.bo.smartindent = true -- Makes indenting smart opt.colorcolumn = "99999" -- fix indentline for now
vim.wo.number = O.number -- set numbered lines opt.completeopt = {'menuone', 'noselect'}
vim.wo.relativenumber = O.relative_number -- set relative number opt.conceallevel = 0 -- so that `` is visible in markdown files
vim.wo.cursorline = O.cursorline -- set highlighting of the current line opt.fileencoding = "utf-8" -- the encoding written to a file
vim.o.showtabline = 2 -- Always show tabs opt.guifont = "monospace:h17" -- the font used in graphical neovim applications
vim.o.showmode = false -- We don't need to see things like -- INSERT -- anymore opt.hidden = O.hidden_files -- required to keep multiple buffers and open multiple buffers
vim.o.backup = false -- This is recommended by coc opt.hlsearch = O.hl_search -- highlight all matches on previous search pattern
vim.o.writebackup = false -- This is recommended by coc opt.ignorecase = O.ignore_case -- ignore case in search patterns
vim.o.swapfile = false -- Do not write any swp files opt.mouse = "a" -- allow the mouse to be used in neovim
vim.o.undodir = CACHE_PATH .. '/undo' -- Set undo directory opt.pumheight = 10 -- pop up menu height
vim.o.undofile = true -- Enable persistent undo opt.showmode = false -- we don't need to see things like -- INSERT -- anymore
vim.wo.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time opt.showtabline = 2 -- always show tabs
vim.o.updatetime = 300 -- Faster completion opt.smartcase = O.smart_case -- smart case
vim.o.timeoutlen = O.timeoutlen -- By default timeoutlen is 1000 ms opt.smartindent = true -- make indenting smarter again
vim.o.clipboard = "unnamedplus" -- Copy paste between vim and everything else opt.splitbelow = true -- force all horizontal splits to go below current window
-- vim.g.nvim_tree_disable_netrw = O.nvim_tree_disable_netrw -- enable netrw for remote gx gf support (must be set before plugin's packadd) opt.splitright = true -- force all vertical splits to go to the right of current window
vim.cmd('filetype plugin on') -- filetype detection opt.swapfile = false -- creates a swapfile
-- vim.o.guifont = "JetBrainsMono\\ Nerd\\ Font\\ Mono:h18" opt.termguicolors = true -- set term gui colors (most terminals support this)
-- vim.o.guifont = "Hack\\ Nerd\\ Font\\ Mono" opt.timeoutlen = O.timeoutlen -- time to wait for a mapped sequence to complete (in milliseconds)
-- vim.o.guifont = "SauceCodePro Nerd Font:h17" opt.title = true -- set the title of window to the value of the titlestring
vim.o.guifont = "FiraCode Nerd Font:h17" opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will be set to
opt.undodir = CACHE_PATH .. '/undo' -- set an undo directory
opt.undofile = true -- enable persisten undo
opt.updatetime = 300 -- faster completion
opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
opt.expandtab = true -- convert tabs to spaces
opt.shiftwidth = 4 -- the number of spaces inserted for each indentation
opt.shortmess:append("c") -- don't pass messages to |ins-completion-menu|
opt.tabstop = 4 -- insert 4 spaces for a tab
opt.cursorline = O.cursorline -- highlight the current line
opt.number = O.number -- set numbered lines
opt.relativenumber = O.relative_number -- set relative numbered lines
opt.signcolumn = "yes" -- always show the sign column, otherwise it would shift the text each time
opt.wrap = O.wrap_lines -- display lines as one long line
-- vim.o.guifont = "JetBrains\\ Mono\\ Regular\\ Nerd\\ Font\\ Complete"
vim.o.ignorecase = O.ignore_case
vim.o.smartcase = O.smart_case

View file

@ -18,6 +18,7 @@ O.leader_key = ' '
O.ignore_case = true O.ignore_case = true
O.smart_case = true O.smart_case = true
O.lushmode = false O.lushmode = false
O.transparent_window = false
-- After changing plugin config it is recommended to run :PackerCompile -- After changing plugin config it is recommended to run :PackerCompile
O.plugin.hop.active = false O.plugin.hop.active = false