a bunch of things
This commit is contained in:
parent
d2ccdfe1eb
commit
081a29441f
3 changed files with 151 additions and 75 deletions
105
init.lua
105
init.lua
|
@ -25,6 +25,8 @@ vim.cmd("autocmd FileType yaml,yaml.ansible setlocal indentkeys-=0#")
|
||||||
-- don't use NeoVim's thin cursor
|
-- don't use NeoVim's thin cursor
|
||||||
vim.opt.guicursor = ""
|
vim.opt.guicursor = ""
|
||||||
|
|
||||||
|
vim.o.mouse = ""
|
||||||
|
|
||||||
require('plugins')
|
require('plugins')
|
||||||
require("colorschemes")
|
require("colorschemes")
|
||||||
|
|
||||||
|
@ -33,17 +35,17 @@ vim.cmd("hi MatchParen cterm=bold,underline gui=bold,underline")
|
||||||
vim.api.nvim_set_keymap("n", "<SPACE>", "<Nop>", { noremap = true })
|
vim.api.nvim_set_keymap("n", "<SPACE>", "<Nop>", { noremap = true })
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
local harpoon_ui = require("harpoon.ui")
|
--local harpoon_ui = require("harpoon.ui")
|
||||||
local harpoon_mark = require("harpoon.mark")
|
--local harpoon_mark = require("harpoon.mark")
|
||||||
for _, mode in ipairs({"n", "i", "v"}) do
|
--vim.keymap.set("n", '<A-,>', harpoon_ui.toggle_quick_menu)
|
||||||
vim.keymap.set(mode, '<A-h>', harpoon_ui.toggle_quick_menu)
|
--for _, mode in ipairs({"n", "i", "v"}) do
|
||||||
vim.keymap.set(mode, '<A-m>', harpoon_mark.add_file)
|
-- vim.keymap.set(mode, '<A-b>', harpoon_mark.add_file)
|
||||||
vim.keymap.set(mode, '<A-a>', function() harpoon_ui.nav_file(1) end, { noremap = true })
|
-- vim.keymap.set(mode, '<A-1>', function() harpoon_ui.nav_file(1) end, { noremap = true })
|
||||||
vim.keymap.set(mode, '<A-s>', function() harpoon_ui.nav_file(2) end, { noremap = true })
|
-- vim.keymap.set(mode, '<A-2>', function() harpoon_ui.nav_file(2) end, { noremap = true })
|
||||||
vim.keymap.set(mode, '<A-d>', function() harpoon_ui.nav_file(3) end, { noremap = true })
|
-- vim.keymap.set(mode, '<A-3>', function() harpoon_ui.nav_file(3) end, { noremap = true })
|
||||||
vim.keymap.set(mode, '<A-f>', function() harpoon_ui.nav_file(4) end, { noremap = true })
|
-- vim.keymap.set(mode, '<A-4>', function() harpoon_ui.nav_file(4) end, { noremap = true })
|
||||||
vim.keymap.set(mode, '<A-g>', function() harpoon_ui.nav_file(5) end, { noremap = true })
|
-- vim.keymap.set(mode, '<A-5>', function() harpoon_ui.nav_file(5) end, { noremap = true })
|
||||||
end
|
--end
|
||||||
|
|
||||||
for _, mode in ipairs({"n", "v"}) do
|
for _, mode in ipairs({"n", "v"}) do
|
||||||
vim.api.nvim_set_keymap(mode, "<Up>", "g<Up>", { noremap = true })
|
vim.api.nvim_set_keymap(mode, "<Up>", "g<Up>", { noremap = true })
|
||||||
|
@ -58,9 +60,9 @@ vim.api.nvim_set_keymap('v', "<M-j>", ":MoveBlock(1)<CR>", { noremap = true })
|
||||||
vim.api.nvim_set_keymap('v', "<M-k>", ":MoveBlock(-1)<CR>", { noremap = true })
|
vim.api.nvim_set_keymap('v', "<M-k>", ":MoveBlock(-1)<CR>", { noremap = true })
|
||||||
|
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>o", "<Cmd>lua vim.diagnostic.open_float()<CR>", { noremap = true })
|
vim.api.nvim_set_keymap("n", "<Leader>o", "<Cmd>lua vim.diagnostic.open_float()<CR>", { noremap = true })
|
||||||
vim.api.nvim_set_keymap("n", "<M-o>", "<Cmd>lua vim.diagnostic.open_float()<CR>", { noremap = true })
|
--vim.api.nvim_set_keymap("n", "<M-o>", "<Cmd>lua vim.diagnostic.open_float()<CR>", { noremap = true })
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>i", "<Cmd>lua vim.lsp.buf.code_action()<CR>", { noremap = true })
|
vim.api.nvim_set_keymap("n", "<Leader>i", "<Cmd>lua vim.lsp.buf.code_action()<CR>", { noremap = true })
|
||||||
vim.api.nvim_set_keymap("n", "<M-i>", "<Cmd>lua vim.lsp.buf.code_action()<CR>", { noremap = true })
|
--vim.api.nvim_set_keymap("n", "<M-i>", "<Cmd>lua vim.lsp.buf.code_action()<CR>", { noremap = true })
|
||||||
|
|
||||||
require('telescope').setup({
|
require('telescope').setup({
|
||||||
initial_mode = "normal"
|
initial_mode = "normal"
|
||||||
|
@ -68,12 +70,18 @@ require('telescope').setup({
|
||||||
local builtin = require('telescope.builtin')
|
local builtin = require('telescope.builtin')
|
||||||
vim.keymap.set('n', '<Leader>p', builtin.find_files, {})
|
vim.keymap.set('n', '<Leader>p', builtin.find_files, {})
|
||||||
|
|
||||||
-- toggle numbers with Alt+N
|
-- toggle numbers and diagnostics with Alt+N
|
||||||
vim.keymap.set(
|
vim.keymap.set(
|
||||||
"n",
|
"n",
|
||||||
"<M-n>",
|
"<M-n>",
|
||||||
function()
|
function()
|
||||||
vim.o.number = not vim.o.number;
|
vim.o.number = not vim.o.number;
|
||||||
|
if not vim.diagnostic.get_next() then return end
|
||||||
|
if vim.o.number then
|
||||||
|
vim.diagnostic.show()
|
||||||
|
else
|
||||||
|
vim.diagnostic.hide()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -126,53 +134,32 @@ require('treesitter')
|
||||||
|
|
||||||
require('nvim_comment').setup()
|
require('nvim_comment').setup()
|
||||||
--vim.keymap.set('v', '<A-->', "<Cmd>'<,'>CommentToggle<CR>")
|
--vim.keymap.set('v', '<A-->', "<Cmd>'<,'>CommentToggle<CR>")
|
||||||
|
vim.keymap.set('v', 'C-/', "<Cmd>'<,'>CommentToggle<CR>")
|
||||||
|
vim.keymap.set('n', 'C-/', "<Cmd>CommentToggle<CR>")
|
||||||
--vim.keymap.set('n', '<A-->', "<Cmd>CommentToggle<CR>")
|
--vim.keymap.set('n', '<A-->', "<Cmd>CommentToggle<CR>")
|
||||||
|
|
||||||
|
-- format on save
|
||||||
|
--vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
|
||||||
|
|
||||||
-- require('nvim-tree').setup()
|
-- require('nvim-tree').setup()
|
||||||
|
|
||||||
-- -- trouble.nvim mappings
|
require('exrc').setup()
|
||||||
-- vim.api.nvim_set_keymap("n", "<leader>xx", "<cmd>Trouble<cr>",
|
require('bufferline').setup()
|
||||||
-- {silent = true, noremap = true}
|
|
||||||
-- )
|
vim.cmd [[
|
||||||
-- vim.api.nvim_set_keymap("n", "<leader>xw", "<cmd>Trouble workspace_diagnostics<cr>",
|
fu! SaveSession()
|
||||||
-- {silent = true, noremap = true}
|
if filereadable(getcwd() . '/Cargo.toml')
|
||||||
-- )
|
execute 'mksession! ' . getcwd() . '/.session.vim'
|
||||||
-- vim.api.nvim_set_keymap("n", "<leader>xd", "<cmd>Trouble document_diagnostics<cr>",
|
endif
|
||||||
-- {silent = true, noremap = true}
|
endfunction
|
||||||
-- )
|
|
||||||
-- vim.api.nvim_set_keymap("n", "<leader>xl", "<cmd>Trouble loclist<cr>",
|
fu! RestoreSession()
|
||||||
-- {silent = true, noremap = true}
|
if filereadable(getcwd() . '/.session.vim')
|
||||||
-- )
|
execute 'so ' . getcwd() . '/.session.vim'
|
||||||
-- vim.api.nvim_set_keymap("n", "<leader>xq", "<cmd>Trouble quickfix<cr>",
|
endif
|
||||||
-- {silent = true, noremap = true}
|
endfunction
|
||||||
-- )
|
|
||||||
-- vim.api.nvim_set_keymap("n", "gR", "<cmd>Trouble lsp_references<cr>",
|
autocmd VimLeavePre * call SaveSession()
|
||||||
-- {silent = true, noremap = true}
|
autocmd VimEnter * nested call RestoreSession()
|
||||||
-- )
|
]]
|
||||||
--
|
|
||||||
|
|
||||||
-- original init.vim
|
|
||||||
-- syntax on
|
|
||||||
-- hi MatchParen ctermfg=none ctermbg=none cterm=bold,underline gui=bold,underline guifg=fg guibg=bg
|
|
||||||
--
|
|
||||||
-- filetype plugin indent on
|
|
||||||
-- set number
|
|
||||||
-- "set relativenumber
|
|
||||||
-- set path+=**
|
|
||||||
-- set noswapfile
|
|
||||||
-- set wildmenu
|
|
||||||
-- set backspace=indent,eol,start
|
|
||||||
-- set undodir=~/.cache/nvim/undo
|
|
||||||
-- set undofile
|
|
||||||
-- set incsearch
|
|
||||||
-- set smartindent
|
|
||||||
-- set ic
|
|
||||||
-- "set colorcolumn=88
|
|
||||||
-- set et
|
|
||||||
-- set ts=4
|
|
||||||
-- set sw=4
|
|
||||||
-- "set showmatch
|
|
||||||
-- set hlsearch incsearch
|
|
||||||
-- "highlight ColorColumn ctermbg=9
|
|
||||||
--
|
|
||||||
-- lua require('plugins')
|
|
||||||
|
|
|
@ -31,6 +31,8 @@ packer.startup(
|
||||||
}
|
}
|
||||||
use 'ThePrimeagen/harpoon'
|
use 'ThePrimeagen/harpoon'
|
||||||
use 'terrortylor/nvim-comment'
|
use 'terrortylor/nvim-comment'
|
||||||
|
use 'MunifTanjim/exrc.nvim'
|
||||||
|
use { 'akinsho/bufferline.nvim', tag = "v2.*", requires = 'kyazdani42/nvim-web-devicons' }
|
||||||
--use {
|
--use {
|
||||||
-- 'kyazdani42/nvim-tree.lua',
|
-- 'kyazdani42/nvim-tree.lua',
|
||||||
-- --requires = {
|
-- --requires = {
|
||||||
|
|
|
@ -9,23 +9,26 @@ vim.api.nvim_command('packadd packer.nvim')
|
||||||
|
|
||||||
local no_errors, error_msg = pcall(function()
|
local no_errors, error_msg = pcall(function()
|
||||||
|
|
||||||
local time
|
_G._packer = _G._packer or {}
|
||||||
local profile_info
|
_G._packer.inside_compile = true
|
||||||
local should_profile = false
|
|
||||||
if should_profile then
|
local time
|
||||||
local hrtime = vim.loop.hrtime
|
local profile_info
|
||||||
profile_info = {}
|
local should_profile = false
|
||||||
time = function(chunk, start)
|
if should_profile then
|
||||||
if start then
|
local hrtime = vim.loop.hrtime
|
||||||
profile_info[chunk] = hrtime()
|
profile_info = {}
|
||||||
else
|
time = function(chunk, start)
|
||||||
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
if start then
|
||||||
end
|
profile_info[chunk] = hrtime()
|
||||||
|
else
|
||||||
|
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
||||||
end
|
end
|
||||||
else
|
|
||||||
time = function(chunk, start) end
|
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
time = function(chunk, start) end
|
||||||
|
end
|
||||||
|
|
||||||
local function save_profiles(threshold)
|
local function save_profiles(threshold)
|
||||||
local sorted_times = {}
|
local sorted_times = {}
|
||||||
for chunk_name, time_taken in pairs(profile_info) do
|
for chunk_name, time_taken in pairs(profile_info) do
|
||||||
|
@ -38,8 +41,10 @@ local function save_profiles(threshold)
|
||||||
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if threshold then
|
||||||
|
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
|
||||||
|
end
|
||||||
|
|
||||||
_G._packer = _G._packer or {}
|
|
||||||
_G._packer.profile_output = results
|
_G._packer.profile_output = results
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -69,19 +74,101 @@ end
|
||||||
time([[try_loadstring definition]], false)
|
time([[try_loadstring definition]], false)
|
||||||
time([[Defining packer_plugins]], true)
|
time([[Defining packer_plugins]], true)
|
||||||
_G.packer_plugins = {
|
_G.packer_plugins = {
|
||||||
|
catppuccin = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/catppuccin",
|
||||||
|
url = "https://github.com/catppuccin/nvim"
|
||||||
|
},
|
||||||
|
["cmp-nvim-lsp"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||||
|
},
|
||||||
|
["cmp-snippy"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/cmp-snippy",
|
||||||
|
url = "https://github.com/dcampos/cmp-snippy"
|
||||||
|
},
|
||||||
|
["exrc.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/exrc.nvim",
|
||||||
|
url = "https://github.com/MunifTanjim/exrc.nvim"
|
||||||
|
},
|
||||||
|
harpoon = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/harpoon",
|
||||||
|
url = "https://github.com/ThePrimeagen/harpoon"
|
||||||
|
},
|
||||||
|
["move.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/move.nvim",
|
||||||
|
url = "https://github.com/fedepujol/move.nvim"
|
||||||
|
},
|
||||||
|
["nvim-cmp"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||||
|
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||||
|
},
|
||||||
|
["nvim-comment"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/nvim-comment",
|
||||||
|
url = "https://github.com/terrortylor/nvim-comment"
|
||||||
|
},
|
||||||
["nvim-lspconfig"] = {
|
["nvim-lspconfig"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||||
url = "https://github.com/neovim/nvim-lspconfig"
|
url = "https://github.com/neovim/nvim-lspconfig"
|
||||||
},
|
},
|
||||||
|
["nvim-snippy"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/nvim-snippy",
|
||||||
|
url = "https://github.com/dcampos/nvim-snippy"
|
||||||
|
},
|
||||||
|
["nvim-treesitter"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||||
|
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||||
|
},
|
||||||
["packer.nvim"] = {
|
["packer.nvim"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
path = "/home/ateijelo/.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"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||||
|
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||||
|
},
|
||||||
|
["telescope.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||||
|
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||||
|
},
|
||||||
|
["tokyonight.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/tokyonight.nvim",
|
||||||
|
url = "https://github.com/folke/tokyonight.nvim"
|
||||||
|
},
|
||||||
|
["vim-lastplace"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/vim-lastplace",
|
||||||
|
url = "https://github.com/farmergreg/vim-lastplace"
|
||||||
|
},
|
||||||
|
["vim-visual-multi"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/vim-visual-multi",
|
||||||
|
url = "https://github.com/mg979/vim-visual-multi"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
time([[Defining packer_plugins]], false)
|
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
|
if should_profile then save_profiles() end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in a new issue