all repos — dotfiles @ 571243a787640c266f6d9afd387263346f4976f4

linux dotfiles

nvim: add telescope
Prithu Goswami pg@prithu.dev
Fri, 09 Sep 2022 21:02:14 +0530
commit

571243a787640c266f6d9afd387263346f4976f4

parent

3bcdff0911bb536363df0b0e6921e0286352f740

M config/nvim/init.luaconfig/nvim/init.lua

@@ -40,3 +40,45 @@ }

} }, }) + +require('telescope').setup { + defaults = { + mappings = { + i = { + ['<Esc>'] = require('telescope.actions').close, + ['<C-j>'] = require('telescope.actions').move_selection_next, + ['<C-k>'] = require('telescope.actions').move_selection_previous, + } + }, + }, + pickers = { + find_files = { + previewer = false, + layout_config = { + width = {0.5, max=80, min=60} + } + }, + buffers = { + previewer = false, + layout_config = { + width = {0.5, max=80, min=60} + } + }, + }, + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, + override_file_sorter = true, + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- the default case_mode is "smart_case" + } + } +} +require('telescope').load_extension('fzf') + +-- TODO move to seperate autocmd file +vim.cmd ([[ + autocmd FileType html,javascript,lua,typescript,yaml setlocal ts=2 sts=2 sw=2 + autocmd BufRead *jsx setlocal sw=2 +]])
M config/nvim/lua/keymaps.luaconfig/nvim/lua/keymaps.lua

@@ -38,6 +38,15 @@ -- stay in visual mode while indenting

k('v', '>', '>gv', options) k('v', '<', '<gv', options) +-- telescope +k('n', '<C-_>', ':Telescope find_files<CR>', options) +k('n', '<leader>f', ':Telescope live_grep<CR>', options) +k('n', '<C-b>', ':Telescope buffers<CR>', options) +k('n', '<leader>h', ':Telescope help_tags<CR>', options) + k('n', '<leader>m', ':nohlsearch<CR>', options) k('n', '<leader>z', '<C-W>_', options) k('n', '<leader>r', ':so ~/.config/nvim/init.lua<CR>', options) + +-- fugitive +k('n', '<leader>g', ':G<CR>', options)
M config/nvim/lua/options.luaconfig/nvim/lua/options.lua

@@ -16,12 +16,9 @@ vim.opt.foldlevelstart = 10

vim.opt.foldnestmax = 10 vim.opt.number = true vim.opt.backspace = 'indent,eol,start' -vim.opt.iskeyword:append "-" -- treat hyphen a part of a word and not a boundary vim.opt.termguicolors = true vim.cmd('colorscheme base16-classic-dark') vim.g.winresizer_vert_resize = 4 vim.g.winresizer_horiz_resize = 2 - -
M config/nvim/lua/plugins.luaconfig/nvim/lua/plugins.lua

@@ -43,4 +43,11 @@ requires = {

'kyazdani42/nvim-web-devicons', } } + + use 'nvim-lua/plenary.nvim' + use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } + use { + 'nvim-telescope/telescope.nvim', tag = '0.1.0', + requires = { {'nvim-lua/plenary.nvim'} } + } end)