Add efm to nvim, update vscode, zsh

This commit is contained in:
Smirnov Alexander 2021-06-21 19:44:12 +03:00
parent 093639a28a
commit fef35c3ef0
21 changed files with 169 additions and 129 deletions

View file

@ -1,5 +1,8 @@
<h1 align="center">dotfiles</h1>
[](screen.png)
--------------
### System configuration
- `OS` Arch
- `WM` bspwm

BIN
config/bspwm/screen.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 KiB

View file

@ -5,20 +5,20 @@
yay -S neovim-nightly-bin
```
## Install plugin manager(`vim-plug`)
## Install plugin manager(`packer`)
```bash
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
git clone https://github.com/wbthomason/packer.nvim\
~/.local/share/nvim/site/pack/packer/start/packer.nvim
```
## Install LSP servers
```bash
# tsserver(JS/TS)
npm i -g typescript typescript-language-server
# Go(gopls)
go get golang.org/x/tools/gopls@latest
# Python(pyls)
pip install python-language-server
# JS/TS
nvim +"LspInstall typescript"
```

View file

@ -1,33 +1,55 @@
call plug#begin('~/.vim/plugged')
Plug 'Smirnov-O/nten.vim'
Plug 'b3nj5m1n/kommentary'
" Plug 'mattn/emmet-vim', {'on': 'EmmetInstall'}
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-lua/popup.nvim'
" Plug 'editorconfig/editorconfig-vim'
Plug 'norcalli/nvim-colorizer.lua'
Plug 'kyazdani42/nvim-web-devicons'
" Status line && Tab line
Plug 'kyazdani42/nvim-tree.lua', {'on': 'NvimTreeToggle'}
Plug 'junegunn/fzf.vim', {'on': ['Files', 'GFiles']}
" Appereance
Plug 'Smirnov-O/nten.vim'
Plug 'hoob3rt/lualine.nvim'
Plug 'romgrk/barbar.nvim'
" LSP && Completion
" LSP
Plug 'neovim/nvim-lspconfig'
Plug 'kabouzeid/nvim-lspinstall'
Plug 'hrsh7th/nvim-compe'
Plug 'jiangmiao/auto-pairs'
" Git
Plug 'TimUntersberger/neogit'
Plug 'lewis6991/gitsigns.nvim'
" File explorer
Plug 'kyazdani42/nvim-tree.lua'
Plug 'nvim-telescope/telescope.nvim'
" Better syntax hl
" Syntax
Plug 'sheerun/vim-polyglot'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
" Plug 'mattn/emmet-vim', {'on': 'EmmetInstall'}
" Plug 'norcalli/nvim-colorizer.lua'
call plug#end()
colo codedark
let mapleader=";"
set termguicolors
"== Config
set termguicolors " GUI colors
set nu rnu nocul " Line numbers & cursor line highlight
set nolbr nowrap " Line wrap
set mouse=a mh " Mouse
set history=500 " Set history size
set autoread " Auto read file on change
set hidden " Change buffet without warning
set visualbell t_vb= " Disable sounds
set pumheight=8 " Maximum items in pop up
set modeline " Enable modeline
set nosmd " Disable show mode
set nobk noswf noudf " Swap files
set is ic scs " Search
set spr " Split
set enc=utf-8 fenc=utf-8 " Encoding
set scrolloff=3 " Scroll padding
set list listchars=tab:\|·,trail:~,space
set completeopt=menuone,noselect
"== Netrw file tree
let g:netrw_liststyle = 3
let g:netrw_banner = 0
let g:netrw_dirhistmax = 0
"== Tab(or spaces)
set ts=4 sw=4 sts=4
@ -36,14 +58,20 @@ set sta et ai
"== Custom commands
com! Prettier :sil !prettier -w %
com! Term :vs|winc L|se nonu nornu|start|term
com! Notes :Files ~/notes
com! GoFmt :sil !gofmt -w %
com! Black :sil !black %
"== Configs
luafile $HOME/.config/nvim/lua/plugins.lua
source $HOME/.config/nvim/vimscript/config.vim
source $HOME/.config/nvim/vimscript/barbar.vim
source $HOME/.config/nvim/vimscript/emmet.vim
source $HOME/.config/nvim/vimscript/compe.vim
source $HOME/.config/nvim/vimscript/filetypes.vim
source $HOME/.config/nvim/vimscript/mappings.vim
"== Emmet
" let g:user_emmet_mode = 'i'
" let g:user_emmet_expandabbr_key ='<c-j>'
" au FileType html,jst,pug,vue,css,less,scss :EmmetInstall
"== Filetypes
au FileType go setl noet
au FileType javascript,yaml,json setl et ts=2 sw=2 sts=4
au FileType python setl et ts=4 sw=4 sts=4 ai
"== Config's
lua require'config'
so $HOME/.config/nvim/vimscript/barbar.vim
so $HOME/.config/nvim/vimscript/mappings.vim

View file

@ -0,0 +1,41 @@
-- LSP servers
require'lspinstall'.setup {}
require'lspconfig'.gopls.setup {} -- Go
require'lspconfig'.pyls.setup {} -- Python
require'lspconfig'.lua.setup {} -- Lua
require'tsserver' -- JS/TS
require'efm' -- Linter's
-- Compe
require'compe'.setup {
enabled = true,
autocomplete = true,
source = {
-- path = true,
buffer = true,
nvim_lsp = true,
};
}
-- LuaLine
require'lualine'.setup {options={
theme = "codedark"
}}
-- GitSigns
require'plug.gitsigns'
-- NeoGit
require'neogit'.setup {}
-- NvimTree
require'plug.nvimtree'
-- TreeSitter
require'nvim-treesitter.configs'.setup {
ensure_installed = {'javascript', 'typescript', 'jsdoc', 'python', 'go'};
highlight = {enable=true};
}
-- Colorizer
-- require'plug.colorizer'

45
config/nvim/lua/efm.lua Normal file
View file

@ -0,0 +1,45 @@
-- Python
local black = {
formatCommand = "black ${filename}", formatStdin = true
}
local flake8 = {
lintCommand = "flake8 --ignore=E501 --stdin-display-name ${INPUT} -",
lintStdin = true,
lintFormats = {"%f:%l:%c: %m"}
}
-- Javascript
local prettier = {
formatCommand = "prettier --stdin-filepath ${INPUT}", formatStdin = true
}
local eslint = {
lintCommand = "./node_modules/.bin/eslint -f unix --stdin --stdin-filename ${INPUT}",
lintIgnoreExitCode = true,
lintStdin = true,
lintFormats = {"%f:%l:%c: %m"},
formatCommand = "./node_modules/.bin/eslint --fix-to-stdout --stdin --stdin-filename=${INPUT}",
formatStdin = true
}
-- GoLang
local golint = {
lintCommand = "golint",
lintIgnoreExitCode = true,
lintFormats = {"%f:%l:%c: %m"},
lintSource = "golint"
}
-- Setup
require"lspconfig".efm.setup {
init_options = {documentFormatting = true, codeAction = false},
filetypes = {"python", "javascript", "typescript", "go"},
settings = {
rootMarkers = {".git/"},
languages = {
python = {flake8, black},
javascript = {eslint, prettier},
typescript = {eslint, prettier},
go = {golint}
}
}
}

View file

@ -1,9 +0,0 @@
require'compe'.setup {
enabled = true,
autocomplete = true,
source = {
path = true,
buffer = true,
nvim_lsp = true,
};
}

View file

@ -1,3 +0,0 @@
require'lspconfig'.tsserver.setup {}
require'lspconfig'.gopls.setup {}
require'lspconfig'.pyls.setup {}

View file

@ -1,5 +0,0 @@
require'lualine'.setup {
options = {
theme = "codedark"
};
}

View file

@ -1 +0,0 @@
require'neogit'.setup {}

View file

@ -1,13 +0,0 @@
local actions = require('telescope.actions')
require('telescope').setup{
defaults = {
prompt_prefix = "Search > ",
selection_caret = " ",
entry_prefix = " ",
file_ignore_patterns = {"node_modules", "env", ".cache"},
mappings = {
i = {["<esc>"] = actions.close}
};
};
}

View file

@ -1,5 +0,0 @@
require'nvim-treesitter.configs'.setup {
ensure_installed = {'javascript', 'typescript', 'python', 'go'};
highlight = { enable = true };
indent = { enable = true };
}

View file

@ -1,9 +0,0 @@
require'plug.compe'
require'plug.lspconfig'
require'plug.nvimtree'
require'plug.lualine'
require'plug.gitsigns'
require'plug.neogit'
require'plug.treesitter'
require'plug.telescope'
require'plug.colorizer'

View file

@ -1,6 +1,7 @@
" Settings
let bufferline = get(g:, 'bufferline', {})
let bufferline.icon_close_tab = '🗴'
let bufferline.icons = v:false
" Mappings
nno <A-1> :BufferGoto 1<cr>

View file

@ -1,11 +0,0 @@
" Settings
set completeopt=menuone,noselect
" Mappings
ino <expr> <tab> pumvisible() ? "\<C-n>" : "\<tab>"
ino <expr> <s-tab> pumvisible() ? "\<C-p>" : "\<tab>"
ino <expr> <cr> compe#confirm('<CR>')
nno sr :lua vim.lsp.buf.rename()<cr>
nno sh :lua vim.lsp.buf.hover()<cr>
nno si :lua vim.lsp.buf.definition()<cr>
nno sa :lua vim.lsp.buf.code_action()<cr>

View file

@ -1,23 +0,0 @@
"== Vim config
set termguicolors " GUI colors
set nu rnu nocul " Line numbers & cursor line highlight
set nolbr nowrap " Line wrap
set mouse=a mh " Mouse
set history=500 " Set history size
set autoread " Auto read file on change
set hidden " Change buffet without warning
set visualbell t_vb= " Disable sounds
set pumheight=8 " Maximum items in pop up
set modeline " Enable modeline
set nosmd " Disable show mode
set nobk noswf noudf " Swap files
set is ic scs " Search
set spr " Split
set enc=utf-8 fenc=utf-8 " Encoding
set scrolloff=3
set list listchars=tab:\|·,trail:~,space
"== Netrw file tree
let g:netrw_liststyle = 3
let g:netrw_banner = 0
let g:netrw_dirhistmax = 0

View file

@ -1,9 +0,0 @@
"== Config
let g:user_emmet_mode = "i"
let g:user_emmet_expandabbr_key ='<c-j>'
let g:user_emmet_leader = ","
let g:user_emmet_settings = {
\ 'javascript': {'extends': 'jsx'}}
"== Load
au FileType html,jst,pug,vue,css,less,scss :EmmetInstall

View file

@ -1,3 +0,0 @@
au FileType python,elm setl sw=4 ts=4 sts=2
au FileType go setl noet sw=4 ts=4 sts=2
au FileType javascript,html,jst,pug,css,less,scss,json,yaml,lua,vim setl sw=2 ts=2 sts=2

View file

@ -1,15 +1,28 @@
nno <C-s> :w<cr>
nno <C-p> :GFiles<cr>
nno <space> :noh<cr>
nno <leader>t :Term<cr>
nno <leader>e :NvimTreeToggle<cr>
nno <leader>; :Telescope fd<cr>
nno <leader>: :Telescope git_files<cr>
nno <leader>g :Neogit<cr>
nno <leader>; :Files<cr>
nno <leader>d :Neogit<cr>
" Buffer
nno <leader>j :bn<cr>
nno <leader>k :bp<cr>
" Compe
ino <expr> <tab> pumvisible() ? "\<C-n>" : "\<tab>"
ino <expr> <s-tab> pumvisible() ? "\<C-p>" : "\<tab>"
ino <expr> <cr> compe#confirm('<CR>')
ino <expr> <c-space> compe#complete()
nno sr :lua vim.lsp.buf.rename()<cr>
nno sh :lua vim.lsp.buf.hover()<cr>
nno sd :lua vim.lsp.buf.definition()<cr>
nno sa :lua vim.lsp.buf.code_action()<cr>
nno si :lua vim.lsp.buf.implementation()<cr>
nno sf :lua vim.lsp.buf.formatting()
nno sR :lua vim.lsp.buf.references()<CR>
" Split
nno <C-h> :winc h<cr>
nno <C-j> :winc j<cr>

View file

@ -46,9 +46,10 @@
"**/node_modules": true
},
"emmet.includeLanguages": {"javascript": "javascriptreact"},
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
"editor.tabSize": 2
}
}

7
zshrc
View file

@ -6,15 +6,14 @@ export GOPATH="$HOME/go"
export PATH="$HOME/bin:$HOME/.local/bin:$HOME/.golang/bin:$GOPATH/bin:$PATH"
export EDITOR="nvim"
## FzF
export FZF_DEFAULT_COMMAND="fd -t f -t l -E node_modules -E env -E __pycache__"
## Oh my zsh
plugins=(dotenv)
ZSH_THEME="simple"
source "$HOME/.oh-my-zsh/oh-my-zsh.sh"
## HotKets
bindkey -s "^o" "ranger\n"
bindkey -s "^g" "lazygit\n"
## FNM
eval $(fnm env)