|
|
|
@ -3,6 +3,7 @@ local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nv
|
|
|
|
|
local is_bootstrap = false
|
|
|
|
|
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
|
|
|
|
is_bootstrap = true
|
|
|
|
|
vim.fn.system({'mkdir', '-p', install_path})
|
|
|
|
|
vim.fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
|
|
|
|
vim.cmd [[packadd packer.nvim]]
|
|
|
|
|
end
|
|
|
|
@ -66,28 +67,6 @@ require('packer').startup(function(use)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- Personal keymapping
|
|
|
|
|
vim.api.nvim_set_keymap('n', '<c-z>', ':bn<CR>', { noremap = 1 })
|
|
|
|
|
vim.api.nvim_set_keymap('v', '<c-z>', ':bn<CR>', { noremap = 1 })
|
|
|
|
|
vim.api.nvim_set_keymap('n', '<c-x>', ':bp<CR>', { noremap = 1 })
|
|
|
|
|
vim.api.nvim_set_keymap('n', '<F5>', ':e<CR>', { noremap = 1 })
|
|
|
|
|
vim.api.nvim_set_keymap('n', '<F6>', '<C-W>w', { noremap = 1 })
|
|
|
|
|
vim.api.nvim_set_keymap('n', '<F18>', '<C-W>W', { noremap = 1 }) -- S-F6 (F18 defined in ST's config.h)
|
|
|
|
|
vim.api.nvim_set_keymap('n', '<F7>', '<C-W>o', { noremap = 1 })
|
|
|
|
|
vim.api.nvim_set_keymap('n', '<F8>', '<C-W>v', { noremap = 1 })
|
|
|
|
|
vim.api.nvim_set_keymap('n', '<F20>', '<C-W>s', { noremap = 1 }) -- S-F8 (F20 defined in ST's config.h)
|
|
|
|
|
vim.api.nvim_set_keymap('n', '<F35>', ':confirm bd<CR>', { noremap = 1 }) -- C-F11 (F35 defined in ST's config.h)
|
|
|
|
|
vim.api.nvim_set_keymap('v', '<LeftRelease>','"*ygv', { noremap = 1 }) -- Copy selection to clipboard
|
|
|
|
|
vim.api.nvim_set_keymap('v', '<2-LeftRelease>','"*ygv', { noremap = 1 }) -- Copy word selection to clipboard
|
|
|
|
|
vim.api.nvim_set_keymap('v', '<3-LeftRelease>','"*ygv', { noremap = 1 }) -- Copy line selection to clipboard
|
|
|
|
|
vim.api.nvim_set_keymap('v', '<4-LeftRelease>','"*ygv', { noremap = 1 }) -- Copy column selection to clipboard
|
|
|
|
|
vim.api.nvim_set_keymap('v', '<c-r>', '"hy/<C-r>h<cr>', { noremap = 1 }) -- Search selected text
|
|
|
|
|
vim.api.nvim_set_keymap('n', '<c-Space>', 'za', { noremap = 1 }) -- Toggle fold
|
|
|
|
|
vim.api.nvim_set_keymap('v', '<', '<gv', { noremap = 1 }) -- Preserve selection after left indent
|
|
|
|
|
vim.api.nvim_set_keymap('v', '>', '>gv', { noremap = 1 }) -- Preserve selection after right indent
|
|
|
|
|
vim.api.nvim_set_keymap('v', 'Q', 'gqap', { noremap = 1 }) -- Reflow visually highlighted lines with Q
|
|
|
|
|
vim.api.nvim_set_keymap('n', 'Q', 'gq', { noremap = 1 }) -- Reflow text
|
|
|
|
|
|
|
|
|
|
-- Nerd Tree (File navigation)
|
|
|
|
|
use 'preservim/nerdtree'
|
|
|
|
|
vim.api.nvim_set_keymap('n', '<c-t>', ':NERDTreeToggle %<CR>', { noremap = 1 })
|
|
|
|
@ -115,7 +94,16 @@ require('packer').startup(function(use)
|
|
|
|
|
'williamboman/mason-lspconfig.nvim',
|
|
|
|
|
|
|
|
|
|
-- Useful status updates for LSP
|
|
|
|
|
'j-hui/fidget.nvim',
|
|
|
|
|
{'j-hui/fidget.nvim', branch = 'legacy'},
|
|
|
|
|
use {
|
|
|
|
|
'j-hui/fidget.nvim',
|
|
|
|
|
tag = 'legacy',
|
|
|
|
|
config = function()
|
|
|
|
|
require("fidget").setup {
|
|
|
|
|
-- options
|
|
|
|
|
}
|
|
|
|
|
end,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -188,12 +176,17 @@ vim.api.nvim_create_autocmd('BufWritePost', {
|
|
|
|
|
-- [[ Setting options ]]
|
|
|
|
|
-- See `:help vim.o`
|
|
|
|
|
|
|
|
|
|
if vim.g.neovide then
|
|
|
|
|
vim.o.guifont = "Iosevka Term:h16"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Set highlight on search
|
|
|
|
|
vim.o.hlsearch = true
|
|
|
|
|
|
|
|
|
|
-- Highlight problematic whitespace
|
|
|
|
|
vim.o.list = true
|
|
|
|
|
vim.opt.listchars = { tab = '▶ ', trail = '●', extends = '#', nbsp = '.' }
|
|
|
|
|
vim.o.wrap = false
|
|
|
|
|
|
|
|
|
|
-- Make line numbers default
|
|
|
|
|
vim.wo.number = true
|
|
|
|
@ -240,6 +233,31 @@ vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
|
|
|
|
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
|
|
|
|
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
|
|
|
|
|
|
|
|
|
-- Personal keymapping
|
|
|
|
|
vim.keymap.set('n', '<c-z>', ':bn<CR>', { silent = true })
|
|
|
|
|
vim.keymap.set('v', '<c-z>', ':bn<CR>', { silent = true })
|
|
|
|
|
vim.keymap.set('n', '<c-x>', ':bp<CR>', { silent = true })
|
|
|
|
|
vim.keymap.set('n', '<F5>', ':e<CR>', { silent = true })
|
|
|
|
|
vim.keymap.set('n', '<F6>', '<C-W>w', { silent = true })
|
|
|
|
|
vim.keymap.set('n', '<F18>', '<C-W>W', { silent = true }) -- S-F6 (F18 defined in ST's config.h)
|
|
|
|
|
vim.keymap.set('n', '<F7>', '<C-W>o', { silent = true })
|
|
|
|
|
vim.keymap.set('n', '<F8>', '<C-W>v', { silent = true })
|
|
|
|
|
vim.keymap.set('n', '<F20>', '<C-W>s', { silent = true }) -- S-F8 (F20 defined in ST's config.h)
|
|
|
|
|
vim.keymap.set('n', '<F35>', ':confirm bd<CR>', { silent = true }) -- C-F11 (F35 defined in ST's config.h)
|
|
|
|
|
vim.keymap.set('v', '<LeftRelease>','"*ygv', { silent = true }) -- Copy selection to clipboard
|
|
|
|
|
vim.keymap.set('v', '<2-LeftRelease>','"*ygv', { silent = true }) -- Copy word selection to clipboard
|
|
|
|
|
vim.keymap.set('v', '<3-LeftRelease>','"*ygv', { silent = true }) -- Copy line selection to clipboard
|
|
|
|
|
vim.keymap.set('v', '<4-LeftRelease>','"*ygv', { silent = true }) -- Copy column selection to clipboard
|
|
|
|
|
vim.keymap.set('v', '<c-r>', '"hy/<C-r>h<cr>', { silent = true }) -- Search selected text
|
|
|
|
|
vim.keymap.set('n', '<c-Space>', 'za', { silent = true }) -- Toggle fold
|
|
|
|
|
vim.keymap.set('v', '<', '<gv', { silent = true }) -- Preserve selection after left indent
|
|
|
|
|
vim.keymap.set('v', '>', '>gv', { silent = true }) -- Preserve selection after right indent
|
|
|
|
|
vim.keymap.set('v', 'Q', 'gqap', { silent = true }) -- Reflow visually highlighted lines with Q
|
|
|
|
|
vim.keymap.set('n', 'Q', 'gq', { silent = true }) -- Reflow text
|
|
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<leader>td', 'a[<C-r>=strftime("%Y/%m/%d")<CR>] <Esc>', { silent = true }) -- Insert Date after cursor
|
|
|
|
|
vim.keymap.set('n', '<leader>tt', 'a[<C-r>=strftime("%Y/%m/%d %X")<CR>] <Esc>', { silent = true }) -- Insert Date and time after cursor
|
|
|
|
|
|
|
|
|
|
-- [[ Highlight on yank ]]
|
|
|
|
|
-- See `:help vim.highlight.on_yank()`
|
|
|
|
|
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
|
|
|
@ -303,7 +321,7 @@ vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { de
|
|
|
|
|
-- See `:help nvim-treesitter`
|
|
|
|
|
require('nvim-treesitter.configs').setup {
|
|
|
|
|
-- Add languages to be installed here that you want installed for treesitter
|
|
|
|
|
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'help', 'perl', 'ruby', 'verilog' },
|
|
|
|
|
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'typescript', 'perl', 'ruby', 'verilog' },
|
|
|
|
|
|
|
|
|
|
highlight = { enable = true },
|
|
|
|
|
indent = { enable = true },
|
|
|
|
|