vimrc: Add alias, prefer :up to :w, update diagnostics
This commit is contained in:
parent
9fb1a834d6
commit
d2610e77bd
44
nvimrc
44
nvimrc
|
@ -127,7 +127,7 @@ imap <right> <nop>
|
||||||
nmap ]q :cn<cr>
|
nmap ]q :cn<cr>
|
||||||
nmap [q :cp<cr>
|
nmap [q :cp<cr>
|
||||||
|
|
||||||
nnoremap <silent> <leader>w :w<cr>
|
nnoremap <silent> <leader>w :up<cr>
|
||||||
nnoremap <silent> <leader>/ :nohlsearch<cr>
|
nnoremap <silent> <leader>/ :nohlsearch<cr>
|
||||||
nnoremap <silent> <leader><space> :nohlsearch<cr>
|
nnoremap <silent> <leader><space> :nohlsearch<cr>
|
||||||
" Select just-pasted text:
|
" Select just-pasted text:
|
||||||
|
@ -142,6 +142,9 @@ nnoremap <leader>s :split<cr>
|
||||||
nnoremap <leader>rp "_dd<bar>P
|
nnoremap <leader>rp "_dd<bar>P
|
||||||
nnoremap <leader>dq ggVG"_d:wq<cr>
|
nnoremap <leader>dq ggVG"_d:wq<cr>
|
||||||
|
|
||||||
|
" abbrevs
|
||||||
|
iabbrev esdebug debugger; // eslint-disable-line no-debugger
|
||||||
|
|
||||||
lua <<EOF
|
lua <<EOF
|
||||||
function _G.dump(...)
|
function _G.dump(...)
|
||||||
local objects = vim.tbl_map(vim.inspect, {...})
|
local objects = vim.tbl_map(vim.inspect, {...})
|
||||||
|
@ -455,6 +458,36 @@ packadd! vim-rhubarb " https://github.com/tpope/vim-rhubarb.git
|
||||||
packadd! editorconfig-vim " https://github.com/editorconfig/editorconfig-vim.git
|
packadd! editorconfig-vim " https://github.com/editorconfig/editorconfig-vim.git
|
||||||
packadd! vim-wordmotion " https://github.com/chaoren/vim-wordmotion.git
|
packadd! vim-wordmotion " https://github.com/chaoren/vim-wordmotion.git
|
||||||
|
|
||||||
|
" formatter.nvim
|
||||||
|
packadd! formatter.nvim " https://github.com/mhartington/formatter.nvim.git
|
||||||
|
lua <<EOF
|
||||||
|
local prettier = function()
|
||||||
|
return {
|
||||||
|
-- TODO: figure out how to pass a relative path based on project root to
|
||||||
|
-- formatter.nvim.
|
||||||
|
exe = "/home/rob/dev/clipper/frontend/node_modules/.bin/prettier",
|
||||||
|
args = {"--stdin-filepath", vim.api.nvim_buf_get_name(0), '--single-quote'},
|
||||||
|
stdin = true
|
||||||
|
}
|
||||||
|
end
|
||||||
|
require('formatter').setup({
|
||||||
|
filetype = {
|
||||||
|
javascript = { prettier },
|
||||||
|
typescript = { prettier },
|
||||||
|
typescriptreact = { prettier },
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_exec([[
|
||||||
|
augroup FormatAutogroup
|
||||||
|
autocmd!
|
||||||
|
autocmd BufWritePost *.js,*.ts,*.tsx silent FormatWrite
|
||||||
|
augroup END
|
||||||
|
]], true)
|
||||||
|
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>F', '<Cmd>silent Format<CR>', { noremap=true, silent=true })
|
||||||
|
EOF
|
||||||
|
|
||||||
" enable inline vim highlighting:
|
" enable inline vim highlighting:
|
||||||
let g:vimsyn_embed= 'lPr'
|
let g:vimsyn_embed= 'lPr'
|
||||||
|
|
||||||
|
@ -643,11 +676,16 @@ local filetypes = {
|
||||||
typescript = "eslint",
|
typescript = "eslint",
|
||||||
typescriptreact = "eslint",
|
typescriptreact = "eslint",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- diagnosticls
|
||||||
|
|
||||||
local linters = {
|
local linters = {
|
||||||
eslint = {
|
eslint = {
|
||||||
sourceName = "eslint",
|
sourceName = "eslint",
|
||||||
command = "eslint",
|
-- fallback to global eslint if the local is not found?
|
||||||
rootPatterns = {".eslintrc.js", "package.json"},
|
-- https://github.com/creativenull/diagnosticls-configs-nvim/blob/e7d6f7e99f6b416d2aeee89314bc46fc36df7b22/lua/diagnosticls-configs/fs.lua#L20
|
||||||
|
command = "./node_modules/.bin/eslint",
|
||||||
|
rootPatterns = {".eslintrc", ".eslintrc.js"},
|
||||||
debounce = 100,
|
debounce = 100,
|
||||||
args = {"--stdin", "--stdin-filename", "%filepath", "--format", "json"},
|
args = {"--stdin", "--stdin-filename", "%filepath", "--format", "json"},
|
||||||
parseJson = {
|
parseJson = {
|
||||||
|
|
Loading…
Reference in New Issue