Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vim: telescope #4

Merged
merged 10 commits into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .fdignore → .rgignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
.git
node_modules/
__reports/
releases
.git
package-lock.json
build/
dist/
ci/
build/

package-lock.json
*.png
*.json.gz
4 changes: 2 additions & 2 deletions .zshrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export ZSH=~/.oh-my-zsh
export TERM=xterm-256color
export BAT_THEME="One Dark"
export PATH="$HOME/bin:$PATH"

ZSH_THEME="robbyrussell"

Expand Down Expand Up @@ -36,7 +37,6 @@ alias top='htop'
alias cat='bat'
alias mmount='~/.mmount-sshfs.sh'

alias vi='nvim'
alias vim='nvim'

alias tmux='tmux -2'
Expand All @@ -48,7 +48,7 @@ export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
if [ -f .nvmrc ]; then nvm use; fi # This switches nvm to node version from .nvmrc

export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --ignore-file /home/$(whoami)/self/dotfiles/.fdignore'
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --ignore-file /home/$(whoami)/self/dotfiles/.rdignore'
export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --no-mouse --exact'
export FZF_CTRL_T_OPTS="--preview 'bat --style=numbers --color=always {} | head -200'"

Expand Down
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# dotfiles

## install
- tmux
- zsh
- iterm2
- neovim
- fzf
- the_silver_searcher
- fd-find
- [tmux](https://github.com/tmux/tmux)
- [zsh](https://ohmyz.sh/)
- [iterm2](https://iterm2.com/)
- [neovim](https://neovim.io/)
- [fzf](https://github.com/junegunn/fzf)
- [fd-find](https://github.com/sharkdp/fd)
- [ripgrep](https://github.com/BurntSushi/ripgrep)

## clone
```bash
mkdir ~/self
git clone https://github.com/bercly0b/dotfiles.git ~/self/dotfiles
mkdir ~/self/dotfiles/.vim/plugged
```

## configure
Expand Down
15 changes: 6 additions & 9 deletions lua/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@ Plug('kyazdani42/nvim-tree.lua')
-- gS gJ
Plug('AndrewRadev/splitjoin.vim')

-- search by files
Plug('junegunn/fzf', {
['do'] = function()
vim.fn['fzf#install']()
end
})

Plug('junegunn/fzf.vim')
-- telescope
Plug('nvim-lua/popup.nvim')
Plug('nvim-lua/plenary.nvim')
Plug('nvim-telescope/telescope.nvim')
Plug('nvim-telescope/telescope-fzf-native.nvim', { ['do'] = 'make' })

Plug('wellle/targets.vim')

Expand Down Expand Up @@ -82,6 +79,6 @@ require('plugins/cmp')
require('plugins/luasnip')
require('plugins/lsp')
require('plugins/tree')
require('plugins/fzf')
require('plugins/telescope')
require('plugins/lualine')
require('plugins/treesitter')
7 changes: 4 additions & 3 deletions lua/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ map('n', '<leader><leader>', ':NvimTreeToggle<CR>', default_opts)
map('n', '<leader>r', ':NvimTreeRefresh<CR>', default_opts)
map('n', '<leader>/', ':NvimTreeFindFile<CR>', default_opts)

-- fzf
map('n', '<Leader>a', ':Ag<CR>', default_opts)
map('n', '<Leader>f', ':Files<CR>', default_opts)
-- telescope
map('n', '<Leader>f', ':Telescope find_files<CR>', default_opts)
map('n', '<Leader>a', ':Telescope live_grep<CR>', default_opts)
map('n', '<Leader>w', ':Telescope grep_string<CR>', default_opts)

-- lsp
map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', default_opts)
Expand Down
28 changes: 0 additions & 28 deletions lua/plugins/fzf.lua

This file was deleted.

64 changes: 64 additions & 0 deletions lua/plugins/telescope.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
require('telescope').setup({
defaults = {
preview = {
treesitter = false,
},
mappings = {
i = {
['<C-j>'] = 'move_selection_next',
['<C-k>'] = 'move_selection_previous',
}
},
vimgrep_arguments = {
'rg',
'--color=never',
'--no-heading',
'--no-heading',
'--with-filename',
'--line-number',
'--column',
'--smart-case',
'--trim',
'--ignore-file', vim.fn.expand('~/self/dotfiles/.rgignore'),
},
layout_config = {
horizontal = {
height = 0.5,
prompt_position = 'bottom',
width = 0.7,
},
},
},
pickers = {
buffers = {
theme = 'dropdown',
},
find_files = {
find_command = {
'fd',
'--type', 'file',
'--type', 'symlink',
'--hidden',
'--ignore-file', vim.fn.expand('~/self/dotfiles/.rgignore'),
},
layout_config = {
horizontal = {
width = 0.4,
height = 0.3,
},
},
previewer = false,
prompt_title = false,
},
},
extensions = {
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = 'smart_case',
},
},
})

require('telescope').load_extension('fzf')
2 changes: 1 addition & 1 deletion lua/plugins/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ require('nvim-treesitter.configs').setup({
})

local parser_config = require('nvim-treesitter.parsers').get_parser_configs()
parser_config.tsx.used_by = { 'javascript', 'typescript.tsx' }
parser_config.tsx.filetype_to_parsername = { 'javascript', 'typescript.tsx' }