nvim
This commit is contained in:
parent
5aea9e5dea
commit
e7f569e938
7 changed files with 61 additions and 23 deletions
|
@ -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 fnm) && fnm env | source
|
||||||
test (command -v zoxide) && zoxide init fish | source
|
test (command -v zoxide) && zoxide init fish | source
|
||||||
|
test -e /opt/asdf-vm/asdf.fish && source /opt/asdf-vm/asdf.fish
|
||||||
|
|
|
@ -4,8 +4,6 @@ if not ok then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local nmap = require("my.utils").nmap
|
|
||||||
|
|
||||||
local border = {
|
local border = {
|
||||||
{ "┌", "FloatBorder" },
|
{ "┌", "FloatBorder" },
|
||||||
{ "─", "FloatBorder" },
|
{ "─", "FloatBorder" },
|
||||||
|
@ -60,12 +58,7 @@ local format_handler = function(err, result, ctx)
|
||||||
end
|
end
|
||||||
|
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
nmap("<Leader>r", vim.lsp.buf.rename, "Rename", bufnr)
|
require("my.keymaps").lsp_keymaps(client, 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.completionProvider then
|
if client.server_capabilities.completionProvider then
|
||||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
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")
|
vim.api.nvim_buf_set_option(bufnr, "tagfunc", "v:lua.vim.lsp.tagfunc")
|
||||||
end
|
end
|
||||||
|
|
||||||
if client.server_capabilities.hoverProvider then
|
|
||||||
nmap("K", vim.lsp.buf.hover, "LSP hover", bufnr)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Highlight on cursor hold
|
-- Highlight on cursor hold
|
||||||
if client.server_capabilities.documentHighlightProvider then
|
if client.server_capabilities.documentHighlightProvider then
|
||||||
vim.api.nvim_create_autocmd({ "CursorHold" }, {
|
vim.api.nvim_create_autocmd({ "CursorHold" }, {
|
||||||
|
|
|
@ -6,14 +6,39 @@ end
|
||||||
|
|
||||||
local nmap = require("my.utils").nmap
|
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 function project()
|
||||||
local opts = { show_untracked = true }
|
local exclusions = {
|
||||||
local ok = pcall(builtin.git_files, opts)
|
"**/.git/",
|
||||||
if not ok then
|
"*.svg",
|
||||||
builtin.fd(opts)
|
"*.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
|
end
|
||||||
|
|
||||||
|
builtin.find_files {
|
||||||
|
find_command = find_command,
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local function dotfiles()
|
local function dotfiles()
|
||||||
|
@ -24,7 +49,10 @@ local function dotfiles()
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
nmap("<C-p>", project_or_files, "Find project files")
|
nmap("<C-p>", project, "Find project files")
|
||||||
nmap("<Leader>fn", dotfiles, "Dotfiles")
|
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>fg", builtin.live_grep, "Live grep")
|
||||||
nmap("<Leader>gs", builtin.git_status, "Git status")
|
nmap("<Leader>gs", builtin.git_status, "Git status")
|
||||||
|
|
||||||
|
telescope.load_extension("fzf")
|
||||||
|
|
|
@ -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.mapleader = " "
|
||||||
-- vim.g.netrw_banner = 0
|
-- vim.g.netrw_banner = 0
|
||||||
vim.g.loaded_netrw = 1
|
vim.g.loaded_netrw = 1
|
||||||
|
|
|
@ -61,3 +61,20 @@ imap("jk", "<Esc>")
|
||||||
vmap("<Leader>p", '"_dP')
|
vmap("<Leader>p", '"_dP')
|
||||||
vmap(">", ">gv")
|
vmap(">", ">gv")
|
||||||
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,
|
||||||
|
}
|
||||||
|
|
|
@ -25,9 +25,10 @@ require "paq" {
|
||||||
"nvim-lualine/lualine.nvim",
|
"nvim-lualine/lualine.nvim",
|
||||||
"windwp/nvim-autopairs",
|
"windwp/nvim-autopairs",
|
||||||
"mickael-menu/zk-nvim",
|
"mickael-menu/zk-nvim",
|
||||||
{ "nvim-telescope/telescope.nvim", branch = "0.1.x" },
|
{ "nvim-telescope/telescope.nvim", branch = "0.1.x" },
|
||||||
{ "catppuccin/nvim", as = "catppuccin" },
|
{ "nvim-telescope/telescope-fzf-native.nvim", run = "make" },
|
||||||
{ "williamboman/mason.nvim", branch = "v1.0.1" },
|
{ "catppuccin/nvim", as = "catppuccin" },
|
||||||
|
{ "williamboman/mason.nvim", branch = "v1.0.1" },
|
||||||
"stevearc/oil.nvim",
|
"stevearc/oil.nvim",
|
||||||
|
|
||||||
-- Treesitter
|
-- Treesitter
|
||||||
|
@ -45,5 +46,4 @@ require "paq" {
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
"nvim-lua/lsp-status.nvim",
|
"nvim-lua/lsp-status.nvim",
|
||||||
"onsails/lspkind.nvim",
|
"onsails/lspkind.nvim",
|
||||||
"mfussenegger/nvim-lint",
|
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue