This commit is contained in:
Nikos Papadakis 2023-06-14 12:30:11 +03:00
parent 5aea9e5dea
commit e7f569e938
Signed by untrusted user who does not match committer: nikos
GPG key ID: 78871F9905ADFF02
7 changed files with 61 additions and 23 deletions

View file

@ -23,3 +23,4 @@ set -x -g PATH $CARGO_HOME/bin $RUSTUP_HOME/bin $HOME/.local/bin $PATH
test (command -v fnm) && fnm env | source
test (command -v zoxide) && zoxide init fish | source
test -e /opt/asdf-vm/asdf.fish && source /opt/asdf-vm/asdf.fish

View file

@ -4,8 +4,6 @@ if not ok then
return
end
local nmap = require("my.utils").nmap
local border = {
{ "", "FloatBorder" },
{ "", "FloatBorder" },
@ -60,12 +58,7 @@ local format_handler = function(err, result, ctx)
end
local on_attach = function(client, bufnr)
nmap("<Leader>r", vim.lsp.buf.rename, "Rename", bufnr)
nmap("<Leader>cf", vim.lsp.buf.format, "Format document", bufnr)
nmap("<Leader>ca", vim.lsp.buf.code_action, "Code actions", bufnr)
nmap("<Leader>ci", vim.lsp.buf.implementation, "Go to implementation", bufnr)
nmap("<Leader>D", vim.lsp.buf.type_definition, "Go to type definition", bufnr)
nmap("gr", "<Cmd>Telescope lsp_references<CR>", "View references", bufnr)
require("my.keymaps").lsp_keymaps(client, bufnr)
if client.server_capabilities.completionProvider then
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
@ -75,10 +68,6 @@ local on_attach = function(client, bufnr)
vim.api.nvim_buf_set_option(bufnr, "tagfunc", "v:lua.vim.lsp.tagfunc")
end
if client.server_capabilities.hoverProvider then
nmap("K", vim.lsp.buf.hover, "LSP hover", bufnr)
end
-- Highlight on cursor hold
if client.server_capabilities.documentHighlightProvider then
vim.api.nvim_create_autocmd({ "CursorHold" }, {

View file

@ -6,14 +6,39 @@ end
local nmap = require("my.utils").nmap
telescope.setup {}
telescope.setup {
extensions = {
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = "smart_case",
}
}
}
local function project_or_files()
local opts = { show_untracked = true }
local ok = pcall(builtin.git_files, opts)
if not ok then
builtin.fd(opts)
local function project()
local exclusions = {
"**/.git/",
"*.svg",
"*.png",
"*.jpg",
}
local find_command = nil
if FD_EXISTS then
find_command = { "fd", "--hidden", "-t", "f" }
for _, value in ipairs(exclusions) do
table.insert(find_command, "--exclude")
table.insert(find_command, value)
end
elseif RIPGREP_EXISTS then
find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/*" }
end
builtin.find_files {
find_command = find_command,
}
end
local function dotfiles()
@ -24,7 +49,10 @@ local function dotfiles()
}
end
nmap("<C-p>", project_or_files, "Find project files")
nmap("<C-p>", project, "Find project files")
nmap("<Leader>fn", dotfiles, "Dotfiles")
nmap("<Leader><C-p>", builtin.git_files, "Find git files")
nmap("<Leader>fg", builtin.live_grep, "Live grep")
nmap("<Leader>gs", builtin.git_status, "Git status")
telescope.load_extension("fzf")

View file

@ -5,6 +5,9 @@ Configuration Home: https://github.com/esprssoo/dotfiles
--]]
FD_EXISTS = vim.fn.executable("fd")
RIPGREP_EXISTS = vim.fn.executable("rg")
vim.g.mapleader = " "
-- vim.g.netrw_banner = 0
vim.g.loaded_netrw = 1

View file

@ -61,3 +61,20 @@ imap("jk", "<Esc>")
vmap("<Leader>p", '"_dP')
vmap(">", ">gv")
vmap("<", "<gv")
local function lsp_keymaps(client, bufnr)
nmap("<Leader>r", vim.lsp.buf.rename, "Rename", bufnr)
nmap("<Leader>cf", vim.lsp.buf.format, "Format document", bufnr)
nmap("<Leader>ca", vim.lsp.buf.code_action, "Code actions", bufnr)
nmap("<Leader>ci", vim.lsp.buf.implementation, "Go to implementation", bufnr)
nmap("<Leader>D", vim.lsp.buf.type_definition, "Go to type definition", bufnr)
nmap("gr", "<Cmd>Telescope lsp_references<CR>", "View references", bufnr)
if client.server_capabilities.hoverProvider then
nmap("K", vim.lsp.buf.hover, "LSP hover", bufnr)
end
end
return {
lsp_keymaps = lsp_keymaps,
}

View file

@ -25,9 +25,10 @@ require "paq" {
"nvim-lualine/lualine.nvim",
"windwp/nvim-autopairs",
"mickael-menu/zk-nvim",
{ "nvim-telescope/telescope.nvim", branch = "0.1.x" },
{ "catppuccin/nvim", as = "catppuccin" },
{ "williamboman/mason.nvim", branch = "v1.0.1" },
{ "nvim-telescope/telescope.nvim", branch = "0.1.x" },
{ "nvim-telescope/telescope-fzf-native.nvim", run = "make" },
{ "catppuccin/nvim", as = "catppuccin" },
{ "williamboman/mason.nvim", branch = "v1.0.1" },
"stevearc/oil.nvim",
-- Treesitter
@ -45,5 +46,4 @@ require "paq" {
"L3MON4D3/LuaSnip",
"nvim-lua/lsp-status.nvim",
"onsails/lspkind.nvim",
"mfussenegger/nvim-lint",
}