Merge branch 'dev' into thesis

nvim: display packer in a floating window
        change telescope comment in packer.lua
        actually use fzf extension
        add telescope-file-browser extension
        add descriptions to mappings
        remap telescope functionalities
        add telescope.help_tags mapping
        use <leader> as prefix for switching colorscheme

system: export PATH in the right place
This commit is contained in:
David JULIEN 2023-01-04 09:13:25 +01:00
commit 4f43d48217
No known key found for this signature in database
GPG Key ID: 1DD6B2BA6DD78810
4 changed files with 97 additions and 18 deletions

View File

@ -3,33 +3,78 @@
-- License : GPLv3 -- License : GPLv3
-- Description : neovim mappings file -- Description : neovim mappings file
vim.keymap.set({ "n", "v" }, "<space>", "<Nop>", { silent = true }) vim.keymap.set({ "n", "v" }, "<space>",
"<Nop>",
{
silent = true,
desc = "leader key"
})
vim.g.mapleader = " " vim.g.mapleader = " "
-- Dealing with word wrap -- Dealing with word wrap
vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", vim.keymap.set("n", "k",
{ expr = true, silent = true }) "v:count == 0 ? 'gk' : 'k'",
vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", {
{ expr = true, silent = true }) expr = true,
silent = true,
desc = "Smart up motion"
})
vim.keymap.set("n", "j",
"v:count == 0 ? 'gj' : 'j'",
{
expr = true,
silent = true,
desc = "Smart down motion"
})
vim.keymap.set("n", "<leader>y", "\"+y") vim.keymap.set("n", "<leader>y",
vim.keymap.set("n", "<leader>p", "\"+P") "\"+y",
vim.keymap.set("n", "<leader><enter>", "<cmd>w! | !compiler %<CR>") { desc = "Yank to clipboard"}
vim.keymap.set("n", "<leader>u", function() require("packer").sync() end) )
vim.keymap.set("n", "<leader>p",
"\"+P",
{ desc = "Copy from clipboard"}
)
vim.keymap.set("n", "<leader><enter>",
"<cmd>w! | !compiler %<CR>",
{ desc = "Compile current file using ~/.local/bin/compiler"}
)
vim.keymap.set("n", "<leader>u",
function() require("packer").sync() end,
{ desc = "Sync packer config and update plugins"}
)
-- telescope -- telescope
vim.keymap.set("n", "<leader>tf", vim.keymap.set("n", "<leader>tf",
function() require("telescope.builtin").find_files() end) function() require("telescope.builtin").find_files() end,
{ desc = "Fuzzy find files" }
)
vim.keymap.set("n", "<leader>tb", vim.keymap.set("n", "<leader>tb",
function() require("telescope.builtin").buffers() end) function() require("telescope").extensions.file_browser.file_browser() end,
{ desc = "Open file browser" }
)
vim.keymap.set("n", "<leader>t/",
function() require("telescope.builtin").buffers() end,
{ desc = "Grep through buffers" }
)
vim.keymap.set("n", "<leader>tg", vim.keymap.set("n", "<leader>tg",
function() require("telescope.builtin").grep_string() end) function() require("telescope.builtin").grep_string() end,
{ desc = "Grep current word" }
)
vim.keymap.set("n", "<leader>th",
function() require("telescope.builtin").help_tags() end,
{ desc = "Search through help" }
)
vim.keymap.set("n", "<leader>tl", vim.keymap.set("n", "<leader>tl",
function() require("telescope.builtin").live_grep() end) function() require("telescope.builtin").live_grep() end,
{ desc = "Grep interactively" }
)
-- colorscheme -- colorscheme
vim.keymap.set("n", "<C-s>", vim.keymap.set("n", "<leader>s",
function() require("astronomy").toggle_variant() end) function() require("astronomy").toggle_variant() end,
{ desc = "Switch between dark and light colorscheme" }
)
-- snippets -- snippets
vim.keymap.set({ "i", "s" }, "<C-E>", "<Plug>luasnip-next-choice") vim.keymap.set({ "i", "s" }, "<C-E>", "<Plug>luasnip-next-choice")

View File

@ -29,6 +29,9 @@ packer.init({
removed_sym = '- ', -- The symbol for an unused plugin which was removed removed_sym = '- ', -- The symbol for an unused plugin which was removed
moved_sym = '', -- The symbol for a plugin which was moved (e.g. from opt to start) moved_sym = '', -- The symbol for a plugin which was moved (e.g. from opt to start)
header_sym = '', -- The symbol for the header line in packer's display header_sym = '', -- The symbol for the header line in packer's display
open_fn = function()
return require('packer.util').float({ border = "single" })
end, -- Display in a floating window
}, },
}) })
@ -51,7 +54,7 @@ return require("packer").startup(function()
config = function() require("plugin.treesitter") end config = function() require("plugin.treesitter") end
} }
-- fuzzy finder -- telescope
use { use {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
requires = { requires = {
@ -61,8 +64,16 @@ return require("packer").startup(function()
{ {
"nvim-telescope/telescope-fzf-native.nvim", "nvim-telescope/telescope-fzf-native.nvim",
run = "make" run = "make"
},
{
"nvim-telescope/telescope-file-browser.nvim",
} }
}, },
config = function()
require("telescope")
require("telescope").load_extension("fzf")
require("telescope").load_extension("file_browser")
end
} }
-- LSP -- LSP

View File

@ -0,0 +1,22 @@
-- Author : swytch
-- Created : Monday Dec. 26, 2022 18:39:16 CET
-- License : GPLv3
-- Description : treesitter config file
require("telescope").setup {
extensions = {
file_browser = {
theme = "ivy",
-- disables netrw and use telescope-file-browser in its place
hijack_netrw = true,
mappings = {
["i"] = {
-- your custom insert mode mappings
},
["n"] = {
-- your custom normal mode mappings
},
},
},
},
}

View File

@ -1,11 +1,12 @@
#!/bin/zsh #!/bin/zsh
# This file is sourced when launching a DM from startx/xinit # This file is sourced when launching a DM from startx/xinit
# path
# environment variables
## path
export PATH="$(find $HOME/.local/bin -type d | tr '\n' ':' | sed 's/:$//'):$PATH" export PATH="$(find $HOME/.local/bin -type d | tr '\n' ':' | sed 's/:$//'):$PATH"
source "$XDG_DATA_HOME/cargo/env" source "$XDG_DATA_HOME/cargo/env"
# environment variables
## custom paths ## custom paths
export DOTFILES="$HOME/.dotfiles.git" export DOTFILES="$HOME/.dotfiles.git"
export LATEX_RESOURCES="$HOME/documents/latex" export LATEX_RESOURCES="$HOME/documents/latex"