Browse Source

bash language server support

macos
Juni Kim 2 years ago
parent
commit
cfc94b7985
  1. 19
      after/plugin/lsp.lua
  2. 27
      after/plugin/telescope.lua
  3. 4
      lua/junikim/init.lua
  4. 17
      lua/junikim/options.lua
  5. 2
      lua/junikim/packer.lua
  6. 2
      lua/junikim/remap.lua
  7. 5
      plugin/packer_compiled.lua

19
after/plugin/lsp.lua

@ -1,6 +1,7 @@
-- Learn the keybindings, see :help lsp-zero-keybindings
-- Learn to configure LSP servers, see :help lsp-zero-api-showcase
local lsp = require('lsp-zero')
local lspconfig = require('lspconfig');
lsp.preset('recommended')
-- (Optional) Configure lua language server for neovim
@ -11,7 +12,17 @@ lsp.ensure_installed({
'tsserver',
'texlab',
'pyright',
'sumneko_lua'
'sumneko_lua',
'efm'
})
lsp.configure("efm", {
settings = {
languages = {
sh = "shellcheck -x"
}
},
filetypes = { "sh" }
})
lsp.on_attach(function(client, bufnr)
@ -20,3 +31,9 @@ lsp.on_attach(function(client, bufnr)
end)
lsp.setup()
vim.diagnostic.config({
virtual_text = true,
underline = true,
float = true,
})

27
after/plugin/telescope.lua

@ -1,5 +1,30 @@
local builtin = require("telescope.builtin")
vim.keymap.set('n', '<C-P>', builtin.git_files, {})
local function git_exists()
local path = require("pl.path")
local p = "."
while true do
local gitpath = p .. "/.git"
local d = io.open(gitpath)
if d then
d:close()
return true
else
p = p .. "/.."
end
if path.abspath(p) ~= "/" then
return false
end
end
end
vim.keymap.set('n', '<C-P>', function()
if git_exists() then
builtin.git_files()
else
builtin.find_files()
end
end, {})
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})

4
lua/junikim/init.lua

@ -1,3 +1,3 @@
require("junikim.remap")
require("junikim.options")
require("junikim.packer")
require("junikim.options")
require("junikim.remap")

17
lua/junikim/options.lua

@ -1,3 +1,4 @@
vim.opt.mouse:append('a')
vim.opt.number = true
vim.opt.linebreak = true
vim.opt.shiftwidth = 2
@ -5,13 +6,17 @@ vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.opt.expandtab = true
vim.opt.smarttab = true
vim.opt.shiftround = true
vim.opt.autoindent = true
vim.opt.textwidth = 80
vim.opt.colorcolumn = "80"
vim.opt.list = true
vim.g.airline_theme = "base16_chalk"
--vim.g.airline_powerline_fonts = 1
vim.g.airline_powerline_fonts = 1
vim.cmd("filetype plugin indent on")
vim.cmd("filetype on")
vim.api.nvim_create_autocmd("FileType", {
pattern = "python",
@ -27,7 +32,7 @@ vim.api.nvim_create_autocmd("FileType", {
vim.api.nvim_create_autocmd("FileType", {
pattern = { "markdown", "tex", "text" },
callback = function(args)
vim.bo.expandtab = false
vim.o.smarttab = false
vim.bo.autoindent = false
end
})
@ -48,6 +53,14 @@ vim.api.nvim_create_autocmd("FileType", {
vim.bo.softtabstop = 4
vim.bo.preserveindent = true
vim.bo.copyindent = true
vim.bo.formatprg = "gofmt -e -w"
vim.api.nvim_set_keymap("n", "<F4>", ":w|:!cpgo test<CR>", { noremap = true })
end
})
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = { "*.go", "*.py", "*.lua", "*.ts", "*.tsx", "*.js", "*.md", "*.json" },
callback = function(args)
vim.lsp.buf.formatting_sync()
end
})

2
lua/junikim/packer.lua

@ -3,6 +3,8 @@ vim.cmd [[packadd packer.nvim]]
return require('packer').startup(function(use)
-- Packer can manage itself
use 'wbthomason/packer.nvim'
use 'tpope/vim-sensible'
use_rocks 'penlight'
use {
'nvim-telescope/telescope.nvim', tag = '0.1.1',
requires = { { 'nvim-lua/plenary.nvim' } }

2
lua/junikim/remap.lua

@ -1,4 +1,4 @@
function map(mode, lhs, rhs, opts)
local function map(mode, lhs, rhs, opts)
local options = { noremap = true }
if opts then
options = vim.tbl_extend("force", options, opts)

5
plugin/packer_compiled.lua

@ -196,6 +196,11 @@ _G.packer_plugins = {
path = "/home/junikim/.local/share/nvim/site/pack/packer/start/vim-autoclose",
url = "https://github.com/Townk/vim-autoclose"
},
["vim-sensible"] = {
loaded = true,
path = "/home/junikim/.local/share/nvim/site/pack/packer/start/vim-sensible",
url = "https://github.com/tpope/vim-sensible"
},
vimtex = {
loaded = true,
path = "/home/junikim/.local/share/nvim/site/pack/packer/start/vimtex",

Loading…
Cancel
Save