Compare commits

...

10 Commits

@ -6,8 +6,6 @@ options = { noremap = true }
-- Navigation -- Navigation
map('n', 'gh', '0', options) -- make gh go to beginning of line map('n', 'gh', '0', options) -- make gh go to beginning of line
map('n', 'gl', '$', options) -- make gl go to end of line map('n', 'gl', '$', options) -- make gl go to end of line
map('n', 'gk', 'gg', options) -- make gk go to top of document
map('n', 'gj', 'G', options) -- make gj go to bottom of document
-- WINDOW MANAGEMENT -- WINDOW MANAGEMENT
@ -40,14 +38,33 @@ map('n', '<leader>q', '<cmd>call ToggleQFList(0)<CR>', {}) -- see plugin/navigat
-- GIT -- GIT
-- top level commands -- top level commands
map('n', '<leader>gs', '<cmd>G<CR>', options) -- Show git status map('n', '<leader>gs', '<cmd>keepalt Git<CR>', options) -- Show git status
map('n', '<leader>gc', '<cmd>G commit<CR>', options) -- git commit map('n', '<leader>gc', '<cmd>G commit -v<CR>', options) -- git commit
map('n', '<leader>gp', '<cmd>G push<CR>', {}) -- git push map('n', '<leader>gp', '<cmd>G push<CR>', {}) -- git push
map('n', '<leader>gd', '<cmd>G diff<CR>', options)
map('n', '<leader>gds', '<cmd>G diff --staged<CR>', options)
-- staging
map('n', '<leader>dp', '<cmd>diffput<CR>', options)
-- merge -- merge
map('n', '<leader>gh', '<cmd>diffget //2<CR>', options) -- merge from left pane map('n', '<leader>gh', '<cmd>diffget //2<CR>', options) -- merge from left pane
map('n', '<leader>gl', '<cmd>diffget //3<CR>', options) -- merge from right pane map('n', '<leader>gl', '<cmd>diffget //3<CR>', options) -- merge from right pane
vim.keymap.set(
"i",
"<Plug>(vimrc:copilot-dummy-map)",
'copilot#Accept("")',
{ silent = true, expr = true, desc = "Copilot dummy accept" }
)
-- remap copilot key to <C-j>
vim.g.copilot_no_tab_map = true
vim.g.copilot_assume_mapped = true
local map = vim.keymap.set
map("i", "<C-j>", "copilot#Accept('<CR>')", {noremap = true, silent = true, expr=true, replace_keycodes = false })
-- LSP -- LSP
-- Use an on_attach function to only map the following keys -- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer -- after the language server attaches to the current buffer
@ -66,19 +83,19 @@ local on_attach = function(client, bufnr)
vim.keymap.set('n', '<leader>F', function() vim.lsp.buf.format() end, opts) vim.keymap.set('n', '<leader>F', function() vim.lsp.buf.format() end, opts)
end end
local cmp_mappings = function () local cmp = require('cmp')
local cmp = require('cmp') local cmp_select = {behavior = cmp.SelectBehavior.Select}
return { local cmp_mappings = {
['<C-j>'] = cmp.mapping.scroll_docs(4), ['<C-d>'] = cmp.mapping.scroll_docs(4),
['<C-k>'] = cmp.mapping.scroll_docs(-4), ['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-Space>'] = cmp.mapping.complete(), ['<C-Space>'] = cmp.mapping.complete(),
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select), ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select), ['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<CR>'] = cmp.mapping.confirm { ['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = true, select = true,
}, }),
['<C-e>'] = cmp.mapping.abort(),
} }
end
return { on_attach = on_attach, cmp_mappings = cmp_mappings } return { on_attach = on_attach, cmp_mappings = cmp_mappings }

@ -1,7 +1,7 @@
local lsp = require('lsp-zero').preset({ local lsp = require('lsp-zero').preset({
name = 'minimal', name = 'minimal',
set_lsp_keymaps = false, set_lsp_keymaps = false,
manage_nvim_cmp = false, manage_nvim_cmp = true,
suggest_lsp_servers = false, suggest_lsp_servers = false,
}) })
@ -23,6 +23,9 @@ local cmp_config = lsp.defaults.cmp_config({
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'luasnip' }, { name = 'luasnip' },
}, },
experimental = {
ghost_text = false -- conflicts with copilot.vim's preview
},
}) })
cmp.setup(cmp_config) cmp.setup(cmp_config)
@ -54,6 +57,17 @@ lsp.configure('html', {
cmd = { "npx", "vscode-html-language-server", "--stdio" }, cmd = { "npx", "vscode-html-language-server", "--stdio" },
}) })
lsp.setup_servers({'tsserver', 'rust_analyzer', 'html'}) lsp.configure('texlab', {
forwardSearch = {
executable = 'zathura',
args = { '--synctex-forward', '%l:1:%f', '%p' }
},
})
lsp.configure('clangd', {})
lsp.configure('pylsp', {})
lsp.setup_servers({'tsserver', 'rust_analyzer', 'html', 'texlab', 'clangd', 'pylsp'})
lsp.setup() lsp.setup()

@ -16,16 +16,22 @@ local plugins = require('packer').startup(function(use)
-- git -- git
use 'tpope/vim-fugitive' use 'tpope/vim-fugitive'
use 'https://github.com/airblade/vim-gitgutter'
use { use {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate' run = ':TSUpdate'
} }
use {
'https://github.com/github/copilot.vim',
keys = "<C-P>",
}
-- lsp -- lsp
use { use {
'VonHeikemen/lsp-zero.nvim', 'VonHeikemen/lsp-zero.nvim',
branch = 'v1.x', branch = 'v2.x',
requires = { requires = {
-- LSP Support -- LSP Support
{'neovim/nvim-lspconfig'}, {'neovim/nvim-lspconfig'},

@ -1,5 +1,10 @@
local parser_config = require "nvim-treesitter.parsers".get_parser_configs() require('nvim-treesitter.configs').setup {
parser_config.hare = { highlight = {
enable = true,
}
}
require('nvim-treesitter.parsers').get_parser_configs().hare = {
install_info = { install_info = {
url = "https://git.sr.ht/~ecmma/tree-sitter-hare", -- local path or git repo url = "https://git.sr.ht/~ecmma/tree-sitter-hare", -- local path or git repo
files = {"src/parser.c"}, files = {"src/parser.c"},

Loading…
Cancel
Save