update(nvim): redo all configurations, keep things at minimal.

This commit is contained in:
juancwu 2022-12-18 17:51:29 -05:00
commit ffe7ed8f1e
No known key found for this signature in database
37 changed files with 434 additions and 693 deletions

1
.config/nvim/.gitignore vendored Normal file
View file

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

View file

@ -1,6 +1,7 @@
local status, autopairs = pcall(require, 'nvim-autopairs') local status, autopairs = pcall(require, "nvim-autopairs")
if not status then return end if not status then return end
autopairs.setup { autopairs.setup({
disable_filetype = { 'TelescopePrompt', 'vim' } disable_filetype = { "TelescopePrompt", "vim" }
} })

View file

@ -1,36 +0,0 @@
local status, bufferline = pcall(require, 'bufferline')
if not status then return end
bufferline.setup {
options = {
mode = 'tabs',
separator_style = 'slant',
always_show_bufferline = false,
show_buffer_close_icons = false,
show_close_icon = false,
color_icons = true
},
highlights = {
separator = {
fg = "#073642",
bg = "#002b36",
},
separator_selected = {
fg = "#073642"
},
background = {
fg = "#657b83",
bg = "#002b36"
},
fill = {
bg = "#073642"
},
buffer_selected = {
bg = "#fdf6e3",
bold = true
}
}
}
vim.api.nvim_set_keymap('n', '<Tab>', '<Cmd>BufferLineCycleNext<CR>', {})
vim.api.nvim_set_keymap('n', '<S-Tab>', '<Cmd>BufferLineCyclePrev<CR>', {})

View file

@ -1,34 +0,0 @@
local status, cmp = pcall(require, 'cmp')
if not status then return end
local lspkind = require('lspkind')
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end
},
mapping = cmp.mapping.preset.insert({
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true
}),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'buffer' }
}),
formatting = {
format = lspkind.cmp_format({ with_text = false, maxwidth = 50 })
}
})
vim.cmd [[
set completeopt=menuone,noinsert,noselect
highlight! default link CmpItemKind CmpItemMenuDefault
]]

View file

@ -1,6 +1,9 @@
local status, colorizer = pcall(require, 'colorizer') local status, colorizer = pcall(require, 'colorizer')
if not status then return end if not status then return end
colorizer.setup({ colorizer.setup({
'*'; '*';
}) })

View file

@ -0,0 +1,27 @@
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
local juancwu_fugitive = vim.api.nvim_create_augroup("juancwu_fugitive", {})
vim.api.nvim_create_autocmd("BufWinEnter", {
group = juancwu_fugitive,
pattern = "*",
callback = function()
if vim.bo.ft ~= "fugitive" then
return
end
local bufnr = vim.api.nvim_get_current_buf()
local opts = { buffer = bufnr, remap = false }
vim.keymap.set("n", "<leader>p", function ()
vim.cmd.Git("push")
end, opts)
vim.keymap.set("n", "<leader>P", function ()
vim.cmd.Git({"pull", "--rebase"})
end, opts)
-- setup an upstream for first pushes to a branch
vim.keymap.set("n", "<leader>u", ":Git push -u origin ", opts)
end
})

View file

@ -0,0 +1,17 @@
local status, mark = pcall(require, "harpoon.mark")
if not status then return end
local status, ui = pcall(require, "harpoon.ui")
if not status then return end
vim.keymap.set("n", "<leader>a", mark.add_file)
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
vim.keymap.set("n", "<leader>q", function() ui.nav_file(1) end)
vim.keymap.set("n", "<leader>w", function() ui.nav_file(2) end)
vim.keymap.set("n", "<leader>e", function() ui.nav_file(3) end)
vim.keymap.set("n", "<leader>r", function() ui.nav_file(4) end)
vim.keymap.set("n", "<leader>,", ui.nav_prev)
vim.keymap.set("n", "<leader>.", ui.nav_next)

View file

@ -0,0 +1,10 @@
local status, lsp = pcall(require, "lsp-zero")
if not status then return end
lsp.preset("recommended")
lsp.setup()
lsp.on_attach(function(_, buffnr)
vim.keymap.set("n", "<C-s>", vim.lsp.buf.signature_help, { buffer = buffnr })
end)

View file

@ -1,49 +0,0 @@
require('lspkind').init({
-- DEPRECATED (use mode instead): enables text annotations
--
-- default: true
-- with_text = true,
-- defines how annotations are shown
-- default: symbol
-- options: 'text', 'text_symbol', 'symbol_text', 'symbol'
mode = 'symbol_text',
-- default symbol map
-- can be either 'default' (requires nerd-fonts font) or
-- 'codicons' for codicon preset (requires vscode-codicons font)
--
-- default: 'default'
preset = 'codicons',
-- override preset symbols
--
-- default: {}
symbol_map = {
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 = ""
},
})

View file

@ -0,0 +1,18 @@
local juancwu_markdown = vim.api.nvim_create_augroup("juancwu_markdown", {})
vim.api.nvim_create_autocmd("BufWinEnter", {
group = juancwu_markdown,
pattern = "*",
callback = function()
if vim.bo.ft ~= "markdown" then
return
end
local bufnr = vim.api.nvim_get_current_buf()
local opts = { buffer = bufnr, remap = false }
vim.keymap.set("n", "<C-m>p", vim.cmd.MarkdownPreview, opts)
vim.keymap.set("n", "<C-m>s", vim.cmd.MarkdownPreviewStop, opts)
vim.keymap.set("n", "<C-m>t", vim.cmd.MarkdownPreviewToggle, opts)
end
})

View file

@ -1,12 +0,0 @@
local status, mason = pcall(require, 'mason')
if not status then return end
local status2, lspconfig = pcall(require, 'mason-lspconfig')
if not status2 then return end
mason.setup {}
lspconfig.setup {
ensure_installed = {
'tailwindcss'
}
}

View file

@ -2,9 +2,7 @@ local status, n = pcall(require, "neosolarized")
if not status then return end if not status then return end
n.setup({ n.setup({ comment_italics = true })
comment_italics = true,
})
local cb = require("colorbuddy.init") local cb = require("colorbuddy.init")
local Color = cb.Color local Color = cb.Color
@ -14,22 +12,20 @@ local groups = cb.groups
local styles = cb.styles local styles = cb.styles
Color.new("black", "#000000") Color.new("black", "#000000")
Group.new("CursorLine", colors.none, colors.base03, styles.none, colors.base1) Group.new("CursorLine", colors.none, colors.base03, styles.NONE, colors.base1)
Group.new("CursorLineNr", colors.yellow, colors.black, styles.none, colors.base1) Group.new("CursorLineNr", colors.yellow, colors.black, styles.NONE, colors.base1)
Group.new("Visual", colors.none, colors.base03, styles.reverse) Group.new("Visual", colors.none, colors.base03, styles.reverse)
local cError = groups.Error.fg -- local cError = groups.Error.fg
local cInfo = groups.Information.fg -- local cInfo = groups.Information.fg
local cWarn = groups.Warning.fg -- local cWarn = groups.Warning.fg
local cHint = groups.Hint.fg -- local cHint = groups.Hint.fg
Group.new("DiagnosticVirtualTextError", cError, cError:dark():dark():dark():dark(), styles.none)
Group.new("DiagonsticVirtualTextInfo", cInfo, cInfo:dark():dark():dark(), styles.none)
Group.new("DiagnosticVirtualTextWarn", cWarn, cWarn:dark():dark():dark(), styles.none)
Group.new("DiagnosticVirtualTextHint", cHint, cHint:dark():dark():dark(), styles.none)
Group.new("DiagnosticUnderlineError", colors.none, colors.none, styles.undercurl, cError)
Group.new("DiagnosticUnderlineWarn", colors.none, colors.none, styles.undercurl, cWarn)
Group.new("DiagnosticUnderlineInfor", colors.none, colors.none, styles.undercurl, cInfo)
Group.new("DiagnosticUnderlineHint", colors.none, colors.none, styles.undercurl, cHint)
-- Group.new("DiagnosticVirtualTextError", cError, cError:dark():dark():dark():dark(), styles.NONE)
-- Group.new("DiagnosticVirtualTextInfo", cInfo, cInfo:dark():dark():dark(), styles.NONE)
-- Group.new("DiagnosticVirtualTextWarn", cWarn, cWarn:dark():dark():dark(), styles.NONE)
-- Group.new("DiagnosticVirtualTextHint", cHint, cHint:dark():dark():dark(), styles.NONE)
-- Group.new("DiagnosticUnderlineError", colors.none, colors.none, styles.udnercurl, cError)
-- Group.new("DiagnosticUnderlineWarn", colors.none, colors.none, styles.udnercurl, cWarn)
-- Group.new("DiagnosticUnderlineInfo", colors.none, colors.none, styles.udnercurl, cInfo)
-- Group.new("DiagnosticUnderlineHint", colors.none, colors.none, styles.udnercurl, cHint)

View file

@ -1,10 +0,0 @@
-- require('colorbuddy').colorscheme('snazzybuddy')
--
-- function toggleTheme()
-- if vim.g.background == 'dark' then
-- vim.g.background = 'light'
-- else
-- vim.g.background = 'dark'
-- end
-- require('snazzybuddy').reload()
-- end

View file

@ -1,16 +1,17 @@
local status, telescope = pcall(require, 'telescope') local status, telescope = pcall(require, "telescope")
if not status then return end if not status then return end
local actions = require('telescope.actions') local actions = require("telescope.actions")
local builtin = require('telescope.builtin') local builtin = require("telescope.builtin")
function telescope_buffer_dir() local fb_actions = require "telescope".extensions.file_browser.actions
return vim.fn.expand('%:p:h')
local function telescope_buffer_dir()
return vim.fn.expand("%:p:h")
end end
local fb_actions = require 'telescope'.extensions.file_browser.actions telescope.setup({
telescope.setup {
defaults = { defaults = {
mappings = { mappings = {
n = { n = {
@ -21,71 +22,41 @@ telescope.setup {
extensions = { extensions = {
file_browser = { file_browser = {
theme = "dropdown", theme = "dropdown",
-- disable netrw and use telescope-file-browser
hijack_netrw = true, hijack_netrw = true,
mappings = { mappings = {
['i'] = { ['i'] = {
['<C-w>'] = function() ['<C-w>'] = function() vim.cmd("normal vbd") end
vim.cmd('normal vbd')
end
}, },
['n'] = { ['n'] = {
['N'] = fb_actions.create, ['N'] = fb_actions.create,
['h'] = fb_actions.goto_parent_dir, ['h'] = fb_actions.goto_parent_dir,
['/'] = function() ['/'] = function() vim.cmd("startinsert") end,
vim.cmd('startinsert') ['D'] = fb_actions.remove
end
} }
} }
} }
} }
} })
telescope.load_extension("file_browser") telescope.load_extension("file_browser")
vim.keymap.set('n', ';f',
function()
builtin.find_files({
no_ignore = false,
hidden = true
})
end)
vim.keymap.set('n', ';r', -- Set up keymaps specific to telescope
function() vim.keymap.set("n", ";f", function()
builtin.live_grep() builtin.find_files({ no_ignore = false, hidden = true })
end) end)
vim.keymap.set("n", ";g", builtin.git_files)
vim.keymap.set('n', '\\\\', vim.keymap.set("n", "sf",
function()
builtin.buffers()
end)
vim.keymap.set('n', ';t',
function()
builtin.help_tags()
end)
vim.keymap.set('n', ';;',
function()
builtin.resume()
end)
vim.keymap.set('n', ';e',
function()
builtin.diagnostics()
end)
vim.keymap.set('n', 'sf',
function() function()
telescope.extensions.file_browser.file_browser({ telescope.extensions.file_browser.file_browser({
path = '%:p:h', path = "%:p:h",
cwd = telescope_buffer_dir(), cwd = telescope_buffer_dir(),
respect_gitignore = false, respect_gitignore = true,
hidden = true, hidden = true,
grouped = true, grouped = true,
previwer = false, previewer = false,
initial_mode = 'normal', initial_mode = "normal",
layout_config = { height = 40 } layout_config = { height = 40 }
}) })
end) end)
vim.keymap.set("n", ";h", builtin.help_tags)

View file

@ -1,31 +1,20 @@
local status, ts = pcall(require, 'nvim-treesitter.configs') local status, treesitter = pcall(require, "nvim-treesitter.configs")
if not status then return end if not status then return end
ts.setup { treesitter.setup {
-- A list of parser names, or "all"
ensure_installed = { "help", "javascript", "typescript", "c", "lua", "rust" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
highlight = { highlight = {
-- `false` will disable the whole extension
enable = true, enable = true,
disable = {},
}, },
indent = {
enable = true,
disable = {},
},
ensure_installed = {
'javascript',
'typescript',
'tsx',
'lua',
'json',
'css',
'go',
'python',
'markdown',
'html'
},
autotag = {
enable = true,
}
} }

View file

@ -1,4 +0,0 @@
local status, autotag = pcall(require, 'nvim-ts-autotag')
if not status then return end
autotag.setup {}

View file

@ -0,0 +1,18 @@
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
local has_persistent_undo = vim.api.nvim_call_function("has", { "persistent_undo" })
if has_persistent_undo then
local target_path = vim.api.nvim_call_function("expand", { "~/.undodir" })
local is_directory = vim.api.nvim_call_function("isdirectory", { target_path })
if not is_directory then
vim.api.nvim_call_function("mkdir", { target_path, "p", 0700 })
end
vim.opt.undodir = target_path
vim.opt.undofile = true
end

View file

@ -1,7 +0,0 @@
local status, icons = pcall(require, 'nvim-web-devicons')
if not status then return end
icons.setup {
override = {},
default = true
}

View file

@ -0,0 +1,7 @@
local status, zen = pcall(require, "zen-mode")
if not status then return end
zen.setup {}
vim.keymap.set("n", "<C-w>o", vim.cmd.ZenMode, { silent = true })

View file

@ -1,2 +0,0 @@
vim.bo.tabstop=4
vim.bo.shiftwidth=4

View file

@ -1,6 +1 @@
require('base') require("juancwu")
require('highlights')
require('maps')
require('clipboard')
require('plugins')
-- require('theme')

View file

@ -1,4 +0,0 @@
{
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
"Lua.workspace.checkThirdParty": false
}

View file

@ -1,38 +0,0 @@
vim.cmd("autocmd!")
vim.scriptencoding = "utf-8"
vim.opt.encoding = "utf-8"
vim.opt.fileencoding = "utf-8"
vim.wo.number = true
vim.opt.relativenumber = true
vim.opt.autoindent = true
vim.smartindent = true
vim.opt.hlsearch = true
vim.opt.backup = false
vim.opt.showcmd = true
vim.opt.cmdheight = 1
vim.opt.laststatus = 2
vim.opt.expandtab = true
vim.opt.scrolloff = 10
vim.opt.shell = 'fish'
vim.opt.backupskip = { '/tmp/*', '/private/tmp/*' }
vim.opt.inccommand = 'split'
vim.opt.ignorecase = true
vim.opt.smarttab = true
vim.opt.breakindent = true
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2
vim.opt.wrap = false
vim.opt.backspace = { 'start', 'eol', 'indent' }
vim.opt.path:append { '**' } -- finding files - search down into subfolders
vim.opt.wildignore:append { '*/node_modules/*', '*/__pycache__/*' }
-- turn off paste mode when leaving insert
vim.api.nvim_create_autocmd("InsertLeave", {
pattern = '*',
command = "set nopaste"
})
-- add '*' in block comments
vim.opt.formatoptions:append { 'r' }

View file

@ -1,2 +0,0 @@
-- sync os with vim clipboard
vim.opt.clipboard:append { 'unnamed', 'unnamedplus' }

View file

@ -1,7 +0,0 @@
vim.opt.cursorline = false
vim.opt.termguicolors = true
vim.opt.winblend = 0
vim.opt.wildoptions = 'pum' -- show popup for autocomplete
vim.opt.pumblend = 5
vim.opt.background = 'dark'

View file

@ -0,0 +1,2 @@
require("juancwu.keymaps")
require("juancwu.options")

View file

@ -0,0 +1,72 @@
vim.g.mapleader = " "
-- open the explorer
vim.keymap.set("n", "<leader>pv", "<cmd>Ex<CR>")
-- move highlighted lines
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
-- make cursor stay in same position when appending line below
vim.keymap.set("n", "J", "mzJ`z")
-- make cursor stay in the middle while moving down/up the page
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
-- make cursor stay in the middle while looking through search results
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")
-- paste without losing clipboard
vim.keymap.set("x", "<leader>p", "\"_dP")
-- do not copy with x, for god sake, WHY copy something that is being deleted??
vim.keymap.set("n", "x", "\"_x")
-- smile
vim.keymap.set("n", "Q", "<nop>")
-- select and replace
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
-- no copy, delete line, for god sake...
vim.keymap.set("n", "dd", "\"_dd")
vim.keymap.set("n", "<leader>dd", "dd") -- cut line, under my control
-- copy/paste to/from system clipboard
vim.keymap.set({"n", "v"}, "<leader>y", "\"+y")
vim.keymap.set("n", "<leader>Y", "\"+Y")
vim.keymap.set({"n", "v"}, "<leader>P", "\"+p")
-- increment/decrement a count, helpful for changing indeces
vim.keymap.set("n", "+", "<C-a>")
vim.keymap.set("n", "-", "<C-x>")
-- do not copy when deleting word
vim.keymap.set("n", "dw", "\"_dw")
vim.keymap.set("n", "de", "\"_de")
vim.keymap.set("n", "<leader>dw", "dw")
vim.keymap.set("n", "<leader>de", "de")
vim.keymap.set("n", "db", "vb\"_d") -- delete in backwards
vim.keymap.set("n", "<leader>db", "vbd")
vim.keymap.set("n", "<C-a>", "gg<S-v>G") -- select all
-- split pane
vim.keymap.set("n", "ss", ":split<Return><C-w>w", { silent = true }) -- horizontal
vim.keymap.set("n", "sv", ":vsplit<Return><C-w>w", { silent = true }) -- vertical
-- pane movement
vim.keymap.set("n", "..", "<C-w>w") -- toggle
vim.keymap.set("n", "sh", "<C-w>h")
vim.keymap.set("n", "sk", "<C-w>k")
vim.keymap.set("n", "sl", "<C-w>l")
vim.keymap.set("n", "sj", "<C-w>j")
-- resize pane
vim.keymap.set("n", "<C-w><left>", "<C-w><")
vim.keymap.set("n", "<C-w><right>", "<C-w>>")
vim.keymap.set("n", "<C-w><up>", "<C-w>+")
vim.keymap.set("n", "<C-w><down>", "<C-w>-")

View file

@ -0,0 +1,41 @@
vim.scriptencoding = "utf-8"
vim.opt.encoding = "utf-8"
vim.opt.fileencoding = "utf-8"
vim.wo.number = true -- show line number
vim.opt.relativenumber = true -- juicy relativity
vim.opt.autoindent = true
vim.opt.smartindent = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smarttab = true
vim.opt.breakindent = true
vim.opt.wrap = false -- bad, stay away from me!
vim.opt.hlsearch = false
vim.opt.incsearch = true -- highlight search pattern as you type
vim.opt.scrolloff = 8 -- give me some personal space
vim.opt.updatetime = 50
vim.opt.ignorecase = true -- case-insensitive search
vim.opt.backspace = { "start", "eol", "indent" }
-- don't want to look into these...
vim.opt.wildignore:append { "*/node_modules/*", "*/__pycache__/*" }
-- add '*' in block comments
vim.opt.formatoptions:append { 'r' }
-- theme
vim.opt.winblend = 0
vim.opt.wildoptions = "pum" -- show popup for autocomplete
vim.opt.pumblend = 5
vim.opt.background = "dark"
vim.opt.termguicolors = true -- good shit, just take it

View file

@ -0,0 +1,79 @@
-- This file can be loaded by calling `lua require('plugins')` from your init.vim
-- Only required if you have packer configured as `opt`
vim.cmd [[packadd packer.nvim]]
return require('packer').startup(function(use)
-- Packer can manage itself
use 'wbthomason/packer.nvim'
-- fuzzy finder
use 'nvim-lua/plenary.nvim'
use {
'nvim-telescope/telescope.nvim', tag = '0.1.0',
requires = { {'nvim-lua/plenary.nvim'} }
}
-- file utilities for telescope
use { "nvim-telescope/telescope-file-browser.nvim" }
-- colorscheme
use "tjdevries/colorbuddy.nvim"
use "svrana/neosolarized.nvim"
-- treesitter baby
use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' })
-- quick navigation between files, harpoon
use 'ThePrimeagen/harpoon'
use 'mbbill/undotree'
-- git functionalities
use 'tpope/vim-fugitive'
-- LSP configurations
use {
'VonHeikemen/lsp-zero.nvim',
requires = {
-- LSP Support
{'neovim/nvim-lspconfig'},
{'williamboman/mason.nvim'},
{'williamboman/mason-lspconfig.nvim'},
-- Autocompletion
{'hrsh7th/nvim-cmp'},
{'hrsh7th/cmp-buffer'},
{'hrsh7th/cmp-path'},
{'saadparwaiz1/cmp_luasnip'},
{'hrsh7th/cmp-nvim-lsp'},
{'hrsh7th/cmp-nvim-lua'},
-- Snippets
{'L3MON4D3/LuaSnip'},
{'rafamadriz/friendly-snippets'},
}
}
-- status line
use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
}
-- autopairs, complete brackets
use {
"windwp/nvim-autopairs",
config = function() require("nvim-autopairs").setup {} end
}
-- colorize the hex codes
use 'norcalli/nvim-colorizer.lua'
-- markdown preview, sweet
use({
"iamcco/markdown-preview.nvim",
run = function() vim.fn["mkdp#util#install"]() end,
})
-- zen mode, mmmmmm
use "folke/zen-mode.nvim"
end)

View file

@ -1,37 +0,0 @@
local keymap = vim.keymap
-- do not copy char with x
keymap.set('n', 'x', '"_x')
-- increment/decrement a count
keymap.set('n', '+', '<C-a>')
keymap.set('n', '-', '<C-x>')
-- delete in backwards
keymap.set('n', 'dw', 'vb"_d')
-- select all
keymap.set('n', '<C-a>', 'gg<S-v>G')
-- new tab
keymap.set('n', 'te', ':tabedit<Return>', { silent = true })
-- split window
-- horizontal split
keymap.set('n', 'ss', ':split<Return><C-w>w', { silent = true })
-- vertical split
keymap.set('n', 'sv', ':vsplit<Return><C-w>w', { silent = true })
-- move window
keymap.set('n', '<Space>', '<C-w>w')
keymap.set('', 'sh', '<C-w>h')
keymap.set('', 'sk', '<C-w>k')
keymap.set('', 'sl', '<C-w>l')
keymap.set('', 'sj', '<C-w>j')
-- resize window
keymap.set('n', '<C-w><left>', '<C-w><')
keymap.set('n', '<C-w><right>', '<C-w>>')
keymap.set('n', '<C-w><up>', '<C-w>+')
keymap.set('n', '<C-w><down>', '<C-w>-')

View file

@ -1,63 +0,0 @@
local status, packer = pcall(require, 'packer')
if (not status) then
print("Packer is not installed")
return
end
packer.startup(function(use)
use 'wbthomason/packer.nvim'
use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
}
use 'tjdevries/colorbuddy.nvim' -- use to configure neovim theme
use 'neovim/nvim-lspconfig' -- configuration presets for LSP
-- use 'bbenzikry/snazzybuddy.nvim' -- colorscheme
use {
'svrana/neosolarized.nvim',
requires = { 'tjdevries/colorbuddy.nvim' }
} -- another colorscheme
use 'onsails/lspkind-nvim' -- vscode-like pictograms
use 'hrsh7th/cmp-buffer' -- nvim-cmp source for buffer words
use 'hrsh7th/cmp-nvim-lsp' -- nvim-cmp source for neovim's built-in LSP
use 'hrsh7th/nvim-cmp' -- auto complete
use 'L3MON4D3/LuaSnip' -- snippets
use {
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate'
}
use 'windwp/nvim-autopairs'
use 'windwp/nvim-ts-autotag'
use {
'nvim-telescope/telescope.nvim',
requires = 'nvim-lua/plenary.nvim'
}
use 'nvim-telescope/telescope-file-browser.nvim'
use 'nvim-tree/nvim-web-devicons'
use {
'iamcco/markdown-preview.nvim',
run = function() vim.fn['mkdp#util#install']() end
}
-- tabs
use {
'akinsho/bufferline.nvim',
tag = "v3.*"
}
-- highlights hexcolor string
use 'norcalli/nvim-colorizer.lua'
-- LSP UI
use 'glepnir/lspsaga.nvim'
-- Signature help
use 'ray-x/lsp_signature.nvim'
-- linter/formatter
use 'jose-elias-alvarez/null-ls.nvim'
-- mason, allows easy manage external editor toolin such as LSP servers, DAP servers, linters, and formatters
use 'williamboman/mason.nvim'
use 'williamboman/mason-lspconfig.nvim'
end)

View file

@ -1,65 +0,0 @@
local Color, colors, Group, groups, styles = require('colorbuddy').setup()
vim.g.colors_name = "pearfs"
-- base colours, global colours
Color.new("red", "#ff3860")
Color.new("reddark", "#ff1443")
Color.new("redlight", "#ff5c7c")
Color.new("blue", "#498afb")
Color.new("bluedark", "#2674fa")
Color.new("bluelight", "#6ca0fc")
Color.new("orange", "#fa8142")
Color.new("orangedark", "#f96a1f")
Color.new("orangelight", "#fb9865")
Color.new("green", "#09c372")
Color.new("greendark", "#07a15e")
Color.new("greenlight", "#0BE586")
Color.new("purple", "#9166cc")
Color.new("purpldark", "#7d4bc3")
Color.new("purplelight", "#a481d5")
Color.new("pink", "#ff4088")
Color.new("pinkdark", "#ff1c72")
Color.new("pinklight", "#ff649e")
Color.new("yellow", "#ffd803")
Color.new("gray0", "#f8f8f8")
Color.new("gray1", "#dbe1e8")
Color.new("gray2", "#b2becd")
Color.new("gray3", "#6c7983")
Color.new("gray4", "#454e56")
Color.new("gray5", "#2a2e35")
Color.new("gray6", "#12181b")
Group.new("Normal", colors.gray2, colors.gray6, styles.none)
Group.new("Comment", colors.gray4, colors.NONE, styles.NONE)
Group.new("Constant", colors.blue, colors.NONE, styles.NONE)
-- variable, function names...
Group.new("Identifier", colors.orangelight, colors.NONE, styles.NONE)
-- any statement, such as if else while etc
Group.new("Statement", colors.redlight, colors.NONE, styles.NONE)
-- things such as '#include'
Group.new("PreProc", colors.gray3, colors.NONE, styles.NONE)
-- type color
Group.new("Type", colors.purple, colors.NONE, styles.NONE)
-- special characters such as escape characters '\n'
Group.new("Special", colors.orange, colors.NONE, styles.NONE)
Group.new("Underlined", colors.bluelight, colors.none, styles.none)
Group.new("Error", colors.red, colors.none, styles.none)
Group.new("TODO", colors.yellow, colors.none, styles.none)
Group.new("String", colors.green, colors.none, styles.none)
Group.new("Number", colors.gray2, colors.none, styles.none)
Group.new("Ignore", colors.none, colors.none, styles.none)
Group.new("Function", colors.purple, colors.none, styles.none)
Group.new("SpecialKey", colors.gray2, colors.gray6, styles.none)
Group.new("NonText", colors.gray2, colors.none, styles.none)
Group.new("Visual", colors.gray2, colors.gray4, styles.none)
Group.new("Directory", colors.blue, colors.none, styles.none)
Group.new("ErrorMsg", colors.red, colors.none, styles.none)
Group.new("IncSearch", colors.gray6, colors.yellow, styles.none)
Group.new("Search", colors.gray6, colors.yellow, styles.none)
Group.new("MoreMsg", colors.blue, colors.none, styles.none)
Group.new("ModeMsg", colors.bluedark, colors.none, styles.none)
Group.new("LineNr", colors.gray3, colors.none, styles.none)

View file

@ -1,113 +0,0 @@
local status, nvim_lsp = pcall(require, 'lspconfig')
if (not status) then return end
local protocol = require('vim.lsp.protocol')
local augroup_format = vim.api.nvim_create_augroup("Format", { clear = true })
local enable_format_on_save = function(_, bufnr)
vim.api.nvim_clear_autocmds({ group = augroup_format, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup_format,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr })
end,
})
end
local on_attach = function(_, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
-- mappings
local opts = { noremap = true, silent = true }
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
end
local capabilities = require('cmp_nvim_lsp').default_capabilities()
protocol.CompletionItemKind = {
'', -- 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
}
nvim_lsp.tsserver.setup {
on_attach = on_attach,
filetypes = {
"typescript",
"typescriptreact",
"typescript.tsx"
},
cmd = { "typescript-language-server", "--stdio" },
capabilities = capabilities
}
nvim_lsp.sumneko_lua.setup {
capabilities = capabilities,
on_attach = function(client, bufnr)
on_attach(client, bufnr)
enable_format_on_save(client, bufnr)
end,
settings = {
Lua = {
diagnostics = {
-- get the language server to recognize the 'vim' global
globals = { 'vim' }
},
workspace = {
-- make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true)
}
}
}
}
nvim_lsp.gopls.setup {
on_attach = on_attach,
capabilities = capabilities,
}
nvim_lsp.pyright.setup {
on_attach = on_attach,
capabilities = capabilities
}
nvim_lsp.tailwindcss.setup {
on_attach = on_attach,
capabilities = capabilities
}
nvim_lsp.clangd.setup {
on_attach = on_attach,
capabilities = capabilities
}
-- lsp signature help
local signature_opts = {
floating_window = false,
-- toggle_key = '<C-i>'
}
require 'lsp_signature'.setup(signature_opts)

View file

@ -1,16 +0,0 @@
local status, saga = pcall(require, 'lspsaga')
if not status then return end
saga.init_lsp_saga {
server_filetype_map = {}
}
local opts = { noremap = true, silent = true }
vim.api.nvim_set_keymap('n', '<C-j>', '<Cmd>Lspsaga diagnostic_jump_next<CR>', opts)
vim.api.nvim_set_keymap('n', 'K', '<Cmd>Lspsaga hover_doc<CR>', opts)
vim.api.nvim_set_keymap('n', 'gd', '<Cmd>Lspsaga lsp_finder<CR>', opts)
-- signature_help has been removed
-- vim.api.nvim_set_keymap('i', '<C-k>', '<Cmd>Lspsaga signature_help<CR>', opts)
vim.api.nvim_set_keymap('n', 'gp', '<Cmd>Lspsaga peek_definition<CR>', opts)
vim.api.nvim_set_keymap('n', 'gr', '<Cmd>Lspsaga rename<CR>', opts)

View file

@ -1,43 +0,0 @@
local status, null_ls = pcall(require, 'null-ls')
if not status then return end
local augroup = vim.api.nvim_create_augroup('LspFormatting', {})
local lsp_formatting = function(bufnr)
vim.lsp.buf.format({
filter = function(client)
return client.name == "null-ls"
end,
bufnr = bufnr,
})
end
null_ls.setup({
sources = {
null_ls.builtins.formatting.prettierd,
-- null_ls.builtins.diagnostics.eslint_d.with({
-- diagnostics_format = '[eslint] #{m}\n(#{c})'
-- }),
null_ls.builtins.diagnostics.fish
},
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
lsp_formatting(bufnr)
end,
})
end
end
})
vim.api.nvim_create_user_command(
'DisableLspFormatting',
function()
vim.api.nvim_create_autocmds({ group = augroup, buffer = 0 })
end,
{ nargs = 0 }
)

View file

@ -49,8 +49,8 @@ local function save_profiles(threshold)
end end
time([[Luarocks path setup]], true) time([[Luarocks path setup]], true)
local package_path_str = "/Users/jc/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/jc/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/jc/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/jc/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" local package_path_str = "/home/jc/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/jc/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/jc/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/jc/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/Users/jc/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" local install_cpath_pattern = "/home/jc/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str package.path = package.path .. ';' .. package_path_str
end end
@ -76,117 +76,153 @@ time([[Defining packer_plugins]], true)
_G.packer_plugins = { _G.packer_plugins = {
LuaSnip = { LuaSnip = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/LuaSnip", path = "/home/jc/.local/share/nvim/site/pack/packer/start/LuaSnip",
url = "https://github.com/L3MON4D3/LuaSnip" url = "https://github.com/L3MON4D3/LuaSnip"
}, },
["bufferline.nvim"] = {
loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/bufferline.nvim",
url = "https://github.com/akinsho/bufferline.nvim"
},
["cmp-buffer"] = { ["cmp-buffer"] = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/cmp-buffer", path = "/home/jc/.local/share/nvim/site/pack/packer/start/cmp-buffer",
url = "https://github.com/hrsh7th/cmp-buffer" url = "https://github.com/hrsh7th/cmp-buffer"
}, },
["cmp-nvim-lsp"] = { ["cmp-nvim-lsp"] = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", path = "/home/jc/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
url = "https://github.com/hrsh7th/cmp-nvim-lsp" url = "https://github.com/hrsh7th/cmp-nvim-lsp"
}, },
["cmp-nvim-lua"] = {
loaded = true,
path = "/home/jc/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua",
url = "https://github.com/hrsh7th/cmp-nvim-lua"
},
["cmp-path"] = {
loaded = true,
path = "/home/jc/.local/share/nvim/site/pack/packer/start/cmp-path",
url = "https://github.com/hrsh7th/cmp-path"
},
cmp_luasnip = {
loaded = true,
path = "/home/jc/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
url = "https://github.com/saadparwaiz1/cmp_luasnip"
},
["colorbuddy.nvim"] = { ["colorbuddy.nvim"] = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/colorbuddy.nvim", path = "/home/jc/.local/share/nvim/site/pack/packer/start/colorbuddy.nvim",
url = "https://github.com/tjdevries/colorbuddy.nvim" url = "https://github.com/tjdevries/colorbuddy.nvim"
}, },
["lsp_signature.nvim"] = { ["friendly-snippets"] = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/lsp_signature.nvim", path = "/home/jc/.local/share/nvim/site/pack/packer/start/friendly-snippets",
url = "https://github.com/ray-x/lsp_signature.nvim" url = "https://github.com/rafamadriz/friendly-snippets"
}, },
["lspkind-nvim"] = { harpoon = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/lspkind-nvim", path = "/home/jc/.local/share/nvim/site/pack/packer/start/harpoon",
url = "https://github.com/onsails/lspkind-nvim" url = "https://github.com/ThePrimeagen/harpoon"
}, },
["lspsaga.nvim"] = { ["lsp-zero.nvim"] = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/lspsaga.nvim", path = "/home/jc/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim",
url = "https://github.com/glepnir/lspsaga.nvim" url = "https://github.com/VonHeikemen/lsp-zero.nvim"
}, },
["lualine.nvim"] = { ["lualine.nvim"] = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/lualine.nvim", path = "/home/jc/.local/share/nvim/site/pack/packer/start/lualine.nvim",
url = "https://github.com/nvim-lualine/lualine.nvim" url = "https://github.com/nvim-lualine/lualine.nvim"
}, },
["markdown-preview.nvim"] = { ["markdown-preview.nvim"] = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/markdown-preview.nvim", path = "/home/jc/.local/share/nvim/site/pack/packer/start/markdown-preview.nvim",
url = "https://github.com/iamcco/markdown-preview.nvim" url = "https://github.com/iamcco/markdown-preview.nvim"
}, },
["mason-lspconfig.nvim"] = {
loaded = true,
path = "/home/jc/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
url = "https://github.com/williamboman/mason-lspconfig.nvim"
},
["mason.nvim"] = {
loaded = true,
path = "/home/jc/.local/share/nvim/site/pack/packer/start/mason.nvim",
url = "https://github.com/williamboman/mason.nvim"
},
["neosolarized.nvim"] = { ["neosolarized.nvim"] = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/neosolarized.nvim", path = "/home/jc/.local/share/nvim/site/pack/packer/start/neosolarized.nvim",
url = "https://github.com/svrana/neosolarized.nvim" url = "https://github.com/svrana/neosolarized.nvim"
}, },
["nvim-autopairs"] = { ["nvim-autopairs"] = {
config = { "\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0" },
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/nvim-autopairs", path = "/home/jc/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
url = "https://github.com/windwp/nvim-autopairs" url = "https://github.com/windwp/nvim-autopairs"
}, },
["nvim-cmp"] = { ["nvim-cmp"] = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/nvim-cmp", path = "/home/jc/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp" url = "https://github.com/hrsh7th/nvim-cmp"
}, },
["nvim-colorizer.lua"] = { ["nvim-colorizer.lua"] = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua", path = "/home/jc/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua",
url = "https://github.com/norcalli/nvim-colorizer.lua" url = "https://github.com/norcalli/nvim-colorizer.lua"
}, },
["nvim-lspconfig"] = { ["nvim-lspconfig"] = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", path = "/home/jc/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig" url = "https://github.com/neovim/nvim-lspconfig"
}, },
["nvim-treesitter"] = { ["nvim-treesitter"] = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/nvim-treesitter", path = "/home/jc/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
url = "https://github.com/nvim-treesitter/nvim-treesitter" url = "https://github.com/nvim-treesitter/nvim-treesitter"
}, },
["nvim-ts-autotag"] = {
loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/nvim-ts-autotag",
url = "https://github.com/windwp/nvim-ts-autotag"
},
["nvim-web-devicons"] = { ["nvim-web-devicons"] = {
loaded = true, loaded = false,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", needs_bufread = false,
url = "https://github.com/nvim-tree/nvim-web-devicons" path = "/home/jc/.local/share/nvim/site/pack/packer/opt/nvim-web-devicons",
url = "https://github.com/kyazdani42/nvim-web-devicons"
}, },
["packer.nvim"] = { ["packer.nvim"] = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/packer.nvim", path = "/home/jc/.local/share/nvim/site/pack/packer/start/packer.nvim",
url = "https://github.com/wbthomason/packer.nvim" url = "https://github.com/wbthomason/packer.nvim"
}, },
["plenary.nvim"] = { ["plenary.nvim"] = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/plenary.nvim", path = "/home/jc/.local/share/nvim/site/pack/packer/start/plenary.nvim",
url = "https://github.com/nvim-lua/plenary.nvim" url = "https://github.com/nvim-lua/plenary.nvim"
}, },
["telescope-file-browser.nvim"] = { ["telescope-file-browser.nvim"] = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/telescope-file-browser.nvim", path = "/home/jc/.local/share/nvim/site/pack/packer/start/telescope-file-browser.nvim",
url = "https://github.com/nvim-telescope/telescope-file-browser.nvim" url = "https://github.com/nvim-telescope/telescope-file-browser.nvim"
}, },
["telescope.nvim"] = { ["telescope.nvim"] = {
loaded = true, loaded = true,
path = "/Users/jc/.local/share/nvim/site/pack/packer/start/telescope.nvim", path = "/home/jc/.local/share/nvim/site/pack/packer/start/telescope.nvim",
url = "https://github.com/nvim-telescope/telescope.nvim" url = "https://github.com/nvim-telescope/telescope.nvim"
},
undotree = {
loaded = true,
path = "/home/jc/.local/share/nvim/site/pack/packer/start/undotree",
url = "https://github.com/mbbill/undotree"
},
["vim-fugitive"] = {
loaded = true,
path = "/home/jc/.local/share/nvim/site/pack/packer/start/vim-fugitive",
url = "https://github.com/tpope/vim-fugitive"
},
["zen-mode.nvim"] = {
loaded = true,
path = "/home/jc/.local/share/nvim/site/pack/packer/start/zen-mode.nvim",
url = "https://github.com/folke/zen-mode.nvim"
} }
} }
time([[Defining packer_plugins]], false) time([[Defining packer_plugins]], false)
-- Config for: nvim-autopairs
time([[Config for nvim-autopairs]], true)
try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs")
time([[Config for nvim-autopairs]], false)
_G._packer.inside_compile = false _G._packer.inside_compile = false
if _G._packer.needs_bufread == true then if _G._packer.needs_bufread == true then