Repository navigation
Expand file tree
/
Copy pathinit.vim
More file actions
173 lines (131 loc) · 4.57 KB
/
Copy pathinit.vim
File metadata and controls
173 lines (131 loc) · 4.57 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
let @/=""
set relativenumber
set number
set smartcase
set backspace=indent,eol,start
set hlsearch
set autoindent
set scrolloff=3
set cursorline
" set textwidth=120
" set colorcolumn=+3
" smartcase search
set ignorecase
set smartcase
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
set autoread
au FocusGained,BufEnter * checktime
highlight CursorLine cterm=NONE ctermbg=NONE ctermfg=NONE guibg=NONE guifg=NONE
set cursorline
filetype plugin indent on
syntax on
au BufNewFile,BufRead *.ejs set filetype=html
call plug#begin()
Plug 'ThePrimeagen/harpoon'
Plug 'ThePrimeagen/vim-be-good'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'folke/tokyonight.nvim', { 'branch': 'main' }
Plug 'ryanoasis/vim-devicons'
Plug 'kyazdani42/nvim-web-devicons' " for file icons
Plug 'kyazdani42/nvim-tree.lua'
Plug 'jiangmiao/auto-pairs'
Plug 'styled-components/vim-styled-components', { 'branch': 'main' }
" coc extensions
Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}
" Plug 'iamcco/coc-tailwindcss', {'do': 'yarn install --frozen-lockfile && yarn run build'}
Plug 'tpope/vim-commentary'
Plug 'sbdchd/neoformat'
" post install (yarn install | npm install) then load plugin only for editing supported files
Plug 'prettier/vim-prettier', { 'do': 'yarn install --frozen-lockfile --production' }
Plug 'ianks/vim-tsx'
Plug 'leafgarland/typescript-vim'
Plug 'tpope/vim-surround'
" telescope requirements
Plug 'nvim-lua/popup.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'nvim-telescope/telescope-fzy-native.nvim'
Plug 'BurntSushi/ripgrep'
call plug#end()
let g:coc_global_extensions = ['coc-tslint-plugin', 'coc-tsserver', 'coc-emmet', 'coc-css', 'coc-html', 'coc-json', 'coc-yank']
" gt will show the type of whatever you hover on
nnoremap <silent> gt :call CocAction('doHover')<CR>
" Move 1 more lines up or down in normal and visual selection modes.
nnoremap K :m .-2<CR>==
nnoremap J :m .+1<CR>==
vnoremap K :m '<-2<CR>gv=gv
vnoremap J :m '>+1<CR>gv=gv
function! ShowDocIfNoDiagnostic(timer_id)
if (coc#float#has_float() == 0 && CocHasProvider('hover') == 1)
silent call CocActionAsync('doHover')
endif
endfunction
function! s:show_hover_doc()
call timer_start(500, 'ShowDocIfNoDiagnostic')
endfunction
autocmd CursorHoldI * :call <SID>show_hover_doc()
autocmd CursorHold * :call <SID>show_hover_doc()
" go to definition, etc
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gr <Plug>(coc-references)
" == AUTOCMD ================================
" by default .ts file are not identified as typescript and .tsx files are not
" identified as typescript react file, so add following
au BufNewFile,BufRead *.ts setlocal filetype=typescript
au BufNewFile,BufRead *.tsx setlocal filetype=typescript.tsx
let g:prettier#autoformat = 1
let g:prettier#autoformat_require_pragma = 0
" == AUTOCMD END ================================
set termguicolors
if $NVIM_PLUGIN_INSTALLING == ""
lua << EOF
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
additional_vim_regex_highlighting = true,
},
}
require'nvim-tree'.setup()
EOF
" italics support
set t_ZH=^[[3m
set t_ZR=^[[23m
let &t_ZH="\e[3m"
let &t_ZR="\e[23m"
let g:tokyonight_colors = {
\ 'comment': '#899ddf',
\ }
let g:tokyonight_style = "day"
colorscheme tokyonight
else
echo "skipping install step"
endif
nnoremap <leader>sv :source $MYVIMRC<CR>
autocmd BufWritePre * :%s/\s\+$//e
nnoremap <CR><CR> :noh<return>
cabb W w
cabb Q q
" Best practice override this with a prettierrc every time.
let g:prettier#preset#config = get(g:,'prettier#preset#config', 'fb')
nnoremap <C-n> :NvimTreeToggle<CR>
nnoremap <leader>r :NvimTreeRefresh<CR>
nnoremap <leader>n :NvimTreeFindFile<CR>
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>
nnoremap s o<Esc>k
nnoremap <C-d> "_d
nnoremap <C-g> <cmd>lua require("harpoon.ui").toggle_quick_menu()<cr>
" mnemonic mark-file
nnoremap mf <cmd>lua require("harpoon.mark").add_file()<cr>
nnoremap m1 <cmd>lua require("harpoon.ui").nav_file(1)<cr>
nnoremap m2 <cmd>lua require("harpoon.ui").nav_file(2)<cr>
nnoremap m3 <cmd>lua require("harpoon.ui").nav_file(3)<cr>
nnoremap m4 <cmd>lua require("harpoon.ui").nav_file(4)<cr>
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<CR>"