parent
3e571765fd
commit
814b208a9b
|
@ -5,19 +5,31 @@ lsp.preset("recommended")
|
||||||
-- Fix Undefined global 'vim'
|
-- Fix Undefined global 'vim'
|
||||||
lsp.nvim_workspace()
|
lsp.nvim_workspace()
|
||||||
|
|
||||||
|
local luasnip = require("luasnip")
|
||||||
local cmp = require('cmp')
|
local cmp = require('cmp')
|
||||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||||
local cmp_mappings = lsp.defaults.cmp_mappings({
|
local cmp_mappings = lsp.defaults.cmp_mappings({
|
||||||
['<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),
|
||||||
['<Tab>'] = cmp.mapping.confirm({ select = true }),
|
|
||||||
["<C-Space>"] = cmp.mapping.complete(),
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.confirm({ select = true })
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" })
|
||||||
})
|
})
|
||||||
|
|
||||||
-- cmp_mappings['<Tab>'] = nil
|
|
||||||
-- cmp_mappings['<S-Tab>'] = nil
|
|
||||||
|
|
||||||
lsp.setup_nvim_cmp({
|
lsp.setup_nvim_cmp({
|
||||||
mapping = cmp_mappings
|
mapping = cmp_mappings
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
require("luasnip.loaders.from_snipmate").load({ path = { "$HOME/.config/nvim/snippets/" } })
|
require("luasnip.loaders.from_snipmate").load({ path = { "$HOME/.config/nvim/snippets/" } })
|
||||||
|
|
||||||
local ls = require("luasnip")
|
local ls = require("luasnip")
|
||||||
vim.keymap.set({"i"}, "<C-K>", function() ls.expand() end, {silent = true})
|
|
||||||
vim.keymap.set({"i", "s"}, "<C-D>", function() ls.jump( 1) end, {silent = true})
|
vim.keymap.set({"i", "s"}, "<C-D>", function() ls.jump( 1) end, {silent = true})
|
||||||
vim.keymap.set({"i", "s"}, "<C-C>", function() ls.jump(-1) end, {silent = true})
|
vim.keymap.set({"i", "s"}, "<C-C>", function() ls.jump(-1) end, {silent = true})
|
||||||
|
|
||||||
vim.keymap.set({"i", "s"}, "<C-E>", function()
|
|
||||||
if ls.choice_active() then
|
|
||||||
ls.change_choice(1)
|
|
||||||
end
|
|
||||||
end, {silent = true})
|
|
||||||
|
|
|
@ -35,7 +35,9 @@ vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
|
||||||
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
|
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
|
||||||
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
|
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>r", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
vim.keymap.set("v", "<leader>rs", [[:s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||||
|
vim.keymap.set("n", "<leader>ra", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||||
|
vim.keymap.set("n", "<leader>rc", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gcI<Left><Left><Left><Left>]])
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>m", "<cmd>!make > /dev/null<CR>", { silent = true })
|
vim.keymap.set("n", "<leader>m", "<cmd>!make > /dev/null<CR>", { silent = true })
|
||||||
|
|
||||||
|
@ -49,5 +51,6 @@ vim.api.nvim_exec([[
|
||||||
augroup SearchHighlight
|
augroup SearchHighlight
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd CmdlineLeave /,\? :nnoremap <buffer> <Esc> :nohls<CR>
|
autocmd CmdlineLeave /,\? :nnoremap <buffer> <Esc> :nohls<CR>
|
||||||
|
autocmd CmdlineChanged /,\? :nnoremap <buffer> <Esc> :nohls<CR>
|
||||||
augroup END
|
augroup END
|
||||||
]], false)
|
]], false)
|
||||||
|
|
|
@ -1,35 +1,30 @@
|
||||||
-- vim.opt.guicursor = ""
|
vim.g.mapleader = " "
|
||||||
|
vim.g.mouse = "a"
|
||||||
|
|
||||||
-- vim.opt.clipboard = "unnamedplus"
|
vim.opt.updatetime = 50
|
||||||
|
vim.opt.wrap = false
|
||||||
|
|
||||||
vim.opt.nu = true
|
vim.opt.nu = true
|
||||||
vim.opt.relativenumber = true
|
vim.opt.relativenumber = true
|
||||||
|
vim.opt.scrolloff = 10
|
||||||
|
vim.opt.signcolumn = "yes"
|
||||||
|
vim.opt.colorcolumn = "0"
|
||||||
|
|
||||||
vim.opt.smartindent = true
|
vim.opt.smartindent = true
|
||||||
|
|
||||||
vim.opt.wrap = false
|
vim.opt.hls = true
|
||||||
|
vim.opt.is = true
|
||||||
|
vim.opt.ic = true
|
||||||
|
|
||||||
vim.opt.swapfile = false
|
vim.opt.swapfile = false
|
||||||
vim.opt.backup = false
|
vim.opt.backup = false
|
||||||
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
||||||
vim.opt.undofile = true
|
vim.opt.undofile = true
|
||||||
|
|
||||||
vim.opt.hlsearch = true
|
|
||||||
vim.opt.incsearch = true
|
|
||||||
|
|
||||||
vim.opt.termguicolors = true
|
vim.opt.termguicolors = true
|
||||||
|
|
||||||
vim.opt.scrolloff = 10
|
|
||||||
vim.opt.signcolumn = "yes"
|
|
||||||
vim.opt.isfname:append("@-@")
|
vim.opt.isfname:append("@-@")
|
||||||
vim.opt.guitablabel = "\\[%N\\]\\ %t\\ %M"
|
vim.opt.guitablabel = "\\[%N\\]\\ %t\\ %M"
|
||||||
|
|
||||||
vim.opt.updatetime = 50
|
|
||||||
|
|
||||||
vim.opt.colorcolumn = "0"
|
|
||||||
|
|
||||||
vim.g.copilot_node_command = "/usr/bin/nodenv"
|
vim.g.copilot_node_command = "/usr/bin/nodenv"
|
||||||
vim.g.copilot_assume_mapped = true
|
vim.g.copilot_assume_mapped = true
|
||||||
|
|
||||||
vim.g.mapleader = " "
|
|
||||||
vim.g.mouse = "a"
|
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
## Main
|
## Main
|
||||||
# main
|
# main
|
||||||
snippet main
|
snippet main
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[]) {
|
||||||
{
|
|
||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
# main(void)
|
# main(void)
|
||||||
snippet mainn
|
snippet mainn
|
||||||
int main(void)
|
int main(void) {
|
||||||
{
|
|
||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
##
|
##
|
||||||
|
@ -141,15 +139,13 @@ snippet do
|
||||||
## Functions
|
## Functions
|
||||||
# function definition
|
# function definition
|
||||||
snippet fun
|
snippet fun
|
||||||
${1:void} ${2:function_name}(${3})
|
${1:void} ${2:function_name}(${3}) {
|
||||||
{
|
${0}
|
||||||
${4}
|
|
||||||
}
|
}
|
||||||
# function definition with zero parameters
|
# function definition with zero parameters
|
||||||
snippet fun0
|
snippet fun0
|
||||||
${1:void} ${2:function_name}()
|
${1:void} ${2:function_name}() {
|
||||||
{
|
${0}
|
||||||
${3}
|
|
||||||
}
|
}
|
||||||
# function definition with Doxygen documentation
|
# function definition with Doxygen documentation
|
||||||
snippet dfun0
|
snippet dfun0
|
||||||
|
@ -159,15 +155,13 @@ snippet dfun0
|
||||||
*
|
*
|
||||||
* \return ${3:Return parameter description}
|
* \return ${3:Return parameter description}
|
||||||
*/
|
*/
|
||||||
${4:void} ${5:function_name}()
|
${4:void} ${5:function_name}() {
|
||||||
{
|
${0}
|
||||||
${6}
|
|
||||||
}
|
}
|
||||||
# function definition with one parameter
|
# function definition with one parameter
|
||||||
snippet fun1
|
snippet fun1
|
||||||
${1:void} ${2:function_name}(${3:Type} ${4:Parameter})
|
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}) {
|
||||||
{
|
${0}
|
||||||
${5}
|
|
||||||
}
|
}
|
||||||
# function definition with one parameter with Doxygen documentation
|
# function definition with one parameter with Doxygen documentation
|
||||||
snippet dfun1
|
snippet dfun1
|
||||||
|
@ -178,15 +172,13 @@ snippet dfun1
|
||||||
* \param $3 ${4:Parameter description}
|
* \param $3 ${4:Parameter description}
|
||||||
* \return ${5:Return parameter description}
|
* \return ${5:Return parameter description}
|
||||||
*/
|
*/
|
||||||
${6:void} ${7:function_name}(${8:Type} ${3:Parameter})
|
${6:void} ${7:function_name}(${8:Type} ${3:Parameter}) {
|
||||||
{
|
${0}
|
||||||
${9}
|
|
||||||
}
|
}
|
||||||
# function definition with two parameters
|
# function definition with two parameters
|
||||||
snippet fun2
|
snippet fun2
|
||||||
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter})
|
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}) {
|
||||||
{
|
${0}
|
||||||
${7}
|
|
||||||
}
|
}
|
||||||
# function definition with two parameters with Doxygen documentation
|
# function definition with two parameters with Doxygen documentation
|
||||||
snippet dfun2
|
snippet dfun2
|
||||||
|
@ -198,15 +190,13 @@ snippet dfun2
|
||||||
* \param $5 ${6:Parameter description}
|
* \param $5 ${6:Parameter description}
|
||||||
* \return ${7:Return parameter description}
|
* \return ${7:Return parameter description}
|
||||||
*/
|
*/
|
||||||
${8:void} ${9:function_name}(${10:Type} ${3:Parameter}, ${11:Type} ${5:Parameter})
|
${8:void} ${9:function_name}(${10:Type} ${3:Parameter}, ${11:Type} ${5:Parameter}) {
|
||||||
{
|
${0}
|
||||||
${12}
|
|
||||||
}
|
}
|
||||||
# function definition with three parameters
|
# function definition with three parameters
|
||||||
snippet fun3
|
snippet fun3
|
||||||
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}, ${7:Type} ${8:Parameter})
|
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}, ${7:Type} ${8:Parameter}) {
|
||||||
{
|
${0}
|
||||||
${9}
|
|
||||||
}
|
}
|
||||||
# function definition with three parameters with Doxygen documentation
|
# function definition with three parameters with Doxygen documentation
|
||||||
snippet dfun3
|
snippet dfun3
|
||||||
|
@ -219,9 +209,8 @@ snippet dfun3
|
||||||
* \param $7 ${8:Parameter description}
|
* \param $7 ${8:Parameter description}
|
||||||
* \return ${9:Return parameter description}
|
* \return ${9:Return parameter description}
|
||||||
*/
|
*/
|
||||||
${10:void} ${11:function_name}(${12:Type} ${3:Parameter}, ${13:Type} ${5:Parameter}, ${14:Type} ${7:Parameter})
|
${10:void} ${11:function_name}(${12:Type} ${3:Parameter}, ${13:Type} ${5:Parameter}, ${14:Type} ${7:Parameter}) {
|
||||||
{
|
${0}
|
||||||
${15}
|
|
||||||
}
|
}
|
||||||
# function declaration
|
# function declaration
|
||||||
snippet fund
|
snippet fund
|
||||||
|
|
27
.vimrc
27
.vimrc
|
@ -1,16 +1,22 @@
|
||||||
syntax on
|
|
||||||
colorscheme onedark
|
|
||||||
|
|
||||||
set nu
|
set nu
|
||||||
set relativenumber
|
set relativenumber
|
||||||
|
set signcolumn=yes
|
||||||
|
set colorcolumn=80
|
||||||
|
|
||||||
|
set smartindent
|
||||||
set tabstop=4
|
set tabstop=4
|
||||||
set shiftwidth=4
|
set shiftwidth=4
|
||||||
set ls=2
|
set ls=2
|
||||||
set hlsearch
|
|
||||||
set incsearch
|
set hls
|
||||||
|
set is
|
||||||
|
set ic
|
||||||
set scrolloff=10
|
set scrolloff=10
|
||||||
|
|
||||||
let g:mapleader = " "
|
let g:mapleader=" "
|
||||||
|
|
||||||
|
syntax on
|
||||||
|
colorscheme onedark
|
||||||
|
|
||||||
nnoremap <leader>w :w<CR>
|
nnoremap <leader>w :w<CR>
|
||||||
nnoremap <leader>e :E<CR>
|
nnoremap <leader>e :E<CR>
|
||||||
|
@ -33,12 +39,15 @@ vnoremap <leader>d "_d
|
||||||
|
|
||||||
nnoremap <silent> Q @@
|
nnoremap <silent> Q @@
|
||||||
|
|
||||||
nnoremap <leader>r :%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>
|
vnoremap <leader>rs :s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>
|
||||||
|
nnoremap <leader>ra :%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>
|
||||||
|
nnoremap <leader>rc :%s/\<<C-r><C-w>\>/<C-r><C-w>/gcI<Left><Left><Left><Left>
|
||||||
|
|
||||||
nnoremap <leader>m :!make<CR>
|
nnoremap <leader>m :!make<CR>
|
||||||
|
|
||||||
augroup SearchHighlight
|
augroup SearchHighlight
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd CmdlineLeave /,\? :nnoremap <buffer> <Esc> :nohls<CR>
|
autocmd CmdlineLeave /,\? :nnoremap <buffer> <Esc> :nohls<CR>
|
||||||
|
autocmd CmdlineChanged /,\? :nnoremap <buffer> <Esc> :nohls<CR>
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
|
|
@ -323,3 +323,5 @@ export CPATH=/home/tiagorg/.local/include:/opt/pic32mx/include:$CPATH
|
||||||
# For C++ only: CPLUS_INCLUDE_PATH
|
# For C++ only: CPLUS_INCLUDE_PATH
|
||||||
# For Obj-C: OBJC_INCLUDE_PATH
|
# For Obj-C: OBJC_INCLUDE_PATH
|
||||||
export LIBRARY_PATH=/home/tiagorg/.local/lib:$LIBRARY_PATH
|
export LIBRARY_PATH=/home/tiagorg/.local/lib:$LIBRARY_PATH
|
||||||
|
|
||||||
|
export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/gcr/ssh
|
||||||
|
|
Loading…
Reference in New Issue