initial commit

This commit is contained in:
iris committed 2022-08-02 16:36:22 -04:00
commit 31ebe341c3
13 files changed
+278

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
return function(cmp)
return cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<c-space>'] = cmp.mapping.complete(),
['<c-e>'] = cmp.mapping.abort(),
['<cr>'] = cmp.mapping.confirm({ select = true }),
['<tab>'] = cmp.mapping.select_next_item(),
})
end
+22
View File
@@ -0,0 +1,22 @@
local map = function(from, to)
vim.keymap.set('n', from, to, { noremap = true, silent = true })
vim.keymap.set('x', from, to, { noremap = true, silent = true })
end
local swap = function(a, b)
map(a, b)
map(b, a)
end
swap('n', 'h')
swap('e', 'j')
swap('i', 'k')
swap('o', 'l')
swap('<C-w>n', '<C-w>h')
swap('<C-w>e', '<C-w>j')
swap('<C-w>i', '<C-w>k')
swap('<C-w>o', '<C-w>l')
swap('N', 'H')
swap('O', 'L')
+28
View File
@@ -0,0 +1,28 @@
local opts = { noremap = true, silent = true }
local map = vim.keymap.set
local nmap = function(from, to) map('n', from, to, opts) end
local cmd = function(content) return '<cmd>' .. content .. '<cr>' end
-- terminal
map('t', '<esc>', '<C-\\><C-n>', opts)
nmap('<space>tm', ':belowright 7sp<cr>:term<cr>A')
-- off search highlight when escape is pressed
nmap('<esc>', ':noh<cr><esc>')
-- telescope
nmap('<space>ff', cmd('Telescope find_files'))
nmap('<space>fg', cmd('Telescope live_grep'))
nmap('<space>fb', cmd('Telescope buffers'))
nmap('<space>fh', cmd('Telescope help_tags'))
-- explorer
nmap('<space>e', cmd('Neotree toggle'))
-- lsp (universal)
nmap('E', vim.diagnostic.open_float)
nmap('[d', vim.diagnostic.goto_prev)
nmap(']d', vim.diagnostic.goto_next)
nmap('<space>q', vim.diagnostic.setloclist)
+23
View File
@@ -0,0 +1,23 @@
return function(bufnr)
local map = function(from, to)
vim.keymap.set('n', from, to, { noremap = true, silent = true, buffer = bufnr })
end
map('gd', vim.lsp.buf.definition)
map('gr', vim.lsp.buf.references)
map('gi', vim.lsp.buf.implementation)
map('gD', vim.lsp.buf.declaration)
map('K', vim.lsp.buf.hover)
map('<C-k>', vim.lsp.buf.signature_help)
map('<space>wa', vim.lsp.buf.add_workspace_folder)
map('<space>wr', vim.lsp.buf.remove_workspace_folder)
map('<space>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end)
map('<space>D', vim.lsp.buf.type_definition)
map('<space>rn', vim.lsp.buf.rename)
map('<space>ca', vim.lsp.buf.code_action)
map('<space>fm', vim.lsp.buf.formatting)
end