:set sidescroll=1
Credit: In vim, how to scroll horizontally, by just one character, when cursor reaches end of the window? [duplicate]
Thanks @iporsut for triggered my curiosity
Showing posts with label VIM. Show all posts
Showing posts with label VIM. Show all posts
Friday, March 27, 2015
Thursday, March 12, 2015
[VIM] Move screen before cursor reaching top or bottom
It's interesting that I didn't realize I had been living without this feature for years as a vim user. Thanks to @tenderlove and @searls for publishing their vim setup session video. In the beginning of this video, @tenderlove adds set scrolloff=2 to vimrc. scrolloff is a good config that everyone who's using vim should have in their vimrc.
What it does is to tell vim to move screen before cursor reaching 2 top or bottom lines (2 is an arbitrary number). Give it a try. I bet you'll like it.
I went observe on JetBrains' IDE, they are configured to behave the same with setting scrolloff=1 on vim.
What it does is to tell vim to move screen before cursor reaching 2 top or bottom lines (2 is an arbitrary number). Give it a try. I bet you'll like it.
I went observe on JetBrains' IDE, they are configured to behave the same with setting scrolloff=1 on vim.
Friday, March 29, 2013
[Fixed][VIM] E354: Invalid register name: '*'
This error occurs when you or some of your vim plugins try to access register '*' which is a system clipboard. In default Mac OSX vim, it is compiled without system clipboard support enable. You can check this by run command :version inside vim. In the result, you will see -clipboard. Disable is -, enable is +.
To solve this issue, you need to compile vim with +clipboard yourself. I suggest OSX users to use brew to help this process. Out-of-the-box brew compiles vim with +clipboard. To do this run
First you need to know the path of your new vim. Run
To solve this issue, you need to compile vim with +clipboard yourself. I suggest OSX users to use brew to help this process. Out-of-the-box brew compiles vim with +clipboard. To do this run
brew install vimThen you might need to create a new symbolic link from your vi command to point to the newly installed vim.
First you need to know the path of your new vim. Run
brew info vimYou should see something similar to /usr/local/Cellar/vim/7.3.875 in the result which means your vim binary file is at /usr/local/Cellar/vim/7.3.875/bin/vim. To create a new symbolic link for vi, first you need to remove the existing link
sudo rm /usr/bin/viThen you can create a new link.
sudo ln -s /usr/local/Cellar/vim/7.3.875/bin/vim /usr/bin/vi
Sunday, October 14, 2012
[VIM] + and * register don't work with clipboard on MacOSX
This problem is because VIM version that shipped with MacOSX doesn't enable xterm_clipboard. You can check this by run :version command in VIM. Enabled xterm_clipboard VIM must have +xterm_clipboard but the version shipped with MacOSX has -xterm_clipboard.
If you want it to be enabled, you need to compile VIM yourself with clipboard enabling flag.
If you want it to be enabled, you need to compile VIM yourself with clipboard enabling flag.
Sunday, November 6, 2011
[VIM] Make newly created file(s) available for search with FuzzyFinder
Once your FuzzyFinder has loaded current files, if you create a new file, you have to tell it to reload it by execute:-
Source: FuzzyFinder : buffer/file/command/tag/etc explorer with fuzzy matching
Thanks: @virasak
:FufRenewCache
Source: FuzzyFinder : buffer/file/command/tag/etc explorer with fuzzy matching
Thanks: @virasak
Saturday, September 17, 2011
[VIM, Mac OSX] How to enable build-in Mac OSX matchit plugin
Put these 2 lines to your .vimrc file
filetype plugin on
runtime macros/matchit.vim
Friday, September 9, 2011
Useful VIM command that I still can't remember
- “0p - pastes the last explicitly copied text
- :reg - Show a list of registers
- J - Merge current line With Next Line
- =, == - Fix indention
- u,U(in visual mode) - lower, uppercase
- q: - list command history
- q/ - list search history
- Ctrl ^ - go to previous buffer
- :w !sudo tee % - save readonly file
- diw - delete a word
- di(, da( - delete text inside/include ()
- di", da" - delete text inside/include ""
For rails.vim
- gf - open file from cursor
- :R{view,model,controller,spec} {file}
Tuesday, August 16, 2011
[VIM] Mostly use FuzzyFinder and NERDTree shortkeys
Basic VIM
- Open new horizontal split :sp file
- Open new vertical split :vs file
- Switch between split pane: Ctrl-w + { h|j|k|l }
- Rotate pane down/right: Ctrl-w + r
- For more, see Vim documentation: windows
FuzzyFinder
- Open in vertical split: Ctrl-k
- Open in horizontal split: Ctrl-j
NERDTree
- Open in vertical split: s
- Open new horizontal split :sp file
- Open new vertical split :vs file
- Switch between split pane: Ctrl-w + { h|j|k|l }
- Rotate pane down/right: Ctrl-w + r
- For more, see Vim documentation: windows
FuzzyFinder
- Open in vertical split: Ctrl-k
- Open in horizontal split: Ctrl-j
NERDTree
- Open in vertical split: s
Monday, July 25, 2011
More advance commands for moving cursor and screen in VI
These are VI commands I have just learned today
F = reverse of f
t = f and step back 1 char
T = reverse of t
; = repeat f, F, t and T
H = Move cursor to first line of the screen
M = Move cursor to middle of the screen
L = Move cursor to last line of the screen
z. || zz = Move screen to make cursor to middle of the screen
zt = Move screen to make cursor to top of the screen
zb = Move screen to make cursor to bottom of the screen
Ctrl+f = Scroll down 1 screen (Ctrl+d only half screen)
Ctrl+b = reverse of Ctrl+f
Ctrl+e = Move screen down 1 line with the cursor try to stay at the sameline
Ctrl+y = reverse of Ctrl+y
F = reverse of f
t = f and step back 1 char
T = reverse of t
; = repeat f, F, t and T
H = Move cursor to first line of the screen
M = Move cursor to middle of the screen
L = Move cursor to last line of the screen
z. || zz = Move screen to make cursor to middle of the screen
zt = Move screen to make cursor to top of the screen
zb = Move screen to make cursor to bottom of the screen
Ctrl+f = Scroll down 1 screen (Ctrl+d only half screen)
Ctrl+b = reverse of Ctrl+f
Ctrl+e = Move screen down 1 line with the cursor try to stay at the sameline
Ctrl+y = reverse of Ctrl+y
Tuesday, June 21, 2011
Monday, May 10, 2010
VIM - How to format and syntax highlight JSON file
Formatting
Run this command in shell
sudo cpan JSON::XS
Put this line to ~/.vimrc
map <leader>jt <Esc>:%!json_xs -f json -t json-pretty<CR>
- When want to format JSON file press
\jt
- credit : “tidify” a json in vim
- Download json.vim form http://www.vim.org/scripts/script.php?script_id=1945 to ~/.vim/syntax/
- Put this line to ~/.vimrc
au BufRead,BufNewFile *.json set filetype=json
- credit : Add JSON syntax highlighting in Vim on OS X
Friday, April 23, 2010
VIM - How to format Html source code
- :filetype indent on
- :set filetype=html
- :set shiftwidth=n (n = indent size)
- :set smartindent
- gg=G (gg = top of file, = is a shortcut of re-tindent, G = botton of file)
For 1,3,4 , you can predefine at .vimrc. While editing Html file, just do 2 and 5
VIM - How to format JavaScript source code
- Download this plugin jsbeautify
- Copy it to $HOME/.vim/plugin/
- In Vim, while you want to format JavaScript code, press \ff*
Saturday, December 20, 2008
VIM - tab size & tab to space setting
to change tab size use this command
:set ts=n
(n=expected size ,ts=tabstop)
to change tab to space use this command
:set et
(et = expandtab)
also invoke it together like this
:set ts=4 et
if you want permanent changing, add command above to file named .vimrc (normally is at your home folder)
:set ts=n
(n=expected size ,ts=tabstop)
to change tab to space use this command
:set et
(et = expandtab)
also invoke it together like this
:set ts=4 et
if you want permanent changing, add command above to file named .vimrc (normally is at your home folder)
Subscribe to:
Posts (Atom)
Collectd PostgreSQL Plugin
I couldn't find this link when searching with google https://www.collectd.org/documentation/manpages/collectd.conf.html#plugin-postgresq...
-
sudo su postgres supply your Mac password modify /Library/PostgreSQL/9.x/data/pg_hba.conf from local all all md5 to local all all ...
-
Put your cursor on the text box of the post/comment you want to indent Go to the menubar at the top of the screen Edit > Emoji & ...
-
I ran to this error the other day when I tried to export a dump file from a slave Postgres database. cpg_dump: Dumping the contents of ta...