nvim/vim: parity

- add fzf to vim
- update looks of telescope
This commit is contained in:
Marco Thomas
2023-03-06 23:27:31 +01:00
parent b78405d1bd
commit aee29e8ca3
3 changed files with 25 additions and 9 deletions

View File

@@ -24,14 +24,15 @@ telescope.setup({
} }
} }
}) })
map("n", "<C-f>", "<cmd> Telescope git_files <CR>", default_opts) map("n", "<C-g>", "<cmd> Telescope git_files <CR>", default_opts)
map("n", "<C-f>", "<cmd> Telescope find_files find_command=rg,--ignore,--hidden,--files<CR>", default_opts)
map("n", "<C-s>", "<cmd> Telescope live_grep<CR>", default_opts) map("n", "<C-s>", "<cmd> Telescope live_grep<CR>", default_opts)
map("n", "<C-k>", "<cmd> Telescope keymaps<CR>", default_opts) map("n", "<C-k>", "<cmd> Telescope keymaps<CR>", default_opts)
-- LSP -- LSP
map("n", "<leader>la", "<cmd> lua vim.lsp.buf.code_action()<CR>", default_opts) map("n", "<leader>la", "<cmd> lua vim.lsp.buf.code_action()<CR>", default_opts)
map("n", "<leader>ld", "<cmd> Telescope lsp_definitions<CR>", default_opts) map("n", "<leader>ld", "<cmd> Telescope lsp_definitions<CR>", default_opts)
map("n", "<leader>le", "<cmd> Telescope diagnostics<CR>", default_opts) map("n", "<leader>le", "<cmd> Telescope diagnostics previewer=false<CR>", default_opts)
map("n", "<leader>lf", "<cmd> lua vim.lsp.buf.format {async = true }<CR>", default_opts) map("n", "<leader>lf", "<cmd> lua vim.lsp.buf.format {async = true }<CR>", default_opts)
map("n", "<leader>lh", "<cmd> lua vim.lsp.buf.hover()<CR>", default_opts) map("n", "<leader>lh", "<cmd> lua vim.lsp.buf.hover()<CR>", default_opts)
map("i", "<C-h>", "<cmd> lua vim.lsp.buf.signature_help()<CR>", default_opts) map("i", "<C-h>", "<cmd> lua vim.lsp.buf.signature_help()<CR>", default_opts)
@@ -119,3 +120,4 @@ cmp.setup({
-- nvim-tree -- nvim-tree
map("n", "<leader>tt", "<cmd> NvimTreeToggle<CR>", default_opts) map("n", "<leader>tt", "<cmd> NvimTreeToggle<CR>", default_opts)
map("n", "<leader>tc", "<cmd> NvimTreeCollapse<CR>", default_opts) map("n", "<leader>tc", "<cmd> NvimTreeCollapse<CR>", default_opts)
map("n", "<leader>tr", "<cmd> NvimTreeRefresh<CR>", default_opts)

View File

@@ -3,13 +3,17 @@ require('telescope').setup({
prompt_prefix = "", prompt_prefix = "",
selection_caret = " ", selection_caret = " ",
entry_prefix = " ", entry_prefix = " ",
border = false,
sorting_strategy = "ascending", sorting_strategy = "ascending",
layout_strategy = "vertical", layout_strategy = "bottom_pane",
layout_config = { layout_config = {
vertical = { vertical = {
width = 160, width = 140,
prompt_position = "top", prompt_position = "top",
mirror = true, mirror = true,
},
bottom_pane = {
theme = get_ivy
} }
} }
}, },

View File

@@ -15,9 +15,11 @@ call plug#begin()
Plug 'tpope/vim-sleuth' " heuristic file indendation Plug 'tpope/vim-sleuth' " heuristic file indendation
Plug 'jiangmiao/auto-pairs' " pair completion Plug 'jiangmiao/auto-pairs' " pair completion
Plug 'ctrlpvim/ctrlp.vim' " file finder
Plug 'tpope/vim-fugitive' " git wrapper Plug 'tpope/vim-fugitive' " git wrapper
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'sainnhe/everforest' " color scheme Plug 'sainnhe/everforest' " color scheme
Plug 'vim-airline/vim-airline' " a nicer status line Plug 'vim-airline/vim-airline' " a nicer status line
Plug 'vim-airline/vim-airline-themes' " auto settings theme for airline Plug 'vim-airline/vim-airline-themes' " auto settings theme for airline
@@ -106,13 +108,21 @@ let g:netrw_liststyle = 3 " Tree-like structure
let g:netrw_banner = 0 " Remove useless banner at the top of netrw let g:netrw_banner = 0 " Remove useless banner at the top of netrw
" ============================== Macros and Mappings " ============================== Macros and Mappings
map <C-f> :CtrlP .<CR> " fzf
" C-/ to hide search results map <C-f> :Files<CR>
map <C-_> :noh<CR> map <C-g> :GFiles<CR>
command! -bang -nargs=* GGrep
\ call fzf#vim#grep(
\ 'git grep --line-number -- '.shellescape(<q-args>), 0,
\ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), <bang>0)
map <C-s> :GGrep<CR>
" git " git
map <leader>gs :Git status<CR> map <leader>gs :Git status<CR>
map <leader>gb :Git blame<CR> map <leader>gb :Git blame<CR>
map <C-s> :Git grep
" other
map <C-_> :noh<CR>
fun! TrimWhitespace() fun! TrimWhitespace()
let l:save = winsaveview() let l:save = winsaveview()