refinement of LSP options and vim packages for TS/JS development
This commit is contained in:
parent
0002f2e51e
commit
f9cdfb390f
3 changed files with 99 additions and 24 deletions
41
nix/home.nix
41
nix/home.nix
|
|
@ -38,6 +38,15 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
vim-catppuccino = pkgs.vimUtils.buildVimPlugin {
|
||||||
|
name = "vim-catppuccino";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "Pocco81";
|
||||||
|
repo = "Catppuccino.nvim";
|
||||||
|
rev = "014d8575acdd19ecef4ecb12fc82a2e21794b548";
|
||||||
|
sha256 = "0i0p21jkrx99n3dnm5xvnw8n963c67l4lgl4iwngz0psdzwxphkw";
|
||||||
|
};
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
|
|
@ -127,7 +136,7 @@ in
|
||||||
plugins = with pkgs.vimPlugins; [
|
plugins = with pkgs.vimPlugins; [
|
||||||
vim-sensible
|
vim-sensible
|
||||||
vim-startify
|
vim-startify
|
||||||
papercolor-theme
|
vim-catppuccino
|
||||||
|
|
||||||
vim-elixir
|
vim-elixir
|
||||||
alchemist-vim
|
alchemist-vim
|
||||||
|
|
@ -150,7 +159,13 @@ in
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
vim-signify
|
vim-signify
|
||||||
vim-indent-guides
|
{
|
||||||
|
plugin = vim-indent-guides;
|
||||||
|
config = ''
|
||||||
|
let g:indent_guides_enable_on_vim_startup = 1
|
||||||
|
let g:indent_guides_start_level = 2
|
||||||
|
'';
|
||||||
|
}
|
||||||
vim-surround
|
vim-surround
|
||||||
fugitive
|
fugitive
|
||||||
{
|
{
|
||||||
|
|
@ -165,19 +180,6 @@ in
|
||||||
}
|
}
|
||||||
vinegar
|
vinegar
|
||||||
undotree
|
undotree
|
||||||
{
|
|
||||||
plugin = vim-test;
|
|
||||||
config = ''
|
|
||||||
nmap <silent> <leader>t :TestNearest<CR>
|
|
||||||
nmap <silent> <leader>T :TestFile<CR>
|
|
||||||
nmap <silent> <leader>a :TestSuite<CR>
|
|
||||||
nmap <silent> <leader>l :TestLast<CR>
|
|
||||||
nmap <silent> <leader>g :TestVisit<CR>
|
|
||||||
let test#strategy = "neovim"
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
fzf-vim
|
|
||||||
fzfWrapper
|
|
||||||
{
|
{
|
||||||
plugin = nvim-compe;
|
plugin = nvim-compe;
|
||||||
config = ''
|
config = ''
|
||||||
|
|
@ -226,6 +228,15 @@ in
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
plugin = telescope-nvim;
|
||||||
|
config = ''
|
||||||
|
nnoremap <leader>ff <cmd>lua require('telescope.builtin').find_files()<cr>
|
||||||
|
nnoremap <leader>fg <cmd>lua require('telescope.builtin').live_grep()<cr>
|
||||||
|
nnoremap <leader>fb <cmd>lua require('telescope.builtin').buffers()<cr>
|
||||||
|
nnoremap <leader>fh <cmd>lua require('telescope.builtin').help_tags()<cr>
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
extraConfig = readFile ./vim/init.vim;
|
extraConfig = readFile ./vim/init.vim;
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,16 @@
|
||||||
filetype plugin indent on
|
filetype plugin indent on
|
||||||
|
|
||||||
nnoremap <leader>t :call LanguageClient_textDocument_hover()<CR>
|
|
||||||
nnoremap <leader>y :call LanguageClient_textDocument_definition()<CR>
|
|
||||||
|
|
||||||
" Indent guides
|
" Indent guides
|
||||||
let g:indent_guides_enable_on_vim_startup = 1
|
|
||||||
let g:indent_guides_start_level = 2
|
|
||||||
|
|
||||||
" let netrw look like NERDTree
|
" let netrw look like NERDTree
|
||||||
let g:netrw_liststyle = 3
|
let g:netrw_liststyle = 3
|
||||||
let mapleader=","
|
|
||||||
set nobackup
|
set nobackup
|
||||||
set noswapfile
|
set noswapfile
|
||||||
set pastetoggle=<F2>
|
set pastetoggle=<F2>
|
||||||
set nowrap
|
set nowrap
|
||||||
|
|
||||||
set background=dark
|
set background=dark
|
||||||
colorscheme PaperColor
|
colorscheme catppuccino
|
||||||
|
|
||||||
set nocompatible
|
set nocompatible
|
||||||
set number relativenumber
|
set number relativenumber
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,77 @@ local on_attach = function(client, bufnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
nvim_lsp.diagnosticls.setup {
|
nvim_lsp.diagnosticls.setup {
|
||||||
on_attach = on_attach
|
on_attach = on_attach;
|
||||||
|
filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact', 'css', 'scss', 'markdown', 'pandoc' },
|
||||||
|
init_options = {
|
||||||
|
linters = {
|
||||||
|
eslint = {
|
||||||
|
command = 'eslint',
|
||||||
|
rootPatterns = { '.git' },
|
||||||
|
debounce = 100,
|
||||||
|
args = { '--stdin', '--stdin-filename', '%filepath', '--format', 'json' },
|
||||||
|
sourceName = 'eslint',
|
||||||
|
parseJson = {
|
||||||
|
errorsRoot = '[0].messages',
|
||||||
|
line = 'line',
|
||||||
|
column = 'column',
|
||||||
|
endLine = 'endLine',
|
||||||
|
endColumn = 'endColumn',
|
||||||
|
message = '[eslint] ${message} [${ruleId}]',
|
||||||
|
security = 'severity'
|
||||||
|
},
|
||||||
|
securities = {
|
||||||
|
[2] = 'error',
|
||||||
|
[1] = 'warning'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
markdownlint = {
|
||||||
|
command = 'markdownlint',
|
||||||
|
rootPatterns = { '.git' },
|
||||||
|
isStderr = true,
|
||||||
|
debounce = 100,
|
||||||
|
args = { '--stdin' },
|
||||||
|
offsetLine = 0,
|
||||||
|
offsetColumn = 0,
|
||||||
|
sourceName = 'markdownlint',
|
||||||
|
securities = {
|
||||||
|
undefined = 'hint'
|
||||||
|
},
|
||||||
|
formatLines = 1,
|
||||||
|
formatPattern = {
|
||||||
|
'^.*:(\\d+)\\s+(.*)$',
|
||||||
|
{
|
||||||
|
line = 1,
|
||||||
|
column = -1,
|
||||||
|
message = 2,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
filetypes = {
|
||||||
|
javascript = 'eslint',
|
||||||
|
javascriptreact = 'eslint',
|
||||||
|
typescript = 'eslint',
|
||||||
|
typescriptreact = 'eslint',
|
||||||
|
markdown = 'markdownlint',
|
||||||
|
pandoc = 'markdownlint'
|
||||||
|
},
|
||||||
|
formatters = {
|
||||||
|
prettier = {
|
||||||
|
command = 'prettier',
|
||||||
|
args = { '--stdin-filepath', '%filename' }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
formatFiletypes = {
|
||||||
|
css = 'prettier',
|
||||||
|
javascript = 'prettier',
|
||||||
|
javascriptreact = 'prettier',
|
||||||
|
json = 'prettier',
|
||||||
|
scss = 'prettier',
|
||||||
|
typescript = 'prettier',
|
||||||
|
typescriptreact = 'prettier'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nvim_lsp.elmls.setup{
|
nvim_lsp.elmls.setup{
|
||||||
|
|
@ -61,7 +131,7 @@ nvim_lsp.elmls.setup{
|
||||||
}
|
}
|
||||||
nvim_lsp.tsserver.setup {
|
nvim_lsp.tsserver.setup {
|
||||||
on_attach = function(client)
|
on_attach = function(client)
|
||||||
-- Avoid conflict with prettier
|
-- Avoid conflict with prettier and eslint
|
||||||
client.resolved_capabilities.document_formatting = false
|
client.resolved_capabilities.document_formatting = false
|
||||||
on_attach(client)
|
on_attach(client)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue