mirror of
https://github.com/olexsmir/dotfiles.git
synced 2026-01-15 08:41:34 +02:00
convert init.vim in modules, update zsh && git
This commit is contained in:
parent
a4532907b4
commit
eb4f1a5b5a
14 changed files with 170 additions and 73 deletions
9
config/nvim/README.md
Normal file
9
config/nvim/README.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# NVIM
|
||||
|
||||
### Install LSP
|
||||
```bash
|
||||
# tsserver(JS/TS)
|
||||
npm i -g typescript typescript-language-server
|
||||
# Go(gopls)
|
||||
go get golang.org/x/tools/gopls@latest
|
||||
```
|
||||
|
|
@ -1,63 +1,64 @@
|
|||
call plug#begin('~/.vim/plugged')
|
||||
Plug 'sheerun/vim-polyglot'
|
||||
" LSP && Completion
|
||||
Plug 'neovim/nvim-lspconfig'
|
||||
Plug 'hrsh7th/nvim-compe'
|
||||
Plug 'mattn/emmet-vim', {'on': ['EmmetInstall', 'Emmet']}
|
||||
Plug 'jiangmiao/auto-pairs'
|
||||
Plug 'mattn/emmet-vim', {'on': 'EmmetInstall'}
|
||||
" File explorer
|
||||
Plug 'junegunn/fzf.vim'
|
||||
Plug 'kyazdani42/nvim-tree.lua'
|
||||
" Git
|
||||
Plug 'lewis6991/gitsigns.nvim'
|
||||
" Theme
|
||||
Plug 'Smirnov-O/nten.vim'
|
||||
" Status line & Buffer line
|
||||
Plug 'hoob3rt/lualine.nvim'
|
||||
Plug 'romgrk/barbar.nvim'
|
||||
" Better syntax hl
|
||||
Plug 'sheerun/vim-polyglot'
|
||||
Plug 'norcalli/nvim-colorizer.lua'
|
||||
" Editor config
|
||||
Plug 'editorconfig/editorconfig-vim'
|
||||
" Other
|
||||
Plug 'vimwiki/vimwiki'
|
||||
Plug 'nvim-lua/plenary.nvim'
|
||||
call plug#end()
|
||||
|
||||
"== General
|
||||
colo codedark " Color scheme
|
||||
set termguicolors " GUI colors
|
||||
set nu rnu cul " 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
|
||||
let mapleader=";" " Set leader key
|
||||
set spr " Split
|
||||
set scrolloff=3
|
||||
set enc=utf-8 fenc=utf-8 " Encoding
|
||||
set list listchars=tab:\|·,trail:~,space:·
|
||||
colo nvcode
|
||||
let mapleader=";"
|
||||
|
||||
"== Tab(or spaces)
|
||||
set ts=4 sw=4 sts=4
|
||||
set sta et ai
|
||||
|
||||
"== Vim config
|
||||
source $HOME/.config/nvim/vimscript/config.vim
|
||||
|
||||
"== Tab line
|
||||
let bufferline = get(g:, 'bufferline', {})
|
||||
let g:bufferline.icons = v:false
|
||||
let g:bufferline.icon_close_tab = '🗴'
|
||||
source $HOME/.config/nvim/vimscript/barbar.vim
|
||||
|
||||
"== Status line
|
||||
lua require'lualine'.setup({options = {
|
||||
\ theme = "codedark"
|
||||
\ }})
|
||||
luafile $HOME/.config/nvim/lua/n-lualine.lua
|
||||
|
||||
"== File explorer
|
||||
luafile $HOME/.config/nvim/lua/n-nvimtree.lua
|
||||
|
||||
"== Git
|
||||
luafile $HOME/.config/nvim/lua/n-gitsigns.lua
|
||||
|
||||
"== Emmet
|
||||
let g:user_emmet_mode = "inc"
|
||||
let g:user_emmet_leader_key=','
|
||||
let g:user_emmet_settings = {'javascript': {
|
||||
\ 'extends': 'jsx'
|
||||
\ }}
|
||||
source $HOME/.config/nvim/vimscript/emmet.vim
|
||||
|
||||
"== Colorizer
|
||||
luafile $HOME/.config/nvim/lua/n-colorizer.lua
|
||||
|
||||
"== Notes
|
||||
let g:vimwiki_list = [{'path': '~/notes', 'syntax': 'markdown', 'ext': '.md'}]
|
||||
|
||||
"== Completion(LSP)
|
||||
ino <expr> <tab> pumvisible() ? "\<C-n>" : "\<tab>"
|
||||
ino <expr> <s-tab> pumvisible() ? "\<C-p>" : "\<tab>"
|
||||
ino <expr> <CR> compe#confirm('<CR>')
|
||||
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>
|
||||
|
|
@ -77,40 +78,17 @@ require'compe'.setup{
|
|||
}
|
||||
EOF
|
||||
|
||||
"== Netrw file tree
|
||||
let g:netrw_liststyle = 3
|
||||
let g:netrw_banner = 0
|
||||
let g:netrw_dirhistmax = 0
|
||||
|
||||
"== Custom setting for another files
|
||||
au FileType python,elm setl sw=4 ts=4
|
||||
au FileType javascript,javascriptreact,json,yaml setl sw=2 ts=2
|
||||
au FileType javascript,javascriptreact,css,scss,less EmmetInstall
|
||||
au FileType javascript,json,yaml,lua setl sw=2 ts=2
|
||||
au FileType javascript,vue,html,css,scss :EmmetInstall
|
||||
au FileType go setl noet sw=4 ts=4
|
||||
|
||||
"== Custom commands
|
||||
com! Prettier :sil !prettier -w %
|
||||
com! Term :vs|winc L|se nonu nornu|start|term
|
||||
com! GoFmt :sil !gofmt -w %
|
||||
com! Black :sil !black %
|
||||
|
||||
"== Mapping
|
||||
nn <C-s> :w<cr>
|
||||
nn <space> :noh<cr>
|
||||
tno <esc> <c-\><c-n>
|
||||
nn <leader>t :Term<cr>
|
||||
nn <leader>e :Ex<cr>
|
||||
nn <leader>j :bn<cr>
|
||||
nn <leader>k :bp<cr>
|
||||
nn <leader>w :bd<cr>
|
||||
nn <leader>; :FZF<cr>
|
||||
|
||||
nn <C-h> :wincmd h<cr>
|
||||
nn <C-j> :wincmd j<cr>
|
||||
nn <C-k> :wincmd k<cr>
|
||||
nn <C-l> :wincmd l<cr>
|
||||
|
||||
nn spv :vs<cr>
|
||||
nn sph :sp<cr>
|
||||
nn spk :winc K<cr>
|
||||
nn spl :winc L<cr>
|
||||
source $HOME/.config/nvim/vimscript/mappings.vim
|
||||
|
|
|
|||
13
config/nvim/lua/n-colorizer.lua
Normal file
13
config/nvim/lua/n-colorizer.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
require'colorizer'.setup(
|
||||
{'*';}, {
|
||||
mode = 'foreground';
|
||||
RGB = true; -- #RGB hex codes
|
||||
RRGGBB = true; -- #RRGGBB hex codes
|
||||
RRGGBBAA = false; -- #RRGGBBAA hex codes
|
||||
rgb_fn = true; -- CSS rgb() and rgba() functions
|
||||
hsl_fn = false; -- CSS hsl() and hsla() functions
|
||||
css = false; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
||||
css_fn = true; -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
||||
names = false; -- "Name" codes like Blue
|
||||
}
|
||||
)
|
||||
18
config/nvim/lua/n-gitsigns.lua
Normal file
18
config/nvim/lua/n-gitsigns.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
require'gitsigns'.setup {
|
||||
signs = {
|
||||
add = {hl = 'GitSignsAdd', text = '│'};
|
||||
change = {hl = 'GitSignsChange', text = '│'};
|
||||
delete = {hl = 'GitSignsDelete', text = '_'};
|
||||
topdelete = {hl = 'GitSignsDelete', text = '‾'};
|
||||
changedelete = {hl = 'GitSignsChange', text = '~'};
|
||||
};
|
||||
watch_index = {
|
||||
interval = 1000
|
||||
};
|
||||
current_line_blame = true,
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil,
|
||||
use_decoration_api = true,
|
||||
use_internal_diff = true,
|
||||
}
|
||||
5
config/nvim/lua/n-lualine.lua
Normal file
5
config/nvim/lua/n-lualine.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
require'lualine'.setup {
|
||||
options = {
|
||||
theme = "codedark"
|
||||
};
|
||||
}
|
||||
8
config/nvim/lua/n-nvimtree.lua
Normal file
8
config/nvim/lua/n-nvimtree.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
local S = vim.g
|
||||
|
||||
-- Settings
|
||||
S.nvim_tree_side = "right"
|
||||
S.nvim_tree_ignore = {".git", "node_modules", "venv"}
|
||||
S.nvim_tree_auto_close = 0
|
||||
S.nvim_tree_quit_on_open = 0
|
||||
S.nvim_tree_width = 24
|
||||
17
config/nvim/vimscript/barbar.vim
Normal file
17
config/nvim/vimscript/barbar.vim
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
" Settings
|
||||
let bufferline = get(g:, 'bufferline', {})
|
||||
let bufferline.icons = v:false
|
||||
let bufferline.icon_close_tab = '🗴'
|
||||
|
||||
" Mappings
|
||||
nno <A-1> :BufferGoto 1<cr>
|
||||
nno <A-2> :BufferGoto 2<cr>
|
||||
nno <A-3> :BufferGoto 3<cr>
|
||||
nno <A-4> :BufferGoto 4<cr>
|
||||
nno <A-5> :BufferGoto 5<cr>
|
||||
nno <A-6> :BufferGoto 6<cr>
|
||||
nno <A-7> :BufferGoto 7<cr>
|
||||
nno <A-8> :BufferGoto 8<cr>
|
||||
nno <A-9> :BufferGoto 9<cr>
|
||||
nno <C-w> :BufferClose<cr>
|
||||
nno <S-x> :BufferClose!<cr>
|
||||
23
config/nvim/vimscript/config.vim
Normal file
23
config/nvim/vimscript/config.vim
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
"== Vim config
|
||||
set termguicolors " GUI colors
|
||||
set nu rnu cul " 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
|
||||
6
config/nvim/vimscript/emmet.vim
Normal file
6
config/nvim/vimscript/emmet.vim
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
let g:user_emmet_mode = "in"
|
||||
let g:user_emmet_leader_key=','
|
||||
let g:user_emmet_settings = {
|
||||
\ 'javascript': {
|
||||
\ 'extends': 'jsx'
|
||||
\ }}
|
||||
27
config/nvim/vimscript/mappings.vim
Normal file
27
config/nvim/vimscript/mappings.vim
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
nno <C-s> :w<cr>
|
||||
nno <space> :noh<cr>
|
||||
nno <leader>t :Term<cr>
|
||||
nno <leader>e :NvimTreeToggle<cr>
|
||||
nno <leader>; :Files<cr>
|
||||
|
||||
" Buffer
|
||||
nno <leader>j :bn<cr>
|
||||
nno <leader>k :bp<cr>
|
||||
|
||||
" Terminal
|
||||
tno <esc> <c-\><c-n>
|
||||
tno <C-h> <c-\><cmd>:winc h<cr>
|
||||
tno <C-j> <c-\><cmd>:winc j<cr>
|
||||
tno <C-k> <c-\><cmd>:winc k<cr>
|
||||
tno <C-l> <c-\><cmd>:winc k<cr>
|
||||
|
||||
" Split
|
||||
nno <C-h> :winc h<cr>
|
||||
nno <C-j> :winc j<cr>
|
||||
nno <C-k> :winc k<cr>
|
||||
nno <C-l> :winc l<cr>
|
||||
|
||||
nno spv :vs<cr>
|
||||
nno sph :sp<cr>
|
||||
nno spk :winc K<cr>
|
||||
nno spl :winc L<cr>
|
||||
|
|
@ -8,6 +8,9 @@
|
|||
[core]
|
||||
editor = nvim
|
||||
|
||||
[init]
|
||||
defaultBranch = main
|
||||
|
||||
[alias]
|
||||
ad = add -A
|
||||
cm = commit -m
|
||||
|
|
|
|||
|
|
@ -4,11 +4,3 @@ Install
|
|||
```bash
|
||||
mv ~/vscode/settings.json ~/.config/Code/User
|
||||
```
|
||||
|
||||
Extensions
|
||||
- `ESlint` - eslint integration
|
||||
- `Prettier` - JS code formater
|
||||
- `GitLens` - Git integration
|
||||
- `Code spell` - Spell checker
|
||||
- `Ayu` - Color scheme
|
||||
- `Vim` - Vim mode
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
"workbench.sideBar.location": "right",
|
||||
"workbench.editor.untitled.hint": "hidden",
|
||||
"workbench.iconTheme": "vs-minimal",
|
||||
"workbench.startupEditor": "none",
|
||||
|
||||
"explorer.compactFolders": false,
|
||||
"explorer.confirmDragAndDrop": false,
|
||||
|
|
@ -35,10 +36,7 @@
|
|||
|
||||
"extensions.ignoreRecommendations": true,
|
||||
|
||||
"tabnine.experimentalAutoImports": true,
|
||||
|
||||
"prettier.semi": false,
|
||||
"html.format.enable": false,
|
||||
|
||||
"emmet.includeLanguages": {"javascript": "javascriptreact"},
|
||||
"[javascript]": {
|
||||
|
|
@ -48,5 +46,5 @@
|
|||
"[javascriptreact]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.tabSize": 2,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
2
zshrc
2
zshrc
|
|
@ -7,7 +7,7 @@ export EDITOR="nvim"
|
|||
export PATH="$HOME/bin:$HOME/.local/bin:$HOME/.golang/bin:$GOPATH/bin:$PATH"
|
||||
|
||||
## Oh my zsh
|
||||
plugins=(dotenv)
|
||||
plugins=(dotenv z)
|
||||
ZSH_THEME="simple"
|
||||
source "$HOME/.oh-my-zsh/oh-my-zsh.sh"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue