aboutsummaryrefslogtreecommitdiffstats
path: root/nvim
diff options
context:
space:
mode:
authorPeter Son Struschka <me@peter-struschka.com>2022-10-06 01:21:07 +0800
committerPeter Son Struschka <me@peter-struschka.com>2022-10-06 01:21:07 +0800
commit4370e16222b4b7b39eb9857d52745f6c6f361c16 (patch)
tree75d4f7db8fd42805d4d6ed03dfdc75240b494a61 /nvim
parent929bbbd90111e7a5fccc30edffa34c0b2d95a2f7 (diff)
downloaddotfiles-master.tar.gz
dotfiles-master.tar.bz2
dotfiles-master.tar.lz
dotfiles-master.tar.xz
dotfiles-master.tar.zst
dotfiles-master.zip
nvim: lua configHEADmaster
Diffstat (limited to 'nvim')
-rw-r--r--nvim/.config/nvim/autoload/plug.vim33
-rw-r--r--nvim/.config/nvim/init.vim5
-rw-r--r--nvim/.config/nvim/lua/pstr/init.lua3
-rw-r--r--nvim/.config/nvim/lua/pstr/keymap.lua22
-rw-r--r--nvim/.config/nvim/lua/pstr/lsp.lua2
-rw-r--r--nvim/.config/nvim/lua/pstr/packer.lua27
-rw-r--r--nvim/.config/nvim/lua/pstr/remap.lua6
-rw-r--r--nvim/.config/nvim/lua/pstr/set.lua27
-rw-r--r--nvim/.config/nvim/plugin/packer_compiled.lua109
-rw-r--r--nvim/.local/share/nvim/site/.gitignore2
10 files changed, 222 insertions, 14 deletions
diff --git a/nvim/.config/nvim/autoload/plug.vim b/nvim/.config/nvim/autoload/plug.vim
index 6a958cb..652caa8 100644
--- a/nvim/.config/nvim/autoload/plug.vim
+++ b/nvim/.config/nvim/autoload/plug.vim
@@ -242,6 +242,8 @@ function! plug#begin(...)
let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p'))
elseif exists('g:plug_home')
let home = s:path(g:plug_home)
+ elseif has('nvim')
+ let home = stdpath('data') . '/plugged'
elseif !empty(&rtp)
let home = s:path(split(&rtp, ',')[0]) . '/plugged'
else
@@ -350,7 +352,7 @@ function! plug#end()
endif
let lod = { 'ft': {}, 'map': {}, 'cmd': {} }
- if exists('g:did_load_filetypes')
+ if get(g:, 'did_load_filetypes', 0)
filetype off
endif
for name in g:plugs_order
@@ -405,7 +407,7 @@ function! plug#end()
for [map, names] in items(lod.map)
for [mode, map_prefix, key_prefix] in
- \ [['i', '<C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
+ \ [['i', '<C-\><C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
execute printf(
\ '%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, %s, "%s")<CR>',
\ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix)
@@ -1208,7 +1210,8 @@ function! s:update_impl(pull, force, args) abort
normal! 2G
silent! redraw
- let s:clone_opt = []
+ " Set remote name, overriding a possible user git config's clone.defaultRemoteName
+ let s:clone_opt = ['--origin', 'origin']
if get(g:, 'plug_shallow', 1)
call extend(s:clone_opt, ['--depth', '1'])
if s:git_version_requirement(1, 7, 10)
@@ -2618,26 +2621,34 @@ function! s:preview_commit()
let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}')
if empty(sha)
- return
+ let name = matchstr(getline('.'), '^- \zs[^:]*\ze:$')
+ if empty(name)
+ return
+ endif
+ let title = 'HEAD@{1}..'
+ let command = 'git diff --no-color HEAD@{1}'
+ else
+ let title = sha
+ let command = 'git show --no-color --pretty=medium '.sha
+ let name = s:find_name(line('.'))
endif
- let name = s:find_name(line('.'))
if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir)
return
endif
if exists('g:plug_pwindow') && !s:is_preview_window_open()
execute g:plug_pwindow
- execute 'e' sha
+ execute 'e' title
else
- execute 'pedit' sha
+ execute 'pedit' title
wincmd P
endif
- setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable
+ setlocal previewwindow filetype=git buftype=nofile bufhidden=wipe nobuflisted modifiable
let batchfile = ''
try
let [sh, shellcmdflag, shrd] = s:chsh(1)
- let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha
+ let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && '.command
if s:is_win
let [batchfile, cmd] = s:batchfile(cmd)
endif
@@ -2763,9 +2774,9 @@ function! s:snapshot(force, ...) abort
1
let anchor = line('$') - 3
let names = sort(keys(filter(copy(g:plugs),
- \'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)')))
+ \'has_key(v:val, "uri") && isdirectory(v:val.dir)')))
for name in reverse(names)
- let sha = s:git_revision(g:plugs[name].dir)
+ let sha = has_key(g:plugs[name], 'commit') ? g:plugs[name].commit : s:git_revision(g:plugs[name].dir)
if !empty(sha)
call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha))
redraw
diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim
index 3e4ca86..e342880 100644
--- a/nvim/.config/nvim/init.vim
+++ b/nvim/.config/nvim/init.vim
@@ -4,6 +4,8 @@ Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'nvim-telescope/telescope-fzy-native.nvim'
+Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
+
Plug 'editorconfig/editorconfig-vim'
Plug 'tpope/vim-sensible'
@@ -31,11 +33,10 @@ Plug 'mileszs/ack.vim'
Plug 'terryma/vim-multiple-cursors'
-Plug 'dense-analysis/ale'
+"Plug 'dense-analysis/ale'
Plug 'lyuts/vim-rtags'
Plug 'airblade/vim-gitgutter'
-
Plug 'preservim/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'preservim/nerdcommenter'
diff --git a/nvim/.config/nvim/lua/pstr/init.lua b/nvim/.config/nvim/lua/pstr/init.lua
new file mode 100644
index 0000000..c58b617
--- /dev/null
+++ b/nvim/.config/nvim/lua/pstr/init.lua
@@ -0,0 +1,3 @@
+require("pstr.set")
+require("pstr.remap")
+require("pstr.packer")
diff --git a/nvim/.config/nvim/lua/pstr/keymap.lua b/nvim/.config/nvim/lua/pstr/keymap.lua
new file mode 100644
index 0000000..8d9bfa0
--- /dev/null
+++ b/nvim/.config/nvim/lua/pstr/keymap.lua
@@ -0,0 +1,22 @@
+local M = {}
+
+local function bind(op, outer_opts)
+ outer_opts = outer_opts or {noremap = true}
+ return function(lhs, rhs, opts)
+ ops = vim.tbl_extend("force",
+ outer_opts,
+ opts or {}
+ )
+ vim.keymap.set(op, lhs, rhs, opts)
+ end
+end
+
+M.nmap = bind("n", {noremap = false})
+M.imap = bind("i", {noremap = false})
+M.nnoremap = bind("n")
+M.vnoremap = bind("v")
+M.xnoremap = bind("x")
+M.inoremap = bind("i")
+
+return M
+
diff --git a/nvim/.config/nvim/lua/pstr/lsp.lua b/nvim/.config/nvim/lua/pstr/lsp.lua
index 832ffed..ef4a860 100644
--- a/nvim/.config/nvim/lua/pstr/lsp.lua
+++ b/nvim/.config/nvim/lua/pstr/lsp.lua
@@ -7,7 +7,7 @@ require'lspconfig'.clangd.setup{
on_attach=on_attach,
root_dir = function() return vim.loop.cwd() end
}
-require'lspconfig'.pyls.setup{ on_attach=on_attach }
+require'lspconfig'.pylsp.setup{ on_attach=on_attach }
require'lspconfig'.rust_analyzer.setup{ on_attach=on_attach }
require'lspconfig'.vuels.setup{
diff --git a/nvim/.config/nvim/lua/pstr/packer.lua b/nvim/.config/nvim/lua/pstr/packer.lua
new file mode 100644
index 0000000..5837424
--- /dev/null
+++ b/nvim/.config/nvim/lua/pstr/packer.lua
@@ -0,0 +1,27 @@
+local ensure_packer = function()
+ local fn = vim.fn
+ local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
+ if fn.empty(fn.glob(install_path)) > 0 then
+ fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
+ vim.cmd [[packadd packer.nvim]]
+ return true
+ end
+ return false
+end
+
+local packer_bootstrap = ensure_packer()
+
+
+return require('packer').startup(function(use)
+ -- Packer can manage itself
+ use 'wbthomason/packer.nvim'
+ use 'ellisonleao/gruvbox.nvim'
+ use {
+ 'nvim-treesitter/nvim-treesitter',
+ run = ':TSUpdate'
+ }
+
+ if packer_bootstrap then
+ require('packer').sync()
+ end
+end)
diff --git a/nvim/.config/nvim/lua/pstr/remap.lua b/nvim/.config/nvim/lua/pstr/remap.lua
new file mode 100644
index 0000000..94325b0
--- /dev/null
+++ b/nvim/.config/nvim/lua/pstr/remap.lua
@@ -0,0 +1,6 @@
+local nnoremap = require("pstr.keymap").nnoremap
+local imap = require("pstr.keymap").imap
+
+imap("jk", "<Esc>")
+
+nnoremap("<leader>pv", "<cmd>Ex<CR>")
diff --git a/nvim/.config/nvim/lua/pstr/set.lua b/nvim/.config/nvim/lua/pstr/set.lua
new file mode 100644
index 0000000..832e390
--- /dev/null
+++ b/nvim/.config/nvim/lua/pstr/set.lua
@@ -0,0 +1,27 @@
+local o = vim.o
+local opt = vim.opt
+local wo = vim.wo
+local bo = vim.bo
+
+opt.guicursor = ''
+
+opt.nu = true -- wo.number = true
+opt.rnu = true -- wo.relativenumber = true
+
+opt.ts = 2 -- bo.tabstop = 2
+opt.sts = 2 -- bo.softtabstop = 2
+opt.sw = 2 -- bo.shiftwidth = 2
+opt.et = true -- bo.expandtab = true
+opt.hls = false -- o.hlsearch = false
+opt.is = true -- o.incsearch = true
+opt.hid = true -- o.hidden = true
+
+opt.si = true -- o.smartindent = true
+opt.wrap = false
+
+opt.so = 8 -- o.scrolloff = 8
+
+opt.cc = '80' -- o.colorcolumn = '80'
+opt.scl = 'yes' -- o.signcolumn = 'yes'
+
+vim.g.mapleader = " "
diff --git a/nvim/.config/nvim/plugin/packer_compiled.lua b/nvim/.config/nvim/plugin/packer_compiled.lua
new file mode 100644
index 0000000..978c904
--- /dev/null
+++ b/nvim/.config/nvim/plugin/packer_compiled.lua
@@ -0,0 +1,109 @@
+-- Automatically generated packer.nvim plugin loader code
+
+if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
+ vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
+ return
+end
+
+vim.api.nvim_command('packadd packer.nvim')
+
+local no_errors, error_msg = pcall(function()
+
+_G._packer = _G._packer or {}
+_G._packer.inside_compile = true
+
+local time
+local profile_info
+local should_profile = false
+if should_profile then
+ local hrtime = vim.loop.hrtime
+ profile_info = {}
+ time = function(chunk, start)
+ if start then
+ profile_info[chunk] = hrtime()
+ else
+ profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
+ end
+ end
+else
+ time = function(chunk, start) end
+end
+
+local function save_profiles(threshold)
+ local sorted_times = {}
+ for chunk_name, time_taken in pairs(profile_info) do
+ sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
+ end
+ table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
+ local results = {}
+ for i, elem in ipairs(sorted_times) do
+ if not threshold or threshold and elem[2] > threshold then
+ results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
+ end
+ end
+ if threshold then
+ table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
+ end
+
+ _G._packer.profile_output = results
+end
+
+time([[Luarocks path setup]], true)
+local package_path_str = "/home/peter/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/peter/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/peter/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/peter/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
+local install_cpath_pattern = "/home/peter/.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
+ package.path = package.path .. ';' .. package_path_str
+end
+
+if not string.find(package.cpath, install_cpath_pattern, 1, true) then
+ package.cpath = package.cpath .. ';' .. install_cpath_pattern
+end
+
+time([[Luarocks path setup]], false)
+time([[try_loadstring definition]], true)
+local function try_loadstring(s, component, name)
+ local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
+ if not success then
+ vim.schedule(function()
+ vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
+ end)
+ end
+ return result
+end
+
+time([[try_loadstring definition]], false)
+time([[Defining packer_plugins]], true)
+_G.packer_plugins = {
+ ["gruvbox.nvim"] = {
+ loaded = true,
+ path = "/home/peter/.local/share/nvim/site/pack/packer/start/gruvbox.nvim",
+ url = "https://github.com/ellisonleao/gruvbox.nvim"
+ },
+ ["nvim-treesitter"] = {
+ loaded = true,
+ path = "/home/peter/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
+ url = "https://github.com/nvim-treesitter/nvim-treesitter"
+ },
+ ["packer.nvim"] = {
+ loaded = true,
+ path = "/home/peter/.local/share/nvim/site/pack/packer/start/packer.nvim",
+ url = "https://github.com/wbthomason/packer.nvim"
+ }
+}
+
+time([[Defining packer_plugins]], false)
+
+_G._packer.inside_compile = false
+if _G._packer.needs_bufread == true then
+ vim.cmd("doautocmd BufRead")
+end
+_G._packer.needs_bufread = false
+
+if should_profile then save_profiles() end
+
+end)
+
+if not no_errors then
+ error_msg = error_msg:gsub('"', '\\"')
+ vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
+end
diff --git a/nvim/.local/share/nvim/site/.gitignore b/nvim/.local/share/nvim/site/.gitignore
new file mode 100644
index 0000000..3e39fe0
--- /dev/null
+++ b/nvim/.local/share/nvim/site/.gitignore
@@ -0,0 +1,2 @@
+pack/
+