first commit
This commit is contained in:
280
nvim/init.lua
Normal file
280
nvim/init.lua
Normal file
@@ -0,0 +1,280 @@
|
||||
-- Enable line numbers
|
||||
vim.o.number = true
|
||||
|
||||
-- Enable true color support
|
||||
if vim.fn.has("termguicolors") then
|
||||
vim.o.termguicolors = true
|
||||
end
|
||||
|
||||
-- Set the indentation rules
|
||||
vim.o.tabstop = 4
|
||||
vim.o.shiftwidth = 4
|
||||
vim.o.expandtab = true
|
||||
|
||||
-- Enable syntax highlighting
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
|
||||
-- Use a protected call to avoid errors on first use
|
||||
local status_ok, packer = pcall(require, "packer")
|
||||
if not status_ok then
|
||||
print("Packer not found!")
|
||||
return
|
||||
end
|
||||
|
||||
-- Initialize the plugins
|
||||
packer.init({
|
||||
display = {
|
||||
open_fn = function()
|
||||
return require('packer.util').float({ border = 'single' })
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
-- Specify the plugins
|
||||
packer.startup(function(use)
|
||||
-- Packer can manage itself
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
-- File icons
|
||||
use 'kyazdani42/nvim-web-devicons'
|
||||
|
||||
-- Gruvbox theme
|
||||
use {
|
||||
'morhetz/gruvbox',
|
||||
config = function()
|
||||
vim.cmd 'colorscheme gruvbox'
|
||||
end
|
||||
}
|
||||
|
||||
-- Commenting
|
||||
use {
|
||||
'numToStr/Comment.nvim',
|
||||
config = function()
|
||||
require('Comment').setup()
|
||||
end
|
||||
}
|
||||
|
||||
-- Status line
|
||||
use {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
requires = {'kyazdani42/nvim-web-devicons', opt = true},
|
||||
config = function()
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'gruvbox',
|
||||
component_separators = '|',
|
||||
section_separators = '',
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', {'diagnostics', sources={'nvim_lsp', 'coc'}}},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'location'},
|
||||
},
|
||||
tabline = {},
|
||||
extensions = {}
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
-- Markdown preview
|
||||
use {'iamcco/markdown-preview.nvim'}
|
||||
|
||||
-- Vimwiki
|
||||
use {
|
||||
'vimwiki/vimwiki',
|
||||
config = function()
|
||||
vim.g.vimwiki_list = {{
|
||||
path = '~/vimwiki/',
|
||||
syntax = 'markdown',
|
||||
ext = '.md',
|
||||
diary_rel_path = 'diary/'
|
||||
}}
|
||||
end
|
||||
}
|
||||
|
||||
-- Gitsigns
|
||||
use {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
requires = {
|
||||
'nvim-lua/plenary.nvim'
|
||||
},
|
||||
config = function()
|
||||
require('gitsigns').setup()
|
||||
end
|
||||
}
|
||||
|
||||
-- Which-key
|
||||
use {
|
||||
'folke/which-key.nvim',
|
||||
config = function()
|
||||
require('which-key').setup()
|
||||
end
|
||||
}
|
||||
|
||||
-- nvim-cmp for autocompletion
|
||||
use 'hrsh7th/nvim-cmp' -- Completion framework
|
||||
use 'hrsh7th/cmp-nvim-lsp' -- LSP completion source
|
||||
use 'hrsh7th/cmp-buffer' -- Buffer completion source
|
||||
use 'hrsh7th/cmp-path' -- Path completion source
|
||||
use 'hrsh7th/cmp-cmdline' -- Command line completion source
|
||||
use 'saadparwaiz1/cmp_luasnip' -- Snippet completion source
|
||||
use 'L3MON4D3/LuaSnip' -- Snippet engine
|
||||
|
||||
-- LSP support
|
||||
use 'neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client
|
||||
|
||||
-- File explorer
|
||||
use {
|
||||
'kyazdani42/nvim-tree.lua',
|
||||
requires = 'kyazdani42/nvim-web-devicons',
|
||||
config = function()
|
||||
require'nvim-tree'.setup {}
|
||||
end
|
||||
}
|
||||
|
||||
-- Fuzzy finder
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
requires = { {'nvim-lua/plenary.nvim'} },
|
||||
config = function()
|
||||
require'telescope'.setup {}
|
||||
end
|
||||
}
|
||||
|
||||
-- Treesitter
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = ':TSUpdate',
|
||||
config = function()
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
-- Auto-pairs
|
||||
use {
|
||||
'windwp/nvim-autopairs',
|
||||
config = function()
|
||||
require'nvim-autopairs'.setup {}
|
||||
end
|
||||
}
|
||||
|
||||
end)
|
||||
|
||||
-- LSP settings
|
||||
local lspconfig = require('lspconfig')
|
||||
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
|
||||
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
local opts = { noremap=true, silent=true }
|
||||
|
||||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
||||
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
end
|
||||
|
||||
-- Enable the following language servers
|
||||
local servers = { 'pyright', 'tsserver', 'gopls', 'rust_analyzer' }
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
}
|
||||
end
|
||||
|
||||
-- nvim-cmp setup
|
||||
local cmp = require'cmp'
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require'luasnip'.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-b>'] = 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 = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
}
|
||||
})
|
||||
|
||||
-- Keybindings for custom functions
|
||||
function SearchWikipedia()
|
||||
local query = vim.fn.input('Wikipedia Search: ')
|
||||
query = vim.fn.shellescape(query)
|
||||
local search_url = "https://en.wikipedia.org/wiki/Special:Search?search=" .. query
|
||||
vim.cmd('silent !xdg-open ' .. search_url)
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<leader>w', ':lua SearchWikipedia()<CR>', {noremap = true, silent = true})
|
||||
|
||||
require('arduino')
|
||||
|
||||
local group = vim.api.nvim_create_augroup('FileTypeSpecific', {clear = true})
|
||||
local associations = {
|
||||
-- extension functions to call
|
||||
{ '*.ino' , { arduino } },
|
||||
}
|
||||
|
||||
for _, assoc in ipairs(associations) do
|
||||
local pattern = assoc[1]
|
||||
local callbacks = assoc[2]
|
||||
|
||||
vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead', 'BufEnter'}, {
|
||||
pattern = pattern,
|
||||
group = group,
|
||||
callback =
|
||||
function()
|
||||
for _, callback in ipairs(callbacks) do
|
||||
callback()
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
256
nvim/init.lua.bak
Normal file
256
nvim/init.lua.bak
Normal file
@@ -0,0 +1,256 @@
|
||||
-- Enable line numbers
|
||||
vim.o.number = true
|
||||
|
||||
-- Enable true color support
|
||||
if vim.fn.has("termguicolors") then
|
||||
vim.o.termguicolors = true
|
||||
end
|
||||
|
||||
-- Set the indentation rules
|
||||
vim.o.tabstop = 4
|
||||
vim.o.shiftwidth = 4
|
||||
vim.o.expandtab = true
|
||||
|
||||
-- Enable syntax highlighting
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
|
||||
-- Use a protected call to avoid errors on first use
|
||||
local status_ok, packer = pcall(require, "packer")
|
||||
if not status_ok then
|
||||
print("Packer not found!")
|
||||
return
|
||||
end
|
||||
|
||||
-- Initialize the plugins
|
||||
packer.init({
|
||||
display = {
|
||||
open_fn = function()
|
||||
return require('packer.util').float({ border = 'single' })
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
-- Specify the plugins
|
||||
packer.startup(function(use)
|
||||
-- Packer can manage itself
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
-- File icons
|
||||
use 'kyazdani42/nvim-web-devicons'
|
||||
|
||||
-- Gruvbox theme
|
||||
use {
|
||||
'morhetz/gruvbox',
|
||||
config = function()
|
||||
vim.cmd 'colorscheme gruvbox'
|
||||
end
|
||||
}
|
||||
|
||||
-- Commenting
|
||||
use {
|
||||
'numToStr/Comment.nvim',
|
||||
config = function()
|
||||
require('Comment').setup()
|
||||
end
|
||||
}
|
||||
|
||||
-- Status line
|
||||
use {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
requires = {'kyazdani42/nvim-web-devicons', opt = true},
|
||||
config = function()
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'gruvbox',
|
||||
component_separators = '|',
|
||||
section_separators = '',
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', {'diagnostics', sources={'nvim_lsp', 'coc'}}},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'location'},
|
||||
},
|
||||
tabline = {},
|
||||
extensions = {}
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
-- Markdown preview
|
||||
use {'iamcco/markdown-preview.nvim'}
|
||||
|
||||
-- Vimwiki
|
||||
use {
|
||||
'vimwiki/vimwiki',
|
||||
config = function()
|
||||
vim.g.vimwiki_list = {{
|
||||
path = '~/vimwiki/',
|
||||
syntax = 'markdown',
|
||||
ext = '.md',
|
||||
diary_rel_path = 'diary/'
|
||||
}}
|
||||
end
|
||||
}
|
||||
|
||||
-- Gitsigns
|
||||
use {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
requires = {
|
||||
'nvim-lua/plenary.nvim'
|
||||
},
|
||||
config = function()
|
||||
require('gitsigns').setup()
|
||||
end
|
||||
}
|
||||
|
||||
-- Which-key
|
||||
use {
|
||||
'folke/which-key.nvim',
|
||||
config = function()
|
||||
require('which-key').setup()
|
||||
end
|
||||
}
|
||||
|
||||
-- nvim-cmp for autocompletion
|
||||
use 'hrsh7th/nvim-cmp' -- Completion framework
|
||||
use 'hrsh7th/cmp-nvim-lsp' -- LSP completion source
|
||||
use 'hrsh7th/cmp-buffer' -- Buffer completion source
|
||||
use 'hrsh7th/cmp-path' -- Path completion source
|
||||
use 'hrsh7th/cmp-cmdline' -- Command line completion source
|
||||
use 'saadparwaiz1/cmp_luasnip' -- Snippet completion source
|
||||
use 'L3MON4D3/LuaSnip' -- Snippet engine
|
||||
|
||||
-- LSP support
|
||||
use 'neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client
|
||||
|
||||
-- File explorer
|
||||
use {
|
||||
'kyazdani42/nvim-tree.lua',
|
||||
requires = 'kyazdani42/nvim-web-devicons',
|
||||
config = function()
|
||||
require'nvim-tree'.setup {}
|
||||
end
|
||||
}
|
||||
|
||||
-- Fuzzy finder
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
requires = { {'nvim-lua/plenary.nvim'} },
|
||||
config = function()
|
||||
require'telescope'.setup {}
|
||||
end
|
||||
}
|
||||
|
||||
-- Treesitter
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = ':TSUpdate',
|
||||
config = function()
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
-- Auto-pairs
|
||||
use {
|
||||
'windwp/nvim-autopairs',
|
||||
config = function()
|
||||
require'nvim-autopairs'.setup {}
|
||||
end
|
||||
}
|
||||
|
||||
end)
|
||||
|
||||
-- LSP settings
|
||||
local lspconfig = require('lspconfig')
|
||||
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
|
||||
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
local opts = { noremap=true, silent=true }
|
||||
|
||||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
||||
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
end
|
||||
|
||||
-- Enable the following language servers
|
||||
local servers = { 'pyright', 'tsserver', 'gopls', 'rust_analyzer' }
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
}
|
||||
end
|
||||
|
||||
-- nvim-cmp setup
|
||||
local cmp = require'cmp'
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require'luasnip'.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-b>'] = 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 = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
}
|
||||
})
|
||||
|
||||
-- Keybindings for custom functions
|
||||
function SearchWikipedia()
|
||||
local query = vim.fn.input('Wikipedia Search: ')
|
||||
query = vim.fn.shellescape(query)
|
||||
local search_url = "https://en.wikipedia.org/wiki/Special:Search?search=" .. query
|
||||
vim.cmd('silent !xdg-open ' .. search_url)
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<leader>w', ':lua SearchWikipedia()<CR>', {noremap = true, silent = true})
|
||||
21
nvim/lua/arduino.lua
Normal file
21
nvim/lua/arduino.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
function map(mode, shortcut, command)
|
||||
vim.api.nvim_set_keymap(mode, shortcut, command, {noremap=true})
|
||||
end
|
||||
|
||||
function nn(shortcut, command)
|
||||
map('n', shortcut, command)
|
||||
end
|
||||
|
||||
function ino(shortcut, command)
|
||||
map('i', shortcut, command)
|
||||
end
|
||||
|
||||
function arduino()
|
||||
baudrate = 9600
|
||||
-- compile and upload sketch
|
||||
nn('<c-n>', ":w | !$HOME/.config/nvim/scripts/arduino -u '%'<cr>")
|
||||
-- show information about connected board
|
||||
nn('+', ":w | !$HOME/.config/nvim/scripts/arduino -i<cr>")
|
||||
-- monitor serial data
|
||||
nn('-', ":w | tabe | ter $HOME/.config/nvim/scripts/arduino -m " .. baudrate .. " <cr>i")
|
||||
end
|
||||
254
nvim/plugin/packer_compiled.lua
Normal file
254
nvim/plugin/packer_compiled.lua
Normal file
@@ -0,0 +1,254 @@
|
||||
-- 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 = "/root/.cache/nvim/packer_hererocks/2.1.1716656478/share/lua/5.1/?.lua;/root/.cache/nvim/packer_hererocks/2.1.1716656478/share/lua/5.1/?/init.lua;/root/.cache/nvim/packer_hererocks/2.1.1716656478/lib/luarocks/rocks-5.1/?.lua;/root/.cache/nvim/packer_hererocks/2.1.1716656478/lib/luarocks/rocks-5.1/?/init.lua"
|
||||
local install_cpath_pattern = "/root/.cache/nvim/packer_hererocks/2.1.1716656478/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 = {
|
||||
["Comment.nvim"] = {
|
||||
config = { "\27LJ\2\n5\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\fComment\frequire\0" },
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/Comment.nvim",
|
||||
url = "https://github.com/numToStr/Comment.nvim"
|
||||
},
|
||||
LuaSnip = {
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/LuaSnip",
|
||||
url = "https://github.com/L3MON4D3/LuaSnip"
|
||||
},
|
||||
["cmp-buffer"] = {
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
||||
url = "https://github.com/hrsh7th/cmp-buffer"
|
||||
},
|
||||
["cmp-cmdline"] = {
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/cmp-cmdline",
|
||||
url = "https://github.com/hrsh7th/cmp-cmdline"
|
||||
},
|
||||
["cmp-nvim-lsp"] = {
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
["cmp-path"] = {
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/cmp-path",
|
||||
url = "https://github.com/hrsh7th/cmp-path"
|
||||
},
|
||||
cmp_luasnip = {
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
|
||||
url = "https://github.com/saadparwaiz1/cmp_luasnip"
|
||||
},
|
||||
["gitsigns.nvim"] = {
|
||||
config = { "\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0" },
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
|
||||
url = "https://github.com/lewis6991/gitsigns.nvim"
|
||||
},
|
||||
gruvbox = {
|
||||
config = { "\27LJ\2\n7\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0\24colorscheme gruvbox\bcmd\bvim\0" },
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/gruvbox",
|
||||
url = "https://github.com/morhetz/gruvbox"
|
||||
},
|
||||
["lualine.nvim"] = {
|
||||
config = { "\27LJ\2\n<EFBFBD>\5\0\0\a\0\29\0)6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\0025\3\a\0005\4\6\0=\4\b\0035\4\t\0005\5\n\0005\6\v\0=\6\f\5>\5\3\4=\4\r\0035\4\14\0=\4\15\0035\4\16\0=\4\17\0035\4\18\0=\4\19\0035\4\20\0=\4\21\3=\3\22\0025\3\23\0004\4\0\0=\4\b\0034\4\0\0=\4\r\0035\4\24\0=\4\15\0035\4\25\0=\4\17\3=\3\26\0024\3\0\0=\3\27\0024\3\0\0=\3\28\2B\0\2\1K\0\1\0\15extensions\ftabline\22inactive_sections\1\2\0\0\rlocation\1\2\0\0\rfilename\1\0\4\14lualine_a\0\14lualine_c\0\14lualine_x\0\14lualine_b\0\rsections\14lualine_z\1\2\0\0\rlocation\14lualine_y\1\2\0\0\rprogress\14lualine_x\1\4\0\0\rencoding\15fileformat\rfiletype\14lualine_c\1\2\0\0\rfilename\14lualine_b\fsources\1\3\0\0\rnvim_lsp\bcoc\1\2\1\0\16diagnostics\fsources\0\1\3\0\0\vbranch\tdiff\14lualine_a\1\0\6\14lualine_y\0\14lualine_x\0\14lualine_b\0\14lualine_a\0\14lualine_c\0\14lualine_z\0\1\2\0\0\tmode\foptions\1\0\5\ftabline\0\15extensions\0\foptions\0\22inactive_sections\0\rsections\0\1\0\4\23section_separators\5\ntheme\fgruvbox\18icons_enabled\2\25component_separators\6|\nsetup\flualine\frequire\0" },
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/lualine.nvim",
|
||||
url = "https://github.com/nvim-lualine/lualine.nvim"
|
||||
},
|
||||
["markdown-preview.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/markdown-preview.nvim",
|
||||
url = "https://github.com/iamcco/markdown-preview.nvim"
|
||||
},
|
||||
["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,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
|
||||
url = "https://github.com/windwp/nvim-autopairs"
|
||||
},
|
||||
["nvim-cmp"] = {
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||
},
|
||||
["nvim-lspconfig"] = {
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||
url = "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
["nvim-tree.lua"] = {
|
||||
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\14nvim-tree\frequire\0" },
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
|
||||
url = "https://github.com/kyazdani42/nvim-tree.lua"
|
||||
},
|
||||
["nvim-treesitter"] = {
|
||||
config = { "\27LJ\2\n<EFBFBD>\1\0\0\5\0\f\0\0156\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\0025\3\6\0=\3\a\0025\3\t\0005\4\b\0=\4\n\3=\3\v\2B\0\2\1K\0\1\0\16textobjects\vselect\1\0\1\vselect\0\1\0\1\venable\2\26incremental_selection\1\0\1\venable\2\14highlight\1\0\3\16textobjects\0\14highlight\0\26incremental_selection\0\1\0\1\venable\2\nsetup\28nvim-treesitter.configs\frequire\0" },
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
["nvim-web-devicons"] = {
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
|
||||
url = "https://github.com/kyazdani42/nvim-web-devicons"
|
||||
},
|
||||
["packer.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
||||
url = "https://github.com/wbthomason/packer.nvim"
|
||||
},
|
||||
["plenary.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
["telescope.nvim"] = {
|
||||
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\14telescope\frequire\0" },
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||
},
|
||||
vimwiki = {
|
||||
config = { "\27LJ\2\nw\0\0\3\0\4\0\a6\0\0\0009\0\1\0004\1\3\0005\2\3\0>\2\1\1=\1\2\0K\0\1\0\1\0\4\bext\b.md\vsyntax\rmarkdown\19diary_rel_path\vdiary/\tpath\15~/vimwiki/\17vimwiki_list\6g\bvim\0" },
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/vimwiki",
|
||||
url = "https://github.com/vimwiki/vimwiki"
|
||||
},
|
||||
["which-key.nvim"] = {
|
||||
config = { "\27LJ\2\n7\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\14which-key\frequire\0" },
|
||||
loaded = true,
|
||||
path = "/root/.local/share/nvim/site/pack/packer/start/which-key.nvim",
|
||||
url = "https://github.com/folke/which-key.nvim"
|
||||
}
|
||||
}
|
||||
|
||||
time([[Defining packer_plugins]], false)
|
||||
-- Config for: nvim-tree.lua
|
||||
time([[Config for nvim-tree.lua]], 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\14nvim-tree\frequire\0", "config", "nvim-tree.lua")
|
||||
time([[Config for nvim-tree.lua]], false)
|
||||
-- Config for: Comment.nvim
|
||||
time([[Config for Comment.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n5\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\fComment\frequire\0", "config", "Comment.nvim")
|
||||
time([[Config for Comment.nvim]], false)
|
||||
-- Config for: vimwiki
|
||||
time([[Config for vimwiki]], true)
|
||||
try_loadstring("\27LJ\2\nw\0\0\3\0\4\0\a6\0\0\0009\0\1\0004\1\3\0005\2\3\0>\2\1\1=\1\2\0K\0\1\0\1\0\4\bext\b.md\vsyntax\rmarkdown\19diary_rel_path\vdiary/\tpath\15~/vimwiki/\17vimwiki_list\6g\bvim\0", "config", "vimwiki")
|
||||
time([[Config for vimwiki]], false)
|
||||
-- Config for: telescope.nvim
|
||||
time([[Config for telescope.nvim]], 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\14telescope\frequire\0", "config", "telescope.nvim")
|
||||
time([[Config for telescope.nvim]], false)
|
||||
-- Config for: lualine.nvim
|
||||
time([[Config for lualine.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n<EFBFBD>\5\0\0\a\0\29\0)6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\0025\3\a\0005\4\6\0=\4\b\0035\4\t\0005\5\n\0005\6\v\0=\6\f\5>\5\3\4=\4\r\0035\4\14\0=\4\15\0035\4\16\0=\4\17\0035\4\18\0=\4\19\0035\4\20\0=\4\21\3=\3\22\0025\3\23\0004\4\0\0=\4\b\0034\4\0\0=\4\r\0035\4\24\0=\4\15\0035\4\25\0=\4\17\3=\3\26\0024\3\0\0=\3\27\0024\3\0\0=\3\28\2B\0\2\1K\0\1\0\15extensions\ftabline\22inactive_sections\1\2\0\0\rlocation\1\2\0\0\rfilename\1\0\4\14lualine_a\0\14lualine_c\0\14lualine_x\0\14lualine_b\0\rsections\14lualine_z\1\2\0\0\rlocation\14lualine_y\1\2\0\0\rprogress\14lualine_x\1\4\0\0\rencoding\15fileformat\rfiletype\14lualine_c\1\2\0\0\rfilename\14lualine_b\fsources\1\3\0\0\rnvim_lsp\bcoc\1\2\1\0\16diagnostics\fsources\0\1\3\0\0\vbranch\tdiff\14lualine_a\1\0\6\14lualine_y\0\14lualine_x\0\14lualine_b\0\14lualine_a\0\14lualine_c\0\14lualine_z\0\1\2\0\0\tmode\foptions\1\0\5\ftabline\0\15extensions\0\foptions\0\22inactive_sections\0\rsections\0\1\0\4\23section_separators\5\ntheme\fgruvbox\18icons_enabled\2\25component_separators\6|\nsetup\flualine\frequire\0", "config", "lualine.nvim")
|
||||
time([[Config for lualine.nvim]], false)
|
||||
-- Config for: nvim-treesitter
|
||||
time([[Config for nvim-treesitter]], true)
|
||||
try_loadstring("\27LJ\2\n<EFBFBD>\1\0\0\5\0\f\0\0156\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\0025\3\6\0=\3\a\0025\3\t\0005\4\b\0=\4\n\3=\3\v\2B\0\2\1K\0\1\0\16textobjects\vselect\1\0\1\vselect\0\1\0\1\venable\2\26incremental_selection\1\0\1\venable\2\14highlight\1\0\3\16textobjects\0\14highlight\0\26incremental_selection\0\1\0\1\venable\2\nsetup\28nvim-treesitter.configs\frequire\0", "config", "nvim-treesitter")
|
||||
time([[Config for nvim-treesitter]], false)
|
||||
-- Config for: which-key.nvim
|
||||
time([[Config for which-key.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n7\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\14which-key\frequire\0", "config", "which-key.nvim")
|
||||
time([[Config for which-key.nvim]], false)
|
||||
-- Config for: gitsigns.nvim
|
||||
time([[Config for gitsigns.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0", "config", "gitsigns.nvim")
|
||||
time([[Config for gitsigns.nvim]], 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)
|
||||
-- Config for: gruvbox
|
||||
time([[Config for gruvbox]], true)
|
||||
try_loadstring("\27LJ\2\n7\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0\24colorscheme gruvbox\bcmd\bvim\0", "config", "gruvbox")
|
||||
time([[Config for gruvbox]], 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
|
||||
45
nvim/scripts/arduino
Executable file
45
nvim/scripts/arduino
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
compile()
|
||||
{
|
||||
echo "[Compiling Sketch]"
|
||||
echo "[Command]: arduino-cli compile -b $FQBN $SKETCH --no-color"
|
||||
arduino-cli compile -b "$FQBN" "$SKETCH" --no-color
|
||||
}
|
||||
|
||||
upload()
|
||||
{
|
||||
echo "[Uploading]"
|
||||
echo "[Command]: arduino-cli upload -b $FQBN -p $PORT_ADDRESS $SKETCH --no-color"
|
||||
arduino-cli upload -b "$FQBN" -p "$PORT_ADDRESS" "$SKETCH" --no-color
|
||||
}
|
||||
|
||||
monitor()
|
||||
{
|
||||
echo "[Command]: arduino-cli monitor -p $PORT_ADDRESS -c $BAUDRATE"
|
||||
arduino-cli monitor -p "$PORT_ADDRESS" -c "$BAUDRATE"
|
||||
}
|
||||
|
||||
compile_and_upload()
|
||||
{
|
||||
[[ "$FQBN" == "null" ]] && echo "[Error]: Board not found" && exit 1
|
||||
compile && upload && echo "[Success]"
|
||||
}
|
||||
|
||||
INFO="$(arduino-cli board list --json)"
|
||||
FQBN="$(echo "$INFO" | jq -r .detected_ports[0].matching_boards[0].fqbn)"
|
||||
PORT_ADDRESS="$(echo "$INFO" | jq -r .detected_ports[0].port.address)"
|
||||
|
||||
while getopts "imu:" opt
|
||||
do
|
||||
case "$opt" in
|
||||
u)
|
||||
SKETCH="$OPTARG"
|
||||
compile && upload ;;
|
||||
i)
|
||||
echo "$INFO" ;;
|
||||
m)
|
||||
BAUDRATE="$2"
|
||||
monitor ;;
|
||||
esac
|
||||
done
|
||||
Reference in New Issue
Block a user