all repos — dotfiles @ 09ca729a620f31a368f27b242c459a535989af9c

my *nix dotfiles

config/nvim/lua/maps.lua (view raw)

 1local cmd = vim.cmd
 2local map = vim.api.nvim_set_keymap
 3
 4-- map the leader key
 5map('n', '<Space>', '', {})
 6vim.g.mapleader = ' '
 7
 8
 9options = { noremap = true }
10map('n', '<leader><esc>', ':nohlsearch<cr>', options)
11map('n', '<leader>n', ':bnext<cr>', options)
12map('n', '<leader>p', ':bprev<cr>', options)
13
14-- Not an editor command: Wqa
15cmd(':command! WQ wq')
16cmd(':command! WQ wq')
17cmd(':command! Wq wq')
18cmd(':command! Wqa wqa')
19cmd(':command! W w')
20cmd(':command! Q q')
21
22local function fzy_ignore(patterns)
23  pattern_cmd = {}
24  for _, p in ipairs(patterns) do
25    table.insert(pattern_cmd, string.format("! -path '%s'", p))
26  end
27
28  return table.concat(pattern_cmd, ' ')
29end
30
31--  fzy mappings
32if vim.fn.executable('fzy') then
33  _G.fzy_shell_cmd = require('fzy.shell').fzy_shell_cmd
34  map(
35    '', 
36    '<leader>e', 
37    string.format(
38    ':call v:lua.fzy_shell_cmd("find -L . -type f %s", ":e")<cr>',
39    fzy_ignore{'*.git/*', '*node_modules*', '*.pyc'}
40    ),
41    { noremap=true, silent=true }
42  )
43
44  _G.fzy_buffers = require('fzy.buffers').fzy_buffers
45  map('',
46  '<leader>b',
47  ':call v:lua.fzy_buffers()<cr>',
48  { noremap=true, silent=true }
49  )
50
51  _G.fzy_jmp = require('fzy.jump').fzy_jmp
52  map('',
53  '<leader>f',
54  ':call v:lua.fzy_jmp()<cr>',
55  { noremap=true, silent=true}
56  )
57else
58  print('fzy not in PATH!')
59end