Browse Source

Use telescope

master
Marcel Schneider 3 years ago
parent
commit
35b1ef4941
No known key found for this signature in database GPG Key ID: 86027C59718EEE88
  1. 73
      init.vim

73
init.vim

@ -34,11 +34,13 @@ Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " We recommend upda
Plug 'nvim-treesitter/nvim-treesitter-textobjects'
Plug 'kyazdani42/nvim-web-devicons' " Icons...
Plug 'mfussenegger/nvim-dap', { 'for': ['typescript', 'javascript', 'python', 'rust'] }
Plug 'lbrayner/vim-rzip' " recursive zip support, needed for yarn pnp
" telescope. Needed for octo.nvim, might replace fzf
Plug 'nvim-lua/popup.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' } " improve sort performance
Plug 'pwntester/octo.nvim'
" {{{ CocPlugins
@ -135,6 +137,7 @@ set number " line numbers
set autoread " reload file automatically
set colorcolumn=100 " highlight column 99
set textwidth=99
set smartcase "use smart case like in ripgrep (case insensitive until capital letters are used)
set history=1000
set wildignore+=node_modules " ignore node_modules folder from file search
@ -189,8 +192,12 @@ au BufReadPost *.mips set syntax=mips
let g:tex_flavor = "latex"
" use python 3 when in doubt
let g:python3_host_prog="/home/schneider/.pyenv/versions/neovim3/bin/python"
set pyxversion=3
" nodejs settings
"let g:node_host_prog="/usr/bin/node"
" Disable ALEs LSP, as we're using coc
let g:ale_disable_lsp = 1
" }}}
@ -201,10 +208,17 @@ let mapleader = ","
nnoremap <leader><C-p> :CtrlPTag<cr>
" fzf bindings
nmap <C-p> :Files<CR>
"nmap <C-p> :Files<CR>
nmap <leader><C-p> :Tags<CR>
nmap <leader>/ :Rg<CR>
nmap <leader>b :Buffers<CR>
"nmap <leader>b :Buffers<CR>
" Telescope Bindings
nmap <C-p> :lua require("telescope.builtin").find_files({find_command={"fd","--type=f","-H", "-E=.git", "-E=.yalc", "-E=node_modules"}})<CR>
"nmap <C-p> :Telescope fd<CR>
nmap <leader>b :lua require('telescope.builtin').buffers({ sort_mru = true, ignore_current_buffer = true })<CR>
nmap <leader>/ :Telescope live_grep<CR>
" Toggle NERDTree
nmap <silent> <leader>k :NERDTreeToggle<cr>
@ -228,6 +242,37 @@ nnoremap <F3> :Git<cr>
nnoremap <F4> :Git push<cr>
"}}}
" {{{ Textobjects
lua <<EOF
require'nvim-treesitter.configs'.setup {
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
-- Or you can define your own textobjects like this
["iF"] = {
python = "(function_definition) @function",
cpp = "(function_definition) @function",
c = "(function_definition) @function",
java = "(method_declaration) @function",
},
},
},
},
}
EOF
" }}}
" P L U G I N S{{{
let g:languagetool_server="/opt/LanguageTool/LanguageTool-5.0/languagetool-server.jar"
let g:languagetool_jar="/opt/LanguageTool/LanguageTool-5.0/languagetool-commandline.jar"
@ -246,7 +291,7 @@ let g:nv_default_extension = '.md'
let g:nv_main_directory = '~/notes'
" Octo.nvim
lua require('octo')
"lua require('octo')
" ALE {{{
let g:airline#extensions#ale#enabled = 1
@ -427,4 +472,26 @@ require'nvim-treesitter.configs'.setup {
EOF
" }}}
" Telescope {{{
lua <<EOF
-- You dont need to set any of these options. These are the default ones. Only
-- the loading is important
require('telescope').setup {
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case"
}
}
}
-- To get fzf loaded and working with telescope, you need to call
-- load_extension, somewhere after setup function:
require('telescope').load_extension('fzf')
EOF
"}}}
"}}}
Loading…
Cancel
Save