nvim: proper move to lua
This commit is contained in:
@@ -46,7 +46,6 @@ alias tree='exa --tree'
|
|||||||
alias vim='nvim'
|
alias vim='nvim'
|
||||||
alias vi='nvim'
|
alias vi='nvim'
|
||||||
alias v='nvim'
|
alias v='nvim'
|
||||||
alias nv='nvim -u ~/Development/personal/dotfiles/init.lua'
|
|
||||||
alias cat='bat --style plain'
|
alias cat='bat --style plain'
|
||||||
alias grep='rg'
|
alias grep='rg'
|
||||||
alias be='bundle exec'
|
alias be='bundle exec'
|
||||||
|
|||||||
386
init.lua
386
init.lua
@@ -1,386 +0,0 @@
|
|||||||
-- Author: Konstantin Bukley <madundead@gmail.com>
|
|
||||||
-- License: WTFPL
|
|
||||||
-- Description: Personal neovim configuration
|
|
||||||
|
|
||||||
-- Helpers
|
|
||||||
local cmd = vim.cmd -- to execute Vim commands e.g. cmd('pwd')
|
|
||||||
local fn = vim.fn -- to call Vim functions e.g. fn.bufnr()
|
|
||||||
local g = vim.g -- a table to access global variables
|
|
||||||
local opt = vim.opt -- to set options
|
|
||||||
|
|
||||||
local function map(mode, lhs, rhs, opts)
|
|
||||||
local options = { noremap = true }
|
|
||||||
if opts then options = vim.tbl_extend('force', options, opts) end
|
|
||||||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function nmap(lhs, rhs, opts)
|
|
||||||
map('n', lhs, rhs, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim'
|
|
||||||
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
|
||||||
vim.fn.execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path)
|
|
||||||
end
|
|
||||||
|
|
||||||
require('packer').startup(function()
|
|
||||||
use 'wbthomason/packer.nvim'
|
|
||||||
use 'arcticicestudio/nord-vim'
|
|
||||||
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
|
|
||||||
use 'tpope/vim-commentary'
|
|
||||||
use 'tpope/vim-surround'
|
|
||||||
use { 'junegunn/fzf', run = 'cd ~/.fzf && ./install --all' }
|
|
||||||
use 'junegunn/fzf.vim'
|
|
||||||
use 'junegunn/vim-easy-align'
|
|
||||||
use 'christoomey/vim-tmux-navigator'
|
|
||||||
use 'airblade/vim-gitgutter'
|
|
||||||
use 'tpope/vim-repeat'
|
|
||||||
use 'scrooloose/nerdtree' -- other file tree plugins are too fancy
|
|
||||||
use 'ellisonleao/glow.nvim'
|
|
||||||
|
|
||||||
-- Snippets
|
|
||||||
use 'L3MON4D3/LuaSnip'
|
|
||||||
use 'hrsh7th/nvim-cmp'
|
|
||||||
use 'saadparwaiz1/cmp_luasnip'
|
|
||||||
use 'rafamadriz/friendly-snippets'
|
|
||||||
|
|
||||||
use 'neovim/nvim-lspconfig'
|
|
||||||
|
|
||||||
-- tpope
|
|
||||||
use 'tpope/vim-fugitive'
|
|
||||||
use 'tpope/vim-rails'
|
|
||||||
|
|
||||||
-- tests
|
|
||||||
use 'vim-test/vim-test'
|
|
||||||
use 'benmills/vimux'
|
|
||||||
|
|
||||||
use 'dyng/ctrlsf.vim'
|
|
||||||
end)
|
|
||||||
|
|
||||||
cmd("au BufNewFile,BufRead Capfile,Gemfile,Vagrantfile,Brewfile setl ft=ruby")
|
|
||||||
cmd('au TextYankPost * lua vim.highlight.on_yank { timeout = 250 }')
|
|
||||||
cmd('colorscheme nord')
|
|
||||||
|
|
||||||
opt.smartindent = true -- Autoindenting when starting a new line
|
|
||||||
opt.tabstop = 2 -- Tab counts as 2 columns
|
|
||||||
opt.shiftwidth = 2 -- Numbers of spaces to (auto)indent
|
|
||||||
opt.expandtab = true -- Tabs to spaces
|
|
||||||
opt.clipboard = 'unnamed' -- Share clipboard with the OS
|
|
||||||
opt.number = true -- Display line numbers
|
|
||||||
opt.fillchars = {
|
|
||||||
vert = '▕', -- alternatives │
|
|
||||||
eob = ' ', -- suppress ~ at EndOfBuffer
|
|
||||||
msgsep = '‾',
|
|
||||||
diff = '⣿',
|
|
||||||
fold = ' ',
|
|
||||||
foldopen = '▾',
|
|
||||||
foldsep = '│',
|
|
||||||
foldclose = '▸',
|
|
||||||
}
|
|
||||||
opt.synmaxcol = 500 -- Do not try to highlight lines longer than 500 characters
|
|
||||||
opt.lazyredraw = true -- Do not redraw while running macros
|
|
||||||
opt.showmatch = true -- Show matching braces
|
|
||||||
opt.matchtime = 2 -- Show matching braces for 2 tenths of second
|
|
||||||
opt.showmode = true -- Shows when you are in insert mode
|
|
||||||
opt.title = true -- Show title in console status bar
|
|
||||||
opt.laststatus = 3
|
|
||||||
opt.wrap = false -- Dont wrap lines
|
|
||||||
opt.scrolloff = 5 -- Keep 5 rows on the screen when scrolling
|
|
||||||
opt.sidescrolloff = 15 -- Horizontal scrolloff
|
|
||||||
opt.visualbell = false -- No visual bell
|
|
||||||
opt.backup = false -- No backups
|
|
||||||
opt.writebackup = false -- No backups
|
|
||||||
opt.swapfile = false -- No backups
|
|
||||||
opt.mouse = 'a' -- Support mouse (for proper mouse highlight)
|
|
||||||
opt.list = true -- List mode
|
|
||||||
opt.listchars = { trail = '·', tab = '->' }
|
|
||||||
opt.timeoutlen = 1000 -- Delay for mappings
|
|
||||||
opt.ttimeoutlen = 0 -- Delay between modes
|
|
||||||
opt.shellcmdflag = '-ic' -- Enables aliases from .bashrc in :! commands
|
|
||||||
opt.grepprg = 'rg -i --vimgrep' -- TODO: check for existence of rg otherwise fallback to grep
|
|
||||||
opt.diffopt:append({ vertical = true }) -- Vertical splits in diff mode
|
|
||||||
opt.shortmess:append({ I = true }) -- Remove welcome message (:intro)
|
|
||||||
opt.shortmess:append({ a = true }) -- Short messages for everything
|
|
||||||
|
|
||||||
-- Ignore when autocompleting TODO: review
|
|
||||||
opt.wildignore:append('*.o,*.obj,*~')
|
|
||||||
opt.wildignore:append('*vim/backups*')
|
|
||||||
opt.wildignore:append('*sass-cache*')
|
|
||||||
opt.wildignore:append('*DS_Store*')
|
|
||||||
opt.wildignore:append('vendor/rails/**')
|
|
||||||
opt.wildignore:append('vendor/cache/**')
|
|
||||||
opt.wildignore:append('*.gem')
|
|
||||||
opt.wildignore:append('log/**,tmp/**')
|
|
||||||
opt.wildignore:append('*.png,*.jpg,*.gif')
|
|
||||||
|
|
||||||
-- " Conceal mostly for markdown TODO :h conceallevel
|
|
||||||
-- set conceallevel=2
|
|
||||||
-- " Highlight VCS conflict markers TODO: translate to LUA
|
|
||||||
-- match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
|
|
||||||
|
|
||||||
g.mapleader = ' '
|
|
||||||
|
|
||||||
-- Netrw
|
|
||||||
g.netrw_banner = 0
|
|
||||||
g.netrw_liststyle = 4
|
|
||||||
|
|
||||||
-- git-gutter
|
|
||||||
g.gitgutter_sign_added = '│'
|
|
||||||
g.gitgutter_sign_modified = '│'
|
|
||||||
g.gitgutter_sign_removed = '│'
|
|
||||||
g.gitgutter_sign_modified_removed = '│'
|
|
||||||
g.gitgutter_sign_removed_first_line = '│'
|
|
||||||
|
|
||||||
-- fzf
|
|
||||||
g.fzf_preview_window = ''
|
|
||||||
g.fzf_layout = { window = { width = 0.6, height = 0.6, border = 'sharp' } }
|
|
||||||
|
|
||||||
-- NERDTree
|
|
||||||
g.NERDTreeWinPos = "right"
|
|
||||||
g.NERDTreeMinimalUI = 1
|
|
||||||
g.NERDTreeDirArrows = 1
|
|
||||||
g.NERDTreeAutoDeleteBuffer = 1
|
|
||||||
g.NERDTreeHijackNetrw = 1
|
|
||||||
|
|
||||||
-- vim-test
|
|
||||||
g['test#strategy'] = 'vimux'
|
|
||||||
|
|
||||||
-- CtrlSF
|
|
||||||
g.ctrlsf_ackprg = 'rg'
|
|
||||||
g.ctrlsf_regex_pattern = 1
|
|
||||||
g.ctrlsf_case_sensitive = 'smart'
|
|
||||||
g.ctrlsf_default_root = 'project'
|
|
||||||
g.ctrlsf_context = '-B 1 -A 1'
|
|
||||||
g.ctrlsf_position = 'bottom'
|
|
||||||
g.ctrlsf_winsize = '40%'
|
|
||||||
g.ctrlsf_mapping = {
|
|
||||||
next = 'n',
|
|
||||||
prev = 'N',
|
|
||||||
}
|
|
||||||
|
|
||||||
-- fzf
|
|
||||||
g.fzf_preview_window = ''
|
|
||||||
g.fzf_layout = { window = { width = 0.6, height = 0.6, border = 'sharp' } }
|
|
||||||
|
|
||||||
--- Mappings
|
|
||||||
-- Essentials
|
|
||||||
nmap(';', ':')
|
|
||||||
nmap(',,', '<C-^>')
|
|
||||||
nmap('<leader>w', ':w<CR>') -- TODO: stop this madness, :h autowrite
|
|
||||||
nmap('Q', ':q!<CR>')
|
|
||||||
nmap('<leader><space>', ':nohlsearch<CR>', { silent = true })
|
|
||||||
|
|
||||||
-- Convenience
|
|
||||||
nmap('yy', 'Y')
|
|
||||||
nmap('Y', 'y$')
|
|
||||||
nmap('N', 'Nzz')
|
|
||||||
nmap('n', 'nzz')
|
|
||||||
nmap('j', 'gj')
|
|
||||||
nmap('k', 'gk')
|
|
||||||
nmap('H', '^')
|
|
||||||
nmap('L', '$')
|
|
||||||
nmap('J', 'mzJ`z')
|
|
||||||
nmap('K', '<Nop>')
|
|
||||||
nmap('gQ', '<Nop>')
|
|
||||||
|
|
||||||
-- Tabs
|
|
||||||
nmap('<leader>t', ':tabnew<CR>')
|
|
||||||
nmap('<Tab>', ':tabnext<CR>')
|
|
||||||
nmap('<S-Tab>', ':tabprevious<CR>')
|
|
||||||
nmap('<leader>1', '1gt')
|
|
||||||
nmap('<leader>2', '2gt')
|
|
||||||
nmap('<leader>3', '3gt')
|
|
||||||
nmap('<leader>4', '4gt')
|
|
||||||
nmap('<leader>5', '5gt')
|
|
||||||
|
|
||||||
-- Visual mode
|
|
||||||
map('v', '.', ':normal .<CR>')
|
|
||||||
map('v', 'J', ':m \'>+1<CR>gv=gv')
|
|
||||||
map('v', 'K', ':m \'<-2<CR>gv=gv')
|
|
||||||
map('v', '<', '<gv')
|
|
||||||
map('v', '>', '>gv')
|
|
||||||
|
|
||||||
-- fzf
|
|
||||||
nmap('<leader>ff', ':Files<CR>')
|
|
||||||
nmap('<leader>ft', ':Files ~/Tmp<CR>')
|
|
||||||
nmap('<leader>fo', ":call fzf#run(fzf#wrap(fzf#vim#with_preview({ 'source': 'fd . --type f --extension=md --follow --exclude .git ~/Syncthing/Obsidian/Personal' })))<CR>", { silent = true })
|
|
||||||
|
|
||||||
-- vim-easy-align
|
|
||||||
map('x', 'ga', ':EasyAlign<CR>') -- TODO: this should allow for gaip, but does not
|
|
||||||
map('v', 'ga', ':EasyAlign<CR>')
|
|
||||||
|
|
||||||
-- nvim-tree.lua
|
|
||||||
nmap('<leader>n', ':NERDTreeToggle<CR>')
|
|
||||||
nmap('<leader>N', ':NERDTreeFind<CR>')
|
|
||||||
|
|
||||||
-- glow.vim
|
|
||||||
nmap('<leader>p', ':Glow<CR>')
|
|
||||||
|
|
||||||
-- fugitive.vim
|
|
||||||
nmap('<leader>ga',':Gwrite<CR>')
|
|
||||||
nmap('<leader>gs',':Git<CR>')
|
|
||||||
nmap('<leader>gb',':Git blame<CR>')
|
|
||||||
|
|
||||||
-- rails-vim
|
|
||||||
nmap('<leader>a', ':A<CR>')
|
|
||||||
|
|
||||||
-- test
|
|
||||||
nmap('<leader>r', ':TestFile<CR>')
|
|
||||||
nmap('<leader>R', ':TestSuite<CR>')
|
|
||||||
|
|
||||||
-- CtrlSF
|
|
||||||
nmap('<C-f>', '<Plug>CtrlSFPrompt')
|
|
||||||
|
|
||||||
-- Plugin config
|
|
||||||
-- Tree-sitter
|
|
||||||
require('nvim-treesitter.configs').setup {
|
|
||||||
-- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
|
||||||
ensure_installed = { 'bash', 'c', 'cpp', 'c_sharp', 'clojure', 'cmake', 'comment', 'commonlisp',
|
|
||||||
'css', 'dockerfile', 'elixir', 'erlang', 'fish', 'go', 'html', 'http', 'java',
|
|
||||||
'javascript', 'json', 'kotlin', 'latex', 'lua', 'make', 'markdown', 'perl', 'php',
|
|
||||||
'python', 'ruby', 'rust', 'scss', 'swift', 'toml', 'tsx', 'vim', 'vue', 'yaml' },
|
|
||||||
-- ignore_install = { 'norg' },
|
|
||||||
highlight = { enable = true },
|
|
||||||
indent = { enable = true },
|
|
||||||
autopairs = { enable = true },
|
|
||||||
}
|
|
||||||
|
|
||||||
-------------------------------
|
|
||||||
|
|
||||||
-- TODO: figure out how to simplify the snippets config
|
|
||||||
-- TODO: figure out how to create custom snippets
|
|
||||||
-- TODO: is it possible to use luasnip without nvim-cpm?
|
|
||||||
|
|
||||||
local function prequire(...)
|
|
||||||
local status, lib = pcall(require, ...)
|
|
||||||
if (status) then return lib end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local luasnip = prequire('luasnip')
|
|
||||||
local cmp = prequire("cmp")
|
|
||||||
|
|
||||||
local t = function(str)
|
|
||||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
local check_back_space = function()
|
|
||||||
local col = vim.fn.col('.') - 1
|
|
||||||
if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
_G.tab_complete = function()
|
|
||||||
if cmp and cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
elseif luasnip and luasnip.expand_or_jumpable() then
|
|
||||||
return t("<Plug>luasnip-expand-or-jump")
|
|
||||||
elseif check_back_space() then
|
|
||||||
return t "<Tab>"
|
|
||||||
else
|
|
||||||
cmp.complete()
|
|
||||||
end
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
_G.s_tab_complete = function()
|
|
||||||
if cmp and cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
elseif luasnip and luasnip.jumpable(-1) then
|
|
||||||
return t("<Plug>luasnip-jump-prev")
|
|
||||||
else
|
|
||||||
return t "<S-Tab>"
|
|
||||||
end
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
|
||||||
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
|
||||||
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
|
||||||
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
|
||||||
vim.api.nvim_set_keymap("i", "<C-E>", "<Plug>luasnip-next-choice", {})
|
|
||||||
vim.api.nvim_set_keymap("s", "<C-E>", "<Plug>luasnip-next-choice", {})
|
|
||||||
|
|
||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
----------- LSP
|
|
||||||
require'lspconfig'.solargraph.setup{}
|
|
||||||
local nvim_lsp = require('lspconfig')
|
|
||||||
|
|
||||||
-- Use an on_attach function to only map the following keys
|
|
||||||
-- after the language server attaches to the current buffer
|
|
||||||
local on_attach = function(client, bufnr)
|
|
||||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
|
||||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
|
||||||
|
|
||||||
-- Enable completion triggered by <c-x><c-o>
|
|
||||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
||||||
|
|
||||||
-- Mappings.
|
|
||||||
local opts = { noremap=true, silent=true }
|
|
||||||
|
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
|
||||||
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
|
||||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
|
||||||
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<space>=', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
|
||||||
-- map buffer local keybindings when the language server attaches
|
|
||||||
local servers = { 'solargraph' }
|
|
||||||
for _, lsp in ipairs(servers) do
|
|
||||||
nvim_lsp[lsp].setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
flags = {
|
|
||||||
debounce_text_changes = 150,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
local cmp = require 'cmp'
|
|
||||||
cmp.setup {
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
require('luasnip').lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
mapping = {
|
|
||||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
|
||||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
|
||||||
['<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,
|
|
||||||
},
|
|
||||||
['<Tab>'] = function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
elseif luasnip.expand_or_jumpable() then
|
|
||||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-expand-or-jump', true, true, true), '')
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
['<S-Tab>'] = function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
elseif luasnip.jumpable(-1) then
|
|
||||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-jump-prev', true, true, true), '')
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
sources = {
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
{ name = 'luasnip' },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
11
vim/.config/nvim/init.lua
Normal file
11
vim/.config/nvim/init.lua
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
-- Author: Konstantin Bukley <madundead@gmail.com>
|
||||||
|
-- License: WTFPL
|
||||||
|
-- Description: Personal neovim configuration
|
||||||
|
|
||||||
|
vim.g.mapleader = ' '
|
||||||
|
|
||||||
|
require('builtins')
|
||||||
|
require('filetypes')
|
||||||
|
require('settings')
|
||||||
|
require('plugins')
|
||||||
|
require('mappings')
|
||||||
@@ -1 +0,0 @@
|
|||||||
source ~/.vimrc
|
|
||||||
21
vim/.config/nvim/lua/builtins.lua
Normal file
21
vim/.config/nvim/lua/builtins.lua
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
-- Disable builtins
|
||||||
|
vim.g.loaded_gzip = 1
|
||||||
|
vim.g.loaded_zip = 1
|
||||||
|
vim.g.loaded_zipPlugin = 1
|
||||||
|
vim.g.loaded_tar = 1
|
||||||
|
vim.g.loaded_tarPlugin = 1
|
||||||
|
|
||||||
|
vim.g.loaded_getscript = 1
|
||||||
|
vim.g.loaded_getscriptPlugin = 1
|
||||||
|
vim.g.loaded_vimball = 1
|
||||||
|
vim.g.loaded_vimballPlugin = 1
|
||||||
|
vim.g.loaded_2html_plugin = 1
|
||||||
|
|
||||||
|
vim.g.loaded_matchit = 1
|
||||||
|
vim.g.loaded_matchparen = 1
|
||||||
|
vim.g.loaded_logiPat = 1
|
||||||
|
vim.g.loaded_rrhelper = 1
|
||||||
|
|
||||||
|
vim.g.loaded_netrw = 1
|
||||||
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
vim.g.loaded_netrwSettings = 1
|
||||||
24
vim/.config/nvim/lua/filetypes.lua
Normal file
24
vim/.config/nvim/lua/filetypes.lua
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
if not vim.filetype then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.g.did_load_filetypes = 0 -- deactivate vim based filetype detection
|
||||||
|
vim.g.do_filetype_lua = 1 -- enable
|
||||||
|
|
||||||
|
vim.filetype.add({
|
||||||
|
extension = {
|
||||||
|
lock = 'yaml',
|
||||||
|
},
|
||||||
|
filename = {
|
||||||
|
['.gitignore'] = 'conf',
|
||||||
|
['launch.json'] = 'jsonc',
|
||||||
|
Podfile = 'ruby',
|
||||||
|
Brewfile = 'ruby',
|
||||||
|
Vagrantfile = 'ruby',
|
||||||
|
},
|
||||||
|
pattern = {
|
||||||
|
['*.gradle'] = 'groovy',
|
||||||
|
['*.env.*'] = 'env',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
79
vim/.config/nvim/lua/mappings.lua
Normal file
79
vim/.config/nvim/lua/mappings.lua
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
local function map(mode, lhs, rhs, opts)
|
||||||
|
local options = { noremap = true }
|
||||||
|
if opts then options = vim.tbl_extend('force', options, opts) end
|
||||||
|
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function nmap(lhs, rhs, opts)
|
||||||
|
map('n', lhs, rhs, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Mappings
|
||||||
|
-- Essentials
|
||||||
|
nmap(';', ':')
|
||||||
|
nmap(',,', '<C-^>')
|
||||||
|
nmap('<leader>w', ':w<CR>') -- TODO: stop this madness, :h autowrite
|
||||||
|
nmap('Q', ':q!<CR>')
|
||||||
|
nmap('<leader><space>', ':nohlsearch<CR>', { silent = true })
|
||||||
|
|
||||||
|
-- Convenience
|
||||||
|
nmap('yy', 'Y')
|
||||||
|
nmap('Y', 'y$')
|
||||||
|
nmap('N', 'Nzz')
|
||||||
|
nmap('n', 'nzz')
|
||||||
|
nmap('j', 'gj')
|
||||||
|
nmap('k', 'gk')
|
||||||
|
nmap('H', '^')
|
||||||
|
nmap('L', '$')
|
||||||
|
nmap('J', 'mzJ`z')
|
||||||
|
nmap('K', '<Nop>')
|
||||||
|
nmap('gQ', '<Nop>')
|
||||||
|
|
||||||
|
-- Tabs
|
||||||
|
nmap('<leader>t', ':tabnew<CR>')
|
||||||
|
nmap('<Tab>', ':tabnext<CR>')
|
||||||
|
nmap('<S-Tab>', ':tabprevious<CR>')
|
||||||
|
nmap('<leader>1', '1gt')
|
||||||
|
nmap('<leader>2', '2gt')
|
||||||
|
nmap('<leader>3', '3gt')
|
||||||
|
nmap('<leader>4', '4gt')
|
||||||
|
nmap('<leader>5', '5gt')
|
||||||
|
|
||||||
|
-- Visual mode
|
||||||
|
map('v', '.', ':normal .<CR>')
|
||||||
|
map('v', 'J', ':m \'>+1<CR>gv=gv')
|
||||||
|
map('v', 'K', ':m \'<-2<CR>gv=gv')
|
||||||
|
map('v', '<', '<gv')
|
||||||
|
map('v', '>', '>gv')
|
||||||
|
|
||||||
|
-- fzf
|
||||||
|
nmap('<leader>ff', ':Files<CR>')
|
||||||
|
nmap('<leader>ft', ':Files ~/Tmp<CR>')
|
||||||
|
-- TODO: make the path relative to ~/Syncthing/Obsidian/Personal
|
||||||
|
nmap('<leader>fo', ":call fzf#run(fzf#wrap(fzf#vim#with_preview({ 'source': 'fd . --type f --extension=md --follow --exclude .git ~/Syncthing/Obsidian/Personal' })))<CR>", { silent = true })
|
||||||
|
|
||||||
|
-- vim-easy-align
|
||||||
|
map('x', 'ga', ':EasyAlign<CR>') -- TODO: this should allow for gaip, but does not
|
||||||
|
map('v', 'ga', ':EasyAlign<CR>')
|
||||||
|
|
||||||
|
-- nvim-tree.lua
|
||||||
|
nmap('<leader>n', ':NERDTreeToggle<CR>')
|
||||||
|
nmap('<leader>N', ':NERDTreeFind<CR>')
|
||||||
|
|
||||||
|
-- glow.vim
|
||||||
|
nmap('<leader>p', ':Glow<CR>')
|
||||||
|
|
||||||
|
-- fugitive.vim
|
||||||
|
nmap('<leader>ga',':Gwrite<CR>')
|
||||||
|
nmap('<leader>gs',':Git<CR>')
|
||||||
|
nmap('<leader>gb',':Git blame<CR>')
|
||||||
|
|
||||||
|
-- rails-vim
|
||||||
|
nmap('<leader>a', ':A<CR>')
|
||||||
|
|
||||||
|
-- test
|
||||||
|
nmap('<leader>r', ':TestFile<CR>')
|
||||||
|
nmap('<leader>R', ':TestSuite<CR>')
|
||||||
|
|
||||||
|
-- CtrlSF
|
||||||
|
nmap('<C-f>', '<Plug>CtrlSFPrompt')
|
||||||
5
vim/.config/nvim/lua/plugins/gitgutter.lua
Normal file
5
vim/.config/nvim/lua/plugins/gitgutter.lua
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
vim.g.gitgutter_sign_added = '│'
|
||||||
|
vim.g.gitgutter_sign_modified = '│'
|
||||||
|
vim.g.gitgutter_sign_removed = '│'
|
||||||
|
vim.g.gitgutter_sign_modified_removed = '│'
|
||||||
|
vim.g.gitgutter_sign_removed_first_line = '│'
|
||||||
79
vim/.config/nvim/lua/plugins/init.lua
Normal file
79
vim/.config/nvim/lua/plugins/init.lua
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
local g = vim.g -- a table to access global variables
|
||||||
|
|
||||||
|
local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim'
|
||||||
|
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
||||||
|
vim.fn.execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path)
|
||||||
|
end
|
||||||
|
|
||||||
|
require('packer').startup(function()
|
||||||
|
use 'wbthomason/packer.nvim'
|
||||||
|
use 'arcticicestudio/nord-vim'
|
||||||
|
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
|
||||||
|
use 'tpope/vim-commentary'
|
||||||
|
use 'tpope/vim-surround'
|
||||||
|
use { 'junegunn/fzf', run = 'cd ~/.fzf && ./install --all' }
|
||||||
|
use 'junegunn/fzf.vim'
|
||||||
|
use 'junegunn/vim-easy-align'
|
||||||
|
use 'christoomey/vim-tmux-navigator'
|
||||||
|
use 'airblade/vim-gitgutter'
|
||||||
|
use 'tpope/vim-repeat'
|
||||||
|
use 'scrooloose/nerdtree' -- other file tree plugins are too fancy
|
||||||
|
use 'ellisonleao/glow.nvim'
|
||||||
|
|
||||||
|
-- Snippets
|
||||||
|
use 'L3MON4D3/LuaSnip'
|
||||||
|
use 'hrsh7th/nvim-cmp'
|
||||||
|
use 'saadparwaiz1/cmp_luasnip'
|
||||||
|
use 'rafamadriz/friendly-snippets'
|
||||||
|
|
||||||
|
use 'neovim/nvim-lspconfig'
|
||||||
|
|
||||||
|
-- tpope
|
||||||
|
use 'tpope/vim-fugitive'
|
||||||
|
use 'tpope/vim-rails'
|
||||||
|
|
||||||
|
-- tests
|
||||||
|
use 'vim-test/vim-test'
|
||||||
|
use 'benmills/vimux'
|
||||||
|
|
||||||
|
use 'dyng/ctrlsf.vim'
|
||||||
|
|
||||||
|
use 'nvim-lua/plenary.nvim'
|
||||||
|
use 'nvim-telescope/telescope.nvim'
|
||||||
|
end)
|
||||||
|
|
||||||
|
require 'plugins/treesitter'
|
||||||
|
require 'plugins/gitgutter'
|
||||||
|
require 'plugins/lsp'
|
||||||
|
require 'plugins/luasnip'
|
||||||
|
|
||||||
|
-- fzf
|
||||||
|
g.fzf_preview_window = ''
|
||||||
|
g.fzf_layout = { window = { width = 0.6, height = 0.6, border = 'sharp' } }
|
||||||
|
|
||||||
|
-- NERDTree
|
||||||
|
g.NERDTreeWinPos = "right"
|
||||||
|
g.NERDTreeMinimalUI = 1
|
||||||
|
g.NERDTreeDirArrows = 1
|
||||||
|
g.NERDTreeAutoDeleteBuffer = 1
|
||||||
|
g.NERDTreeHijackNetrw = 1
|
||||||
|
|
||||||
|
-- vim-test
|
||||||
|
g['test#strategy'] = 'vimux'
|
||||||
|
|
||||||
|
-- CtrlSF
|
||||||
|
g.ctrlsf_ackprg = 'rg'
|
||||||
|
g.ctrlsf_regex_pattern = 1
|
||||||
|
g.ctrlsf_case_sensitive = 'smart'
|
||||||
|
g.ctrlsf_default_root = 'project'
|
||||||
|
g.ctrlsf_context = '-B 1 -A 1'
|
||||||
|
g.ctrlsf_position = 'bottom'
|
||||||
|
g.ctrlsf_winsize = '40%'
|
||||||
|
g.ctrlsf_mapping = {
|
||||||
|
next = 'n',
|
||||||
|
prev = 'N',
|
||||||
|
}
|
||||||
|
|
||||||
|
-- fzf
|
||||||
|
g.fzf_preview_window = ''
|
||||||
|
g.fzf_layout = { window = { width = 0.6, height = 0.6, border = 'sharp' } }
|
||||||
77
vim/.config/nvim/lua/plugins/lsp.lua
Normal file
77
vim/.config/nvim/lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
----------- LSP
|
||||||
|
require'lspconfig'.solargraph.setup{}
|
||||||
|
local nvim_lsp = require('lspconfig')
|
||||||
|
|
||||||
|
-- Use an on_attach function to only map the following keys
|
||||||
|
-- after the language server attaches to the current buffer
|
||||||
|
local on_attach = function(client, bufnr)
|
||||||
|
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||||
|
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||||
|
|
||||||
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
|
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
|
||||||
|
-- Mappings.
|
||||||
|
local opts = { noremap=true, silent=true }
|
||||||
|
|
||||||
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
|
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||||
|
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||||
|
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||||
|
buf_set_keymap('n', '<space>=', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||||
|
-- map buffer local keybindings when the language server attaches
|
||||||
|
local servers = { 'solargraph' }
|
||||||
|
for _, lsp in ipairs(servers) do
|
||||||
|
nvim_lsp[lsp].setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
flags = {
|
||||||
|
debounce_text_changes = 150,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local cmp = require 'cmp'
|
||||||
|
cmp.setup {
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require('luasnip').lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = {
|
||||||
|
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||||
|
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||||
|
['<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,
|
||||||
|
},
|
||||||
|
['<Tab>'] = function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-expand-or-jump', true, true, true), '')
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
['<S-Tab>'] = function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.jumpable(-1) then
|
||||||
|
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-jump-prev', true, true, true), '')
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
},
|
||||||
|
}
|
||||||
57
vim/.config/nvim/lua/plugins/luasnip.lua
Normal file
57
vim/.config/nvim/lua/plugins/luasnip.lua
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
-- TODO: figure out how to simplify the snippets config
|
||||||
|
-- TODO: figure out how to create custom snippets
|
||||||
|
-- TODO: is it possible to use luasnip without nvim-cpm?
|
||||||
|
|
||||||
|
local function prequire(...)
|
||||||
|
local status, lib = pcall(require, ...)
|
||||||
|
if (status) then return lib end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local luasnip = prequire('luasnip')
|
||||||
|
local cmp = prequire("cmp")
|
||||||
|
|
||||||
|
local t = function(str)
|
||||||
|
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
local check_back_space = function()
|
||||||
|
local col = vim.fn.col('.') - 1
|
||||||
|
if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
_G.tab_complete = function()
|
||||||
|
if cmp and cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip and luasnip.expand_or_jumpable() then
|
||||||
|
return t("<Plug>luasnip-expand-or-jump")
|
||||||
|
elseif check_back_space() then
|
||||||
|
return t "<Tab>"
|
||||||
|
else
|
||||||
|
cmp.complete()
|
||||||
|
end
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
_G.s_tab_complete = function()
|
||||||
|
if cmp and cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip and luasnip.jumpable(-1) then
|
||||||
|
return t("<Plug>luasnip-jump-prev")
|
||||||
|
else
|
||||||
|
return t "<S-Tab>"
|
||||||
|
end
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||||
|
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||||
|
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||||
|
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||||
|
vim.api.nvim_set_keymap("i", "<C-E>", "<Plug>luasnip-next-choice", {})
|
||||||
|
vim.api.nvim_set_keymap("s", "<C-E>", "<Plug>luasnip-next-choice", {})
|
||||||
|
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
12
vim/.config/nvim/lua/plugins/treesitter.lua
Normal file
12
vim/.config/nvim/lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
-- Tree-sitter
|
||||||
|
require('nvim-treesitter.configs').setup {
|
||||||
|
-- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||||
|
ensure_installed = { 'bash', 'c', 'cpp', 'c_sharp', 'clojure', 'cmake', 'comment', 'commonlisp',
|
||||||
|
'css', 'dockerfile', 'elixir', 'erlang', 'fish', 'go', 'html', 'http', 'java',
|
||||||
|
'javascript', 'json', 'kotlin', 'latex', 'lua', 'make', 'markdown', 'perl', 'php',
|
||||||
|
'python', 'ruby', 'rust', 'scss', 'swift', 'toml', 'tsx', 'vim', 'vue', 'yaml' },
|
||||||
|
-- ignore_install = { 'norg' },
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true },
|
||||||
|
autopairs = { enable = true },
|
||||||
|
}
|
||||||
89
vim/.config/nvim/lua/settings.lua
Normal file
89
vim/.config/nvim/lua/settings.lua
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
-- TODO:
|
||||||
|
-- " Conceal mostly for markdown TODO :h conceallevel
|
||||||
|
-- set conceallevel=2
|
||||||
|
-- " Highlight VCS conflict markers TODO: translate to LUA
|
||||||
|
-- match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
|
||||||
|
|
||||||
|
-- local g = vim.g -- a table to access global variables
|
||||||
|
local opt = vim.opt -- to set options
|
||||||
|
local cmd = vim.cmd -- to set options
|
||||||
|
|
||||||
|
cmd('au TextYankPost * lua vim.highlight.on_yank { timeout = 250 }')
|
||||||
|
cmd('colorscheme nord')
|
||||||
|
|
||||||
|
opt.smartindent = true -- Autoindenting when starting a new line
|
||||||
|
opt.tabstop = 2 -- Tab counts as 2 columns
|
||||||
|
opt.shiftwidth = 2 -- Numbers of spaces to (auto)indent
|
||||||
|
opt.expandtab = true -- Tabs to spaces
|
||||||
|
opt.clipboard = 'unnamedplus' -- Share clipboard with the OS
|
||||||
|
opt.number = true -- Display line numbers
|
||||||
|
opt.fillchars = {
|
||||||
|
vert = '▕', -- alternatives │
|
||||||
|
eob = ' ', -- suppress ~ at EndOfBuffer
|
||||||
|
msgsep = '‾',
|
||||||
|
diff = '⣿',
|
||||||
|
fold = ' ',
|
||||||
|
foldopen = '▾',
|
||||||
|
foldsep = '│',
|
||||||
|
foldclose = '▸',
|
||||||
|
}
|
||||||
|
opt.synmaxcol = 500 -- Do not try to highlight lines longer than 500 characters
|
||||||
|
opt.lazyredraw = true -- Do not redraw while running macros
|
||||||
|
opt.showmatch = true -- Show matching braces
|
||||||
|
opt.matchtime = 2 -- Show matching braces for 2 tenths of second
|
||||||
|
opt.showmode = true -- Shows when you are in insert mode
|
||||||
|
opt.title = true -- Show title in console status bar
|
||||||
|
opt.laststatus = 3 -- Single status line
|
||||||
|
opt.wrap = false -- Dont wrap lines
|
||||||
|
opt.scrolloff = 5 -- Keep 5 rows on the screen when scrolling
|
||||||
|
opt.sidescrolloff = 15 -- Horizontal scrolloff
|
||||||
|
opt.visualbell = false -- No visual bell
|
||||||
|
opt.backup = false -- No backups
|
||||||
|
opt.writebackup = false -- No backups
|
||||||
|
opt.swapfile = false -- No backups
|
||||||
|
opt.mouse = 'a' -- Support mouse (for proper mouse highlight)
|
||||||
|
opt.list = true -- List mode
|
||||||
|
opt.listchars = { trail = '·', tab = '->' }
|
||||||
|
opt.timeoutlen = 1000 -- Delay for mappings
|
||||||
|
opt.ttimeoutlen = 0 -- Delay between modes
|
||||||
|
opt.shellcmdflag = '-ic' -- Enables aliases from .bashrc in :! commands
|
||||||
|
|
||||||
|
if vim.fn.executable('rg') > 0 then
|
||||||
|
vim.o.grepprg = [[rg --glob "!.git" --no-heading --vimgrep --follow $*]]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Use in vertical diff mode, blank lines to keep sides aligned, Ignore whitespace changes
|
||||||
|
opt.diffopt = vim.opt.diffopt
|
||||||
|
+ {
|
||||||
|
'vertical',
|
||||||
|
'iwhite',
|
||||||
|
'hiddenoff',
|
||||||
|
'foldcolumn:0',
|
||||||
|
'context:4',
|
||||||
|
'algorithm:histogram',
|
||||||
|
'indent-heuristic',
|
||||||
|
}
|
||||||
|
|
||||||
|
opt.shortmess = {
|
||||||
|
t = true, -- truncate file messages at start
|
||||||
|
A = true, -- ignore annoying swap file messages
|
||||||
|
o = true, -- file-read message overwrites previous
|
||||||
|
O = true, -- file-read message overwrites previous
|
||||||
|
T = true, -- truncate non-file messages in middle
|
||||||
|
f = true, -- (file x of x) instead of just (x of x
|
||||||
|
F = true, -- Don't give file info when editing a file, NOTE: this breaks autocommand messages
|
||||||
|
s = true,
|
||||||
|
I = true, -- disable welcome message (:intro)
|
||||||
|
a = true, -- shortmess for everything
|
||||||
|
c = true,
|
||||||
|
W = true, -- Don't show [w] or written when writing
|
||||||
|
}
|
||||||
|
|
||||||
|
-- ignore when autocompleting
|
||||||
|
opt.wildignore = {
|
||||||
|
'*.aux', '*.out', '*.toc', '*.o', '*.obj',
|
||||||
|
'*.dll', '*.jar', '*.pyc', '*.rbc', '*.class',
|
||||||
|
'*.gif', '*.ico', '*.jpg', '*.jpeg', '*.png',
|
||||||
|
'*.avi', '*.wav', '*.*~', '*~ ', '*.swp',
|
||||||
|
'.lock', '.DS_Store', 'tags.lock'
|
||||||
|
}
|
||||||
207
vim/.config/nvim/plugin/packer_compiled.lua
Normal file
207
vim/.config/nvim/plugin/packer_compiled.lua
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
-- 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()
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
_G._packer = _G._packer or {}
|
||||||
|
_G._packer.profile_output = results
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[Luarocks path setup]], true)
|
||||||
|
local package_path_str = "/Users/madundead/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/madundead/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/madundead/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/madundead/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
||||||
|
local install_cpath_pattern = "/Users/madundead/.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 = {
|
||||||
|
LuaSnip = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/LuaSnip",
|
||||||
|
url = "https://github.com/L3MON4D3/LuaSnip"
|
||||||
|
},
|
||||||
|
cmp_luasnip = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
|
||||||
|
url = "https://github.com/saadparwaiz1/cmp_luasnip"
|
||||||
|
},
|
||||||
|
["ctrlsf.vim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/ctrlsf.vim",
|
||||||
|
url = "https://github.com/dyng/ctrlsf.vim"
|
||||||
|
},
|
||||||
|
["friendly-snippets"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/friendly-snippets",
|
||||||
|
url = "https://github.com/rafamadriz/friendly-snippets"
|
||||||
|
},
|
||||||
|
fzf = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/fzf",
|
||||||
|
url = "https://github.com/junegunn/fzf"
|
||||||
|
},
|
||||||
|
["fzf.vim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/fzf.vim",
|
||||||
|
url = "https://github.com/junegunn/fzf.vim"
|
||||||
|
},
|
||||||
|
["glow.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/glow.nvim",
|
||||||
|
url = "https://github.com/ellisonleao/glow.nvim"
|
||||||
|
},
|
||||||
|
nerdtree = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/nerdtree",
|
||||||
|
url = "https://github.com/scrooloose/nerdtree"
|
||||||
|
},
|
||||||
|
["nord-vim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/nord-vim",
|
||||||
|
url = "https://github.com/arcticicestudio/nord-vim"
|
||||||
|
},
|
||||||
|
["nvim-cmp"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||||
|
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||||
|
},
|
||||||
|
["nvim-lspconfig"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||||
|
url = "https://github.com/neovim/nvim-lspconfig"
|
||||||
|
},
|
||||||
|
["nvim-treesitter"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||||
|
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||||
|
},
|
||||||
|
["packer.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
||||||
|
url = "https://github.com/wbthomason/packer.nvim"
|
||||||
|
},
|
||||||
|
["plenary.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||||
|
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||||
|
},
|
||||||
|
["telescope.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||||
|
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||||
|
},
|
||||||
|
["vim-commentary"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-commentary",
|
||||||
|
url = "https://github.com/tpope/vim-commentary"
|
||||||
|
},
|
||||||
|
["vim-easy-align"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-easy-align",
|
||||||
|
url = "https://github.com/junegunn/vim-easy-align"
|
||||||
|
},
|
||||||
|
["vim-fugitive"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-fugitive",
|
||||||
|
url = "https://github.com/tpope/vim-fugitive"
|
||||||
|
},
|
||||||
|
["vim-gitgutter"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-gitgutter",
|
||||||
|
url = "https://github.com/airblade/vim-gitgutter"
|
||||||
|
},
|
||||||
|
["vim-rails"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-rails",
|
||||||
|
url = "https://github.com/tpope/vim-rails"
|
||||||
|
},
|
||||||
|
["vim-repeat"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-repeat",
|
||||||
|
url = "https://github.com/tpope/vim-repeat"
|
||||||
|
},
|
||||||
|
["vim-surround"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-surround",
|
||||||
|
url = "https://github.com/tpope/vim-surround"
|
||||||
|
},
|
||||||
|
["vim-test"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-test",
|
||||||
|
url = "https://github.com/vim-test/vim-test"
|
||||||
|
},
|
||||||
|
["vim-tmux-navigator"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-tmux-navigator",
|
||||||
|
url = "https://github.com/christoomey/vim-tmux-navigator"
|
||||||
|
},
|
||||||
|
vimux = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vimux",
|
||||||
|
url = "https://github.com/benmills/vimux"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
time([[Defining packer_plugins]], 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
|
||||||
Reference in New Issue
Block a user