-
Notifications
You must be signed in to change notification settings - Fork 1
/
maps.lua
81 lines (74 loc) · 3.42 KB
/
maps.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
local keymap = vim.keymap
local opts = { noremap = true, silent = true }
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
keymap.set('n', '<Leader>o',
'<cmd>TypescriptOrganizeImports<cr> <cmd>TypescriptRemoveUnused<cr>',
opts)
keymap.set('n', '<Leader>p', ' <cmd>Prettier <cr>', opts)
keymap.set('n', '<Leader>w', ' <cmd>w<CR>', opts)
keymap.set('n', '<Leader>W', ' <cmd>wa<CR>', opts)
keymap.set('n', '<Leader>q', ' <cmd>q<CR>', opts)
keymap.set('n', '<Leader>Q', ' <cmd>qa!<CR>', opts)
keymap.set('n', 's', ' <Plug>(easymotion-s2)', opts)
keymap.set('n', '<leader>rl', '<cmd>edit!<cr>')
keymap.set('n', ';dd', ' <cmd>bd <cr>', opts)
keymap.set('n', 'gd', ' <cmd>Lspsaga goto_definition<cr> ')
keymap.set('n', '<leader>gt', ' <cmd>Lspsaga term_toggle<cr> ')
keymap.set('n', 'gp', ' <cmd>Lspsaga peek_definition<cr>')
keymap.set('n', 'ge', ' <cmd>Lspsaga show_line_diagnostics<cr>')
keymap.set({ "n", "v" }, "<leader>ca", "<cmd>Lspsaga code_action<CR>")
keymap.set({ "n" }, "K", "<cmd>Lspsaga hover_doc<CR>")
keymap.set("n", "rn", "<cmd>Lspsaga rename ++project<CR>")
keymap.set('n', 'ee', '<cmd>Startify <cr>', opts)
keymap.set('n', 'gr', vim.lsp.buf.references, opts)
keymap.set('n', '<leader>di', '<cmd>Telescope diagnostics initial_mode=normal prompt_prefix=🔍<cr>', opts)
keymap.set('n', '<leader>:', '<cmd>Telescope commands prompt_prefix=🔍 initial_mode=normal<cr> ', opts)
keymap.set('n', '<leader>n',
'<cmd>Telescope file_browser path=%:p:h select_buffer=true initial_mode=normal prompt_prefix=🔍<cr>', opts)
keymap.set('n', '<Leader>t', '<cmd>tabnew<cr>', opts)
keymap.set('n', '<Leader>s', '<cmd>vsplit<cr>', opts)
keymap.set('n', '<Leader>i', '<cmd>split<cr>', opts)
keymap.set('n', '<leader>ll', '<cmd>CocCommand explorer --position right<cr>', opts)
keymap.set('n', '<leader>gb', '<cmd>Git blame<cr>', opts)
-- fire database connections
keymap.set('n', '<leader>db', '<cmd>DBUI<cr>', opts)
-- Telescope
keymap.set('n', '<leader>gf', '<cmd>Telescope find_files find_command=rg,--ignore,--hidden,--files prompt_prefix=🔍 <cr>',
opts)
keymap.set('n', '<leader>fg', '<cmd>Telescope live_grep prompt_prefix=🔍 <cr>', opts)
keymap.set('n', '<leader>b', '<cmd>Telescope buffers initial_mode=normal prompt_prefix=🔍 <cr>', opts)
keymap.set('n', '<leader>fh', '<cmd>Telescope help_tags prompt_prefix=🔍 <cr>', opts)
keymap.set('n', '<leader>gc', '<cmd>Telescope git_commits prompt_prefix=🔍 <cr>', opts)
-- vimscript
vim.cmd([[
let mapleader=" "
imap <Esc> <C-c>
nnoremap tg gT
nnoremap <Leader>w :w<CR>
nnoremap <Leader>q :q<CR>
" autocmd BufWritePre *.go :silent call CocAction('runCommand', 'editor.action.organizeImport')
" command! -nargs=0 OR :silent call CocAction('runCommand', 'editor.action.organizeImport')
nnoremap <Leader>, $a,<Esc>
nnoremap <Leader>; $a;<Esc>
nnoremap ;dd :bd<cr>
nnoremap ;da :%bd <bar> e#<cr>
" copy on clipboard filename
nnoremap <Leader>yf :let @+ = expand("%:t")<cr>
" copy on clipboard fullpath and filename
nnoremap <Leader>yp :let @+ = expand("%")<cr>
" copy on line on clipboard
nnoremap <Leader>Y "+y<CR>
let g:netrw_liststyle = 3
" autoclose-tag
let g:closetag_filenames = '*.html,*.xhtml,*.phtml,*.jsx,*.js,*.tsx'
let g:closetag_xhtml_filenames = '*.xhtml,*.tsx'
let g:closetag_regions = {
\ 'typescript.tsx': 'jsxRegion,tsxRegion',
\ 'javascript.jsx': 'jsxRegion',
\ }
" nnoremap <leader>o <CR>require<cr> :TypescriptOrganizeImports<cr> <CR>
" dart
let g:dart_html_in_string = v:true
let g:lsc_auto_map = v:true
]])