Nuked neovim config to start fresh

This commit is contained in:
2021-11-23 19:41:00 +03:00
parent 9e2c64e48e
commit bf9195389b
12 changed files with 0 additions and 428 deletions

View File

@@ -1,13 +0,0 @@
require("nvim-tree").setup({
open_on_setup = true,
hijack_cursor = true,
update_cwd = true,
update_focused_file = { enable = true },
view = { width = 30, side = "left", auto_resize = true },
filters = { custom = { ".git" } }
})
vim.g.nvim_tree_add_trailing = 1
vim.g.nvim_tree_indent_markers = 1
vim.g.nvim_tree_show_icons = { git = 0, folders = 0, files = 0, folder_arrows = 0 }

View File

@@ -1,37 +0,0 @@
vim.o.tabstop = 2
vim.o.shiftwidth = 2
vim.o.expandtab = true
vim.o.autoindent = true
vim.o.number = true
vim.o.relativenumber = true
vim.o.wrap = true
vim.o.swapfile = true
vim.o.encoding = "utf-8"
vim.o.hidden = true
vim.o.writebackup = false
vim.o.cmdheight = 2
vim.o.updatetime = 300
vim.o.shortmess = "filnxtToOFc"
vim.o.mouse = "a"
vim.o.cursorline = true
vim.o.clipboard = "unnamedplus"
vim.o.splitright = true
vim.o.splitbelow = true
vim.o.termguicolors = true
vim.o.signcolumn = "yes"
vim.g.mapleader = " "
-- Highlight on yank
vim.api.nvim_exec([[
augroup YankHighlight
autocmd!
autocmd TextYankPost * silent! lua vim.highlight.on_yank{higroup="IncSearch", timeout=700}
augroup end
]], false)
-- Automatically formatting buffer on save
vim.api.nvim_command("autocmd BufWritePre * lua vim.lsp.buf.formatting_sync(nil, 100)")
vim.cmd('command! ToggleBackground lua require("utils").toggleBackground()')

View File

@@ -1,107 +0,0 @@
local lsp_installer = require("nvim-lsp-installer")
local cmp = require("cmp")
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-y>'] = cmp.config.disable,
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm({ select = true, behavior = cmp.SelectBehavior.Insert }),
['<C-j>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
['<C-k>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
['<TAB>'] = cmp.mapping.confirm({ behavior = cmp.SelectBehavior.Insert })
},
sources = { { name = "nvim_lsp" }, { name = "luasnip" }, { name = "nvim_lua" }, { name = "path" }, { name = "buffer", keyword_length = 5 } },
completion = { completeopt = "menu,menuone,noselect,noinsert" },
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]", nvim_lsp = "[LSP]", luasnip = "[Snippet]", nvim_lua = "[Lua]", path = "[File]" })[entry.source.name]
return vim_item
end
},
experimental = { ghost_text = true },
documentation = { border = { "", "", "", "", "", "", "", "" }, zindex = 999 }
})
local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
lsp_installer.on_server_ready(function(server)
local opts = { capabilities = capabilities }
if server.name == "sumneko_lua" then
opts = {
capabilities = capabilities,
settings = {
Lua = {
runtime = { version = "LuaJIT", path = vim.split(package.path, ";") },
diagnostics = { globals = { "vim" } },
workspace = {
library = {
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
[vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true,
[vim.fn.expand("$HOME/.local/share/nvim/site/pack/packer/start")] = true
}
}
}
}
}
end
if server.name == "efm" then
opts = {
capabilities = capabilities,
init_options = { documentFormatting = true },
filetypes = { "lua" },
settings = {
rootMarkers = { ".git/" },
languages = {
lua = {
{
formatCommand = "lua-format -i --no-keep-simple-function-one-line --no-break-after-operator --column-limit=150 --break-after-table-lb --tab-width 2 --indent-width 2 --spaces-inside-table-braces",
formatStdin = true
}
}
}
}
}
end
require("lsp_signature").setup({ bind = true })
server:setup(opts)
end)

View File

@@ -1,25 +0,0 @@
-- Tabs
require("bufferline").setup()
-- Statusline
require("lualine").setup()
require("nvim-autopairs").setup()
require("colorizer").setup()
-- Git
require("gitsigns").setup({
current_line_blame = true,
current_line_blame_opts = { virt_text = true, virt_text_pos = "eol", delay = 500 },
keymaps = {
noremap = true,
["n <leader>gs"] = '<cmd>lua require("gitsigns").stage_hunk()<CR>',
["n <leader>gu"] = '<cmd>lua require("gitsigns").undo_stage_hunk()<CR>',
["n <leader>gr"] = '<cmd>lua require("gitsigns").reset_hunk()<CR>'
}
})
require("iswap").setup({ keys = "1234567890", autoswap = true })
require("focus").setup()

View File

@@ -1,96 +0,0 @@
return require("packer").startup(function(use)
use("wbthomason/packer.nvim")
-- Colorschemes
use({ "ayu-theme/ayu-vim" })
-- Treesitter
use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" })
use({ "p00f/nvim-ts-rainbow" })
use({ "windwp/nvim-ts-autotag" })
use({ "JoosepAlviste/nvim-ts-context-commentstring" })
use({ "nvim-treesitter/playground" })
use({
"folke/twilight.nvim",
config = function()
require("twilight").setup({})
end
})
use({
"folke/zen-mode.nvim",
config = function()
require("zen-mode").setup({})
end
})
-- Make commenting code great
use({ "tpope/vim-commentary" })
-- File tree
use({ "kyazdani42/nvim-tree.lua", requires = { "kyazdani42/nvim-web-devicons" } })
-- Telescope
use({ "nvim-telescope/telescope.nvim", requires = { "nvim-lua/plenary.nvim" } })
use({ "nvim-telescope/telescope-symbols.nvim" })
-- Automatically close brackets and quotes
use({ "windwp/nvim-autopairs" })
-- LSP
use({ "neovim/nvim-lspconfig", "williamboman/nvim-lsp-installer", "onsails/lspkind-nvim" })
use({
"hrsh7th/nvim-cmp",
requires = {
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", "hrsh7th/cmp-cmdline", "hrsh7th/cmp-nvim-lua", "saadparwaiz1/cmp_luasnip"
}
})
-- Snippets
use({ "L3MON4D3/LuaSnip" })
use({ "rafamadriz/friendly-snippets" })
-- Signature like in vscode
use({ "ray-x/lsp_signature.nvim" })
-- Tabs
use({ "akinsho/bufferline.nvim", requires = { "kyazdani42/nvim-web-devicons" } })
-- Terminal
use({ "caenrique/nvim-toggle-terminal" })
-- Statusline
use({ "nvim-lualine/lualine.nvim", requires = { "kyazdani42/nvim-web-devicons", opt = true } })
-- Git
use({ "lewis6991/gitsigns.nvim", requires = { "nvim-lua/plenary.nvim" } })
use({ "tpope/vim-fugitive" })
use({ "fatih/vim-go", ft = { "go", "gomod" } })
use({ "iamcco/markdown-preview.nvim", run = "cd app && yarn install" })
-- Highlight colors in editor
use({ "norcalli/nvim-colorizer.lua" })
-- Show indent lines
use({
"lukas-reineke/indent-blankline.nvim",
config = function()
vim.cmd("let g:indent_blankline_filetype_exclude = ['help']")
require("indent_blankline").setup({ char = "|", buftype_exclude = { "terminal" } })
end
})
-- Fast movement
use({
"ggandor/lightspeed.nvim",
config = function()
require("lightspeed").setup()
end
})
-- Window management
use({ "beauwilliams/focus.nvim" })
use({ "mizlan/iswap.nvim" })
end)

View File

@@ -1,84 +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
local function imap(shortcut, command)
map("i", shortcut, command)
end
-- Quickly save/quit vim
nmap("<leader>w", ":w<CR>")
nmap("<leader>q", ":q<CR>")
nmap("<leader>e", ":bdelete<CR>")
-- Move line under the cursor up and down
nmap("<C-k>", ":m .-2<CR>==")
nmap("<C-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", "<cmd>lua vim.lsp.buf.hover()<CR>")
nmap("gd", "<cmd>lua vim.lsp.buf.definition()<CR>")
nmap(".", "<cmd>lua vim.lsp.buf.code_action()<CR>")
nmap("<F2>", "<cmd>lua vim.lsp.buf.rename()<CR>")
-- Tabs
nmap("<leader>1", ":BufferLineGoToBuffer 1<CR>")
nmap("<leader>2", ":BufferLineGoToBuffer 2<CR>")
nmap("<leader>3", ":BufferLineGoToBuffer 3<CR>")
nmap("<leader>4", ":BufferLineGoToBuffer 4<CR>")
nmap("<leader>5", ":BufferLineGoToBuffer 5<CR>")
nmap("<leader>6", ":BufferLineGoToBuffer 6<CR>")
nmap("<leader>7", ":BufferLineGoToBuffer 7<CR>")
nmap("<leader>8", ":BufferLineGoToBuffer 8<CR>")
nmap("<leader>9", ":BufferLineGoToBuffer 9<CR>")
-- Terminal
nmap("<leader>t", ":ToggleTerminal<CR>")
-- Git
nmap("<leader>gg", ":G<CR>")
-- Iswap
nmap("<leader>sw", ":ISwap<CR>")
-- Zen mode
nmap("zz", ":ZenMode<CR>")

View File

@@ -1,10 +0,0 @@
local ls = require("luasnip")
-- local parse = ls.parser.parse_snippet
ls.config.set_config({
history = true,
-- Update more often, :h events for more info.
updateevents = "TextChanged,TextChangedI"
})
require("luasnip/loaders/from_vscode").lazy_load()

View File

@@ -1,2 +0,0 @@
require("telescope").setup({ defaults = { sorting_strategy = "ascending", file_ignore_patterns = { ".git", "node_modules" } } })

View File

@@ -1,25 +0,0 @@
local function set_highlight(group, options)
local bg = options.bg == nil and '' or 'guibg=' .. options.bg
local fg = options.fg == nil and '' or 'guifg=' .. options.fg
local gui = options.gui == nil and '' or 'gui=' .. options.gui
vim.cmd(string.format('hi %s %s %s %s', group, bg, fg, gui))
end
vim.cmd([[
let ayucolor = "mirage"
colorscheme ayu
]])
-- Remove highlighting in signcolumn
vim.cmd("highlight clear SignColumn")
-- Autocompletion menu
set_highlight("CmpItemMenu", { fg = "DarkGrey" })
set_highlight("Pmenu", { bg = "#191e2a", fg = "#cbccc6" })
set_highlight("PmenuSel", { bg = "#cbccc6", fg = "#ffa754" })
set_highlight("PmenuThumb", { bg = "#ffa754" })
set_highlight("Comment", { gui = "italic" })
-- Diagnostics
set_highlight("DiagnosticVirtualTextError", { fg = "DarkRed" })

View File

@@ -1,6 +0,0 @@
require("nvim-treesitter.configs").setup({
highlight = { enable = true },
rainbow = { enable = true, extended_mode = true, disable = { "html" } },
autotag = { enable = true },
context_commentstring = { enable = true }
})

View File

@@ -1,11 +0,0 @@
local M = {}
M.toggleBackground = function()
if vim.opt.background:get() == "dark" then
vim.opt.background = "light"
else
vim.opt.background = "dark"
end
end
return M