1
0
Fork 0

feat: uplift nvim

Signed-off-by: Lucas Sta Maria <lucas@priime.dev>
This commit is contained in:
Lucas Sta Maria 2022-10-12 01:30:09 -04:00
parent 5619e9b217
commit 67c0e020a2
No known key found for this signature in database
GPG key ID: F07FB16A826E3B47
9 changed files with 183 additions and 45 deletions

View file

@ -12,6 +12,55 @@ def env(name):
endglobal endglobal
# General Formatting # General Formatting
snippet preamble "preamble" w
\\usepackage[a4paper, margin=0.5in]{geometry}
\\usepackage{amsmath}
\\usepackage{amsthm}
\\usepackage{amssymb}
\\usepackage{enumitem}
\\usepackage{import}
\\usepackage{pdfpages}
\\usepackage{transparent}
\\usepackage{xcolor}
\\newcommand{\\incfig}[2][1]{%
\t\\def\\svgwidth{#1\\columnwidth}
\t\\import{./figures/}{#2.pdf_tex}
}
\\pdfsuppresswarningpagegroup=1
\\theoremstyle{definition}
\\newtheorem{all}{Theorem}[section]
\\theoremstyle{definition}
\\newtheorem{corollary}[all]{Corollary}
\\theoremstyle{definition}
\\newtheorem{lemma}[all]{Lemma}
\\theoremstyle{definition}
\\newtheorem{definition}[all]{Definition}
\\theoremstyle{definition}
\\newtheorem{exercise}[all]{Exercise}
\\theoremstyle{definition}
\\newtheorem{proposition}[all]{Proposition}
\\theoremstyle{definition}
\\newtheorem{example}[all]{Example}
\\newenvironment{lecture}[1]{
\t\\section{\\MakeUppercase{#1}}
\t\\vspace{-0.5em}
\t\\hrule
\t\\vspace{1em}
\t\\begin{list}{}{
\t\t\\setlength{\\leftmargin}{1.5em}
\t}
\t\\item[]
}{
\t\\end{list}
}
endsnippet
snippet beg "begin{} / end{}" bA snippet beg "begin{} / end{}" bA
\\begin{$1} \\begin{$1}
$0 $0
@ -27,7 +76,6 @@ snippet tob "Bold" w
endsnippet endsnippet
# Text Formatting # Text Formatting
snippet ... "ldots" A snippet ... "ldots" A
\ldots \ldots
endsnippet endsnippet
@ -50,8 +98,8 @@ endsnippet
# Math Snippets # Math Snippets
context "math()" context "math()"
snippet iff "iff" Ai snippet iff "iff" iA
\iff \iff $0
endsnippet endsnippet
context "math()" context "math()"
@ -93,6 +141,10 @@ snippet __ "subscript" iA
_{$1}$0 _{$1}$0
endsnippet endsnippet
snippet ^^ "superscript" iA
^{$1}$0
endsnippet
context "math()" context "math()"
snippet ceil "ceil" iA snippet ceil "ceil" iA
\left\lceil $1 \right\rceil $0 \left\lceil $1 \right\rceil $0
@ -153,14 +205,19 @@ snippet compl "complement" iA
^{c} ^{c}
endsnippet endsnippet
context "math()"
snippet txt "text" iA
\\text{ $1 } $0
endsnippet
context "math()" context "math()"
snippet set "set" wA snippet set "set" wA
\\{$1\\} $0 \\{$1\\} $0
endsnippet endsnippet
context "math()" context "math()"
snippet cc "subset" Ai snippet cc "complement" Ai
\subset ^{c}
endsnippet endsnippet
snippet notin "not in " iA snippet notin "not in " iA
@ -176,11 +233,13 @@ snippet NN "n" iA
\N \N
endsnippet endsnippet
snippet Nn "cap" iA context "math()"
snippet cap "cap" iA
\cap \cap
endsnippet endsnippet
snippet UU "cup" iA context "math()"
snippet cup "cup" iA
\cup \cup
endsnippet endsnippet

View file

@ -0,0 +1,11 @@
-- map the key (sequence) to a command
local function map(mode, lhs, rhs, opts)
local options = { noremap = true }
if opts then
options = vim.tbl_extend("force", options, opts)
end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
-- map("n", "<C-c>", "<ESC>:w<CR>:terminal<CR>racket -i -f " .. vim.fn.expand("%"))
map("n", "<C-c>", "<ESC>:w<CR>:ToggleTerm<CR>racket -i -f ")

View file

@ -0,0 +1,14 @@
-- map the key (sequence) to a command
local function map(mode, lhs, rhs, opts)
local options = { noremap = true }
if opts then
options = vim.tbl_extend("force", options, opts)
end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
map("i", "<C-c>", "<ESC>:w<CR>:!just<CR>")
map("n", "<C-c>", "<ESC>:w<CR>:!just<CR>")
vim.cmd("inoremap <C-f> <Esc>: silent exec '.!inkscape-figures create \"'.getline('.').'\" \"'.b:vimtex.root.'/figures/\"'<CR><CR>:w<CR>")
vim.cmd("nnoremap <C-f> : silent exec '!inkscape-figures edit \"'.b:vimtex.root.'/figures/\" > /dev/null 2>&1 &'<CR><CR>:redraw!<CR>")

View file

@ -30,9 +30,12 @@ opt("mouse", "a")
vim.g.mapleader = " " vim.g.mapleader = " "
vim.g.copilot_no_tab_map = true vim.g.copilot_no_tab_map = true
vim.g.maplocalleader = ","
require("plugins") require("plugins")
require("mappings") require("mappings")
require("treesitter") require("treesitter")
require("completion") require("completion")
require("lsp") require("lsp")
require("git")
require("neovide")

1
.config/nvim/lua/git.lua Normal file
View file

@ -0,0 +1 @@
local neogit = require("neogit")

View file

@ -31,36 +31,36 @@ cmp.setup({
}, { }, {
{ name = 'buffer' }, { name = 'buffer' },
}) })
}) })
-- Set configuration for specific filetype. -- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', { cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
}, { }, {
{ name = 'buffer' }, { name = 'buffer' },
}) })
}) })
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline('/', { cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = { sources = {
{ name = 'buffer' } { name = 'buffer' }
} }
}) })
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', { cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'path' } { name = 'path' }
}, { }, {
{ name = 'cmdline' } { name = 'cmdline' }
}) })
}) })
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
local on_attach = function(client, bufnr) local on_attach = function(client, bufnr)
local opts = { noremap = true, silent = true } local opts = { noremap = true, silent = true }
@ -129,9 +129,24 @@ lspconfig.tsserver.setup {
lspconfig.java_language_server.setup { lspconfig.java_language_server.setup {
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities, capabilities = capabilities,
cmd = { "/usr/share/java/java-language-server/lang_server_linux.sh" } cmd = { "/usr/share/java/java-language-server/lang_server_linux.sh" },
root_dir = lspconfig.util.root_pattern('*.iml', '.idea', 'build.xml', 'pom.xml', 'settings.gradle',
'settings.gradle.kts')
} }
--lspconfig.jdtls.setup {
-- on_attach = on_attach,
-- capabilities = capabilities,
-- root_dir = lspconfig.util.root_pattern(
-- 'build.xml',
-- 'pom.xml',
-- 'settings.gradle',
-- 'settings.gradle.kts',
-- '*.iml',
-- '.idea'
-- )
--}
lspconfig.racket_langserver.setup { lspconfig.racket_langserver.setup {
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities, capabilities = capabilities,

View file

@ -8,7 +8,9 @@ local function map(mode, lhs, rhs, opts)
end end
-- open terminal -- open terminal
map("n", "<leader>ot", ":ToggleTerm<CR>") map("n", "<leader>ott", ":ToggleTerm<CR>")
map("n", "<leader>otf", ":ToggleTerm direction=float<CR>")
map("n", "<leader>otv", ":ToggleTerm direction=vertical<CR>")
-- exit terminal mode -- exit terminal mode
map("t", "<esc>", "<C-\\><C-n>") map("t", "<esc>", "<C-\\><C-n>")
@ -23,3 +25,13 @@ map("n", "<leader>tg", ":Telescope live_grep<CR>")
-- copilot -- copilot
map('i', '<C-a>', 'copilot#Accept("<CR>")', {expr=true, silent=true}) map('i', '<C-a>', 'copilot#Accept("<CR>")', {expr=true, silent=true})
-- neogit
map('n', '<leader>gg', ':Neogit<CR>')
-- symbols outline
map("n", "<leader>os", ":SymbolsOutline<CR>")
-- leap
map("n", "<C-s>", ":lua require('leap').leap {}<CR>")
map("n", "<C-z>", ":lua require('leap').leap { backward = true }<CR>")

View file

@ -0,0 +1,11 @@
vim.opt.guifont = { "Source Code Pro", ":h10"}
vim.g.neovide_hide_mouse_when_typing = true
vim.g.neovide_refresh_rate = 60
vim.g.neovide_refresh_rate_idle = 5
vim.g.neovide_remember_window_size = false
vim.g.neovide_cursor_animation_length=0.08
vim.g.neovide_cursor_trail_size = 0.6

View file

@ -13,6 +13,8 @@ packer.startup(function()
use("neovim/nvim-lspconfig") use("neovim/nvim-lspconfig")
use("j-hui/fidget.nvim") use("j-hui/fidget.nvim")
use("onsails/lspkind-nvim") use("onsails/lspkind-nvim")
use("wlangstroth/vim-racket")
use("Olical/conjure")
-- ui -- ui
use("ayu-theme/ayu-vim") use("ayu-theme/ayu-vim")
@ -22,7 +24,8 @@ packer.startup(function()
use("kyazdani42/nvim-web-devicons") use("kyazdani42/nvim-web-devicons")
use("kyazdani42/nvim-tree.lua") use("kyazdani42/nvim-tree.lua")
use("nvim-lualine/lualine.nvim") use("nvim-lualine/lualine.nvim")
use("akinsho/toggleterm.nvim") use{"akinsho/toggleterm.nvim",branch="main"}
use("simrat39/symbols-outline.nvim")
-- completion -- completion
use("hrsh7th/cmp-nvim-lsp") use("hrsh7th/cmp-nvim-lsp")
@ -39,6 +42,9 @@ packer.startup(function()
use("davidgranstrom/nvim-markdown-preview") use("davidgranstrom/nvim-markdown-preview")
use("folke/todo-comments.nvim") use("folke/todo-comments.nvim")
use("lervag/vimtex") use("lervag/vimtex")
use("TimUntersberger/neogit")
use("ggandor/leap.nvim")
use("eraserhd/parinfer-rust")
if packer_bootstrap then if packer_bootstrap then
require('packer').sync() require('packer').sync()
@ -132,10 +138,16 @@ vim.cmd[[
]] ]]
-- todo-comments -- todo-comments
require('todo-comments').setup {} -- require('todo-comments').setup {}
-- copilot -- copilot
vim.g.copilot_filetypes = { vim.g.copilot_filetypes = {
['*'] = false, ['*'] = false,
['java'] = true, ['java'] = true,
} }
-- symbols-outline
require('symbols-outline').setup {}
-- leap
require('leap').setup {}