Remove old neovim config
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
local function prettierd()
|
||||
return {
|
||||
exe = "prettierd",
|
||||
args = {vim.api.nvim_buf_get_name(0)},
|
||||
stdin = true
|
||||
}
|
||||
end
|
||||
|
||||
local function luaformat()
|
||||
return {
|
||||
exe = "lua-format",
|
||||
args = {vim.api.nvim_buf_get_name(0)},
|
||||
stdin = true
|
||||
}
|
||||
end
|
||||
|
||||
local function gofmt()
|
||||
return {exe = "gofmt", args = {vim.api.nvim_buf_get_name(0)}, stdin = true}
|
||||
end
|
||||
|
||||
local function goimports()
|
||||
return {
|
||||
exe = "goimports",
|
||||
args = {vim.api.nvim_buf_get_name(0)},
|
||||
stdin = true
|
||||
}
|
||||
end
|
||||
|
||||
require("formatter").setup({
|
||||
filetype = {
|
||||
javascript = {prettierd},
|
||||
javascriptreact = {prettierd},
|
||||
typescript = {prettierd},
|
||||
typescriptreact = {prettierd},
|
||||
html = {prettierd},
|
||||
css = {prettierd},
|
||||
scss = {prettierd},
|
||||
json = {prettierd},
|
||||
svelte = {prettierd},
|
||||
lua = {luaformat},
|
||||
go = {gofmt, goimports}
|
||||
}
|
||||
})
|
||||
|
||||
vim.cmd(
|
||||
[[autocmd BufWritePost *.js,*.jsx,*.ts,*.tsx,*.html,*.css,*.scss,*.json,*.svelte,*.lua,*.go FormatWrite]])
|
||||
@@ -1,174 +0,0 @@
|
||||
local lsp_installer = require("nvim-lsp-installer")
|
||||
local cmp = require("cmp")
|
||||
local configs = require("lspconfig.configs")
|
||||
local nvim_lsp = require("lspconfig")
|
||||
|
||||
local kind_icons = {
|
||||
Text = "",
|
||||
Method = "",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "",
|
||||
Variable = "",
|
||||
Class = "ﴯ",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "ﰠ",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = ""
|
||||
}
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args) require("luasnip").lsp_expand(args.body) end
|
||||
},
|
||||
mapping = {
|
||||
["<C-j>"] = cmp.mapping.select_next_item({
|
||||
behavior = cmp.SelectBehavior.Select
|
||||
}),
|
||||
["<C-k>"] = cmp.mapping.select_prev_item({
|
||||
behavior = cmp.SelectBehavior.Select
|
||||
}),
|
||||
["<C-space>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.close()
|
||||
else
|
||||
cmp.complete()
|
||||
end
|
||||
end),
|
||||
-- ["<CR>"] = cmp.mapping.confirm({
|
||||
-- select = true,
|
||||
-- behavior = cmp.SelectBehavior.Insert
|
||||
-- }),
|
||||
["<TAB>"] = cmp.mapping.confirm({
|
||||
select = true,
|
||||
behavior = cmp.SelectBehavior.Insert
|
||||
})
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{name = "nvim_lsp", trigger_characters = {".", "!", "#", ">", "*"}},
|
||||
{name = "luasnip"}, {name = "nvim_lua"}
|
||||
}, {{name = "path"}, {name = "buffer"}}),
|
||||
completion = {completeopt = "menu,menuone,noselect,noinsert,preview"},
|
||||
experimental = {ghost_text = true},
|
||||
sorting = {
|
||||
comparators = {
|
||||
cmp.config.compare.score, cmp.config.compare.sort_text,
|
||||
cmp.config.compare.kind
|
||||
}
|
||||
},
|
||||
documentation = {
|
||||
border = {"╭", "─", "╮", "│", "╯", "─", "╰", "│"},
|
||||
zindex = 999
|
||||
},
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind],
|
||||
vim_item.kind)
|
||||
vim_item.menu = ({
|
||||
buffer = "[Buffer]",
|
||||
luasnip = "[Snippet]",
|
||||
nvim_lua = "[Lua]",
|
||||
path = "[File]"
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
vim.cmd([[
|
||||
highlight! CmpItemAbbrDeprecated guibg=NONE gui=strikethrough guifg=#808080
|
||||
]])
|
||||
|
||||
cmp.setup.cmdline("/", {sources = {{name = "buffer"}}})
|
||||
|
||||
cmp.setup.cmdline(":", {sources = {{name = "path"}, {name = "cmdline"}}})
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp
|
||||
.protocol
|
||||
.make_client_capabilities())
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
local function setupLspSignature()
|
||||
require("lsp_signature").setup({
|
||||
bind = true,
|
||||
hint_enable = false,
|
||||
handler_opts = {border = "rounded"}
|
||||
})
|
||||
end
|
||||
|
||||
lsp_installer.on_server_ready(function(server)
|
||||
local opts = {capabilities = capabilities}
|
||||
|
||||
if server.name == "sumneko_lua" then
|
||||
local runtime_path = vim.split(package.path, ';')
|
||||
table.insert(runtime_path, "lua/?.lua")
|
||||
table.insert(runtime_path, "lua/?/init.lua")
|
||||
|
||||
opts.settings = {
|
||||
Lua = {
|
||||
runtime = {version = "LuaJIT", path = runtime_path},
|
||||
diagnostics = {globals = {"vim"}},
|
||||
workspace = {library = vim.api.nvim_get_runtime_file("", true)},
|
||||
telemetry = {enable = false}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
if server.name == "tsserver" then
|
||||
opts.filetypes = {
|
||||
"javascript", "javascriptreact", "typescript", "typescriptreact",
|
||||
"svelte", "html"
|
||||
}
|
||||
end
|
||||
|
||||
setupLspSignature()
|
||||
|
||||
server:setup(opts)
|
||||
end)
|
||||
|
||||
-- Use this emmet lsp - https://github.com/pedro757/emmet
|
||||
if not configs.ls_emmet then
|
||||
configs.ls_emmet = {
|
||||
default_config = {
|
||||
cmd = {'ls_emmet', '--stdio'},
|
||||
filetypes = {
|
||||
'html', 'css', 'scss', 'javascriptreact', 'typescriptreact',
|
||||
'haml', 'xml', 'xsl', 'pug', 'slim', 'sass', 'stylus', 'less',
|
||||
'sss'
|
||||
},
|
||||
root_dir = function(fname) return vim.loop.cwd() end,
|
||||
settings = {}
|
||||
}
|
||||
}
|
||||
end
|
||||
nvim_lsp.ls_emmet.setup({capabilities = capabilities})
|
||||
|
||||
nvim_lsp.gopls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = function() setupLspSignature() end,
|
||||
settings = {
|
||||
gopls = {
|
||||
experimentalPostfixCompletions = true,
|
||||
analyses = {unusedparams = true, shadow = true},
|
||||
staticcheck = true
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
require("luasnip/loaders/from_vscode").load({
|
||||
include = {"javascript", "typescript", "go", "html"}
|
||||
})
|
||||
@@ -1,71 +0,0 @@
|
||||
local function map(mode, shortcut, command)
|
||||
vim.api.nvim_set_keymap(mode, shortcut, command,
|
||||
{noremap = true, silent = true})
|
||||
end
|
||||
|
||||
local function nmap(shortcut, command) map("n", shortcut, command) end
|
||||
|
||||
local function vmap(shortcut, command) map("v", shortcut, command) end
|
||||
|
||||
-- Quickly save/quit vim
|
||||
nmap("<leader>w", ":w<CR>")
|
||||
nmap("<leader>q", ":q<CR>")
|
||||
|
||||
-- Move line under the cursor up and down
|
||||
nmap("<A-k>", ":m .-2<CR>==")
|
||||
nmap("<A-j>", ":m .+1<CR>==")
|
||||
vmap("K", ":m '<-2<CR>gv=gv")
|
||||
vmap("J", ":m '>+1<CR>gv=gv")
|
||||
|
||||
-- Remove search highlighting
|
||||
nmap("<leader>nh", ":nohl<CR>")
|
||||
|
||||
-- Escape from terminal
|
||||
map("t", "<ESC>", "<C-\\><C-n>")
|
||||
|
||||
-- Open splits
|
||||
nmap("<leader>sv", ":vs<CR>")
|
||||
nmap("<leader>sh", ":sp<CR>")
|
||||
|
||||
-- Move focus between splits
|
||||
nmap("<leader>h", "<C-w>h")
|
||||
nmap("<leader>j", "<C-w>j")
|
||||
nmap("<leader>k", "<C-w>k")
|
||||
nmap("<leader>l", "<C-w>l")
|
||||
|
||||
-- Resize splits
|
||||
nmap("<C-j>", ":resize -2<CR>")
|
||||
nmap("<C-k>", ":resize +2<CR>")
|
||||
nmap("<C-h>", ":vert resize -10<CR>")
|
||||
nmap("<C-l>", ":vert resize +10<CR>")
|
||||
|
||||
-- File Tree
|
||||
nmap("<leader>b", ":NvimTreeToggle<CR>")
|
||||
|
||||
-- Telescope
|
||||
nmap("<leader>p", ":Telescope<CR>")
|
||||
nmap("<leader>f", ":Telescope find_files<CR>")
|
||||
|
||||
-- LSP
|
||||
nmap("K", ":lua vim.lsp.buf.hover()<CR>")
|
||||
nmap("gd", ":lua vim.lsp.buf.definition()<CR>")
|
||||
nmap("gr", ":lua vim.lsp.buf.references()<CR>")
|
||||
nmap("<leader>.", ":lua vim.lsp.buf.code_action()<CR>")
|
||||
nmap("<F2>", ":lua vim.lsp.buf.rename()<CR>")
|
||||
|
||||
-- Tabs
|
||||
nmap("<leader>1", ":BufferGoto 1<CR>")
|
||||
nmap("<leader>2", ":BufferGoto 2<CR>")
|
||||
nmap("<leader>3", ":BufferGoto 3<CR>")
|
||||
nmap("<leader>4", ":BufferGoto 4<CR>")
|
||||
nmap("<leader>5", ":BufferGoto 5<CR>")
|
||||
nmap("<leader>6", ":BufferGoto 6<CR>")
|
||||
nmap("<leader>7", ":BufferGoto 7<CR>")
|
||||
nmap("<leader>8", ":BufferGoto 8<CR>")
|
||||
nmap("<leader>9", ":BufferGoto 9<CR>")
|
||||
nmap("<leader>e", ":BufferClose<CR>")
|
||||
|
||||
-- Git
|
||||
nmap("<leader>gg", ":G | :resize -10<CR>")
|
||||
|
||||
nmap("<leader>t", ":ToggleTerminal<CR>")
|
||||
@@ -1,21 +0,0 @@
|
||||
local function line_and_column()
|
||||
local line, column = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
|
||||
return "Ln " .. line .. ", Col " .. column
|
||||
end
|
||||
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
component_separators = {left = "", right = ""},
|
||||
section_separators = {left = "", right = ""},
|
||||
disabled_filetypes = {"NvimTree"}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {"branch", "diff", "filename"},
|
||||
lualine_x = {line_and_column, "encoding"},
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
}
|
||||
})
|
||||
@@ -1,16 +0,0 @@
|
||||
-- General
|
||||
vim.cmd([[
|
||||
hi Comment gui=italic
|
||||
]])
|
||||
|
||||
-- File tree
|
||||
vim.cmd([[
|
||||
hi NvimTreeGitNew guibg=green
|
||||
hi NvimTreeGitStaged guibg=lightgreen
|
||||
hi NvimTreeGitDeleted guibg=red
|
||||
hi NvimTreeGitDirty guibg=lightblue
|
||||
hi NvimTreeGitMerge guibg=yellow
|
||||
hi NvimTreeGitIgnored guibg=gray
|
||||
|
||||
hi NvimTreeOpenedFolderName gui=italic,bold
|
||||
]])
|
||||
Reference in New Issue
Block a user