Updates to nvim

Signed-off-by: Tiago Garcia <tiago.rgarcia@ua.pt>
This commit is contained in:
Tiago Garcia 2024-09-21 21:32:51 +01:00
parent fde37c0c3a
commit 7a79fd376a
Signed by: TiagoRG
GPG Key ID: DFCD48E3F420DB42
7 changed files with 43 additions and 398 deletions

View File

@ -1,5 +1,16 @@
require("aerial").setup()
local aerial = require("aerial")
aerial.setup({
layout = {
width = 0.2,
default_direction = "prefer_right",
},
show_guides = true,
open_automatic = true,
})
vim.keymap.set("n", "{", "<cmd>AerialPrev<CR>")
vim.keymap.set("n", "}", "<cmd>AerialNext<CR>")
vim.keymap.set("n", "<leader><leader>", "<cmd>AerialToggle float<CR>")
vim.keymap.set("n", "<leader><leader>", aerial.focus)

View File

@ -1,7 +1,7 @@
local lsp = require("lsp-zero")
vim.opt.pumheight = 10
vim.opt.pumwidth = 30
vim.opt.pumheight = 15
vim.opt.pumwidth = 60
lsp.preset("recommended")

View File

@ -10,11 +10,11 @@ require("presence").setup({
debounce_timeout = 1, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`)
enable_line_number = false, -- Displays the current line number instead of the current project
blacklist = { -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
"glua-atas",
"glua-regulamento",
"glua-documentos",
"toggleterm",
"curriculum-vitae",
"Nextcloud",
"NvimTree",
"NvimTree_1",
},
buttons = true, -- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "<label>", url = "<url>" }, ...}`, or a function(buffer: string, repo_url: string|nil): table)

View File

@ -1,6 +1,26 @@
local telescope = require('telescope')
local builtin = require('telescope.builtin')
local trouble = require("trouble.sources.telescope")
telescope.load_extension('aerial')
telescope.setup({
extensions = {
aerial = {
-- How to format the symbols
format_symbol = function(symbol_path, filetype)
if filetype == "json" or filetype == "yaml" then
return table.concat(symbol_path, ".")
else
return symbol_path[#symbol_path]
end
end,
-- Available modes: symbols, lines, both
show_columns = "both",
},
},
})
-- File pickers
vim.keymap.set('n', '<leader>pf', "<cmd>Telescope find_files hidden=true<CR>", {})
vim.keymap.set('n', '<leader>pg', builtin.live_grep, {})
@ -8,6 +28,9 @@ vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep > ") });
end)
-- Context pickers
vim.keymap.set('n', '<leader>pa', "<cmd>Telescope aerial<CR>", {})
-- Git pickers
vim.keymap.set('n', '<leader>gc', builtin.git_commits, {})
vim.keymap.set('n', '<leader>gs', builtin.git_stash, {})
@ -17,6 +40,6 @@ vim.keymap.set('n', '<leader>pe', trouble.open, {})
-- Help pickers
vim.keymap.set('n', '<leader>sh', builtin.help_tags, {})
vim.api.nvim_create_user_command('Help',function()
vim.api.nvim_create_user_command('Help', function()
builtin.help_tags()
end,{})
end, {})

View File

@ -3,4 +3,4 @@ snippet co
snippet so
Signed-off-by: ${1} <${2}>
snippet sotrg
Signed-off-by: TiagoRG <tiago.rgarcia@ua.pt>
Signed-off-by: Tiago Garcia <tiago.rgarcia@ua.pt>

View File

@ -1,252 +0,0 @@
#################
# Rust Snippets #
#################
# Functions
snippet fn "Function definition"
fn ${1:function_name}(${2})${3} {
${0}
}
snippet pfn "Function definition"
pub fn ${1:function_name}(${2})${3} {
${0}
}
snippet afn "Async function definition"
async fn ${1:function_name}(${2})${3} {
${0}
}
snippet pafn "Async function definition"
pub async fn ${1:function_name}(${2})${3} {
${0}
}
snippet bench "Bench function" b
#[bench]
fn ${1:bench_function_name}(b: &mut test::Bencher) {
b.iter(|| {
${0}
})
}
snippet new "Constructor function"
pub fn new(${2}) -> ${1:Self} {
$1 { ${3} }
}
snippet main "Main function"
pub fn main() {
${0}
}
snippet let "let variable declaration with type inference"
let ${1} = ${2};
snippet lett "let variable declaration with explicit type annotation"
let ${1}: ${2} = ${3};
snippet letm "let mut variable declaration with type inference"
let mut ${1} = ${2};
snippet lettm "let mut variable declaration with explicit type annotation"
let mut ${1}: ${2} = ${3};
snippet pri "print!"
print!("${1}");
snippet pri, "print! with format param"
print!("${1}{${2}}", ${3});
snippet pln "println!"
println!("${1}");
snippet pln, "println! with format param"
println!("${1}{${2}}", ${3});
snippet fmt "format!"
format!("${1}{${2}}", ${3});
snippet d "dbg! debugging macro"
dbg!(${0:${VISUAL}})
snippet d; "dbg! debugging macro statement"
dbg!(&${1});
${0}
# Modules
snippet ec "extern crate"
extern crate ${1:sync};
snippet ecl "extern crate log"
#[macro_use]
extern crate log;
snippet mod
mod ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
} /* $1 */
# Testing
snippet as "assert!"
assert!(${1:predicate});
snippet ase "assert_eq!"
assert_eq!(${1:expected}, ${2:actual});
snippet test "Unit test function"
#[test]
fn ${1:function_name}_test() {
${0}
}
snippet testmod "Test module" b
#[cfg(test)]
mod tests {
use super::${1:*};
test${0}
}
snippet ig "#[ignore]"
#[ignore]
# Attributes
snippet allow "allow lint attribute" b
#[allow(${1:unused_variables})]
snippet cfg "cfg attribute" b
#[cfg(${1:target_os = "linux"})]
snippet feat "feature attribute" b
#![feature(${1:plugin})]
snippet der "#[derive(..)]" b
#[derive(${1:Debug})]
snippet attr "#[..]" b
#[${1:inline}]
snippet crate "Define create meta attributes"
// Crate name
#![crate_name = "${1:crate_name}"]
// Additional metadata attributes
#![desc = "${2:Description.}"]
#![license = "${3:BSD}"]
#![comment = "${4:Comment.}"]
// Specify the output type
#![crate_type = "${5:lib}"]
# Common types
snippet opt "Option<T>"
Option<${1:i32}>
snippet res "Result<T, E>"
Result<${1:&str}, ${2:()}>
# Control structures
snippet if
if ${1} {
${0:${VISUAL}}
}
snippet ife "if / else"
if ${1} {
${2:${VISUAL}}
} else {
${0}
}
snippet ifl "if let (...)"
if let ${1:Some($2)} = $3 {
${0:${VISUAL}}
}
snippet el "else"
else {
${0:${VISUAL}}
}
snippet eli "else if"
else if ${1} {
${0:${VISUAL}}
}
snippet mat "match pattern"
match ${1} {
${2} => ${3}
}
snippet case "Case clause of pattern match"
${1:_} => ${2:expression}
snippet = "=> "
=> $0
snippet loop "loop {}" b
loop {
${0:${VISUAL}}
}
snippet wh "while loop"
while $1 {
${0:${VISUAL}}
}
snippet whl "while let (...)"
while let ${1:Some($2)} = $3 {
${0:${VISUAL}}
}
snippet for "for ... in ... loop"
for ${1:i} in ${2} {
${0}
}
# TODO commenting
snippet todo "TODO comment"
// TODO: $0
snippet fixme "FIXME comment"
// FIXME: $0
# Struct
snippet st "Struct definition"
struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
}
snippet impl "Struct/Trait implementation"
impl ${1:Type/Trait}${2: for $3} {
${0}
}
snippet stn "Struct with new constructor"
pub struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
}
impl$2 $1$2 {
pub fn new(${4}) -> Self {
$1 { ${5} }
}
}
snippet ty "Type alias"
type ${1:NewName} = $2;
snippet enum "enum definition"
enum ${1:Name} {
${2},
}
snippet penum "pub enum definition"
pub enum ${1:Name} {
${2},
}
# Traits
snippet trait "Trait definition"
trait ${1:Name} {
${0}
}
snippet drop "Drop trait implementation (destructor)"
impl Drop for $1 {
fn drop(&mut self) {
${0}
}
}
# Statics
snippet ss "static string declaration"
static ${1}: &'static str = "${0}";
snippet stat "static item declaration"
static ${1}: ${2:usize} = ${0};
# Concurrency
snippet spawn "spawn a thread"
thread::spawn(${1:move }|| {
${0}
});
snippet chan "Declare (Sender, Receiver) pair of asynchronous channel()"
let (${1:tx}, ${2:rx}): (Sender<${3:i32}>, Receiver<${4:i32}>) = channel();
# Implementations
snippet asref "AsRef trait implementation"
impl AsRef<${1:Ref}> for ${2:Type} {
fn as_ref(&self) -> &${3:$1} {
&self.${0:field}
}
}
snippet asmut "AsMut trait implementation"
impl AsMut<${1:Ref}> for ${2:Type} {
fn as_mut(&mut self) -> &mut ${3:$1} {
&mut self.${0:field}
}
}
snippet fd "Struct field definition" w
${1:name}: ${2:Type},
snippet || "Closure, anonymous function (inline)" i
${1:move }|$2| { $3 }
snippet |} "Closure, anonymous function (block)" i
${1:move }|$2| {
$3
}
snippet macro "macro_rules!" b
macro_rules! ${1:name} {
(${2:matcher}) => (
$3
)
}
snippet boxp "Box::new()"
Box::new(${0:${VISUAL}})
snippet rc "Rc::new()"
Rc::new(${0:${VISUAL}})
snippet unim "unimplemented!()"
unimplemented!()
snippet use "use ...;" b
use ${1:std::$2};

View File

@ -1,137 +0,0 @@
#
## Libraries
snippet lib
library ${1}
use $1.${2}
# Standard Libraries
snippet libs
library IEEE;
use IEEE.std_logic_1164.ALL;
use IEEE.numeric_std.ALL;
# Xilinx Library
snippet libx
library UNISIM;
use UNISIM.VCOMPONENTS.ALL;
## Entity Declaration
snippet ent
entity ${1:`vim_snippets#Filename()`} is
generic (
${2}
);
port (
${3}
);
end entity $1;
## Architecture
snippet arc
architecture ${1:behav} of ${2:`vim_snippets#Filename()`} is
${3}
begin
end $1;
## Declarations
# std_logic
snippet st
signal ${1} : std_logic;
# std_logic_vector
snippet sv
signal ${1} : std_logic_vector (${2} downto 0);
# std_logic in
snippet ist
${1} : in std_logic;
# std_logic_vector in
snippet isv
${1} : in std_logic_vector (${2} downto 0);
# std_logic out
snippet ost
${1} : out std_logic;
# std_logic_vector out
snippet osv
${1} : out std_logic_vector (${2} downto 0);
# unsigned
snippet un
signal ${1} : unsigned (${2} downto 0);
## Process Statements
# process
snippet pr
process (${1})
begin
${2}
end process;
# process with clock
snippet prc
process (${1:clk})
begin
if rising_edge ($1) then
${2}
end if;
end process;
# process with clock and reset
snippet prcr
process (${1:clk}, ${2:nrst})
begin
if ($2 = '${3:0}') then
${4}
elsif rising_edge($1) then
${5}
end if;
end process;
# process all
snippet pra
process (${1:all})
begin
${2}
end process;
## Control Statements
# if
snippet if
if ${1} then
${2}
end if;
# if
snippet ife
if ${1} then
${2}
else
${3}
end if;
# else
snippet el
else
${1}
# if
snippet eif
elsif ${1} then
${2}
# case
snippet ca
case ${1} is
${2}
end case;
# when
snippet wh
when ${1} =>
${2}
# for
snippet for
for ${1:i} in ${2} ${3:to} ${4} loop
${5}
end loop;
# while
snippet wh
while ${1} loop
${2}
end loop;
## Misc
# others
snippet oth
(others => '${1:0}');