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
|
||||
vim.opt.guicursor = ""
|
||||
|
||||
vim.o.mouse = ""
|
||||
|
||||
require('plugins')
|
||||
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.g.mapleader = " "
|
||||
|
||||
local harpoon_ui = require("harpoon.ui")
|
||||
local harpoon_mark = require("harpoon.mark")
|
||||
for _, mode in ipairs({"n", "i", "v"}) do
|
||||
vim.keymap.set(mode, '<A-h>', harpoon_ui.toggle_quick_menu)
|
||||
vim.keymap.set(mode, '<A-m>', harpoon_mark.add_file)
|
||||
vim.keymap.set(mode, '<A-a>', 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-d>', 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-g>', function() harpoon_ui.nav_file(5) end, { noremap = true })
|
||||
end
|
||||
--local harpoon_ui = require("harpoon.ui")
|
||||
--local harpoon_mark = require("harpoon.mark")
|
||||
--vim.keymap.set("n", '<A-,>', harpoon_ui.toggle_quick_menu)
|
||||
--for _, mode in ipairs({"n", "i", "v"}) do
|
||||
-- vim.keymap.set(mode, '<A-b>', harpoon_mark.add_file)
|
||||
-- vim.keymap.set(mode, '<A-1>', function() harpoon_ui.nav_file(1) end, { noremap = true })
|
||||
-- vim.keymap.set(mode, '<A-2>', function() harpoon_ui.nav_file(2) end, { noremap = true })
|
||||
-- vim.keymap.set(mode, '<A-3>', function() harpoon_ui.nav_file(3) end, { noremap = true })
|
||||
-- vim.keymap.set(mode, '<A-4>', function() harpoon_ui.nav_file(4) end, { noremap = true })
|
||||
-- vim.keymap.set(mode, '<A-5>', function() harpoon_ui.nav_file(5) end, { noremap = true })
|
||||
--end
|
||||
|
||||
for _, mode in ipairs({"n", "v"}) do
|
||||
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("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", "<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({
|
||||
initial_mode = "normal"
|
||||
|
@ -68,12 +70,18 @@ require('telescope').setup({
|
|||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<Leader>p', builtin.find_files, {})
|
||||
|
||||
-- toggle numbers with Alt+N
|
||||
-- toggle numbers and diagnostics with Alt+N
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<M-n>",
|
||||
function()
|
||||
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
|
||||
)
|
||||
|
||||
|
@ -126,53 +134,32 @@ require('treesitter')
|
|||
|
||||
require('nvim_comment').setup()
|
||||
--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>")
|
||||
|
||||
-- format on save
|
||||
--vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
|
||||
|
||||
-- require('nvim-tree').setup()
|
||||
|
||||
-- -- trouble.nvim mappings
|
||||
-- vim.api.nvim_set_keymap("n", "<leader>xx", "<cmd>Trouble<cr>",
|
||||
-- {silent = true, noremap = true}
|
||||
-- )
|
||||
-- vim.api.nvim_set_keymap("n", "<leader>xw", "<cmd>Trouble workspace_diagnostics<cr>",
|
||||
-- {silent = true, noremap = true}
|
||||
-- )
|
||||
-- vim.api.nvim_set_keymap("n", "<leader>xd", "<cmd>Trouble document_diagnostics<cr>",
|
||||
-- {silent = true, noremap = true}
|
||||
-- )
|
||||
-- vim.api.nvim_set_keymap("n", "<leader>xl", "<cmd>Trouble loclist<cr>",
|
||||
-- {silent = true, noremap = true}
|
||||
-- )
|
||||
-- vim.api.nvim_set_keymap("n", "<leader>xq", "<cmd>Trouble quickfix<cr>",
|
||||
-- {silent = true, noremap = true}
|
||||
-- )
|
||||
-- vim.api.nvim_set_keymap("n", "gR", "<cmd>Trouble lsp_references<cr>",
|
||||
-- {silent = true, noremap = true}
|
||||
-- )
|
||||
--
|
||||
require('exrc').setup()
|
||||
require('bufferline').setup()
|
||||
|
||||
vim.cmd [[
|
||||
fu! SaveSession()
|
||||
if filereadable(getcwd() . '/Cargo.toml')
|
||||
execute 'mksession! ' . getcwd() . '/.session.vim'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
fu! RestoreSession()
|
||||
if filereadable(getcwd() . '/.session.vim')
|
||||
execute 'so ' . getcwd() . '/.session.vim'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
autocmd VimLeavePre * call SaveSession()
|
||||
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 'terrortylor/nvim-comment'
|
||||
use 'MunifTanjim/exrc.nvim'
|
||||
use { 'akinsho/bufferline.nvim', tag = "v2.*", requires = 'kyazdani42/nvim-web-devicons' }
|
||||
--use {
|
||||
-- 'kyazdani42/nvim-tree.lua',
|
||||
-- --requires = {
|
||||
|
|
|
@ -9,22 +9,25 @@ 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
|
||||
_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
|
||||
else
|
||||
time = function(chunk, start) end
|
||||
end
|
||||
else
|
||||
time = function(chunk, start) end
|
||||
end
|
||||
|
||||
local function save_profiles(threshold)
|
||||
local sorted_times = {}
|
||||
|
@ -38,8 +41,10 @@ local function save_profiles(threshold)
|
|||
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 = _G._packer or {}
|
||||
_G._packer.profile_output = results
|
||||
end
|
||||
|
||||
|
@ -69,19 +74,101 @@ end
|
|||
time([[try_loadstring definition]], false)
|
||||
time([[Defining packer_plugins]], true)
|
||||
_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"] = {
|
||||
loaded = true,
|
||||
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/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"] = {
|
||||
loaded = true,
|
||||
path = "/home/ateijelo/.local/share/nvim/site/pack/packer/start/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)
|
||||
|
||||
_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)
|
||||
|
|
Loading…
Reference in a new issue